daniel has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-sgsn/+/21028 )

Change subject: Let libosmocore handle VTY parent node tracking
......................................................................

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
---
M src/gbproxy/gb_proxy_main.c
M src/gtphub/gtphub_main.c
M src/sgsn/sgsn_main.c
3 files changed, 4 insertions(+), 94 deletions(-)

Approvals:
  Jenkins Builder: Verified
  lynxis lazus: Looks good to me, but someone else must approve
  pespin: Looks good to me, but someone else must approve
  laforge: Looks good to me, approved



diff --git a/src/gbproxy/gb_proxy_main.c b/src/gbproxy/gb_proxy_main.c
index f8c5ade..63e5f49 100644
--- a/src/gbproxy/gb_proxy_main.c
+++ b/src/gbproxy/gb_proxy_main.c
@@ -183,39 +183,9 @@
        }
 }

-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 664c801..665224a 100644
--- a/src/gtphub/gtphub_main.c
+++ b/src/gtphub/gtphub_main.c
@@ -118,44 +118,12 @@
        }
 }

-#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 3044f95..1eccad8 100644
--- a/src/sgsn/sgsn_main.c
+++ b/src/sgsn/sgsn_main.c
@@ -172,35 +172,6 @@
 /* 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 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)

--
To view, visit https://gerrit.osmocom.org/c/osmo-sgsn/+/21028
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-Change-Id: I2008dd9026922d29ee703c59e70d3fecced0ee18
Gerrit-Change-Number: 21028
Gerrit-PatchSet: 8
Gerrit-Owner: daniel <dwillm...@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillm...@sysmocom.de>
Gerrit-Reviewer: laforge <lafo...@osmocom.org>
Gerrit-Reviewer: lynxis lazus <lyn...@fe80.eu>
Gerrit-Reviewer: pespin <pes...@sysmocom.de>
Gerrit-MessageType: merged

Reply via email to