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/.
pespin gerrit-no-reply at lists.osmocom.orgpespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-sccp/+/16956 ) Change subject: examples/sccp_demo_user: Support reading log/vty config from file ...................................................................... examples/sccp_demo_user: Support reading log/vty config from file Passing a config file is still optional, and both client and server work out of the box with providing any. It's still goot allowing to pass a config file to be able to configure easily stuff like logging, VTY ip address binding, etc. Change-Id: Ie75d004a0e9f24309060f241f22209df1bbe358e --- M examples/sccp_demo_user.c 1 file changed, 27 insertions(+), 5 deletions(-) Approvals: Jenkins Builder: Verified fixeria: Looks good to me, but someone else must approve laforge: Looks good to me, approved diff --git a/examples/sccp_demo_user.c b/examples/sccp_demo_user.c index e3f5ee0..88aead3 100644 --- a/examples/sccp_demo_user.c +++ b/examples/sccp_demo_user.c @@ -13,6 +13,8 @@ #include <osmocom/core/fsm.h> #include <osmocom/vty/vty.h> #include <osmocom/vty/telnet_interface.h> +#include <osmocom/vty/logging.h> +#include <osmocom/vty/misc.h> #include <osmocom/sigtran/osmo_ss7.h> #include <osmocom/sigtran/sccp_sap.h> @@ -22,6 +24,8 @@ #include "internal.h" +static const char *config_file; + static struct osmo_sccp_instance *g_sccp; static struct osmo_sccp_instance *sua_server_helper(int local_port, const char *local_address, int local_pc, @@ -71,11 +75,10 @@ .num_cat = ARRAY_SIZE(log_info_cat), }; -static void init_logging(void) +static void init_logging(void *tall_ctx) { const int log_cats[] = { DLSS7, DLSUA, DLM3UA, DLSCCP, DLINP }; unsigned int i; - void *tall_ctx = talloc_named_const(NULL, 1, "example"); msgb_talloc_ctx_init(tall_ctx, 0); osmo_init_logging2(tall_ctx, &log_info); log_set_print_category(osmo_stderr_target, true); @@ -177,7 +180,7 @@ int remote_pc = DEFAULT_PC_CLIENT; bool lflag = false, rflag = false, Lflag = false, Rflag = false; - while ((ch = getopt(argc, argv, "cl:r:L:R:")) != -1) { + while ((ch = getopt(argc, argv, "cl:r:L:R:C:")) != -1) { switch (ch) { case 'c': client = true; @@ -222,6 +225,9 @@ remote_pc = atoi(optarg); Rflag = true; break; + case 'C': + config_file = optarg; + break; default: usage(); } @@ -237,14 +243,30 @@ signal(SIGUSR1, &signal_handler); signal(SIGUSR2, &signal_handler); - init_logging(); + void *tall_ctx = talloc_named_const(NULL, 1, "sccp_demo_user"); + init_logging(tall_ctx); OSMO_ASSERT(osmo_ss7_init() == 0); osmo_fsm_log_addr(false); + vty_info.tall_ctx = tall_ctx; vty_init(&vty_info); + logging_vty_add_cmds(); + osmo_talloc_vty_add_cmds(); + osmo_fsm_vty_add_cmds(); osmo_ss7_vty_init_asp(NULL); osmo_sccp_vty_init(); - rc = telnet_init_dynif(NULL, NULL, local_address, 2324+client); + /* Read the config if requested with -C */ + if (config_file) { + rc = vty_read_config_file(config_file, NULL); + if (rc < 0) { + LOGP(DMAIN, LOGL_FATAL, "Failed to parse the config file: '%s'\n", + config_file); + exit(1); + } + } + + rc = telnet_init_dynif(NULL, NULL, config_file ? vty_get_bind_addr() : local_address, + 2324+client); if (rc < 0) { perror("Error binding VTY port"); exit(1); -- To view, visit https://gerrit.osmocom.org/c/libosmo-sccp/+/16956 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-sccp Gerrit-Branch: master Gerrit-Change-Id: Ie75d004a0e9f24309060f241f22209df1bbe358e Gerrit-Change-Number: 16956 Gerrit-PatchSet: 3 Gerrit-Owner: pespin <pespin at sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <axilirator at gmail.com> Gerrit-Reviewer: laforge <laforge at osmocom.org> Gerrit-Reviewer: pespin <pespin at sysmocom.de> Gerrit-MessageType: merged -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200121/1a3808fb/attachment.htm>