flag new subscriber structs in memory and send a signal
This commit is contained in:
parent
7f28cd559a
commit
b0dfc31d7d
|
@ -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;
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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");
|
||||
|
|
Loading…
Reference in New Issue