diff options
author | Jan Luebbe <jluebbe@debian.org> | 2009-08-12 10:12:52 +0200 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2009-08-12 21:03:00 +0200 |
commit | b0dfc31d7dc7ed533d5802b51dfb4cee92328d5c (patch) | |
tree | d7dd0266d8619ce113f5ac49983f399e32018b56 | |
parent | 7f28cd559a95077c9a6a7c53d29dd983b93f41f7 (diff) |
flag new subscriber structs in memory and send a signal
-rw-r--r-- | openbsc/include/openbsc/gsm_subscriber.h | 5 | ||||
-rw-r--r-- | openbsc/include/openbsc/signal.h | 1 | ||||
-rw-r--r-- | openbsc/src/db.c | 1 | ||||
-rw-r--r-- | openbsc/src/gsm_04_08.c | 9 |
4 files changed, 15 insertions, 1 deletions
diff --git a/openbsc/include/openbsc/gsm_subscriber.h b/openbsc/include/openbsc/gsm_subscriber.h index 3efb20c03..0abf17ab7 100644 --- a/openbsc/include/openbsc/gsm_subscriber.h +++ b/openbsc/include/openbsc/gsm_subscriber.h @@ -11,6 +11,8 @@ #define GSM_NAME_LENGTH 128 #define GSM_EXTENSION_LENGTH 128 +#define GSM_SUBSCRIBER_FIRST_CONTACT 0x00000001 + struct gsm_equipment { long long unsigned int id; char imei[GSM_IMEI_LENGTH]; @@ -33,6 +35,9 @@ struct gsm_subscriber { char extension[GSM_EXTENSION_LENGTH]; int authorized; + /* Temporary field which is not stored in the DB/HLR */ + u_int32_t flags; + /* Every user can only have one equipment in use at any given * point in time */ struct gsm_equipment equipment; diff --git a/openbsc/include/openbsc/signal.h b/openbsc/include/openbsc/signal.h index 1af849684..0dc1772dc 100644 --- a/openbsc/include/openbsc/signal.h +++ b/openbsc/include/openbsc/signal.h @@ -83,6 +83,7 @@ enum signal_lchan { enum signal_subscr { S_SUBSCR_ATTACHED, S_SUBSCR_DETACHED, + S_SUBSCR_FIRST_CONTACT, }; typedef int signal_cbfn(unsigned int subsys, unsigned int signal, diff --git a/openbsc/src/db.c b/openbsc/src/db.c index 9ad39d3da..e24b619c6 100644 --- a/openbsc/src/db.c +++ b/openbsc/src/db.c @@ -224,6 +224,7 @@ struct gsm_subscriber* db_create_subscriber(struct gsm_network *net, char *imsi) } subscr = subscr_alloc(); + subscr->flags |= GSM_SUBSCRIBER_FIRST_CONTACT; if (!subscr) return NULL; result = dbi_conn_queryf(conn, diff --git a/openbsc/src/gsm_04_08.c b/openbsc/src/gsm_04_08.c index ec7b4d339..5c4465e37 100644 --- a/openbsc/src/gsm_04_08.c +++ b/openbsc/src/gsm_04_08.c @@ -1151,8 +1151,12 @@ static int mm_rx_id_resp(struct msgb *msg) switch (mi_type) { case GSM_MI_TYPE_IMSI: - if (!lchan->subscr) + if (!lchan->subscr) { lchan->subscr = db_create_subscriber(net, mi_string); + if (lchan->subscr->flags & GSM_SUBSCRIBER_FIRST_CONTACT) { + dispatch_signal(SS_SUBSCR, S_SUBSCR_FIRST_CONTACT, &lchan->subscr); + } + } if (lchan->loc_operation) lchan->loc_operation->waiting_for_imsi = 0; break; @@ -1245,6 +1249,9 @@ static int mm_rx_loc_upd_req(struct msgb *msg) /* look up subscriber based on IMSI */ subscr = db_create_subscriber(bts->network, mi_string); + if (subscr->flags & GSM_SUBSCRIBER_FIRST_CONTACT) { + dispatch_signal(SS_SUBSCR, S_SUBSCR_FIRST_CONTACT, &subscr); + } break; case GSM_MI_TYPE_TMSI: DEBUGPC(DMM, "\n"); |