[PATCH] osmo-msc[master]: dissolve libcommon-cs: move gsm_network_init() to libmsc

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
Thu Mar 22 16:12:11 UTC 2018


Review at  https://gerrit.osmocom.org/7455

dissolve libcommon-cs: move gsm_network_init() to libmsc

Move to libmsc/osmo_msc.c (for lack of a better place and reluctance to create
an own file just for gsm_network_init()).

Change-Id: I2279eee4db6f6687726bfd55841b3748d4930f15
---
M src/libcommon-cs/common_cs.c
M src/libmsc/osmo_msc.c
2 files changed, 37 insertions(+), 43 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/55/7455/1

diff --git a/src/libcommon-cs/common_cs.c b/src/libcommon-cs/common_cs.c
index a1d2298..c3b971e 100644
--- a/src/libcommon-cs/common_cs.c
+++ b/src/libcommon-cs/common_cs.c
@@ -31,49 +31,6 @@
 #include <osmocom/msc/gsm_04_11.h>
 #include <osmocom/msc/gsm_04_08.h>
 
-/* Warning: if bsc_network_init() is not called, some of the members of
- * gsm_network are not initialized properly and must not be used! (In
- * particular the llist heads and stats counters.)
- * The long term aim should be to have entirely separate structs for libbsc and
- * libmsc with some common general items.
- */
-struct gsm_network *gsm_network_init(void *ctx, mncc_recv_cb_t mncc_recv)
-{
-	struct gsm_network *net;
-
-	net = talloc_zero(ctx, struct gsm_network);
-	if (!net)
-		return NULL;
-
-	net->plmn = (struct osmo_plmn_id){ .mcc=1, .mnc=1 };
-
-	/* Permit a compile-time default of A5/3 and A5/1 */
-	net->a5_encryption_mask = (1 << 3) | (1 << 1);
-
-	/* Use 30 min periodic update interval as sane default */
-	net->t3212 = 5;
-
-	net->paging_response_timer = MSC_PAGING_RESPONSE_TIMER_DEFAULT;
-
-	INIT_LLIST_HEAD(&net->trans_list);
-	INIT_LLIST_HEAD(&net->upqueue);
-	INIT_LLIST_HEAD(&net->subscr_conns);
-
-	/* init statistics */
-	net->msc_ctrs = rate_ctr_group_alloc(net, &msc_ctrg_desc, 0);
-	if (!net->msc_ctrs) {
-		talloc_free(net);
-		return NULL;
-	}
-	net->active_calls = osmo_counter_alloc("msc.active_calls");
-
-	net->mncc_recv = mncc_recv;
-
-	INIT_LLIST_HEAD(&net->a.bscs);
-
-	return net;
-}
-
 struct msgb *gsm48_create_mm_serv_rej(enum gsm48_reject_value value)
 {
 	struct msgb *msg;
diff --git a/src/libmsc/osmo_msc.c b/src/libmsc/osmo_msc.c
index d0c5235..62a7e8a 100644
--- a/src/libmsc/osmo_msc.c
+++ b/src/libmsc/osmo_msc.c
@@ -38,6 +38,43 @@
 #include <osmocom/msc/iu_dummy.h>
 #endif
 
+struct gsm_network *gsm_network_init(void *ctx, mncc_recv_cb_t mncc_recv)
+{
+	struct gsm_network *net;
+
+	net = talloc_zero(ctx, struct gsm_network);
+	if (!net)
+		return NULL;
+
+	net->plmn = (struct osmo_plmn_id){ .mcc=1, .mnc=1 };
+
+	/* Permit a compile-time default of A5/3 and A5/1 */
+	net->a5_encryption_mask = (1 << 3) | (1 << 1);
+
+	/* Use 30 min periodic update interval as sane default */
+	net->t3212 = 5;
+
+	net->paging_response_timer = MSC_PAGING_RESPONSE_TIMER_DEFAULT;
+
+	INIT_LLIST_HEAD(&net->trans_list);
+	INIT_LLIST_HEAD(&net->upqueue);
+	INIT_LLIST_HEAD(&net->subscr_conns);
+
+	/* init statistics */
+	net->msc_ctrs = rate_ctr_group_alloc(net, &msc_ctrg_desc, 0);
+	if (!net->msc_ctrs) {
+		talloc_free(net);
+		return NULL;
+	}
+	net->active_calls = osmo_counter_alloc("msc.active_calls");
+
+	net->mncc_recv = mncc_recv;
+
+	INIT_LLIST_HEAD(&net->a.bscs);
+
+	return net;
+}
+
 /* Receive a SAPI-N-REJECT from BSC */
 void msc_sapi_n_reject(struct gsm_subscriber_connection *conn, int dlci)
 {

-- 
To view, visit https://gerrit.osmocom.org/7455
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2279eee4db6f6687726bfd55841b3748d4930f15
Gerrit-PatchSet: 1
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>



More information about the gerrit-log mailing list