From 474698abefae966fa8712cb47c2761ad1ef48238 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Mon, 2 May 2011 16:50:36 +0200 Subject: nat: Introduce the concept of a paging group and use it A paging group is a list of LACs, different BSCs can point to a paging group and use it for the LAC lookup. --- openbsc/src/osmo-bsc_nat/bsc_nat_utils.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'openbsc/src/osmo-bsc_nat/bsc_nat_utils.c') diff --git a/openbsc/src/osmo-bsc_nat/bsc_nat_utils.c b/openbsc/src/osmo-bsc_nat/bsc_nat_utils.c index 0a565a9b7..512656a6b 100644 --- a/openbsc/src/osmo-bsc_nat/bsc_nat_utils.c +++ b/openbsc/src/osmo-bsc_nat/bsc_nat_utils.c @@ -90,6 +90,7 @@ struct bsc_nat *bsc_nat_alloc(void) INIT_LLIST_HEAD(&nat->sccp_connections); INIT_LLIST_HEAD(&nat->bsc_connections); + INIT_LLIST_HEAD(&nat->paging_groups); INIT_LLIST_HEAD(&nat->bsc_configs); INIT_LLIST_HEAD(&nat->access_lists); INIT_LLIST_HEAD(&nat->dests); @@ -137,6 +138,7 @@ struct bsc_config *bsc_config_alloc(struct bsc_nat *nat, const char *token) conf->nr = nat->num_bsc; conf->nat = nat; conf->max_endpoints = 32; + conf->paging_group = PAGIN_GROUP_UNASSIGNED; INIT_LLIST_HEAD(&conf->lac_list); @@ -187,14 +189,36 @@ void bsc_config_del_lac(struct bsc_config *cfg, int _lac) } } +static struct bsc_nat_paging_group *bsc_nat_paging_group_num( + struct bsc_nat *nat, int group) +{ + struct bsc_nat_paging_group *pgroup; + + llist_for_each_entry(pgroup, &nat->paging_groups, entry) + if (pgroup->nr == group) + return pgroup; + + return NULL; +} + int bsc_config_handles_lac(struct bsc_config *cfg, int lac_nr) { + struct bsc_nat_paging_group *pgroup; struct bsc_lac_entry *entry; llist_for_each_entry(entry, &cfg->lac_list, entry) if (entry->lac == lac_nr) return 1; + /* now lookup the paging group */ + pgroup = bsc_nat_paging_group_num(cfg->nat, cfg->paging_group); + if (!pgroup) + return 0; + + llist_for_each_entry(entry, &pgroup->lists, entry) + if (entry->lac == lac_nr) + return 1; + return 0; } -- cgit v1.2.3