This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Review at https://gerrit.osmocom.org/3360
osmo_ss7_vty_init: ensure a talloc ctx is set by user
Drop the separate osmo_ss7_set_vty_alloc_ctx() because we are likely to forget
calling it. Instead, incorporate into osmo_ss7_vty_init_*() with a new ctx arg,
and set the static context var in vty_init_shared().
Change-Id: Id4e7f47979001f7856b0b3665c9e94982e75e490
---
M examples/m3ua_example.c
M include/osmocom/sigtran/osmo_ss7.h
M src/osmo_ss7_vty.c
M stp/stp_main.c
4 files changed, 11 insertions(+), 15 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/60/3360/1
diff --git a/examples/m3ua_example.c b/examples/m3ua_example.c
index d3c6a7c..6c2b146 100644
--- a/examples/m3ua_example.c
+++ b/examples/m3ua_example.c
@@ -92,7 +92,7 @@
osmo_ss7_init();
osmo_fsm_log_addr(false);
vty_init(&vty_info);
- osmo_ss7_vty_init_asp();
+ osmo_ss7_vty_init_asp(NULL);
osmo_sccp_vty_init();
if (argc <= 1)
diff --git a/include/osmocom/sigtran/osmo_ss7.h b/include/osmocom/sigtran/osmo_ss7.h
index 87ace4a..bbe425c 100644
--- a/include/osmocom/sigtran/osmo_ss7.h
+++ b/include/osmocom/sigtran/osmo_ss7.h
@@ -471,8 +471,7 @@
/* VTY related */
struct vty;
-void osmo_ss7_set_vty_alloc_ctx(void *ctx);
-void osmo_ss7_vty_init_asp(void);
-void osmo_ss7_vty_init_sg(void);
+void osmo_ss7_vty_init_asp(void *ctx);
+void osmo_ss7_vty_init_sg(void *ctx);
int osmo_ss7_vty_go_parent(struct vty *vty);
int osmo_ss7_is_config_node(struct vty *vty, int node);
diff --git a/src/osmo_ss7_vty.c b/src/osmo_ss7_vty.c
index c859eb9..476aedf 100644
--- a/src/osmo_ss7_vty.c
+++ b/src/osmo_ss7_vty.c
@@ -1661,8 +1661,10 @@
install_element(L_CS7_SCCPADDR_GT_NODE, &cs7_sccpaddr_gt_digits_cmd);
}
-static void vty_init_shared(void)
+static void vty_init_shared(void *ctx)
{
+ g_ctx = ctx;
+
install_element_ve(&show_cs7_user_cmd);
/* the mother of all VTY config nodes */
@@ -1706,14 +1708,14 @@
vty_init_addr();
}
-void osmo_ss7_vty_init_asp(void)
+void osmo_ss7_vty_init_asp(void *ctx)
{
- vty_init_shared();
+ vty_init_shared(ctx);
}
-void osmo_ss7_vty_init_sg(void)
+void osmo_ss7_vty_init_sg(void *ctx)
{
- vty_init_shared();
+ vty_init_shared(ctx);
install_node(&rtable_node, NULL);
vty_install_default(L_CS7_RTABLE_NODE);
@@ -1730,8 +1732,3 @@
install_element(L_CS7_XUA_NODE, &xua_local_ip_cmd);
install_element(L_CS7_XUA_NODE, &xua_accept_dyn_asp_cmd);
}
-
-void osmo_ss7_set_vty_alloc_ctx(void *ctx)
-{
- g_ctx = ctx;
-};
diff --git a/stp/stp_main.c b/stp/stp_main.c
index 074272b..ac8e6dd 100644
--- a/stp/stp_main.c
+++ b/stp/stp_main.c
@@ -137,7 +137,7 @@
osmo_ss7_init();
osmo_fsm_log_addr(false);
logging_vty_add_cmds(&log_info);
- osmo_ss7_vty_init_sg();
+ osmo_ss7_vty_init_sg(NULL);
osmo_fsm_vty_add_cmds();
rc = vty_read_config_file(cmdline_config.config_file, NULL);
--
To view, visit https://gerrit.osmocom.org/3360
To unsubscribe, visit https://gerrit.osmocom.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id4e7f47979001f7856b0b3665c9e94982e75e490
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>