pespin has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-smlc/+/40678?usp=email )


Change subject: vty: Create smlc_vty.c
......................................................................

vty: Create smlc_vty.c

We already have a smlc_vty.h file, but no usual smlc_vty.c file where we
put commands or init functions existed yet.

Change-Id: I6899602c3a6e22ee6ff93540466f839b2bf5ccc1
---
M include/osmocom/smlc/smlc_vty.h
M src/osmo-smlc/Makefile.am
M src/osmo-smlc/smlc_main.c
A src/osmo-smlc/smlc_vty.c
4 files changed, 52 insertions(+), 10 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-smlc refs/changes/78/40678/1

diff --git a/include/osmocom/smlc/smlc_vty.h b/include/osmocom/smlc/smlc_vty.h
index d5d82f8..1c53a25 100644
--- a/include/osmocom/smlc/smlc_vty.h
+++ b/include/osmocom/smlc/smlc_vty.h
@@ -5,3 +5,5 @@
 enum smlc_vty_node {
        CELLS_NODE = _LAST_OSMOVTY_NODE + 1,
 };
+
+void smlc_vty_init(struct vty_app_info *vty_app_info);
diff --git a/src/osmo-smlc/Makefile.am b/src/osmo-smlc/Makefile.am
index 585d1de..185a8d9 100644
--- a/src/osmo-smlc/Makefile.am
+++ b/src/osmo-smlc/Makefile.am
@@ -32,6 +32,7 @@
        smlc_loc_req.c \
        smlc_main.c \
        smlc_subscr.c \
+       smlc_vty.c \
        $(NULL)

 osmo_smlc_LDADD = \
diff --git a/src/osmo-smlc/smlc_main.c b/src/osmo-smlc/smlc_main.c
index f72ec4b..a521745 100644
--- a/src/osmo-smlc/smlc_main.c
+++ b/src/osmo-smlc/smlc_main.c
@@ -40,7 +40,7 @@
 #include <osmocom/smlc/debug.h>
 #include <osmocom/smlc/smlc_data.h>
 #include <osmocom/smlc/sccp_lb_inst.h>
-#include <osmocom/smlc/cell_locations.h>
+#include <osmocom/smlc/smlc_vty.h>

 #define _GNU_SOURCE
 #include <getopt.h>
@@ -241,17 +241,11 @@

        g_smlc = smlc_state_alloc(tall_smlc_ctx);

-       /* This needs to precede handle_options() */
-       vty_init(&vty_info);
-       logging_vty_add_cmds();
-       osmo_talloc_vty_add_cmds();
-       ctrl_vty_init(tall_smlc_ctx);
-       cell_locations_vty_init();
-
        /* Initialize SS7 */
        OSMO_ASSERT(osmo_ss7_init() == 0);
-       osmo_ss7_vty_init_asp(tall_smlc_ctx);
-       osmo_sccp_vty_init();
+
+       /* This needs to precede handle_options() */
+       smlc_vty_init(&vty_info);

        /* parse options */
        handle_options(argc, argv);
diff --git a/src/osmo-smlc/smlc_vty.c b/src/osmo-smlc/smlc_vty.c
new file mode 100644
index 0000000..36ca47e
--- /dev/null
+++ b/src/osmo-smlc/smlc_vty.c
@@ -0,0 +1,45 @@
+/*
+ * (C) 2025 by sysmocom - s.f.m.c. GmbH <i...@sysmocom.de>
+ * All Rights Reserved
+ *
+ * SPDX-License-Identifier: AGPL-3.0+
+ *
+ * Author: Pau Espin Pedrol
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <osmocom/ctrl/control_vty.h>
+#include <osmocom/vty/logging.h>
+#include <osmocom/vty/misc.h>
+
+#include <osmocom/sigtran/osmo_ss7.h>
+#include <osmocom/sigtran/sccp_sap.h>
+
+#include <osmocom/smlc/cell_locations.h>
+
+void smlc_vty_init(struct vty_app_info *vty_app_info)
+{
+       vty_init(vty_app_info);
+
+       logging_vty_add_cmds();
+       osmo_talloc_vty_add_cmds();
+       ctrl_vty_init(vty_app_info->tall_ctx);
+       osmo_fsm_vty_add_cmds();
+
+       osmo_ss7_vty_init_asp(vty_app_info->tall_ctx);
+       osmo_sccp_vty_init();
+
+       cell_locations_vty_init();
+}

--
To view, visit https://gerrit.osmocom.org/c/osmo-smlc/+/40678?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: osmo-smlc
Gerrit-Branch: master
Gerrit-Change-Id: I6899602c3a6e22ee6ff93540466f839b2bf5ccc1
Gerrit-Change-Number: 40678
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pes...@sysmocom.de>

Reply via email to