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.
This commit is contained in:
parent
1ffe98c175
commit
474698abef
|
@ -38,6 +38,8 @@
|
|||
#define DIR_BSC 1
|
||||
#define DIR_MSC 2
|
||||
|
||||
#define PAGIN_GROUP_UNASSIGNED -1
|
||||
|
||||
struct sccp_source_reference;
|
||||
struct sccp_connections;
|
||||
struct bsc_nat_parsed;
|
||||
|
@ -134,6 +136,7 @@ struct bsc_config {
|
|||
char *acc_lst_name;
|
||||
|
||||
int forbid_paging;
|
||||
int paging_group;
|
||||
|
||||
/* audio handling */
|
||||
int max_endpoints;
|
||||
|
@ -151,6 +154,14 @@ struct bsc_lac_entry {
|
|||
uint16_t lac;
|
||||
};
|
||||
|
||||
struct bsc_nat_paging_group {
|
||||
struct llist_head entry;
|
||||
|
||||
/* list of lac entries */
|
||||
struct llist_head lists;
|
||||
int nr;
|
||||
};
|
||||
|
||||
/**
|
||||
* BSCs point of view of endpoints
|
||||
*/
|
||||
|
@ -225,6 +236,9 @@ struct bsc_nat {
|
|||
/* access lists */
|
||||
struct llist_head access_lists;
|
||||
|
||||
/* paging groups */
|
||||
struct llist_head paging_groups;
|
||||
|
||||
/* known BSC's */
|
||||
struct llist_head bsc_configs;
|
||||
int num_bsc;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue