diff options
author | Harald Welte <laforge@gnumonks.org> | 2010-05-14 18:59:17 +0200 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2010-05-14 18:59:17 +0200 |
commit | 62ab20c5dd85bb8c14a44af73b674494447318e7 (patch) | |
tree | b030427bde17387c6159d8712d74f91bf62edfa5 /openbsc/src/vty_interface_cmds.c | |
parent | 197dea95ff55acd86d5800f5a1cf7e339b24064d (diff) |
[VTY] Remove OpenBSC specific node-exit handling from src/vty
The idea is to move the VTY code into libosmocore at some point,
and for that we need to eliminate OpenBSC specifics from it
Diffstat (limited to 'openbsc/src/vty_interface_cmds.c')
-rw-r--r-- | openbsc/src/vty_interface_cmds.c | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/openbsc/src/vty_interface_cmds.c b/openbsc/src/vty_interface_cmds.c index 4e5dc2919..134a8d3a3 100644 --- a/openbsc/src/vty_interface_cmds.c +++ b/openbsc/src/vty_interface_cmds.c @@ -71,6 +71,55 @@ struct log_target *log_target_create_vty(struct vty *vty) return target; } +/* Down vty node level. */ +gDEFUN(ournode_exit, + ournode_exit_cmd, "exit", "Exit current mode and down to previous mode\n") +{ + 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; + vty->index_sub = NULL; + } + break; + case TRX_NODE: + vty->node = BTS_NODE; + { + /* set vty->index correctly ! */ + struct gsm_bts_trx *trx = vty->index; + vty->index = trx->bts; + vty->index_sub = &trx->bts->description; + } + break; + case TS_NODE: + vty->node = TRX_NODE; + { + /* set vty->index correctly ! */ + struct gsm_bts_trx_ts *ts = vty->index; + vty->index = ts->trx; + vty->index_sub = &ts->trx->description; + } + break; + case MGCP_NODE: + case GBPROXY_NODE: + case SGSN_NODE: + case NS_NODE: + vty->node = CONFIG_NODE; + vty->index = NULL; + break; + default: + break; + } + return CMD_SUCCESS; +} + DEFUN(enable_logging, enable_logging_cmd, "logging enable", |