Commit 20cb51cb authored by Frédéric Leroy's avatar Frédéric Leroy

UE/EMM: move _emm_data to nas_user_t

parent 97fdf8bb
...@@ -133,7 +133,7 @@ static struct { ...@@ -133,7 +133,7 @@ static struct {
** INITIATED. ** ** INITIATED. **
** ** ** **
** Inputs: type: Type of the requested attach ** ** Inputs: type: Type of the requested attach **
** Others: _emm_data ** ** Others: user->emm_data-> **
** ** ** **
** Outputs: None ** ** Outputs: None **
** Return: RETURNok, RETURNerror ** ** Return: RETURNok, RETURNerror **
...@@ -154,7 +154,7 @@ int emm_proc_attach(nas_user_t *user, emm_proc_attach_type_t type) ...@@ -154,7 +154,7 @@ int emm_proc_attach(nas_user_t *user, emm_proc_attach_type_t type)
/* Update the emergency bearer service indicator */ /* Update the emergency bearer service indicator */
if (type == EMM_ATTACH_TYPE_EMERGENCY) { if (type == EMM_ATTACH_TYPE_EMERGENCY) {
_emm_data.is_emergency = TRUE; user->emm_data->is_emergency = TRUE;
} }
/* Setup initial NAS information message to transfer */ /* Setup initial NAS information message to transfer */
...@@ -163,7 +163,7 @@ int emm_proc_attach(nas_user_t *user, emm_proc_attach_type_t type) ...@@ -163,7 +163,7 @@ int emm_proc_attach(nas_user_t *user, emm_proc_attach_type_t type)
emm_as->type = type; emm_as->type = type;
/* Set the RRC connection establishment cause */ /* Set the RRC connection establishment cause */
if (_emm_data.is_emergency) { if (user->emm_data->is_emergency) {
emm_as->RRCcause = NET_ESTABLISH_CAUSE_EMERGENCY; emm_as->RRCcause = NET_ESTABLISH_CAUSE_EMERGENCY;
emm_as->RRCtype = NET_ESTABLISH_TYPE_EMERGENCY_CALLS; emm_as->RRCtype = NET_ESTABLISH_TYPE_EMERGENCY_CALLS;
} else { } else {
...@@ -172,7 +172,7 @@ int emm_proc_attach(nas_user_t *user, emm_proc_attach_type_t type) ...@@ -172,7 +172,7 @@ int emm_proc_attach(nas_user_t *user, emm_proc_attach_type_t type)
} }
/* Set the PLMN identifier of the selected PLMN */ /* Set the PLMN identifier of the selected PLMN */
emm_as->plmnID = &_emm_data.splmn; emm_as->plmnID = &user->emm_data->splmn;
/* /*
* Process the EPS mobile identity * Process the EPS mobile identity
*/ */
...@@ -182,55 +182,55 @@ int emm_proc_attach(nas_user_t *user, emm_proc_attach_type_t type) ...@@ -182,55 +182,55 @@ int emm_proc_attach(nas_user_t *user, emm_proc_attach_type_t type)
emm_as->UEid.imei = NULL; emm_as->UEid.imei = NULL;
/* Check whether the UE is configured for "AttachWithIMSI" */ /* Check whether the UE is configured for "AttachWithIMSI" */
if (_emm_data.AttachWithImsi) { if (user->emm_data->AttachWithImsi) {
/* Check whether the selected PLMN is neither the registered PLMN /* Check whether the selected PLMN is neither the registered PLMN
* nor in the list of equivalent PLMNs */ * nor in the list of equivalent PLMNs */
if ( (!_emm_data.is_rplmn) && (!_emm_data.is_eplmn) ) { if ( (!user->emm_data->is_rplmn) && (!user->emm_data->is_eplmn) ) {
LOG_TRACE(INFO, "EMM-PROC - Initiate EPS attach with IMSI"); LOG_TRACE(INFO, "EMM-PROC - Initiate EPS attach with IMSI");
/* Include the IMSI */ /* Include the IMSI */
emm_as->UEid.imsi = _emm_data.imsi; emm_as->UEid.imsi = user->emm_data->imsi;
} else { } else {
LOG_TRACE(INFO, LOG_TRACE(INFO,
"EMM-PROC - Initiate EPS attach with NO IMSI, is registered PLMN %d, is equivalent PLMN %d", "EMM-PROC - Initiate EPS attach with NO IMSI, is registered PLMN %d, is equivalent PLMN %d",
_emm_data.is_rplmn, user->emm_data->is_rplmn,
_emm_data.is_eplmn); user->emm_data->is_eplmn);
} }
} else if (_emm_data.guti) { } else if (user->emm_data->guti) {
LOG_TRACE(INFO, "EMM-PROC - Initiate EPS attach with GUTI"); LOG_TRACE(INFO, "EMM-PROC - Initiate EPS attach with GUTI");
/* Include a valid GUTI and the last visited registered TAI */ /* Include a valid GUTI and the last visited registered TAI */
emm_as->UEid.guti = _emm_data.guti; emm_as->UEid.guti = user->emm_data->guti;
emm_as->UEid.tai = _emm_data.tai; emm_as->UEid.tai = user->emm_data->tai;
} else if (!_emm_data.is_emergency) { } else if (!user->emm_data->is_emergency) {
LOG_TRACE(INFO, "EMM-PROC - Initiate EPS attach with IMSI cause is no emergency and no GUTI"); LOG_TRACE(INFO, "EMM-PROC - Initiate EPS attach with IMSI cause is no emergency and no GUTI");
/* Include the IMSI if no valid GUTI is available */ /* Include the IMSI if no valid GUTI is available */
emm_as->UEid.imsi = _emm_data.imsi; emm_as->UEid.imsi = user->emm_data->imsi;
} else { } else {
/* The UE is attaching for emergency bearer services and /* The UE is attaching for emergency bearer services and
* does not hold a valid GUTI */ * does not hold a valid GUTI */
if (_emm_data.imsi) { if (user->emm_data->imsi) {
/* Include the IMSI if valid (USIM is present) */ /* Include the IMSI if valid (USIM is present) */
LOG_TRACE(INFO, "EMM-PROC - Initiate EPS attach with IMSI cause is emergency and no GUTI"); LOG_TRACE(INFO, "EMM-PROC - Initiate EPS attach with IMSI cause is emergency and no GUTI");
emm_as->UEid.imsi = _emm_data.imsi; emm_as->UEid.imsi = user->emm_data->imsi;
} else { } else {
LOG_TRACE(INFO, "EMM-PROC - Initiate EPS attach with IMSI cause is emergency and no GUTI and no IMSI"); LOG_TRACE(INFO, "EMM-PROC - Initiate EPS attach with IMSI cause is emergency and no GUTI and no IMSI");
/* Include the IMEI if the IMSI is not valid */ /* Include the IMEI if the IMSI is not valid */
emm_as->UEid.imei = _emm_data.imei; emm_as->UEid.imei = user->emm_data->imei;
} }
} }
/* Setup EPS NAS security data */ /* Setup EPS NAS security data */
emm_as_set_security_data(&emm_as->sctx, _emm_data.security, FALSE, FALSE); emm_as_set_security_data(&emm_as->sctx, user->emm_data->security, FALSE, FALSE);
emm_as->ksi = EMM_AS_NO_KEY_AVAILABLE; emm_as->ksi = EMM_AS_NO_KEY_AVAILABLE;
if (_emm_data.security) { if (user->emm_data->security) {
if (_emm_data.security->type != EMM_KSI_NOT_AVAILABLE) { if (user->emm_data->security->type != EMM_KSI_NOT_AVAILABLE) {
emm_as->ksi = _emm_data.security->eksi; emm_as->ksi = user->emm_data->security->eksi;
} }
LOG_TRACE(INFO, "EMM-PROC - eps_encryption 0x%X", _emm_data.security->capability.eps_encryption); LOG_TRACE(INFO, "EMM-PROC - eps_encryption 0x%X", user->emm_data->security->capability.eps_encryption);
LOG_TRACE(INFO, "EMM-PROC - eps_integrity 0x%X", _emm_data.security->capability.eps_integrity); LOG_TRACE(INFO, "EMM-PROC - eps_integrity 0x%X", user->emm_data->security->capability.eps_integrity);
emm_as->encryption = _emm_data.security->capability.eps_encryption; emm_as->encryption = user->emm_data->security->capability.eps_encryption;
emm_as->integrity = _emm_data.security->capability.eps_integrity; emm_as->integrity = user->emm_data->security->capability.eps_integrity;
} }
/* /*
...@@ -244,7 +244,7 @@ int emm_proc_attach(nas_user_t *user, emm_proc_attach_type_t type) ...@@ -244,7 +244,7 @@ int emm_proc_attach(nas_user_t *user, emm_proc_attach_type_t type)
/* TODO: PDN type should be set according to the IP capability of the UE */ /* TODO: PDN type should be set according to the IP capability of the UE */
esm_sap.data.pdn_connect.pdn_type = NET_PDN_TYPE_IPV4; esm_sap.data.pdn_connect.pdn_type = NET_PDN_TYPE_IPV4;
esm_sap.data.pdn_connect.apn = NULL; esm_sap.data.pdn_connect.apn = NULL;
esm_sap.data.pdn_connect.is_emergency = _emm_data.is_emergency; esm_sap.data.pdn_connect.is_emergency = user->emm_data->is_emergency;
rc = esm_sap_send(user, &esm_sap); rc = esm_sap_send(user, &esm_sap);
if (rc != RETURNerror) { if (rc != RETURNerror) {
...@@ -342,7 +342,7 @@ int emm_proc_attach_request(void *args) ...@@ -342,7 +342,7 @@ int emm_proc_attach_request(void *args)
** ** ** **
** Outputs: None ** ** Outputs: None **
** Return: RETURNok, RETURNerror ** ** Return: RETURNok, RETURNerror **
** Others: _emm_data, T3412, T3402, T3423 ** ** Others: user->emm_data-> T3412, T3402, T3423 **
** ** ** **
***************************************************************************/ ***************************************************************************/
int emm_proc_attach_accept(nas_user_t *user, long t3412, long t3402, long t3423, int emm_proc_attach_accept(nas_user_t *user, long t3412, long t3402, long t3423,
...@@ -365,10 +365,10 @@ int emm_proc_attach_accept(nas_user_t *user, long t3412, long t3402, long t3423, ...@@ -365,10 +365,10 @@ int emm_proc_attach_accept(nas_user_t *user, long t3412, long t3402, long t3423,
T3410.id = nas_timer_stop(T3410.id); T3410.id = nas_timer_stop(T3410.id);
/* Delete old TAI list and store the received TAI list */ /* Delete old TAI list and store the received TAI list */
_emm_data.ltai.n_tais = n_tais; user->emm_data->ltai.n_tais = n_tais;
for (i = 0; (i < n_tais) && (i < EMM_DATA_TAI_MAX); i++) { for (i = 0; (i < n_tais) && (i < EMM_DATA_TAI_MAX); i++) {
_emm_data.ltai.tai[i] = tai[i]; user->emm_data->ltai.tai[i] = tai[i];
} }
/* Update periodic tracking area update timer value */ /* Update periodic tracking area update timer value */
...@@ -386,22 +386,22 @@ int emm_proc_attach_accept(nas_user_t *user, long t3412, long t3402, long t3423, ...@@ -386,22 +386,22 @@ int emm_proc_attach_accept(nas_user_t *user, long t3412, long t3402, long t3423,
/* Delete old GUTI and store the new assigned GUTI if provided */ /* Delete old GUTI and store the new assigned GUTI if provided */
if (guti) { if (guti) {
*_emm_data.guti = *guti; *user->emm_data->guti = *guti;
} }
/* Update the stored list of equivalent PLMNs */ /* Update the stored list of equivalent PLMNs */
_emm_data.nvdata.eplmn.n_plmns = 0; user->emm_data->nvdata.eplmn.n_plmns = 0;
if (n_eplmns > 0) { if (n_eplmns > 0) {
for (i = 0; (i < n_eplmns) && (i < EMM_DATA_EPLMN_MAX); i++) { for (i = 0; (i < n_eplmns) && (i < EMM_DATA_EPLMN_MAX); i++) {
int is_forbidden = FALSE; int is_forbidden = FALSE;
if (!_emm_data.is_emergency) { if (!user->emm_data->is_emergency) {
/* If the attach procedure is not for emergency bearer /* If the attach procedure is not for emergency bearer
* services, the UE shall remove from the list any PLMN * services, the UE shall remove from the list any PLMN
* code that is already in the list of forbidden PLMNs */ * code that is already in the list of forbidden PLMNs */
for (j = 0; j < _emm_data.fplmn.n_plmns; j++) { for (j = 0; j < user->emm_data->fplmn.n_plmns; j++) {
if (PLMNS_ARE_EQUAL(eplmn[i], _emm_data.fplmn.plmn[j])) { if (PLMNS_ARE_EQUAL(eplmn[i], user->emm_data->fplmn.plmn[j])) {
is_forbidden = TRUE; is_forbidden = TRUE;
break; break;
} }
...@@ -409,15 +409,15 @@ int emm_proc_attach_accept(nas_user_t *user, long t3412, long t3402, long t3423, ...@@ -409,15 +409,15 @@ int emm_proc_attach_accept(nas_user_t *user, long t3412, long t3402, long t3423,
} }
if ( !is_forbidden ) { if ( !is_forbidden ) {
_emm_data.nvdata.eplmn.plmn[_emm_data.nvdata.eplmn.n_plmns++] = user->emm_data->nvdata.eplmn.plmn[user->emm_data->nvdata.eplmn.n_plmns++] =
eplmn[i]; eplmn[i];
} }
} }
/* Add the PLMN code of the registered PLMN that sent the list */ /* Add the PLMN code of the registered PLMN that sent the list */
if (_emm_data.nvdata.eplmn.n_plmns < EMM_DATA_EPLMN_MAX) { if (user->emm_data->nvdata.eplmn.n_plmns < EMM_DATA_EPLMN_MAX) {
_emm_data.nvdata.eplmn.plmn[_emm_data.nvdata.eplmn.n_plmns++] = user->emm_data->nvdata.eplmn.plmn[user->emm_data->nvdata.eplmn.n_plmns++] =
_emm_data.splmn; user->emm_data->splmn;
} }
} }
...@@ -448,11 +448,11 @@ int emm_proc_attach_accept(nas_user_t *user, long t3412, long t3402, long t3423, ...@@ -448,11 +448,11 @@ int emm_proc_attach_accept(nas_user_t *user, long t3412, long t3402, long t3423,
* be sent to the network * be sent to the network
*/ */
emm_sap.primitive = EMMAS_DATA_REQ; emm_sap.primitive = EMMAS_DATA_REQ;
emm_sap.u.emm_as.u.data.guti = _emm_data.guti; emm_sap.u.emm_as.u.data.guti = user->emm_data->guti;
emm_sap.u.emm_as.u.data.ueid = 0; emm_sap.u.emm_as.u.data.ueid = 0;
/* Setup EPS NAS security data */ /* Setup EPS NAS security data */
emm_as_set_security_data(&emm_sap.u.emm_as.u.data.sctx, emm_as_set_security_data(&emm_sap.u.emm_as.u.data.sctx,
_emm_data.security, FALSE, TRUE); user->emm_data->security, FALSE, TRUE);
/* Get the activate default EPS bearer context accept message /* Get the activate default EPS bearer context accept message
* to be transfered within the ESM container of the attach * to be transfered within the ESM container of the attach
* complete message */ * complete message */
...@@ -497,7 +497,7 @@ int emm_proc_attach_accept(nas_user_t *user, long t3412, long t3402, long t3423, ...@@ -497,7 +497,7 @@ int emm_proc_attach_accept(nas_user_t *user, long t3412, long t3402, long t3423,
** ** ** **
** Outputs: None ** ** Outputs: None **
** Return: RETURNok, RETURNerror ** ** Return: RETURNok, RETURNerror **
** Others: _emm_data, _emm_attach_data, T3410 ** ** Others: user->emm_data-> _emm_attach_data, T3410 **
** ** ** **
***************************************************************************/ ***************************************************************************/
int emm_proc_attach_reject(nas_user_t *user, int emm_cause, const OctetString *esm_msg_pP) int emm_proc_attach_reject(nas_user_t *user, int emm_cause, const OctetString *esm_msg_pP)
...@@ -528,15 +528,15 @@ int emm_proc_attach_reject(nas_user_t *user, int emm_cause, const OctetString *e ...@@ -528,15 +528,15 @@ int emm_proc_attach_reject(nas_user_t *user, int emm_cause, const OctetString *e
case EMM_CAUSE_ROAMING_NOT_ALLOWED: case EMM_CAUSE_ROAMING_NOT_ALLOWED:
case EMM_CAUSE_NO_SUITABLE_CELLS: case EMM_CAUSE_NO_SUITABLE_CELLS:
/* Set the EPS update status to EU3 ROAMING NOT ALLOWED */ /* Set the EPS update status to EU3 ROAMING NOT ALLOWED */
_emm_data.status = EU3_ROAMING_NOT_ALLOWED; user->emm_data->status = EU3_ROAMING_NOT_ALLOWED;
/* Delete the GUTI */ /* Delete the GUTI */
_emm_data.guti = NULL; user->emm_data->guti = NULL;
/* Delete the last visited registered TAI */ /* Delete the last visited registered TAI */
_emm_data.tai = NULL; user->emm_data->tai = NULL;
/* Delete the eKSI */ /* Delete the eKSI */
if (_emm_data.security) { if (user->emm_data->security) {
_emm_data.security->type = EMM_KSI_NOT_AVAILABLE; user->emm_data->security->type = EMM_KSI_NOT_AVAILABLE;
} }
break; break;
...@@ -552,16 +552,16 @@ int emm_proc_attach_reject(nas_user_t *user, int emm_cause, const OctetString *e ...@@ -552,16 +552,16 @@ int emm_proc_attach_reject(nas_user_t *user, int emm_cause, const OctetString *e
case EMM_CAUSE_EPS_NOT_ALLOWED: case EMM_CAUSE_EPS_NOT_ALLOWED:
case EMM_CAUSE_BOTH_NOT_ALLOWED: case EMM_CAUSE_BOTH_NOT_ALLOWED:
/* Consider the USIM as invalid for EPS services */ /* Consider the USIM as invalid for EPS services */
_emm_data.usim_is_valid = FALSE; user->emm_data->usim_is_valid = FALSE;
/* Delete the list of equivalent PLMNs */ /* Delete the list of equivalent PLMNs */
_emm_data.nvdata.eplmn.n_plmns = 0; user->emm_data->nvdata.eplmn.n_plmns = 0;
break; break;
case EMM_CAUSE_PLMN_NOT_ALLOWED: case EMM_CAUSE_PLMN_NOT_ALLOWED:
case EMM_CAUSE_NOT_AUTHORIZED_IN_PLMN: case EMM_CAUSE_NOT_AUTHORIZED_IN_PLMN:
case EMM_CAUSE_ROAMING_NOT_ALLOWED: case EMM_CAUSE_ROAMING_NOT_ALLOWED:
/* Delete the list of equivalent PLMNs */ /* Delete the list of equivalent PLMNs */
_emm_data.nvdata.eplmn.n_plmns = 0; user->emm_data->nvdata.eplmn.n_plmns = 0;
/* Reset the attach attempt counter */ /* Reset the attach attempt counter */
_emm_attach_data.attempt_count = 0; _emm_attach_data.attempt_count = 0;
break; break;
...@@ -576,7 +576,7 @@ int emm_proc_attach_reject(nas_user_t *user, int emm_cause, const OctetString *e ...@@ -576,7 +576,7 @@ int emm_proc_attach_reject(nas_user_t *user, int emm_cause, const OctetString *e
case EMM_CAUSE_ESM_FAILURE: case EMM_CAUSE_ESM_FAILURE:
/* 3GPP TS 24.301, section 5.5.1.2.6, case d */ /* 3GPP TS 24.301, section 5.5.1.2.6, case d */
if (_emm_data.NAS_SignallingPriority != 1) { if (user->emm_data->NAS_SignallingPriority != 1) {
/* The UE is not configured for NAS signalling low priority; /* The UE is not configured for NAS signalling low priority;
* set the attach attempt counter to 5 */ * set the attach attempt counter to 5 */
_emm_attach_data.attempt_count = EMM_ATTACH_COUNTER_MAX; _emm_attach_data.attempt_count = EMM_ATTACH_COUNTER_MAX;
...@@ -603,25 +603,25 @@ int emm_proc_attach_reject(nas_user_t *user, int emm_cause, const OctetString *e ...@@ -603,25 +603,25 @@ int emm_proc_attach_reject(nas_user_t *user, int emm_cause, const OctetString *e
case EMM_CAUSE_PLMN_NOT_ALLOWED: case EMM_CAUSE_PLMN_NOT_ALLOWED:
case EMM_CAUSE_NOT_AUTHORIZED_IN_PLMN: case EMM_CAUSE_NOT_AUTHORIZED_IN_PLMN:
/* Store the PLMN identity in the "forbidden PLMN list" */ /* Store the PLMN identity in the "forbidden PLMN list" */
_emm_data.fplmn.plmn[_emm_data.fplmn.n_plmns++] = _emm_data.splmn; user->emm_data->fplmn.plmn[user->emm_data->fplmn.n_plmns++] = user->emm_data->splmn;
break; break;
case EMM_CAUSE_TA_NOT_ALLOWED: case EMM_CAUSE_TA_NOT_ALLOWED:
/* Store the current TAI in the list of "forbidden tracking /* Store the current TAI in the list of "forbidden tracking
* areas for regional provision of service" */ * areas for regional provision of service" */
_emm_data.ftai.tai[_emm_data.ftai.n_tais++] = *_emm_data.tai; user->emm_data->ftai.tai[user->emm_data->ftai.n_tais++] = *user->emm_data->tai;
break; break;
case EMM_CAUSE_ROAMING_NOT_ALLOWED: case EMM_CAUSE_ROAMING_NOT_ALLOWED:
/* Store the current TAI in the list of "forbidden tracking /* Store the current TAI in the list of "forbidden tracking
* areas for roaming" */ * areas for roaming" */
_emm_data.ftai_roaming.tai[_emm_data.ftai_roaming.n_tais++] = *_emm_data.tai; user->emm_data->ftai_roaming.tai[user->emm_data->ftai_roaming.n_tais++] = *user->emm_data->tai;
break; break;
case EMM_CAUSE_EPS_NOT_ALLOWED_IN_PLMN: case EMM_CAUSE_EPS_NOT_ALLOWED_IN_PLMN:
/* Store the PLMN identity in the "forbidden PLMNs for GPRS /* Store the PLMN identity in the "forbidden PLMNs for GPRS
* service" list */ * service" list */
_emm_data.fplmn_gprs.plmn[_emm_data.fplmn_gprs.n_plmns++] = _emm_data.splmn; user->emm_data->fplmn_gprs.plmn[user->emm_data->fplmn_gprs.n_plmns++] = user->emm_data->splmn;
break; break;
default : default :
...@@ -662,7 +662,7 @@ int emm_proc_attach_reject(nas_user_t *user, int emm_cause, const OctetString *e ...@@ -662,7 +662,7 @@ int emm_proc_attach_reject(nas_user_t *user, int emm_cause, const OctetString *e
break; break;
case EMM_CAUSE_IMEI_NOT_ACCEPTED: case EMM_CAUSE_IMEI_NOT_ACCEPTED:
if (_emm_data.is_emergency) { if (user->emm_data->is_emergency) {
/* /*
* Notify EMM that the UE failed to register to the network * Notify EMM that the UE failed to register to the network
* for emergency bearer services because "IMEI not accepted" * for emergency bearer services because "IMEI not accepted"
...@@ -714,7 +714,7 @@ int emm_proc_attach_reject(nas_user_t *user, int emm_cause, const OctetString *e ...@@ -714,7 +714,7 @@ int emm_proc_attach_reject(nas_user_t *user, int emm_cause, const OctetString *e
** ** ** **
** Outputs: None ** ** Outputs: None **
** Return: RETURNok, RETURNerror ** ** Return: RETURNok, RETURNerror **
** Others: _emm_data, _emm_attach_data ** ** Others: user->emm_data-> _emm_attach_data **
** ** ** **
***************************************************************************/ ***************************************************************************/
int emm_proc_attach_complete(void *args) int emm_proc_attach_complete(void *args)
...@@ -736,8 +736,8 @@ int emm_proc_attach_complete(void *args) ...@@ -736,8 +736,8 @@ int emm_proc_attach_complete(void *args)
/* TODO: Reset the tracking area updating attempt counter */ /* TODO: Reset the tracking area updating attempt counter */
/* Set the EPS update status to EU1 UPDATED */ /* Set the EPS update status to EU1 UPDATED */
_emm_data.status = EU1_UPDATED; user->emm_data->status = EU1_UPDATED;
_emm_data.is_attached = TRUE; user->emm_data->is_attached = TRUE;
/* /*
* Notify EMM that network attach complete message has been delivered * Notify EMM that network attach complete message has been delivered
...@@ -897,7 +897,7 @@ int emm_proc_attach_restart(nas_user_t *user) ...@@ -897,7 +897,7 @@ int emm_proc_attach_restart(nas_user_t *user)
* Notify EMM that the attach procedure has to be restarted * Notify EMM that the attach procedure has to be restarted
*/ */
emm_sap.primitive = EMMREG_ATTACH_INIT; emm_sap.primitive = EMMREG_ATTACH_INIT;
emm_sap.u.emm_reg.u.attach.is_emergency = _emm_data.is_emergency; emm_sap.u.emm_reg.u.attach.is_emergency = user->emm_data->is_emergency;
rc = emm_sap_send(user, &emm_sap); rc = emm_sap_send(user, &emm_sap);
LOG_FUNC_RETURN(rc); LOG_FUNC_RETURN(rc);
...@@ -914,17 +914,17 @@ int emm_proc_attach_restart(nas_user_t *user) ...@@ -914,17 +914,17 @@ int emm_proc_attach_restart(nas_user_t *user)
** ** ** **
** Outputs: None ** ** Outputs: None **
** Return: RETURNok, RETURNerror ** ** Return: RETURNok, RETURNerror **
** Others: _emm_data ** ** Others: user->emm_data-> **
** ** ** **
***************************************************************************/ ***************************************************************************/
int emm_proc_attach_set_emergency(void) int emm_proc_attach_set_emergency(emm_data_t *emm_data)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
LOG_TRACE(WARNING, "EMM-PROC - UE is now attached to the network for " LOG_TRACE(WARNING, "EMM-PROC - UE is now attached to the network for "
"emergency bearer services only"); "emergency bearer services only");
_emm_data.is_emergency = TRUE; emm_data->is_emergency = TRUE;
LOG_FUNC_RETURN(RETURNok); LOG_FUNC_RETURN(RETURNok);
} }
...@@ -941,7 +941,7 @@ int emm_proc_attach_set_emergency(void) ...@@ -941,7 +941,7 @@ int emm_proc_attach_set_emergency(void)
** ** ** **
** Outputs: None ** ** Outputs: None **
** Return: RETURNok, RETURNerror ** ** Return: RETURNok, RETURNerror **
** Others: _emm_data ** ** Others: user->emm_data-> **
** ** ** **
***************************************************************************/ ***************************************************************************/
int emm_proc_attach_set_detach(void *nas_user) int emm_proc_attach_set_detach(void *nas_user)
...@@ -955,7 +955,7 @@ int emm_proc_attach_set_detach(void *nas_user) ...@@ -955,7 +955,7 @@ int emm_proc_attach_set_detach(void *nas_user)
"EMM-PROC - UE is now locally detached from the network"); "EMM-PROC - UE is now locally detached from the network");
/* Reset the network attachment indicator */ /* Reset the network attachment indicator */
_emm_data.is_attached = FALSE; user->emm_data->is_attached = FALSE;
/* /*
* Notify that the UE is locally detached from the network * Notify that the UE is locally detached from the network
*/ */
...@@ -1016,7 +1016,7 @@ void *_emm_attach_t3410_handler(void *args) ...@@ -1016,7 +1016,7 @@ void *_emm_attach_t3410_handler(void *args)
if (rc != RETURNerror) { if (rc != RETURNerror) {
/* Locally release the NAS signalling connection */ /* Locally release the NAS signalling connection */
_emm_data.ecm_status = ECM_IDLE; user->emm_data->ecm_status = ECM_IDLE;
} }
LOG_FUNC_RETURN(NULL); LOG_FUNC_RETURN(NULL);
...@@ -1056,7 +1056,7 @@ static void *_emm_attach_t3411_handler(void *args) ...@@ -1056,7 +1056,7 @@ static void *_emm_attach_t3411_handler(void *args)
* restarted * restarted
*/ */
emm_sap.primitive = EMMREG_ATTACH_INIT; emm_sap.primitive = EMMREG_ATTACH_INIT;
emm_sap.u.emm_reg.u.attach.is_emergency = _emm_data.is_emergency; emm_sap.u.emm_reg.u.attach.is_emergency = user->emm_data->is_emergency;
(void) emm_sap_send(user, &emm_sap); (void) emm_sap_send(user, &emm_sap);
...@@ -1103,7 +1103,7 @@ static void *_emm_attach_t3402_handler(void *args) ...@@ -1103,7 +1103,7 @@ static void *_emm_attach_t3402_handler(void *args)
* restarted * restarted
*/ */
emm_sap.primitive = EMMREG_ATTACH_INIT; emm_sap.primitive = EMMREG_ATTACH_INIT;
emm_sap.u.emm_reg.u.attach.is_emergency = _emm_data.is_emergency; emm_sap.u.emm_reg.u.attach.is_emergency = user->emm_data->is_emergency;
(void) emm_sap_send(user, &emm_sap); (void) emm_sap_send(user, &emm_sap);
...@@ -1133,7 +1133,7 @@ static void *_emm_attach_t3402_handler(void *args) ...@@ -1133,7 +1133,7 @@ static void *_emm_attach_t3402_handler(void *args)
** ** ** **
** Outputs: emm_sap: EMM service access point ** ** Outputs: emm_sap: EMM service access point **
** Return: None ** ** Return: None **
** Others: _emm_data, _emm_attach_data, T3402, T3410, ** ** Others: user->emm_data-> _emm_attach_data, T3402, T3410, **
** T3411 ** ** T3411 **
** ** ** **
***************************************************************************/ ***************************************************************************/
...@@ -1165,21 +1165,21 @@ static void _emm_attach_abnormal_cases_bcd(nas_user_t *user, emm_sap_t *emm_sap) ...@@ -1165,21 +1165,21 @@ static void _emm_attach_abnormal_cases_bcd(nas_user_t *user, emm_sap_t *emm_sap)
emm_sap->primitive = EMMREG_ATTACH_FAILED; emm_sap->primitive = EMMREG_ATTACH_FAILED;
} else { } else {
/* Delete the GUTI */ /* Delete the GUTI */
_emm_data.guti = NULL; user->emm_data->guti = NULL;
/* Delete the TAI list */ /* Delete the TAI list */
_emm_data.ltai.n_tais = 0; user->emm_data->ltai.n_tais = 0;
/* Delete the last visited registered TAI */ /* Delete the last visited registered TAI */
_emm_data.tai = NULL; user->emm_data->tai = NULL;
/* Delete the list of equivalent PLMNs */ /* Delete the list of equivalent PLMNs */
_emm_data.nvdata.eplmn.n_plmns = 0; user->emm_data->nvdata.eplmn.n_plmns = 0;
/* Delete the eKSI */ /* Delete the eKSI */
if (_emm_data.security) { if (user->emm_data->security) {
_emm_data.security->type = EMM_KSI_NOT_AVAILABLE; user->emm_data->security->type = EMM_KSI_NOT_AVAILABLE;
} }
/* Set the EPS update status to EU2 NOT UPDATED */ /* Set the EPS update status to EU2 NOT UPDATED */
_emm_data.status = EU2_NOT_UPDATED; user->emm_data->status = EU2_NOT_UPDATED;
/* Start T3402 timer */ /* Start T3402 timer */
T3402.id = nas_timer_start(T3402.sec, _emm_attach_t3402_handler, user); T3402.id = nas_timer_start(T3402.sec, _emm_attach_t3402_handler, user);
......
...@@ -163,11 +163,11 @@ static int _authentication_kasme(const OctetString *autn, ...@@ -163,11 +163,11 @@ static int _authentication_kasme(const OctetString *autn,
** ksi: The NAS ket sey identifier ** ** ksi: The NAS ket sey identifier **
** rand: Authentication parameter RAND ** ** rand: Authentication parameter RAND **
** autn: Authentication parameter AUTN ** ** autn: Authentication parameter AUTN **
** Others: _emm_data, _authentication_data ** ** Others: user->emm_data-> _authentication_data **
** ** ** **
** Outputs: None ** ** Outputs: None **
** Return: RETURNok, RETURNerror ** ** Return: RETURNok, RETURNerror **
** Others: _emm_data, _authentication_data, T3416, ** ** Others: user->emm_data-> _authentication_data, T3416, **
** T3418, T3420 ** ** T3418, T3420 **
** ** ** **
***************************************************************************/ ***************************************************************************/
...@@ -185,7 +185,7 @@ int emm_proc_authentication_request(nas_user_t *user, int native_ksi, int ksi, ...@@ -185,7 +185,7 @@ int emm_proc_authentication_request(nas_user_t *user, int native_ksi, int ksi,
* The UE shall proceed with an EPS authentication challenge only if a * The UE shall proceed with an EPS authentication challenge only if a
* USIM is present * USIM is present
*/ */
if (!_emm_data.usim_is_valid) { if (!user->emm_data->usim_is_valid) {
LOG_TRACE(WARNING, "EMM-PROC - USIM is not present or not valid"); LOG_TRACE(WARNING, "EMM-PROC - USIM is not present or not valid");
LOG_FUNC_RETURN (RETURNerror); LOG_FUNC_RETURN (RETURNerror);
} }
...@@ -327,14 +327,14 @@ int emm_proc_authentication_request(nas_user_t *user, int native_ksi, int ksi, ...@@ -327,14 +327,14 @@ int emm_proc_authentication_request(nas_user_t *user, int native_ksi, int ksi,
*/ */
emm_sap_t emm_sap; emm_sap_t emm_sap;
emm_sap.primitive = EMMAS_SECURITY_RES; emm_sap.primitive = EMMAS_SECURITY_RES;
emm_sap.u.emm_as.u.security.guti = _emm_data.guti; emm_sap.u.emm_as.u.security.guti = user->emm_data->guti;
emm_sap.u.emm_as.u.security.ueid = 0; emm_sap.u.emm_as.u.security.ueid = 0;
emm_sap.u.emm_as.u.security.msgType = EMM_AS_MSG_TYPE_AUTH; emm_sap.u.emm_as.u.security.msgType = EMM_AS_MSG_TYPE_AUTH;
emm_sap.u.emm_as.u.security.emm_cause = EMM_CAUSE_SUCCESS; emm_sap.u.emm_as.u.security.emm_cause = EMM_CAUSE_SUCCESS;
emm_sap.u.emm_as.u.security.res = &res; emm_sap.u.emm_as.u.security.res = &res;
/* Setup EPS NAS security data */ /* Setup EPS NAS security data */
emm_as_set_security_data(&emm_sap.u.emm_as.u.security.sctx, emm_as_set_security_data(&emm_sap.u.emm_as.u.security.sctx,
_emm_data.security, FALSE, TRUE); user->emm_data->security, FALSE, TRUE);
rc = emm_sap_send(user, &emm_sap); rc = emm_sap_send(user, &emm_sap);
if (rc != RETURNerror) { if (rc != RETURNerror) {
...@@ -344,29 +344,29 @@ int emm_proc_authentication_request(nas_user_t *user, int native_ksi, int ksi, ...@@ -344,29 +344,29 @@ int emm_proc_authentication_request(nas_user_t *user, int native_ksi, int ksi,
_authentication_data.sync_count = 0; _authentication_data.sync_count = 0;
/* Create non-current EPS security context */ /* Create non-current EPS security context */
if (_emm_data.non_current == NULL) { if (user->emm_data->non_current == NULL) {
_emm_data.non_current = user->emm_data->non_current =
(emm_security_context_t *)malloc(sizeof(emm_security_context_t)); (emm_security_context_t *)malloc(sizeof(emm_security_context_t));
} }
if (_emm_data.non_current) { if (user->emm_data->non_current) {
memset(_emm_data.non_current, 0, sizeof(emm_security_context_t)); memset(user->emm_data->non_current, 0, sizeof(emm_security_context_t));
/* Set the security context type */ /* Set the security context type */
if (native_ksi) { if (native_ksi) {
_emm_data.non_current->type = EMM_KSI_NATIVE; user->emm_data->non_current->type = EMM_KSI_NATIVE;
} else { } else {
_emm_data.non_current->type = EMM_KSI_MAPPED; user->emm_data->non_current->type = EMM_KSI_MAPPED;
} }
/* Set the EPS key set identifier */ /* Set the EPS key set identifier */
_emm_data.non_current->eksi = ksi; user->emm_data->non_current->eksi = ksi;
/* Derive the Kasme from the authentication challenge using /* Derive the Kasme from the authentication challenge using
* the PLMN identity of the selected PLMN */ * the PLMN identity of the selected PLMN */
_emm_data.non_current->kasme.length = AUTH_KASME_SIZE; user->emm_data->non_current->kasme.length = AUTH_KASME_SIZE;
_emm_data.non_current->kasme.value = malloc(32); user->emm_data->non_current->kasme.value = malloc(32);
_authentication_kasme(autn, &ck, &ik, &_emm_data.splmn, _authentication_kasme(autn, &ck, &ik, &user->emm_data->splmn,
&_emm_data.non_current->kasme); &user->emm_data->non_current->kasme);
/* NAS integrity and cyphering keys are not yet available */ /* NAS integrity and cyphering keys are not yet available */
} }
} }
...@@ -392,7 +392,7 @@ int emm_proc_authentication_request(nas_user_t *user, int native_ksi, int ksi, ...@@ -392,7 +392,7 @@ int emm_proc_authentication_request(nas_user_t *user, int native_ksi, int ksi,
** ** ** **
** Outputs: None ** ** Outputs: None **
** Return: RETURNok, RETURNerror ** ** Return: RETURNok, RETURNerror **
** Others: _emm_data, _authentication_data, T3410, ** ** Others: user->emm_data-> _authentication_data, T3410, **
** T3417, T3430 ** ** T3417, T3430 **
** ** ** **
***************************************************************************/ ***************************************************************************/
...@@ -409,21 +409,21 @@ int emm_proc_authentication_reject(nas_user_t *user) ...@@ -409,21 +409,21 @@ int emm_proc_authentication_reject(nas_user_t *user)
(void) emm_proc_authentication_delete(); (void) emm_proc_authentication_delete();
/* Set the EPS update status to EU3 ROAMING NOT ALLOWED */ /* Set the EPS update status to EU3 ROAMING NOT ALLOWED */
_emm_data.status = EU3_ROAMING_NOT_ALLOWED; user->emm_data->status = EU3_ROAMING_NOT_ALLOWED;
/* Delete the stored GUTI */ /* Delete the stored GUTI */
_emm_data.guti = NULL; user->emm_data->guti = NULL;
/* Delete the TAI list */ /* Delete the TAI list */
_emm_data.ltai.n_tais = 0; user->emm_data->ltai.n_tais = 0;
/* Delete the last visited registered TAI */ /* Delete the last visited registered TAI */
_emm_data.tai = NULL; user->emm_data->tai = NULL;
/* Delete the eKSI */ /* Delete the eKSI */
if (_emm_data.security) { if (user->emm_data->security) {
_emm_data.security->type = EMM_KSI_NOT_AVAILABLE; user->emm_data->security->type = EMM_KSI_NOT_AVAILABLE;
} }
/* Consider the USIM invalid */ /* Consider the USIM invalid */
_emm_data.usim_is_valid = FALSE; user->emm_data->usim_is_valid = FALSE;
/* Stop timer T3410 */ /* Stop timer T3410 */
if (T3410.id != NAS_TIMER_INACTIVE_ID) { if (T3410.id != NAS_TIMER_INACTIVE_ID) {
...@@ -664,14 +664,14 @@ static int _authentication_abnormal_cases_cde(nas_user_t *user, int emm_cause, ...@@ -664,14 +664,14 @@ static int _authentication_abnormal_cases_cde(nas_user_t *user, int emm_cause,
*/ */
emm_sap_t emm_sap; emm_sap_t emm_sap;
emm_sap.primitive = EMMAS_SECURITY_RES; emm_sap.primitive = EMMAS_SECURITY_RES;
emm_sap.u.emm_as.u.security.guti = _emm_data.guti; emm_sap.u.emm_as.u.security.guti = user->emm_data->guti;
emm_sap.u.emm_as.u.security.ueid = 0; emm_sap.u.emm_as.u.security.ueid = 0;
emm_sap.u.emm_as.u.security.msgType = EMM_AS_MSG_TYPE_AUTH; emm_sap.u.emm_as.u.security.msgType = EMM_AS_MSG_TYPE_AUTH;
emm_sap.u.emm_as.u.security.emm_cause = emm_cause; emm_sap.u.emm_as.u.security.emm_cause = emm_cause;
emm_sap.u.emm_as.u.security.auts = auts; emm_sap.u.emm_as.u.security.auts = auts;
/* Setup EPS NAS security data */ /* Setup EPS NAS security data */
emm_as_set_security_data(&emm_sap.u.emm_as.u.security.sctx, emm_as_set_security_data(&emm_sap.u.emm_as.u.security.sctx,
_emm_data.security, FALSE, TRUE); user->emm_data->security, FALSE, TRUE);
rc = emm_sap_send(user, &emm_sap); rc = emm_sap_send(user, &emm_sap);
if (rc != RETURNerror) { if (rc != RETURNerror) {
...@@ -787,7 +787,7 @@ static int _authentication_abnormal_case_f(nas_user_t *user) ...@@ -787,7 +787,7 @@ static int _authentication_abnormal_case_f(nas_user_t *user)
*/ */
emm_sap_t emm_sap; emm_sap_t emm_sap;
emm_sap.primitive = EMMAS_RELEASE_REQ; emm_sap.primitive = EMMAS_RELEASE_REQ;
emm_sap.u.emm_as.u.release.guti = _emm_data.guti; emm_sap.u.emm_as.u.release.guti = user->emm_data->guti;
emm_sap.u.emm_as.u.release.cause = EMM_AS_CAUSE_AUTHENTICATION; emm_sap.u.emm_as.u.release.cause = EMM_AS_CAUSE_AUTHENTICATION;
rc = emm_sap_send(user, &emm_sap); rc = emm_sap_send(user, &emm_sap);
......
...@@ -124,7 +124,7 @@ static struct { ...@@ -124,7 +124,7 @@ static struct {
** Inputs: type: Type of the requested detach ** ** Inputs: type: Type of the requested detach **
** switch_off: Indicates whether the detach is required ** ** switch_off: Indicates whether the detach is required **
** because the UE is switched off or not ** ** because the UE is switched off or not **
** Others: _emm_data ** ** Others: user->emm_data-> **
** ** ** **
** Outputs: None ** ** Outputs: None **
** Return: RETURNok, RETURNerror ** ** Return: RETURNok, RETURNerror **
...@@ -167,10 +167,10 @@ int emm_proc_detach(nas_user_t *user, emm_proc_detach_type_t type, int switch_of ...@@ -167,10 +167,10 @@ int emm_proc_detach(nas_user_t *user, emm_proc_detach_type_t type, int switch_of
/* Set the switch-off indicator */ /* Set the switch-off indicator */
emm_as->switch_off = switch_off; emm_as->switch_off = switch_off;
/* Set the EPS mobile identity */ /* Set the EPS mobile identity */
emm_as->guti = _emm_data.guti; emm_as->guti = user->emm_data->guti;
emm_as->ueid = 0; emm_as->ueid = 0;
/* Setup EPS NAS security data */ /* Setup EPS NAS security data */
emm_as_set_security_data(&emm_as->sctx, _emm_data.security, FALSE, TRUE); emm_as_set_security_data(&emm_as->sctx, user->emm_data->security, FALSE, TRUE);
/* /*
* Notify EMM-AS SAP that Detach Request message has to * Notify EMM-AS SAP that Detach Request message has to
...@@ -413,10 +413,10 @@ void *_emm_detach_t3421_handler(void *args) ...@@ -413,10 +413,10 @@ void *_emm_detach_t3421_handler(void *args)
/* Set the switch-off indicator */ /* Set the switch-off indicator */
emm_as->switch_off = _emm_detach_data.switch_off; emm_as->switch_off = _emm_detach_data.switch_off;
/* Set the EPS mobile identity */ /* Set the EPS mobile identity */
emm_as->guti = _emm_data.guti; emm_as->guti = user->emm_data->guti;
emm_as->ueid = 0; emm_as->ueid = 0;
/* Setup EPS NAS security data */ /* Setup EPS NAS security data */
emm_as_set_security_data(&emm_as->sctx, _emm_data.security, emm_as_set_security_data(&emm_as->sctx, user->emm_data->security,
FALSE, TRUE); FALSE, TRUE);
/* /*
......
...@@ -134,8 +134,8 @@ int emm_proc_status(nas_user_t *user, unsigned int ueid, int emm_cause) ...@@ -134,8 +134,8 @@ int emm_proc_status(nas_user_t *user, unsigned int ueid, int emm_cause)
emm_sap.u.emm_as.u.status.emm_cause = emm_cause; emm_sap.u.emm_as.u.status.emm_cause = emm_cause;
emm_sap.u.emm_as.u.status.ueid = ueid; emm_sap.u.emm_as.u.status.ueid = ueid;
emm_sap.u.emm_as.u.status.guti = _emm_data.guti; emm_sap.u.emm_as.u.status.guti = user->emm_data->guti;
sctx = _emm_data.security; sctx = user->emm_data->security;
/* Setup EPS NAS security data */ /* Setup EPS NAS security data */
emm_as_set_security_data(&emm_sap.u.emm_as.u.status.sctx, sctx, emm_as_set_security_data(&emm_sap.u.emm_as.u.status.sctx, sctx,
FALSE, TRUE); FALSE, TRUE);
......
...@@ -130,8 +130,8 @@ int emm_proc_identification_request(nas_user_t *user, emm_proc_identity_type_t t ...@@ -130,8 +130,8 @@ int emm_proc_identification_request(nas_user_t *user, emm_proc_identity_type_t t
imsi_t modified_imsi; imsi_t modified_imsi;
/* International Mobile Subscriber Identity is requested */ /* International Mobile Subscriber Identity is requested */
if (_emm_data.imsi) { if (user->emm_data->imsi) {
memcpy (&modified_imsi, _emm_data.imsi, sizeof (modified_imsi)); memcpy (&modified_imsi, user->emm_data->imsi, sizeof (modified_imsi));
/* LW: Eventually replace the 0xF value set in MNC digit 3 by a 0 to avoid IMSI to be truncated before reaching HSS */ /* LW: Eventually replace the 0xF value set in MNC digit 3 by a 0 to avoid IMSI to be truncated before reaching HSS */
if (modified_imsi.u.num.digit6 == 0xF) { if (modified_imsi.u.num.digit6 == 0xF) {
...@@ -167,9 +167,9 @@ int emm_proc_identification_request(nas_user_t *user, emm_proc_identity_type_t t ...@@ -167,9 +167,9 @@ int emm_proc_identification_request(nas_user_t *user, emm_proc_identity_type_t t
case EMM_IDENT_TYPE_IMEI: case EMM_IDENT_TYPE_IMEI:
/* International Mobile Equipment Identity is requested */ /* International Mobile Equipment Identity is requested */
if (_emm_data.imei) { if (user->emm_data->imei) {
emm_sap.u.emm_as.u.security.identType = EMM_IDENT_TYPE_IMEI; emm_sap.u.emm_as.u.security.identType = EMM_IDENT_TYPE_IMEI;
emm_sap.u.emm_as.u.security.imei = _emm_data.imei; emm_sap.u.emm_as.u.security.imei = user->emm_data->imei;
} }
break; break;
...@@ -177,9 +177,9 @@ int emm_proc_identification_request(nas_user_t *user, emm_proc_identity_type_t t ...@@ -177,9 +177,9 @@ int emm_proc_identification_request(nas_user_t *user, emm_proc_identity_type_t t
case EMM_IDENT_TYPE_TMSI: case EMM_IDENT_TYPE_TMSI:
/* Temporary Mobile Subscriber Identity is requested */ /* Temporary Mobile Subscriber Identity is requested */
if (_emm_data.guti) { if (user->emm_data->guti) {
emm_sap.u.emm_as.u.security.identType = EMM_IDENT_TYPE_TMSI; emm_sap.u.emm_as.u.security.identType = EMM_IDENT_TYPE_TMSI;
emm_sap.u.emm_as.u.security.tmsi = _emm_data.guti->m_tmsi; emm_sap.u.emm_as.u.security.tmsi = user->emm_data->guti->m_tmsi;
} }
break; break;
...@@ -194,12 +194,12 @@ int emm_proc_identification_request(nas_user_t *user, emm_proc_identity_type_t t ...@@ -194,12 +194,12 @@ int emm_proc_identification_request(nas_user_t *user, emm_proc_identity_type_t t
* to the MME * to the MME
*/ */
emm_sap.primitive = EMMAS_SECURITY_RES; emm_sap.primitive = EMMAS_SECURITY_RES;
emm_sap.u.emm_as.u.security.guti = _emm_data.guti; emm_sap.u.emm_as.u.security.guti = user->emm_data->guti;
emm_sap.u.emm_as.u.security.ueid = 0; emm_sap.u.emm_as.u.security.ueid = 0;
emm_sap.u.emm_as.u.security.msgType = EMM_AS_MSG_TYPE_IDENT; emm_sap.u.emm_as.u.security.msgType = EMM_AS_MSG_TYPE_IDENT;
/* Setup EPS NAS security data */ /* Setup EPS NAS security data */
emm_as_set_security_data(&emm_sap.u.emm_as.u.security.sctx, emm_as_set_security_data(&emm_sap.u.emm_as.u.security.sctx,
_emm_data.security, FALSE, TRUE); user->emm_data->security, FALSE, TRUE);
rc = emm_sap_send(user, &emm_sap); rc = emm_sap_send(user, &emm_sap);
LOG_FUNC_RETURN (rc); LOG_FUNC_RETURN (rc);
......
...@@ -269,10 +269,9 @@ int IdleMode_get_splmn_index(void) ...@@ -269,10 +269,9 @@ int IdleMode_get_splmn_index(void)
** ** ** **
** Outputs: None ** ** Outputs: None **
** Return: The size of the list in bytes ** ** Return: The size of the list in bytes **
** Others: _emm_data.plist **
** ** ** **
***************************************************************************/ ***************************************************************************/
int IdleMode_update_plmn_list(int i) int IdleMode_update_plmn_list(emm_data_t *emm_data, int i)
{ {
int offset = 0; int offset = 0;
int n = 1; int n = 1;
...@@ -281,22 +280,22 @@ int IdleMode_update_plmn_list(int i) ...@@ -281,22 +280,22 @@ int IdleMode_update_plmn_list(int i)
struct plmn_param_t *plmn = &(_emm_plmn_list.param[i++]); struct plmn_param_t *plmn = &(_emm_plmn_list.param[i++]);
if (n++ > 1) { if (n++ > 1) {
offset += snprintf(_emm_data.plist.buffer + offset, offset += snprintf(emm_data->plist.buffer + offset,
EMM_DATA_BUFFER_SIZE - offset, ","); EMM_DATA_BUFFER_SIZE - offset, ",");
} }
offset += snprintf(_emm_data.plist.buffer + offset, offset += snprintf(emm_data->plist.buffer + offset,
EMM_DATA_BUFFER_SIZE - offset, "(%d,%s,%s,%s", EMM_DATA_BUFFER_SIZE - offset, "(%d,%s,%s,%s",
plmn->stat, plmn->fullname, plmn->stat, plmn->fullname,
plmn->shortname, plmn->num); plmn->shortname, plmn->num);
if (plmn->rat != NET_ACCESS_UNAVAILABLE) { if (plmn->rat != NET_ACCESS_UNAVAILABLE) {
offset += snprintf(_emm_data.plist.buffer + offset, offset += snprintf(emm_data->plist.buffer + offset,
EMM_DATA_BUFFER_SIZE - offset, ",%d", EMM_DATA_BUFFER_SIZE - offset, ",%d",
plmn->rat); plmn->rat);
} }
offset += snprintf(_emm_data.plist.buffer + offset, offset += snprintf(emm_data->plist.buffer + offset,
EMM_DATA_BUFFER_SIZE - offset, ")"); EMM_DATA_BUFFER_SIZE - offset, ")");
} }
...@@ -503,7 +502,7 @@ int IdleMode_get_plmn_id_index(const char *plmn) ...@@ -503,7 +502,7 @@ int IdleMode_get_plmn_id_index(const char *plmn)
** to PLMN selection procedure. ** ** to PLMN selection procedure. **
** ** ** **
** Inputs: None ** ** Inputs: None **
** Others: _emm_data ** ** Others: user->emm_data-> **
** ** ** **
** Outputs: None ** ** Outputs: None **
** Return: RETURNok, RETURNerror ** ** Return: RETURNok, RETURNerror **
...@@ -518,21 +517,21 @@ int emm_proc_initialize(nas_user_t *user) ...@@ -518,21 +517,21 @@ int emm_proc_initialize(nas_user_t *user)
int rc; int rc;
int i; int i;
if (!_emm_data.usim_is_valid) { if (!user->emm_data->usim_is_valid) {
/* The USIM application is not present or not valid */ /* The USIM application is not present or not valid */
LOG_TRACE(WARNING, "EMM-IDLE - USIM is not valid"); LOG_TRACE(WARNING, "EMM-IDLE - USIM is not valid");
emm_sap.primitive = EMMREG_NO_IMSI; emm_sap.primitive = EMMREG_NO_IMSI;
} else { } else {
/* The highest priority is given to either the "equivalent PLMNs" /* The highest priority is given to either the "equivalent PLMNs"
* if available, or the last registered PLMN */ * if available, or the last registered PLMN */
if (_emm_data.nvdata.eplmn.n_plmns > 0) { if (user->emm_data->nvdata.eplmn.n_plmns > 0) {
for (i=0; i < _emm_data.nvdata.eplmn.n_plmns; i++) { for (i=0; i < user->emm_data->nvdata.eplmn.n_plmns; i++) {
_emm_plmn_list.plmn[_emm_plmn_list.n_plmns++] = _emm_plmn_list.plmn[_emm_plmn_list.n_plmns++] =
&_emm_data.nvdata.eplmn.plmn[i]; &user->emm_data->nvdata.eplmn.plmn[i];
} }
} else if ( PLMN_IS_VALID(_emm_data.nvdata.rplmn) ) { } else if ( PLMN_IS_VALID(user->emm_data->nvdata.rplmn) ) {
_emm_plmn_list.plmn[_emm_plmn_list.n_plmns++] = _emm_plmn_list.plmn[_emm_plmn_list.n_plmns++] =
&_emm_data.nvdata.rplmn; &user->emm_data->nvdata.rplmn;
} }
/* Update the index of the HPLMN or EHPLM of highest priority. /* Update the index of the HPLMN or EHPLM of highest priority.
...@@ -544,25 +543,25 @@ int emm_proc_initialize(nas_user_t *user) ...@@ -544,25 +543,25 @@ int emm_proc_initialize(nas_user_t *user)
/* Add the highest priority PLMN in the list of "equivalent HPLMNs" /* Add the highest priority PLMN in the list of "equivalent HPLMNs"
if present and not empty, or the HPLMN derived from the IMSI */ if present and not empty, or the HPLMN derived from the IMSI */
if (_emm_data.ehplmn.n_plmns > 0) { if (user->emm_data->ehplmn.n_plmns > 0) {
_emm_plmn_list.plmn[_emm_plmn_list.n_plmns++] = _emm_plmn_list.plmn[_emm_plmn_list.n_plmns++] =
&_emm_data.ehplmn.plmn[0]; &user->emm_data->ehplmn.plmn[0];
} else { } else {
_emm_plmn_list.plmn[_emm_plmn_list.n_plmns++] = &_emm_data.hplmn; _emm_plmn_list.plmn[_emm_plmn_list.n_plmns++] = &user->emm_data->hplmn;
} }
/* Each PLMN/access technology combination in the "User /* Each PLMN/access technology combination in the "User
* Controlled PLMN Selector with Access Technology" */ * Controlled PLMN Selector with Access Technology" */
for (i=0; i < _emm_data.plmn.n_plmns; i++) { for (i=0; i < user->emm_data->plmn.n_plmns; i++) {
_emm_plmn_list.plmn[_emm_plmn_list.n_plmns++] = _emm_plmn_list.plmn[_emm_plmn_list.n_plmns++] =
&_emm_data.plmn.plmn[i]; &user->emm_data->plmn.plmn[i];
} }
/* Each PLMN/access technology combination in the "Operator /* Each PLMN/access technology combination in the "Operator
* Controlled PLMN Selector with Access Technology" */ * Controlled PLMN Selector with Access Technology" */
for (i=0; i < _emm_data.oplmn.n_plmns; i++) { for (i=0; i < user->emm_data->oplmn.n_plmns; i++) {
_emm_plmn_list.plmn[_emm_plmn_list.n_plmns++] = _emm_plmn_list.plmn[_emm_plmn_list.n_plmns++] =
&_emm_data.oplmn.plmn[i]; &user->emm_data->oplmn.plmn[i];
} }
/* Other PLMN/access technology combinations with received /* Other PLMN/access technology combinations with received
...@@ -582,9 +581,9 @@ int emm_proc_initialize(nas_user_t *user) ...@@ -582,9 +581,9 @@ int emm_proc_initialize(nas_user_t *user)
plmn->fullname[0] = '\0'; plmn->fullname[0] = '\0';
plmn->shortname[0] = '\0'; plmn->shortname[0] = '\0';
} else { } else {
strncpy(plmn->fullname, _emm_data.opnn[id].fullname, strncpy(plmn->fullname, user->emm_data->opnn[id].fullname,
NET_FORMAT_LONG_SIZE); NET_FORMAT_LONG_SIZE);
strncpy(plmn->shortname, _emm_data.opnn[id].shortname, strncpy(plmn->shortname, user->emm_data->opnn[id].shortname,
NET_FORMAT_SHORT_SIZE); NET_FORMAT_SHORT_SIZE);
} }
...@@ -627,7 +626,7 @@ int emm_proc_initialize(nas_user_t *user) ...@@ -627,7 +626,7 @@ int emm_proc_initialize(nas_user_t *user)
** mode. ** ** mode. **
** ** ** **
** Inputs: None ** ** Inputs: None **
** Others: _emm_plmn_list, _emm_data ** ** Others: _emm_plmn_list, user->emm_data-> **
** ** ** **
** Outputs: None ** ** Outputs: None **
** Return: None ** ** Return: None **
...@@ -640,7 +639,7 @@ int emm_proc_plmn_selection(nas_user_t *user, int index) ...@@ -640,7 +639,7 @@ int emm_proc_plmn_selection(nas_user_t *user, int index)
int rc = RETURNok; int rc = RETURNok;
if (_emm_data.plmn_mode != EMM_DATA_PLMN_AUTO) { if (user->emm_data->plmn_mode != EMM_DATA_PLMN_AUTO) {
/* /*
* Manual or manual/automatic mode of operation * Manual or manual/automatic mode of operation
* -------------------------------------------- * --------------------------------------------
...@@ -649,13 +648,13 @@ int emm_proc_plmn_selection(nas_user_t *user, int index) ...@@ -649,13 +648,13 @@ int emm_proc_plmn_selection(nas_user_t *user, int index)
/* /*
* Selection of the last registered or equivalent PLMNs failed * Selection of the last registered or equivalent PLMNs failed
*/ */
if (_emm_data.plmn_index < 0) { if (user->emm_data->plmn_index < 0) {
/* /*
* The user did not select any PLMN yet; display the ordered * The user did not select any PLMN yet; display the ordered
* list of available PLMNs to the user * list of available PLMNs to the user
*/ */
index = -1; index = -1;
rc = emm_proc_network_notify(_emm_plmn_list.hplmn); rc = emm_proc_network_notify(user->emm_data, _emm_plmn_list.hplmn);
if (rc != RETURNok) { if (rc != RETURNok) {
LOG_TRACE(WARNING, "EMM-IDLE - Failed to notify " LOG_TRACE(WARNING, "EMM-IDLE - Failed to notify "
...@@ -665,7 +664,7 @@ int emm_proc_plmn_selection(nas_user_t *user, int index) ...@@ -665,7 +664,7 @@ int emm_proc_plmn_selection(nas_user_t *user, int index)
/* /*
* Try to register to the PLMN manually selected by the user * Try to register to the PLMN manually selected by the user
*/ */
index = _emm_data.plmn_index; index = user->emm_data->plmn_index;
} }
} }
} }
...@@ -714,11 +713,11 @@ int emm_proc_plmn_selection(nas_user_t *user, int index) ...@@ -714,11 +713,11 @@ int emm_proc_plmn_selection(nas_user_t *user, int index)
** ci: The identifier of the cell ** ** ci: The identifier of the cell **
** rat: The radio access technology supported by ** ** rat: The radio access technology supported by **
** the cell ** ** the cell **
** Others: _emm_plmn_list, _emm_data ** ** Others: _emm_plmn_list, user->emm_data-> **
** ** ** **
** Outputs: None ** ** Outputs: None **
** Return: None ** ** Return: None **
** Others: _emm_plmn_list, _emm_data ** ** Others: _emm_plmn_list, user->emm_data-> **
** ** ** **
***************************************************************************/ ***************************************************************************/
int emm_proc_plmn_selection_end(nas_user_t *user, int found, tac_t tac, ci_t ci, AcT_t rat) int emm_proc_plmn_selection_end(nas_user_t *user, int found, tac_t tac, ci_t ci, AcT_t rat)
...@@ -732,15 +731,15 @@ int emm_proc_plmn_selection_end(nas_user_t *user, int found, tac_t tac, ci_t ci, ...@@ -732,15 +731,15 @@ int emm_proc_plmn_selection_end(nas_user_t *user, int found, tac_t tac, ci_t ci,
LOG_TRACE(INFO, "EMM-IDLE - %s cell found for PLMN %d in %s mode", LOG_TRACE(INFO, "EMM-IDLE - %s cell found for PLMN %d in %s mode",
(found)? "One" : "No", index, (found)? "One" : "No", index,
(_emm_data.plmn_mode == EMM_DATA_PLMN_AUTO)? "Automatic" : (user->emm_data->plmn_mode == EMM_DATA_PLMN_AUTO)? "Automatic" :
(_emm_data.plmn_mode == EMM_DATA_PLMN_MANUAL)? "Manual" : (user->emm_data->plmn_mode == EMM_DATA_PLMN_MANUAL)? "Manual" :
"Automatic/manual"); "Automatic/manual");
if (found) { if (found) {
int is_forbidden = FALSE; int is_forbidden = FALSE;
/* Select the PLMN of which a suitable cell has been found */ /* Select the PLMN of which a suitable cell has been found */
_emm_data.splmn = *_emm_plmn_list.plmn[index]; user->emm_data->splmn = *_emm_plmn_list.plmn[index];
/* Update the selected PLMN's parameters */ /* Update the selected PLMN's parameters */
_emm_plmn_list.param[index].tac = tac; _emm_plmn_list.param[index].tac = tac;
...@@ -748,13 +747,13 @@ int emm_proc_plmn_selection_end(nas_user_t *user, int found, tac_t tac, ci_t ci, ...@@ -748,13 +747,13 @@ int emm_proc_plmn_selection_end(nas_user_t *user, int found, tac_t tac, ci_t ci,
_emm_plmn_list.param[index].rat = rat; _emm_plmn_list.param[index].rat = rat;
/* Update the location data and notify EMM that data have changed */ /* Update the location data and notify EMM that data have changed */
rc = emm_proc_location_notify(tac, ci , rat); rc = emm_proc_location_notify(user->emm_data, tac, ci , rat);
if (rc != RETURNok) { if (rc != RETURNok) {
LOG_TRACE(WARNING, "EMM-IDLE - Failed to notify location update"); LOG_TRACE(WARNING, "EMM-IDLE - Failed to notify location update");
} }
if (_emm_data.plmn_mode == EMM_DATA_PLMN_AUTO) { if (user->emm_data->plmn_mode == EMM_DATA_PLMN_AUTO) {
/* /*
* Automatic mode of operation * Automatic mode of operation
* --------------------------- * ---------------------------
...@@ -762,17 +761,17 @@ int emm_proc_plmn_selection_end(nas_user_t *user, int found, tac_t tac, ci_t ci, ...@@ -762,17 +761,17 @@ int emm_proc_plmn_selection_end(nas_user_t *user, int found, tac_t tac, ci_t ci,
int i; int i;
/* Check if the selected PLMN is in the forbidden list */ /* Check if the selected PLMN is in the forbidden list */
for (i = 0; i < _emm_data.fplmn.n_plmns; i++) { for (i = 0; i < user->emm_data->fplmn.n_plmns; i++) {
if (PLMNS_ARE_EQUAL(_emm_data.splmn, _emm_data.fplmn.plmn[i])) { if (PLMNS_ARE_EQUAL(user->emm_data->splmn, user->emm_data->fplmn.plmn[i])) {
is_forbidden = TRUE; is_forbidden = TRUE;
break; break;
} }
} }
if (!is_forbidden) { if (!is_forbidden) {
for (i = 0; i < _emm_data.fplmn_gprs.n_plmns; i++) { for (i = 0; i < user->emm_data->fplmn_gprs.n_plmns; i++) {
if (PLMNS_ARE_EQUAL(_emm_data.splmn, if (PLMNS_ARE_EQUAL(user->emm_data->splmn,
_emm_data.fplmn_gprs.plmn[i])) { user->emm_data->fplmn_gprs.plmn[i])) {
is_forbidden = TRUE; is_forbidden = TRUE;
break; break;
} }
...@@ -782,12 +781,12 @@ int emm_proc_plmn_selection_end(nas_user_t *user, int found, tac_t tac, ci_t ci, ...@@ -782,12 +781,12 @@ int emm_proc_plmn_selection_end(nas_user_t *user, int found, tac_t tac, ci_t ci,
/* Check if the selected PLMN belongs to a forbidden /* Check if the selected PLMN belongs to a forbidden
* tracking area */ * tracking area */
tai_t tai; tai_t tai;
tai.plmn = _emm_data.splmn; tai.plmn = user->emm_data->splmn;
tai.tac = tac; tai.tac = tac;
if (!is_forbidden) { if (!is_forbidden) {
for (i = 0; i < _emm_data.ftai.n_tais; i++) { for (i = 0; i < user->emm_data->ftai.n_tais; i++) {
if (TAIS_ARE_EQUAL(tai, _emm_data.ftai.tai[i])) { if (TAIS_ARE_EQUAL(tai, user->emm_data->ftai.tai[i])) {
is_forbidden = TRUE; is_forbidden = TRUE;
break; break;
} }
...@@ -795,8 +794,8 @@ int emm_proc_plmn_selection_end(nas_user_t *user, int found, tac_t tac, ci_t ci, ...@@ -795,8 +794,8 @@ int emm_proc_plmn_selection_end(nas_user_t *user, int found, tac_t tac, ci_t ci,
} }
if (!is_forbidden) { if (!is_forbidden) {
for (i = 0; i < _emm_data.ftai_roaming.n_tais; i++) { for (i = 0; i < user->emm_data->ftai_roaming.n_tais; i++) {
if (TAIS_ARE_EQUAL(tai, _emm_data.ftai_roaming.tai[i])) { if (TAIS_ARE_EQUAL(tai, user->emm_data->ftai_roaming.tai[i])) {
is_forbidden = TRUE; is_forbidden = TRUE;
break; break;
} }
...@@ -825,10 +824,10 @@ int emm_proc_plmn_selection_end(nas_user_t *user, int found, tac_t tac, ci_t ci, ...@@ -825,10 +824,10 @@ int emm_proc_plmn_selection_end(nas_user_t *user, int found, tac_t tac, ci_t ci,
} }
/* Duplicate the new selected PLMN at the end of the ordered list */ /* Duplicate the new selected PLMN at the end of the ordered list */
_emm_plmn_list.plmn[_emm_plmn_list.n_plmns] = &_emm_data.splmn; _emm_plmn_list.plmn[_emm_plmn_list.n_plmns] = &user->emm_data->splmn;
} }
else if (_emm_data.plmn_mode == EMM_DATA_PLMN_AUTO) { else if (user->emm_data->plmn_mode == EMM_DATA_PLMN_AUTO) {
/* /*
* Automatic mode of operation * Automatic mode of operation
* --------------------------- * ---------------------------
...@@ -844,7 +843,7 @@ int emm_proc_plmn_selection_end(nas_user_t *user, int found, tac_t tac, ci_t ci, ...@@ -844,7 +843,7 @@ int emm_proc_plmn_selection_end(nas_user_t *user, int found, tac_t tac, ci_t ci,
} }
} }
else if (_emm_data.plmn_index < 0) { else if (user->emm_data->plmn_index < 0) {
/* /*
* Manual or manual/automatic mode of operation * Manual or manual/automatic mode of operation
* -------------------------------------------- * --------------------------------------------
...@@ -855,7 +854,7 @@ int emm_proc_plmn_selection_end(nas_user_t *user, int found, tac_t tac, ci_t ci, ...@@ -855,7 +854,7 @@ int emm_proc_plmn_selection_end(nas_user_t *user, int found, tac_t tac, ci_t ci,
select_next_plmn = TRUE; select_next_plmn = TRUE;
} }
else if (_emm_data.plmn_mode == EMM_DATA_PLMN_MANUAL) { else if (user->emm_data->plmn_mode == EMM_DATA_PLMN_MANUAL) {
/* /*
* Manual mode of operation * Manual mode of operation
* ------------------------ * ------------------------
...@@ -871,7 +870,7 @@ int emm_proc_plmn_selection_end(nas_user_t *user, int found, tac_t tac, ci_t ci, ...@@ -871,7 +870,7 @@ int emm_proc_plmn_selection_end(nas_user_t *user, int found, tac_t tac, ci_t ci,
* Attempt to find a suitable cell of the PLMN selected by the user * Attempt to find a suitable cell of the PLMN selected by the user
* failed; Try to automatically select another PLMN * failed; Try to automatically select another PLMN
*/ */
_emm_data.plmn_mode = EMM_DATA_PLMN_AUTO; user->emm_data->plmn_mode = EMM_DATA_PLMN_AUTO;
index = _emm_plmn_list.hplmn; index = _emm_plmn_list.hplmn;
select_next_plmn = TRUE; select_next_plmn = TRUE;
} }
...@@ -938,11 +937,11 @@ int emm_proc_plmn_selection_end(nas_user_t *user, int found, tac_t tac, ci_t ci, ...@@ -938,11 +937,11 @@ int emm_proc_plmn_selection_end(nas_user_t *user, int found, tac_t tac, ci_t ci,
if (_emm_plmn_list.splmn == _emm_plmn_list.rplmn) { if (_emm_plmn_list.splmn == _emm_plmn_list.rplmn) {
/* The selected PLMN is the registered PLMN */ /* The selected PLMN is the registered PLMN */
LOG_TRACE(INFO, "EMM-IDLE - The selected PLMN is the registered PLMN"); LOG_TRACE(INFO, "EMM-IDLE - The selected PLMN is the registered PLMN");
_emm_data.is_rplmn = TRUE; user->emm_data->is_rplmn = TRUE;
} else if (_emm_plmn_list.splmn < _emm_plmn_list.hplmn) { } else if (_emm_plmn_list.splmn < _emm_plmn_list.hplmn) {
/* The selected PLMN is in the list of equivalent PLMNs */ /* The selected PLMN is in the list of equivalent PLMNs */
LOG_TRACE(INFO, "EMM-IDLE - The selected PLMN is in the list of equivalent PLMNs"); LOG_TRACE(INFO, "EMM-IDLE - The selected PLMN is in the list of equivalent PLMNs");
_emm_data.is_eplmn = TRUE; user->emm_data->is_eplmn = TRUE;
} }
/* /*
...@@ -976,20 +975,20 @@ int emm_proc_plmn_selection_end(nas_user_t *user, int found, tac_t tac, ci_t ci, ...@@ -976,20 +975,20 @@ int emm_proc_plmn_selection_end(nas_user_t *user, int found, tac_t tac, ci_t ci,
** ** ** **
** Outputs: None ** ** Outputs: None **
** Return: RETURNok, RETURNerror ** ** Return: RETURNok, RETURNerror **
** Others: _emm_data ** ** Others: user->emm_data-> **
** ** ** **
***************************************************************************/ ***************************************************************************/
int emm_proc_registration_notify(Stat_t status) int emm_proc_registration_notify(emm_data_t *emm_data, Stat_t status)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
int rc = RETURNok; int rc = RETURNok;
/* Update the network registration status */ /* Update the network registration status */
if (_emm_data.stat != status) { if (emm_data->stat != status) {
_emm_data.stat = status; emm_data->stat = status;
/* Notify EMM that data has changed */ /* Notify EMM that data has changed */
rc = (*_emm_indication_notify)(1); rc = (*_emm_indication_notify)(emm_data, 1);
} }
LOG_FUNC_RETURN (rc); LOG_FUNC_RETURN (rc);
...@@ -1010,24 +1009,24 @@ int emm_proc_registration_notify(Stat_t status) ...@@ -1010,24 +1009,24 @@ int emm_proc_registration_notify(Stat_t status)
** ** ** **
** Outputs: None ** ** Outputs: None **
** Return: RETURNok, RETURNerror ** ** Return: RETURNok, RETURNerror **
** Others: _emm_data ** ** Others: user->emm_data-> **
** ** ** **
***************************************************************************/ ***************************************************************************/
int emm_proc_location_notify(tac_t tac, ci_t ci, AcT_t rat) int emm_proc_location_notify(emm_data_t *emm_data, tac_t tac, ci_t ci, AcT_t rat)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
int rc = RETURNok; int rc = RETURNok;
/* Update the location information */ /* Update the location information */
if ( (_emm_data.tac != tac) || if ( (emm_data->tac != tac) ||
(_emm_data.ci != ci) || (emm_data->ci != ci) ||
(_emm_data.rat != rat) ) { (emm_data->rat != rat) ) {
_emm_data.tac = tac; emm_data->tac = tac;
_emm_data.ci = ci; emm_data->ci = ci;
_emm_data.rat = rat; emm_data->rat = rat;
/* Notify EMM that data has changed */ /* Notify EMM that data has changed */
rc = (*_emm_indication_notify)(0); rc = (*_emm_indication_notify)(emm_data, 0);
} }
LOG_FUNC_RETURN (rc); LOG_FUNC_RETURN (rc);
...@@ -1047,17 +1046,17 @@ int emm_proc_location_notify(tac_t tac, ci_t ci, AcT_t rat) ...@@ -1047,17 +1046,17 @@ int emm_proc_location_notify(tac_t tac, ci_t ci, AcT_t rat)
** ** ** **
** Outputs: None ** ** Outputs: None **
** Return: RETURNok, RETURNerror ** ** Return: RETURNok, RETURNerror **
** Others: _emm_data ** ** Others: user->emm_data-> **
** ** ** **
***************************************************************************/ ***************************************************************************/
int emm_proc_network_notify(int index) int emm_proc_network_notify(emm_data_t *emm_data, int index)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
/* Update the list of operators present in the network */ /* Update the list of operators present in the network */
int size = IdleMode_update_plmn_list(index); int size = IdleMode_update_plmn_list(emm_data, index);
/* Notify EMM that data has changed */ /* Notify EMM that data has changed */
int rc = (*_emm_indication_notify)(size); int rc = (*_emm_indication_notify)(emm_data, size);
LOG_FUNC_RETURN (rc); LOG_FUNC_RETURN (rc);
} }
...@@ -1126,7 +1125,7 @@ static int _IdleMode_plmn_str(char *plmn_str, const plmn_t *plmn) ...@@ -1126,7 +1125,7 @@ static int _IdleMode_plmn_str(char *plmn_str, const plmn_t *plmn)
** tor network name records ** ** tor network name records **
** ** ** **
** Inputs: plmn: The PLMN identifier ** ** Inputs: plmn: The PLMN identifier **
** Others: _emm_data ** ** Others: user->emm_data-> **
** ** ** **
** Outputs: None ** ** Outputs: None **
** Return: The index of the PLMN if found in the list ** ** Return: The index of the PLMN if found in the list **
...@@ -1139,28 +1138,28 @@ static int _IldlMode_get_opnn_id(nas_user_t *user, const plmn_t *plmn) ...@@ -1139,28 +1138,28 @@ static int _IldlMode_get_opnn_id(nas_user_t *user, const plmn_t *plmn)
{ {
int i; int i;
for (i = 0; i < _emm_data.n_opnns; i++) { for (i = 0; i < user->emm_data->n_opnns; i++) {
if (plmn->MCCdigit1 != _emm_data.opnn[i].plmn->MCCdigit1) { if (plmn->MCCdigit1 != user->emm_data->opnn[i].plmn->MCCdigit1) {
continue; continue;
} }
if (plmn->MCCdigit2 != _emm_data.opnn[i].plmn->MCCdigit2) { if (plmn->MCCdigit2 != user->emm_data->opnn[i].plmn->MCCdigit2) {
continue; continue;
} }
if (plmn->MCCdigit3 != _emm_data.opnn[i].plmn->MCCdigit3) { if (plmn->MCCdigit3 != user->emm_data->opnn[i].plmn->MCCdigit3) {
continue; continue;
} }
if (plmn->MNCdigit1 != _emm_data.opnn[i].plmn->MNCdigit1) { if (plmn->MNCdigit1 != user->emm_data->opnn[i].plmn->MNCdigit1) {
continue; continue;
} }
if (plmn->MNCdigit2 != _emm_data.opnn[i].plmn->MNCdigit2) { if (plmn->MNCdigit2 != user->emm_data->opnn[i].plmn->MNCdigit2) {
continue; continue;
} }
if (plmn->MNCdigit3 != _emm_data.opnn[i].plmn->MNCdigit3) { if (plmn->MNCdigit3 != user->emm_data->opnn[i].plmn->MNCdigit3) {
continue; continue;
} }
...@@ -1195,8 +1194,8 @@ static int _IdleMode_get_suitable_cell(nas_user_t *user, int index) ...@@ -1195,8 +1194,8 @@ static int _IdleMode_get_suitable_cell(nas_user_t *user, int index)
LOG_TRACE(INFO, "EMM-IDLE - Trying to search a suitable cell " LOG_TRACE(INFO, "EMM-IDLE - Trying to search a suitable cell "
"of PLMN %d in %s mode", index, "of PLMN %d in %s mode", index,
(_emm_data.plmn_mode == EMM_DATA_PLMN_AUTO)? "Automatic" : (user->emm_data->plmn_mode == EMM_DATA_PLMN_AUTO)? "Automatic" :
(_emm_data.plmn_mode == EMM_DATA_PLMN_MANUAL)? "Manual" : (user->emm_data->plmn_mode == EMM_DATA_PLMN_MANUAL)? "Manual" :
"Automatic/manual"); "Automatic/manual");
/* /*
* Notify EMM-AS SAP that cell information related to the given * Notify EMM-AS SAP that cell information related to the given
...@@ -1206,8 +1205,8 @@ static int _IdleMode_get_suitable_cell(nas_user_t *user, int index) ...@@ -1206,8 +1205,8 @@ static int _IdleMode_get_suitable_cell(nas_user_t *user, int index)
emm_sap.u.emm_as.u.cell_info.plmnIDs.n_plmns = 1; emm_sap.u.emm_as.u.cell_info.plmnIDs.n_plmns = 1;
emm_sap.u.emm_as.u.cell_info.plmnIDs.plmn[0] = *plmn; emm_sap.u.emm_as.u.cell_info.plmnIDs.plmn[0] = *plmn;
if (_emm_data.plmn_rat != NET_ACCESS_UNAVAILABLE) { if (user->emm_data->plmn_rat != NET_ACCESS_UNAVAILABLE) {
emm_sap.u.emm_as.u.cell_info.rat = (1 << _emm_data.plmn_rat); emm_sap.u.emm_as.u.cell_info.rat = (1 << user->emm_data->plmn_rat);
} else { } else {
emm_sap.u.emm_as.u.cell_info.rat = NET_ACCESS_UNAVAILABLE; emm_sap.u.emm_as.u.cell_info.rat = NET_ACCESS_UNAVAILABLE;
} }
......
...@@ -51,7 +51,7 @@ Description Defines the functions used to get information from the list ...@@ -51,7 +51,7 @@ Description Defines the functions used to get information from the list
/************************ G L O B A L T Y P E S ************************/ /************************ G L O B A L T Y P E S ************************/
/****************************************************************************/ /****************************************************************************/
typedef int (*IdleMode_callback_t) (int); typedef int (*IdleMode_callback_t) (emm_data_t *emm_data, int);
/****************************************************************************/ /****************************************************************************/
/******************** G L O B A L V A R I A B L E S ********************/ /******************** G L O B A L V A R I A B L E S ********************/
...@@ -68,7 +68,7 @@ int IdleMode_get_hplmn_index(void); ...@@ -68,7 +68,7 @@ int IdleMode_get_hplmn_index(void);
int IdleMode_get_rplmn_index(void); int IdleMode_get_rplmn_index(void);
int IdleMode_get_splmn_index(void); int IdleMode_get_splmn_index(void);
int IdleMode_update_plmn_list(int index); int IdleMode_update_plmn_list(emm_data_t *emm_data, int i);
const char *IdleMode_get_plmn_fullname(const plmn_t *plmn, int index, const char *IdleMode_get_plmn_fullname(const plmn_t *plmn, int index,
size_t *len); size_t *len);
......
...@@ -160,7 +160,7 @@ int lowerlayer_establish(nas_user_t *user) ...@@ -160,7 +160,7 @@ int lowerlayer_establish(nas_user_t *user)
LOG_FUNC_IN; LOG_FUNC_IN;
/* Update the EPS Connection Management status */ /* Update the EPS Connection Management status */
_emm_data.ecm_status = ECM_CONNECTED; user->emm_data->ecm_status = ECM_CONNECTED;
LOG_FUNC_RETURN (RETURNok); LOG_FUNC_RETURN (RETURNok);
} }
...@@ -188,7 +188,7 @@ int lowerlayer_release(nas_user_t *user, int cause) ...@@ -188,7 +188,7 @@ int lowerlayer_release(nas_user_t *user, int cause)
int rc; int rc;
/* Update the EPS Connection Management status */ /* Update the EPS Connection Management status */
_emm_data.ecm_status = ECM_IDLE; user->emm_data->ecm_status = ECM_IDLE;
emm_sap.primitive = EMMREG_LOWERLAYER_RELEASE; emm_sap.primitive = EMMREG_LOWERLAYER_RELEASE;
emm_sap.u.emm_reg.ueid = 0; emm_sap.u.emm_reg.ueid = 0;
...@@ -257,9 +257,9 @@ int lowerlayer_data_req(nas_user_t *user, unsigned int ueid, const OctetString * ...@@ -257,9 +257,9 @@ int lowerlayer_data_req(nas_user_t *user, unsigned int ueid, const OctetString *
//struct emm_data_context_s *ctx = NULL; //struct emm_data_context_s *ctx = NULL;
emm_sap.primitive = EMMAS_DATA_REQ; emm_sap.primitive = EMMAS_DATA_REQ;
emm_sap.u.emm_as.u.data.guti = _emm_data.guti; emm_sap.u.emm_as.u.data.guti = user->emm_data->guti;
emm_sap.u.emm_as.u.data.ueid = 0; emm_sap.u.emm_as.u.data.ueid = 0;
sctx = _emm_data.security; sctx = user->emm_data->security;
emm_sap.u.emm_as.u.data.NASinfo = 0; emm_sap.u.emm_as.u.data.NASinfo = 0;
emm_sap.u.emm_as.u.data.NASmsg.length = data->length; emm_sap.u.emm_as.u.data.NASmsg.length = data->length;
......
...@@ -108,8 +108,7 @@ int EmmDeregisteredNoCellAvailable(nas_user_t *user, const emm_reg_t *evt) ...@@ -108,8 +108,7 @@ int EmmDeregisteredNoCellAvailable(nas_user_t *user, const emm_reg_t *evt)
* Notify EMM that the MT is currently searching an operator * Notify EMM that the MT is currently searching an operator
* to register to * to register to
*/ */
// FIXME REVIEW rc = emm_proc_registration_notify(user->emm_data, NET_REG_STATE_ON);
rc = emm_proc_registration_notify(NET_REG_STATE_ON);
if (rc != RETURNok) { if (rc != RETURNok) {
LOG_TRACE(WARNING, "EMM-FSM - " LOG_TRACE(WARNING, "EMM-FSM - "
......
...@@ -95,7 +95,7 @@ int EmmDeregisteredPlmnSearch(nas_user_t *user, const emm_reg_t *evt) ...@@ -95,7 +95,7 @@ int EmmDeregisteredPlmnSearch(nas_user_t *user, const emm_reg_t *evt)
/* /*
* No suitable cell of the selected PLMN has been found to camp on * No suitable cell of the selected PLMN has been found to camp on
*/ */
rc = emm_proc_registration_notify(NET_REG_STATE_DENIED); rc = emm_proc_registration_notify(user->emm_data, NET_REG_STATE_DENIED);
if (rc != RETURNok) { if (rc != RETURNok) {
LOG_TRACE(WARNING, "EMM-FSM - " LOG_TRACE(WARNING, "EMM-FSM - "
...@@ -112,7 +112,7 @@ int EmmDeregisteredPlmnSearch(nas_user_t *user, const emm_reg_t *evt) ...@@ -112,7 +112,7 @@ int EmmDeregisteredPlmnSearch(nas_user_t *user, const emm_reg_t *evt)
* may be selected either automatically or manually. * may be selected either automatically or manually.
* Or the user manually re-selected a PLMN to register to. * Or the user manually re-selected a PLMN to register to.
*/ */
rc = emm_proc_registration_notify(NET_REG_STATE_ON); rc = emm_proc_registration_notify(user->emm_data, NET_REG_STATE_ON);
if (rc != RETURNok) { if (rc != RETURNok) {
LOG_TRACE(WARNING, "EMM-FSM - " LOG_TRACE(WARNING, "EMM-FSM - "
......
...@@ -140,7 +140,7 @@ int EmmRegisteredInitiated(nas_user_t *user, const emm_reg_t *evt) ...@@ -140,7 +140,7 @@ int EmmRegisteredInitiated(nas_user_t *user, const emm_reg_t *evt)
/* /*
* Notify EMM that the MT is registered * Notify EMM that the MT is registered
*/ */
rc = emm_proc_registration_notify(NET_REG_STATE_HN); rc = emm_proc_registration_notify(user->emm_data, NET_REG_STATE_HN);
if (rc != RETURNok) { if (rc != RETURNok) {
LOG_TRACE(WARNING, "EMM-FSM - " LOG_TRACE(WARNING, "EMM-FSM - "
...@@ -167,7 +167,7 @@ int EmmRegisteredInitiated(nas_user_t *user, const emm_reg_t *evt) ...@@ -167,7 +167,7 @@ int EmmRegisteredInitiated(nas_user_t *user, const emm_reg_t *evt)
/* /*
* Notify EMM that the MT's registration is denied * Notify EMM that the MT's registration is denied
*/ */
rc = emm_proc_registration_notify(NET_REG_STATE_DENIED); rc = emm_proc_registration_notify(user->emm_data, NET_REG_STATE_DENIED);
if (rc != RETURNok) { if (rc != RETURNok) {
LOG_TRACE(WARNING, "EMM-FSM - " LOG_TRACE(WARNING, "EMM-FSM - "
......
...@@ -135,16 +135,16 @@ static int _emm_as_encrypt( ...@@ -135,16 +135,16 @@ static int _emm_as_encrypt(
static int _emm_as_send(const nas_user_t *user, const emm_as_t *msg); static int _emm_as_send(const nas_user_t *user, const emm_as_t *msg);
static int _emm_as_security_res(const emm_as_security_t *, static int _emm_as_security_res(const emm_data_t *emm_data, const emm_as_security_t *,
ul_info_transfer_req_t *); ul_info_transfer_req_t *);
static int _emm_as_establish_req(const emm_as_establish_t *, static int _emm_as_establish_req(const emm_data_t *emm_data, const emm_as_establish_t *,
nas_establish_req_t *); nas_establish_req_t *);
static int _emm_as_cell_info_req(const emm_as_cell_info_t *, cell_info_req_t *); static int _emm_as_cell_info_req(const emm_as_cell_info_t *, cell_info_req_t *);
static int _emm_as_data_req(const emm_as_data_t *msg, ul_info_transfer_req_t *); static int _emm_as_data_req(const emm_data_t *emm_data, const emm_as_data_t *msg, ul_info_transfer_req_t *);
static int _emm_as_status_ind(const emm_as_status_t *, ul_info_transfer_req_t *); static int _emm_as_status_ind(const emm_data_t *emm_data, const emm_as_status_t *, ul_info_transfer_req_t *);
static int _emm_as_release_req(const emm_as_release_t *, nas_release_req_t *); static int _emm_as_release_req(const emm_as_release_t *, nas_release_req_t *);
/****************************************************************************/ /****************************************************************************/
...@@ -321,7 +321,7 @@ static int _emm_as_recv(nas_user_t *user, unsigned int ueid, const char *msg, in ...@@ -321,7 +321,7 @@ static int _emm_as_recv(nas_user_t *user, unsigned int ueid, const char *msg, in
emm_security_context_t *security = NULL; /* Current EPS NAS security context */ emm_security_context_t *security = NULL; /* Current EPS NAS security context */
security = _emm_data.security; security = user->emm_data->security;
/* Decode the received message */ /* Decode the received message */
decoder_rc = nas_message_decode(msg, &nas_msg, len, security); decoder_rc = nas_message_decode(msg, &nas_msg, len, security);
...@@ -428,7 +428,7 @@ static int _emm_as_data_ind(nas_user_t *user, const emm_as_data_t *msg, int *emm ...@@ -428,7 +428,7 @@ static int _emm_as_data_ind(nas_user_t *user, const emm_as_data_t *msg, int *emm
memset(&header, 0, sizeof(header)); memset(&header, 0, sizeof(header));
/* Decrypt the received security protected message */ /* Decrypt the received security protected message */
security = _emm_data.security; security = user->emm_data->security;
int bytes = nas_message_decrypt((char *)(msg->NASmsg.value), int bytes = nas_message_decrypt((char *)(msg->NASmsg.value),
plain_msg, plain_msg,
&header, &header,
...@@ -509,7 +509,7 @@ static int _emm_as_establish_cnf(nas_user_t *user, const emm_as_establish_t *msg ...@@ -509,7 +509,7 @@ static int _emm_as_establish_cnf(nas_user_t *user, const emm_as_establish_t *msg
decoder_rc = nas_message_decode((char *)(msg->NASmsg.value), decoder_rc = nas_message_decode((char *)(msg->NASmsg.value),
&nas_msg, &nas_msg,
msg->NASmsg.length, msg->NASmsg.length,
_emm_data.security); user->emm_data->security);
if (decoder_rc < 0) { if (decoder_rc < 0) {
LOG_TRACE(WARNING, "EMMAS-SAP - Failed to decode initial NAS message" LOG_TRACE(WARNING, "EMMAS-SAP - Failed to decode initial NAS message"
...@@ -937,13 +937,13 @@ static int _emm_as_send(const nas_user_t *user, const emm_as_t *msg) ...@@ -937,13 +937,13 @@ static int _emm_as_send(const nas_user_t *user, const emm_as_t *msg)
switch (msg->primitive) { switch (msg->primitive) {
case _EMMAS_DATA_REQ: case _EMMAS_DATA_REQ:
as_msg.msgID = _emm_as_data_req( as_msg.msgID = _emm_as_data_req(user->emm_data,
&msg->u.data, &msg->u.data,
&as_msg.msg.ul_info_transfer_req); &as_msg.msg.ul_info_transfer_req);
break; break;
case _EMMAS_STATUS_IND: case _EMMAS_STATUS_IND:
as_msg.msgID = _emm_as_status_ind( as_msg.msgID = _emm_as_status_ind(user->emm_data,
&msg->u.status, &msg->u.status,
&as_msg.msg.ul_info_transfer_req); &as_msg.msg.ul_info_transfer_req);
break; break;
...@@ -956,13 +956,13 @@ static int _emm_as_send(const nas_user_t *user, const emm_as_t *msg) ...@@ -956,13 +956,13 @@ static int _emm_as_send(const nas_user_t *user, const emm_as_t *msg)
case _EMMAS_SECURITY_RES: case _EMMAS_SECURITY_RES:
as_msg.msgID = _emm_as_security_res( as_msg.msgID = _emm_as_security_res(user->emm_data,
&msg->u.security, &msg->u.security,
&as_msg.msg.ul_info_transfer_req); &as_msg.msg.ul_info_transfer_req);
break; break;
case _EMMAS_ESTABLISH_REQ: case _EMMAS_ESTABLISH_REQ:
as_msg.msgID = _emm_as_establish_req( as_msg.msgID = _emm_as_establish_req(user->emm_data,
&msg->u.establish, &msg->u.establish,
&as_msg.msg.nas_establish_req); &as_msg.msg.nas_establish_req);
break; break;
...@@ -1065,7 +1065,7 @@ static int _emm_as_send(const nas_user_t *user, const emm_as_t *msg) ...@@ -1065,7 +1065,7 @@ static int _emm_as_send(const nas_user_t *user, const emm_as_t *msg)
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
static int _emm_as_data_req(const emm_as_data_t *msg, static int _emm_as_data_req(const emm_data_t *emm_data, const emm_as_data_t *msg,
ul_info_transfer_req_t *as_msg) ul_info_transfer_req_t *as_msg)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
...@@ -1112,7 +1112,7 @@ static int _emm_as_data_req(const emm_as_data_t *msg, ...@@ -1112,7 +1112,7 @@ static int _emm_as_data_req(const emm_as_data_t *msg,
int bytes; int bytes;
emm_security_context_t *emm_security_context = NULL; emm_security_context_t *emm_security_context = NULL;
emm_security_context = _emm_data.security; emm_security_context = emm_data->security;
if (emm_security_context) { if (emm_security_context) {
...@@ -1161,7 +1161,7 @@ static int _emm_as_data_req(const emm_as_data_t *msg, ...@@ -1161,7 +1161,7 @@ static int _emm_as_data_req(const emm_as_data_t *msg,
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
static int _emm_as_status_ind(const emm_as_status_t *msg, static int _emm_as_status_ind(const emm_data_t *emm_data, const emm_as_status_t *msg,
ul_info_transfer_req_t *as_msg) ul_info_transfer_req_t *as_msg)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
...@@ -1193,7 +1193,7 @@ static int _emm_as_status_ind(const emm_as_status_t *msg, ...@@ -1193,7 +1193,7 @@ static int _emm_as_status_ind(const emm_as_status_t *msg,
if (size > 0) { if (size > 0) {
emm_security_context_t *emm_security_context = NULL; emm_security_context_t *emm_security_context = NULL;
emm_security_context = _emm_data.security; emm_security_context = emm_data->security;
if (emm_security_context) { if (emm_security_context) {
...@@ -1275,7 +1275,7 @@ static int _emm_as_release_req(const emm_as_release_t *msg, ...@@ -1275,7 +1275,7 @@ static int _emm_as_release_req(const emm_as_release_t *msg,
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
static int _emm_as_security_res(const emm_as_security_t *msg, static int _emm_as_security_res(const emm_data_t *emm_data, const emm_as_security_t *msg,
ul_info_transfer_req_t *as_msg) ul_info_transfer_req_t *as_msg)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
...@@ -1340,7 +1340,7 @@ static int _emm_as_security_res(const emm_as_security_t *msg, ...@@ -1340,7 +1340,7 @@ static int _emm_as_security_res(const emm_as_security_t *msg,
int bytes = _emm_as_encode(&as_msg->nasMsg, int bytes = _emm_as_encode(&as_msg->nasMsg,
&nas_msg, &nas_msg,
size, size,
_emm_data.security); emm_data->security);
if (bytes > 0) { if (bytes > 0) {
LOG_FUNC_RETURN (AS_UL_INFO_TRANSFER_REQ); LOG_FUNC_RETURN (AS_UL_INFO_TRANSFER_REQ);
...@@ -1369,7 +1369,7 @@ static int _emm_as_security_res(const emm_as_security_t *msg, ...@@ -1369,7 +1369,7 @@ static int _emm_as_security_res(const emm_as_security_t *msg,
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
static int _emm_as_establish_req(const emm_as_establish_t *msg, static int _emm_as_establish_req(const emm_data_t *emm_data, const emm_as_establish_t *msg,
nas_establish_req_t *as_msg) nas_establish_req_t *as_msg)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
...@@ -1433,7 +1433,7 @@ static int _emm_as_establish_req(const emm_as_establish_t *msg, ...@@ -1433,7 +1433,7 @@ static int _emm_as_establish_req(const emm_as_establish_t *msg,
&as_msg->initialNasMsg, &as_msg->initialNasMsg,
&nas_msg, &nas_msg,
size, size,
_emm_data.security); emm_data->security);
if (bytes > 0) { if (bytes > 0) {
LOG_FUNC_RETURN (AS_NAS_ESTABLISH_REQ); LOG_FUNC_RETURN (AS_NAS_ESTABLISH_REQ);
......
...@@ -134,7 +134,7 @@ int emm_esm_send(nas_user_t *user, const emm_esm_t *msg) ...@@ -134,7 +134,7 @@ int emm_esm_send(nas_user_t *user, const emm_esm_t *msg)
if (msg->u.establish.is_emergency) { if (msg->u.establish.is_emergency) {
/* Consider the UE attached for emergency bearer services /* Consider the UE attached for emergency bearer services
* only */ * only */
rc = emm_proc_attach_set_emergency(); rc = emm_proc_attach_set_emergency(user->emm_data);
} }
} else { } else {
/* Consider the UE locally detached from the network */ /* Consider the UE locally detached from the network */
......
...@@ -163,8 +163,8 @@ int emm_proc_security_mode_command(nas_user_t *user, int native_ksi, int ksi, ...@@ -163,8 +163,8 @@ int emm_proc_security_mode_command(nas_user_t *user, int native_ksi, int ksi,
/* /*
* Check the replayed UE security capabilities * Check the replayed UE security capabilities
*/ */
uint8_t eea = (0x80 >> _emm_data.security->capability.eps_encryption); uint8_t eea = (0x80 >> user->emm_data->security->capability.eps_encryption);
uint8_t eia = (0x80 >> _emm_data.security->capability.eps_integrity); uint8_t eia = (0x80 >> user->emm_data->security->capability.eps_integrity);
if ( (reea != eea) || (reia != eia) ) { if ( (reea != eea) || (reia != eia) ) {
LOG_TRACE(WARNING, "EMM-PROC - Replayed UE security capabilities " LOG_TRACE(WARNING, "EMM-PROC - Replayed UE security capabilities "
...@@ -180,7 +180,7 @@ int emm_proc_security_mode_command(nas_user_t *user, int native_ksi, int ksi, ...@@ -180,7 +180,7 @@ int emm_proc_security_mode_command(nas_user_t *user, int native_ksi, int ksi,
/* /*
* Check the non-current EPS security context * Check the non-current EPS security context
*/ */
else if (_emm_data.non_current == NULL) { else if (user->emm_data->non_current == NULL) {
LOG_TRACE(WARNING, "EMM-PROC - Non-current EPS security context " LOG_TRACE(WARNING, "EMM-PROC - Non-current EPS security context "
"is not valid"); "is not valid");
emm_cause = EMM_CAUSE_SECURITY_MODE_REJECTED; emm_cause = EMM_CAUSE_SECURITY_MODE_REJECTED;
...@@ -191,37 +191,37 @@ int emm_proc_security_mode_command(nas_user_t *user, int native_ksi, int ksi, ...@@ -191,37 +191,37 @@ int emm_proc_security_mode_command(nas_user_t *user, int native_ksi, int ksi,
else { else {
LOG_TRACE(INFO, "EMM-PROC - Update the non-current EPS security context seea=%u seia=%u", seea, seia); LOG_TRACE(INFO, "EMM-PROC - Update the non-current EPS security context seea=%u seia=%u", seea, seia);
/* Update selected cyphering and integrity algorithms */ /* Update selected cyphering and integrity algorithms */
//LG COMENTED _emm_data.non_current->capability.encryption = seea; //LG COMENTED user->emm_data->non_current->capability.encryption = seea;
//LG COMENTED _emm_data.non_current->capability.integrity = seia; //LG COMENTED user->emm_data->non_current->capability.integrity = seia;
_emm_data.non_current->selected_algorithms.encryption = seea; user->emm_data->non_current->selected_algorithms.encryption = seea;
_emm_data.non_current->selected_algorithms.integrity = seia; user->emm_data->non_current->selected_algorithms.integrity = seia;
/* Derive the NAS cyphering key */ /* Derive the NAS cyphering key */
if (_emm_data.non_current->knas_enc.value == NULL) { if (user->emm_data->non_current->knas_enc.value == NULL) {
_emm_data.non_current->knas_enc.value = user->emm_data->non_current->knas_enc.value =
(uint8_t *)calloc(1,AUTH_KNAS_ENC_SIZE); (uint8_t *)calloc(1,AUTH_KNAS_ENC_SIZE);
_emm_data.non_current->knas_enc.length = AUTH_KNAS_ENC_SIZE; user->emm_data->non_current->knas_enc.length = AUTH_KNAS_ENC_SIZE;
} }
if (_emm_data.non_current->knas_enc.value != NULL) { if (user->emm_data->non_current->knas_enc.value != NULL) {
LOG_TRACE(INFO, "EMM-PROC - Update the non-current EPS security context knas_enc"); LOG_TRACE(INFO, "EMM-PROC - Update the non-current EPS security context knas_enc");
rc = _security_knas_enc(&_emm_data.non_current->kasme, rc = _security_knas_enc(&user->emm_data->non_current->kasme,
&_emm_data.non_current->knas_enc, seea); &user->emm_data->non_current->knas_enc, seea);
} }
/* Derive the NAS integrity key */ /* Derive the NAS integrity key */
if (_emm_data.non_current->knas_int.value == NULL) { if (user->emm_data->non_current->knas_int.value == NULL) {
_emm_data.non_current->knas_int.value = user->emm_data->non_current->knas_int.value =
(uint8_t *)calloc(1,AUTH_KNAS_INT_SIZE); (uint8_t *)calloc(1,AUTH_KNAS_INT_SIZE);
_emm_data.non_current->knas_int.length = AUTH_KNAS_INT_SIZE; user->emm_data->non_current->knas_int.length = AUTH_KNAS_INT_SIZE;
} }
if (_emm_data.non_current->knas_int.value != NULL) { if (user->emm_data->non_current->knas_int.value != NULL) {
if (rc != RETURNerror) { if (rc != RETURNerror) {
LOG_TRACE(INFO, "EMM-PROC - Update the non-current EPS security context knas_int"); LOG_TRACE(INFO, "EMM-PROC - Update the non-current EPS security context knas_int");
rc = _security_knas_int(&_emm_data.non_current->kasme, rc = _security_knas_int(&user->emm_data->non_current->kasme,
&_emm_data.non_current->knas_int, seia); &user->emm_data->non_current->knas_int, seia);
} }
} }
...@@ -234,10 +234,10 @@ int emm_proc_security_mode_command(nas_user_t *user, int native_ksi, int ksi, ...@@ -234,10 +234,10 @@ int emm_proc_security_mode_command(nas_user_t *user, int native_ksi, int ksi,
if (_security_data.kenb.value != NULL) { if (_security_data.kenb.value != NULL) {
if (rc != RETURNerror) { if (rc != RETURNerror) {
LOG_TRACE(INFO, "EMM-PROC - Update the non-current EPS security context kenb"); LOG_TRACE(INFO, "EMM-PROC - Update the non-current EPS security context kenb");
// LG COMMENT rc = _security_kenb(&_emm_data.security->kasme, // LG COMMENT rc = _security_kenb(&user->emm_data->security->kasme,
rc = _security_kenb(&_emm_data.non_current->kasme, rc = _security_kenb(&user->emm_data->non_current->kasme,
&_security_data.kenb, &_security_data.kenb,
*(uint32_t *)(&_emm_data.non_current->ul_count)); *(uint32_t *)(&user->emm_data->non_current->ul_count));
} }
} }
...@@ -248,13 +248,13 @@ int emm_proc_security_mode_command(nas_user_t *user, int native_ksi, int ksi, ...@@ -248,13 +248,13 @@ int emm_proc_security_mode_command(nas_user_t *user, int native_ksi, int ksi,
LOG_TRACE(INFO, "EMM-PROC - NAS security mode command accepted by the UE"); LOG_TRACE(INFO, "EMM-PROC - NAS security mode command accepted by the UE");
/* Update the current EPS security context */ /* Update the current EPS security context */
if ( native_ksi && (_emm_data.security->type != EMM_KSI_NATIVE) ) { if ( native_ksi && (user->emm_data->security->type != EMM_KSI_NATIVE) ) {
/* The type of security context flag included in the SECURITY /* The type of security context flag included in the SECURITY
* MODE COMMAND message is set to "native security context" and * MODE COMMAND message is set to "native security context" and
* the UE has a mapped EPS security context as the current EPS * the UE has a mapped EPS security context as the current EPS
* security context */ * security context */
if ( (_emm_data.non_current->type == EMM_KSI_NATIVE) && if ( (user->emm_data->non_current->type == EMM_KSI_NATIVE) &&
(_emm_data.non_current->eksi == ksi) ) { (user->emm_data->non_current->eksi == ksi) ) {
/* The KSI matches the non-current native EPS security /* The KSI matches the non-current native EPS security
* context; the UE shall take the non-current native EPS * context; the UE shall take the non-current native EPS
* security context into use which then becomes the * security context into use which then becomes the
...@@ -263,36 +263,37 @@ int emm_proc_security_mode_command(nas_user_t *user, int native_ksi, int ksi, ...@@ -263,36 +263,37 @@ int emm_proc_security_mode_command(nas_user_t *user, int native_ksi, int ksi,
LOG_TRACE(INFO, LOG_TRACE(INFO,
"EMM-PROC - Update Current security context"); "EMM-PROC - Update Current security context");
/* Release non-current security context */ /* Release non-current security context */
_security_release(_emm_data.security); _security_release(user->emm_data->security);
_emm_data.security = _emm_data.non_current; user->emm_data->security = user->emm_data->non_current;
/* Reset the uplink NAS COUNT counter */ /* Reset the uplink NAS COUNT counter */
_emm_data.security->ul_count.overflow = 0; user->emm_data->security->ul_count.overflow = 0;
_emm_data.security->ul_count.seq_num = 0; user->emm_data->security->ul_count.seq_num = 0;
/* Set new security context indicator */ /* Set new security context indicator */
security_context_is_new = TRUE; security_context_is_new = TRUE;
} }
} }
if ( !native_ksi && (_emm_data.security->type != EMM_KSI_NATIVE) ) { if ( !native_ksi && (user->emm_data->security->type != EMM_KSI_NATIVE) ) {
/* The type of security context flag included in the SECURITY /* The type of security context flag included in the SECURITY
* MODE COMMAND message is set to "mapped security context" and * MODE COMMAND message is set to "mapped security context" and
* the UE has a mapped EPS security context as the current EPS * the UE has a mapped EPS security context as the current EPS
* security context */ * security context */
if (ksi != _emm_data.security->eksi) { if (ksi != user->emm_data->security->eksi) {
/* The KSI does not match the current EPS security context; /* The KSI does not match the current EPS security context;
* the UE shall reset the uplink NAS COUNT counter */ * the UE shall reset the uplink NAS COUNT counter */
LOG_TRACE(INFO, LOG_TRACE(INFO,
"EMM-PROC - Reset uplink NAS COUNT counter"); "EMM-PROC - Reset uplink NAS COUNT counter");
_emm_data.security->ul_count.overflow = 0; user->emm_data->security->ul_count.overflow = 0;
_emm_data.security->ul_count.seq_num = 0; user->emm_data->security->ul_count.seq_num = 0;
} }
} }
_emm_data.security->selected_algorithms.encryption = seea; user->emm_data->security->selected_algorithms.encryption = seea;
_emm_data.security->selected_algorithms.integrity = seia; user->emm_data->security->selected_algorithms.integrity = seia;
#if defined(NAS_BUILT_IN_UE) #if defined(NAS_BUILT_IN_UE)
nas_itti_kenb_refresh_req(_security_data.kenb.value); nas_itti_kenb_refresh_req(_security_data.kenb.value);
#endif #endif
} }
/* /*
* NAS security mode command not accepted by the UE * NAS security mode command not accepted by the UE
...@@ -326,14 +327,14 @@ int emm_proc_security_mode_command(nas_user_t *user, int native_ksi, int ksi, ...@@ -326,14 +327,14 @@ int emm_proc_security_mode_command(nas_user_t *user, int native_ksi, int ksi,
*/ */
emm_sap_t emm_sap; emm_sap_t emm_sap;
emm_sap.primitive = EMMAS_SECURITY_RES; emm_sap.primitive = EMMAS_SECURITY_RES;
emm_sap.u.emm_as.u.security.guti = _emm_data.guti; emm_sap.u.emm_as.u.security.guti = user->emm_data->guti;
emm_sap.u.emm_as.u.security.ueid = 0; emm_sap.u.emm_as.u.security.ueid = 0;
emm_sap.u.emm_as.u.security.msgType = EMM_AS_MSG_TYPE_SMC; emm_sap.u.emm_as.u.security.msgType = EMM_AS_MSG_TYPE_SMC;
emm_sap.u.emm_as.u.security.imeisv_request = imeisv_request; emm_sap.u.emm_as.u.security.imeisv_request = imeisv_request;
emm_sap.u.emm_as.u.security.emm_cause = emm_cause; emm_sap.u.emm_as.u.security.emm_cause = emm_cause;
/* Setup EPS NAS security data */ /* Setup EPS NAS security data */
emm_as_set_security_data(&emm_sap.u.emm_as.u.security.sctx, emm_as_set_security_data(&emm_sap.u.emm_as.u.security.sctx,
_emm_data.security, security_context_is_new, TRUE); user->emm_data->security, security_context_is_new, TRUE);
rc = emm_sap_send(user, &emm_sap); rc = emm_sap_send(user, &emm_sap);
LOG_FUNC_RETURN (rc); LOG_FUNC_RETURN (rc);
......
...@@ -333,13 +333,6 @@ typedef struct emm_data_s { ...@@ -333,13 +333,6 @@ typedef struct emm_data_s {
/******************** G L O B A L V A R I A B L E S ********************/ /******************** G L O B A L V A R I A B L E S ********************/
/****************************************************************************/ /****************************************************************************/
/*
* --------------------------------------------------------------------------
* EPS mobility management data (used within EMM only)
* --------------------------------------------------------------------------
*/
emm_data_t _emm_data;
/* /*
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* EPS mobility management timers – UE side * EPS mobility management timers – UE side
......
...@@ -78,7 +78,7 @@ static usim_data_t _usim_data; ...@@ -78,7 +78,7 @@ static usim_data_t _usim_data;
* to the user application * to the user application
*/ */
static emm_indication_callback_t _emm_main_user_callback; static emm_indication_callback_t _emm_main_user_callback;
static int _emm_main_callback(int); static int _emm_main_callback(emm_data_t *emm_data, int);
/****************************************************************************/ /****************************************************************************/
/****************** E X P O R T E D F U N C T I O N S ******************/ /****************** E X P O R T E D F U N C T I O N S ******************/
...@@ -97,66 +97,70 @@ static int _emm_main_callback(int); ...@@ -97,66 +97,70 @@ static int _emm_main_callback(int);
** ** ** **
** Outputs: None ** ** Outputs: None **
** Return: None ** ** Return: None **
** Others: _emm_data ** ** Others: user->emm_data-> **
** ** ** **
***************************************************************************/ ***************************************************************************/
void emm_main_initialize(nas_user_t *user, emm_indication_callback_t cb, const char *imei) void emm_main_initialize(nas_user_t *user, emm_indication_callback_t cb, const char *imei)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
user->emm_data = calloc(1, sizeof(emm_data_t));
if ( user->emm_data == NULL ) {
LOG_TRACE(ERROR, "EMM-MAIN - Failed to get allocate emm_data");
// FIXME stop here
}
/* USIM validity indicator */ /* USIM validity indicator */
_emm_data.usim_is_valid = FALSE; user->emm_data->usim_is_valid = FALSE;
/* The IMEI read from the UE's non-volatile memory */ /* The IMEI read from the UE's non-volatile memory */
_emm_data.imei = (imei_t *)malloc(sizeof(imei_t)); user->emm_data->imei = (imei_t *)malloc(sizeof(imei_t));
_emm_data.imei->length = _emm_main_get_imei(_emm_data.imei, imei); user->emm_data->imei->length = _emm_main_get_imei(user->emm_data->imei, imei);
/* The IMSI, valid only if USIM is present */ /* The IMSI, valid only if USIM is present */
_emm_data.imsi = NULL; user->emm_data->imsi = NULL;
/* EPS location information */ /* EPS location information */
_emm_data.guti = NULL; user->emm_data->guti = NULL;
_emm_data.tai = NULL; user->emm_data->tai = NULL;
_emm_data.ltai.n_tais = 0; user->emm_data->ltai.n_tais = 0;
/* EPS Connection Management status */ /* EPS Connection Management status */
_emm_data.ecm_status = ECM_IDLE; user->emm_data->ecm_status = ECM_IDLE;
/* Network selection mode of operation */ /* Network selection mode of operation */
_emm_data.plmn_mode = EMM_DATA_PLMN_AUTO; user->emm_data->plmn_mode = EMM_DATA_PLMN_AUTO;
/* Index of the PLMN manually selected by the user */ /* Index of the PLMN manually selected by the user */
_emm_data.plmn_index = -1; user->emm_data->plmn_index = -1;
/* Selected Radio Access Technology */ /* Selected Radio Access Technology */
_emm_data.plmn_rat = NET_ACCESS_UNAVAILABLE; user->emm_data->plmn_rat = NET_ACCESS_UNAVAILABLE;
/* Selected PLMN */ /* Selected PLMN */
memset(&_emm_data.splmn, 0xFF, sizeof(plmn_t)); memset(&user->emm_data->splmn, 0xFF, sizeof(plmn_t));
_emm_data.is_rplmn = FALSE; user->emm_data->is_rplmn = FALSE;
_emm_data.is_eplmn = FALSE; user->emm_data->is_eplmn = FALSE;
/* Radio Access Technology of the serving cell */ /* Radio Access Technology of the serving cell */
_emm_data.rat = NET_ACCESS_UNAVAILABLE; user->emm_data->rat = NET_ACCESS_UNAVAILABLE;
/* Network registration status */ /* Network registration status */
_emm_data.stat = NET_REG_STATE_OFF; user->emm_data->stat = NET_REG_STATE_OFF;
_emm_data.is_attached = FALSE; user->emm_data->is_attached = FALSE;
_emm_data.is_emergency = FALSE; user->emm_data->is_emergency = FALSE;
/* Location/Tracking area code */ /* Location/Tracking area code */
_emm_data.tac = 0; // two byte in hexadecimal format user->emm_data->tac = 0; // two byte in hexadecimal format
/* Identifier of the serving cell */ /* Identifier of the serving cell */
_emm_data.ci = 0; // four byte in hexadecimal format user->emm_data->ci = 0; // four byte in hexadecimal format
/* List of operators present in the network */ /* List of operators present in the network */
memset(_emm_data.plist.buffer, 0, EMM_DATA_BUFFER_SIZE + 1); memset(user->emm_data->plist.buffer, 0, EMM_DATA_BUFFER_SIZE + 1);
/* Home PLMN */ /* Home PLMN */
memset(&_emm_data.hplmn, 0xFF, sizeof(plmn_t)); memset(&user->emm_data->hplmn, 0xFF, sizeof(plmn_t));
/* List of Forbidden PLMNs */ /* List of Forbidden PLMNs */
_emm_data.fplmn.n_plmns = 0; user->emm_data->fplmn.n_plmns = 0;
/* List of Forbidden PLMNs for GPRS service */ /* List of Forbidden PLMNs for GPRS service */
_emm_data.fplmn_gprs.n_plmns = 0; user->emm_data->fplmn_gprs.n_plmns = 0;
/* List of Equivalent HPLMNs */ /* List of Equivalent HPLMNs */
_emm_data.ehplmn.n_plmns = 0; user->emm_data->ehplmn.n_plmns = 0;
/* List of user controlled PLMNs */ /* List of user controlled PLMNs */
_emm_data.plmn.n_plmns = 0; user->emm_data->plmn.n_plmns = 0;
/* List of operator controlled PLMNs */ /* List of operator controlled PLMNs */
_emm_data.oplmn.n_plmns = 0; user->emm_data->oplmn.n_plmns = 0;
/* List of operator network name records */ /* List of operator network name records */
_emm_data.n_opnns = 0; user->emm_data->n_opnns = 0;
/* List of Forbidden Tracking Areas */ /* List of Forbidden Tracking Areas */
_emm_data.ftai.n_tais = 0; user->emm_data->ftai.n_tais = 0;
/* List of Forbidden Tracking Areas for roaming */ /* List of Forbidden Tracking Areas for roaming */
_emm_data.ftai_roaming.n_tais = 0; user->emm_data->ftai_roaming.n_tais = 0;
/* /*
* Get USIM application data * Get USIM application data
...@@ -170,47 +174,47 @@ void emm_main_initialize(nas_user_t *user, emm_indication_callback_t cb, const c ...@@ -170,47 +174,47 @@ void emm_main_initialize(nas_user_t *user, emm_indication_callback_t cb, const c
/* The USIM application is present and valid */ /* The USIM application is present and valid */
LOG_TRACE(INFO, "EMM-MAIN - USIM application data successfully read"); LOG_TRACE(INFO, "EMM-MAIN - USIM application data successfully read");
_emm_data.usim_is_valid = TRUE; user->emm_data->usim_is_valid = TRUE;
/* Get the Home PLMN derived from the IMSI */ /* Get the Home PLMN derived from the IMSI */
_emm_data.hplmn.MCCdigit1 = _usim_data.imsi.u.num.digit1; user->emm_data->hplmn.MCCdigit1 = _usim_data.imsi.u.num.digit1;
_emm_data.hplmn.MCCdigit2 = _usim_data.imsi.u.num.digit2; user->emm_data->hplmn.MCCdigit2 = _usim_data.imsi.u.num.digit2;
_emm_data.hplmn.MCCdigit3 = _usim_data.imsi.u.num.digit3; user->emm_data->hplmn.MCCdigit3 = _usim_data.imsi.u.num.digit3;
_emm_data.hplmn.MNCdigit1 = _usim_data.imsi.u.num.digit4; user->emm_data->hplmn.MNCdigit1 = _usim_data.imsi.u.num.digit4;
_emm_data.hplmn.MNCdigit2 = _usim_data.imsi.u.num.digit5; user->emm_data->hplmn.MNCdigit2 = _usim_data.imsi.u.num.digit5;
_emm_data.hplmn.MNCdigit3 = _usim_data.imsi.u.num.digit6; user->emm_data->hplmn.MNCdigit3 = _usim_data.imsi.u.num.digit6;
/* Get the list of forbidden PLMNs */ /* Get the list of forbidden PLMNs */
for (i=0; (i < EMM_DATA_FPLMN_MAX) && (i < USIM_FPLMN_MAX); i++) { for (i=0; (i < EMM_DATA_FPLMN_MAX) && (i < USIM_FPLMN_MAX); i++) {
if ( PLMN_IS_VALID(_usim_data.fplmn[i]) ) { if ( PLMN_IS_VALID(_usim_data.fplmn[i]) ) {
_emm_data.fplmn.plmn[i] = _usim_data.fplmn[i]; user->emm_data->fplmn.plmn[i] = _usim_data.fplmn[i];
_emm_data.fplmn.n_plmns += 1; user->emm_data->fplmn.n_plmns += 1;
} }
} }
/* Get the list of Equivalent HPLMNs */ /* Get the list of Equivalent HPLMNs */
for (i=0; (i < EMM_DATA_EHPLMN_MAX) && (i < USIM_EHPLMN_MAX); i++) { for (i=0; (i < EMM_DATA_EHPLMN_MAX) && (i < USIM_EHPLMN_MAX); i++) {
if ( PLMN_IS_VALID(_usim_data.ehplmn[i]) ) { if ( PLMN_IS_VALID(_usim_data.ehplmn[i]) ) {
_emm_data.ehplmn.plmn[i] = _usim_data.ehplmn[i]; user->emm_data->ehplmn.plmn[i] = _usim_data.ehplmn[i];
_emm_data.ehplmn.n_plmns += 1; user->emm_data->ehplmn.n_plmns += 1;
} }
} }
/* Get the list of User controlled PLMN Selector */ /* Get the list of User controlled PLMN Selector */
for (i=0; (i < EMM_DATA_PLMN_MAX) && (i < USIM_PLMN_MAX); i++) { for (i=0; (i < EMM_DATA_PLMN_MAX) && (i < USIM_PLMN_MAX); i++) {
if ( PLMN_IS_VALID(_usim_data.plmn[i].plmn) ) { if ( PLMN_IS_VALID(_usim_data.plmn[i].plmn) ) {
_emm_data.plmn.plmn[i] = _usim_data.plmn[i].plmn; user->emm_data->plmn.plmn[i] = _usim_data.plmn[i].plmn;
_emm_data.userAcT[i] = _usim_data.plmn[i].AcT; user->emm_data->userAcT[i] = _usim_data.plmn[i].AcT;
_emm_data.plmn.n_plmns += 1; user->emm_data->plmn.n_plmns += 1;
} }
} }
/* Get the list of Operator controlled PLMN Selector */ /* Get the list of Operator controlled PLMN Selector */
for (i=0; (i < EMM_DATA_OPLMN_MAX) && (i < USIM_OPLMN_MAX); i++) { for (i=0; (i < EMM_DATA_OPLMN_MAX) && (i < USIM_OPLMN_MAX); i++) {
if ( PLMN_IS_VALID(_usim_data.oplmn[i].plmn) ) { if ( PLMN_IS_VALID(_usim_data.oplmn[i].plmn) ) {
_emm_data.oplmn.plmn[i] = _usim_data.oplmn[i].plmn; user->emm_data->oplmn.plmn[i] = _usim_data.oplmn[i].plmn;
_emm_data.operAcT[i] = _usim_data.oplmn[i].AcT; user->emm_data->operAcT[i] = _usim_data.oplmn[i].AcT;
_emm_data.oplmn.n_plmns += 1; user->emm_data->oplmn.n_plmns += 1;
} }
} }
...@@ -218,10 +222,10 @@ void emm_main_initialize(nas_user_t *user, emm_indication_callback_t cb, const c ...@@ -218,10 +222,10 @@ void emm_main_initialize(nas_user_t *user, emm_indication_callback_t cb, const c
for (i=0; (i < EMM_DATA_OPNN_MAX) && (i < USIM_OPL_MAX); i++) { for (i=0; (i < EMM_DATA_OPNN_MAX) && (i < USIM_OPL_MAX); i++) {
if ( PLMN_IS_VALID(_usim_data.opl[i].plmn) ) { if ( PLMN_IS_VALID(_usim_data.opl[i].plmn) ) {
int pnn_id = _usim_data.opl[i].record_id; int pnn_id = _usim_data.opl[i].record_id;
_emm_data.opnn[i].plmn = &_usim_data.opl[i].plmn; user->emm_data->opnn[i].plmn = &_usim_data.opl[i].plmn;
_emm_data.opnn[i].fullname = (char *)_usim_data.pnn[pnn_id].fullname.value; user->emm_data->opnn[i].fullname = (char *)_usim_data.pnn[pnn_id].fullname.value;
_emm_data.opnn[i].shortname = (char *)_usim_data.pnn[pnn_id].shortname.value; user->emm_data->opnn[i].shortname = (char *)_usim_data.pnn[pnn_id].shortname.value;
_emm_data.n_opnns += 1; user->emm_data->n_opnns += 1;
} }
} }
...@@ -229,78 +233,78 @@ void emm_main_initialize(nas_user_t *user, emm_indication_callback_t cb, const c ...@@ -229,78 +233,78 @@ void emm_main_initialize(nas_user_t *user, emm_indication_callback_t cb, const c
/* Get the EPS location information */ /* Get the EPS location information */
if (PLMN_IS_VALID(_usim_data.epsloci.guti.gummei.plmn)) { if (PLMN_IS_VALID(_usim_data.epsloci.guti.gummei.plmn)) {
_emm_data.guti = &_usim_data.epsloci.guti; user->emm_data->guti = &_usim_data.epsloci.guti;
} }
if (TAI_IS_VALID(_usim_data.epsloci.tai)) { if (TAI_IS_VALID(_usim_data.epsloci.tai)) {
_emm_data.tai = &_usim_data.epsloci.tai; user->emm_data->tai = &_usim_data.epsloci.tai;
} }
_emm_data.status = _usim_data.epsloci.status; user->emm_data->status = _usim_data.epsloci.status;
/* Get NAS configuration parameters */ /* Get NAS configuration parameters */
_emm_data.NAS_SignallingPriority = user->emm_data->NAS_SignallingPriority =
_usim_data.nasconfig.NAS_SignallingPriority.value[0]; _usim_data.nasconfig.NAS_SignallingPriority.value[0];
_emm_data.NMO_I_Behaviour = _usim_data.nasconfig.NMO_I_Behaviour.value[0]; user->emm_data->NMO_I_Behaviour = _usim_data.nasconfig.NMO_I_Behaviour.value[0];
_emm_data.AttachWithImsi = _usim_data.nasconfig.AttachWithImsi.value[0]; user->emm_data->AttachWithImsi = _usim_data.nasconfig.AttachWithImsi.value[0];
_emm_data.MinimumPeriodicSearchTimer = user->emm_data->MinimumPeriodicSearchTimer =
_usim_data.nasconfig.MinimumPeriodicSearchTimer.value[0]; _usim_data.nasconfig.MinimumPeriodicSearchTimer.value[0];
_emm_data.ExtendedAccessBarring = user->emm_data->ExtendedAccessBarring =
_usim_data.nasconfig.ExtendedAccessBarring.value[0]; _usim_data.nasconfig.ExtendedAccessBarring.value[0];
_emm_data.Timer_T3245_Behaviour = user->emm_data->Timer_T3245_Behaviour =
_usim_data.nasconfig.Timer_T3245_Behaviour.value[0]; _usim_data.nasconfig.Timer_T3245_Behaviour.value[0];
/* /*
* Get EPS NAS security context * Get EPS NAS security context
*/ */
/* Create NAS security context */ /* Create NAS security context */
_emm_data.security = user->emm_data->security =
(emm_security_context_t *)malloc(sizeof(emm_security_context_t)); (emm_security_context_t *)malloc(sizeof(emm_security_context_t));
if (_emm_data.security != NULL) { if (user->emm_data->security != NULL) {
memset(_emm_data.security, 0, sizeof(emm_security_context_t)); memset(user->emm_data->security, 0, sizeof(emm_security_context_t));
/* Type of security context */ /* Type of security context */
if (_usim_data.securityctx.KSIasme.value[0] != if (_usim_data.securityctx.KSIasme.value[0] !=
USIM_KSI_NOT_AVAILABLE) { USIM_KSI_NOT_AVAILABLE) {
_emm_data.security->type = EMM_KSI_NATIVE; user->emm_data->security->type = EMM_KSI_NATIVE;
} else { } else {
_emm_data.security->type = EMM_KSI_NOT_AVAILABLE; user->emm_data->security->type = EMM_KSI_NOT_AVAILABLE;
} }
/* EPS key set identifier */ /* EPS key set identifier */
_emm_data.security->eksi = _usim_data.securityctx.KSIasme.value[0]; user->emm_data->security->eksi = _usim_data.securityctx.KSIasme.value[0];
/* ASME security key */ /* ASME security key */
_emm_data.security->kasme.length = user->emm_data->security->kasme.length =
_usim_data.securityctx.Kasme.length; _usim_data.securityctx.Kasme.length;
_emm_data.security->kasme.value = user->emm_data->security->kasme.value =
(uint8_t *)malloc(_emm_data.security->kasme.length); (uint8_t *)malloc(user->emm_data->security->kasme.length);
if (_emm_data.security->kasme.value) { if (user->emm_data->security->kasme.value) {
memcpy(_emm_data.security->kasme.value, memcpy(user->emm_data->security->kasme.value,
_usim_data.securityctx.Kasme.value, _usim_data.securityctx.Kasme.value,
_emm_data.security->kasme.length); user->emm_data->security->kasme.length);
} }
/* Downlink count parameter */ /* Downlink count parameter */
if (_usim_data.securityctx.dlNAScount.length <= sizeof(uint32_t)) { if (_usim_data.securityctx.dlNAScount.length <= sizeof(uint32_t)) {
memcpy(&_emm_data.security->dl_count, memcpy(&user->emm_data->security->dl_count,
_usim_data.securityctx.dlNAScount.value, _usim_data.securityctx.dlNAScount.value,
_usim_data.securityctx.dlNAScount.length); _usim_data.securityctx.dlNAScount.length);
} }
/* Uplink count parameter */ /* Uplink count parameter */
if (_usim_data.securityctx.ulNAScount.length <= sizeof(uint32_t)) { if (_usim_data.securityctx.ulNAScount.length <= sizeof(uint32_t)) {
memcpy(&_emm_data.security->ul_count, memcpy(&user->emm_data->security->ul_count,
_usim_data.securityctx.ulNAScount.value, _usim_data.securityctx.ulNAScount.value,
_usim_data.securityctx.ulNAScount.length); _usim_data.securityctx.ulNAScount.length);
} }
/* Ciphering algorithm */ /* Ciphering algorithm */
_emm_data.security->capability.eps_encryption = user->emm_data->security->capability.eps_encryption =
((_usim_data.securityctx.algorithmID.value[0] >> 4) & 0xf); ((_usim_data.securityctx.algorithmID.value[0] >> 4) & 0xf);
/* Identity protection algorithm */ /* Identity protection algorithm */
_emm_data.security->capability.eps_integrity = user->emm_data->security->capability.eps_integrity =
(_usim_data.securityctx.algorithmID.value[0] & 0xf); (_usim_data.securityctx.algorithmID.value[0] & 0xf);
/* NAS integrity and cyphering keys are not available */ /* NAS integrity and cyphering keys are not available */
} else { } else {
...@@ -311,8 +315,8 @@ void emm_main_initialize(nas_user_t *user, emm_indication_callback_t cb, const c ...@@ -311,8 +315,8 @@ void emm_main_initialize(nas_user_t *user, emm_indication_callback_t cb, const c
/* /*
* Get EMM data from the UE's non-volatile memory * Get EMM data from the UE's non-volatile memory
*/ */
memset(&_emm_data.nvdata.rplmn, 0xFF, sizeof(plmn_t)); memset(&user->emm_data->nvdata.rplmn, 0xFF, sizeof(plmn_t));
_emm_data.nvdata.eplmn.n_plmns = 0; user->emm_data->nvdata.eplmn.n_plmns = 0;
/* Get EMM data pathname */ /* Get EMM data pathname */
char *path = memory_get_path(EMM_NVRAM_DIRNAME, EMM_NVRAM_FILENAME); char *path = memory_get_path(EMM_NVRAM_DIRNAME, EMM_NVRAM_FILENAME);
...@@ -320,29 +324,29 @@ void emm_main_initialize(nas_user_t *user, emm_indication_callback_t cb, const c ...@@ -320,29 +324,29 @@ void emm_main_initialize(nas_user_t *user, emm_indication_callback_t cb, const c
LOG_TRACE(ERROR, "EMM-MAIN - Failed to get EMM data pathname"); LOG_TRACE(ERROR, "EMM-MAIN - Failed to get EMM data pathname");
} else { } else {
/* Get EMM data stored in the non-volatile memory device */ /* Get EMM data stored in the non-volatile memory device */
int rc = memory_read(path, &_emm_data.nvdata, sizeof(emm_nvdata_t)); int rc = memory_read(path, &user->emm_data->nvdata, sizeof(emm_nvdata_t));
if (rc != RETURNok) { if (rc != RETURNok) {
LOG_TRACE(ERROR, "EMM-MAIN - Failed to read %s", path); LOG_TRACE(ERROR, "EMM-MAIN - Failed to read %s", path);
} else { } else {
/* Check the IMSI */ /* Check the IMSI */
LOG_TRACE(INFO, "EMM-MAIN - EMM data successfully read"); LOG_TRACE(INFO, "EMM-MAIN - EMM data successfully read");
_emm_data.imsi = &_usim_data.imsi; user->emm_data->imsi = &_usim_data.imsi;
int imsi_ok = _emm_main_imsi_cmp(&_emm_data.nvdata.imsi, int imsi_ok = _emm_main_imsi_cmp(&user->emm_data->nvdata.imsi,
&_usim_data.imsi); &_usim_data.imsi);
if (!imsi_ok) { if (!imsi_ok) {
LOG_TRACE(WARNING, "EMM-MAIN - IMSI checking failed nvram: " LOG_TRACE(WARNING, "EMM-MAIN - IMSI checking failed nvram: "
"%02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x, " "%02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x, "
"usim: %02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x", "usim: %02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x",
_emm_data.nvdata.imsi.u.value[0], user->emm_data->nvdata.imsi.u.value[0],
_emm_data.nvdata.imsi.u.value[1], user->emm_data->nvdata.imsi.u.value[1],
_emm_data.nvdata.imsi.u.value[2], user->emm_data->nvdata.imsi.u.value[2],
_emm_data.nvdata.imsi.u.value[3], user->emm_data->nvdata.imsi.u.value[3],
_emm_data.nvdata.imsi.u.value[4], user->emm_data->nvdata.imsi.u.value[4],
_emm_data.nvdata.imsi.u.value[5], user->emm_data->nvdata.imsi.u.value[5],
_emm_data.nvdata.imsi.u.value[6], user->emm_data->nvdata.imsi.u.value[6],
_emm_data.nvdata.imsi.u.value[7], user->emm_data->nvdata.imsi.u.value[7],
_usim_data.imsi.u.value[0], _usim_data.imsi.u.value[0],
_usim_data.imsi.u.value[1], _usim_data.imsi.u.value[1],
_usim_data.imsi.u.value[2], _usim_data.imsi.u.value[2],
...@@ -351,8 +355,8 @@ void emm_main_initialize(nas_user_t *user, emm_indication_callback_t cb, const c ...@@ -351,8 +355,8 @@ void emm_main_initialize(nas_user_t *user, emm_indication_callback_t cb, const c
_usim_data.imsi.u.value[5], _usim_data.imsi.u.value[5],
_usim_data.imsi.u.value[6], _usim_data.imsi.u.value[6],
_usim_data.imsi.u.value[7]); _usim_data.imsi.u.value[7]);
memset(&_emm_data.nvdata.rplmn, 0xFF, sizeof(plmn_t)); memset(&user->emm_data->nvdata.rplmn, 0xFF, sizeof(plmn_t));
_emm_data.nvdata.eplmn.n_plmns = 0; user->emm_data->nvdata.eplmn.n_plmns = 0;
} }
} }
...@@ -392,6 +396,7 @@ void emm_main_initialize(nas_user_t *user, emm_indication_callback_t cb, const c ...@@ -392,6 +396,7 @@ void emm_main_initialize(nas_user_t *user, emm_indication_callback_t cb, const c
/* /*
* Initialize EMM internal data used for UE in idle mode * Initialize EMM internal data used for UE in idle mode
*/ */
// FIXME REVIEW
IdleMode_initialize(user, &_emm_main_callback); IdleMode_initialize(user, &_emm_main_callback);
LOG_FUNC_OUT; LOG_FUNC_OUT;
...@@ -412,56 +417,14 @@ void emm_main_initialize(nas_user_t *user, emm_indication_callback_t cb, const c ...@@ -412,56 +417,14 @@ void emm_main_initialize(nas_user_t *user, emm_indication_callback_t cb, const c
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
void emm_main_cleanup(void) void emm_main_cleanup(emm_data_t *emm_data)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
if (_emm_data.usim_is_valid) { if (emm_data->usim_is_valid) {
/* /*
* TODO: Update USIM application data * TODO: Update USIM application data
*/ */
#if 0
int i;
/* Update the list of Forbidden PLMNs */
for (i=0; (i < _emm_data.fplmn.n_plmns) && (i < USIM_FPLMN_MAX); i++) {
_usim_data.fplmn[i] = _emm_data.fplmn.plmn[i];
}
/* Update the list of Equivalent HPLMNs */
for (i=0; (i < _emm_data.ehplmn.n_plmns) && (i < USIM_EHPLMN_MAX); i++) {
_usim_data.ehplmn[i] = _emm_data.ehplmn.plmn[i];
}
/* Update the GUTI */
if (_emm_data.guti) {
_usim_data.epsloci.guti = *(_emm_data.guti);
}
/* Update the last visited registered TAI */
if (_emm_data.tai) {
_usim_data.epsloci.tai = *(_emm_data.tai);
}
/* Update the EPS location information */
_usim_data.epsloci.status = _emm_data.status;
if (_emm_data.security && (_emm_data.security->type == EMM_KSI_NATIVE)) {
/* TODO: Update the EPS security context parameters from the full
* native EPS security context */
}
/*
* Store USIM application data
* - List of forbidden PLMNs
*/
if ( usim_api_write(&_usim_data) != RETURNok ) {
/* The USIM application may not be present or not valid */
LOG_TRACE(WARNING, "EMM-MAIN - "
"Failed to write USIM application data");
}
#endif
} }
/* /*
...@@ -474,7 +437,7 @@ void emm_main_cleanup(void) ...@@ -474,7 +437,7 @@ void emm_main_cleanup(void)
if (path == NULL) { if (path == NULL) {
LOG_TRACE(ERROR, "EMM-MAIN - Failed to get EMM data pathname"); LOG_TRACE(ERROR, "EMM-MAIN - Failed to get EMM data pathname");
} else { } else {
int rc = memory_write(path, &_emm_data.nvdata, sizeof(emm_nvdata_t)); int rc = memory_write(path, &emm_data->nvdata, sizeof(emm_nvdata_t));
if (rc != RETURNok) { if (rc != RETURNok) {
LOG_TRACE(ERROR, "EMM-MAIN - Failed to write %s", path); LOG_TRACE(ERROR, "EMM-MAIN - Failed to write %s", path);
...@@ -482,13 +445,13 @@ void emm_main_cleanup(void) ...@@ -482,13 +445,13 @@ void emm_main_cleanup(void)
} }
/* Release dynamically allocated memory */ /* Release dynamically allocated memory */
if (_emm_data.imei) { if (emm_data->imei) {
free(_emm_data.imei); free(emm_data->imei);
_emm_data.imei = NULL; emm_data->imei = NULL;
} }
if (_emm_data.security) { if (emm_data->security) {
emm_security_context_t *security = _emm_data.security; emm_security_context_t *security = emm_data->security;
if (security->kasme.value) { if (security->kasme.value) {
free(security->kasme.value); free(security->kasme.value);
...@@ -508,8 +471,8 @@ void emm_main_cleanup(void) ...@@ -508,8 +471,8 @@ void emm_main_cleanup(void)
security->knas_int.length = 0; security->knas_int.length = 0;
} }
free(_emm_data.security); free(emm_data->security);
_emm_data.security = NULL; emm_data->security = NULL;
} }
LOG_FUNC_OUT; LOG_FUNC_OUT;
} }
...@@ -521,17 +484,17 @@ void emm_main_cleanup(void) ...@@ -521,17 +484,17 @@ void emm_main_cleanup(void)
** Description: Get the International Mobile Subscriber Identity number ** ** Description: Get the International Mobile Subscriber Identity number **
** ** ** **
** Inputs: None ** ** Inputs: None **
** Others: _emm_data ** ** Others: user->emm_data-> **
** ** ** **
** Outputs: None ** ** Outputs: None **
** Return: Pointer to the IMSI ** ** Return: Pointer to the IMSI **
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
const imsi_t *emm_main_get_imsi(void) const imsi_t *emm_main_get_imsi(emm_data_t *emm_data)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
LOG_FUNC_RETURN (&_emm_data.nvdata.imsi); LOG_FUNC_RETURN (&emm_data->nvdata.imsi);
} }
/**************************************************************************** /****************************************************************************
...@@ -572,10 +535,10 @@ const msisdn_t *emm_main_get_msisdn(void) ...@@ -572,10 +535,10 @@ const msisdn_t *emm_main_get_msisdn(void)
** ** ** **
** Outputs: None ** ** Outputs: None **
** Return: RETURNok, RETURNerror ** ** Return: RETURNok, RETURNerror **
** Others: _emm_data ** ** Others: user->emm_data-> **
** ** ** **
***************************************************************************/ ***************************************************************************/
int emm_main_set_plmn_selection_mode(int mode, int format, int emm_main_set_plmn_selection_mode(emm_data_t *emm_data, int mode, int format,
const network_plmn_t *plmn, int rat) const network_plmn_t *plmn, int rat)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
...@@ -585,7 +548,7 @@ int emm_main_set_plmn_selection_mode(int mode, int format, ...@@ -585,7 +548,7 @@ int emm_main_set_plmn_selection_mode(int mode, int format,
LOG_TRACE(INFO, "EMM-MAIN - PLMN selection: mode=%d, format=%d, plmn=%s, " LOG_TRACE(INFO, "EMM-MAIN - PLMN selection: mode=%d, format=%d, plmn=%s, "
"rat=%d", mode, format, (const char *)&plmn->id, rat); "rat=%d", mode, format, (const char *)&plmn->id, rat);
_emm_data.plmn_mode = mode; emm_data->plmn_mode = mode;
if (mode != EMM_DATA_PLMN_AUTO) { if (mode != EMM_DATA_PLMN_AUTO) {
/* Get the index of the PLMN in the list of available PLMNs */ /* Get the index of the PLMN in the list of available PLMNs */
...@@ -596,8 +559,8 @@ int emm_main_set_plmn_selection_mode(int mode, int format, ...@@ -596,8 +559,8 @@ int emm_main_set_plmn_selection_mode(int mode, int format,
(const char *)&plmn->id); (const char *)&plmn->id);
} else { } else {
/* Update the manually selected network selection data */ /* Update the manually selected network selection data */
_emm_data.plmn_index = index; emm_data->plmn_index = index;
_emm_data.plmn_rat = rat; emm_data->plmn_rat = rat;
} }
} else { } else {
/* /*
...@@ -619,17 +582,17 @@ int emm_main_set_plmn_selection_mode(int mode, int format, ...@@ -619,17 +582,17 @@ int emm_main_set_plmn_selection_mode(int mode, int format,
** operation ** ** operation **
** ** ** **
** Inputs: None ** ** Inputs: None **
** Others: _emm_data ** ** Others: user->emm_data-> **
** ** ** **
** Outputs: None ** ** Outputs: None **
** Return: The value of the network selection mode ** ** Return: The value of the network selection mode **
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
int emm_main_get_plmn_selection_mode(void) int emm_main_get_plmn_selection_mode(emm_data_t *emm_data)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
LOG_FUNC_RETURN (_emm_data.plmn_mode); LOG_FUNC_RETURN (emm_data->plmn_mode);
} }
/**************************************************************************** /****************************************************************************
...@@ -639,19 +602,19 @@ int emm_main_get_plmn_selection_mode(void) ...@@ -639,19 +602,19 @@ int emm_main_get_plmn_selection_mode(void)
** Description: Get the list of available PLMNs ** ** Description: Get the list of available PLMNs **
** ** ** **
** Inputs: None ** ** Inputs: None **
** Others: _emm_data ** ** Others: user->emm_data-> **
** ** ** **
** Outputs: plist: Pointer to the list of available PLMNs ** ** Outputs: plist: Pointer to the list of available PLMNs **
** Return: The size of the list in bytes ** ** Return: The size of the list in bytes **
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
int emm_main_get_plmn_list(const char **plist) int emm_main_get_plmn_list(emm_data_t *emm_data, const char **plist)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
int size = IdleMode_update_plmn_list(0); int size = IdleMode_update_plmn_list(emm_data, 0);
*plist = _emm_data.plist.buffer; *plist = emm_data->plist.buffer;
LOG_FUNC_RETURN (size); LOG_FUNC_RETURN (size);
} }
...@@ -664,7 +627,6 @@ int emm_main_get_plmn_list(const char **plist) ...@@ -664,7 +627,6 @@ int emm_main_get_plmn_list(const char **plist)
** ** ** **
** Inputs: format: The requested format of the string repre- ** ** Inputs: format: The requested format of the string repre- **
** sentation of the PLMN identifier ** ** sentation of the PLMN identifier **
** Others: _emm_data **
** ** ** **
** Outputs: plmn: The selected PLMN identifier coded in the ** ** Outputs: plmn: The selected PLMN identifier coded in the **
** requested format ** ** requested format **
...@@ -673,7 +635,7 @@ int emm_main_get_plmn_list(const char **plist) ...@@ -673,7 +635,7 @@ int emm_main_get_plmn_list(const char **plist)
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
const char *emm_main_get_selected_plmn(network_plmn_t *plmn, int format) const char *emm_main_get_selected_plmn(emm_data_t *emm_data, network_plmn_t *plmn, int format)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
...@@ -684,7 +646,7 @@ const char *emm_main_get_selected_plmn(network_plmn_t *plmn, int format) ...@@ -684,7 +646,7 @@ const char *emm_main_get_selected_plmn(network_plmn_t *plmn, int format)
int index = IdleMode_get_splmn_index(); int index = IdleMode_get_splmn_index();
if ( !(index < 0) ) { if ( !(index < 0) ) {
const char *name = _emm_main_get_plmn(&_emm_data.splmn, index, const char *name = _emm_main_get_plmn(&emm_data->splmn, index,
format, &size); format, &size);
if (size > 0) { if (size > 0) {
...@@ -703,7 +665,6 @@ const char *emm_main_get_selected_plmn(network_plmn_t *plmn, int format) ...@@ -703,7 +665,6 @@ const char *emm_main_get_selected_plmn(network_plmn_t *plmn, int format)
** ** ** **
** Inputs: format: The requested format of the string repre- ** ** Inputs: format: The requested format of the string repre- **
** sentation of the PLMN identifier ** ** sentation of the PLMN identifier **
** Others: _emm_data **
** ** ** **
** Outputs: plmn: The registered PLMN identifier coded in ** ** Outputs: plmn: The registered PLMN identifier coded in **
** the requested format ** ** the requested format **
...@@ -712,7 +673,7 @@ const char *emm_main_get_selected_plmn(network_plmn_t *plmn, int format) ...@@ -712,7 +673,7 @@ const char *emm_main_get_selected_plmn(network_plmn_t *plmn, int format)
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
const char *emm_main_get_registered_plmn(network_plmn_t *plmn, int format) const char *emm_main_get_registered_plmn(emm_data_t *emm_data, network_plmn_t *plmn, int format)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
...@@ -724,7 +685,7 @@ const char *emm_main_get_registered_plmn(network_plmn_t *plmn, int format) ...@@ -724,7 +685,7 @@ const char *emm_main_get_registered_plmn(network_plmn_t *plmn, int format)
int index = IdleMode_get_rplmn_index(); int index = IdleMode_get_rplmn_index();
if ( !(index < 0) ) { if ( !(index < 0) ) {
const char *name = _emm_main_get_plmn(&_emm_data.nvdata.rplmn, const char *name = _emm_main_get_plmn(&emm_data->nvdata.rplmn,
index, format, &size); index, format, &size);
if (size > 0) { if (size > 0) {
...@@ -744,17 +705,16 @@ const char *emm_main_get_registered_plmn(network_plmn_t *plmn, int format) ...@@ -744,17 +705,16 @@ const char *emm_main_get_registered_plmn(network_plmn_t *plmn, int format)
** registration of the UE ** ** registration of the UE **
** ** ** **
** Inputs: None ** ** Inputs: None **
** Others: _emm_data **
** ** ** **
** Outputs: None ** ** Outputs: None **
** Return: The current network registration status ** ** Return: The current network registration status **
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
Stat_t emm_main_get_plmn_status(void) Stat_t emm_main_get_plmn_status(emm_data_t *emm_data)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
LOG_FUNC_RETURN (_emm_data.stat); LOG_FUNC_RETURN (emm_data->stat);
} }
/**************************************************************************** /****************************************************************************
...@@ -765,17 +725,16 @@ Stat_t emm_main_get_plmn_status(void) ...@@ -765,17 +725,16 @@ Stat_t emm_main_get_plmn_status(void)
** belongs to ** ** belongs to **
** ** ** **
** Inputs: None ** ** Inputs: None **
** Others: _emm_data **
** ** ** **
** Outputs: None ** ** Outputs: None **
** Return: The Location/Tracking area code ** ** Return: The Location/Tracking area code **
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
tac_t emm_main_get_plmn_tac(void) tac_t emm_main_get_plmn_tac(emm_data_t *emm_data)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
LOG_FUNC_RETURN (_emm_data.tac); LOG_FUNC_RETURN (emm_data->tac);
} }
/**************************************************************************** /****************************************************************************
...@@ -785,17 +744,16 @@ tac_t emm_main_get_plmn_tac(void) ...@@ -785,17 +744,16 @@ tac_t emm_main_get_plmn_tac(void)
** Description: Get the identifier of the serving cell ** ** Description: Get the identifier of the serving cell **
** ** ** **
** Inputs: None ** ** Inputs: None **
** Others: _emm_data **
** ** ** **
** Outputs: None ** ** Outputs: None **
** Return: The serving cell identifier ** ** Return: The serving cell identifier **
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
ci_t emm_main_get_plmn_ci(void) ci_t emm_main_get_plmn_ci(emm_data_t *emm_data)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
LOG_FUNC_RETURN (_emm_data.ci); LOG_FUNC_RETURN (emm_data->ci);
} }
/**************************************************************************** /****************************************************************************
...@@ -806,7 +764,6 @@ ci_t emm_main_get_plmn_ci(void) ...@@ -806,7 +764,6 @@ ci_t emm_main_get_plmn_ci(void)
** ving cell ** ** ving cell **
** ** ** **
** Inputs: None ** ** Inputs: None **
** Others: _emm_data **
** ** ** **
** Outputs: None ** ** Outputs: None **
** Return: The value of the Radio Access Technology ** ** Return: The value of the Radio Access Technology **
...@@ -814,10 +771,10 @@ ci_t emm_main_get_plmn_ci(void) ...@@ -814,10 +771,10 @@ ci_t emm_main_get_plmn_ci(void)
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
AcT_t emm_main_get_plmn_rat(void) AcT_t emm_main_get_plmn_rat(emm_data_t *emm_data)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
LOG_FUNC_RETURN (_emm_data.rat); LOG_FUNC_RETURN (emm_data->rat);
} }
/**************************************************************************** /****************************************************************************
...@@ -828,7 +785,7 @@ AcT_t emm_main_get_plmn_rat(void) ...@@ -828,7 +785,7 @@ AcT_t emm_main_get_plmn_rat(void)
** network for EPS services or emergency service only ** ** network for EPS services or emergency service only **
** ** ** **
** Inputs: None ** ** Inputs: None **
** Others: _emm_data ** ** Others: user->emm_data-> **
** ** ** **
** Outputs: None ** ** Outputs: None **
** Return: TRUE if the UE is currently attached to ** ** Return: TRUE if the UE is currently attached to **
...@@ -836,10 +793,10 @@ AcT_t emm_main_get_plmn_rat(void) ...@@ -836,10 +793,10 @@ AcT_t emm_main_get_plmn_rat(void)
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
int emm_main_is_attached(void) int emm_main_is_attached(emm_data_t *emm_data)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
LOG_FUNC_RETURN (_emm_data.is_attached); LOG_FUNC_RETURN (emm_data->is_attached);
} }
/**************************************************************************** /****************************************************************************
...@@ -850,7 +807,7 @@ int emm_main_is_attached(void) ...@@ -850,7 +807,7 @@ int emm_main_is_attached(void)
** network for emergency bearer services ** ** network for emergency bearer services **
** ** ** **
** Inputs: None ** ** Inputs: None **
** Others: _emm_data ** ** Others: user->emm_data-> **
** ** ** **
** Outputs: None ** ** Outputs: None **
** Return: TRUE if the UE is currently attached or is ** ** Return: TRUE if the UE is currently attached or is **
...@@ -859,10 +816,10 @@ int emm_main_is_attached(void) ...@@ -859,10 +816,10 @@ int emm_main_is_attached(void)
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
int emm_main_is_emergency(void) int emm_main_is_emergency(emm_data_t *emm_data)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
LOG_FUNC_RETURN (_emm_data.is_attached && _emm_data.is_emergency); LOG_FUNC_RETURN (emm_data->is_attached && emm_data->is_emergency);
} }
/****************************************************************************/ /****************************************************************************/
...@@ -881,21 +838,21 @@ int emm_main_is_emergency(void) ...@@ -881,21 +838,21 @@ int emm_main_is_emergency(void)
** present in the network. The list has to be ** ** present in the network. The list has to be **
** displayed to the user application when ** ** displayed to the user application when **
** size > 0. ** ** size > 0. **
** Others: _emm_data ** ** Others: user->emm_data-> **
** ** ** **
** Outputs: None ** ** Outputs: None **
** Return: RETURNok, RETURNerror ** ** Return: RETURNok, RETURNerror **
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
static int _emm_main_callback(int size) static int _emm_main_callback(emm_data_t *emm_data, int size)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
/* Forward the notification to the user API */ /* Forward the notification to the user API */
int rc = (*_emm_main_user_callback)(_emm_data.stat, _emm_data.tac, int rc = (*_emm_main_user_callback)(emm_data->stat, emm_data->tac,
_emm_data.ci, _emm_data.rat, emm_data->ci, emm_data->rat,
_emm_data.plist.buffer, size); emm_data->plist.buffer, size);
LOG_FUNC_RETURN (rc); LOG_FUNC_RETURN (rc);
} }
......
...@@ -70,32 +70,32 @@ typedef int (*emm_indication_callback_t) (Stat_t, tac_t, ci_t, AcT_t, ...@@ -70,32 +70,32 @@ typedef int (*emm_indication_callback_t) (Stat_t, tac_t, ci_t, AcT_t,
void emm_main_initialize(nas_user_t *user, emm_indication_callback_t cb, const char *imei); void emm_main_initialize(nas_user_t *user, emm_indication_callback_t cb, const char *imei);
void emm_main_cleanup(void); void emm_main_cleanup(emm_data_t *emm_data);
/* User's getter of UE's identity */ /* User's getter of UE's identity */
const imsi_t *emm_main_get_imsi(void); const imsi_t *emm_main_get_imsi(emm_data_t *emm_data);
/* User's getter of the subscriber dialing number */ /* User's getter of the subscriber dialing number */
const msisdn_t *emm_main_get_msisdn(void); const msisdn_t *emm_main_get_msisdn(void);
/* User's getter/setter for network selection */ /* User's getter/setter for network selection */
int emm_main_set_plmn_selection_mode(int mode, int format, int emm_main_set_plmn_selection_mode(emm_data_t *emm_data, int mode, int format,
const network_plmn_t *plmn, int rat); const network_plmn_t *plmn, int rat);
int emm_main_get_plmn_selection_mode(void); int emm_main_get_plmn_selection_mode(emm_data_t *emm_data);
int emm_main_get_plmn_list(const char **plist); int emm_main_get_plmn_list(emm_data_t *emm_data, const char **plist);
const char *emm_main_get_selected_plmn(network_plmn_t *plmn, int format); const char *emm_main_get_selected_plmn(emm_data_t *emm_data, network_plmn_t *plmn, int format);
/* User's getter for network registration */ /* User's getter for network registration */
Stat_t emm_main_get_plmn_status(void); Stat_t emm_main_get_plmn_status(emm_data_t *emm_data);
tac_t emm_main_get_plmn_tac(void); tac_t emm_main_get_plmn_tac(emm_data_t *emm_data);
ci_t emm_main_get_plmn_ci(void); ci_t emm_main_get_plmn_ci(emm_data_t *emm_data);
AcT_t emm_main_get_plmn_rat(void); AcT_t emm_main_get_plmn_rat(emm_data_t *emm_data);
const char *emm_main_get_registered_plmn(network_plmn_t *plmn, int format); const char *emm_main_get_registered_plmn(emm_data_t *emm_data, network_plmn_t *plmn, int format);
/* User's getter for network attachment */ /* User's getter for network attachment */
int emm_main_is_attached(void); int emm_main_is_attached(emm_data_t *emm_data);
int emm_main_is_emergency(void); int emm_main_is_emergency(emm_data_t *emm_data);
#endif /* __EMM_MAIN_H__*/ #endif /* __EMM_MAIN_H__*/
...@@ -133,7 +133,7 @@ int emm_proc_attach_failure(int is_initial, void *args); ...@@ -133,7 +133,7 @@ int emm_proc_attach_failure(int is_initial, void *args);
int emm_proc_attach_release(void *args); int emm_proc_attach_release(void *args);
int emm_proc_attach_restart(nas_user_t *user); int emm_proc_attach_restart(nas_user_t *user);
int emm_proc_attach_set_emergency(void); int emm_proc_attach_set_emergency(emm_data_t *emm_data);
// FIXME check prototype // FIXME check prototype
int emm_proc_attach_set_detach(void *user); int emm_proc_attach_set_detach(void *user);
...@@ -183,8 +183,8 @@ int emm_proc_security_mode_command(nas_user_t *user, int native_ksi, int ksi, in ...@@ -183,8 +183,8 @@ int emm_proc_security_mode_command(nas_user_t *user, int native_ksi, int ksi, in
* Network indication handlers * Network indication handlers
*--------------------------------------------------------------------------- *---------------------------------------------------------------------------
*/ */
int emm_proc_registration_notify(Stat_t status); int emm_proc_registration_notify(emm_data_t *emm_data, Stat_t status);
int emm_proc_location_notify(tac_t tac, ci_t ci, AcT_t rat); int emm_proc_location_notify(emm_data_t *emm_data, tac_t tac, ci_t ci, AcT_t rat);
int emm_proc_network_notify(int index); int emm_proc_network_notify(emm_data_t *emm_data, int index);
#endif /* __EMM_PROC_H__*/ #endif /* __EMM_PROC_H__*/
...@@ -134,7 +134,7 @@ void nas_proc_cleanup(nas_user_t *user) ...@@ -134,7 +134,7 @@ void nas_proc_cleanup(nas_user_t *user)
/* Perform the EPS Mobility Manager's clean up procedure */ /* Perform the EPS Mobility Manager's clean up procedure */
emm_main_cleanup(); emm_main_cleanup(user->emm_data);
/* Perform the EPS Session Manager's clean up procedure */ /* Perform the EPS Session Manager's clean up procedure */
esm_main_cleanup(user->esm_data); esm_main_cleanup(user->esm_data);
...@@ -251,11 +251,11 @@ int nas_proc_get_eps(nas_user_t *user, int *stat) ...@@ -251,11 +251,11 @@ int nas_proc_get_eps(nas_user_t *user, int *stat)
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
int nas_proc_get_imsi(char *imsi_str) int nas_proc_get_imsi(emm_data_t *emm_data, char *imsi_str)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
const imsi_t *imsi = emm_main_get_imsi(); const imsi_t *imsi = emm_main_get_imsi(emm_data);
if (imsi != NULL) { if (imsi != NULL) {
int offset = 0; int offset = 0;
...@@ -386,7 +386,7 @@ int nas_proc_register(nas_user_t *user, int mode, int format, const network_plmn ...@@ -386,7 +386,7 @@ int nas_proc_register(nas_user_t *user, int mode, int format, const network_plmn
/* /*
* Set the PLMN selection mode of operation * Set the PLMN selection mode of operation
*/ */
int index = emm_main_set_plmn_selection_mode(mode, format, oper, AcT); int index = emm_main_set_plmn_selection_mode(user->emm_data, mode, format, oper, AcT);
if ( !(index < 0) ) { if ( !(index < 0) ) {
/* /*
...@@ -452,16 +452,16 @@ int nas_proc_get_reg_data(nas_user_t *user, int *mode, int *selected, int format ...@@ -452,16 +452,16 @@ int nas_proc_get_reg_data(nas_user_t *user, int *mode, int *selected, int format
LOG_FUNC_IN; LOG_FUNC_IN;
/* Get the PLMN selection mode of operation */ /* Get the PLMN selection mode of operation */
*mode = emm_main_get_plmn_selection_mode(); *mode = emm_main_get_plmn_selection_mode(user->emm_data);
/* Get the currently selected operator */ /* Get the currently selected operator */
const char *oper_name = emm_main_get_selected_plmn(oper, format); const char *oper_name = emm_main_get_selected_plmn(user->emm_data, oper, format);
if (oper_name != NULL) { if (oper_name != NULL) {
/* An operator is currently selected */ /* An operator is currently selected */
*selected = TRUE; *selected = TRUE;
/* Get the supported Radio Access Technology */ /* Get the supported Radio Access Technology */
*AcT = emm_main_get_plmn_rat(); *AcT = emm_main_get_plmn_rat(user->emm_data);
} else { } else {
/* No any operator is selected */ /* No any operator is selected */
*selected = FALSE; *selected = FALSE;
...@@ -489,7 +489,7 @@ int nas_proc_get_oper_list(nas_user_t *user, const char **oper_list) ...@@ -489,7 +489,7 @@ int nas_proc_get_oper_list(nas_user_t *user, const char **oper_list)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
int size = emm_main_get_plmn_list(oper_list); int size = emm_main_get_plmn_list(user->emm_data, oper_list);
LOG_FUNC_RETURN (size); LOG_FUNC_RETURN (size);
} }
...@@ -514,7 +514,7 @@ int nas_proc_get_reg_status(nas_user_t *user, int *stat) ...@@ -514,7 +514,7 @@ int nas_proc_get_reg_status(nas_user_t *user, int *stat)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
*stat = emm_main_get_plmn_status(); *stat = emm_main_get_plmn_status(user->emm_data);
LOG_FUNC_RETURN (RETURNok); LOG_FUNC_RETURN (RETURNok);
} }
...@@ -542,9 +542,9 @@ int nas_proc_get_loc_info(nas_user_t *user, char *tac, char *ci, int *AcT) ...@@ -542,9 +542,9 @@ int nas_proc_get_loc_info(nas_user_t *user, char *tac, char *ci, int *AcT)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
sprintf(tac, "%.4x", emm_main_get_plmn_tac()); // two byte sprintf(tac, "%.4x", emm_main_get_plmn_tac(user->emm_data)); // two byte
sprintf(ci, "%.8x", emm_main_get_plmn_ci()); // four byte sprintf(ci, "%.8x", emm_main_get_plmn_ci(user->emm_data)); // four byte
*AcT = emm_main_get_plmn_rat(); // E-UTRAN *AcT = emm_main_get_plmn_rat(user->emm_data); // E-UTRAN
LOG_FUNC_RETURN (RETURNok); LOG_FUNC_RETURN (RETURNok);
} }
...@@ -570,7 +570,7 @@ int nas_proc_detach(nas_user_t *user, int switch_off) ...@@ -570,7 +570,7 @@ int nas_proc_detach(nas_user_t *user, int switch_off)
emm_sap_t emm_sap; emm_sap_t emm_sap;
int rc = RETURNok; int rc = RETURNok;
if ( emm_main_is_attached() ) { if ( emm_main_is_attached(user->emm_data) ) {
/* Initiate an Detach procedure */ /* Initiate an Detach procedure */
emm_sap.primitive = EMMREG_DETACH_INIT; emm_sap.primitive = EMMREG_DETACH_INIT;
emm_sap.u.emm_reg.u.detach.switch_off = switch_off; emm_sap.u.emm_reg.u.detach.switch_off = switch_off;
...@@ -601,7 +601,7 @@ int nas_proc_attach(nas_user_t *user) ...@@ -601,7 +601,7 @@ int nas_proc_attach(nas_user_t *user)
emm_sap_t emm_sap; emm_sap_t emm_sap;
int rc = RETURNok; int rc = RETURNok;
if ( !emm_main_is_attached() ) { if ( !emm_main_is_attached(user->emm_data) ) {
/* Initiate an Attach procedure */ /* Initiate an Attach procedure */
emm_sap.primitive = EMMREG_ATTACH_INIT; emm_sap.primitive = EMMREG_ATTACH_INIT;
emm_sap.u.emm_reg.u.attach.is_emergency = FALSE; emm_sap.u.emm_reg.u.attach.is_emergency = FALSE;
...@@ -630,7 +630,7 @@ int nas_proc_get_attach_status(nas_user_t *user) ...@@ -630,7 +630,7 @@ int nas_proc_get_attach_status(nas_user_t *user)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
int is_attached = emm_main_is_attached(); int is_attached = emm_main_is_attached(user->emm_data);
LOG_FUNC_RETURN (is_attached); LOG_FUNC_RETURN (is_attached);
} }
...@@ -950,14 +950,14 @@ int nas_proc_activate_pdn(nas_user_t *user, int cid) ...@@ -950,14 +950,14 @@ int nas_proc_activate_pdn(nas_user_t *user, int cid)
int rc = RETURNok; int rc = RETURNok;
if ( !emm_main_is_attached() ) { if ( !emm_main_is_attached(user->emm_data) ) {
/* /*
* If the UE is not attached to the network, perform EPS attach * If the UE is not attached to the network, perform EPS attach
* procedure prior to attempt to request any PDN connectivity * procedure prior to attempt to request any PDN connectivity
*/ */
LOG_TRACE(WARNING, "NAS-PROC - UE is not attached to the network"); LOG_TRACE(WARNING, "NAS-PROC - UE is not attached to the network");
rc = nas_proc_attach(user); rc = nas_proc_attach(user);
} else if (emm_main_is_emergency()) { } else if (emm_main_is_emergency(user->emm_data)) {
/* The UE is attached for emergency bearer services; It shall not /* The UE is attached for emergency bearer services; It shall not
* request a PDN connection to any other PDN */ * request a PDN connection to any other PDN */
LOG_TRACE(WARNING,"NAS-PROC - Attached for emergency bearer services"); LOG_TRACE(WARNING,"NAS-PROC - Attached for emergency bearer services");
......
...@@ -76,7 +76,7 @@ int nas_proc_enable_s1_mode(nas_user_t *user); ...@@ -76,7 +76,7 @@ int nas_proc_enable_s1_mode(nas_user_t *user);
int nas_proc_disable_s1_mode(nas_user_t *user); int nas_proc_disable_s1_mode(nas_user_t *user);
int nas_proc_get_eps(nas_user_t *user, int *stat); int nas_proc_get_eps(nas_user_t *user, int *stat);
int nas_proc_get_imsi(char *imsi_str); int nas_proc_get_imsi(emm_data_t *emm_data, char *imsi_str);
int nas_proc_get_msisdn(char *msisdn_str, int *ton_npi); int nas_proc_get_msisdn(char *msisdn_str, int *ton_npi);
int nas_proc_get_signal_quality(nas_user_t *user, int *rsrq, int *rsrp); int nas_proc_get_signal_quality(nas_user_t *user, int *rsrq, int *rsrp);
......
...@@ -652,7 +652,7 @@ static int _nas_user_proc_cimi(nas_user_t *user, const at_command_t *data) ...@@ -652,7 +652,7 @@ static int _nas_user_proc_cimi(nas_user_t *user, const at_command_t *data)
} }
/* Get the International Mobile Subscriber Identity (IMSI) */ /* Get the International Mobile Subscriber Identity (IMSI) */
ret_code = nas_proc_get_imsi(cimi->IMSI); ret_code = nas_proc_get_imsi(user->emm_data, cimi->IMSI);
if (ret_code != RETURNok) { if (ret_code != RETURNok) {
LOG_TRACE(ERROR, "USR-MAIN - Failed to get IMSI number"); LOG_TRACE(ERROR, "USR-MAIN - Failed to get IMSI number");
......
...@@ -49,14 +49,16 @@ Description NAS type definition to manage a user equipment ...@@ -49,14 +49,16 @@ Description NAS type definition to manage a user equipment
#include "esmData.h" #include "esmData.h"
#include "esm_pt_defs.h" #include "esm_pt_defs.h"
#include "EMM/emm_fsm_defs.h" #include "EMM/emm_fsm_defs.h"
#include "EMM/emmData.h"
typedef struct { typedef struct {
int fd; int fd;
proc_data_t proc; proc_data_t proc;
esm_data_t *esm_data; // ESM internal data (used within ESM only) esm_data_t *esm_data; // ESM internal data (used within ESM only)
esm_pt_data_t *esm_pt_data; esm_pt_data_t *esm_pt_data;
emm_fsm_state_t emm_fsm_status; // Current EPS Mobility Management status
esm_ebr_data_t *esm_ebr_data; // EPS bearer contexts esm_ebr_data_t *esm_ebr_data; // EPS bearer contexts
emm_fsm_state_t emm_fsm_status; // Current EPS Mobility Management status
emm_data_t *emm_data; // EPS mobility management data
} nas_user_t; } nas_user_t;
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment