From 38933afdd95f9e809c2e3a15ff860d22b22f27c4 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Wed, 20 Jan 2016 21:54:21 +0100 Subject: introduce + use new generic vty_get_phy_instance() this function is intended to be used by VTY commands that need to resolve a given PHY interface. --- src/common/vty.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/common/vty.c') diff --git a/src/common/vty.c b/src/common/vty.c index 94ccdbe7..7488fbba 100644 --- a/src/common/vty.c +++ b/src/common/vty.c @@ -51,6 +51,26 @@ #include #include +struct phy_instance *vty_get_phy_instance(struct vty *vty, int phy_nr, int inst_nr) +{ + struct phy_link *plink = phy_link_by_num(phy_nr); + struct phy_instance *pinst; + + if (!plink) { + vty_out(vty, "Cannot find PHY link number %d%s", + phy_nr, VTY_NEWLINE); + return NULL; + } + + pinst = phy_instance_by_num(plink, inst_nr); + if (!pinst) { + vty_out(vty, "Cannot find PHY instance number %d%s", + inst_nr, VTY_NEWLINE); + return NULL; + } + return pinst; +} + int bts_vty_go_parent(struct vty *vty) { switch (vty->node) { -- cgit v1.2.3