aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/osmo-bsc/osmo_bsc_msc.c
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2011-06-04 19:58:26 +0200
committerHolger Hans Peter Freyther <zecke@selfish.org>2012-03-16 11:56:21 +0100
commit20fea245150b377ec97a3e56818cfbfc6e691097 (patch)
treef80a08be6cba80da909a145d6879bb6657b7b505 /openbsc/src/osmo-bsc/osmo_bsc_msc.c
parent44e5dad3e25ed8aa200bd6229f2d4d94b8326123 (diff)
bsc: Prepare to have multiple MSC connections
We now have a list of MSCs but in the code we will try to access the MSC with the nr 0.
Diffstat (limited to 'openbsc/src/osmo-bsc/osmo_bsc_msc.c')
-rw-r--r--openbsc/src/osmo-bsc/osmo_bsc_msc.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/openbsc/src/osmo-bsc/osmo_bsc_msc.c b/openbsc/src/osmo-bsc/osmo_bsc_msc.c
index b2962a978..617a59aee 100644
--- a/openbsc/src/osmo-bsc/osmo_bsc_msc.c
+++ b/openbsc/src/osmo-bsc/osmo_bsc_msc.c
@@ -455,3 +455,43 @@ int osmo_bsc_msc_init(struct osmo_msc_data *data)
return 0;
}
+
+struct osmo_msc_data *osmo_msc_data_find(struct gsm_network *net, int nr)
+{
+ struct osmo_msc_data *msc_data;
+
+ llist_for_each_entry(msc_data, &net->bsc_data->mscs, entry)
+ if (msc_data->nr == nr)
+ return msc_data;
+ return NULL;
+}
+
+struct osmo_msc_data *osmo_msc_data_alloc(struct gsm_network *net, int nr)
+{
+ struct osmo_msc_data *msc_data;
+
+ /* check if there is already one */
+ msc_data = osmo_msc_data_find(net, nr);
+ if (msc_data)
+ return msc_data;
+
+ msc_data = talloc_zero(net, struct osmo_msc_data);
+ if (!msc_data)
+ return NULL;
+
+ llist_add_tail(&msc_data->entry, &net->bsc_data->mscs);
+
+ /* Init back pointer */
+ msc_data->network = net;
+
+ INIT_LLIST_HEAD(&msc_data->dests);
+ msc_data->ping_timeout = 20;
+ msc_data->pong_timeout = 5;
+ msc_data->core_ncc = -1;
+ msc_data->core_mcc = -1;
+ msc_data->rtp_base = 4000;
+
+ msc_data->nr = nr;
+
+ return msc_data;
+}