aboutsummaryrefslogtreecommitdiffstats
path: root/src/common/vty.c
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2016-01-20 21:54:21 +0100
committerHarald Welte <laforge@gnumonks.org>2016-02-15 14:27:16 +0100
commit38933afdd95f9e809c2e3a15ff860d22b22f27c4 (patch)
treea90f70e2bf43158a5527b0965b6ad5dc724cb18d /src/common/vty.c
parent6a0f0f9e21e46055dd8481036c75f49d89863639 (diff)
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.
Diffstat (limited to 'src/common/vty.c')
-rw-r--r--src/common/vty.c20
1 files changed, 20 insertions, 0 deletions
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 <osmo-bts/vty.h>
#include <osmo-bts/l1sap.h>
+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) {