diff options
author | Jacob Erlbeck <jerlbeck@sysmocom.de> | 2014-12-03 09:28:24 +0100 |
---|---|---|
committer | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2014-12-05 14:59:02 +0100 |
commit | 1e30a28e51b5e8a14b977233858f267f839197d5 (patch) | |
tree | 07f0a3f2fc5cf316b40d55cae5f40243b419e5ca /openbsc/src/libbsc | |
parent | dae1f64ba688eaa24aad6ce15a8529bdef788146 (diff) |
msc: Add and use gsm_subscriber_group
Currently every subcriber object directly refers to the gsm_network
which contains a flag shared by every related subscriber
(keep_subscr). This adds a dependency on gsm_network even if only the
function defined in gsm_subscriber_base.c are used.
This patch adds a new struct gsm_subscriber_group which contains the
keep_subscr flag and a back reference to the network object. The
latter is not dereferenced in gsm_subscriber_base.c, so it can safely
be set to NULL when only that part of the gsm_subscriber API is being
used. It also changes that API to use gsm_subscriber_group instead of
gsm_network parameters.
Since there are some places where a pointer to the gsm_network is
needed but where only a gsm_subscriber is available, a 'net' back
pointer is added to the group struct, too. Nevertheless subscr group
and network could be separated completely, but this is not the topic
of this commit.
Sponsored-by: On-Waves ehf
Diffstat (limited to 'openbsc/src/libbsc')
-rw-r--r-- | openbsc/src/libbsc/bsc_vty.c | 4 | ||||
-rw-r--r-- | openbsc/src/libbsc/chan_alloc.c | 2 | ||||
-rw-r--r-- | openbsc/src/libbsc/net_init.c | 8 | ||||
-rw-r--r-- | openbsc/src/libbsc/paging.c | 2 |
4 files changed, 12 insertions, 4 deletions
diff --git a/openbsc/src/libbsc/bsc_vty.c b/openbsc/src/libbsc/bsc_vty.c index 9129059e5..08f9a8e50 100644 --- a/openbsc/src/libbsc/bsc_vty.c +++ b/openbsc/src/libbsc/bsc_vty.c @@ -709,7 +709,7 @@ static int config_write_net(struct vty *vty) vty_out(vty, " timer t3141 %u%s", gsmnet->T3141, VTY_NEWLINE); vty_out(vty, " dtx-used %u%s", gsmnet->dtx_enabled, VTY_NEWLINE); vty_out(vty, " subscriber-keep-in-ram %d%s", - gsmnet->keep_subscr, VTY_NEWLINE); + gsmnet->subscr_group->keep_subscr, VTY_NEWLINE); return CMD_SUCCESS; } @@ -1510,7 +1510,7 @@ DEFUN(cfg_net_subscr_keep, "Delete unused subscribers\n" "Keep unused subscribers\n") { struct gsm_network *gsmnet = gsmnet_from_vty(vty); - gsmnet->keep_subscr = atoi(argv[0]); + gsmnet->subscr_group->keep_subscr = atoi(argv[0]); return CMD_SUCCESS; } diff --git a/openbsc/src/libbsc/chan_alloc.c b/openbsc/src/libbsc/chan_alloc.c index f6eb5af14..cd96c1b38 100644 --- a/openbsc/src/libbsc/chan_alloc.c +++ b/openbsc/src/libbsc/chan_alloc.c @@ -436,7 +436,7 @@ static struct gsm_lchan* lchan_find(struct gsm_bts *bts, struct gsm_subscriber * struct gsm_subscriber_connection *connection_for_subscr(struct gsm_subscriber *subscr) { struct gsm_bts *bts; - struct gsm_network *net = subscr->net; + struct gsm_network *net = subscr->group->net; struct gsm_lchan *lchan; llist_for_each_entry(bts, &net->bts_list, list) { diff --git a/openbsc/src/libbsc/net_init.c b/openbsc/src/libbsc/net_init.c index 1d370203c..5bb8ae2b6 100644 --- a/openbsc/src/libbsc/net_init.c +++ b/openbsc/src/libbsc/net_init.c @@ -19,6 +19,7 @@ #include <openbsc/gsm_data.h> #include <openbsc/osmo_msc_data.h> +#include <openbsc/gsm_subscriber.h> struct gsm_network *gsm_network_init(uint16_t country_code, uint16_t network_code, int (*mncc_recv)(struct gsm_network *, struct msgb *)) @@ -35,10 +36,17 @@ struct gsm_network *gsm_network_init(uint16_t country_code, uint16_t network_cod return NULL; } + net->subscr_group = talloc_zero(net, struct gsm_subscriber_group); + if (!net->subscr_group) { + talloc_free(net); + 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->country_code = country_code; net->network_code = network_code; diff --git a/openbsc/src/libbsc/paging.c b/openbsc/src/libbsc/paging.c index 286c57ba9..f0518bbcb 100644 --- a/openbsc/src/libbsc/paging.c +++ b/openbsc/src/libbsc/paging.c @@ -389,7 +389,7 @@ void paging_request_stop(struct gsm_bts *_bts, struct gsm_subscriber *subscr, * location area of the _bts as reconfiguration of the * network is probably happening less often. */ - bts = gsm_bts_by_lac(subscr->net, subscr->lac, bts); + bts = gsm_bts_by_lac(subscr->group->net, subscr->lac, bts); if (!bts) break; |