aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/osmo-bsc_nat/bsc_nat_utils.c
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2011-05-02 16:50:36 +0200
committerHolger Hans Peter Freyther <zecke@selfish.org>2011-05-02 19:19:15 +0200
commit474698abefae966fa8712cb47c2761ad1ef48238 (patch)
tree7a4e4325114dae20267af69821714f599b43e4c5 /openbsc/src/osmo-bsc_nat/bsc_nat_utils.c
parent1ffe98c17570cc38aff15ef6b4dbade89fd1a7e4 (diff)
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.
Diffstat (limited to 'openbsc/src/osmo-bsc_nat/bsc_nat_utils.c')
-rw-r--r--openbsc/src/osmo-bsc_nat/bsc_nat_utils.c24
1 files changed, 24 insertions, 0 deletions
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;
}