diff --git a/openbsc/include/vty/command.h b/openbsc/include/vty/command.h index 99fba47d9..1b6e0a7b7 100644 --- a/openbsc/include/vty/command.h +++ b/openbsc/include/vty/command.h @@ -350,6 +350,7 @@ struct desc { void install_node(struct cmd_node *, int (*)(struct vty *)); void install_default(enum node_type); void install_element(enum node_type, struct cmd_element *); +void install_element_ve(struct cmd_element *cmd); void sort_node(); /* Concatenates argv[shift] through argv[argc-1] into a single NUL-terminated diff --git a/openbsc/src/vty/command.c b/openbsc/src/vty/command.c index fe29824ba..a1130b68e 100644 --- a/openbsc/src/vty/command.c +++ b/openbsc/src/vty/command.c @@ -478,6 +478,13 @@ void install_element(enum node_type ntype, struct cmd_element *cmd) cmd->cmdsize = cmd_cmdsize(cmd->strvec); } +/* Install a command into VIEW and ENABLE node */ +void install_element_ve(struct cmd_element *cmd) +{ + install_element(VIEW_NODE, cmd); + install_element(ENABLE_NODE, cmd); +} + #ifdef VTY_CRYPT_PW static unsigned char itoa64[] = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; diff --git a/openbsc/src/vty_interface.c b/openbsc/src/vty_interface.c index 48dce9e4e..acfdd94de 100644 --- a/openbsc/src/vty_interface.c +++ b/openbsc/src/vty_interface.c @@ -1904,17 +1904,17 @@ int bsc_vty_init(struct gsm_network *net) cmd_init(1); vty_init(); - install_element(VIEW_NODE, &show_net_cmd); - install_element(VIEW_NODE, &show_bts_cmd); - install_element(VIEW_NODE, &show_trx_cmd); - install_element(VIEW_NODE, &show_ts_cmd); - install_element(VIEW_NODE, &show_lchan_cmd); + install_element_ve(&show_net_cmd); + install_element_ve(&show_bts_cmd); + install_element_ve(&show_trx_cmd); + install_element_ve(&show_ts_cmd); + install_element_ve(&show_lchan_cmd); - install_element(VIEW_NODE, &show_e1drv_cmd); - install_element(VIEW_NODE, &show_e1line_cmd); - install_element(VIEW_NODE, &show_e1ts_cmd); + install_element_ve(&show_e1drv_cmd); + install_element_ve(&show_e1line_cmd); + install_element_ve(&show_e1ts_cmd); - install_element(VIEW_NODE, &show_paging_cmd); + install_element_ve(&show_paging_cmd); openbsc_vty_add_cmds(); diff --git a/openbsc/src/vty_interface_cmds.c b/openbsc/src/vty_interface_cmds.c index 31818925f..dd5e108ab 100644 --- a/openbsc/src/vty_interface_cmds.c +++ b/openbsc/src/vty_interface_cmds.c @@ -324,14 +324,13 @@ void openbsc_vty_print_statistics(struct vty *vty, struct gsm_network *net) void openbsc_vty_add_cmds() { - install_element(VIEW_NODE, &enable_logging_cmd); - install_element(VIEW_NODE, &disable_logging_cmd); - install_element(VIEW_NODE, &logging_fltr_imsi_cmd); - install_element(VIEW_NODE, &logging_fltr_all_cmd); - install_element(VIEW_NODE, &logging_use_clr_cmd); - install_element(VIEW_NODE, &logging_prnt_timestamp_cmd); - install_element(VIEW_NODE, &logging_set_category_mask_cmd); - install_element(VIEW_NODE, &logging_level_cmd); - install_element(VIEW_NODE, &show_logging_vty_cmd); - + install_element_ve(&enable_logging_cmd); + install_element_ve(&disable_logging_cmd); + install_element_ve(&logging_fltr_imsi_cmd); + install_element_ve(&logging_fltr_all_cmd); + install_element_ve(&logging_use_clr_cmd); + install_element_ve(&logging_prnt_timestamp_cmd); + install_element_ve(&logging_set_category_mask_cmd); + install_element_ve(&logging_level_cmd); + install_element_ve(&show_logging_vty_cmd); } diff --git a/openbsc/src/vty_interface_layer3.c b/openbsc/src/vty_interface_layer3.c index fee5baee5..1b2adbbc7 100644 --- a/openbsc/src/vty_interface_layer3.c +++ b/openbsc/src/vty_interface_layer3.c @@ -544,16 +544,16 @@ int bsc_vty_init_extra(struct gsm_network *net) register_signal_handler(SS_SCALL, scall_cbfn, NULL); - install_element(VIEW_NODE, &show_subscr_cmd); - install_element(VIEW_NODE, &show_subscr_cache_cmd); + install_element_ve(&show_subscr_cmd); + install_element_ve(&show_subscr_cache_cmd); - install_element(VIEW_NODE, &sms_send_pend_cmd); + install_element_ve(&sms_send_pend_cmd); - install_element(VIEW_NODE, &subscriber_send_sms_cmd); - install_element(VIEW_NODE, &subscriber_silent_sms_cmd); - install_element(VIEW_NODE, &subscriber_silent_call_start_cmd); - install_element(VIEW_NODE, &subscriber_silent_call_stop_cmd); - install_element(VIEW_NODE, &show_stats_cmd); + install_element_ve(&subscriber_send_sms_cmd); + install_element_ve(&subscriber_silent_sms_cmd); + install_element_ve(&subscriber_silent_call_start_cmd); + install_element_ve(&subscriber_silent_call_stop_cmd); + install_element_ve(&show_stats_cmd); install_element(CONFIG_NODE, &cfg_subscr_cmd); install_node(&subscr_node, dummy_config_write);