aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/vty
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2010-05-14 18:59:17 +0200
committerHarald Welte <laforge@gnumonks.org>2010-05-14 18:59:17 +0200
commit62ab20c5dd85bb8c14a44af73b674494447318e7 (patch)
treeb030427bde17387c6159d8712d74f91bf62edfa5 /openbsc/src/vty
parent197dea95ff55acd86d5800f5a1cf7e339b24064d (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')
-rw-r--r--openbsc/src/vty/command.c49
-rw-r--r--openbsc/src/vty/vty.c4
2 files changed, 6 insertions, 47 deletions
diff --git a/openbsc/src/vty/command.c b/openbsc/src/vty/command.c
index a1130b68e..811cbf17b 100644
--- a/openbsc/src/vty/command.c
+++ b/openbsc/src/vty/command.c
@@ -2322,39 +2322,6 @@ gDEFUN(config_exit,
config_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;
- }
- 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;
case VIEW_NODE:
case ENABLE_NODE:
if (0) //vty_shell (vty))
@@ -2369,22 +2336,12 @@ gDEFUN(config_exit,
case VTY_NODE:
vty->node = CONFIG_NODE;
break;
- case MGCP_NODE:
- case GBPROXY_NODE:
- case SGSN_NODE:
- case NS_NODE:
- vty->node = CONFIG_NODE;
- vty->index = NULL;
default:
break;
}
return CMD_SUCCESS;
}
-/* quit is alias of exit. */
-gALIAS(config_exit,
- config_quit_cmd, "quit", "Exit current mode and down to previous mode\n")
-
/* End of configuration. */
gDEFUN(config_end,
config_end_cmd, "end", "End current mode and change to enable mode.")
@@ -3333,9 +3290,6 @@ void host_config_set(const char *filename)
void install_default(enum node_type node)
{
- install_element(node, &config_exit_cmd);
- install_element(node, &config_quit_cmd);
- install_element(node, &config_end_cmd);
install_element(node, &config_help_cmd);
install_element(node, &config_list_cmd);
@@ -3374,7 +3328,6 @@ void cmd_init(int terminal)
if (terminal) {
install_element(VIEW_NODE, &config_list_cmd);
install_element(VIEW_NODE, &config_exit_cmd);
- install_element(VIEW_NODE, &config_quit_cmd);
install_element(VIEW_NODE, &config_help_cmd);
install_element(VIEW_NODE, &config_enable_cmd);
install_element(VIEW_NODE, &config_terminal_length_cmd);
@@ -3383,6 +3336,7 @@ void cmd_init(int terminal)
}
if (terminal) {
+ install_element(ENABLE_NODE, &config_exit_cmd);
install_default(ENABLE_NODE);
install_element(ENABLE_NODE, &config_disable_cmd);
install_element(ENABLE_NODE, &config_terminal_cmd);
@@ -3397,6 +3351,7 @@ void cmd_init(int terminal)
install_element(ENABLE_NODE, &echo_cmd);
install_default(CONFIG_NODE);
+ install_element(CONFIG_NODE, &config_exit_cmd);
}
install_element(CONFIG_NODE, &hostname_cmd);
diff --git a/openbsc/src/vty/vty.c b/openbsc/src/vty/vty.c
index 08068560b..986902a01 100644
--- a/openbsc/src/vty/vty.c
+++ b/openbsc/src/vty/vty.c
@@ -731,6 +731,8 @@ static void vty_backward_word(struct vty *vty)
static void vty_down_level(struct vty *vty)
{
vty_out(vty, "%s", VTY_NEWLINE);
+ /* FIXME: we need to call the exit function of the specific node
+ * in question, not this generic one that doesn't know all nodes */
(*config_exit_cmd.func) (NULL, vty, 0, NULL);
vty_prompt(vty);
vty->cp = 0;
@@ -741,6 +743,8 @@ static void vty_end_config(struct vty *vty)
{
vty_out(vty, "%s", VTY_NEWLINE);
+ /* FIXME: we need to call the exit function of the specific node
+ * in question, not this generic one that doesn't know all nodes */
switch (vty->node) {
case VIEW_NODE:
case ENABLE_NODE: