aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Willmann <dwillmann@sysmocom.de>2020-11-03 09:07:45 +0100
committerDaniel Willmann <dwillmann@sysmocom.de>2020-11-06 22:21:21 +0100
commit62fa6198aee1cab0b78d820e1f6440c28930a71e (patch)
tree230cad38d3c90c25d45c0e30892a6a0e94deb52b
parentc42331f359560b217118fd12516b6baec3875b22 (diff)
Let libosmocore handle VTY parent node tracking
* is_config_node is deprecated, so don't set it * go_parent_cb is only used if we want to do special stuff upon exiting a node, in osmo-sgsn and gtphub only osmo_ss7_vty_go_parent() needs to be called Change-Id: I2008dd9026922d29ee703c59e70d3fecced0ee18
-rw-r--r--src/gbproxy/gb_proxy_main.c30
-rw-r--r--src/gtphub/gtphub_main.c34
-rw-r--r--src/sgsn/sgsn_main.c34
3 files changed, 4 insertions, 94 deletions
diff --git a/src/gbproxy/gb_proxy_main.c b/src/gbproxy/gb_proxy_main.c
index f8c5ade0..63e5f492 100644
--- a/src/gbproxy/gb_proxy_main.c
+++ b/src/gbproxy/gb_proxy_main.c
@@ -183,39 +183,9 @@ static void handle_options(int argc, char **argv)
}
}
-int gbproxy_vty_is_config_node(struct vty *vty, int node)
-{
- switch (node) {
- /* add items that are not config */
- case CONFIG_NODE:
- return 0;
-
- default:
- return 1;
- }
-}
-
-int gbproxy_vty_go_parent(struct vty *vty)
-{
- switch (vty->node) {
- case GBPROXY_NODE:
- default:
- if (gbproxy_vty_is_config_node(vty, vty->node))
- vty->node = CONFIG_NODE;
- else
- vty->node = ENABLE_NODE;
-
- vty->index = NULL;
- }
-
- return vty->node;
-}
-
static struct vty_app_info vty_info = {
.name = "OsmoGbProxy",
.version = PACKAGE_VERSION,
- .go_parent_cb = gbproxy_vty_go_parent,
- .is_config_node = gbproxy_vty_is_config_node,
};
/* default categories */
diff --git a/src/gtphub/gtphub_main.c b/src/gtphub/gtphub_main.c
index 664c801e..665224a1 100644
--- a/src/gtphub/gtphub_main.c
+++ b/src/gtphub/gtphub_main.c
@@ -118,44 +118,12 @@ static void signal_handler(int signal)
}
}
-#if BUILD_IU
-int gtphub_vty_go_parent(struct vty *vty)
-{
- switch (vty->node) {
- default:
- osmo_ss7_vty_go_parent(vty);
- }
-
- return vty->node;
-}
-#endif
-
-int gtphub_vty_is_config_node(struct vty *vty, int node)
-{
- /* Check if libosmo-sccp declares the node in
- * question as config node */
-#if BUILD_IU
- if (osmo_ss7_is_config_node(vty, node))
- return 1;
-#endif
-
- switch (node) {
- /* add items that are not config */
- case CONFIG_NODE:
- return 0;
-
- default:
- return 1;
- }
-}
-
static struct vty_app_info vty_info = {
.name = "OsmoGTPhub",
.version = PACKAGE_VERSION,
#if BUILD_IU
- .go_parent_cb = gtphub_vty_go_parent,
+ .go_parent_cb = osmo_ss7_vty_go_parent,
#endif
- .is_config_node = gtphub_vty_is_config_node,
};
struct cmdline_cfg {
diff --git a/src/sgsn/sgsn_main.c b/src/sgsn/sgsn_main.c
index 3044f95e..1eccad8e 100644
--- a/src/sgsn/sgsn_main.c
+++ b/src/sgsn/sgsn_main.c
@@ -172,35 +172,6 @@ static void signal_handler(int signal)
/* NSI that BSSGP uses when transmitting on NS */
extern struct gprs_ns_inst *bssgp_nsi;
-int sgsn_vty_is_config_node(struct vty *vty, int node)
-{
- /* So far the SGSN has no nested nodes that need parent node
- * declaration, except for the ss7 vty nodes. */
- switch (node) {
- case SGSN_NODE:
- return 1;
- default:
-#if BUILD_IU
- return osmo_ss7_is_config_node(vty, node);
-#else
- return 0;
-#endif
- }
-}
-
-int sgsn_vty_go_parent(struct vty *vty)
-{
- /* So far the SGSN has no nested nodes that need parent node
- * declaration, except for the ss7 vty nodes. */
-#if BUILD_IU
- return osmo_ss7_vty_go_parent(vty);
-#else
- vty->node = CONFIG_NODE;
- vty->index = NULL;
- return 0;
-#endif
-}
-
static void bvc_reset_persistent_nsvcs(void)
{
/* Send BVC-RESET on all persistent NSVCs */
@@ -221,8 +192,9 @@ static void bvc_reset_persistent_nsvcs(void)
static struct vty_app_info vty_info = {
.name = "OsmoSGSN",
.version = PACKAGE_VERSION,
- .go_parent_cb = sgsn_vty_go_parent,
- .is_config_node = sgsn_vty_is_config_node,
+#if BUILD_IU
+ .go_parent_cb = osmo_ss7_vty_go_parent,
+#endif
};
static void print_help(void)