diff options
author | Harald Welte <laforge@gnumonks.org> | 2010-05-19 19:45:32 +0200 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2010-05-25 23:40:38 +0200 |
commit | 4b037e4117c0c1e02a516c8b3374444f438c70e1 (patch) | |
tree | c2c02920c333c33f728b4d3dbe63a45635b1b61b /openbsc/src/common_vty.c | |
parent | 4f1e81543abea8cfb6b55c09e342831863d7a134 (diff) |
Migrate VTY code to libosmovty
Diffstat (limited to 'openbsc/src/common_vty.c')
-rw-r--r-- | openbsc/src/common_vty.c | 52 |
1 files changed, 48 insertions, 4 deletions
diff --git a/openbsc/src/common_vty.c b/openbsc/src/common_vty.c index 4f18a74e7..eb0d29e38 100644 --- a/openbsc/src/common_vty.c +++ b/openbsc/src/common_vty.c @@ -25,15 +25,59 @@ #include <osmocore/talloc.h> #include <openbsc/vty.h> -#include <openbsc/telnet_interface.h> #include <openbsc/gsm_data.h> #include <openbsc/debug.h> +#include <openbsc/gsm_subscriber.h> -#include <vty/command.h> -#include <vty/buffer.h> -#include <vty/vty.h> +#include <osmocom/vty/telnet_interface.h> +#include <osmocom/vty/command.h> +#include <osmocom/vty/buffer.h> +#include <osmocom/vty/vty.h> +int bsc_vty_go_parent(struct vty *vty) +{ + switch (vty->node) { + case GSMNET_NODE: + vty->node = CONFIG_NODE; + vty->index = NULL; + break; + case BTS_NODE: + vty->node = GSMNET_NODE; + { + /* set vty->index correctly ! */ + struct gsm_bts *bts = vty->index; + vty->index = bts->network; + } + break; + case TRX_NODE: + vty->node = BTS_NODE; + { + /* set vty->index correctly ! */ + struct gsm_bts_trx *trx = vty->index; + vty->index = trx->bts; + } + break; + case TS_NODE: + vty->node = TRX_NODE; + { + /* set vty->index correctly ! */ + struct gsm_bts_trx_ts *ts = vty->index; + vty->index = ts->trx; + } + break; + case SUBSCR_NODE: + vty->node = VIEW_NODE; + subscr_put(vty->index); + vty->index = NULL; + break; + default: + vty->node = CONFIG_NODE; + } + + return vty->node; +} + /* Down vty node level. */ gDEFUN(ournode_exit, ournode_exit_cmd, "exit", "Exit current mode and down to previous mode\n") |