Change in osmo-remsim[master]: client: Split into remsim_client.c and remsim_client_main.c

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/.

laforge gerrit-no-reply at lists.osmocom.org
Sun Feb 16 14:46:51 UTC 2020


laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-remsim/+/17159 )

Change subject: client: Split into remsim_client.c and remsim_client_main.c
......................................................................

client: Split into remsim_client.c and remsim_client_main.c

Change-Id: Ie1d21c2cd84756d5c8aa2c41bcc37f5951a3a285
---
M src/client/Makefile.am
M src/client/remsim_client.c
A src/client/remsim_client_main.c
3 files changed, 99 insertions(+), 99 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



diff --git a/src/client/Makefile.am b/src/client/Makefile.am
index ec99818..ac0d707 100644
--- a/src/client/Makefile.am
+++ b/src/client/Makefile.am
@@ -6,7 +6,7 @@
 
 bin_PROGRAMS = osmo-remsim-client-st2 osmo-remsim-client-shell
 
-osmo_remsim_client_shell_SOURCES = user_shell.c \
+osmo_remsim_client_shell_SOURCES = user_shell.c remsim_client_main.c \
 				   remsim_client.c ../rspro_client_fsm.c ../debug.c
 osmo_remsim_client_shell_LDADD = $(OSMOCORE_LIBS) $(OSMOGSM_LIBS) $(OSMOABIS_LIBS) \
 		      $(top_builddir)/src/libosmo-rspro.la
diff --git a/src/client/remsim_client.c b/src/client/remsim_client.c
index 7ff8f37..07ffbde 100644
--- a/src/client/remsim_client.c
+++ b/src/client/remsim_client.c
@@ -159,101 +159,3 @@
 		bc->bankd_conn.clslot->slotNr = slot_nr;
 	}
 }
