Commit 223247ce authored by Frédéric Leroy's avatar Frédéric Leroy

UE/EMM: add nas_user_t parameter to emm_sap_send

Surprisingly, it touches every part of openair3, and most of the prototype.
Moreover, a special attention have been put to callback review.
However, there are still places to fix or review indicated by FIXME
parent 4742178a
...@@ -97,7 +97,7 @@ static void *_emm_attach_t3402_handler(void *); ...@@ -97,7 +97,7 @@ static void *_emm_attach_t3402_handler(void *);
/* /*
* Abnormal case attach procedure * Abnormal case attach procedure
*/ */
static void _emm_attach_abnormal_cases_bcd(emm_sap_t *); static void _emm_attach_abnormal_cases_bcd(nas_user_t *user, emm_sap_t *);
/* /*
* Internal data used for attach procedure * Internal data used for attach procedure
...@@ -140,7 +140,7 @@ static struct { ...@@ -140,7 +140,7 @@ static struct {
** Others: T3402, T3410, T3411 ** ** Others: T3402, T3410, T3411 **
** ** ** **
***************************************************************************/ ***************************************************************************/
int emm_proc_attach(emm_proc_attach_type_t type) int emm_proc_attach(nas_user_t *user, emm_proc_attach_type_t type)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
...@@ -245,14 +245,14 @@ int emm_proc_attach(emm_proc_attach_type_t type) ...@@ -245,14 +245,14 @@ int emm_proc_attach(emm_proc_attach_type_t type)
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 = _emm_data.is_emergency;
rc = esm_sap_send(&esm_sap); rc = esm_sap_send(user, &esm_sap);
if (rc != RETURNerror) { if (rc != RETURNerror) {
/* Setup EMM procedure handler to be executed upon receiving /* Setup EMM procedure handler to be executed upon receiving
* lower layer notification */ * lower layer notification */
rc = emm_proc_lowerlayer_initialize(emm_proc_attach_request, rc = emm_proc_lowerlayer_initialize(emm_proc_attach_request,
emm_proc_attach_failure, emm_proc_attach_failure,
emm_proc_attach_release, NULL); emm_proc_attach_release, user);
if (rc != RETURNok) { if (rc != RETURNok) {
LOG_TRACE(WARNING, "Failed to initialize EMM procedure handler"); LOG_TRACE(WARNING, "Failed to initialize EMM procedure handler");
...@@ -260,7 +260,7 @@ int emm_proc_attach(emm_proc_attach_type_t type) ...@@ -260,7 +260,7 @@ int emm_proc_attach(emm_proc_attach_type_t type)
} }
/* Start T3410 timer */ /* Start T3410 timer */
T3410.id = nas_timer_start(T3410.sec, _emm_attach_t3410_handler, NULL); T3410.id = nas_timer_start(T3410.sec, _emm_attach_t3410_handler, user);
LOG_TRACE(INFO,"EMM-PROC - Timer T3410 (%d) expires in %ld seconds", LOG_TRACE(INFO,"EMM-PROC - Timer T3410 (%d) expires in %ld seconds",
T3410.id, T3410.sec); T3410.id, T3410.sec);
/* Stop T3402 and T3411 timers if running */ /* Stop T3402 and T3411 timers if running */
...@@ -276,7 +276,7 @@ int emm_proc_attach(emm_proc_attach_type_t type) ...@@ -276,7 +276,7 @@ int emm_proc_attach(emm_proc_attach_type_t type)
/* Get the PDN connectivity request to transfer within the ESM /* Get the PDN connectivity request to transfer within the ESM
* container of the initial attach request message */ * container of the initial attach request message */
emm_sap.u.emm_as.u.establish.NASmsg = esm_sap.send; emm_sap.u.emm_as.u.establish.NASmsg = esm_sap.send;
rc = emm_sap_send(&emm_sap); rc = emm_sap_send(user, &emm_sap);
} }
LOG_FUNC_RETURN(rc); LOG_FUNC_RETURN(rc);
...@@ -301,7 +301,7 @@ int emm_proc_attach(emm_proc_attach_type_t type) ...@@ -301,7 +301,7 @@ int emm_proc_attach(emm_proc_attach_type_t type)
int emm_proc_attach_request(void *args) int emm_proc_attach_request(void *args)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
nas_user_t *user=args;
emm_sap_t emm_sap; emm_sap_t emm_sap;
int rc; int rc;
...@@ -309,7 +309,7 @@ int emm_proc_attach_request(void *args) ...@@ -309,7 +309,7 @@ int emm_proc_attach_request(void *args)
* Notify EMM that Attach Request has been sent to the network * Notify EMM that Attach Request has been sent to the network
*/ */
emm_sap.primitive = EMMREG_ATTACH_REQ; emm_sap.primitive = EMMREG_ATTACH_REQ;
rc = emm_sap_send(&emm_sap); rc = emm_sap_send(user, &emm_sap);
LOG_FUNC_RETURN(rc); LOG_FUNC_RETURN(rc);
} }
...@@ -345,7 +345,7 @@ int emm_proc_attach_request(void *args) ...@@ -345,7 +345,7 @@ int emm_proc_attach_request(void *args)
** Others: _emm_data, T3412, T3402, T3423 ** ** Others: _emm_data, T3412, T3402, T3423 **
** ** ** **
***************************************************************************/ ***************************************************************************/
int emm_proc_attach_accept(long t3412, long t3402, long t3423, int emm_proc_attach_accept(nas_user_t *user, long t3412, long t3402, long t3423,
int n_tais, tai_t *tai, GUTI_t *guti, int n_tais, tai_t *tai, GUTI_t *guti,
int n_eplmns, plmn_t *eplmn, int n_eplmns, plmn_t *eplmn,
const OctetString *esm_msg_pP) const OctetString *esm_msg_pP)
...@@ -427,14 +427,14 @@ int emm_proc_attach_accept(long t3412, long t3402, long t3423, ...@@ -427,14 +427,14 @@ int emm_proc_attach_accept(long t3412, long t3402, long t3423,
esm_sap.primitive = ESM_DEFAULT_EPS_BEARER_CONTEXT_ACTIVATE_REQ; esm_sap.primitive = ESM_DEFAULT_EPS_BEARER_CONTEXT_ACTIVATE_REQ;
esm_sap.is_standalone = FALSE; esm_sap.is_standalone = FALSE;
esm_sap.recv = esm_msg_pP; esm_sap.recv = esm_msg_pP;
rc = esm_sap_send(&esm_sap); rc = esm_sap_send(user, &esm_sap);
if ( (rc != RETURNerror) && (esm_sap.err == ESM_SAP_SUCCESS) ) { if ( (rc != RETURNerror) && (esm_sap.err == ESM_SAP_SUCCESS) ) {
/* Setup EMM procedure handler to be executed upon receiving /* Setup EMM procedure handler to be executed upon receiving
* lower layer notification */ * lower layer notification */
rc = emm_proc_lowerlayer_initialize(emm_proc_attach_complete, rc = emm_proc_lowerlayer_initialize(emm_proc_attach_complete,
emm_proc_attach_failure, emm_proc_attach_failure,
NULL, NULL); NULL, user);
if (rc != RETURNok) { if (rc != RETURNok) {
LOG_TRACE(WARNING, LOG_TRACE(WARNING,
...@@ -458,7 +458,7 @@ int emm_proc_attach_accept(long t3412, long t3402, long t3423, ...@@ -458,7 +458,7 @@ int emm_proc_attach_accept(long t3412, long t3402, long t3423,
* complete message */ * complete message */
emm_sap.u.emm_as.u.data.NASinfo = EMM_AS_NAS_DATA_ATTACH; emm_sap.u.emm_as.u.data.NASinfo = EMM_AS_NAS_DATA_ATTACH;
emm_sap.u.emm_as.u.data.NASmsg = esm_sap.send; emm_sap.u.emm_as.u.data.NASmsg = esm_sap.send;
rc = emm_sap_send(&emm_sap); rc = emm_sap_send(user, &emm_sap);
} else if (esm_sap.err != ESM_SAP_DISCARDED) { } else if (esm_sap.err != ESM_SAP_DISCARDED) {
/* 3GPP TS 24.301, section 5.5.1.2.6, case j /* 3GPP TS 24.301, section 5.5.1.2.6, case j
* If the ACTIVATE DEFAULT BEARER CONTEXT REQUEST message combined * If the ACTIVATE DEFAULT BEARER CONTEXT REQUEST message combined
...@@ -467,7 +467,7 @@ int emm_proc_attach_accept(long t3412, long t3402, long t3423, ...@@ -467,7 +467,7 @@ int emm_proc_attach_accept(long t3412, long t3402, long t3423,
* procedure by sending a DETACH REQUEST message to the network. * procedure by sending a DETACH REQUEST message to the network.
*/ */
emm_sap.primitive = EMMREG_DETACH_INIT; emm_sap.primitive = EMMREG_DETACH_INIT;
rc = emm_sap_send(&emm_sap); rc = emm_sap_send(user, &emm_sap);
} else { } else {
/* /*
* ESM procedure failed and, received message has been discarded or * ESM procedure failed and, received message has been discarded or
...@@ -500,7 +500,7 @@ int emm_proc_attach_accept(long t3412, long t3402, long t3423, ...@@ -500,7 +500,7 @@ int emm_proc_attach_accept(long t3412, long t3402, long t3423,
** Others: _emm_data, _emm_attach_data, T3410 ** ** Others: _emm_data, _emm_attach_data, T3410 **
** ** ** **
***************************************************************************/ ***************************************************************************/
int emm_proc_attach_reject(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)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
...@@ -676,11 +676,11 @@ int emm_proc_attach_reject(int emm_cause, const OctetString *esm_msg_pP) ...@@ -676,11 +676,11 @@ int emm_proc_attach_reject(int emm_cause, const OctetString *esm_msg_pP)
default : default :
/* Other values are considered as abnormal cases /* Other values are considered as abnormal cases
* 3GPP TS 24.301, section 5.5.1.2.6, case d */ * 3GPP TS 24.301, section 5.5.1.2.6, case d */
_emm_attach_abnormal_cases_bcd(&emm_sap); _emm_attach_abnormal_cases_bcd(user, &emm_sap);
break; break;
} }
rc = emm_sap_send(&emm_sap); rc = emm_sap_send(user, &emm_sap);
/* /*
* Notify ESM that the network rejected connectivity to the PDN * Notify ESM that the network rejected connectivity to the PDN
...@@ -690,7 +690,7 @@ int emm_proc_attach_reject(int emm_cause, const OctetString *esm_msg_pP) ...@@ -690,7 +690,7 @@ int emm_proc_attach_reject(int emm_cause, const OctetString *esm_msg_pP)
esm_sap.primitive = ESM_PDN_CONNECTIVITY_REJ; esm_sap.primitive = ESM_PDN_CONNECTIVITY_REJ;
esm_sap.is_standalone = FALSE; esm_sap.is_standalone = FALSE;
esm_sap.recv = esm_msg_pP; esm_sap.recv = esm_msg_pP;
rc = esm_sap_send(&esm_sap); rc = esm_sap_send(user, &esm_sap);
} }
LOG_FUNC_RETURN(rc); LOG_FUNC_RETURN(rc);
...@@ -721,6 +721,7 @@ int emm_proc_attach_complete(void *args) ...@@ -721,6 +721,7 @@ int emm_proc_attach_complete(void *args)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
nas_user_t *user=args;
emm_sap_t emm_sap; emm_sap_t emm_sap;
esm_sap_t esm_sap; esm_sap_t esm_sap;
int rc; int rc;
...@@ -743,7 +744,7 @@ int emm_proc_attach_complete(void *args) ...@@ -743,7 +744,7 @@ int emm_proc_attach_complete(void *args)
* to the network * to the network
*/ */
emm_sap.primitive = EMMREG_ATTACH_CNF; emm_sap.primitive = EMMREG_ATTACH_CNF;
rc = emm_sap_send(&emm_sap); rc = emm_sap_send(user, &emm_sap);
if (rc != RETURNerror) { if (rc != RETURNerror) {
/* /*
...@@ -753,7 +754,7 @@ int emm_proc_attach_complete(void *args) ...@@ -753,7 +754,7 @@ int emm_proc_attach_complete(void *args)
*/ */
esm_sap.primitive = ESM_DEFAULT_EPS_BEARER_CONTEXT_ACTIVATE_CNF; esm_sap.primitive = ESM_DEFAULT_EPS_BEARER_CONTEXT_ACTIVATE_CNF;
esm_sap.is_standalone = FALSE; esm_sap.is_standalone = FALSE;
rc = esm_sap_send(&esm_sap); rc = esm_sap_send(user, &esm_sap);
} }
LOG_FUNC_RETURN(rc); LOG_FUNC_RETURN(rc);
...@@ -786,9 +787,9 @@ int emm_proc_attach_complete(void *args) ...@@ -786,9 +787,9 @@ int emm_proc_attach_complete(void *args)
int emm_proc_attach_failure(int is_initial, void *args) int emm_proc_attach_failure(int is_initial, void *args)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
int rc = RETURNok; int rc = RETURNok;
esm_sap_t esm_sap; esm_sap_t esm_sap;
nas_user_t *user=args;
LOG_TRACE(WARNING, "EMM-PROC - EPS attach failure"); LOG_TRACE(WARNING, "EMM-PROC - EPS attach failure");
...@@ -821,7 +822,7 @@ int emm_proc_attach_failure(int is_initial, void *args) ...@@ -821,7 +822,7 @@ int emm_proc_attach_failure(int is_initial, void *args)
esm_sap.recv = NULL; esm_sap.recv = NULL;
} }
rc = esm_sap_send(&esm_sap); rc = esm_sap_send(user, &esm_sap);
if (rc != RETURNerror) { if (rc != RETURNerror) {
/* Start T3411 timer */ /* Start T3411 timer */
...@@ -855,16 +856,16 @@ int emm_proc_attach_failure(int is_initial, void *args) ...@@ -855,16 +856,16 @@ int emm_proc_attach_failure(int is_initial, void *args)
int emm_proc_attach_release(void *args) int emm_proc_attach_release(void *args)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
nas_user_t *user=args;
emm_sap_t emm_sap; emm_sap_t emm_sap;
int rc; int rc;
LOG_TRACE(WARNING, "EMM-PROC - NAS signalling connection released"); LOG_TRACE(WARNING, "EMM-PROC - NAS signalling connection released");
/* Execute abnormal case attach procedure */ /* Execute abnormal case attach procedure */
_emm_attach_abnormal_cases_bcd(&emm_sap); _emm_attach_abnormal_cases_bcd(user, &emm_sap);
rc = emm_sap_send(&emm_sap); rc = emm_sap_send(user, &emm_sap);
LOG_FUNC_RETURN(rc); LOG_FUNC_RETURN(rc);
} }
...@@ -883,7 +884,7 @@ int emm_proc_attach_release(void *args) ...@@ -883,7 +884,7 @@ int emm_proc_attach_release(void *args)
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
int emm_proc_attach_restart(void) int emm_proc_attach_restart(nas_user_t *user)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
...@@ -897,7 +898,7 @@ int emm_proc_attach_restart(void) ...@@ -897,7 +898,7 @@ int emm_proc_attach_restart(void)
*/ */
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 = _emm_data.is_emergency;
rc = emm_sap_send(&emm_sap); rc = emm_sap_send(user, &emm_sap);
LOG_FUNC_RETURN(rc); LOG_FUNC_RETURN(rc);
} }
...@@ -943,10 +944,11 @@ int emm_proc_attach_set_emergency(void) ...@@ -943,10 +944,11 @@ int emm_proc_attach_set_emergency(void)
** Others: _emm_data ** ** Others: _emm_data **
** ** ** **
***************************************************************************/ ***************************************************************************/
int emm_proc_attach_set_detach(void) int emm_proc_attach_set_detach(void *nas_user)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
nas_user_t *user=nas_user;
int rc; int rc;
LOG_TRACE(WARNING, LOG_TRACE(WARNING,
...@@ -959,7 +961,7 @@ int emm_proc_attach_set_detach(void) ...@@ -959,7 +961,7 @@ int emm_proc_attach_set_detach(void)
*/ */
emm_sap_t emm_sap; emm_sap_t emm_sap;
emm_sap.primitive = EMMREG_DETACH_CNF; emm_sap.primitive = EMMREG_DETACH_CNF;
rc = emm_sap_send(&emm_sap); rc = emm_sap_send(user, &emm_sap);
LOG_FUNC_RETURN(rc); LOG_FUNC_RETURN(rc);
} }
...@@ -999,6 +1001,7 @@ void *_emm_attach_t3410_handler(void *args) ...@@ -999,6 +1001,7 @@ void *_emm_attach_t3410_handler(void *args)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
nas_user_t *user=args;
emm_sap_t emm_sap; emm_sap_t emm_sap;
int rc; int rc;
...@@ -1007,9 +1010,9 @@ void *_emm_attach_t3410_handler(void *args) ...@@ -1007,9 +1010,9 @@ void *_emm_attach_t3410_handler(void *args)
/* Stop T3410 timer */ /* Stop T3410 timer */
T3410.id = nas_timer_stop(T3410.id); T3410.id = nas_timer_stop(T3410.id);
/* Execute abnormal case attach procedure */ /* Execute abnormal case attach procedure */
_emm_attach_abnormal_cases_bcd(&emm_sap); _emm_attach_abnormal_cases_bcd(user, &emm_sap);
rc = emm_sap_send(&emm_sap); rc = emm_sap_send(user, &emm_sap);
if (rc != RETURNerror) { if (rc != RETURNerror) {
/* Locally release the NAS signalling connection */ /* Locally release the NAS signalling connection */
...@@ -1041,6 +1044,7 @@ static void *_emm_attach_t3411_handler(void *args) ...@@ -1041,6 +1044,7 @@ static void *_emm_attach_t3411_handler(void *args)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
nas_user_t *user=args;
emm_sap_t emm_sap; emm_sap_t emm_sap;
LOG_TRACE(WARNING, "EMM-PROC - T3411 timer expired"); LOG_TRACE(WARNING, "EMM-PROC - T3411 timer expired");
...@@ -1054,7 +1058,7 @@ static void *_emm_attach_t3411_handler(void *args) ...@@ -1054,7 +1058,7 @@ static void *_emm_attach_t3411_handler(void *args)
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 = _emm_data.is_emergency;
(void) emm_sap_send(&emm_sap); (void) emm_sap_send(user, &emm_sap);
LOG_FUNC_RETURN(NULL); LOG_FUNC_RETURN(NULL);
} }
...@@ -1085,6 +1089,7 @@ static void *_emm_attach_t3402_handler(void *args) ...@@ -1085,6 +1089,7 @@ static void *_emm_attach_t3402_handler(void *args)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
nas_user_t *user=args;
emm_sap_t emm_sap; emm_sap_t emm_sap;
LOG_TRACE(WARNING, "EMM-PROC - T3402 timer expired"); LOG_TRACE(WARNING, "EMM-PROC - T3402 timer expired");
...@@ -1100,7 +1105,7 @@ static void *_emm_attach_t3402_handler(void *args) ...@@ -1100,7 +1105,7 @@ static void *_emm_attach_t3402_handler(void *args)
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 = _emm_data.is_emergency;
(void) emm_sap_send(&emm_sap); (void) emm_sap_send(user, &emm_sap);
LOG_FUNC_RETURN(NULL); LOG_FUNC_RETURN(NULL);
} }
...@@ -1132,7 +1137,7 @@ static void *_emm_attach_t3402_handler(void *args) ...@@ -1132,7 +1137,7 @@ static void *_emm_attach_t3402_handler(void *args)
** T3411 ** ** T3411 **
** ** ** **
***************************************************************************/ ***************************************************************************/
static void _emm_attach_abnormal_cases_bcd(emm_sap_t *emm_sap) static void _emm_attach_abnormal_cases_bcd(nas_user_t *user, emm_sap_t *emm_sap)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
...@@ -1177,7 +1182,7 @@ static void _emm_attach_abnormal_cases_bcd(emm_sap_t *emm_sap) ...@@ -1177,7 +1182,7 @@ static void _emm_attach_abnormal_cases_bcd(emm_sap_t *emm_sap)
_emm_data.status = EU2_NOT_UPDATED; _emm_data.status = EU2_NOT_UPDATED;
/* Start T3402 timer */ /* Start T3402 timer */
T3402.id = nas_timer_start(T3402.sec, _emm_attach_t3402_handler, NULL); T3402.id = nas_timer_start(T3402.sec, _emm_attach_t3402_handler, user);
LOG_TRACE(INFO, "EMM-PROC - Timer T3402 (%d) expires in %ld seconds", LOG_TRACE(INFO, "EMM-PROC - Timer T3402 (%d) expires in %ld seconds",
T3402.id, T3402.sec); T3402.id, T3402.sec);
/* /*
......
...@@ -119,9 +119,9 @@ static struct { ...@@ -119,9 +119,9 @@ static struct {
/* /*
* Abnormal case authentication procedure * Abnormal case authentication procedure
*/ */
static int _authentication_abnormal_cases_cde(int emm_cause, static int _authentication_abnormal_cases_cde(nas_user_t *user, int emm_cause,
const OctetString *auts); const OctetString *auts);
static int _authentication_abnormal_case_f(void); static int _authentication_abnormal_case_f(nas_user_t *user);
static int _authentication_stop_timers(void); static int _authentication_stop_timers(void);
static int _authentication_start_timers(void); static int _authentication_start_timers(void);
...@@ -171,7 +171,7 @@ static int _authentication_kasme(const OctetString *autn, ...@@ -171,7 +171,7 @@ static int _authentication_kasme(const OctetString *autn,
** T3418, T3420 ** ** T3418, T3420 **
** ** ** **
***************************************************************************/ ***************************************************************************/
int emm_proc_authentication_request(int native_ksi, int ksi, int emm_proc_authentication_request(nas_user_t *user, int native_ksi, int ksi,
const OctetString *rand, const OctetString *rand,
const OctetString *autn) const OctetString *autn)
{ {
...@@ -261,17 +261,17 @@ int emm_proc_authentication_request(int native_ksi, int ksi, ...@@ -261,17 +261,17 @@ int emm_proc_authentication_request(int native_ksi, int ksi,
/* 3GPP TS 24.301, section 5.4.2.6, case e /* 3GPP TS 24.301, section 5.4.2.6, case e
* SQN failure */ * SQN failure */
rc = _authentication_abnormal_cases_cde( rc = _authentication_abnormal_cases_cde(
EMM_CAUSE_SYNCH_FAILURE, &auts); user, EMM_CAUSE_SYNCH_FAILURE, &auts);
} else if (sbit == 0) { } else if (sbit == 0) {
/* 3GPP TS 24.301, section 5.4.2.6, case d /* 3GPP TS 24.301, section 5.4.2.6, case d
* Non-EPS authentication unacceptable */ * Non-EPS authentication unacceptable */
rc = _authentication_abnormal_cases_cde( rc = _authentication_abnormal_cases_cde(
EMM_CAUSE_NON_EPS_AUTH_UNACCEPTABLE, NULL); user, EMM_CAUSE_NON_EPS_AUTH_UNACCEPTABLE, NULL);
} else { } else {
/* 3GPP TS 24.301, section 5.4.2.6, case c /* 3GPP TS 24.301, section 5.4.2.6, case c
* MAC code failure */ * MAC code failure */
rc = _authentication_abnormal_cases_cde( rc = _authentication_abnormal_cases_cde(
EMM_CAUSE_MAC_FAILURE, NULL); user, EMM_CAUSE_MAC_FAILURE, NULL);
} }
/* Free the AUTS parameter */ /* Free the AUTS parameter */
...@@ -335,7 +335,7 @@ int emm_proc_authentication_request(int native_ksi, int ksi, ...@@ -335,7 +335,7 @@ int emm_proc_authentication_request(int native_ksi, int ksi,
/* 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); _emm_data.security, FALSE, TRUE);
rc = emm_sap_send(&emm_sap); rc = emm_sap_send(user, &emm_sap);
if (rc != RETURNerror) { if (rc != RETURNerror) {
/* Reset the authentication failure counters */ /* Reset the authentication failure counters */
...@@ -396,7 +396,7 @@ int emm_proc_authentication_request(int native_ksi, int ksi, ...@@ -396,7 +396,7 @@ int emm_proc_authentication_request(int native_ksi, int ksi,
** T3417, T3430 ** ** T3417, T3430 **
** ** ** **
***************************************************************************/ ***************************************************************************/
int emm_proc_authentication_reject(void) int emm_proc_authentication_reject(nas_user_t *user)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
...@@ -451,7 +451,7 @@ int emm_proc_authentication_reject(void) ...@@ -451,7 +451,7 @@ int emm_proc_authentication_reject(void)
* Notify EMM that authentication is not accepted by the network * Notify EMM that authentication is not accepted by the network
*/ */
emm_sap.primitive = EMMREG_AUTH_REJ; emm_sap.primitive = EMMREG_AUTH_REJ;
rc = emm_sap_send(&emm_sap); rc = emm_sap_send(user, &emm_sap);
LOG_FUNC_RETURN (rc); LOG_FUNC_RETURN (rc);
} }
...@@ -563,6 +563,7 @@ static void *_authentication_t3418_handler(void *args) ...@@ -563,6 +563,7 @@ static void *_authentication_t3418_handler(void *args)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
nas_user_t *user=args;
int rc; int rc;
LOG_TRACE(WARNING, "EMM-PROC - T3418 timer expired"); LOG_TRACE(WARNING, "EMM-PROC - T3418 timer expired");
...@@ -573,7 +574,7 @@ static void *_authentication_t3418_handler(void *args) ...@@ -573,7 +574,7 @@ static void *_authentication_t3418_handler(void *args)
_authentication_data.mac_count = 0; _authentication_data.mac_count = 0;
_authentication_data.umts_count = 0; _authentication_data.umts_count = 0;
/* 3GPP TS 24.301, section 5.4.2.7, case f */ /* 3GPP TS 24.301, section 5.4.2.7, case f */
rc = _authentication_abnormal_case_f(); rc = _authentication_abnormal_case_f(user);
if (rc != RETURNok) { if (rc != RETURNok) {
LOG_TRACE(WARNING, "EMM-PROC - Failed to proceed abnormal case f"); LOG_TRACE(WARNING, "EMM-PROC - Failed to proceed abnormal case f");
...@@ -604,6 +605,7 @@ static void *_authentication_t3420_handler(void *args) ...@@ -604,6 +605,7 @@ static void *_authentication_t3420_handler(void *args)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
nas_user_t *user=args;
int rc; int rc;
LOG_TRACE(WARNING, "EMM-PROC - T3420 timer expired"); LOG_TRACE(WARNING, "EMM-PROC - T3420 timer expired");
...@@ -613,7 +615,7 @@ static void *_authentication_t3420_handler(void *args) ...@@ -613,7 +615,7 @@ static void *_authentication_t3420_handler(void *args)
/* Reset the sync failure counter */ /* Reset the sync failure counter */
_authentication_data.sync_count = 0; _authentication_data.sync_count = 0;
/* 3GPP TS 24.301, section 5.4.2.7, case f */ /* 3GPP TS 24.301, section 5.4.2.7, case f */
rc = _authentication_abnormal_case_f(); rc = _authentication_abnormal_case_f(user);
if (rc != RETURNok) { if (rc != RETURNok) {
LOG_TRACE(WARNING, "EMM-PROC - Failed to proceed abnormal case f"); LOG_TRACE(WARNING, "EMM-PROC - Failed to proceed abnormal case f");
...@@ -644,7 +646,7 @@ static void *_authentication_t3420_handler(void *args) ...@@ -644,7 +646,7 @@ static void *_authentication_t3420_handler(void *args)
** Others: _authentication_data, T3418, T3420 ** ** Others: _authentication_data, T3418, T3420 **
** ** ** **
***************************************************************************/ ***************************************************************************/
static int _authentication_abnormal_cases_cde(int emm_cause, static int _authentication_abnormal_cases_cde(nas_user_t *user, int emm_cause,
const OctetString *auts) const OctetString *auts)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
...@@ -670,7 +672,7 @@ static int _authentication_abnormal_cases_cde(int emm_cause, ...@@ -670,7 +672,7 @@ static int _authentication_abnormal_cases_cde(int 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, FALSE, TRUE); _emm_data.security, FALSE, TRUE);
rc = emm_sap_send(&emm_sap); rc = emm_sap_send(user, &emm_sap);
if (rc != RETURNerror) { if (rc != RETURNerror) {
/* /*
...@@ -683,7 +685,7 @@ static int _authentication_abnormal_cases_cde(int emm_cause, ...@@ -683,7 +685,7 @@ static int _authentication_abnormal_cases_cde(int emm_cause,
_authentication_data.mac_count += 1; _authentication_data.mac_count += 1;
/* Start timer T3418 */ /* Start timer T3418 */
T3418.id = nas_timer_start(T3418.sec, T3418.id = nas_timer_start(T3418.sec,
_authentication_t3418_handler, NULL); _authentication_t3418_handler, user);
LOG_TRACE(INFO,"EMM-PROC - Timer T3418 (%d) expires in " LOG_TRACE(INFO,"EMM-PROC - Timer T3418 (%d) expires in "
"%ld seconds", T3418.id, T3418.sec); "%ld seconds", T3418.id, T3418.sec);
break; break;
...@@ -694,7 +696,7 @@ static int _authentication_abnormal_cases_cde(int emm_cause, ...@@ -694,7 +696,7 @@ static int _authentication_abnormal_cases_cde(int emm_cause,
_authentication_data.umts_count += 1; _authentication_data.umts_count += 1;
/* Start timer T3418 */ /* Start timer T3418 */
T3418.id = nas_timer_start(T3418.sec, T3418.id = nas_timer_start(T3418.sec,
_authentication_t3418_handler, NULL); _authentication_t3418_handler, user);
LOG_TRACE(INFO,"EMM-PROC - Timer T3418 (%d) expires in " LOG_TRACE(INFO,"EMM-PROC - Timer T3418 (%d) expires in "
"%ld seconds", T3418.id, T3418.sec); "%ld seconds", T3418.id, T3418.sec);
break; break;
...@@ -705,7 +707,7 @@ static int _authentication_abnormal_cases_cde(int emm_cause, ...@@ -705,7 +707,7 @@ static int _authentication_abnormal_cases_cde(int emm_cause,
_authentication_data.sync_count += 1; _authentication_data.sync_count += 1;
/* Start timer T3420 */ /* Start timer T3420 */
T3420.id = nas_timer_start(T3420.sec, T3420.id = nas_timer_start(T3420.sec,
_authentication_t3420_handler, NULL); _authentication_t3420_handler, user);
LOG_TRACE(INFO,"EMM-PROC - Timer T3420 (%d) expires in " LOG_TRACE(INFO,"EMM-PROC - Timer T3420 (%d) expires in "
"%ld seconds", T3420.id, T3420.sec); "%ld seconds", T3420.id, T3420.sec);
break; break;
...@@ -743,7 +745,7 @@ static int _authentication_abnormal_cases_cde(int emm_cause, ...@@ -743,7 +745,7 @@ static int _authentication_abnormal_cases_cde(int emm_cause,
if (failure_counter >= AUTHENTICATION_COUNTER_MAX) { if (failure_counter >= AUTHENTICATION_COUNTER_MAX) {
/* 3GPP TS 24.301, section 5.4.2.6, case f */ /* 3GPP TS 24.301, section 5.4.2.6, case f */
rc = _authentication_abnormal_case_f(); rc = _authentication_abnormal_case_f(user);
if (rc != RETURNok) { if (rc != RETURNok) {
LOG_TRACE(WARNING, "EMM-PROC - " LOG_TRACE(WARNING, "EMM-PROC - "
...@@ -771,7 +773,7 @@ static int _authentication_abnormal_cases_cde(int emm_cause, ...@@ -771,7 +773,7 @@ static int _authentication_abnormal_cases_cde(int emm_cause,
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
static int _authentication_abnormal_case_f(void) static int _authentication_abnormal_case_f(nas_user_t *user)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
...@@ -787,7 +789,7 @@ static int _authentication_abnormal_case_f(void) ...@@ -787,7 +789,7 @@ static int _authentication_abnormal_case_f(void)
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 = _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(&emm_sap); rc = emm_sap_send(user, &emm_sap);
if (rc != RETURNerror) { if (rc != RETURNerror) {
/* Start any retransmission timers (e.g. T3410, T3417, T3421 or /* Start any retransmission timers (e.g. T3410, T3417, T3421 or
......
...@@ -83,7 +83,7 @@ void *_emm_detach_t3421_handler(void *); ...@@ -83,7 +83,7 @@ void *_emm_detach_t3421_handler(void *);
/* /*
* Abnormal case detach procedures * Abnormal case detach procedures
*/ */
static int _emm_detach_abort(emm_proc_detach_type_t type); static int _emm_detach_abort(nas_user_t *user, emm_proc_detach_type_t type);
/* /*
* Internal data used for detach procedure * Internal data used for detach procedure
...@@ -131,7 +131,7 @@ static struct { ...@@ -131,7 +131,7 @@ static struct {
** Others: _emm_detach_data ** ** Others: _emm_detach_data **
** ** ** **
***************************************************************************/ ***************************************************************************/
int emm_proc_detach(emm_proc_detach_type_t type, int switch_off) int emm_proc_detach(nas_user_t *user, emm_proc_detach_type_t type, int switch_off)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
...@@ -151,7 +151,7 @@ int emm_proc_detach(emm_proc_detach_type_t type, int switch_off) ...@@ -151,7 +151,7 @@ int emm_proc_detach(emm_proc_detach_type_t type, int switch_off)
* lower layer notification */ * lower layer notification */
rc = emm_proc_lowerlayer_initialize(emm_proc_detach_request, rc = emm_proc_lowerlayer_initialize(emm_proc_detach_request,
emm_proc_detach_failure, emm_proc_detach_failure,
emm_proc_detach_release, NULL); emm_proc_detach_release, user);
if (rc != RETURNok) { if (rc != RETURNok) {
LOG_TRACE(WARNING, "Failed to initialize EMM procedure handler"); LOG_TRACE(WARNING, "Failed to initialize EMM procedure handler");
...@@ -177,7 +177,7 @@ int emm_proc_detach(emm_proc_detach_type_t type, int switch_off) ...@@ -177,7 +177,7 @@ int emm_proc_detach(emm_proc_detach_type_t type, int switch_off)
* be sent to the network * be sent to the network
*/ */
emm_sap.primitive = EMMAS_DATA_REQ; emm_sap.primitive = EMMAS_DATA_REQ;
rc = emm_sap_send(&emm_sap); rc = emm_sap_send(user, &emm_sap);
LOG_FUNC_RETURN(rc); LOG_FUNC_RETURN(rc);
} }
...@@ -202,12 +202,13 @@ int emm_proc_detach_request(void *args) ...@@ -202,12 +202,13 @@ int emm_proc_detach_request(void *args)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
nas_user_t *user=args;
emm_sap_t emm_sap; emm_sap_t emm_sap;
int rc; int rc;
if ( !_emm_detach_data.switch_off ) { if ( !_emm_detach_data.switch_off ) {
/* Start T3421 timer */ /* Start T3421 timer */
T3421.id = nas_timer_start(T3421.sec, _emm_detach_t3421_handler, NULL); T3421.id = nas_timer_start(T3421.sec, _emm_detach_t3421_handler, user);
LOG_TRACE(INFO, "EMM-PROC - Timer T3421 (%d) expires in %ld seconds", LOG_TRACE(INFO, "EMM-PROC - Timer T3421 (%d) expires in %ld seconds",
T3421.id, T3421.sec); T3421.id, T3421.sec);
} }
...@@ -216,7 +217,7 @@ int emm_proc_detach_request(void *args) ...@@ -216,7 +217,7 @@ int emm_proc_detach_request(void *args)
* Notify EMM that Detach Request has been sent to the network * Notify EMM that Detach Request has been sent to the network
*/ */
emm_sap.primitive = EMMREG_DETACH_REQ; emm_sap.primitive = EMMREG_DETACH_REQ;
rc = emm_sap_send(&emm_sap); rc = emm_sap_send(user, &emm_sap);
LOG_FUNC_RETURN(rc); LOG_FUNC_RETURN(rc);
} }
...@@ -243,10 +244,11 @@ int emm_proc_detach_request(void *args) ...@@ -243,10 +244,11 @@ int emm_proc_detach_request(void *args)
** Others: T3421 ** ** Others: T3421 **
** ** ** **
***************************************************************************/ ***************************************************************************/
int emm_proc_detach_accept(void) int emm_proc_detach_accept(void* args)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
nas_user_t *user=args;
int rc; int rc;
LOG_TRACE(INFO, "EMM-PROC - UE initiated detach procedure completion"); LOG_TRACE(INFO, "EMM-PROC - UE initiated detach procedure completion");
...@@ -263,7 +265,7 @@ int emm_proc_detach_accept(void) ...@@ -263,7 +265,7 @@ int emm_proc_detach_accept(void)
esm_sap_t esm_sap; esm_sap_t esm_sap;
esm_sap.primitive = ESM_EPS_BEARER_CONTEXT_DEACTIVATE_REQ; esm_sap.primitive = ESM_EPS_BEARER_CONTEXT_DEACTIVATE_REQ;
esm_sap.data.eps_bearer_context_deactivate.ebi = ESM_SAP_ALL_EBI; esm_sap.data.eps_bearer_context_deactivate.ebi = ESM_SAP_ALL_EBI;
rc = esm_sap_send(&esm_sap); rc = esm_sap_send(user, &esm_sap);
/* /*
* XXX - Upon receiving notification from ESM that all EPS bearer * XXX - Upon receiving notification from ESM that all EPS bearer
...@@ -296,6 +298,7 @@ int emm_proc_detach_failure(int is_initial, void *args) ...@@ -296,6 +298,7 @@ int emm_proc_detach_failure(int is_initial, void *args)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
nas_user_t *user=args;
emm_sap_t emm_sap; emm_sap_t emm_sap;
int rc; int rc;
...@@ -312,7 +315,7 @@ int emm_proc_detach_failure(int is_initial, void *args) ...@@ -312,7 +315,7 @@ int emm_proc_detach_failure(int is_initial, void *args)
*/ */
emm_sap.primitive = EMMREG_DETACH_INIT; emm_sap.primitive = EMMREG_DETACH_INIT;
emm_sap.u.emm_reg.u.detach.switch_off = _emm_detach_data.switch_off; emm_sap.u.emm_reg.u.detach.switch_off = _emm_detach_data.switch_off;
rc = emm_sap_send(&emm_sap); rc = emm_sap_send(user, &emm_sap);
LOG_FUNC_RETURN(rc); LOG_FUNC_RETURN(rc);
} }
...@@ -342,8 +345,9 @@ int emm_proc_detach_release(void *args) ...@@ -342,8 +345,9 @@ int emm_proc_detach_release(void *args)
LOG_TRACE(WARNING, "EMM-PROC - NAS signalling connection released"); LOG_TRACE(WARNING, "EMM-PROC - NAS signalling connection released");
nas_user_t *user=args;
/* Abort the detach procedure */ /* Abort the detach procedure */
int rc = _emm_detach_abort(_emm_detach_data.type); int rc = _emm_detach_abort(user, _emm_detach_data.type);
LOG_FUNC_RETURN(rc); LOG_FUNC_RETURN(rc);
} }
...@@ -383,6 +387,7 @@ void *_emm_detach_t3421_handler(void *args) ...@@ -383,6 +387,7 @@ void *_emm_detach_t3421_handler(void *args)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
nas_user_t *user=args;
int rc; int rc;
/* Increment the retransmission counter */ /* Increment the retransmission counter */
...@@ -419,17 +424,17 @@ void *_emm_detach_t3421_handler(void *args) ...@@ -419,17 +424,17 @@ void *_emm_detach_t3421_handler(void *args)
* be sent to the network * be sent to the network
*/ */
emm_sap.primitive = EMMAS_DATA_REQ; emm_sap.primitive = EMMAS_DATA_REQ;
rc = emm_sap_send(&emm_sap); rc = emm_sap_send(user, &emm_sap);
if (rc != RETURNerror) { if (rc != RETURNerror) {
/* Start T3421 timer */ /* Start T3421 timer */
T3421.id = nas_timer_start(T3421.sec, _emm_detach_t3421_handler, NULL); T3421.id = nas_timer_start(T3421.sec, _emm_detach_t3421_handler, user);
LOG_TRACE(INFO, "EMM-PROC - Timer T3421 (%d) expires in %ld " LOG_TRACE(INFO, "EMM-PROC - Timer T3421 (%d) expires in %ld "
"seconds", T3421.id, T3421.sec); "seconds", T3421.id, T3421.sec);
} }
} else { } else {
/* Abort the detach procedure */ /* Abort the detach procedure */
rc = _emm_detach_abort(_emm_detach_data.type); rc = _emm_detach_abort(user, _emm_detach_data.type);
} }
LOG_FUNC_RETURN(NULL); LOG_FUNC_RETURN(NULL);
...@@ -455,7 +460,7 @@ void *_emm_detach_t3421_handler(void *args) ...@@ -455,7 +460,7 @@ void *_emm_detach_t3421_handler(void *args)
** Others: T3421 ** ** Others: T3421 **
** ** ** **
***************************************************************************/ ***************************************************************************/
static int _emm_detach_abort(emm_proc_detach_type_t type) static int _emm_detach_abort(nas_user_t *user, emm_proc_detach_type_t type)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
...@@ -475,7 +480,7 @@ static int _emm_detach_abort(emm_proc_detach_type_t type) ...@@ -475,7 +480,7 @@ static int _emm_detach_abort(emm_proc_detach_type_t type)
*/ */
emm_sap.primitive = EMMREG_DETACH_FAILED; emm_sap.primitive = EMMREG_DETACH_FAILED;
emm_sap.u.emm_reg.u.detach.type = type; emm_sap.u.emm_reg.u.detach.type = type;
rc = emm_sap_send(&emm_sap); rc = emm_sap_send(user, &emm_sap);
LOG_FUNC_RETURN (rc); LOG_FUNC_RETURN (rc);
} }
...@@ -115,7 +115,7 @@ int emm_proc_status_ind(unsigned int ueid, int emm_cause) ...@@ -115,7 +115,7 @@ int emm_proc_status_ind(unsigned int ueid, int emm_cause)
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
int emm_proc_status(unsigned int ueid, int emm_cause) int emm_proc_status(nas_user_t *user, unsigned int ueid, int emm_cause)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
...@@ -140,7 +140,7 @@ int emm_proc_status(unsigned int ueid, int emm_cause) ...@@ -140,7 +140,7 @@ int emm_proc_status(unsigned int ueid, int emm_cause)
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);
rc = emm_sap_send(&emm_sap); rc = emm_sap_send(user, &emm_sap);
LOG_FUNC_RETURN (rc); LOG_FUNC_RETURN (rc);
} }
......
...@@ -49,6 +49,7 @@ Description Defines the identification EMM procedure executed by the ...@@ -49,6 +49,7 @@ Description Defines the identification EMM procedure executed by the
#include "emm_sap.h" #include "emm_sap.h"
#include "msc.h" #include "msc.h"
#include "user_defs.h"
#include <stdlib.h> // malloc, free #include <stdlib.h> // malloc, free
#include <string.h> // memcpy #include <string.h> // memcpy
...@@ -102,7 +103,7 @@ static const char *_emm_identity_type_str[] = { ...@@ -102,7 +103,7 @@ static const char *_emm_identity_type_str[] = {
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
int emm_proc_identification_request(emm_proc_identity_type_t type) int emm_proc_identification_request(nas_user_t *user, emm_proc_identity_type_t type)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
...@@ -199,7 +200,7 @@ int emm_proc_identification_request(emm_proc_identity_type_t type) ...@@ -199,7 +200,7 @@ int emm_proc_identification_request(emm_proc_identity_type_t type)
/* 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); _emm_data.security, FALSE, TRUE);
rc = emm_sap_send(&emm_sap); rc = emm_sap_send(user, &emm_sap);
LOG_FUNC_RETURN (rc); LOG_FUNC_RETURN (rc);
} }
......
...@@ -78,8 +78,8 @@ Description Defines EMM procedures executed by the Non-Access Stratum ...@@ -78,8 +78,8 @@ Description Defines EMM procedures executed by the Non-Access Stratum
/****************************************************************************/ /****************************************************************************/
static int _IdleMode_plmn_str(char *plmn_str, const plmn_t *plmn); static int _IdleMode_plmn_str(char *plmn_str, const plmn_t *plmn);
static int _IldlMode_get_opnn_id(const plmn_t *plmn); static int _IldlMode_get_opnn_id(nas_user_t *user, const plmn_t *plmn);
static int _IdleMode_get_suitable_cell(int index); static int _IdleMode_get_suitable_cell(nas_user_t *user, int index);
/* /*
* A list of PLMN identities in priority order is maintained locally * A list of PLMN identities in priority order is maintained locally
...@@ -152,7 +152,7 @@ static IdleMode_callback_t _emm_indication_notify; ...@@ -152,7 +152,7 @@ static IdleMode_callback_t _emm_indication_notify;
** Others: _emm_plmn_list, _emm_indication_notify ** ** Others: _emm_plmn_list, _emm_indication_notify **
** ** ** **
***************************************************************************/ ***************************************************************************/
void IdleMode_initialize(IdleMode_callback_t cb) void IdleMode_initialize(nas_user_t *user, IdleMode_callback_t cb)
{ {
/* Initialize the list of available PLMNs */ /* Initialize the list of available PLMNs */
_emm_plmn_list.n_plmns = 0; _emm_plmn_list.n_plmns = 0;
...@@ -166,7 +166,7 @@ void IdleMode_initialize(IdleMode_callback_t cb) ...@@ -166,7 +166,7 @@ void IdleMode_initialize(IdleMode_callback_t cb)
_emm_indication_notify = *cb; _emm_indication_notify = *cb;
/* Initialize EMM Service Access Point */ /* Initialize EMM Service Access Point */
emm_sap_initialize(); emm_sap_initialize(user);
} }
/* /*
...@@ -510,7 +510,7 @@ int IdleMode_get_plmn_id_index(const char *plmn) ...@@ -510,7 +510,7 @@ int IdleMode_get_plmn_id_index(const char *plmn)
** Others: _emm_plmn_list ** ** Others: _emm_plmn_list **
** ** ** **
***************************************************************************/ ***************************************************************************/
int emm_proc_initialize(void) int emm_proc_initialize(nas_user_t *user)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
...@@ -576,7 +576,7 @@ int emm_proc_initialize(void) ...@@ -576,7 +576,7 @@ int emm_proc_initialize(void)
/* Initialize the PLMNs' parameters */ /* Initialize the PLMNs' parameters */
for (i=0; i < _emm_plmn_list.n_plmns; i++) { for (i=0; i < _emm_plmn_list.n_plmns; i++) {
struct plmn_param_t *plmn = &(_emm_plmn_list.param[i]); struct plmn_param_t *plmn = &(_emm_plmn_list.param[i]);
int id = _IldlMode_get_opnn_id(_emm_plmn_list.plmn[i]); int id = _IldlMode_get_opnn_id(user, _emm_plmn_list.plmn[i]);
if (id < 0) { if (id < 0) {
plmn->fullname[0] = '\0'; plmn->fullname[0] = '\0';
...@@ -603,7 +603,7 @@ int emm_proc_initialize(void) ...@@ -603,7 +603,7 @@ int emm_proc_initialize(void)
emm_sap.u.emm_reg.u.regist.index = 0; emm_sap.u.emm_reg.u.regist.index = 0;
} }
rc = emm_sap_send(&emm_sap); rc = emm_sap_send(user, &emm_sap);
LOG_FUNC_RETURN(rc); LOG_FUNC_RETURN(rc);
...@@ -634,7 +634,7 @@ int emm_proc_initialize(void) ...@@ -634,7 +634,7 @@ int emm_proc_initialize(void)
** Others: _emm_plmn_list.index ** ** Others: _emm_plmn_list.index **
** ** ** **
***************************************************************************/ ***************************************************************************/
int emm_proc_plmn_selection(int index) int emm_proc_plmn_selection(nas_user_t *user, int index)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
...@@ -679,7 +679,7 @@ int emm_proc_plmn_selection(int index) ...@@ -679,7 +679,7 @@ int emm_proc_plmn_selection(int index)
* automatic mode. * automatic mode.
*/ */
_emm_plmn_list.index = index; _emm_plmn_list.index = index;
rc = _IdleMode_get_suitable_cell(index); rc = _IdleMode_get_suitable_cell(user, index);
} }
LOG_FUNC_RETURN (rc); LOG_FUNC_RETURN (rc);
...@@ -721,7 +721,7 @@ int emm_proc_plmn_selection(int index) ...@@ -721,7 +721,7 @@ int emm_proc_plmn_selection(int index)
** Others: _emm_plmn_list, _emm_data ** ** Others: _emm_plmn_list, _emm_data **
** ** ** **
***************************************************************************/ ***************************************************************************/
int emm_proc_plmn_selection_end(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)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
...@@ -890,7 +890,7 @@ int emm_proc_plmn_selection_end(int found, tac_t tac, ci_t ci, AcT_t rat) ...@@ -890,7 +890,7 @@ int emm_proc_plmn_selection_end(int found, tac_t tac, ci_t ci, AcT_t rat)
if (index < last_plmn_index) { if (index < last_plmn_index) {
/* Try to select the next PLMN in the list of available PLMNs */ /* Try to select the next PLMN in the list of available PLMNs */
_emm_plmn_list.index = index; _emm_plmn_list.index = index;
rc = emm_proc_plmn_selection(index); rc = emm_proc_plmn_selection(user, index);
} else { } else {
/* No suitable cell of any PLMN within the ordered list /* No suitable cell of any PLMN within the ordered list
* of available PLMNs has been found */ * of available PLMNs has been found */
...@@ -932,7 +932,7 @@ int emm_proc_plmn_selection_end(int found, tac_t tac, ci_t ci, AcT_t rat) ...@@ -932,7 +932,7 @@ int emm_proc_plmn_selection_end(int found, tac_t tac, ci_t ci, AcT_t rat)
/* /*
* Notify EMM that PLMN selection procedure has completed * Notify EMM that PLMN selection procedure has completed
*/ */
rc = emm_sap_send(&emm_sap); rc = emm_sap_send(user, &emm_sap);
if (_emm_plmn_list.splmn != -1) { if (_emm_plmn_list.splmn != -1) {
if (_emm_plmn_list.splmn == _emm_plmn_list.rplmn) { if (_emm_plmn_list.splmn == _emm_plmn_list.rplmn) {
...@@ -950,7 +950,7 @@ int emm_proc_plmn_selection_end(int found, tac_t tac, ci_t ci, AcT_t rat) ...@@ -950,7 +950,7 @@ int emm_proc_plmn_selection_end(int found, tac_t tac, ci_t ci, AcT_t rat)
* to register the presence of the UE to the selected PLMN * to register the presence of the UE to the selected PLMN
*/ */
emm_sap.primitive = EMMREG_ATTACH_INIT; emm_sap.primitive = EMMREG_ATTACH_INIT;
rc = emm_sap_send(&emm_sap); rc = emm_sap_send(user, &emm_sap);
} }
} }
...@@ -1135,7 +1135,7 @@ static int _IdleMode_plmn_str(char *plmn_str, const plmn_t *plmn) ...@@ -1135,7 +1135,7 @@ static int _IdleMode_plmn_str(char *plmn_str, const plmn_t *plmn)
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
static int _IldlMode_get_opnn_id(const plmn_t *plmn) static int _IldlMode_get_opnn_id(nas_user_t *user, const plmn_t *plmn)
{ {
int i; int i;
...@@ -1188,7 +1188,7 @@ static int _IldlMode_get_opnn_id(const plmn_t *plmn) ...@@ -1188,7 +1188,7 @@ static int _IldlMode_get_opnn_id(const plmn_t *plmn)
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
static int _IdleMode_get_suitable_cell(int index) static int _IdleMode_get_suitable_cell(nas_user_t *user, int index)
{ {
emm_sap_t emm_sap; emm_sap_t emm_sap;
const plmn_t *plmn = _emm_plmn_list.plmn[index]; const plmn_t *plmn = _emm_plmn_list.plmn[index];
...@@ -1212,6 +1212,6 @@ static int _IdleMode_get_suitable_cell(int index) ...@@ -1212,6 +1212,6 @@ static int _IdleMode_get_suitable_cell(int index)
emm_sap.u.emm_as.u.cell_info.rat = NET_ACCESS_UNAVAILABLE; emm_sap.u.emm_as.u.cell_info.rat = NET_ACCESS_UNAVAILABLE;
} }
return emm_sap_send(&emm_sap); return emm_sap_send(user, &emm_sap);
} }
...@@ -41,6 +41,7 @@ Description Defines the functions used to get information from the list ...@@ -41,6 +41,7 @@ Description Defines the functions used to get information from the list
#define __IDLEMODE_H__ #define __IDLEMODE_H__
#include "commonDef.h" #include "commonDef.h"
#include "user_defs.h"
/****************************************************************************/ /****************************************************************************/
/********************* G L O B A L C O N S T A N T S *******************/ /********************* G L O B A L C O N S T A N T S *******************/
...@@ -60,7 +61,7 @@ typedef int (*IdleMode_callback_t) (int); ...@@ -60,7 +61,7 @@ typedef int (*IdleMode_callback_t) (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 ******************/
/****************************************************************************/ /****************************************************************************/
void IdleMode_initialize(IdleMode_callback_t cb); void IdleMode_initialize(nas_user_t *user, IdleMode_callback_t cb);
int IdleMode_get_nb_plmns(void); int IdleMode_get_nb_plmns(void);
int IdleMode_get_hplmn_index(void); int IdleMode_get_hplmn_index(void);
......
...@@ -96,7 +96,7 @@ static struct { ...@@ -96,7 +96,7 @@ static struct {
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
int lowerlayer_success(unsigned int ueid) int lowerlayer_success(nas_user_t *user, unsigned int ueid)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
...@@ -105,7 +105,7 @@ int lowerlayer_success(unsigned int ueid) ...@@ -105,7 +105,7 @@ int lowerlayer_success(unsigned int ueid)
emm_sap.primitive = EMMREG_LOWERLAYER_SUCCESS; emm_sap.primitive = EMMREG_LOWERLAYER_SUCCESS;
emm_sap.u.emm_reg.ueid = ueid; emm_sap.u.emm_reg.ueid = ueid;
rc = emm_sap_send(&emm_sap); rc = emm_sap_send(user, &emm_sap);
LOG_FUNC_RETURN (rc); LOG_FUNC_RETURN (rc);
} }
...@@ -125,7 +125,7 @@ int lowerlayer_success(unsigned int ueid) ...@@ -125,7 +125,7 @@ int lowerlayer_success(unsigned int ueid)
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
int lowerlayer_failure(unsigned int ueid) int lowerlayer_failure(nas_user_t *user, unsigned int ueid)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
...@@ -134,7 +134,7 @@ int lowerlayer_failure(unsigned int ueid) ...@@ -134,7 +134,7 @@ int lowerlayer_failure(unsigned int ueid)
emm_sap.primitive = EMMREG_LOWERLAYER_FAILURE; emm_sap.primitive = EMMREG_LOWERLAYER_FAILURE;
emm_sap.u.emm_reg.ueid = ueid; emm_sap.u.emm_reg.ueid = ueid;
rc = emm_sap_send(&emm_sap); rc = emm_sap_send(user, &emm_sap);
LOG_FUNC_RETURN (rc); LOG_FUNC_RETURN (rc);
} }
...@@ -155,7 +155,7 @@ int lowerlayer_failure(unsigned int ueid) ...@@ -155,7 +155,7 @@ int lowerlayer_failure(unsigned int ueid)
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
int lowerlayer_establish(void) int lowerlayer_establish(nas_user_t *user)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
...@@ -180,7 +180,7 @@ int lowerlayer_establish(void) ...@@ -180,7 +180,7 @@ int lowerlayer_establish(void)
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
int lowerlayer_release(int cause) int lowerlayer_release(nas_user_t *user, int cause)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
...@@ -192,7 +192,7 @@ int lowerlayer_release(int cause) ...@@ -192,7 +192,7 @@ int lowerlayer_release(int cause)
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;
rc = emm_sap_send(&emm_sap); rc = emm_sap_send(user, &emm_sap);
LOG_FUNC_RETURN (rc); LOG_FUNC_RETURN (rc);
} }
...@@ -213,7 +213,7 @@ int lowerlayer_release(int cause) ...@@ -213,7 +213,7 @@ int lowerlayer_release(int cause)
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
int lowerlayer_data_ind(unsigned int ueid, const OctetString *data) int lowerlayer_data_ind(nas_user_t *user, unsigned int ueid, const OctetString *data)
{ {
esm_sap_t esm_sap; esm_sap_t esm_sap;
int rc; int rc;
...@@ -226,7 +226,7 @@ int lowerlayer_data_ind(unsigned int ueid, const OctetString *data) ...@@ -226,7 +226,7 @@ int lowerlayer_data_ind(unsigned int ueid, const OctetString *data)
esm_sap.ueid = ueid; esm_sap.ueid = ueid;
esm_sap.recv = data; esm_sap.recv = data;
rc = esm_sap_send(&esm_sap); rc = esm_sap_send(user, &esm_sap);
LOG_FUNC_RETURN (rc); LOG_FUNC_RETURN (rc);
} }
...@@ -247,7 +247,7 @@ int lowerlayer_data_ind(unsigned int ueid, const OctetString *data) ...@@ -247,7 +247,7 @@ int lowerlayer_data_ind(unsigned int ueid, const OctetString *data)
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
int lowerlayer_data_req(unsigned int ueid, const OctetString *data) int lowerlayer_data_req(nas_user_t *user, unsigned int ueid, const OctetString *data)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
...@@ -266,7 +266,7 @@ int lowerlayer_data_req(unsigned int ueid, const OctetString *data) ...@@ -266,7 +266,7 @@ int lowerlayer_data_req(unsigned int ueid, const OctetString *data)
emm_sap.u.emm_as.u.data.NASmsg.value = data->value; emm_sap.u.emm_as.u.data.NASmsg.value = data->value;
/* Setup EPS NAS security data */ /* Setup EPS NAS security data */
emm_as_set_security_data(&emm_sap.u.emm_as.u.data.sctx, sctx, FALSE, TRUE); emm_as_set_security_data(&emm_sap.u.emm_as.u.data.sctx, sctx, FALSE, TRUE);
rc = emm_sap_send(&emm_sap); rc = emm_sap_send(user, &emm_sap);
LOG_FUNC_RETURN (rc); LOG_FUNC_RETURN (rc);
} }
......
...@@ -43,6 +43,7 @@ Description Defines EMM procedures executed by the Non-Access Stratum ...@@ -43,6 +43,7 @@ Description Defines EMM procedures executed by the Non-Access Stratum
#define __LOWERLAYER_H__ #define __LOWERLAYER_H__
#include "OctetString.h" #include "OctetString.h"
#include "user_defs.h"
/****************************************************************************/ /****************************************************************************/
/********************* G L O B A L C O N S T A N T S *******************/ /********************* G L O B A L C O N S T A N T S *******************/
...@@ -78,12 +79,13 @@ typedef int (*lowerlayer_release_callback_t)(void *); ...@@ -78,12 +79,13 @@ typedef int (*lowerlayer_release_callback_t)(void *);
/****************** 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 ******************/
/****************************************************************************/ /****************************************************************************/
int lowerlayer_success(unsigned int ueid); // FIXME prototype with ueid
int lowerlayer_failure(unsigned int ueid); int lowerlayer_success(nas_user_t *user, unsigned int ueid);
int lowerlayer_establish(void); int lowerlayer_failure(nas_user_t *user, unsigned int ueid);
int lowerlayer_release(int cause); int lowerlayer_establish(nas_user_t *user);
int lowerlayer_release(nas_user_t *user, int cause);
int lowerlayer_data_ind(unsigned int ueid, const OctetString *data); int lowerlayer_data_ind(nas_user_t *user, unsigned int ueid, const OctetString *data);
int lowerlayer_data_req(unsigned int ueid, const OctetString *data); int lowerlayer_data_req(nas_user_t *user, unsigned int ueid, const OctetString *data);
#endif /* __LOWERLAYER_H__*/ #endif /* __LOWERLAYER_H__*/
...@@ -86,7 +86,7 @@ Description Implements the EPS Mobility Management procedures executed ...@@ -86,7 +86,7 @@ Description Implements the EPS Mobility Management procedures executed
** Others: emm_fsm_status ** ** Others: emm_fsm_status **
** ** ** **
***************************************************************************/ ***************************************************************************/
int EmmDeregistered(const emm_reg_t *evt) int EmmDeregistered(nas_user_t *user, const emm_reg_t *evt)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
...@@ -149,7 +149,7 @@ int EmmDeregistered(const emm_reg_t *evt) ...@@ -149,7 +149,7 @@ int EmmDeregistered(const emm_reg_t *evt)
if (rc != RETURNerror) { if (rc != RETURNerror) {
/* Restart the attach procedure */ /* Restart the attach procedure */
rc = emm_proc_attach_restart(); rc = emm_proc_attach_restart(user);
} }
break; break;
......
...@@ -79,7 +79,7 @@ Description Implements the EPS Mobility Management procedures executed ...@@ -79,7 +79,7 @@ Description Implements the EPS Mobility Management procedures executed
** Others: emm_fsm_status ** ** Others: emm_fsm_status **
** ** ** **
***************************************************************************/ ***************************************************************************/
int EmmDeregisteredAttemptingToAttach(const emm_reg_t *evt) int EmmDeregisteredAttemptingToAttach(nas_user_t *user, const emm_reg_t *evt)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
...@@ -104,7 +104,7 @@ int EmmDeregisteredAttemptingToAttach(const emm_reg_t *evt) ...@@ -104,7 +104,7 @@ int EmmDeregisteredAttemptingToAttach(const emm_reg_t *evt)
if (rc != RETURNerror) { if (rc != RETURNerror) {
/* Restart the attach procedure */ /* Restart the attach procedure */
rc = emm_proc_attach_restart(); rc = emm_proc_attach_restart(user);
} }
break; break;
......
...@@ -83,7 +83,7 @@ Description Implements the EPS Mobility Management procedures executed ...@@ -83,7 +83,7 @@ Description Implements the EPS Mobility Management procedures executed
** Others: emm_fsm_status ** ** Others: emm_fsm_status **
** ** ** **
***************************************************************************/ ***************************************************************************/
int EmmDeregisteredLimitedService(const emm_reg_t *evt) int EmmDeregisteredLimitedService(nas_user_t *user, const emm_reg_t *evt)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
...@@ -109,7 +109,7 @@ int EmmDeregisteredLimitedService(const emm_reg_t *evt) ...@@ -109,7 +109,7 @@ int EmmDeregisteredLimitedService(const emm_reg_t *evt)
/* /*
* Initiate attach procedure for emergency bearer services * Initiate attach procedure for emergency bearer services
*/ */
rc = emm_proc_attach(EMM_ATTACH_TYPE_EMERGENCY); rc = emm_proc_attach(user, EMM_ATTACH_TYPE_EMERGENCY);
break; break;
case _EMMREG_ATTACH_REQ: case _EMMREG_ATTACH_REQ:
......
...@@ -84,7 +84,7 @@ Description Implements the EPS Mobility Management procedures executed ...@@ -84,7 +84,7 @@ Description Implements the EPS Mobility Management procedures executed
** Others: emm_fsm_status ** ** Others: emm_fsm_status **
** ** ** **
***************************************************************************/ ***************************************************************************/
int EmmDeregisteredNoCellAvailable(const emm_reg_t *evt) int EmmDeregisteredNoCellAvailable(nas_user_t *user, const emm_reg_t *evt)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
...@@ -118,7 +118,7 @@ int EmmDeregisteredNoCellAvailable(const emm_reg_t *evt) ...@@ -118,7 +118,7 @@ int EmmDeregisteredNoCellAvailable(const emm_reg_t *evt)
/* /*
* Perform network re-selection procedure * Perform network re-selection procedure
*/ */
rc = emm_proc_plmn_selection(evt->u.regist.index); rc = emm_proc_plmn_selection(user, evt->u.regist.index);
} }
break; break;
......
...@@ -84,7 +84,7 @@ extern uint8_t usim_test; ...@@ -84,7 +84,7 @@ extern uint8_t usim_test;
** Others: emm_fsm_status ** ** Others: emm_fsm_status **
** ** ** **
***************************************************************************/ ***************************************************************************/
int EmmDeregisteredNormalService(const emm_reg_t *evt) int EmmDeregisteredNormalService(nas_user_t *user, const emm_reg_t *evt)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
...@@ -112,11 +112,11 @@ int EmmDeregisteredNormalService(const emm_reg_t *evt) ...@@ -112,11 +112,11 @@ int EmmDeregisteredNormalService(const emm_reg_t *evt)
*/ */
if(usim_test == 0) if(usim_test == 0)
{ {
rc = emm_proc_attach(EMM_ATTACH_TYPE_EPS); rc = emm_proc_attach(user, EMM_ATTACH_TYPE_EPS);
} }
else else
{ {
rc = emm_proc_attach(EMM_ATTACH_TYPE_IMSI); // CMW500 IMSI initial attach expected rc = emm_proc_attach(user, EMM_ATTACH_TYPE_IMSI); // CMW500 IMSI initial attach expected
} }
break; break;
......
...@@ -82,7 +82,7 @@ Description Implements the EPS Mobility Management procedures executed ...@@ -82,7 +82,7 @@ Description Implements the EPS Mobility Management procedures executed
** Others: emm_fsm_status ** ** Others: emm_fsm_status **
** ** ** **
***************************************************************************/ ***************************************************************************/
int EmmDeregisteredPlmnSearch(const emm_reg_t *evt) int EmmDeregisteredPlmnSearch(nas_user_t *user, const emm_reg_t *evt)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
...@@ -122,7 +122,7 @@ int EmmDeregisteredPlmnSearch(const emm_reg_t *evt) ...@@ -122,7 +122,7 @@ int EmmDeregisteredPlmnSearch(const emm_reg_t *evt)
/* /*
* Perform network selection procedure * Perform network selection procedure
*/ */
rc = emm_proc_plmn_selection(evt->u.regist.index); rc = emm_proc_plmn_selection(user, evt->u.regist.index);
break; break;
case _EMMREG_REGISTER_REJ: case _EMMREG_REGISTER_REJ:
......
...@@ -76,7 +76,7 @@ Description Implements the EPS Mobility Management procedures executed ...@@ -76,7 +76,7 @@ Description Implements the EPS Mobility Management procedures executed
** Others: emm_fsm_status ** ** Others: emm_fsm_status **
** ** ** **
***************************************************************************/ ***************************************************************************/
int EmmNull(const emm_reg_t *evt) int EmmNull(nas_user_t *user, const emm_reg_t *evt)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
...@@ -104,7 +104,7 @@ int EmmNull(const emm_reg_t *evt) ...@@ -104,7 +104,7 @@ int EmmNull(const emm_reg_t *evt)
* establish an EMM context and make the UE reachable by an MME. * establish an EMM context and make the UE reachable by an MME.
*/ */
if (rc != RETURNerror) { if (rc != RETURNerror) {
rc = emm_proc_initialize(); rc = emm_proc_initialize(user);
} }
break; break;
......
...@@ -81,7 +81,7 @@ Description Implements the EPS Mobility Management procedures executed ...@@ -81,7 +81,7 @@ Description Implements the EPS Mobility Management procedures executed
** Others: emm_fsm_status ** ** Others: emm_fsm_status **
** ** ** **
***************************************************************************/ ***************************************************************************/
int EmmRegistered(const emm_reg_t *evt) int EmmRegistered(nas_user_t *user, const emm_reg_t *evt)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
...@@ -96,7 +96,7 @@ int EmmRegistered(const emm_reg_t *evt) ...@@ -96,7 +96,7 @@ int EmmRegistered(const emm_reg_t *evt)
/* /*
* Initiate detach procedure for EPS services * Initiate detach procedure for EPS services
*/ */
rc = emm_proc_detach(EMM_DETACH_TYPE_EPS, evt->u.detach.switch_off); rc = emm_proc_detach(user, EMM_DETACH_TYPE_EPS, evt->u.detach.switch_off);
break; break;
case _EMMREG_DETACH_REQ: case _EMMREG_DETACH_REQ:
......
...@@ -78,7 +78,7 @@ Description Implements the EPS Mobility Management procedures executed ...@@ -78,7 +78,7 @@ Description Implements the EPS Mobility Management procedures executed
** Others: emm_fsm_status ** ** Others: emm_fsm_status **
** ** ** **
***************************************************************************/ ***************************************************************************/
int EmmRegisteredInitiated(const emm_reg_t *evt) int EmmRegisteredInitiated(nas_user_t *user, const emm_reg_t *evt)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
...@@ -103,7 +103,7 @@ int EmmRegisteredInitiated(const emm_reg_t *evt) ...@@ -103,7 +103,7 @@ int EmmRegisteredInitiated(const emm_reg_t *evt)
if (rc != RETURNerror) { if (rc != RETURNerror) {
/* Restart the attach procedure */ /* Restart the attach procedure */
rc = emm_proc_attach_restart(); rc = emm_proc_attach_restart(user);
} }
break; break;
...@@ -209,7 +209,7 @@ int EmmRegisteredInitiated(const emm_reg_t *evt) ...@@ -209,7 +209,7 @@ int EmmRegisteredInitiated(const emm_reg_t *evt)
/* /*
* Initiate detach procedure for EPS services * Initiate detach procedure for EPS services
*/ */
rc = emm_proc_detach(EMM_DETACH_TYPE_EPS, evt->u.detach.switch_off); rc = emm_proc_detach(user, EMM_DETACH_TYPE_EPS, evt->u.detach.switch_off);
break; break;
case _EMMREG_DETACH_REQ: case _EMMREG_DETACH_REQ:
......
...@@ -99,19 +99,19 @@ static const char *_emm_as_primitive_str[] = { ...@@ -99,19 +99,19 @@ static const char *_emm_as_primitive_str[] = {
* Functions executed to process EMM procedures upon receiving * Functions executed to process EMM procedures upon receiving
* data from the network * data from the network
*/ */
static int _emm_as_recv(unsigned int ueid, const char *msg, int len, static int _emm_as_recv(nas_user_t *user, unsigned int ueid, const char *msg, int len,
int *emm_cause); int *emm_cause);
static int _emm_as_establish_cnf(const emm_as_establish_t *msg, int *emm_cause); static int _emm_as_establish_cnf(nas_user_t *user, const emm_as_establish_t *msg, int *emm_cause);
static int _emm_as_establish_rej(void); static int _emm_as_establish_rej(nas_user_t *user);
static int _emm_as_release_ind(const emm_as_release_t *msg); static int _emm_as_release_ind(nas_user_t *user, const emm_as_release_t *msg);
static int _emm_as_page_ind(const emm_as_page_t *msg); static int _emm_as_page_ind(const emm_as_page_t *msg);
static int _emm_as_cell_info_res(const emm_as_cell_info_t *msg); static int _emm_as_cell_info_res(const emm_as_cell_info_t *msg);
static int _emm_as_cell_info_ind(const emm_as_cell_info_t *msg); static int _emm_as_cell_info_ind(const emm_as_cell_info_t *msg);
static int _emm_as_data_ind(const emm_as_data_t *msg, int *emm_cause); static int _emm_as_data_ind(nas_user_t *user, const emm_as_data_t *msg, int *emm_cause);
/* /*
* Functions executed to send data to the network when requested * Functions executed to send data to the network when requested
...@@ -133,7 +133,7 @@ static int _emm_as_encrypt( ...@@ -133,7 +133,7 @@ static int _emm_as_encrypt(
int length, int length,
emm_security_context_t *emm_security_context); emm_security_context_t *emm_security_context);
static int _emm_as_send(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_as_security_t *,
ul_info_transfer_req_t *); ul_info_transfer_req_t *);
...@@ -143,7 +143,7 @@ static int _emm_as_establish_req(const emm_as_establish_t *, ...@@ -143,7 +143,7 @@ static int _emm_as_establish_req(const emm_as_establish_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 *, ul_info_transfer_req_t *); static int _emm_as_data_req(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_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 *);
...@@ -165,7 +165,7 @@ static int _emm_as_release_req(const emm_as_release_t *, nas_release_req_t *); ...@@ -165,7 +165,7 @@ static int _emm_as_release_req(const emm_as_release_t *, nas_release_req_t *);
** Others: NONE ** ** Others: NONE **
** ** ** **
***************************************************************************/ ***************************************************************************/
void emm_as_initialize(void) void emm_as_initialize(nas_user_t *user)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
...@@ -188,7 +188,7 @@ void emm_as_initialize(void) ...@@ -188,7 +188,7 @@ void emm_as_initialize(void)
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
int emm_as_send(const emm_as_t *msg) int emm_as_send(nas_user_t *user, const emm_as_t *msg)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
...@@ -203,21 +203,21 @@ int emm_as_send(const emm_as_t *msg) ...@@ -203,21 +203,21 @@ int emm_as_send(const emm_as_t *msg)
switch (primitive) { switch (primitive) {
case _EMMAS_DATA_IND: case _EMMAS_DATA_IND:
rc = _emm_as_data_ind(&msg->u.data, &emm_cause); rc = _emm_as_data_ind(user, &msg->u.data, &emm_cause);
ueid = msg->u.data.ueid; ueid = msg->u.data.ueid;
break; break;
case _EMMAS_ESTABLISH_CNF: case _EMMAS_ESTABLISH_CNF:
rc = _emm_as_establish_cnf(&msg->u.establish, &emm_cause); rc = _emm_as_establish_cnf(user, &msg->u.establish, &emm_cause);
break; break;
case _EMMAS_ESTABLISH_REJ: case _EMMAS_ESTABLISH_REJ:
rc = _emm_as_establish_rej(); rc = _emm_as_establish_rej(user);
break; break;
case _EMMAS_RELEASE_IND: case _EMMAS_RELEASE_IND:
rc = _emm_as_release_ind(&msg->u.release); rc = _emm_as_release_ind(user, &msg->u.release);
break; break;
case _EMMAS_PAGE_IND: case _EMMAS_PAGE_IND:
...@@ -234,7 +234,7 @@ int emm_as_send(const emm_as_t *msg) ...@@ -234,7 +234,7 @@ int emm_as_send(const emm_as_t *msg)
default: default:
/* Other primitives are forwarded to the Access Stratum */ /* Other primitives are forwarded to the Access Stratum */
rc = _emm_as_send(msg); rc = _emm_as_send(user, msg);
if (rc != RETURNok) { if (rc != RETURNok) {
LOG_TRACE(ERROR, "EMMAS-SAP - " LOG_TRACE(ERROR, "EMMAS-SAP - "
...@@ -306,7 +306,7 @@ int emm_as_send(const emm_as_t *msg) ...@@ -306,7 +306,7 @@ int emm_as_send(const emm_as_t *msg)
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
static int _emm_as_recv(unsigned int ueid, const char *msg, int len, static int _emm_as_recv(nas_user_t *user, unsigned int ueid, const char *msg, int len,
int *emm_cause) int *emm_cause)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
...@@ -342,30 +342,30 @@ static int _emm_as_recv(unsigned int ueid, const char *msg, int len, ...@@ -342,30 +342,30 @@ static int _emm_as_recv(unsigned int ueid, const char *msg, int len,
break; break;
case IDENTITY_REQUEST: case IDENTITY_REQUEST:
rc = emm_recv_identity_request(&emm_msg->identity_request, rc = emm_recv_identity_request(user, &emm_msg->identity_request,
emm_cause); emm_cause);
break; break;
case AUTHENTICATION_REQUEST: case AUTHENTICATION_REQUEST:
rc = emm_recv_authentication_request( rc = emm_recv_authentication_request(user,
&emm_msg->authentication_request, &emm_msg->authentication_request,
emm_cause); emm_cause);
break; break;
case AUTHENTICATION_REJECT: case AUTHENTICATION_REJECT:
rc = emm_recv_authentication_reject( rc = emm_recv_authentication_reject(user,
&emm_msg->authentication_reject, &emm_msg->authentication_reject,
emm_cause); emm_cause);
break; break;
case SECURITY_MODE_COMMAND: case SECURITY_MODE_COMMAND:
rc = emm_recv_security_mode_command( rc = emm_recv_security_mode_command(user,
&emm_msg->security_mode_command, &emm_msg->security_mode_command,
emm_cause); emm_cause);
break; break;
case DETACH_ACCEPT: case DETACH_ACCEPT:
rc = emm_recv_detach_accept(&emm_msg->detach_accept, emm_cause); rc = emm_recv_detach_accept(user, &emm_msg->detach_accept, emm_cause);
break; break;
...@@ -406,7 +406,7 @@ static int _emm_as_recv(unsigned int ueid, const char *msg, int len, ...@@ -406,7 +406,7 @@ static int _emm_as_recv(unsigned int ueid, const char *msg, int len,
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
static int _emm_as_data_ind(const emm_as_data_t *msg, int *emm_cause) static int _emm_as_data_ind(nas_user_t *user, const emm_as_data_t *msg, int *emm_cause)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
...@@ -443,23 +443,23 @@ static int _emm_as_data_ind(const emm_as_data_t *msg, int *emm_cause) ...@@ -443,23 +443,23 @@ static int _emm_as_data_ind(const emm_as_data_t *msg, int *emm_cause)
} else if (header.protocol_discriminator == } else if (header.protocol_discriminator ==
EPS_MOBILITY_MANAGEMENT_MESSAGE) { EPS_MOBILITY_MANAGEMENT_MESSAGE) {
/* Process EMM data */ /* Process EMM data */
rc = _emm_as_recv(msg->ueid, plain_msg, bytes, emm_cause); rc = _emm_as_recv(user, msg->ueid, plain_msg, bytes, emm_cause);
} else if (header.protocol_discriminator == } else if (header.protocol_discriminator ==
EPS_SESSION_MANAGEMENT_MESSAGE) { EPS_SESSION_MANAGEMENT_MESSAGE) {
const OctetString data = {bytes, (uint8_t *)plain_msg}; const OctetString data = {bytes, (uint8_t *)plain_msg};
/* Foward ESM data to EPS session management */ /* Foward ESM data to EPS session management */
rc = lowerlayer_data_ind(msg->ueid, &data); rc = lowerlayer_data_ind(user, msg->ueid, &data);
} }
free(plain_msg); free(plain_msg);
} }
} else { } else {
/* Process successfull lower layer transfer indication */ /* Process successfull lower layer transfer indication */
rc = lowerlayer_success(msg->ueid); rc = lowerlayer_success(user, msg->ueid);
} }
} else { } else {
/* Process lower layer transmission failure of NAS message */ /* Process lower layer transmission failure of NAS message */
rc = lowerlayer_failure(msg->ueid); rc = lowerlayer_failure(user, msg->ueid);
} }
LOG_FUNC_RETURN (rc); LOG_FUNC_RETURN (rc);
...@@ -482,7 +482,7 @@ static int _emm_as_data_ind(const emm_as_data_t *msg, int *emm_cause) ...@@ -482,7 +482,7 @@ static int _emm_as_data_ind(const emm_as_data_t *msg, int *emm_cause)
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
static int _emm_as_establish_cnf(const emm_as_establish_t *msg, static int _emm_as_establish_cnf(nas_user_t *user, const emm_as_establish_t *msg,
int *emm_cause) int *emm_cause)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
...@@ -494,11 +494,11 @@ static int _emm_as_establish_cnf(const emm_as_establish_t *msg, ...@@ -494,11 +494,11 @@ static int _emm_as_establish_cnf(const emm_as_establish_t *msg,
if (msg->NASmsg.length > 0) { if (msg->NASmsg.length > 0) {
/* The NAS signalling connection is established */ /* The NAS signalling connection is established */
(void) lowerlayer_establish(); (void) lowerlayer_establish(user);
} else { } else {
/* The initial NAS message has been successfully delivered to /* The initial NAS message has been successfully delivered to
* lower layers */ * lower layers */
rc = lowerlayer_success(0); rc = lowerlayer_success(user, 0);
LOG_FUNC_RETURN (rc); LOG_FUNC_RETURN (rc);
} }
...@@ -523,11 +523,11 @@ static int _emm_as_establish_cnf(const emm_as_establish_t *msg, ...@@ -523,11 +523,11 @@ static int _emm_as_establish_cnf(const emm_as_establish_t *msg,
switch (emm_msg->header.message_type) { switch (emm_msg->header.message_type) {
case ATTACH_ACCEPT: case ATTACH_ACCEPT:
rc = emm_recv_attach_accept(&emm_msg->attach_accept, emm_cause); rc = emm_recv_attach_accept(user, &emm_msg->attach_accept, emm_cause);
break; break;
case ATTACH_REJECT: case ATTACH_REJECT:
rc = emm_recv_attach_reject(&emm_msg->attach_reject, emm_cause); rc = emm_recv_attach_reject(user, &emm_msg->attach_reject, emm_cause);
break; break;
case DETACH_ACCEPT: case DETACH_ACCEPT:
...@@ -563,7 +563,7 @@ static int _emm_as_establish_cnf(const emm_as_establish_t *msg, ...@@ -563,7 +563,7 @@ static int _emm_as_establish_cnf(const emm_as_establish_t *msg,
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
static int _emm_as_establish_rej(void) static int _emm_as_establish_rej(nas_user_t *user)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
...@@ -573,7 +573,7 @@ static int _emm_as_establish_rej(void) ...@@ -573,7 +573,7 @@ static int _emm_as_establish_rej(void)
"failure"); "failure");
/* Process lower layer transmission failure of initial NAS message */ /* Process lower layer transmission failure of initial NAS message */
rc = lowerlayer_failure(0); rc = lowerlayer_failure(user, 0);
LOG_FUNC_RETURN (rc); LOG_FUNC_RETURN (rc);
} }
...@@ -595,7 +595,7 @@ static int _emm_as_establish_rej(void) ...@@ -595,7 +595,7 @@ static int _emm_as_establish_rej(void)
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
static int _emm_as_release_ind(const emm_as_release_t *msg) static int _emm_as_release_ind(nas_user_t *user, const emm_as_release_t *msg)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
...@@ -605,7 +605,7 @@ static int _emm_as_release_ind(const emm_as_release_t *msg) ...@@ -605,7 +605,7 @@ static int _emm_as_release_ind(const emm_as_release_t *msg)
"(cause=%d)", msg->cause); "(cause=%d)", msg->cause);
/* Process NAS signalling connection release indication */ /* Process NAS signalling connection release indication */
rc = lowerlayer_release(msg->cause); rc = lowerlayer_release(user, msg->cause);
LOG_FUNC_RETURN (rc); LOG_FUNC_RETURN (rc);
} }
...@@ -928,7 +928,7 @@ _emm_as_encrypt( ...@@ -928,7 +928,7 @@ _emm_as_encrypt(
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
static int _emm_as_send(const emm_as_t *msg) static int _emm_as_send(const nas_user_t *user, const emm_as_t *msg)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
......
...@@ -41,6 +41,7 @@ Description Defines the EMMAS Service Access Point that provides ...@@ -41,6 +41,7 @@ Description Defines the EMMAS Service Access Point that provides
#define __EMM_AS_H__ #define __EMM_AS_H__
#include "emm_asDef.h" #include "emm_asDef.h"
#include "user_defs.h"
/****************************************************************************/ /****************************************************************************/
/********************* G L O B A L C O N S T A N T S *******************/ /********************* G L O B A L C O N S T A N T S *******************/
...@@ -58,8 +59,8 @@ Description Defines the EMMAS Service Access Point that provides ...@@ -58,8 +59,8 @@ Description Defines the EMMAS Service Access Point that provides
/****************** 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 ******************/
/****************************************************************************/ /****************************************************************************/
void emm_as_initialize(void); void emm_as_initialize(nas_user_t *user);
int emm_as_send(const emm_as_t *msg); int emm_as_send(nas_user_t *user, const emm_as_t *msg);
#endif /* __EMM_AS_H__*/ #endif /* __EMM_AS_H__*/
...@@ -108,7 +108,7 @@ void emm_esm_initialize(void) ...@@ -108,7 +108,7 @@ void emm_esm_initialize(void)
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
int emm_esm_send(const emm_esm_t *msg) int emm_esm_send(nas_user_t *user, const emm_esm_t *msg)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
...@@ -123,7 +123,7 @@ int emm_esm_send(const emm_esm_t *msg) ...@@ -123,7 +123,7 @@ int emm_esm_send(const emm_esm_t *msg)
case _EMMESM_ESTABLISH_REQ: case _EMMESM_ESTABLISH_REQ:
/* ESM requests EMM to initiate an attach procedure before /* ESM requests EMM to initiate an attach procedure before
* requesting subsequent connectivity to additional PDNs */ * requesting subsequent connectivity to additional PDNs */
rc = emm_proc_attach_restart(); rc = emm_proc_attach_restart(user);
break; break;
case _EMMESM_ESTABLISH_CNF: case _EMMESM_ESTABLISH_CNF:
...@@ -138,7 +138,7 @@ int emm_esm_send(const emm_esm_t *msg) ...@@ -138,7 +138,7 @@ int emm_esm_send(const emm_esm_t *msg)
} }
} else { } else {
/* Consider the UE locally detached from the network */ /* Consider the UE locally detached from the network */
rc = emm_proc_attach_set_detach(); rc = emm_proc_attach_set_detach(user);
} }
break; break;
...@@ -149,7 +149,7 @@ int emm_esm_send(const emm_esm_t *msg) ...@@ -149,7 +149,7 @@ int emm_esm_send(const emm_esm_t *msg)
case _EMMESM_UNITDATA_REQ: case _EMMESM_UNITDATA_REQ:
/* ESM requests EMM to transfer ESM data unit to lower layer */ /* ESM requests EMM to transfer ESM data unit to lower layer */
rc = lowerlayer_data_req(msg->ueid, &msg->u.data.msg); rc = lowerlayer_data_req(user, msg->ueid, &msg->u.data.msg);
break; break;
default: default:
......
...@@ -42,6 +42,7 @@ Description Defines the EMMESM Service Access Point that provides ...@@ -42,6 +42,7 @@ Description Defines the EMMESM Service Access Point that provides
#define __EMM_ESM_H__ #define __EMM_ESM_H__
#include "emm_esmDef.h" #include "emm_esmDef.h"
#include "user_defs.h"
/****************************************************************************/ /****************************************************************************/
/********************* G L O B A L C O N S T A N T S *******************/ /********************* G L O B A L C O N S T A N T S *******************/
...@@ -61,6 +62,6 @@ Description Defines the EMMESM Service Access Point that provides ...@@ -61,6 +62,6 @@ Description Defines the EMMESM Service Access Point that provides
void emm_esm_initialize(void); void emm_esm_initialize(void);
int emm_esm_send(const emm_esm_t *msg); int emm_esm_send(nas_user_t *user, const emm_esm_t *msg);
#endif /* __EMM_ESM_H__*/ #endif /* __EMM_ESM_H__*/
...@@ -125,7 +125,7 @@ int emm_recv_status(unsigned int ueid, emm_status_msg *msg, int *emm_cause) ...@@ -125,7 +125,7 @@ int emm_recv_status(unsigned int ueid, emm_status_msg *msg, int *emm_cause)
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
int emm_recv_attach_accept(attach_accept_msg *msg, int *emm_cause) int emm_recv_attach_accept(nas_user_t *user, attach_accept_msg *msg, int *emm_cause)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
...@@ -224,7 +224,7 @@ int emm_recv_attach_accept(attach_accept_msg *msg, int *emm_cause) ...@@ -224,7 +224,7 @@ int emm_recv_attach_accept(attach_accept_msg *msg, int *emm_cause)
} }
/* Execute attach procedure accepted by the network */ /* Execute attach procedure accepted by the network */
rc = emm_proc_attach_accept(T3412, T3402, T3423, n_tais, tai, pguti, rc = emm_proc_attach_accept(user, T3412, T3402, T3423, n_tais, tai, pguti,
n_eplmns, &eplmn, n_eplmns, &eplmn,
&msg->esmmessagecontainer.esmmessagecontainercontents); &msg->esmmessagecontainer.esmmessagecontainercontents);
...@@ -245,7 +245,7 @@ int emm_recv_attach_accept(attach_accept_msg *msg, int *emm_cause) ...@@ -245,7 +245,7 @@ int emm_recv_attach_accept(attach_accept_msg *msg, int *emm_cause)
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
int emm_recv_attach_reject(attach_reject_msg *msg, int *emm_cause) int emm_recv_attach_reject(nas_user_t *user, attach_reject_msg *msg, int *emm_cause)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
...@@ -275,11 +275,11 @@ int emm_recv_attach_reject(attach_reject_msg *msg, int *emm_cause) ...@@ -275,11 +275,11 @@ int emm_recv_attach_reject(attach_reject_msg *msg, int *emm_cause)
*/ */
if (msg->presencemask & ATTACH_REJECT_ESM_MESSAGE_CONTAINER_PRESENT) { if (msg->presencemask & ATTACH_REJECT_ESM_MESSAGE_CONTAINER_PRESENT) {
/* Execute attach procedure rejected by the network */ /* Execute attach procedure rejected by the network */
rc = emm_proc_attach_reject(msg->emmcause, rc = emm_proc_attach_reject(user, msg->emmcause,
&msg->esmmessagecontainer.esmmessagecontainercontents); &msg->esmmessagecontainer.esmmessagecontainercontents);
} else { } else {
/* Execute attach procedure rejected by the network */ /* Execute attach procedure rejected by the network */
rc = emm_proc_attach_reject(msg->emmcause, NULL); rc = emm_proc_attach_reject(user, msg->emmcause, NULL);
} }
LOG_FUNC_RETURN (rc); LOG_FUNC_RETURN (rc);
...@@ -299,7 +299,7 @@ int emm_recv_attach_reject(attach_reject_msg *msg, int *emm_cause) ...@@ -299,7 +299,7 @@ int emm_recv_attach_reject(attach_reject_msg *msg, int *emm_cause)
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
int emm_recv_detach_accept(detach_accept_msg *msg, int *emm_cause) int emm_recv_detach_accept(nas_user_t *user, detach_accept_msg *msg, int *emm_cause)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
...@@ -311,7 +311,7 @@ int emm_recv_detach_accept(detach_accept_msg *msg, int *emm_cause) ...@@ -311,7 +311,7 @@ int emm_recv_detach_accept(detach_accept_msg *msg, int *emm_cause)
* Message processing * Message processing
*/ */
/* Execute the UE initiated detach procedure completion by the UE */ /* Execute the UE initiated detach procedure completion by the UE */
rc = emm_proc_detach_accept(); rc = emm_proc_detach_accept(user);
LOG_FUNC_RETURN (rc); LOG_FUNC_RETURN (rc);
} }
...@@ -330,7 +330,7 @@ int emm_recv_detach_accept(detach_accept_msg *msg, int *emm_cause) ...@@ -330,7 +330,7 @@ int emm_recv_detach_accept(detach_accept_msg *msg, int *emm_cause)
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
int emm_recv_identity_request(identity_request_msg *msg, int *emm_cause) int emm_recv_identity_request(nas_user_t *user, identity_request_msg *msg, int *emm_cause)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
...@@ -358,7 +358,7 @@ int emm_recv_identity_request(identity_request_msg *msg, int *emm_cause) ...@@ -358,7 +358,7 @@ int emm_recv_identity_request(identity_request_msg *msg, int *emm_cause)
} }
/* Execute the identification procedure initiated by the network */ /* Execute the identification procedure initiated by the network */
rc = emm_proc_identification_request(type); rc = emm_proc_identification_request(user, type);
LOG_FUNC_RETURN (rc); LOG_FUNC_RETURN (rc);
} }
...@@ -377,7 +377,7 @@ int emm_recv_identity_request(identity_request_msg *msg, int *emm_cause) ...@@ -377,7 +377,7 @@ int emm_recv_identity_request(identity_request_msg *msg, int *emm_cause)
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
int emm_recv_authentication_request(authentication_request_msg *msg, int emm_recv_authentication_request(nas_user_t *user, authentication_request_msg *msg,
int *emm_cause) int *emm_cause)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
...@@ -404,7 +404,7 @@ int emm_recv_authentication_request(authentication_request_msg *msg, ...@@ -404,7 +404,7 @@ int emm_recv_authentication_request(authentication_request_msg *msg,
* Message processing * Message processing
*/ */
/* Execute the authentication procedure initiated by the network */ /* Execute the authentication procedure initiated by the network */
rc = emm_proc_authentication_request( rc = emm_proc_authentication_request(user,
msg->naskeysetidentifierasme.tsc != NAS_KEY_SET_IDENTIFIER_MAPPED, msg->naskeysetidentifierasme.tsc != NAS_KEY_SET_IDENTIFIER_MAPPED,
msg->naskeysetidentifierasme.naskeysetidentifier, msg->naskeysetidentifierasme.naskeysetidentifier,
&msg->authenticationparameterrand.rand, &msg->authenticationparameterrand.rand,
...@@ -427,7 +427,7 @@ int emm_recv_authentication_request(authentication_request_msg *msg, ...@@ -427,7 +427,7 @@ int emm_recv_authentication_request(authentication_request_msg *msg,
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
int emm_recv_authentication_reject(authentication_reject_msg *msg, int emm_recv_authentication_reject(nas_user_t *user, authentication_reject_msg *msg,
int *emm_cause) int *emm_cause)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
...@@ -440,7 +440,7 @@ int emm_recv_authentication_reject(authentication_reject_msg *msg, ...@@ -440,7 +440,7 @@ int emm_recv_authentication_reject(authentication_reject_msg *msg,
* Message processing * Message processing
*/ */
/* Execute the authentication procedure not accepted by the network */ /* Execute the authentication procedure not accepted by the network */
rc = emm_proc_authentication_reject(); rc = emm_proc_authentication_reject(user);
LOG_FUNC_RETURN (rc); LOG_FUNC_RETURN (rc);
} }
...@@ -459,7 +459,7 @@ int emm_recv_authentication_reject(authentication_reject_msg *msg, ...@@ -459,7 +459,7 @@ int emm_recv_authentication_reject(authentication_reject_msg *msg,
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
int emm_recv_security_mode_command(security_mode_command_msg *msg, int emm_recv_security_mode_command(nas_user_t *user, security_mode_command_msg *msg,
int *emm_cause) int *emm_cause)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
...@@ -473,7 +473,7 @@ int emm_recv_security_mode_command(security_mode_command_msg *msg, ...@@ -473,7 +473,7 @@ int emm_recv_security_mode_command(security_mode_command_msg *msg,
*/ */
/* Execute the security mode control procedure initiated by the network */ /* Execute the security mode control procedure initiated by the network */
LOG_TRACE(INFO,"Execute the security mode control procedure initiated by the network: imeisvrequest %d\n",msg->imeisvrequest); LOG_TRACE(INFO,"Execute the security mode control procedure initiated by the network: imeisvrequest %d\n",msg->imeisvrequest);
rc = emm_proc_security_mode_command( rc = emm_proc_security_mode_command(user,
msg->naskeysetidentifier.tsc != NAS_KEY_SET_IDENTIFIER_MAPPED, msg->naskeysetidentifier.tsc != NAS_KEY_SET_IDENTIFIER_MAPPED,
msg->naskeysetidentifier.naskeysetidentifier, msg->naskeysetidentifier.naskeysetidentifier,
msg->selectednassecurityalgorithms.typeofcipheringalgorithm, msg->selectednassecurityalgorithms.typeofcipheringalgorithm,
......
...@@ -59,7 +59,7 @@ Description Defines functions executed at the EMMAS Service Access ...@@ -59,7 +59,7 @@ Description Defines functions executed at the EMMAS Service Access
#include "EmmInformation.h" #include "EmmInformation.h"
#include "DownlinkNasTransport.h" #include "DownlinkNasTransport.h"
#include "CsServiceNotification.h" #include "CsServiceNotification.h"
#include "user_defs.h"
/****************************************************************************/ /****************************************************************************/
/********************* G L O B A L C O N S T A N T S *******************/ /********************* G L O B A L C O N S T A N T S *******************/
/****************************************************************************/ /****************************************************************************/
...@@ -88,17 +88,17 @@ int emm_recv_status(unsigned int ueid, emm_status_msg *msg, int *emm_cause); ...@@ -88,17 +88,17 @@ int emm_recv_status(unsigned int ueid, emm_status_msg *msg, int *emm_cause);
* Functions executed by the UE upon receiving EMM message from the network * Functions executed by the UE upon receiving EMM message from the network
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
int emm_recv_attach_accept(attach_accept_msg *msg, int *emm_cause); int emm_recv_attach_accept(nas_user_t *user, attach_accept_msg *msg, int *emm_cause);
int emm_recv_attach_reject(attach_reject_msg *msg, int *emm_cause); int emm_recv_attach_reject(nas_user_t *user, attach_reject_msg *msg, int *emm_cause);
int emm_recv_detach_accept(detach_accept_msg *msg, int *emm_cause); int emm_recv_detach_accept(nas_user_t *user, detach_accept_msg *msg, int *emm_cause);
int emm_recv_identity_request(identity_request_msg *msg, int *emm_cause); int emm_recv_identity_request(nas_user_t *user, identity_request_msg *msg, int *emm_cause);
int emm_recv_authentication_request(authentication_request_msg *msg, int emm_recv_authentication_request(nas_user_t *user, authentication_request_msg *msg,
int *emm_cause); int *emm_cause);
int emm_recv_authentication_reject(authentication_reject_msg *msg, int emm_recv_authentication_reject(nas_user_t *user, authentication_reject_msg *msg,
int *emm_cause); int *emm_cause);
int emm_recv_security_mode_command(security_mode_command_msg *msg, int emm_recv_security_mode_command(nas_user_t *user, security_mode_command_msg *msg,
int *emm_cause); int *emm_cause);
#endif /* __EMM_RECV_H__*/ #endif /* __EMM_RECV_H__*/
...@@ -46,6 +46,7 @@ Description Defines the EMM Service Access Points at which the EPS ...@@ -46,6 +46,7 @@ Description Defines the EMM Service Access Points at which the EPS
#include "emm_reg.h" #include "emm_reg.h"
#include "emm_esm.h" #include "emm_esm.h"
#include "emm_as.h" #include "emm_as.h"
#include "user_defs.h"
/****************************************************************************/ /****************************************************************************/
/**************** E X T E R N A L D E F I N I T I O N S ****************/ /**************** E X T E R N A L D E F I N I T I O N S ****************/
...@@ -73,13 +74,13 @@ Description Defines the EMM Service Access Points at which the EPS ...@@ -73,13 +74,13 @@ Description Defines the EMM Service Access Points at which the EPS
** Others: NONE ** ** Others: NONE **
** ** ** **
***************************************************************************/ ***************************************************************************/
void emm_sap_initialize(void) void emm_sap_initialize(nas_user_t *user)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
emm_reg_initialize(); emm_reg_initialize();
emm_esm_initialize(); emm_esm_initialize();
emm_as_initialize(); emm_as_initialize(user);
LOG_FUNC_OUT; LOG_FUNC_OUT;
} }
...@@ -98,7 +99,7 @@ void emm_sap_initialize(void) ...@@ -98,7 +99,7 @@ void emm_sap_initialize(void)
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
int emm_sap_send(emm_sap_t *msg) int emm_sap_send(nas_user_t *user, emm_sap_t *msg)
{ {
int rc = RETURNerror; int rc = RETURNerror;
...@@ -116,12 +117,12 @@ int emm_sap_send(emm_sap_t *msg) ...@@ -116,12 +117,12 @@ int emm_sap_send(emm_sap_t *msg)
(primitive < (emm_primitive_t)EMMESM_PRIMITIVE_MAX) ) { (primitive < (emm_primitive_t)EMMESM_PRIMITIVE_MAX) ) {
/* Forward to the EMMESM-SAP */ /* Forward to the EMMESM-SAP */
msg->u.emm_esm.primitive = primitive; msg->u.emm_esm.primitive = primitive;
rc = emm_esm_send(&msg->u.emm_esm); rc = emm_esm_send(user, &msg->u.emm_esm);
} else if ( (primitive > (emm_primitive_t)EMMAS_PRIMITIVE_MIN) && } else if ( (primitive > (emm_primitive_t)EMMAS_PRIMITIVE_MIN) &&
(primitive < (emm_primitive_t)EMMAS_PRIMITIVE_MAX) ) { (primitive < (emm_primitive_t)EMMAS_PRIMITIVE_MAX) ) {
/* Forward to the EMMAS-SAP */ /* Forward to the EMMAS-SAP */
msg->u.emm_as.primitive = primitive; msg->u.emm_as.primitive = primitive;
rc = emm_as_send(&msg->u.emm_as); rc = emm_as_send(user, &msg->u.emm_as);
} }
else { else {
LOG_TRACE(WARNING, "EMM-SAP - Out of range primitive (%d)", primitive); LOG_TRACE(WARNING, "EMM-SAP - Out of range primitive (%d)", primitive);
......
...@@ -46,6 +46,7 @@ Description Defines the EMM Service Access Points at which the EPS ...@@ -46,6 +46,7 @@ Description Defines the EMM Service Access Points at which the EPS
#include "emm_regDef.h" #include "emm_regDef.h"
#include "emm_esmDef.h" #include "emm_esmDef.h"
#include "emm_asDef.h" #include "emm_asDef.h"
#include "user_defs.h"
/****************************************************************************/ /****************************************************************************/
/********************* G L O B A L C O N S T A N T S *******************/ /********************* G L O B A L C O N S T A N T S *******************/
...@@ -156,8 +157,8 @@ typedef struct emm_sap_s { ...@@ -156,8 +157,8 @@ typedef struct emm_sap_s {
/****************** 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 ******************/
/****************************************************************************/ /****************************************************************************/
void emm_sap_initialize(void); void emm_sap_initialize(nas_user_t *user);
int emm_sap_send(emm_sap_t *msg); int emm_sap_send(nas_user_t *user, emm_sap_t *msg);
#endif /* __EMM_SAP_H__*/ #endif /* __EMM_SAP_H__*/
...@@ -145,7 +145,7 @@ static void _security_release(emm_security_context_t *ctx); ...@@ -145,7 +145,7 @@ static void _security_release(emm_security_context_t *ctx);
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
int emm_proc_security_mode_command(int native_ksi, int ksi, int emm_proc_security_mode_command(nas_user_t *user, int native_ksi, int ksi,
int seea, int seia, int reea, int reia, int imeisv_request) int seea, int seia, int reea, int reia, int imeisv_request)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
...@@ -334,7 +334,7 @@ int emm_proc_security_mode_command(int native_ksi, int ksi, ...@@ -334,7 +334,7 @@ int emm_proc_security_mode_command(int native_ksi, int ksi,
/* 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); _emm_data.security, security_context_is_new, TRUE);
rc = emm_sap_send(&emm_sap); rc = emm_sap_send(user, &emm_sap);
LOG_FUNC_RETURN (rc); LOG_FUNC_RETURN (rc);
} }
......
...@@ -100,7 +100,7 @@ static int _emm_main_callback(int); ...@@ -100,7 +100,7 @@ static int _emm_main_callback(int);
** Others: _emm_data ** ** Others: _emm_data **
** ** ** **
***************************************************************************/ ***************************************************************************/
void emm_main_initialize(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;
...@@ -392,7 +392,7 @@ void emm_main_initialize(emm_indication_callback_t cb, const char *imei) ...@@ -392,7 +392,7 @@ void emm_main_initialize(emm_indication_callback_t cb, const char *imei)
/* /*
* Initialize EMM internal data used for UE in idle mode * Initialize EMM internal data used for UE in idle mode
*/ */
IdleMode_initialize(&_emm_main_callback); IdleMode_initialize(user, &_emm_main_callback);
LOG_FUNC_OUT; LOG_FUNC_OUT;
} }
......
...@@ -41,6 +41,7 @@ Description Defines the EPS Mobility Management procedure call manager, ...@@ -41,6 +41,7 @@ Description Defines the EPS Mobility Management procedure call manager,
#include "commonDef.h" #include "commonDef.h"
#include "networkDef.h" #include "networkDef.h"
#include "user_defs.h"
/****************************************************************************/ /****************************************************************************/
/********************* G L O B A L C O N S T A N T S *******************/ /********************* G L O B A L C O N S T A N T S *******************/
...@@ -67,7 +68,7 @@ typedef int (*emm_indication_callback_t) (Stat_t, tac_t, ci_t, AcT_t, ...@@ -67,7 +68,7 @@ typedef int (*emm_indication_callback_t) (Stat_t, tac_t, ci_t, AcT_t,
/****************** 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 ******************/
/****************************************************************************/ /****************************************************************************/
void emm_main_initialize(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(void);
......
...@@ -42,6 +42,7 @@ Description Defines the EPS Mobility Management procedures executed at ...@@ -42,6 +42,7 @@ Description Defines the EPS Mobility Management procedures executed at
#include "commonDef.h" #include "commonDef.h"
#include "OctetString.h" #include "OctetString.h"
#include "LowerLayer.h" #include "LowerLayer.h"
#include "user_defs.h"
/****************************************************************************/ /****************************************************************************/
/********************* G L O B A L C O N S T A N T S *******************/ /********************* G L O B A L C O N S T A N T S *******************/
...@@ -92,7 +93,7 @@ typedef enum { ...@@ -92,7 +93,7 @@ typedef enum {
*--------------------------------------------------------------------------- *---------------------------------------------------------------------------
*/ */
int emm_proc_status_ind(unsigned int ueid, int emm_cause); int emm_proc_status_ind(unsigned int ueid, int emm_cause);
int emm_proc_status(unsigned int ueid, int emm_cause); int emm_proc_status(nas_user_t *user, unsigned int ueid, int emm_cause);
/* /*
*--------------------------------------------------------------------------- *---------------------------------------------------------------------------
...@@ -112,28 +113,29 @@ int emm_proc_lowerlayer_release(void); ...@@ -112,28 +113,29 @@ int emm_proc_lowerlayer_release(void);
* UE's Idle mode procedure * UE's Idle mode procedure
*--------------------------------------------------------------------------- *---------------------------------------------------------------------------
*/ */
int emm_proc_initialize(void); int emm_proc_initialize(nas_user_t *user);
int emm_proc_plmn_selection(int index); int emm_proc_plmn_selection(nas_user_t *user, int index);
int emm_proc_plmn_selection_end(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);
/* /*
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Attach procedure * Attach procedure
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
int emm_proc_attach(emm_proc_attach_type_t type); int emm_proc_attach(nas_user_t *user, emm_proc_attach_type_t type);
int emm_proc_attach_request(void *args); int emm_proc_attach_request(void *args);
int emm_proc_attach_accept(long T3412, long T3402, long T3423, int n_tais, int emm_proc_attach_accept(nas_user_t *user, long T3412, long T3402, long T3423, int n_tais,
tai_t *tai, GUTI_t *guti, int n_eplmns, plmn_t *eplmn, tai_t *tai, GUTI_t *guti, int n_eplmns, plmn_t *eplmn,
const OctetString *esm_msg); const OctetString *esm_msg);
int emm_proc_attach_reject(int emm_cause, const OctetString *esm_msg); int emm_proc_attach_reject(nas_user_t *user, int emm_cause, const OctetString *esm_msg);
int emm_proc_attach_complete(void *args); int emm_proc_attach_complete(void *args);
int emm_proc_attach_failure(int is_initial, void *args); 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(void); int emm_proc_attach_restart(nas_user_t *user);
int emm_proc_attach_set_emergency(void); int emm_proc_attach_set_emergency(void);
int emm_proc_attach_set_detach(void); // FIXME check prototype
int emm_proc_attach_set_detach(void *user);
...@@ -142,9 +144,9 @@ int emm_proc_attach_set_detach(void); ...@@ -142,9 +144,9 @@ int emm_proc_attach_set_detach(void);
* Detach procedure * Detach procedure
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
int emm_proc_detach(emm_proc_detach_type_t type, int switch_off); int emm_proc_detach(nas_user_t *user, emm_proc_detach_type_t type, int switch_off);
int emm_proc_detach_request(void *args); int emm_proc_detach_request(void *args);
int emm_proc_detach_accept(void); int emm_proc_detach_accept(void *args);
int emm_proc_detach_failure(int is_initial, void *args); int emm_proc_detach_failure(int is_initial, void *args);
int emm_proc_detach_release(void *args); int emm_proc_detach_release(void *args);
...@@ -154,7 +156,7 @@ int emm_proc_detach_release(void *args); ...@@ -154,7 +156,7 @@ int emm_proc_detach_release(void *args);
* Identification procedure * Identification procedure
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
int emm_proc_identification_request(emm_proc_identity_type_t type); int emm_proc_identification_request(nas_user_t *user, emm_proc_identity_type_t type);
/* /*
...@@ -162,9 +164,9 @@ int emm_proc_identification_request(emm_proc_identity_type_t type); ...@@ -162,9 +164,9 @@ int emm_proc_identification_request(emm_proc_identity_type_t type);
* Authentication procedure * Authentication procedure
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
int emm_proc_authentication_request(int native_ksi, int ksi, int emm_proc_authentication_request(nas_user_t *user, int native_ksi, int ksi,
const OctetString *rand, const OctetString *autn); const OctetString *rand, const OctetString *autn);
int emm_proc_authentication_reject(void); int emm_proc_authentication_reject(nas_user_t *user);
int emm_proc_authentication_delete(void); int emm_proc_authentication_delete(void);
...@@ -173,8 +175,8 @@ int emm_proc_authentication_delete(void); ...@@ -173,8 +175,8 @@ int emm_proc_authentication_delete(void);
* Security mode control procedure * Security mode control procedure
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
int emm_proc_security_mode_command(int native_ksi, int ksi, int seea, int seia, int emm_proc_security_mode_command(nas_user_t *user, int native_ksi, int ksi, int seea, int seia,
int reea, int reia,int imeisv_request); int reea, int reia, int imeisv_request);
/* /*
*--------------------------------------------------------------------------- *---------------------------------------------------------------------------
......
...@@ -104,13 +104,13 @@ Description Defines the dedicated EPS bearer context activation ESM ...@@ -104,13 +104,13 @@ Description Defines the dedicated EPS bearer context activation ESM
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
int esm_proc_dedicated_eps_bearer_context_request(esm_data_t *esm_data, int ebi, int default_ebi, int esm_proc_dedicated_eps_bearer_context_request(nas_user_t *user, int ebi, int default_ebi,
const esm_proc_qos_t *qos, const esm_proc_qos_t *qos,
const esm_proc_tft_t *tft, const esm_proc_tft_t *tft,
int *esm_cause) int *esm_cause)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
esm_data_t *esm_data = _esm_data;
int rc = RETURNerror; int rc = RETURNerror;
LOG_TRACE(INFO, "ESM-PROC - Dedicated EPS bearer context activation " LOG_TRACE(INFO, "ESM-PROC - Dedicated EPS bearer context activation "
...@@ -141,7 +141,7 @@ int esm_proc_dedicated_eps_bearer_context_request(esm_data_t *esm_data, int ebi, ...@@ -141,7 +141,7 @@ int esm_proc_dedicated_eps_bearer_context_request(esm_data_t *esm_data, int ebi,
int old_pid, old_bid; int old_pid, old_bid;
/* Locally deactivate the existing EPS bearer context and proceed /* Locally deactivate the existing EPS bearer context and proceed
* with the requested dedicated EPS bearer context activation */ * with the requested dedicated EPS bearer context activation */
rc = esm_proc_eps_bearer_context_deactivate(esm_data, TRUE, ebi, rc = esm_proc_eps_bearer_context_deactivate(user, TRUE, ebi,
&old_pid, &old_bid); &old_pid, &old_bid);
if (rc != RETURNok) { if (rc != RETURNok) {
...@@ -206,7 +206,7 @@ int esm_proc_dedicated_eps_bearer_context_request(esm_data_t *esm_data, int ebi, ...@@ -206,7 +206,7 @@ int esm_proc_dedicated_eps_bearer_context_request(esm_data_t *esm_data, int ebi,
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
int esm_proc_dedicated_eps_bearer_context_accept(int is_standalone, int ebi, int esm_proc_dedicated_eps_bearer_context_accept(nas_user_t *user, int is_standalone, int ebi,
OctetString *msg, int ue_triggered) OctetString *msg, int ue_triggered)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
...@@ -225,7 +225,7 @@ int esm_proc_dedicated_eps_bearer_context_accept(int is_standalone, int ebi, ...@@ -225,7 +225,7 @@ int esm_proc_dedicated_eps_bearer_context_accept(int is_standalone, int ebi,
emm_sap.u.emm_esm.ueid = 0; emm_sap.u.emm_esm.ueid = 0;
emm_esm->msg.length = msg->length; emm_esm->msg.length = msg->length;
emm_esm->msg.value = msg->value; emm_esm->msg.value = msg->value;
rc = emm_sap_send(&emm_sap); rc = emm_sap_send(user, &emm_sap);
if (rc != RETURNerror) { if (rc != RETURNerror) {
/* Set the EPS bearer context state to ACTIVE */ /* Set the EPS bearer context state to ACTIVE */
...@@ -266,7 +266,7 @@ int esm_proc_dedicated_eps_bearer_context_accept(int is_standalone, int ebi, ...@@ -266,7 +266,7 @@ int esm_proc_dedicated_eps_bearer_context_accept(int is_standalone, int ebi,
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
int esm_proc_dedicated_eps_bearer_context_reject(int is_standalone, int ebi, int esm_proc_dedicated_eps_bearer_context_reject(nas_user_t *user, int is_standalone, int ebi,
OctetString *msg, int ue_triggered) OctetString *msg, int ue_triggered)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
...@@ -293,7 +293,7 @@ int esm_proc_dedicated_eps_bearer_context_reject(int is_standalone, int ebi, ...@@ -293,7 +293,7 @@ int esm_proc_dedicated_eps_bearer_context_reject(int is_standalone, int ebi,
emm_sap.u.emm_esm.ueid = 0; emm_sap.u.emm_esm.ueid = 0;
emm_esm->msg.length = msg->length; emm_esm->msg.length = msg->length;
emm_esm->msg.value = msg->value; emm_esm->msg.value = msg->value;
rc = emm_sap_send(&emm_sap); rc = emm_sap_send(user, &emm_sap);
} }
LOG_FUNC_RETURN (rc); LOG_FUNC_RETURN (rc);
......
...@@ -104,12 +104,12 @@ static struct { ...@@ -104,12 +104,12 @@ static struct {
** Others: _default_eps_bearer_context_data ** ** Others: _default_eps_bearer_context_data **
** ** ** **
***************************************************************************/ ***************************************************************************/
int esm_proc_default_eps_bearer_context_request(esm_data_t *esm_data, int pid, int ebi, int esm_proc_default_eps_bearer_context_request(nas_user_t *user, int pid, int ebi,
const esm_proc_qos_t *qos, const esm_proc_qos_t *qos,
int *esm_cause) int *esm_cause)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
esm_data_t *esm_data = _esm_data;
int rc = RETURNerror; int rc = RETURNerror;
LOG_TRACE(INFO, "ESM-PROC - Default EPS bearer context activation " LOG_TRACE(INFO, "ESM-PROC - Default EPS bearer context activation "
...@@ -126,7 +126,7 @@ int esm_proc_default_eps_bearer_context_request(esm_data_t *esm_data, int pid, i ...@@ -126,7 +126,7 @@ int esm_proc_default_eps_bearer_context_request(esm_data_t *esm_data, int pid, i
int old_pid, old_bid; int old_pid, old_bid;
/* Locally deactivate the existing EPS bearer context and proceed /* Locally deactivate the existing EPS bearer context and proceed
* with the requested default EPS bearer context activation */ * with the requested default EPS bearer context activation */
rc = esm_proc_eps_bearer_context_deactivate(esm_data, TRUE, ebi, rc = esm_proc_eps_bearer_context_deactivate(user, TRUE, ebi,
&old_pid, &old_bid); &old_pid, &old_bid);
if (rc != RETURNok) { if (rc != RETURNok) {
...@@ -188,7 +188,7 @@ int esm_proc_default_eps_bearer_context_request(esm_data_t *esm_data, int pid, i ...@@ -188,7 +188,7 @@ int esm_proc_default_eps_bearer_context_request(esm_data_t *esm_data, int pid, i
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
int esm_proc_default_eps_bearer_context_accept(int is_standalone, int ebi, int esm_proc_default_eps_bearer_context_accept(nas_user_t *user, int is_standalone, int ebi,
OctetString *msg, int ue_triggered) OctetString *msg, int ue_triggered)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
...@@ -208,7 +208,7 @@ int esm_proc_default_eps_bearer_context_accept(int is_standalone, int ebi, ...@@ -208,7 +208,7 @@ int esm_proc_default_eps_bearer_context_accept(int is_standalone, int ebi,
emm_sap.u.emm_esm.ueid = 0; emm_sap.u.emm_esm.ueid = 0;
emm_esm->msg.length = msg->length; emm_esm->msg.length = msg->length;
emm_esm->msg.value = msg->value; emm_esm->msg.value = msg->value;
rc = emm_sap_send(&emm_sap); rc = emm_sap_send(user, &emm_sap);
} }
if (rc != RETURNerror) { if (rc != RETURNerror) {
...@@ -256,7 +256,7 @@ int esm_proc_default_eps_bearer_context_accept(int is_standalone, int ebi, ...@@ -256,7 +256,7 @@ int esm_proc_default_eps_bearer_context_accept(int is_standalone, int ebi,
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
int esm_proc_default_eps_bearer_context_reject(int is_standalone, int ebi, int esm_proc_default_eps_bearer_context_reject(nas_user_t *user, int is_standalone, int ebi,
OctetString *msg, int ue_triggered) OctetString *msg, int ue_triggered)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
...@@ -283,7 +283,7 @@ int esm_proc_default_eps_bearer_context_reject(int is_standalone, int ebi, ...@@ -283,7 +283,7 @@ int esm_proc_default_eps_bearer_context_reject(int is_standalone, int ebi,
emm_sap.u.emm_esm.ueid = 0; emm_sap.u.emm_esm.ueid = 0;
emm_esm->msg.length = msg->length; emm_esm->msg.length = msg->length;
emm_esm->msg.value = msg->value; emm_esm->msg.value = msg->value;
rc = emm_sap_send(&emm_sap); rc = emm_sap_send(user, &emm_sap);
} else { } else {
/* An error is returned to notify EMM that the default EPS bearer /* An error is returned to notify EMM that the default EPS bearer
* activation procedure initiated as part of the initial attach * activation procedure initiated as part of the initial attach
...@@ -346,7 +346,7 @@ int esm_proc_default_eps_bearer_context_complete(void) ...@@ -346,7 +346,7 @@ int esm_proc_default_eps_bearer_context_complete(void)
** Others: _default_eps_bearer_context_data ** ** Others: _default_eps_bearer_context_data **
** ** ** **
***************************************************************************/ ***************************************************************************/
int esm_proc_default_eps_bearer_context_failure(esm_data_t *esm_data) int esm_proc_default_eps_bearer_context_failure(nas_user_t *user)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
...@@ -357,7 +357,7 @@ int esm_proc_default_eps_bearer_context_failure(esm_data_t *esm_data) ...@@ -357,7 +357,7 @@ int esm_proc_default_eps_bearer_context_failure(esm_data_t *esm_data)
"ESM-PROC - Default EPS bearer context activation failure"); "ESM-PROC - Default EPS bearer context activation failure");
/* Release the default EPS bearer context and enter state INACTIVE */ /* Release the default EPS bearer context and enter state INACTIVE */
int rc = esm_proc_eps_bearer_context_deactivate(esm_data, TRUE, ebi, &pid, &bid); int rc = esm_proc_eps_bearer_context_deactivate(user, TRUE, ebi, &pid, &bid);
if (rc != RETURNerror) { if (rc != RETURNerror) {
/* Reset default EPS bearer context internal data */ /* Reset default EPS bearer context internal data */
......
...@@ -74,7 +74,7 @@ Description Defines the EPS bearer context deactivation ESM procedure ...@@ -74,7 +74,7 @@ Description Defines the EPS bearer context deactivation ESM procedure
* in the UE * in the UE
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
static int _eps_bearer_release(esm_data_t *esm_data, int ebi, int *pid, int *bid); static int _eps_bearer_release(nas_user_t *user, int ebi, int *pid, int *bid);
/****************************************************************************/ /****************************************************************************/
...@@ -112,25 +112,25 @@ static int _eps_bearer_release(esm_data_t *esm_data, int ebi, int *pid, int *bid ...@@ -112,25 +112,25 @@ static int _eps_bearer_release(esm_data_t *esm_data, int ebi, int *pid, int *bid
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
int esm_proc_eps_bearer_context_deactivate(esm_data_t *esm_data, int is_local, int ebi, int esm_proc_eps_bearer_context_deactivate(nas_user_t *user, int is_local, int ebi,
int *pid, int *bid) int *pid, int *bid)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
int rc = RETURNerror; int rc = RETURNerror;
int i; int i;
esm_data_t *esm_data = _esm_data;
if (is_local) { if (is_local) {
if (ebi != ESM_SAP_ALL_EBI) { if (ebi != ESM_SAP_ALL_EBI) {
/* Locally release the EPS bearer context */ /* Locally release the EPS bearer context */
rc = _eps_bearer_release(esm_data, ebi, pid, bid); rc = _eps_bearer_release(user, ebi, pid, bid);
} else { } else {
/* Locally release all the EPS bearer contexts */ /* Locally release all the EPS bearer contexts */
*bid = 0; *bid = 0;
for (*pid = 0; *pid < ESM_DATA_PDN_MAX; (*pid)++) { for (*pid = 0; *pid < ESM_DATA_PDN_MAX; (*pid)++) {
if (esm_data->pdn[*pid].data) { if (esm_data->pdn[*pid].data) {
rc = _eps_bearer_release(esm_data, ESM_EBI_UNASSIGNED, pid, bid); rc = _eps_bearer_release(user, ESM_EBI_UNASSIGNED, pid, bid);
if (rc != RETURNok) { if (rc != RETURNok) {
break; break;
...@@ -189,18 +189,19 @@ int esm_proc_eps_bearer_context_deactivate(esm_data_t *esm_data, int is_local, i ...@@ -189,18 +189,19 @@ int esm_proc_eps_bearer_context_deactivate(esm_data_t *esm_data, int is_local, i
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
int esm_proc_eps_bearer_context_deactivate_request(esm_data_t *esm_data, int ebi, int *esm_cause) int esm_proc_eps_bearer_context_deactivate_request(nas_user_t *user, int ebi, int *esm_cause)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
int pid, bid; int pid, bid;
int rc = RETURNok; int rc = RETURNok;
esm_data_t *esm_data = _esm_data;
LOG_TRACE(INFO, "ESM-PROC - EPS bearer context deactivation " LOG_TRACE(INFO, "ESM-PROC - EPS bearer context deactivation "
"requested by the network (ebi=%d)", ebi); "requested by the network (ebi=%d)", ebi);
/* Release the EPS bearer context entry */ /* Release the EPS bearer context entry */
if (esm_ebr_context_release(esm_data, ebi, &pid, &bid) == ESM_EBI_UNASSIGNED) { if (esm_ebr_context_release(user, ebi, &pid, &bid) == ESM_EBI_UNASSIGNED) {
LOG_TRACE(WARNING, "ESM-PROC - Failed to release EPS bearer context"); LOG_TRACE(WARNING, "ESM-PROC - Failed to release EPS bearer context");
*esm_cause = ESM_CAUSE_PROTOCOL_ERROR; *esm_cause = ESM_CAUSE_PROTOCOL_ERROR;
LOG_FUNC_RETURN (RETURNerror); LOG_FUNC_RETURN (RETURNerror);
...@@ -243,7 +244,7 @@ int esm_proc_eps_bearer_context_deactivate_request(esm_data_t *esm_data, int ebi ...@@ -243,7 +244,7 @@ int esm_proc_eps_bearer_context_deactivate_request(esm_data_t *esm_data, int ebi
esm_sap.is_standalone = TRUE; esm_sap.is_standalone = TRUE;
esm_sap.data.pdn_connect.is_defined = TRUE; esm_sap.data.pdn_connect.is_defined = TRUE;
esm_sap.data.pdn_connect.cid = pid + 1; esm_sap.data.pdn_connect.cid = pid + 1;
rc = esm_sap_send(&esm_sap); rc = esm_sap_send(user, &esm_sap);
} }
} }
} }
...@@ -275,7 +276,7 @@ int esm_proc_eps_bearer_context_deactivate_request(esm_data_t *esm_data, int ebi ...@@ -275,7 +276,7 @@ int esm_proc_eps_bearer_context_deactivate_request(esm_data_t *esm_data, int ebi
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
int esm_proc_eps_bearer_context_deactivate_accept(int is_standalone, int ebi, int esm_proc_eps_bearer_context_deactivate_accept(nas_user_t *user, int is_standalone, int ebi,
OctetString *msg, int ue_triggered) OctetString *msg, int ue_triggered)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
...@@ -293,7 +294,7 @@ int esm_proc_eps_bearer_context_deactivate_accept(int is_standalone, int ebi, ...@@ -293,7 +294,7 @@ int esm_proc_eps_bearer_context_deactivate_accept(int is_standalone, int ebi,
emm_sap.u.emm_esm.ueid = 0; emm_sap.u.emm_esm.ueid = 0;
emm_sap.u.emm_esm.u.data.msg.length = msg->length; emm_sap.u.emm_esm.u.data.msg.length = msg->length;
emm_sap.u.emm_esm.u.data.msg.value = msg->value; emm_sap.u.emm_esm.u.data.msg.value = msg->value;
rc = emm_sap_send(&emm_sap); rc = emm_sap_send(user, &emm_sap);
} }
if (rc != RETURNerror) { if (rc != RETURNerror) {
...@@ -352,14 +353,14 @@ int esm_proc_eps_bearer_context_deactivate_accept(int is_standalone, int ebi, ...@@ -352,14 +353,14 @@ int esm_proc_eps_bearer_context_deactivate_accept(int is_standalone, int ebi,
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
static int _eps_bearer_release(esm_data_t *esm_data, int ebi, int *pid, int *bid) static int _eps_bearer_release(nas_user_t *user, int ebi, int *pid, int *bid)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
int rc = RETURNerror; int rc = RETURNerror;
/* Release the EPS bearer context entry */ /* Release the EPS bearer context entry */
ebi = esm_ebr_context_release(esm_data, ebi, pid, bid); ebi = esm_ebr_context_release(user, ebi, pid, bid);
if (ebi == ESM_EBI_UNASSIGNED) { if (ebi == ESM_EBI_UNASSIGNED) {
LOG_TRACE(WARNING, "ESM-PROC - Failed to release EPS bearer context"); LOG_TRACE(WARNING, "ESM-PROC - Failed to release EPS bearer context");
......
...@@ -161,7 +161,7 @@ int esm_proc_status_ind( ...@@ -161,7 +161,7 @@ int esm_proc_status_ind(
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
int esm_proc_status(int is_standalone, int esm_proc_status(nas_user_t *user, int is_standalone,
int ebi, OctetString *msg, int ebi, OctetString *msg,
int ue_triggered) int ue_triggered)
{ {
...@@ -179,7 +179,7 @@ int esm_proc_status(int is_standalone, ...@@ -179,7 +179,7 @@ int esm_proc_status(int is_standalone,
emm_sap.u.emm_esm.ueid = 0; emm_sap.u.emm_esm.ueid = 0;
emm_sap.u.emm_esm.u.data.msg.length = msg->length; emm_sap.u.emm_esm.u.data.msg.length = msg->length;
emm_sap.u.emm_esm.u.data.msg.value = msg->value; emm_sap.u.emm_esm.u.data.msg.value = msg->value;
rc = emm_sap_send(&emm_sap); rc = emm_sap_send(user, &emm_sap);
LOG_FUNC_RETURN (rc); LOG_FUNC_RETURN (rc);
} }
......
...@@ -279,7 +279,7 @@ int esm_proc_pdn_connectivity(esm_data_t *esm_data, int cid, int is_to_define, ...@@ -279,7 +279,7 @@ int esm_proc_pdn_connectivity(esm_data_t *esm_data, int cid, int is_to_define,
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
int esm_proc_pdn_connectivity_request(int is_standalone, int pti, int esm_proc_pdn_connectivity_request(nas_user_t *user, int is_standalone, int pti,
OctetString *msg, int sent_by_ue) OctetString *msg, int sent_by_ue)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
...@@ -298,7 +298,7 @@ int esm_proc_pdn_connectivity_request(int is_standalone, int pti, ...@@ -298,7 +298,7 @@ int esm_proc_pdn_connectivity_request(int is_standalone, int pti,
emm_sap.u.emm_esm.ueid = 0; emm_sap.u.emm_esm.ueid = 0;
emm_esm->msg.length = msg->length; emm_esm->msg.length = msg->length;
emm_esm->msg.value = msg->value; emm_esm->msg.value = msg->value;
rc = emm_sap_send(&emm_sap); rc = emm_sap_send(user, &emm_sap);
if (rc != RETURNerror) { if (rc != RETURNerror) {
/* Start T3482 retransmission timer */ /* Start T3482 retransmission timer */
...@@ -346,12 +346,12 @@ int esm_proc_pdn_connectivity_request(int is_standalone, int pti, ...@@ -346,12 +346,12 @@ int esm_proc_pdn_connectivity_request(int is_standalone, int pti,
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
int esm_proc_pdn_connectivity_accept(esm_data_t *esm_data, int pti, esm_proc_pdn_type_t pdn_type, int esm_proc_pdn_connectivity_accept(nas_user_t *user, int pti, esm_proc_pdn_type_t pdn_type,
const OctetString *pdn_addr, const OctetString *pdn_addr,
const OctetString *apn, int *esm_cause) const OctetString *apn, int *esm_cause)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
esm_data_t *esm_data = _esm_data;
int rc; int rc;
int pid = RETURNerror; int pid = RETURNerror;
char apn_first_char[4]; char apn_first_char[4];
...@@ -438,7 +438,7 @@ int esm_proc_pdn_connectivity_accept(esm_data_t *esm_data, int pti, esm_proc_pdn ...@@ -438,7 +438,7 @@ int esm_proc_pdn_connectivity_accept(esm_data_t *esm_data, int pti, esm_proc_pdn
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
int esm_proc_pdn_connectivity_reject(int pti, int *esm_cause) int esm_proc_pdn_connectivity_reject(nas_user_t *user, int pti, int *esm_cause)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
...@@ -489,7 +489,7 @@ int esm_proc_pdn_connectivity_reject(int pti, int *esm_cause) ...@@ -489,7 +489,7 @@ int esm_proc_pdn_connectivity_reject(int pti, int *esm_cause)
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
int esm_proc_pdn_connectivity_complete(void) int esm_proc_pdn_connectivity_complete(nas_user_t *user)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
...@@ -530,7 +530,7 @@ int esm_proc_pdn_connectivity_complete(void) ...@@ -530,7 +530,7 @@ int esm_proc_pdn_connectivity_complete(void)
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
int esm_proc_pdn_connectivity_failure(int is_pending) int esm_proc_pdn_connectivity_failure(nas_user_t *user, int is_pending)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
...@@ -603,6 +603,7 @@ int esm_proc_pdn_connectivity_failure(int is_pending) ...@@ -603,6 +603,7 @@ int esm_proc_pdn_connectivity_failure(int is_pending)
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
// FIXME
static void *_pdn_connectivity_t3482_handler(void *args) static void *_pdn_connectivity_t3482_handler(void *args)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
...@@ -610,7 +611,8 @@ static void *_pdn_connectivity_t3482_handler(void *args) ...@@ -610,7 +611,8 @@ static void *_pdn_connectivity_t3482_handler(void *args)
int rc; int rc;
/* Get retransmission timer parameters data */ /* Get retransmission timer parameters data */
esm_pt_timer_data_t *data = (esm_pt_timer_data_t *)(args); esm_pt_timer_data_t *data = args;
nas_user_t *user = data->user;
/* Increment the retransmission counter */ /* Increment the retransmission counter */
data->count += 1; data->count += 1;
...@@ -629,7 +631,7 @@ static void *_pdn_connectivity_t3482_handler(void *args) ...@@ -629,7 +631,7 @@ static void *_pdn_connectivity_t3482_handler(void *args)
emm_sap.u.emm_esm.ueid = 0; emm_sap.u.emm_esm.ueid = 0;
emm_esm->msg.length = data->msg.length; emm_esm->msg.length = data->msg.length;
emm_esm->msg.value = data->msg.value; emm_esm->msg.value = data->msg.value;
rc = emm_sap_send(&emm_sap); rc = emm_sap_send(user, &emm_sap);
if (rc != RETURNerror) { if (rc != RETURNerror) {
/* Restart the timer T3482 */ /* Restart the timer T3482 */
......
...@@ -168,7 +168,7 @@ int esm_proc_pdn_disconnect(esm_data_t *esm_data, int cid, unsigned int *pti, un ...@@ -168,7 +168,7 @@ int esm_proc_pdn_disconnect(esm_data_t *esm_data, int cid, unsigned int *pti, un
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
int esm_proc_pdn_disconnect_request(int is_standalone, int pti, int esm_proc_pdn_disconnect_request(nas_user_t *user, int is_standalone, int pti,
OctetString *msg, int sent_by_ue) OctetString *msg, int sent_by_ue)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
...@@ -187,7 +187,7 @@ int esm_proc_pdn_disconnect_request(int is_standalone, int pti, ...@@ -187,7 +187,7 @@ int esm_proc_pdn_disconnect_request(int is_standalone, int pti,
emm_sap.u.emm_esm.ueid = 0; emm_sap.u.emm_esm.ueid = 0;
emm_esm->msg.length = msg->length; emm_esm->msg.length = msg->length;
emm_esm->msg.value = msg->value; emm_esm->msg.value = msg->value;
rc = emm_sap_send(&emm_sap); rc = emm_sap_send(user, &emm_sap);
if (rc != RETURNerror) { if (rc != RETURNerror) {
/* Start T3482 retransmission timer */ /* Start T3482 retransmission timer */
...@@ -284,10 +284,10 @@ int esm_proc_pdn_disconnect_accept(int pti, int *esm_cause) ...@@ -284,10 +284,10 @@ int esm_proc_pdn_disconnect_accept(int pti, int *esm_cause)
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
int esm_proc_pdn_disconnect_reject(esm_data_t *esm_data, int pti, int *esm_cause) int esm_proc_pdn_disconnect_reject(nas_user_t *user, int pti, int *esm_cause)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
esm_data_t *esm_data = _esm_data;
int rc; int rc;
LOG_TRACE(WARNING, "ESM-PROC - PDN disconnection rejected by the network " LOG_TRACE(WARNING, "ESM-PROC - PDN disconnection rejected by the network "
...@@ -331,7 +331,7 @@ int esm_proc_pdn_disconnect_reject(esm_data_t *esm_data, int pti, int *esm_cause ...@@ -331,7 +331,7 @@ int esm_proc_pdn_disconnect_reject(esm_data_t *esm_data, int pti, int *esm_cause
esm_sap.recv = NULL; esm_sap.recv = NULL;
esm_sap.send.length = 0; esm_sap.send.length = 0;
esm_sap.data.eps_bearer_context_deactivate.ebi = ebi; esm_sap.data.eps_bearer_context_deactivate.ebi = ebi;
rc = esm_sap_send(&esm_sap); rc = esm_sap_send(user, &esm_sap);
if (rc != RETURNok) { if (rc != RETURNok) {
*esm_cause = ESM_CAUSE_PROTOCOL_ERROR; *esm_cause = ESM_CAUSE_PROTOCOL_ERROR;
...@@ -383,7 +383,8 @@ static void *_pdn_disconnect_t3492_handler(void *args) ...@@ -383,7 +383,8 @@ static void *_pdn_disconnect_t3492_handler(void *args)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
// FIXME check callback call // FIXME check callback call
esm_data_t *esm_data = args;; nas_user_t *user = args;
esm_data_t *esm_data = _esm_data;;
int rc; int rc;
/* Get retransmission timer parameters data */ /* Get retransmission timer parameters data */
...@@ -406,7 +407,7 @@ static void *_pdn_disconnect_t3492_handler(void *args) ...@@ -406,7 +407,7 @@ static void *_pdn_disconnect_t3492_handler(void *args)
emm_sap.u.emm_esm.ueid = 0; emm_sap.u.emm_esm.ueid = 0;
emm_esm->msg.length = data->msg.length; emm_esm->msg.length = data->msg.length;
emm_esm->msg.value = data->msg.value; emm_esm->msg.value = data->msg.value;
rc = emm_sap_send(&emm_sap); rc = emm_sap_send(user, &emm_sap);
if (rc != RETURNerror) { if (rc != RETURNerror) {
/* Restart the timer T3492 */ /* Restart the timer T3492 */
...@@ -449,7 +450,7 @@ static void *_pdn_disconnect_t3492_handler(void *args) ...@@ -449,7 +450,7 @@ static void *_pdn_disconnect_t3492_handler(void *args)
esm_sap.recv = NULL; esm_sap.recv = NULL;
esm_sap.send.length = 0; esm_sap.send.length = 0;
esm_sap.data.eps_bearer_context_deactivate.ebi = ebi; esm_sap.data.eps_bearer_context_deactivate.ebi = ebi;
rc = esm_sap_send(&esm_sap); rc = esm_sap_send(user, &esm_sap);
} }
} }
} }
......
...@@ -135,7 +135,7 @@ int esm_recv_status(int pti, int ebi, const esm_status_msg *msg) ...@@ -135,7 +135,7 @@ int esm_recv_status(int pti, int ebi, const esm_status_msg *msg)
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
int esm_recv_pdn_connectivity_reject(esm_data_t *esm_data, int pti, int ebi, int esm_recv_pdn_connectivity_reject(nas_user_t *user, int pti, int ebi,
const pdn_connectivity_reject_msg *msg) const pdn_connectivity_reject_msg *msg)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
...@@ -179,7 +179,7 @@ int esm_recv_pdn_connectivity_reject(esm_data_t *esm_data, int pti, int ebi, ...@@ -179,7 +179,7 @@ int esm_recv_pdn_connectivity_reject(esm_data_t *esm_data, int pti, int ebi,
esm_cause = msg->esmcause; esm_cause = msg->esmcause;
/* Execute the PDN connectivity procedure not accepted by the network */ /* Execute the PDN connectivity procedure not accepted by the network */
int rc = esm_proc_pdn_connectivity_reject(pti, &esm_cause); int rc = esm_proc_pdn_connectivity_reject(user, pti, &esm_cause);
if (rc != RETURNerror) { if (rc != RETURNerror) {
esm_cause = ESM_CAUSE_SUCCESS; esm_cause = ESM_CAUSE_SUCCESS;
...@@ -206,7 +206,7 @@ int esm_recv_pdn_connectivity_reject(esm_data_t *esm_data, int pti, int ebi, ...@@ -206,7 +206,7 @@ int esm_recv_pdn_connectivity_reject(esm_data_t *esm_data, int pti, int ebi,
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
int esm_recv_pdn_disconnect_reject(esm_data_t *esm_data, int pti, int ebi, int esm_recv_pdn_disconnect_reject(nas_user_t *user, int pti, int ebi,
const pdn_disconnect_reject_msg *msg) const pdn_disconnect_reject_msg *msg)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
...@@ -250,7 +250,7 @@ int esm_recv_pdn_disconnect_reject(esm_data_t *esm_data, int pti, int ebi, ...@@ -250,7 +250,7 @@ int esm_recv_pdn_disconnect_reject(esm_data_t *esm_data, int pti, int ebi,
esm_cause = msg->esmcause; esm_cause = msg->esmcause;
/* Execute the PDN disconnect procedure not accepted by the network */ /* Execute the PDN disconnect procedure not accepted by the network */
int rc = esm_proc_pdn_disconnect_reject(esm_data, pti, &esm_cause); int rc = esm_proc_pdn_disconnect_reject(user, pti, &esm_cause);
if (rc != RETURNerror) { if (rc != RETURNerror) {
esm_cause = ESM_CAUSE_SUCCESS; esm_cause = ESM_CAUSE_SUCCESS;
...@@ -278,11 +278,10 @@ int esm_recv_pdn_disconnect_reject(esm_data_t *esm_data, int pti, int ebi, ...@@ -278,11 +278,10 @@ int esm_recv_pdn_disconnect_reject(esm_data_t *esm_data, int pti, int ebi,
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
int esm_recv_activate_default_eps_bearer_context_request(esm_data_t *esm_data, int pti, int ebi, int esm_recv_activate_default_eps_bearer_context_request(nas_user_t *user, int pti, int ebi,
const activate_default_eps_bearer_context_request_msg *msg) const activate_default_eps_bearer_context_request_msg *msg)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
int esm_cause = ESM_CAUSE_SUCCESS; int esm_cause = ESM_CAUSE_SUCCESS;
LOG_TRACE(INFO, "ESM-SAP - Received Activate Default EPS Bearer Context " LOG_TRACE(INFO, "ESM-SAP - Received Activate Default EPS Bearer Context "
...@@ -369,14 +368,14 @@ int esm_recv_activate_default_eps_bearer_context_request(esm_data_t *esm_data, i ...@@ -369,14 +368,14 @@ int esm_recv_activate_default_eps_bearer_context_request(esm_data_t *esm_data, i
} }
/* Execute the PDN connectivity procedure accepted by the network */ /* Execute the PDN connectivity procedure accepted by the network */
int pid = esm_proc_pdn_connectivity_accept(esm_data, pti, pdn_type, int pid = esm_proc_pdn_connectivity_accept(user, pti, pdn_type,
&msg->pdnaddress.pdnaddressinformation, &msg->pdnaddress.pdnaddressinformation,
&msg->accesspointname.accesspointnamevalue, &msg->accesspointname.accesspointnamevalue,
&esm_cause); &esm_cause);
if (pid != RETURNerror) { if (pid != RETURNerror) {
/* Create local default EPS bearer context */ /* Create local default EPS bearer context */
int rc = esm_proc_default_eps_bearer_context_request(esm_data, pid, ebi, &qos, int rc = esm_proc_default_eps_bearer_context_request(user, pid, ebi, &qos,
&esm_cause); &esm_cause);
if (rc != RETURNerror) { if (rc != RETURNerror) {
...@@ -406,7 +405,7 @@ int esm_recv_activate_default_eps_bearer_context_request(esm_data_t *esm_data, i ...@@ -406,7 +405,7 @@ int esm_recv_activate_default_eps_bearer_context_request(esm_data_t *esm_data, i
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
int esm_recv_activate_dedicated_eps_bearer_context_request(esm_data_t *esm_data, int pti, int ebi, int esm_recv_activate_dedicated_eps_bearer_context_request(nas_user_t *user, int pti, int ebi,
const activate_dedicated_eps_bearer_context_request_msg *msg) const activate_dedicated_eps_bearer_context_request_msg *msg)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
...@@ -580,7 +579,7 @@ int esm_recv_activate_dedicated_eps_bearer_context_request(esm_data_t *esm_data, ...@@ -580,7 +579,7 @@ int esm_recv_activate_dedicated_eps_bearer_context_request(esm_data_t *esm_data,
} }
/* Execute the dedicated EPS bearer context activation procedure */ /* Execute the dedicated EPS bearer context activation procedure */
int rc = esm_proc_dedicated_eps_bearer_context_request(esm_data, ebi, int rc = esm_proc_dedicated_eps_bearer_context_request(user, ebi,
msg->linkedepsbeareridentity, msg->linkedepsbeareridentity,
&qos, &tft, &esm_cause); &qos, &tft, &esm_cause);
...@@ -614,7 +613,7 @@ int esm_recv_activate_dedicated_eps_bearer_context_request(esm_data_t *esm_data, ...@@ -614,7 +613,7 @@ int esm_recv_activate_dedicated_eps_bearer_context_request(esm_data_t *esm_data,
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
int esm_recv_deactivate_eps_bearer_context_request(esm_data_t *esm_data, int pti, int ebi, int esm_recv_deactivate_eps_bearer_context_request(nas_user_t *user, int pti, int ebi,
const deactivate_eps_bearer_context_request_msg *msg) const deactivate_eps_bearer_context_request_msg *msg)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
...@@ -670,7 +669,7 @@ int esm_recv_deactivate_eps_bearer_context_request(esm_data_t *esm_data, int pti ...@@ -670,7 +669,7 @@ int esm_recv_deactivate_eps_bearer_context_request(esm_data_t *esm_data, int pti
if (rc != RETURNerror) { if (rc != RETURNerror) {
/* Execute the EPS bearer context deactivation procedure */ /* Execute the EPS bearer context deactivation procedure */
rc = esm_proc_eps_bearer_context_deactivate_request(esm_data, ebi, &esm_cause); rc = esm_proc_eps_bearer_context_deactivate_request(user, ebi, &esm_cause);
if (rc != RETURNerror) { if (rc != RETURNerror) {
esm_cause = ESM_CAUSE_SUCCESS; esm_cause = ESM_CAUSE_SUCCESS;
......
...@@ -42,6 +42,7 @@ Description Defines functions executed at the ESM Service Access ...@@ -42,6 +42,7 @@ Description Defines functions executed at the ESM Service Access
#include "EsmStatus.h" #include "EsmStatus.h"
#include "emmData.h" #include "emmData.h"
#include "user_defs.h"
#include "PdnConnectivityReject.h" #include "PdnConnectivityReject.h"
#include "PdnDisconnectReject.h" #include "PdnDisconnectReject.h"
...@@ -88,23 +89,23 @@ int esm_recv_status(int pti, int ebi, const esm_status_msg *msg); ...@@ -88,23 +89,23 @@ int esm_recv_status(int pti, int ebi, const esm_status_msg *msg);
* Transaction related messages * Transaction related messages
* ---------------------------- * ----------------------------
*/ */
int esm_recv_pdn_connectivity_reject(esm_data_t *esm_data, int pti, int ebi, int esm_recv_pdn_connectivity_reject(nas_user_t *user, int pti, int ebi,
const pdn_connectivity_reject_msg *msg); const pdn_connectivity_reject_msg *msg);
int esm_recv_pdn_disconnect_reject(esm_data_t *esm_data, int pti, int ebi, int esm_recv_pdn_disconnect_reject(nas_user_t *user, int pti, int ebi,
const pdn_disconnect_reject_msg *msg); const pdn_disconnect_reject_msg *msg);
/* /*
* Messages related to EPS bearer contexts * Messages related to EPS bearer contexts
* --------------------------------------- * ---------------------------------------
*/ */
int esm_recv_activate_default_eps_bearer_context_request(esm_data_t *esm_data, int pti, int ebi, int esm_recv_activate_default_eps_bearer_context_request(nas_user_t *user, int pti, int ebi,
const activate_default_eps_bearer_context_request_msg *msg); const activate_default_eps_bearer_context_request_msg *msg);
int esm_recv_activate_dedicated_eps_bearer_context_request(esm_data_t *esm_data, int pti, int ebi, int esm_recv_activate_dedicated_eps_bearer_context_request(nas_user_t *user, int pti, int ebi,
const activate_dedicated_eps_bearer_context_request_msg *msg); const activate_dedicated_eps_bearer_context_request_msg *msg);
int esm_recv_deactivate_eps_bearer_context_request(esm_data_t *esm_data, int pti, int ebi, int esm_recv_deactivate_eps_bearer_context_request(nas_user_t *user, int pti, int ebi,
const deactivate_eps_bearer_context_request_msg *msg); const deactivate_eps_bearer_context_request_msg *msg);
......
...@@ -63,10 +63,9 @@ Description Defines the ESM Service Access Points at which the EPS ...@@ -63,10 +63,9 @@ Description Defines the ESM Service Access Points at which the EPS
/******************* L O C A L D E F I N I T I O N S *******************/ /******************* L O C A L D E F I N I T I O N S *******************/
/****************************************************************************/ /****************************************************************************/
// FIXME NOT SURE FOR THIS ONE static int _esm_sap_recv(nas_user_t *user, int msg_type, int is_standalone,
static int _esm_sap_recv(esm_data_t *esm_data, int msg_type, int is_standalone,
const OctetString *req, OctetString *rsp, esm_sap_error_t *err); const OctetString *req, OctetString *rsp, esm_sap_error_t *err);
static int _esm_sap_send(int msg_type, int is_standalone, int pti, int ebi, static int _esm_sap_send(nas_user_t *user, int msg_type, int is_standalone, int pti, int ebi,
const esm_sap_data_t *data, OctetString *rsp); const esm_sap_data_t *data, OctetString *rsp);
...@@ -145,7 +144,7 @@ void esm_sap_initialize(void) ...@@ -145,7 +144,7 @@ void esm_sap_initialize(void)
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
int esm_sap_send(esm_sap_t *msg) int esm_sap_send(nas_user_t *user, esm_sap_t *msg)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
// FIXME // FIXME
...@@ -193,7 +192,7 @@ int esm_sap_send(esm_sap_t *msg) ...@@ -193,7 +192,7 @@ int esm_sap_send(esm_sap_t *msg)
if (rc != RETURNerror) { if (rc != RETURNerror) {
/* Send PDN connectivity request */ /* Send PDN connectivity request */
rc = _esm_sap_send(PDN_CONNECTIVITY_REQUEST, rc = _esm_sap_send(user, PDN_CONNECTIVITY_REQUEST,
msg->is_standalone, msg->is_standalone,
pti, EPS_BEARER_IDENTITY_UNASSIGNED, pti, EPS_BEARER_IDENTITY_UNASSIGNED,
&msg->data, &msg->send); &msg->data, &msg->send);
...@@ -214,11 +213,11 @@ int esm_sap_send(esm_sap_t *msg) ...@@ -214,11 +213,11 @@ int esm_sap_send(esm_sap_t *msg)
pdn_connect->is_emergency, NULL); pdn_connect->is_emergency, NULL);
} else if (msg->recv != NULL) { } else if (msg->recv != NULL) {
/* The UE received a PDN connectivity reject message */ /* The UE received a PDN connectivity reject message */
rc = _esm_sap_recv(esm_data, PDN_CONNECTIVITY_REJECT, msg->is_standalone, rc = _esm_sap_recv(user, PDN_CONNECTIVITY_REJECT, msg->is_standalone,
msg->recv, &msg->send, &msg->err); msg->recv, &msg->send, &msg->err);
} else { } else {
/* The PDN connectivity procedure locally failed */ /* The PDN connectivity procedure locally failed */
rc = esm_proc_pdn_connectivity_failure(TRUE); rc = esm_proc_pdn_connectivity_failure(user, TRUE);
} }
} }
break; break;
...@@ -234,7 +233,7 @@ int esm_sap_send(esm_sap_t *msg) ...@@ -234,7 +233,7 @@ int esm_sap_send(esm_sap_t *msg)
if (rc != RETURNerror) { if (rc != RETURNerror) {
/* Send PDN disconnect request */ /* Send PDN disconnect request */
rc = _esm_sap_send(PDN_DISCONNECT_REQUEST, TRUE, pti, ebi, rc = _esm_sap_send(user, PDN_DISCONNECT_REQUEST, TRUE, pti, ebi,
&msg->data, &msg->send); &msg->data, &msg->send);
} }
} }
...@@ -257,7 +256,7 @@ int esm_sap_send(esm_sap_t *msg) ...@@ -257,7 +256,7 @@ int esm_sap_send(esm_sap_t *msg)
case ESM_DEFAULT_EPS_BEARER_CONTEXT_ACTIVATE_REQ: case ESM_DEFAULT_EPS_BEARER_CONTEXT_ACTIVATE_REQ:
/* The UE received activate default ESP bearer context request */ /* The UE received activate default ESP bearer context request */
rc = _esm_sap_recv(esm_data, ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST, rc = _esm_sap_recv(user, ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST,
msg->is_standalone, msg->is_standalone,
msg->recv, &msg->send, &msg->err); msg->recv, &msg->send, &msg->err);
break; break;
...@@ -270,7 +269,7 @@ int esm_sap_send(esm_sap_t *msg) ...@@ -270,7 +269,7 @@ int esm_sap_send(esm_sap_t *msg)
rc = esm_proc_default_eps_bearer_context_complete(); rc = esm_proc_default_eps_bearer_context_complete();
if (rc != RETURNerror) { if (rc != RETURNerror) {
rc = esm_proc_pdn_connectivity_complete(); rc = esm_proc_pdn_connectivity_complete(user);
} }
break; break;
...@@ -279,10 +278,10 @@ int esm_sap_send(esm_sap_t *msg) ...@@ -279,10 +278,10 @@ int esm_sap_send(esm_sap_t *msg)
/* /*
* Default ESP bearer context activation procedure locally failed * Default ESP bearer context activation procedure locally failed
*/ */
rc = esm_proc_default_eps_bearer_context_failure(esm_data); rc = esm_proc_default_eps_bearer_context_failure(user);
if (rc != RETURNerror) { if (rc != RETURNerror) {
rc = esm_proc_pdn_connectivity_failure(FALSE); rc = esm_proc_pdn_connectivity_failure(user, FALSE);
} }
break; break;
...@@ -310,7 +309,7 @@ int esm_sap_send(esm_sap_t *msg) ...@@ -310,7 +309,7 @@ int esm_sap_send(esm_sap_t *msg)
/* /*
* Locally deactivate EPS bearer context * Locally deactivate EPS bearer context
*/ */
rc = esm_proc_eps_bearer_context_deactivate(esm_data, TRUE, rc = esm_proc_eps_bearer_context_deactivate(user, TRUE,
msg->data.eps_bearer_context_deactivate.ebi, &pid, &bid); msg->data.eps_bearer_context_deactivate.ebi, &pid, &bid);
} }
break; break;
...@@ -319,7 +318,7 @@ int esm_sap_send(esm_sap_t *msg) ...@@ -319,7 +318,7 @@ int esm_sap_send(esm_sap_t *msg)
break; break;
case ESM_UNITDATA_IND: case ESM_UNITDATA_IND:
rc = _esm_sap_recv(esm_data, -1, msg->is_standalone, msg->recv, rc = _esm_sap_recv(user, -1, msg->is_standalone, msg->recv,
&msg->send, &msg->err); &msg->send, &msg->err);
break; break;
...@@ -364,7 +363,7 @@ int esm_sap_send(esm_sap_t *msg) ...@@ -364,7 +363,7 @@ int esm_sap_send(esm_sap_t *msg)
** Others: _esm_sap_buffer ** ** Others: _esm_sap_buffer **
** ** ** **
***************************************************************************/ ***************************************************************************/
static int _esm_sap_recv(esm_data_t *esm_data, int msg_type, int is_standalone, static int _esm_sap_recv(nas_user_t *user, int msg_type, int is_standalone,
const OctetString *req, OctetString *rsp, const OctetString *req, OctetString *rsp,
esm_sap_error_t *err) esm_sap_error_t *err)
{ {
...@@ -442,7 +441,7 @@ static int _esm_sap_recv(esm_data_t *esm_data, int msg_type, int is_standalone, ...@@ -442,7 +441,7 @@ static int _esm_sap_recv(esm_data_t *esm_data, int msg_type, int is_standalone,
* received from the MME * received from the MME
*/ */
esm_cause = esm_recv_activate_default_eps_bearer_context_request( esm_cause = esm_recv_activate_default_eps_bearer_context_request(
esm_data, pti, ebi, user, pti, ebi,
&esm_msg.activate_default_eps_bearer_context_request); &esm_msg.activate_default_eps_bearer_context_request);
if ( (esm_cause == ESM_CAUSE_SUCCESS) || if ( (esm_cause == ESM_CAUSE_SUCCESS) ||
...@@ -480,7 +479,7 @@ static int _esm_sap_recv(esm_data_t *esm_data, int msg_type, int is_standalone, ...@@ -480,7 +479,7 @@ static int _esm_sap_recv(esm_data_t *esm_data, int msg_type, int is_standalone,
* received from the MME * received from the MME
*/ */
esm_cause = esm_recv_activate_dedicated_eps_bearer_context_request( esm_cause = esm_recv_activate_dedicated_eps_bearer_context_request(
esm_data, pti, ebi, user, pti, ebi,
&esm_msg.activate_dedicated_eps_bearer_context_request); &esm_msg.activate_dedicated_eps_bearer_context_request);
if ( (esm_cause == ESM_CAUSE_SUCCESS) || if ( (esm_cause == ESM_CAUSE_SUCCESS) ||
...@@ -520,7 +519,7 @@ static int _esm_sap_recv(esm_data_t *esm_data, int msg_type, int is_standalone, ...@@ -520,7 +519,7 @@ static int _esm_sap_recv(esm_data_t *esm_data, int msg_type, int is_standalone,
* Process deactivate EPS bearer context request message * Process deactivate EPS bearer context request message
* received from the MME * received from the MME
*/ */
esm_cause = esm_recv_deactivate_eps_bearer_context_request(esm_data, pti, ebi, esm_cause = esm_recv_deactivate_eps_bearer_context_request(user, pti, ebi,
&esm_msg.deactivate_eps_bearer_context_request); &esm_msg.deactivate_eps_bearer_context_request);
if ( (esm_cause == ESM_CAUSE_INVALID_PTI_VALUE) || if ( (esm_cause == ESM_CAUSE_INVALID_PTI_VALUE) ||
...@@ -556,7 +555,7 @@ static int _esm_sap_recv(esm_data_t *esm_data, int msg_type, int is_standalone, ...@@ -556,7 +555,7 @@ static int _esm_sap_recv(esm_data_t *esm_data, int msg_type, int is_standalone,
/* /*
* Process PDN connectivity reject message received from the MME * Process PDN connectivity reject message received from the MME
*/ */
esm_cause = esm_recv_pdn_connectivity_reject(esm_data, pti, ebi, esm_cause = esm_recv_pdn_connectivity_reject(user, pti, ebi,
&esm_msg.pdn_connectivity_reject); &esm_msg.pdn_connectivity_reject);
if ( (esm_cause == ESM_CAUSE_INVALID_PTI_VALUE) || if ( (esm_cause == ESM_CAUSE_INVALID_PTI_VALUE) ||
...@@ -579,7 +578,7 @@ static int _esm_sap_recv(esm_data_t *esm_data, int msg_type, int is_standalone, ...@@ -579,7 +578,7 @@ static int _esm_sap_recv(esm_data_t *esm_data, int msg_type, int is_standalone,
/* /*
* Process PDN disconnect reject message received from the MME * Process PDN disconnect reject message received from the MME
*/ */
esm_cause = esm_recv_pdn_disconnect_reject(esm_data, pti, ebi, esm_cause = esm_recv_pdn_disconnect_reject(user, pti, ebi,
&esm_msg.pdn_disconnect_reject); &esm_msg.pdn_disconnect_reject);
if ( (esm_cause == ESM_CAUSE_INVALID_PTI_VALUE) || if ( (esm_cause == ESM_CAUSE_INVALID_PTI_VALUE) ||
...@@ -653,7 +652,7 @@ static int _esm_sap_recv(esm_data_t *esm_data, int msg_type, int is_standalone, ...@@ -653,7 +652,7 @@ static int _esm_sap_recv(esm_data_t *esm_data, int msg_type, int is_standalone,
} }
/* Complete the relevant ESM procedure */ /* Complete the relevant ESM procedure */
rc = (*esm_procedure)(is_standalone, ebi, rsp, triggered_by_ue); rc = (*esm_procedure)(user, is_standalone, ebi, rsp, triggered_by_ue);
if (is_discarded) { if (is_discarded) {
/* Return indication that received message has been discarded */ /* Return indication that received message has been discarded */
...@@ -696,7 +695,7 @@ static int _esm_sap_recv(esm_data_t *esm_data, int msg_type, int is_standalone, ...@@ -696,7 +695,7 @@ static int _esm_sap_recv(esm_data_t *esm_data, int msg_type, int is_standalone,
** Others: _esm_sap_buffer ** ** Others: _esm_sap_buffer **
** ** ** **
***************************************************************************/ ***************************************************************************/
static int _esm_sap_send(int msg_type, int is_standalone, static int _esm_sap_send(nas_user_t *user, int msg_type, int is_standalone,
int pti, int ebi, const esm_sap_data_t *data, int pti, int ebi, const esm_sap_data_t *data,
OctetString *rsp) OctetString *rsp)
{ {
...@@ -784,7 +783,7 @@ static int _esm_sap_send(int msg_type, int is_standalone, ...@@ -784,7 +783,7 @@ static int _esm_sap_send(int msg_type, int is_standalone,
/* Execute the relevant ESM procedure */ /* Execute the relevant ESM procedure */
if (esm_procedure) { if (esm_procedure) {
rc = (*esm_procedure)(is_standalone, pti, rsp, sent_by_ue); rc = (*esm_procedure)(user, is_standalone, pti, rsp, sent_by_ue);
} }
} }
......
...@@ -41,6 +41,7 @@ Description Defines the ESM Service Access Points at which the EPS ...@@ -41,6 +41,7 @@ Description Defines the ESM Service Access Points at which the EPS
#define __ESM_SAP_H__ #define __ESM_SAP_H__
#include "esm_sapDef.h" #include "esm_sapDef.h"
#include "user_defs.h"
/****************************************************************************/ /****************************************************************************/
/********************* G L O B A L C O N S T A N T S *******************/ /********************* G L O B A L C O N S T A N T S *******************/
...@@ -60,6 +61,6 @@ Description Defines the ESM Service Access Points at which the EPS ...@@ -60,6 +61,6 @@ Description Defines the ESM Service Access Points at which the EPS
void esm_sap_initialize(void); void esm_sap_initialize(void);
int esm_sap_send(esm_sap_t *msg); int esm_sap_send(nas_user_t *user, esm_sap_t *msg);
#endif /* __ESM_SAP_H__*/ #endif /* __ESM_SAP_H__*/
...@@ -330,8 +330,7 @@ int esm_ebr_context_create( ...@@ -330,8 +330,7 @@ int esm_ebr_context_create(
** Others: _esm_data ** ** Others: _esm_data **
** ** ** **
***************************************************************************/ ***************************************************************************/
int esm_ebr_context_release( int esm_ebr_context_release(nas_user_t *user,
esm_data_t *esm_data,
int ebi, int *pid, int *bid) int ebi, int *pid, int *bid)
{ {
int found = FALSE; int found = FALSE;
...@@ -342,7 +341,7 @@ int esm_ebr_context_release( ...@@ -342,7 +341,7 @@ int esm_ebr_context_release(
LOG_FUNC_IN; LOG_FUNC_IN;
esm_ctx = esm_data; esm_ctx = _esm_data;
if (ebi != ESM_EBI_UNASSIGNED) { if (ebi != ESM_EBI_UNASSIGNED) {
/* /*
...@@ -492,7 +491,7 @@ int esm_ebr_context_release( ...@@ -492,7 +491,7 @@ int esm_ebr_context_release(
emm_sap_t emm_sap; emm_sap_t emm_sap;
emm_sap.primitive = EMMESM_ESTABLISH_CNF; emm_sap.primitive = EMMESM_ESTABLISH_CNF;
emm_sap.u.emm_esm.u.establish.is_attached = FALSE; emm_sap.u.emm_esm.u.establish.is_attached = FALSE;
(void) emm_sap_send(&emm_sap); (void) emm_sap_send(user, &emm_sap);
} }
/* 3GPP TS 24.301, section 6.4.4.3, 6.4.4.6 /* 3GPP TS 24.301, section 6.4.4.3, 6.4.4.6
* If due to the EPS bearer context deactivation only the PDN * If due to the EPS bearer context deactivation only the PDN
...@@ -505,7 +504,7 @@ int esm_ebr_context_release( ...@@ -505,7 +504,7 @@ int esm_ebr_context_release(
emm_sap.primitive = EMMESM_ESTABLISH_CNF; emm_sap.primitive = EMMESM_ESTABLISH_CNF;
emm_sap.u.emm_esm.u.establish.is_attached = TRUE; emm_sap.u.emm_esm.u.establish.is_attached = TRUE;
emm_sap.u.emm_esm.u.establish.is_emergency = TRUE; emm_sap.u.emm_esm.u.establish.is_emergency = TRUE;
(void) emm_sap_send(&emm_sap); (void) emm_sap_send(user, &emm_sap);
} }
LOG_FUNC_RETURN (ebi); LOG_FUNC_RETURN (ebi);
......
...@@ -39,6 +39,7 @@ Description Defines functions used to handle EPS bearer contexts. ...@@ -39,6 +39,7 @@ Description Defines functions used to handle EPS bearer contexts.
#define __ESM_EBR_CONTEXT_H__ #define __ESM_EBR_CONTEXT_H__
#include "networkDef.h" #include "networkDef.h"
#include "user_defs.h"
/****************************************************************************/ /****************************************************************************/
/********************* G L O B A L C O N S T A N T S *******************/ /********************* G L O B A L C O N S T A N T S *******************/
...@@ -68,7 +69,7 @@ typedef enum { ...@@ -68,7 +69,7 @@ typedef enum {
int esm_ebr_context_create(esm_data_t *esm_data, int pid, int ebi, int is_default, int esm_ebr_context_create(esm_data_t *esm_data, int pid, int ebi, int is_default,
const network_qos_t *qos, const network_tft_t *tft); const network_qos_t *qos, const network_tft_t *tft);
int esm_ebr_context_release(esm_data_t *esm_data, int ebi, int *pid, int *bid); int esm_ebr_context_release(nas_user_t *user, int ebi, int *pid, int *bid);
int esm_ebr_context_get_pid(esm_data_t *esm_data, int ebi); int esm_ebr_context_get_pid(esm_data_t *esm_data, int ebi);
......
...@@ -43,6 +43,7 @@ Description Defines the EPS Session Management procedures executed at ...@@ -43,6 +43,7 @@ Description Defines the EPS Session Management procedures executed at
#include "OctetString.h" #include "OctetString.h"
#include "emmData.h" #include "emmData.h"
#include "ProtocolConfigurationOptions.h" #include "ProtocolConfigurationOptions.h"
#include "user_defs.h"
/****************************************************************************/ /****************************************************************************/
/********************* G L O B A L C O N S T A N T S *******************/ /********************* G L O B A L C O N S T A N T S *******************/
...@@ -78,7 +79,7 @@ typedef enum { ...@@ -78,7 +79,7 @@ typedef enum {
* Type of the ESM procedure callback executed when requested by the UE * Type of the ESM procedure callback executed when requested by the UE
* or initiated by the network * or initiated by the network
*/ */
typedef int (*esm_proc_procedure_t) (int, int, OctetString *, int); typedef int (*esm_proc_procedure_t) (nas_user_t *user, int, int, OctetString *, int);
/* EPS bearer level QoS parameters */ /* EPS bearer level QoS parameters */
typedef network_qos_t esm_proc_qos_t; typedef network_qos_t esm_proc_qos_t;
...@@ -112,7 +113,7 @@ typedef struct { ...@@ -112,7 +113,7 @@ typedef struct {
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
int esm_proc_status_ind(int pti, int ebi, int *esm_cause); int esm_proc_status_ind(int pti, int ebi, int *esm_cause);
int esm_proc_status(int is_standalone, int pti, OctetString *msg, int esm_proc_status(nas_user_t *user, int is_standalone, int pti, OctetString *msg,
int sent_by_ue); int sent_by_ue);
...@@ -124,13 +125,13 @@ int esm_proc_status(int is_standalone, int pti, OctetString *msg, ...@@ -124,13 +125,13 @@ int esm_proc_status(int is_standalone, int pti, OctetString *msg,
int esm_proc_pdn_connectivity(esm_data_t *esm_data, int cid, int to_define, int esm_proc_pdn_connectivity(esm_data_t *esm_data, int cid, int to_define,
esm_proc_pdn_type_t pdn_type, const OctetString *apn, int is_emergency, esm_proc_pdn_type_t pdn_type, const OctetString *apn, int is_emergency,
unsigned int *pti); unsigned int *pti);
int esm_proc_pdn_connectivity_request(int is_standalone, int pti, int esm_proc_pdn_connectivity_request(nas_user_t *user, int is_standalone, int pti,
OctetString *msg, int sent_by_ue); OctetString *msg, int sent_by_ue);
int esm_proc_pdn_connectivity_accept(esm_data_t *esm_data, int pti, esm_proc_pdn_type_t pdn_type, int esm_proc_pdn_connectivity_accept(nas_user_t *user, int pti, esm_proc_pdn_type_t pdn_type,
const OctetString *pdn_address, const OctetString *apn, int *esm_cause); const OctetString *pdn_address, const OctetString *apn, int *esm_cause);
int esm_proc_pdn_connectivity_reject(int pti, int *esm_cause); int esm_proc_pdn_connectivity_reject(nas_user_t *user, int pti, int *esm_cause);
int esm_proc_pdn_connectivity_complete(void); int esm_proc_pdn_connectivity_complete(nas_user_t *user);
int esm_proc_pdn_connectivity_failure(int is_pending); int esm_proc_pdn_connectivity_failure(nas_user_t *user, int is_pending);
/* /*
...@@ -139,11 +140,11 @@ int esm_proc_pdn_connectivity_failure(int is_pending); ...@@ -139,11 +140,11 @@ int esm_proc_pdn_connectivity_failure(int is_pending);
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
int esm_proc_pdn_disconnect(esm_data_t *esm_data, int cid, unsigned int *pti, unsigned int *ebi); int esm_proc_pdn_disconnect(esm_data_t *esm_data, int cid, unsigned int *pti, unsigned int *ebi);
int esm_proc_pdn_disconnect_request(int is_standalone, int pti, int esm_proc_pdn_disconnect_request(nas_user_t *user, int is_standalone, int pti,
OctetString *msg, int sent_by_ue); OctetString *msg, int sent_by_ue);
int esm_proc_pdn_disconnect_accept(int pti, int *esm_cause); int esm_proc_pdn_disconnect_accept(int pti, int *esm_cause);
int esm_proc_pdn_disconnect_reject(esm_data_t *esm_data, int pti, int *esm_cause); int esm_proc_pdn_disconnect_reject(nas_user_t *user, int pti, int *esm_cause);
/* /*
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
...@@ -151,14 +152,14 @@ int esm_proc_pdn_disconnect_reject(esm_data_t *esm_data, int pti, int *esm_cause ...@@ -151,14 +152,14 @@ int esm_proc_pdn_disconnect_reject(esm_data_t *esm_data, int pti, int *esm_cause
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
int esm_proc_default_eps_bearer_context_request(esm_data_t *esm_data, int pid, int ebi, int esm_proc_default_eps_bearer_context_request(nas_user_t *user, int pid, int ebi,
const esm_proc_qos_t *esm_qos, int *esm_cause); const esm_proc_qos_t *esm_qos, int *esm_cause);
int esm_proc_default_eps_bearer_context_complete(void); int esm_proc_default_eps_bearer_context_complete(void);
int esm_proc_default_eps_bearer_context_failure(esm_data_t *esm_data); int esm_proc_default_eps_bearer_context_failure(nas_user_t *user);
int esm_proc_default_eps_bearer_context_accept(int is_standalone, int ebi, int esm_proc_default_eps_bearer_context_accept(nas_user_t *user, int is_standalone, int ebi,
OctetString *msg, int ue_triggered); OctetString *msg, int ue_triggered);
int esm_proc_default_eps_bearer_context_reject(int is_standalone, int ebi, int esm_proc_default_eps_bearer_context_reject(nas_user_t *user, int is_standalone, int ebi,
OctetString *msg, int ue_triggered); OctetString *msg, int ue_triggered);
/* /*
...@@ -167,12 +168,12 @@ int esm_proc_default_eps_bearer_context_reject(int is_standalone, int ebi, ...@@ -167,12 +168,12 @@ int esm_proc_default_eps_bearer_context_reject(int is_standalone, int ebi,
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
int esm_proc_dedicated_eps_bearer_context_request(esm_data_t *esm_data, int ebi, int default_ebi, int esm_proc_dedicated_eps_bearer_context_request(nas_user_t *user, int ebi, int default_ebi,
const esm_proc_qos_t *qos, const esm_proc_tft_t *tft, int *esm_cause); const esm_proc_qos_t *qos, const esm_proc_tft_t *tft, int *esm_cause);
int esm_proc_dedicated_eps_bearer_context_accept(int is_standalone, int ebi, int esm_proc_dedicated_eps_bearer_context_accept(nas_user_t *user, int is_standalone, int ebi,
OctetString *msg, int ue_triggered); OctetString *msg, int ue_triggered);
int esm_proc_dedicated_eps_bearer_context_reject(int is_standalone, int ebi, int esm_proc_dedicated_eps_bearer_context_reject(nas_user_t *user, int is_standalone, int ebi,
OctetString *msg, int ue_triggered); OctetString *msg, int ue_triggered);
/* /*
...@@ -181,11 +182,11 @@ int esm_proc_dedicated_eps_bearer_context_reject(int is_standalone, int ebi, ...@@ -181,11 +182,11 @@ int esm_proc_dedicated_eps_bearer_context_reject(int is_standalone, int ebi,
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
int esm_proc_eps_bearer_context_deactivate(esm_data_t *esm_data, int is_local, int ebi, int *pid, int esm_proc_eps_bearer_context_deactivate(nas_user_t *user, int is_local, int ebi, int *pid,
int *bid); int *bid);
int esm_proc_eps_bearer_context_deactivate_request(esm_data_t *esm_data, int ebi, int *esm_cause); int esm_proc_eps_bearer_context_deactivate_request(nas_user_t *user, int ebi, int *esm_cause);
int esm_proc_eps_bearer_context_deactivate_accept(int is_standalone, int ebi, int esm_proc_eps_bearer_context_deactivate_accept(nas_user_t *user, int is_standalone, int ebi,
OctetString *msg, int ue_triggered); OctetString *msg, int ue_triggered);
#endif /* __ESM_PROC_H__*/ #endif /* __ESM_PROC_H__*/
...@@ -308,6 +308,7 @@ int esm_pt_start_timer(int pti, const OctetString *msg, ...@@ -308,6 +308,7 @@ int esm_pt_start_timer(int pti, const OctetString *msg,
* time interval */ * time interval */
ctx->timer.id = nas_timer_start(sec, cb, ctx->args); ctx->timer.id = nas_timer_start(sec, cb, ctx->args);
ctx->timer.sec = sec; ctx->timer.sec = sec;
// FIXME add user
} }
} }
......
...@@ -40,6 +40,7 @@ Description Defines functions used to handle ESM procedure transactions. ...@@ -40,6 +40,7 @@ Description Defines functions used to handle ESM procedure transactions.
#include "OctetString.h" #include "OctetString.h"
#include "nas_timer.h" #include "nas_timer.h"
#include "user_defs.h"
#include "ProcedureTransactionIdentity.h" #include "ProcedureTransactionIdentity.h"
...@@ -67,6 +68,7 @@ typedef struct { ...@@ -67,6 +68,7 @@ typedef struct {
unsigned char pti; /* Procedure transaction identity */ unsigned char pti; /* Procedure transaction identity */
unsigned int count; /* Retransmission counter */ unsigned int count; /* Retransmission counter */
OctetString msg; /* Encoded ESM message to re-transmit */ OctetString msg; /* Encoded ESM message to re-transmit */
nas_user_t *user; /* user reference */
} esm_pt_timer_data_t; } esm_pt_timer_data_t;
/****************************************************************************/ /****************************************************************************/
......
...@@ -98,7 +98,7 @@ void nas_proc_initialize(nas_user_t *user, emm_indication_callback_t emm_cb, ...@@ -98,7 +98,7 @@ void nas_proc_initialize(nas_user_t *user, emm_indication_callback_t emm_cb,
user->proc.rsrp = NAS_PROC_RSRP_UNKNOWN; user->proc.rsrp = NAS_PROC_RSRP_UNKNOWN;
/* Initialize the EMM procedure manager */ /* Initialize the EMM procedure manager */
emm_main_initialize(emm_cb, imei); emm_main_initialize(user, emm_cb, imei);
/* Initialize the ESM procedure manager */ /* Initialize the ESM procedure manager */
_esm_data = esm_main_initialize(esm_cb); _esm_data = esm_main_initialize(esm_cb);
...@@ -175,7 +175,7 @@ int nas_proc_enable_s1_mode(nas_user_t *user) ...@@ -175,7 +175,7 @@ int nas_proc_enable_s1_mode(nas_user_t *user)
*/ */
user->proc.EPS_capability_status = TRUE; user->proc.EPS_capability_status = TRUE;
emm_sap.primitive = EMMREG_S1_ENABLED; emm_sap.primitive = EMMREG_S1_ENABLED;
rc = emm_sap_send(&emm_sap); rc = emm_sap_send(user, &emm_sap);
LOG_FUNC_RETURN (rc); LOG_FUNC_RETURN (rc);
} }
...@@ -208,7 +208,7 @@ int nas_proc_disable_s1_mode(nas_user_t *user) ...@@ -208,7 +208,7 @@ int nas_proc_disable_s1_mode(nas_user_t *user)
*/ */
user->proc.EPS_capability_status = FALSE; user->proc.EPS_capability_status = FALSE;
emm_sap.primitive = EMMREG_S1_DISABLED; emm_sap.primitive = EMMREG_S1_DISABLED;
rc = emm_sap_send(&emm_sap); rc = emm_sap_send(user, &emm_sap);
LOG_FUNC_RETURN (rc); LOG_FUNC_RETURN (rc);
} }
...@@ -396,7 +396,7 @@ int nas_proc_register(nas_user_t *user, int mode, int format, const network_plmn ...@@ -396,7 +396,7 @@ int nas_proc_register(nas_user_t *user, int mode, int format, const network_plmn
emm_sap_t emm_sap; emm_sap_t emm_sap;
emm_sap.primitive = EMMREG_REGISTER_REQ; emm_sap.primitive = EMMREG_REGISTER_REQ;
emm_sap.u.emm_reg.u.regist.index = index; emm_sap.u.emm_reg.u.regist.index = index;
rc = emm_sap_send(&emm_sap); rc = emm_sap_send(user, &emm_sap);
} }
LOG_FUNC_RETURN (rc); LOG_FUNC_RETURN (rc);
...@@ -574,7 +574,7 @@ int nas_proc_detach(nas_user_t *user, int switch_off) ...@@ -574,7 +574,7 @@ int nas_proc_detach(nas_user_t *user, int switch_off)
/* 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;
rc = emm_sap_send(&emm_sap); rc = emm_sap_send(user, &emm_sap);
} }
LOG_FUNC_RETURN (rc); LOG_FUNC_RETURN (rc);
...@@ -605,7 +605,7 @@ int nas_proc_attach(nas_user_t *user) ...@@ -605,7 +605,7 @@ int nas_proc_attach(nas_user_t *user)
/* 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;
rc = emm_sap_send(&emm_sap); rc = emm_sap_send(user, &emm_sap);
} }
LOG_FUNC_RETURN (rc); LOG_FUNC_RETURN (rc);
...@@ -852,7 +852,7 @@ int nas_proc_set_pdn(nas_user_t *user, int cid, int type, const char *apn, int i ...@@ -852,7 +852,7 @@ int nas_proc_set_pdn(nas_user_t *user, int cid, int type, const char *apn, int i
* Notify ESM that a new PDN context has to be defined for * Notify ESM that a new PDN context has to be defined for
* the specified APN * the specified APN
*/ */
rc = esm_sap_send(&esm_sap); rc = esm_sap_send(user, &esm_sap);
LOG_FUNC_RETURN (rc); LOG_FUNC_RETURN (rc);
} }
...@@ -885,7 +885,7 @@ int nas_proc_reset_pdn(nas_user_t *user, int cid) ...@@ -885,7 +885,7 @@ int nas_proc_reset_pdn(nas_user_t *user, int cid)
/* /*
* Notify ESM that the specified PDN context has to be undefined * Notify ESM that the specified PDN context has to be undefined
*/ */
rc = esm_sap_send(&esm_sap); rc = esm_sap_send(user, &esm_sap);
LOG_FUNC_RETURN (rc); LOG_FUNC_RETURN (rc);
} }
...@@ -1034,7 +1034,7 @@ int nas_proc_cell_info(nas_user_t *user, int found, tac_t tac, ci_t ci, AcT_t Ac ...@@ -1034,7 +1034,7 @@ int nas_proc_cell_info(nas_user_t *user, int found, tac_t tac, ci_t ci, AcT_t Ac
emm_sap.u.emm_as.u.cell_info.tac = tac; emm_sap.u.emm_as.u.cell_info.tac = tac;
emm_sap.u.emm_as.u.cell_info.cellID = ci; emm_sap.u.emm_as.u.cell_info.cellID = ci;
rc = emm_sap_send(&emm_sap); rc = emm_sap_send(user, &emm_sap);
LOG_FUNC_RETURN (rc); LOG_FUNC_RETURN (rc);
} }
...@@ -1071,7 +1071,7 @@ int nas_proc_establish_cnf(nas_user_t *user, const Byte_t *data, uint32_t len) ...@@ -1071,7 +1071,7 @@ int nas_proc_establish_cnf(nas_user_t *user, const Byte_t *data, uint32_t len)
emm_sap.primitive = EMMAS_ESTABLISH_CNF; emm_sap.primitive = EMMAS_ESTABLISH_CNF;
emm_sap.u.emm_as.u.establish.NASmsg.length = len; emm_sap.u.emm_as.u.establish.NASmsg.length = len;
emm_sap.u.emm_as.u.establish.NASmsg.value = (uint8_t *)data; emm_sap.u.emm_as.u.establish.NASmsg.value = (uint8_t *)data;
rc = emm_sap_send(&emm_sap); rc = emm_sap_send(user, &emm_sap);
LOG_FUNC_RETURN (rc); LOG_FUNC_RETURN (rc);
} }
...@@ -1106,7 +1106,7 @@ int nas_proc_establish_rej(nas_user_t *user) ...@@ -1106,7 +1106,7 @@ int nas_proc_establish_rej(nas_user_t *user)
* from lower layers * from lower layers
*/ */
emm_sap.primitive = EMMAS_ESTABLISH_REJ; emm_sap.primitive = EMMAS_ESTABLISH_REJ;
rc = emm_sap_send(&emm_sap); rc = emm_sap_send(user, &emm_sap);
LOG_FUNC_RETURN (rc); LOG_FUNC_RETURN (rc);
} }
...@@ -1139,7 +1139,7 @@ int nas_proc_release_ind(nas_user_t *user, int cause) ...@@ -1139,7 +1139,7 @@ int nas_proc_release_ind(nas_user_t *user, int cause)
*/ */
emm_sap.primitive = EMMAS_RELEASE_IND; emm_sap.primitive = EMMAS_RELEASE_IND;
emm_sap.u.emm_as.u.release.cause = cause; emm_sap.u.emm_as.u.release.cause = cause;
rc = emm_sap_send(&emm_sap); rc = emm_sap_send(user, &emm_sap);
LOG_FUNC_RETURN (rc); LOG_FUNC_RETURN (rc);
} }
...@@ -1176,7 +1176,7 @@ int nas_proc_ul_transfer_cnf(nas_user_t *user) ...@@ -1176,7 +1176,7 @@ int nas_proc_ul_transfer_cnf(nas_user_t *user)
emm_sap.u.emm_as.u.data.ueid = 0; emm_sap.u.emm_as.u.data.ueid = 0;
emm_sap.u.emm_as.u.data.delivered = TRUE; emm_sap.u.emm_as.u.data.delivered = TRUE;
emm_sap.u.emm_as.u.data.NASmsg.length = 0; emm_sap.u.emm_as.u.data.NASmsg.length = 0;
rc = emm_sap_send(&emm_sap); rc = emm_sap_send(user, &emm_sap);
LOG_FUNC_RETURN (rc); LOG_FUNC_RETURN (rc);
} }
...@@ -1213,7 +1213,7 @@ int nas_proc_ul_transfer_rej(nas_user_t *user) ...@@ -1213,7 +1213,7 @@ int nas_proc_ul_transfer_rej(nas_user_t *user)
emm_sap.u.emm_as.u.data.ueid = 0; emm_sap.u.emm_as.u.data.ueid = 0;
emm_sap.u.emm_as.u.data.delivered = FALSE; emm_sap.u.emm_as.u.data.delivered = FALSE;
emm_sap.u.emm_as.u.data.NASmsg.length = 0; emm_sap.u.emm_as.u.data.NASmsg.length = 0;
rc = emm_sap_send(&emm_sap); rc = emm_sap_send(user, &emm_sap);
LOG_FUNC_RETURN (rc); LOG_FUNC_RETURN (rc);
} }
...@@ -1251,7 +1251,7 @@ int nas_proc_dl_transfer_ind(nas_user_t *user, const Byte_t *data, uint32_t len) ...@@ -1251,7 +1251,7 @@ int nas_proc_dl_transfer_ind(nas_user_t *user, const Byte_t *data, uint32_t len)
emm_sap.u.emm_as.u.data.delivered = TRUE; emm_sap.u.emm_as.u.data.delivered = TRUE;
emm_sap.u.emm_as.u.data.NASmsg.length = len; emm_sap.u.emm_as.u.data.NASmsg.length = len;
emm_sap.u.emm_as.u.data.NASmsg.value = (uint8_t *)data; emm_sap.u.emm_as.u.data.NASmsg.value = (uint8_t *)data;
rc = emm_sap_send(&emm_sap); rc = emm_sap_send(user, &emm_sap);
} }
LOG_FUNC_RETURN (rc); LOG_FUNC_RETURN (rc);
...@@ -1332,7 +1332,7 @@ static int _nas_proc_activate(nas_user_t *user, int cid, int apply_to_all) ...@@ -1332,7 +1332,7 @@ static int _nas_proc_activate(nas_user_t *user, int cid, int apply_to_all)
esm_sap.is_standalone = TRUE; esm_sap.is_standalone = TRUE;
esm_sap.data.pdn_connect.is_defined = TRUE; esm_sap.data.pdn_connect.is_defined = TRUE;
esm_sap.data.pdn_connect.cid = cid; esm_sap.data.pdn_connect.cid = cid;
rc = esm_sap_send(&esm_sap); rc = esm_sap_send(user, &esm_sap);
LOG_FUNC_RETURN (rc); LOG_FUNC_RETURN (rc);
} }
...@@ -1391,7 +1391,7 @@ static int _nas_proc_deactivate(nas_user_t *user, int cid, int apply_to_all) ...@@ -1391,7 +1391,7 @@ static int _nas_proc_deactivate(nas_user_t *user, int cid, int apply_to_all)
esm_sap_t esm_sap; esm_sap_t esm_sap;
esm_sap.primitive = ESM_PDN_DISCONNECT_REQ; esm_sap.primitive = ESM_PDN_DISCONNECT_REQ;
esm_sap.data.pdn_disconnect.cid = cid; esm_sap.data.pdn_disconnect.cid = cid;
rc = esm_sap_send(&esm_sap); rc = esm_sap_send(user, &esm_sap);
} else { } else {
/* For EPS, if an attempt is made to disconnect the last PDN /* For EPS, if an attempt is made to disconnect the last PDN
* connection, then the MT responds with an error */ * connection, then the MT responds with an error */
......
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