diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2009-08-19 12:53:57 +0200 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2009-09-28 05:14:25 +0200 |
commit | 2223025e218263af6e1157ef1eeca1686cefe4b9 (patch) | |
tree | c3d9f36d3d14bf650f86b85d4bcc83492c741e1b /openbsc/include/openbsc | |
parent | 6b0b103bdcfaf15ca1c33d3c61f211cb40661e92 (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/include/openbsc')
-rw-r--r-- | openbsc/include/openbsc/gsm_subscriber.h | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/openbsc/include/openbsc/gsm_subscriber.h b/openbsc/include/openbsc/gsm_subscriber.h index aaf261eda..ea70c3aa2 100644 --- a/openbsc/include/openbsc/gsm_subscriber.h +++ b/openbsc/include/openbsc/gsm_subscriber.h @@ -7,14 +7,17 @@ #define GSM_IMEI_LENGTH 17 #define GSM_IMSI_LENGTH 17 -#define GSM_TMSI_LENGTH 17 #define GSM_NAME_LENGTH 128 #define GSM_EXTENSION_LENGTH 128 +/* reserved according to GSM 03.03 § 2.4 */ +#define GSM_RESERVED_TMSI 0xFFFFFFFF + #define GSM_MIN_EXTEN 20000 #define GSM_MAX_EXTEN 49999 #define GSM_SUBSCRIBER_FIRST_CONTACT 0x00000001 +#define tmsi_from_string(str) strtoul(str, NULL, 10) struct gsm_equipment { long long unsigned int id; @@ -32,7 +35,7 @@ struct gsm_subscriber { struct gsm_network *net; long long unsigned int id; char imsi[GSM_IMSI_LENGTH]; - char tmsi[GSM_TMSI_LENGTH]; + u_int32_t tmsi; u_int16_t lac; char name[GSM_NAME_LENGTH]; char extension[GSM_EXTENSION_LENGTH]; @@ -70,7 +73,7 @@ enum gsm_subscriber_update_reason { struct gsm_subscriber *subscr_get(struct gsm_subscriber *subscr); struct gsm_subscriber *subscr_put(struct gsm_subscriber *subscr); struct gsm_subscriber *subscr_get_by_tmsi(struct gsm_network *net, - const char *tmsi); + u_int32_t tmsi); struct gsm_subscriber *subscr_get_by_imsi(struct gsm_network *net, const char *imsi); struct gsm_subscriber *subscr_get_by_extension(struct gsm_network *net, |