aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/gsm_subscriber_base.c
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-11-15 13:32:33 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-11-15 20:06:45 +0100
commit8dfd241bc657789bb89fcf781f898a6080b34ddd (patch)
tree3f958cf7bc91b7feed1d2c39d88e35bc7301a112 /openbsc/src/gsm_subscriber_base.c
parentd740b688dc33116efd12763170e1c5e6a4fdc9d4 (diff)
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.
Diffstat (limited to 'openbsc/src/gsm_subscriber_base.c')
-rw-r--r--openbsc/src/gsm_subscriber_base.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/openbsc/src/gsm_subscriber_base.c b/openbsc/src/gsm_subscriber_base.c
index f5fb16c5a..caa22a313 100644
--- a/openbsc/src/gsm_subscriber_base.c
+++ b/openbsc/src/gsm_subscriber_base.c
@@ -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;
+}