-
-
-
-#include <signal.h>
-#include <unistd.h>
-#define _GNU_SOURCE
-#include <getopt.h>
-
-#include <osmocom/core/msgb.h>
-#include <osmocom/core/application.h>
-
-static void *g_tall_ctx;
-void __thread *talloc_asn1_ctx;
-int asn_debug;
-
-static void handle_sig_usr1(int signal)
-{
-	OSMO_ASSERT(signal == SIGUSR1);
-	talloc_report_full(g_tall_ctx, stderr);
-}
-
-static void printf_help()
-{
-	printf(
-		"  -h --help                  Print this help message\n"
-		"  -i --server-ip A.B.C.D     remsim-server IP address\n"
-		"  -p --server-port 13245     remsim-server TCP port\n"
-		"  -i --client-id <0-65535>   RSPRO ClientId of this client\n"
-		"  -n --client-slot <0-65535> RSPRO SlotNr of this client\n"
-	      );
-}
-
-static void handle_options(struct bankd_client *bc, int argc, char **argv)
-{
-	while (1) {
-		int option_index = 0, c;
-		static const struct option long_options[] = {
-			{ "help", 0, 0, 'h' },
-			{ "server-ip", 1, 0, 'i' },
-			{ "server-port", 1, 0, 'p' },
-			{ "client-id", 1, 0, 'c' },
-			{ "client-slot", 1, 0, 'n' },
-			{ 0, 0, 0, 0 }
-		};
-
-		c = getopt_long(argc, argv, "hi:p:c:n:",
-				long_options, &option_index);
-		if (c == -1)
-			break;
-
-		switch (c) {
-		case 'h':
-			printf_help();
-			exit(0);
-			break;
-		case 'i':
-			bc->srv_conn.server_host = optarg;
-			break;
-		case 'p':
-			bc->srv_conn.server_port = atoi(optarg);
-			break;
-		case 'c':
-			remsim_client_set_clslot(bc, atoi(optarg), -1);
-			break;
-		case 'n':
-			remsim_client_set_clslot(bc, -1, atoi(optarg));
-			break;
-		default:
-			break;
-		}
-	}
-}
-
-int main(int argc, char **argv)
-{
-	struct bankd_client *g_client;
-	char hostname[256];
-
-	gethostname(hostname, sizeof(hostname));
-
-	g_tall_ctx = talloc_named_const(NULL, 0, "global");
-	talloc_asn1_ctx = talloc_named_const(g_tall_ctx, 0, "asn1");
-	msgb_talloc_ctx_init(g_tall_ctx, 0);
-
-	osmo_init_logging2(g_tall_ctx, &log_info);
-
-	g_client = remsim_client_create(g_tall_ctx, hostname, "remsim-client");
-
-	handle_options(g_client, argc, argv);
-
-	osmo_fsm_inst_dispatch(g_client->srv_conn.fi, SRVC_E_ESTABLISH, NULL);
-
-	signal(SIGUSR1, handle_sig_usr1);
-
-	asn_debug = 0;
-
-	client_user_main(g_client);
-}
diff --git a/src/client/remsim_client_main.c b/src/client/remsim_client_main.c
new file mode 100644
index 0000000..95eb089
--- /dev/null
+++ b/src/client/remsim_client_main.c
@@ -0,0 +1,98 @@
+
+#include <signal.h>
+#include <unistd.h>
+#define _GNU_SOURCE
+#include <getopt.h>
+
+#include <osmocom/core/msgb.h>
+#include <osmocom/core/application.h>
+
+#include "client.h"
+
+static void *g_tall_ctx;
+void __thread *talloc_asn1_ctx;
+int asn_debug;
+
+static void handle_sig_usr1(int signal)
+{
+	OSMO_ASSERT(signal == SIGUSR1);
+	talloc_report_full(g_tall_ctx, stderr);
+}
+
+static void printf_help()
+{
+	printf(
+		"  -h --help                  Print this help message\n"
+		"  -i --server-ip A.B.C.D     remsim-server IP address\n"
+		"  -p --server-port 13245     remsim-server TCP port\n"
+		"  -i --client-id <0-65535>   RSPRO ClientId of this client\n"
+		"  -n --client-slot <0-65535> RSPRO SlotNr of this client\n"
+	      );
+}
+
+static void handle_options(struct bankd_client *bc, int argc, char **argv)
+{
+	while (1) {
+		int option_index = 0, c;
+		static const struct option long_options[] = {
+			{ "help", 0, 0, 'h' },
+			{ "server-ip", 1, 0, 'i' },
+			{ "server-port", 1, 0, 'p' },
+			{ "client-id", 1, 0, 'c' },
+			{ "client-slot", 1, 0, 'n' },
+			{ 0, 0, 0, 0 }
+		};
+
+		c = getopt_long(argc, argv, "hi:p:c:n:",
+				long_options, &option_index);
+		if (c == -1)
+			break;
+
+		switch (c) {
+		case 'h':
+			printf_help();
+			exit(0);
+			break;
+		case 'i':
+			bc->srv_conn.server_host = optarg;
+			break;
+		case 'p':
+			bc->srv_conn.server_port = atoi(optarg);
+			break;
+		case 'c':
+			remsim_client_set_clslot(bc, atoi(optarg), -1);
+			break;
+		case 'n':
+			remsim_client_set_clslot(bc, -1, atoi(optarg));
+			break;
+		default:
+			break;
+		}
+	}
+}
+
+int main(int argc, char **argv)
+{
+	struct bankd_client *g_client;
+	char hostname[256];
+
+	gethostname(hostname, sizeof(hostname));
+
+	g_tall_ctx = talloc_named_const(NULL, 0, "global");
+	talloc_asn1_ctx = talloc_named_const(g_tall_ctx, 0, "asn1");
+	msgb_talloc_ctx_init(g_tall_ctx, 0);
+
+	osmo_init_logging2(g_tall_ctx, &log_info);
+
+	g_client = remsim_client_create(g_tall_ctx, hostname, "remsim-client");
+
+	handle_options(g_client, argc, argv);
+
+	osmo_fsm_inst_dispatch(g_client->srv_conn.fi, SRVC_E_ESTABLISH, NULL);
+
+	signal(SIGUSR1, handle_sig_usr1);
+
+	asn_debug = 0;
+
+	client_user_main(g_client);
+}

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

Gerrit-Project: osmo-remsim
Gerrit-Branch: master
Gerrit-Change-Id: Ie1d21c2cd84756d5c8aa2c41bcc37f5951a3a285
Gerrit-Change-Number: 17159
Gerrit-PatchSet: 3
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200216/4530926a/attachment.htm>


More information about the gerrit-log mailing list