aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/gsm_subscriber.c
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2009-08-19 12:53:57 +0200
committerHolger Hans Peter Freyther <zecke@selfish.org>2009-09-28 05:14:25 +0200
commit2223025e218263af6e1157ef1eeca1686cefe4b9 (patch)
treec3d9f36d3d14bf650f86b85d4bcc83492c741e1b /openbsc/src/gsm_subscriber.c
parent6b0b103bdcfaf15ca1c33d3c61f211cb40661e92 (diff)
[tmsi] Make the tmsi a 4 octet number
tmsi is four octets long, there is no need to make it a string and then jump through hoops to convert it to a number. Keep the database using it as a string to benefit from the NULL handling of the db. Introduce the reserved tmsi which has all bits set to 1 according to GSM 03.03 ยง2.4 and start checking for it and make sure the db code will never allocate such a tmsi.
Diffstat (limited to 'openbsc/src/gsm_subscriber.c')
-rw-r--r--openbsc/src/gsm_subscriber.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/openbsc/src/gsm_subscriber.c b/openbsc/src/gsm_subscriber.c
index 84e14a0ea..a4e35c7b1 100644
--- a/openbsc/src/gsm_subscriber.c
+++ b/openbsc/src/gsm_subscriber.c
@@ -35,17 +35,19 @@
extern struct llist_head *subscr_bsc_active_subscriber(void);
struct gsm_subscriber *subscr_get_by_tmsi(struct gsm_network *net,
- const char *tmsi)
+ u_int32_t tmsi)
{
+ char tmsi_string[14];
struct gsm_subscriber *subscr;
/* we might have a record in memory already */
llist_for_each_entry(subscr, subscr_bsc_active_subscriber(), entry) {
- if (strcmp(subscr->tmsi, tmsi) == 0)
+ if (tmsi == subscr->tmsi)
return subscr_get(subscr);
}
- return db_get_subscriber(net, GSM_SUBSCRIBER_TMSI, tmsi);
+ sprintf(tmsi_string, "%u", tmsi);
+ return db_get_subscriber(net, GSM_SUBSCRIBER_TMSI, tmsi_string);
}
struct gsm_subscriber *subscr_get_by_imsi(struct gsm_network *net,