Review at https://gerrit.osmocom.org/6438
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 --- M include/osmocom/bsc/common_cs.h M src/libbsc/net_init.c M src/libcommon-cs/common_cs.c 3 files changed, 15 insertions(+), 38 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/38/6438/1 diff --git a/include/osmocom/bsc/common_cs.h b/include/osmocom/bsc/common_cs.h index c2e8515..432d4d5 100644 --- a/include/osmocom/bsc/common_cs.h +++ b/include/osmocom/bsc/common_cs.h @@ -16,10 +16,6 @@ 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 435c0ce..4fa59ed 100644 --- a/src/libbsc/net_init.c +++ b/src/libbsc/net_init.c @@ -45,7 +45,21 @@ { 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 39df45e..0520e96 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; -- To view, visit https://gerrit.osmocom.org/6438 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I8968787a5f0b078619264f0cb42349a9bc7943af Gerrit-PatchSet: 1 Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr <nhofm...@sysmocom.de>