diff options
author | Neels Hofmeyr <nhofmeyr@sysmocom.de> | 2016-05-14 00:46:29 +0200 |
---|---|---|
committer | Neels Hofmeyr <nhofmeyr@sysmocom.de> | 2016-11-24 16:58:31 +0100 |
commit | e78ae21ff44a7442be065b67b827efcd10de34fc (patch) | |
tree | 19df2a86e357715921dad6d5b5999218350b98cb /openbsc/src/libbsc/net_init.c | |
parent | 2d521a0296fdecc1a8cb337354654123a864015b (diff) |
move to libcommon-cs: net init 3: actual move
Reincarnate gsm_network_init() as the parts not specific to libbsc.
Move from bsc_network_init() those bits that are not BSC specific (and useful
for upcoming osmo-cscn).
Add libcommon-cs to all linkages that use gsm_network_init().
Note: the only requirement to allow linking gsm_network_init() without libbsc
is to keep the call to gsm_net_update_ctype() out of libcommon-cs. The other items
are kept out of libcommon-cs because it makes sense semantically. But the separation
is not strong in that the BSC specific data members are of course still
omnipresent in struct gsm_network. If bsc_network_init() is not called, these
are not initialized properly -- for now no users of uninitialized members
exist.
So this is just a first step towards a sensible split of the BSC and MSC
gsm_network structs. The long term aim should be to have entirely separate
structs with some common general items.
Change-Id: If06316b97002390dc9a434686750cb96193ea63b
Diffstat (limited to 'openbsc/src/libbsc/net_init.c')
-rw-r--r-- | openbsc/src/libbsc/net_init.c | 36 |
1 files changed, 2 insertions, 34 deletions
diff --git a/openbsc/src/libbsc/net_init.c b/openbsc/src/libbsc/net_init.c index 07a442356..f728d3fa6 100644 --- a/openbsc/src/libbsc/net_init.c +++ b/openbsc/src/libbsc/net_init.c @@ -17,12 +17,9 @@ * */ +#include <openbsc/common_cs.h> #include <openbsc/osmo_bsc.h> -#include <openbsc/gsm_data.h> #include <openbsc/osmo_msc_data.h> -#include <openbsc/gsm_subscriber.h> - -#include <stdbool.h> struct gsm_network *bsc_network_init(void *ctx, uint16_t country_code, @@ -30,11 +27,8 @@ struct gsm_network *bsc_network_init(void *ctx, mncc_recv_cb_t mncc_recv) { struct gsm_network *net; - const char *default_regexp = ".*"; - net = talloc_zero(ctx, struct gsm_network); - if (!net) - return NULL; + net = gsm_network_init(ctx, country_code, network_code, mncc_recv); net->bsc_data = talloc_zero(net, struct osmo_bsc_data); if (!net->bsc_data) { @@ -42,27 +36,11 @@ struct gsm_network *bsc_network_init(void *ctx, return NULL; } - net->subscr_group = talloc_zero(net, struct gsm_subscriber_group); - if (!net->subscr_group) { - talloc_free(net); - return NULL; - } - - if (gsm_parse_reg(net, &net->authorized_regexp, &net->authorized_reg_str, 1, - &default_regexp) != 0) - return NULL; - /* Init back pointer */ net->bsc_data->auto_off_timeout = -1; net->bsc_data->network = net; INIT_LLIST_HEAD(&net->bsc_data->mscs); - net->subscr_group->net = net; - net->auto_create_subscr = true; - net->auto_assign_exten = true; - - net->country_code = country_code; - net->network_code = network_code; net->num_bts = 0; net->reject_cause = GSM48_REJECT_ROAMING_NOT_ALLOWED; net->T3101 = GSM_T3101_DEFAULT; @@ -79,23 +57,13 @@ struct gsm_network *bsc_network_init(void *ctx, net->handover.pwr_hysteresis = 3; net->handover.max_distance = 9999; - INIT_LLIST_HEAD(&net->trans_list); - INIT_LLIST_HEAD(&net->upqueue); INIT_LLIST_HEAD(&net->bts_list); - INIT_LLIST_HEAD(&net->subscr_conns); /* init statistics */ net->bsc_ctrs = rate_ctr_group_alloc(net, &bsc_ctrg_desc, 0); - net->msc_ctrs = rate_ctr_group_alloc(net, &msc_ctrg_desc, 0); - net->active_calls = osmo_counter_alloc("msc.active_calls"); - net->mncc_recv = mncc_recv; - net->ext_min = GSM_MIN_EXTEN; - net->ext_max = GSM_MAX_EXTEN; gsm_net_update_ctype(net); - net->dyn_ts_allow_tch_f = true; - return net; } |