jolly has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-e1d/+/43686?usp=email )
Change subject: Use VTY node defintion from libosmocore ......................................................................
Use VTY node defintion from libosmocore
Depends-on: I497ee1503fed1681fae217bfe4d7be9b1580448f (libosmocore) Change-Id: I1e176362eba4966ad6c249831d6a82d0ed4ea6d5 --- M src/octoi/octoi.c M src/octoi/octoi.h M src/octoi/octoi_clnt_vty.c M src/octoi/octoi_srv_vty.c 4 files changed, 42 insertions(+), 51 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-e1d refs/changes/86/43686/1
diff --git a/src/octoi/octoi.c b/src/octoi/octoi.c index 8d8d3da..9a80f11 100644 --- a/src/octoi/octoi.c +++ b/src/octoi/octoi.c @@ -46,16 +46,16 @@ struct octoi_client *clnt;
switch (vty->node) { - case OCTOI_ACCOUNT_NODE: - vty->node = OCTOI_SRV_NODE; + case L_OCTOI_ACCOUNT_NODE: + vty->node = L_OCTOI_SRV_NODE; vty->index = g_octoi->server; break; - case OCTOI_CLNT_ACCOUNT_NODE: + case L_OCTOI_CLNT_ACCOUNT_NODE: acc = vty->index; - vty->node = OCTOI_CLNT_NODE; + vty->node = L_OCTOI_CLNT_NODE; vty->index = client4account(acc); break; - case OCTOI_CLNT_NODE: + case L_OCTOI_CLNT_NODE: clnt = vty->index; /* check if we have a (new?) line for this client */ if (g_octoi->ops->client_updated) diff --git a/src/octoi/octoi.h b/src/octoi/octoi.h index 589c208..4505e3c 100644 --- a/src/octoi/octoi.h +++ b/src/octoi/octoi.h @@ -8,15 +8,6 @@
#include <osmocom/octoi/octoi.h>
-/* FIXME: migrate to libosmocore/vty/command.h */ -enum octoi_vty_node { - OCTOI_SRV_NODE = RESERVED1_NODE, - OCTOI_ACCOUNT_NODE, - OCTOI_CLNT_NODE, - OCTOI_CLNT_ACCOUNT_NODE, -}; - - extern struct osmo_fsm octoi_server_fsm; extern struct osmo_fsm octoi_client_fsm;
diff --git a/src/octoi/octoi_clnt_vty.c b/src/octoi/octoi_clnt_vty.c index 3ea3a9a..7323c71 100644 --- a/src/octoi/octoi_clnt_vty.c +++ b/src/octoi/octoi_clnt_vty.c @@ -76,13 +76,13 @@ ***********************************************************************/
static struct cmd_node clnt_node = { - (enum node_type) OCTOI_CLNT_NODE, + (enum node_type) L_OCTOI_CLNT_NODE, "%s(config-octoi-client)# ", 1, };
static struct cmd_node clnt_account_node = { - (enum node_type) OCTOI_CLNT_ACCOUNT_NODE, + (enum node_type) L_OCTOI_CLNT_ACCOUNT_NODE, "%s(config-octoi-client-account)# ", 1, }; @@ -104,7 +104,7 @@ llist_add_tail(&clnt->list, &g_octoi->clients); }
- vty->node = OCTOI_CLNT_NODE; + vty->node = L_OCTOI_CLNT_NODE; vty->index = clnt;
return CMD_SUCCESS; @@ -227,7 +227,7 @@ } else osmo_talloc_replace_string(ac, &ac->user_id, user_id);
- vty->node = OCTOI_CLNT_ACCOUNT_NODE; + vty->node = L_OCTOI_CLNT_ACCOUNT_NODE; vty->index = ac;
return CMD_SUCCESS; @@ -277,23 +277,23 @@ install_element_ve(&show_clnt_cmd);
install_node(&clnt_account_node, NULL); - install_element(OCTOI_CLNT_ACCOUNT_NODE, &cfg_account_ice1_serno_cmd); - install_element(OCTOI_CLNT_ACCOUNT_NODE, &cfg_account_ice1_line_cmd); - install_element(OCTOI_CLNT_ACCOUNT_NODE, &cfg_account_mode_cmd); - install_element(OCTOI_CLNT_ACCOUNT_NODE, &cfg_account_batching_factor_cmd); - install_element(OCTOI_CLNT_ACCOUNT_NODE, &cfg_account_force_all_ts_cmd); - install_element(OCTOI_CLNT_ACCOUNT_NODE, &cfg_account_no_force_all_ts_cmd); - install_element(OCTOI_CLNT_ACCOUNT_NODE, &cfg_account_prefill_frame_count_cmd); - install_element(OCTOI_CLNT_ACCOUNT_NODE, &cfg_account_buffer_reset_cmd); + install_element(L_OCTOI_CLNT_ACCOUNT_NODE, &cfg_account_ice1_serno_cmd); + install_element(L_OCTOI_CLNT_ACCOUNT_NODE, &cfg_account_ice1_line_cmd); + install_element(L_OCTOI_CLNT_ACCOUNT_NODE, &cfg_account_mode_cmd); + install_element(L_OCTOI_CLNT_ACCOUNT_NODE, &cfg_account_batching_factor_cmd); + install_element(L_OCTOI_CLNT_ACCOUNT_NODE, &cfg_account_force_all_ts_cmd); + install_element(L_OCTOI_CLNT_ACCOUNT_NODE, &cfg_account_no_force_all_ts_cmd); + install_element(L_OCTOI_CLNT_ACCOUNT_NODE, &cfg_account_prefill_frame_count_cmd); + install_element(L_OCTOI_CLNT_ACCOUNT_NODE, &cfg_account_buffer_reset_cmd); #ifdef HAVE_DAHDI_TRUNKDEV - install_element(OCTOI_CLNT_ACCOUNT_NODE, &cfg_account_trunkdev_name_cmd); - install_element(OCTOI_CLNT_ACCOUNT_NODE, &cfg_account_trunkdev_line_cmd); + install_element(L_OCTOI_CLNT_ACCOUNT_NODE, &cfg_account_trunkdev_name_cmd); + install_element(L_OCTOI_CLNT_ACCOUNT_NODE, &cfg_account_trunkdev_line_cmd); #endif /* HAVE_DAHDI_TRUNKDEV */
install_node(&clnt_node, config_write_octoi_clnt); install_element(CONFIG_NODE, &cfg_client_cmd); - install_element(OCTOI_CLNT_NODE, &cfg_clnt_local_cmd); - install_element(OCTOI_CLNT_NODE, &cfg_clnt_dscp_cmd); - install_element(OCTOI_CLNT_NODE, &cfg_clnt_prio_cmd); - install_element(OCTOI_CLNT_NODE, &cfg_clnt_account_cmd); + install_element(L_OCTOI_CLNT_NODE, &cfg_clnt_local_cmd); + install_element(L_OCTOI_CLNT_NODE, &cfg_clnt_dscp_cmd); + install_element(L_OCTOI_CLNT_NODE, &cfg_clnt_prio_cmd); + install_element(L_OCTOI_CLNT_NODE, &cfg_clnt_account_cmd); } diff --git a/src/octoi/octoi_srv_vty.c b/src/octoi/octoi_srv_vty.c index 05a99a4..32fe3c6 100644 --- a/src/octoi/octoi_srv_vty.c +++ b/src/octoi/octoi_srv_vty.c @@ -123,13 +123,13 @@ ***********************************************************************/
static struct cmd_node srv_node = { - (enum node_type) OCTOI_SRV_NODE, + (enum node_type) L_OCTOI_SRV_NODE, "%s(config-octoi-server)# ", 1, };
static struct cmd_node account_node = { - (enum node_type) OCTOI_ACCOUNT_NODE, + (enum node_type) L_OCTOI_ACCOUNT_NODE, "%s(config-octoi-server-account)# ", 1, }; @@ -144,7 +144,7 @@ srv = g_octoi->server = octoi_server_alloc(g_octoi); OSMO_ASSERT(srv);
- vty->node = OCTOI_SRV_NODE; + vty->node = L_OCTOI_SRV_NODE; vty->index = srv;
return CMD_SUCCESS; @@ -264,7 +264,7 @@ if (!ac) return CMD_WARNING;
- vty->node = OCTOI_ACCOUNT_NODE; + vty->node = L_OCTOI_ACCOUNT_NODE; vty->index = ac;
return CMD_SUCCESS; @@ -566,26 +566,26 @@ install_element_ve(&show_server_cmd);
install_node(&account_node, NULL); - install_element(OCTOI_ACCOUNT_NODE, &cfg_account_mode_cmd); - install_element(OCTOI_ACCOUNT_NODE, &cfg_account_ice1_serno_cmd); - install_element(OCTOI_ACCOUNT_NODE, &cfg_account_ice1_line_cmd); - install_element(OCTOI_ACCOUNT_NODE, &cfg_account_redir_cmd); - install_element(OCTOI_ACCOUNT_NODE, &cfg_account_batching_factor_cmd); - install_element(OCTOI_ACCOUNT_NODE, &cfg_account_force_all_ts_cmd); - install_element(OCTOI_ACCOUNT_NODE, &cfg_account_no_force_all_ts_cmd); - install_element(OCTOI_ACCOUNT_NODE, &cfg_account_prefill_frame_count_cmd); - install_element(OCTOI_ACCOUNT_NODE, &cfg_account_buffer_reset_cmd); + install_element(L_OCTOI_ACCOUNT_NODE, &cfg_account_mode_cmd); + install_element(L_OCTOI_ACCOUNT_NODE, &cfg_account_ice1_serno_cmd); + install_element(L_OCTOI_ACCOUNT_NODE, &cfg_account_ice1_line_cmd); + install_element(L_OCTOI_ACCOUNT_NODE, &cfg_account_redir_cmd); + install_element(L_OCTOI_ACCOUNT_NODE, &cfg_account_batching_factor_cmd); + install_element(L_OCTOI_ACCOUNT_NODE, &cfg_account_force_all_ts_cmd); + install_element(L_OCTOI_ACCOUNT_NODE, &cfg_account_no_force_all_ts_cmd); + install_element(L_OCTOI_ACCOUNT_NODE, &cfg_account_prefill_frame_count_cmd); + install_element(L_OCTOI_ACCOUNT_NODE, &cfg_account_buffer_reset_cmd); #ifdef HAVE_DAHDI_TRUNKDEV - install_element(OCTOI_ACCOUNT_NODE, &cfg_account_trunkdev_name_cmd); - install_element(OCTOI_ACCOUNT_NODE, &cfg_account_trunkdev_line_cmd); + install_element(L_OCTOI_ACCOUNT_NODE, &cfg_account_trunkdev_name_cmd); + install_element(L_OCTOI_ACCOUNT_NODE, &cfg_account_trunkdev_line_cmd); #endif /* HAVE_DAHDI_TRUNKDEV */
install_node(&srv_node, config_write_octoi_srv); install_element(CONFIG_NODE, &cfg_server_cmd); //install_element(CONFIG_NODE, &cfg_no_server_cmd); - install_element(OCTOI_SRV_NODE, &cfg_srv_local_cmd); - install_element(OCTOI_SRV_NODE, &cfg_srv_dscp_cmd); - install_element(OCTOI_SRV_NODE, &cfg_srv_prio_cmd); - install_element(OCTOI_SRV_NODE, &cfg_srv_account_cmd); + install_element(L_OCTOI_SRV_NODE, &cfg_srv_local_cmd); + install_element(L_OCTOI_SRV_NODE, &cfg_srv_dscp_cmd); + install_element(L_OCTOI_SRV_NODE, &cfg_srv_prio_cmd); + install_element(L_OCTOI_SRV_NODE, &cfg_srv_account_cmd); //install_element(CONFIG_SRV_NODE, &cfg_srv_no_account_cmd); }