subscr: Add method to find an active subscriber
This is used by the paging code of the osmo_bsc. When we get a paging response there should be an active subscriber with the TMSI or IMSI and we can stop paging. There is no need to allocate a new subscriber.
This commit is contained in:
parent
d740b688dc
commit
8dfd241bc6
|
@ -83,6 +83,10 @@ int subscr_update(struct gsm_subscriber *s, struct gsm_bts *bts, int reason);
|
|||
void subscr_put_channel(struct gsm_subscriber_connection *conn);
|
||||
void subscr_get_channel(struct gsm_subscriber *subscr,
|
||||
int type, gsm_cbfn *cbfn, void *param);
|
||||
struct gsm_subscriber *subscr_active_by_tmsi(struct gsm_network *net,
|
||||
uint32_t tmsi);
|
||||
struct gsm_subscriber *subscr_active_by_imsi(struct gsm_network *net,
|
||||
const char *imsi);
|
||||
|
||||
char *subscr_name(struct gsm_subscriber *subscr);
|
||||
|
||||
|
|
|
@ -237,3 +237,27 @@ struct gsm_subscriber *subscr_get_or_create(struct gsm_network *net,
|
|||
subscr->net = net;
|
||||
return subscr;
|
||||
}
|
||||
|
||||
struct gsm_subscriber *subscr_active_by_tmsi(struct gsm_network *net, uint32_t tmsi)
|
||||
{
|
||||
struct gsm_subscriber *subscr;
|
||||
|
||||
llist_for_each_entry(subscr, subscr_bsc_active_subscriber(), entry) {
|
||||
if (subscr->tmsi == tmsi && subscr->net == net)
|
||||
return subscr_get(subscr);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct gsm_subscriber *subscr_active_by_imsi(struct gsm_network *net, const char *imsi)
|
||||
{
|
||||
struct gsm_subscriber *subscr;
|
||||
|
||||
llist_for_each_entry(subscr, subscr_bsc_active_subscriber(), entry) {
|
||||
if (strcmp(subscr->imsi, imsi) == 0 && subscr->net == net)
|
||||
return subscr_get(subscr);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue