aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2018-02-13 23:34:07 +0100
committerNeels Hofmeyr <neels@hofmeyr.de>2018-02-14 12:55:45 +0100
commitab1b381d1b61fb26f53b04d0eebf451bb6e02507 (patch)
tree81480f7294a8af2be3eeacf11b532152f7a5f401
parentf088e790f71430f9d19d167194c2750bb338f844 (diff)
libcommon-cs: move gsm_network_init() into bsc_network_init()
Some part of the network init was common between libbsc and libmsc in the old openbsc.git repository. Now osmo-bsc.git is independent with its own copy of the gsm_network initialization. So move it over to libbsc. Change-Id: I8968787a5f0b078619264f0cb42349a9bc7943af
-rw-r--r--include/osmocom/bsc/common_cs.h4
-rw-r--r--src/libbsc/net_init.c16
-rw-r--r--src/libcommon-cs/common_cs.c33
3 files changed, 15 insertions, 38 deletions
diff --git a/include/osmocom/bsc/common_cs.h b/include/osmocom/bsc/common_cs.h
index c2e8515df..432d4d594 100644
--- a/include/osmocom/bsc/common_cs.h
+++ b/include/osmocom/bsc/common_cs.h
@@ -16,10 +16,6 @@ struct gsm_encr {
uint8_t key[MAX_A5_KEY_LEN];
};
-struct gsm_network *gsm_network_init(void *ctx,
- uint16_t country_code,
- uint16_t network_code);
-
int common_cs_vty_init(struct gsm_network *network,
int (* config_write_net )(struct vty *));
struct gsm_network *gsmnet_from_vty(struct vty *v);
diff --git a/src/libbsc/net_init.c b/src/libbsc/net_init.c
index 435c0ce6a..4fa59ed76 100644
--- a/src/libbsc/net_init.c
+++ b/src/libbsc/net_init.c
@@ -45,7 +45,21 @@ struct gsm_network *bsc_network_init(void *ctx,
{
struct gsm_network *net;
- net = gsm_network_init(ctx, country_code, network_code);
+ net = talloc_zero(ctx, struct gsm_network);
+ if (!net)
+ return NULL;
+
+ net->country_code = country_code;
+ net->network_code = network_code;
+
+ /* Use 30 min periodic update interval as sane default */
+ net->t3212 = 5;
+
+ INIT_LLIST_HEAD(&net->trans_list);
+ INIT_LLIST_HEAD(&net->subscr_conns);
+
+ net->bsc_subscribers = talloc_zero(net, struct llist_head);
+ INIT_LLIST_HEAD(net->bsc_subscribers);
net->bsc_data = talloc_zero(net, struct osmo_bsc_data);
if (!net->bsc_data) {
diff --git a/src/libcommon-cs/common_cs.c b/src/libcommon-cs/common_cs.c
index 39df45e7d..0520e9660 100644
--- a/src/libcommon-cs/common_cs.c
+++ b/src/libcommon-cs/common_cs.c
@@ -30,39 +30,6 @@
#include <osmocom/bsc/gsm_data.h>
#include <osmocom/bsc/gsm_04_08_utils.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,
- uint16_t country_code,
- uint16_t network_code)
-{
- struct gsm_network *net;
-
- net = talloc_zero(ctx, struct gsm_network);
- if (!net)
- return NULL;
-
- net->country_code = country_code;
- net->network_code = network_code;
-
- /* Use 30 min periodic update interval as sane default */
- net->t3212 = 5;
-
- INIT_LLIST_HEAD(&net->trans_list);
- INIT_LLIST_HEAD(&net->subscr_conns);
-
- net->bsc_subscribers = talloc_zero(net, struct llist_head);
- INIT_LLIST_HEAD(net->bsc_subscribers);
-
- net->dyn_ts_allow_tch_f = true;
-
- return net;
-}
-
struct msgb *gsm48_create_mm_serv_rej(enum gsm48_reject_value value)
{
struct msgb *msg;