From 223247ceb099bcb9ae2482985f2fe7d82d57b87f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Leroy?= Date: Mon, 11 Jul 2016 15:48:09 +0200 Subject: [PATCH] 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 --- openair3/NAS/UE/EMM/Attach.c | 73 ++++++++++--------- openair3/NAS/UE/EMM/Authentication.c | 40 +++++----- openair3/NAS/UE/EMM/Detach.c | 35 +++++---- openair3/NAS/UE/EMM/EmmStatusHdl.c | 4 +- openair3/NAS/UE/EMM/Identification.c | 5 +- openair3/NAS/UE/EMM/IdleMode.c | 32 ++++---- openair3/NAS/UE/EMM/IdleMode.h | 3 +- openair3/NAS/UE/EMM/LowerLayer.c | 22 +++--- openair3/NAS/UE/EMM/LowerLayer.h | 14 ++-- openair3/NAS/UE/EMM/SAP/EmmDeregistered.c | 4 +- .../SAP/EmmDeregisteredAttemptingToAttach.c | 4 +- .../EMM/SAP/EmmDeregisteredLimitedService.c | 4 +- .../EMM/SAP/EmmDeregisteredNoCellAvailable.c | 4 +- .../UE/EMM/SAP/EmmDeregisteredNormalService.c | 6 +- .../UE/EMM/SAP/EmmDeregisteredPlmnSearch.c | 4 +- openair3/NAS/UE/EMM/SAP/EmmNull.c | 4 +- openair3/NAS/UE/EMM/SAP/EmmRegistered.c | 4 +- .../NAS/UE/EMM/SAP/EmmRegisteredInitiated.c | 6 +- openair3/NAS/UE/EMM/SAP/emm_as.c | 70 +++++++++--------- openair3/NAS/UE/EMM/SAP/emm_as.h | 5 +- openair3/NAS/UE/EMM/SAP/emm_esm.c | 8 +- openair3/NAS/UE/EMM/SAP/emm_esm.h | 3 +- openair3/NAS/UE/EMM/SAP/emm_recv.c | 30 ++++---- openair3/NAS/UE/EMM/SAP/emm_recv.h | 16 ++-- openair3/NAS/UE/EMM/SAP/emm_sap.c | 11 +-- openair3/NAS/UE/EMM/SAP/emm_sap.h | 5 +- openair3/NAS/UE/EMM/SecurityModeControl.c | 4 +- openair3/NAS/UE/EMM/emm_main.c | 4 +- openair3/NAS/UE/EMM/emm_main.h | 3 +- openair3/NAS/UE/EMM/emm_proc.h | 34 +++++---- .../ESM/DedicatedEpsBearerContextActivation.c | 14 ++-- .../ESM/DefaultEpsBearerContextActivation.c | 18 ++--- .../NAS/UE/ESM/EpsBearerContextDeactivation.c | 25 ++++--- openair3/NAS/UE/ESM/EsmStatusHdl.c | 4 +- openair3/NAS/UE/ESM/PdnConnectivity.c | 20 ++--- openair3/NAS/UE/ESM/PdnDisconnect.c | 17 +++-- openair3/NAS/UE/ESM/SAP/esm_recv.c | 23 +++--- openair3/NAS/UE/ESM/SAP/esm_recv.h | 11 +-- openair3/NAS/UE/ESM/SAP/esm_sap.c | 45 ++++++------ openair3/NAS/UE/ESM/SAP/esm_sap.h | 3 +- openair3/NAS/UE/ESM/esm_ebr_context.c | 9 +-- openair3/NAS/UE/ESM/esm_ebr_context.h | 3 +- openair3/NAS/UE/ESM/esm_proc.h | 39 +++++----- openair3/NAS/UE/ESM/esm_pt.c | 1 + openair3/NAS/UE/ESM/esm_pt.h | 2 + openair3/NAS/UE/nas_proc.c | 34 ++++----- 46 files changed, 380 insertions(+), 349 deletions(-) diff --git a/openair3/NAS/UE/EMM/Attach.c b/openair3/NAS/UE/EMM/Attach.c index 939c5b4afd..7084c69f92 100644 --- a/openair3/NAS/UE/EMM/Attach.c +++ b/openair3/NAS/UE/EMM/Attach.c @@ -97,7 +97,7 @@ static void *_emm_attach_t3402_handler(void *); /* * 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 @@ -140,7 +140,7 @@ static struct { ** 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; @@ -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.apn = NULL; 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) { /* Setup EMM procedure handler to be executed upon receiving * lower layer notification */ rc = emm_proc_lowerlayer_initialize(emm_proc_attach_request, emm_proc_attach_failure, - emm_proc_attach_release, NULL); + emm_proc_attach_release, user); if (rc != RETURNok) { LOG_TRACE(WARNING, "Failed to initialize EMM procedure handler"); @@ -260,7 +260,7 @@ int emm_proc_attach(emm_proc_attach_type_t type) } /* 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", T3410.id, T3410.sec); /* Stop T3402 and T3411 timers if running */ @@ -276,7 +276,7 @@ int emm_proc_attach(emm_proc_attach_type_t type) /* Get the PDN connectivity request to transfer within the ESM * container of the initial attach request message */ 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); @@ -301,7 +301,7 @@ int emm_proc_attach(emm_proc_attach_type_t type) int emm_proc_attach_request(void *args) { LOG_FUNC_IN; - + nas_user_t *user=args; emm_sap_t emm_sap; int rc; @@ -309,7 +309,7 @@ int emm_proc_attach_request(void *args) * Notify EMM that Attach Request has been sent to the network */ emm_sap.primitive = EMMREG_ATTACH_REQ; - rc = emm_sap_send(&emm_sap); + rc = emm_sap_send(user, &emm_sap); LOG_FUNC_RETURN(rc); } @@ -345,7 +345,7 @@ int emm_proc_attach_request(void *args) ** 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_eplmns, plmn_t *eplmn, const OctetString *esm_msg_pP) @@ -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.is_standalone = FALSE; 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) ) { /* Setup EMM procedure handler to be executed upon receiving * lower layer notification */ rc = emm_proc_lowerlayer_initialize(emm_proc_attach_complete, emm_proc_attach_failure, - NULL, NULL); + NULL, user); if (rc != RETURNok) { LOG_TRACE(WARNING, @@ -458,7 +458,7 @@ int emm_proc_attach_accept(long t3412, long t3402, long t3423, * complete message */ emm_sap.u.emm_as.u.data.NASinfo = EMM_AS_NAS_DATA_ATTACH; 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) { /* 3GPP TS 24.301, section 5.5.1.2.6, case j * If the ACTIVATE DEFAULT BEARER CONTEXT REQUEST message combined @@ -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. */ emm_sap.primitive = EMMREG_DETACH_INIT; - rc = emm_sap_send(&emm_sap); + rc = emm_sap_send(user, &emm_sap); } else { /* * 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, ** 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; @@ -676,11 +676,11 @@ int emm_proc_attach_reject(int emm_cause, const OctetString *esm_msg_pP) default : /* Other values are considered as abnormal cases * 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; } - rc = emm_sap_send(&emm_sap); + rc = emm_sap_send(user, &emm_sap); /* * 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) esm_sap.primitive = ESM_PDN_CONNECTIVITY_REJ; esm_sap.is_standalone = FALSE; esm_sap.recv = esm_msg_pP; - rc = esm_sap_send(&esm_sap); + rc = esm_sap_send(user, &esm_sap); } LOG_FUNC_RETURN(rc); @@ -721,6 +721,7 @@ int emm_proc_attach_complete(void *args) { LOG_FUNC_IN; + nas_user_t *user=args; emm_sap_t emm_sap; esm_sap_t esm_sap; int rc; @@ -743,7 +744,7 @@ int emm_proc_attach_complete(void *args) * to the network */ emm_sap.primitive = EMMREG_ATTACH_CNF; - rc = emm_sap_send(&emm_sap); + rc = emm_sap_send(user, &emm_sap); if (rc != RETURNerror) { /* @@ -753,7 +754,7 @@ int emm_proc_attach_complete(void *args) */ esm_sap.primitive = ESM_DEFAULT_EPS_BEARER_CONTEXT_ACTIVATE_CNF; esm_sap.is_standalone = FALSE; - rc = esm_sap_send(&esm_sap); + rc = esm_sap_send(user, &esm_sap); } LOG_FUNC_RETURN(rc); @@ -786,9 +787,9 @@ int emm_proc_attach_complete(void *args) int emm_proc_attach_failure(int is_initial, void *args) { LOG_FUNC_IN; - int rc = RETURNok; esm_sap_t esm_sap; + nas_user_t *user=args; LOG_TRACE(WARNING, "EMM-PROC - EPS attach failure"); @@ -821,7 +822,7 @@ int emm_proc_attach_failure(int is_initial, void *args) esm_sap.recv = NULL; } - rc = esm_sap_send(&esm_sap); + rc = esm_sap_send(user, &esm_sap); if (rc != RETURNerror) { /* Start T3411 timer */ @@ -855,16 +856,16 @@ int emm_proc_attach_failure(int is_initial, void *args) int emm_proc_attach_release(void *args) { LOG_FUNC_IN; - + nas_user_t *user=args; emm_sap_t emm_sap; int rc; LOG_TRACE(WARNING, "EMM-PROC - NAS signalling connection released"); /* 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); } @@ -883,7 +884,7 @@ int emm_proc_attach_release(void *args) ** Others: None ** ** ** ***************************************************************************/ -int emm_proc_attach_restart(void) +int emm_proc_attach_restart(nas_user_t *user) { LOG_FUNC_IN; @@ -897,7 +898,7 @@ int emm_proc_attach_restart(void) */ emm_sap.primitive = EMMREG_ATTACH_INIT; 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); } @@ -943,10 +944,11 @@ int emm_proc_attach_set_emergency(void) ** Others: _emm_data ** ** ** ***************************************************************************/ -int emm_proc_attach_set_detach(void) +int emm_proc_attach_set_detach(void *nas_user) { LOG_FUNC_IN; + nas_user_t *user=nas_user; int rc; LOG_TRACE(WARNING, @@ -959,7 +961,7 @@ int emm_proc_attach_set_detach(void) */ emm_sap_t emm_sap; emm_sap.primitive = EMMREG_DETACH_CNF; - rc = emm_sap_send(&emm_sap); + rc = emm_sap_send(user, &emm_sap); LOG_FUNC_RETURN(rc); } @@ -999,6 +1001,7 @@ void *_emm_attach_t3410_handler(void *args) { LOG_FUNC_IN; + nas_user_t *user=args; emm_sap_t emm_sap; int rc; @@ -1007,9 +1010,9 @@ void *_emm_attach_t3410_handler(void *args) /* Stop T3410 timer */ T3410.id = nas_timer_stop(T3410.id); /* 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) { /* Locally release the NAS signalling connection */ @@ -1041,6 +1044,7 @@ static void *_emm_attach_t3411_handler(void *args) { LOG_FUNC_IN; + nas_user_t *user=args; emm_sap_t emm_sap; LOG_TRACE(WARNING, "EMM-PROC - T3411 timer expired"); @@ -1054,7 +1058,7 @@ static void *_emm_attach_t3411_handler(void *args) emm_sap.primitive = EMMREG_ATTACH_INIT; 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); } @@ -1085,6 +1089,7 @@ static void *_emm_attach_t3402_handler(void *args) { LOG_FUNC_IN; + nas_user_t *user=args; emm_sap_t emm_sap; LOG_TRACE(WARNING, "EMM-PROC - T3402 timer expired"); @@ -1100,7 +1105,7 @@ static void *_emm_attach_t3402_handler(void *args) emm_sap.primitive = EMMREG_ATTACH_INIT; 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); } @@ -1132,7 +1137,7 @@ static void *_emm_attach_t3402_handler(void *args) ** 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; @@ -1177,7 +1182,7 @@ static void _emm_attach_abnormal_cases_bcd(emm_sap_t *emm_sap) _emm_data.status = EU2_NOT_UPDATED; /* 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", T3402.id, T3402.sec); /* diff --git a/openair3/NAS/UE/EMM/Authentication.c b/openair3/NAS/UE/EMM/Authentication.c index 9022acbdac..7b5672c3bf 100644 --- a/openair3/NAS/UE/EMM/Authentication.c +++ b/openair3/NAS/UE/EMM/Authentication.c @@ -119,9 +119,9 @@ static struct { /* * 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); -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_start_timers(void); @@ -171,7 +171,7 @@ static int _authentication_kasme(const OctetString *autn, ** 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 *autn) { @@ -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 * SQN failure */ rc = _authentication_abnormal_cases_cde( - EMM_CAUSE_SYNCH_FAILURE, &auts); + user, EMM_CAUSE_SYNCH_FAILURE, &auts); } else if (sbit == 0) { /* 3GPP TS 24.301, section 5.4.2.6, case d * Non-EPS authentication unacceptable */ rc = _authentication_abnormal_cases_cde( - EMM_CAUSE_NON_EPS_AUTH_UNACCEPTABLE, NULL); + user, EMM_CAUSE_NON_EPS_AUTH_UNACCEPTABLE, NULL); } else { /* 3GPP TS 24.301, section 5.4.2.6, case c * MAC code failure */ rc = _authentication_abnormal_cases_cde( - EMM_CAUSE_MAC_FAILURE, NULL); + user, EMM_CAUSE_MAC_FAILURE, NULL); } /* Free the AUTS parameter */ @@ -335,7 +335,7 @@ int emm_proc_authentication_request(int native_ksi, int ksi, /* Setup EPS NAS security data */ emm_as_set_security_data(&emm_sap.u.emm_as.u.security.sctx, _emm_data.security, FALSE, TRUE); - rc = emm_sap_send(&emm_sap); + rc = emm_sap_send(user, &emm_sap); if (rc != RETURNerror) { /* Reset the authentication failure counters */ @@ -396,7 +396,7 @@ int emm_proc_authentication_request(int native_ksi, int ksi, ** T3417, T3430 ** ** ** ***************************************************************************/ -int emm_proc_authentication_reject(void) +int emm_proc_authentication_reject(nas_user_t *user) { LOG_FUNC_IN; @@ -451,7 +451,7 @@ int emm_proc_authentication_reject(void) * Notify EMM that authentication is not accepted by the network */ emm_sap.primitive = EMMREG_AUTH_REJ; - rc = emm_sap_send(&emm_sap); + rc = emm_sap_send(user, &emm_sap); LOG_FUNC_RETURN (rc); } @@ -563,6 +563,7 @@ static void *_authentication_t3418_handler(void *args) { LOG_FUNC_IN; + nas_user_t *user=args; int rc; LOG_TRACE(WARNING, "EMM-PROC - T3418 timer expired"); @@ -573,7 +574,7 @@ static void *_authentication_t3418_handler(void *args) _authentication_data.mac_count = 0; _authentication_data.umts_count = 0; /* 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) { LOG_TRACE(WARNING, "EMM-PROC - Failed to proceed abnormal case f"); @@ -604,6 +605,7 @@ static void *_authentication_t3420_handler(void *args) { LOG_FUNC_IN; + nas_user_t *user=args; int rc; LOG_TRACE(WARNING, "EMM-PROC - T3420 timer expired"); @@ -613,7 +615,7 @@ static void *_authentication_t3420_handler(void *args) /* Reset the sync failure counter */ _authentication_data.sync_count = 0; /* 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) { LOG_TRACE(WARNING, "EMM-PROC - Failed to proceed abnormal case f"); @@ -644,7 +646,7 @@ static void *_authentication_t3420_handler(void *args) ** 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) { LOG_FUNC_IN; @@ -670,7 +672,7 @@ static int _authentication_abnormal_cases_cde(int emm_cause, /* Setup EPS NAS security data */ emm_as_set_security_data(&emm_sap.u.emm_as.u.security.sctx, _emm_data.security, FALSE, TRUE); - rc = emm_sap_send(&emm_sap); + rc = emm_sap_send(user, &emm_sap); if (rc != RETURNerror) { /* @@ -683,7 +685,7 @@ static int _authentication_abnormal_cases_cde(int emm_cause, _authentication_data.mac_count += 1; /* Start timer T3418 */ 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 " "%ld seconds", T3418.id, T3418.sec); break; @@ -694,7 +696,7 @@ static int _authentication_abnormal_cases_cde(int emm_cause, _authentication_data.umts_count += 1; /* Start timer T3418 */ 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 " "%ld seconds", T3418.id, T3418.sec); break; @@ -705,7 +707,7 @@ static int _authentication_abnormal_cases_cde(int emm_cause, _authentication_data.sync_count += 1; /* Start timer T3420 */ 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 " "%ld seconds", T3420.id, T3420.sec); break; @@ -743,7 +745,7 @@ static int _authentication_abnormal_cases_cde(int emm_cause, if (failure_counter >= AUTHENTICATION_COUNTER_MAX) { /* 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) { LOG_TRACE(WARNING, "EMM-PROC - " @@ -771,7 +773,7 @@ static int _authentication_abnormal_cases_cde(int emm_cause, ** Others: None ** ** ** ***************************************************************************/ -static int _authentication_abnormal_case_f(void) +static int _authentication_abnormal_case_f(nas_user_t *user) { LOG_FUNC_IN; @@ -787,7 +789,7 @@ static int _authentication_abnormal_case_f(void) emm_sap.primitive = EMMAS_RELEASE_REQ; emm_sap.u.emm_as.u.release.guti = _emm_data.guti; 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) { /* Start any retransmission timers (e.g. T3410, T3417, T3421 or diff --git a/openair3/NAS/UE/EMM/Detach.c b/openair3/NAS/UE/EMM/Detach.c index 7fd7330524..7ea4220cae 100644 --- a/openair3/NAS/UE/EMM/Detach.c +++ b/openair3/NAS/UE/EMM/Detach.c @@ -83,7 +83,7 @@ void *_emm_detach_t3421_handler(void *); /* * 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 @@ -131,7 +131,7 @@ static struct { ** 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; @@ -151,7 +151,7 @@ int emm_proc_detach(emm_proc_detach_type_t type, int switch_off) * lower layer notification */ rc = emm_proc_lowerlayer_initialize(emm_proc_detach_request, emm_proc_detach_failure, - emm_proc_detach_release, NULL); + emm_proc_detach_release, user); if (rc != RETURNok) { 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) * be sent to the network */ emm_sap.primitive = EMMAS_DATA_REQ; - rc = emm_sap_send(&emm_sap); + rc = emm_sap_send(user, &emm_sap); LOG_FUNC_RETURN(rc); } @@ -202,12 +202,13 @@ int emm_proc_detach_request(void *args) { LOG_FUNC_IN; + nas_user_t *user=args; emm_sap_t emm_sap; int rc; if ( !_emm_detach_data.switch_off ) { /* 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", T3421.id, T3421.sec); } @@ -216,7 +217,7 @@ int emm_proc_detach_request(void *args) * Notify EMM that Detach Request has been sent to the network */ emm_sap.primitive = EMMREG_DETACH_REQ; - rc = emm_sap_send(&emm_sap); + rc = emm_sap_send(user, &emm_sap); LOG_FUNC_RETURN(rc); } @@ -243,10 +244,11 @@ int emm_proc_detach_request(void *args) ** Others: T3421 ** ** ** ***************************************************************************/ -int emm_proc_detach_accept(void) +int emm_proc_detach_accept(void* args) { LOG_FUNC_IN; + nas_user_t *user=args; int rc; LOG_TRACE(INFO, "EMM-PROC - UE initiated detach procedure completion"); @@ -263,7 +265,7 @@ int emm_proc_detach_accept(void) esm_sap_t esm_sap; esm_sap.primitive = ESM_EPS_BEARER_CONTEXT_DEACTIVATE_REQ; 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 @@ -296,6 +298,7 @@ int emm_proc_detach_failure(int is_initial, void *args) { LOG_FUNC_IN; + nas_user_t *user=args; emm_sap_t emm_sap; int rc; @@ -312,7 +315,7 @@ int emm_proc_detach_failure(int is_initial, void *args) */ emm_sap.primitive = EMMREG_DETACH_INIT; 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); } @@ -342,8 +345,9 @@ int emm_proc_detach_release(void *args) LOG_TRACE(WARNING, "EMM-PROC - NAS signalling connection released"); + nas_user_t *user=args; /* 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); } @@ -383,6 +387,7 @@ void *_emm_detach_t3421_handler(void *args) { LOG_FUNC_IN; + nas_user_t *user=args; int rc; /* Increment the retransmission counter */ @@ -419,17 +424,17 @@ void *_emm_detach_t3421_handler(void *args) * be sent to the network */ emm_sap.primitive = EMMAS_DATA_REQ; - rc = emm_sap_send(&emm_sap); + rc = emm_sap_send(user, &emm_sap); if (rc != RETURNerror) { /* 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", T3421.id, T3421.sec); } } else { /* 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); @@ -455,7 +460,7 @@ void *_emm_detach_t3421_handler(void *args) ** 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; @@ -475,7 +480,7 @@ static int _emm_detach_abort(emm_proc_detach_type_t type) */ emm_sap.primitive = EMMREG_DETACH_FAILED; 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); } diff --git a/openair3/NAS/UE/EMM/EmmStatusHdl.c b/openair3/NAS/UE/EMM/EmmStatusHdl.c index c95441d370..c0c1fc24de 100644 --- a/openair3/NAS/UE/EMM/EmmStatusHdl.c +++ b/openair3/NAS/UE/EMM/EmmStatusHdl.c @@ -115,7 +115,7 @@ int emm_proc_status_ind(unsigned int ueid, int emm_cause) ** 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; @@ -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, FALSE, TRUE); - rc = emm_sap_send(&emm_sap); + rc = emm_sap_send(user, &emm_sap); LOG_FUNC_RETURN (rc); } diff --git a/openair3/NAS/UE/EMM/Identification.c b/openair3/NAS/UE/EMM/Identification.c index a9ceb7a43b..ce64e65850 100644 --- a/openair3/NAS/UE/EMM/Identification.c +++ b/openair3/NAS/UE/EMM/Identification.c @@ -49,6 +49,7 @@ Description Defines the identification EMM procedure executed by the #include "emm_sap.h" #include "msc.h" +#include "user_defs.h" #include // malloc, free #include // memcpy @@ -102,7 +103,7 @@ static const char *_emm_identity_type_str[] = { ** 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; @@ -199,7 +200,7 @@ int emm_proc_identification_request(emm_proc_identity_type_t type) /* Setup EPS NAS security data */ emm_as_set_security_data(&emm_sap.u.emm_as.u.security.sctx, _emm_data.security, FALSE, TRUE); - rc = emm_sap_send(&emm_sap); + rc = emm_sap_send(user, &emm_sap); LOG_FUNC_RETURN (rc); } diff --git a/openair3/NAS/UE/EMM/IdleMode.c b/openair3/NAS/UE/EMM/IdleMode.c index a5a2c30708..f7e3274614 100644 --- a/openair3/NAS/UE/EMM/IdleMode.c +++ b/openair3/NAS/UE/EMM/IdleMode.c @@ -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 _IldlMode_get_opnn_id(const plmn_t *plmn); -static int _IdleMode_get_suitable_cell(int index); +static int _IldlMode_get_opnn_id(nas_user_t *user, const plmn_t *plmn); +static int _IdleMode_get_suitable_cell(nas_user_t *user, int index); /* * A list of PLMN identities in priority order is maintained locally @@ -152,7 +152,7 @@ static IdleMode_callback_t _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 */ _emm_plmn_list.n_plmns = 0; @@ -166,7 +166,7 @@ void IdleMode_initialize(IdleMode_callback_t cb) _emm_indication_notify = *cb; /* 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) ** Others: _emm_plmn_list ** ** ** ***************************************************************************/ -int emm_proc_initialize(void) +int emm_proc_initialize(nas_user_t *user) { LOG_FUNC_IN; @@ -576,7 +576,7 @@ int emm_proc_initialize(void) /* Initialize the PLMNs' parameters */ for (i=0; i < _emm_plmn_list.n_plmns; 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) { plmn->fullname[0] = '\0'; @@ -603,7 +603,7 @@ int emm_proc_initialize(void) 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); @@ -634,7 +634,7 @@ int emm_proc_initialize(void) ** 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; @@ -679,7 +679,7 @@ int emm_proc_plmn_selection(int index) * automatic mode. */ _emm_plmn_list.index = index; - rc = _IdleMode_get_suitable_cell(index); + rc = _IdleMode_get_suitable_cell(user, index); } LOG_FUNC_RETURN (rc); @@ -721,7 +721,7 @@ int emm_proc_plmn_selection(int index) ** 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; @@ -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) { /* Try to select the next PLMN in the list of available PLMNs */ _emm_plmn_list.index = index; - rc = emm_proc_plmn_selection(index); + rc = emm_proc_plmn_selection(user, index); } else { /* No suitable cell of any PLMN within the ordered list * 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) /* * 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 == _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) * to register the presence of the UE to the selected PLMN */ 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) ** 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; @@ -1188,7 +1188,7 @@ static int _IldlMode_get_opnn_id(const plmn_t *plmn) ** 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; const plmn_t *plmn = _emm_plmn_list.plmn[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; } - return emm_sap_send(&emm_sap); + return emm_sap_send(user, &emm_sap); } diff --git a/openair3/NAS/UE/EMM/IdleMode.h b/openair3/NAS/UE/EMM/IdleMode.h index f75d149e91..f602cb37b0 100644 --- a/openair3/NAS/UE/EMM/IdleMode.h +++ b/openair3/NAS/UE/EMM/IdleMode.h @@ -41,6 +41,7 @@ Description Defines the functions used to get information from the list #define __IDLEMODE_H__ #include "commonDef.h" +#include "user_defs.h" /****************************************************************************/ /********************* 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); /****************** 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_hplmn_index(void); diff --git a/openair3/NAS/UE/EMM/LowerLayer.c b/openair3/NAS/UE/EMM/LowerLayer.c index f0f7a3c5b6..afe8f37c1b 100644 --- a/openair3/NAS/UE/EMM/LowerLayer.c +++ b/openair3/NAS/UE/EMM/LowerLayer.c @@ -96,7 +96,7 @@ static struct { ** Others: None ** ** ** ***************************************************************************/ -int lowerlayer_success(unsigned int ueid) +int lowerlayer_success(nas_user_t *user, unsigned int ueid) { LOG_FUNC_IN; @@ -105,7 +105,7 @@ int lowerlayer_success(unsigned int ueid) emm_sap.primitive = EMMREG_LOWERLAYER_SUCCESS; emm_sap.u.emm_reg.ueid = ueid; - rc = emm_sap_send(&emm_sap); + rc = emm_sap_send(user, &emm_sap); LOG_FUNC_RETURN (rc); } @@ -125,7 +125,7 @@ int lowerlayer_success(unsigned int ueid) ** Others: None ** ** ** ***************************************************************************/ -int lowerlayer_failure(unsigned int ueid) +int lowerlayer_failure(nas_user_t *user, unsigned int ueid) { LOG_FUNC_IN; @@ -134,7 +134,7 @@ int lowerlayer_failure(unsigned int ueid) emm_sap.primitive = EMMREG_LOWERLAYER_FAILURE; emm_sap.u.emm_reg.ueid = ueid; - rc = emm_sap_send(&emm_sap); + rc = emm_sap_send(user, &emm_sap); LOG_FUNC_RETURN (rc); } @@ -155,7 +155,7 @@ int lowerlayer_failure(unsigned int ueid) ** Others: None ** ** ** ***************************************************************************/ -int lowerlayer_establish(void) +int lowerlayer_establish(nas_user_t *user) { LOG_FUNC_IN; @@ -180,7 +180,7 @@ int lowerlayer_establish(void) ** Others: None ** ** ** ***************************************************************************/ -int lowerlayer_release(int cause) +int lowerlayer_release(nas_user_t *user, int cause) { LOG_FUNC_IN; @@ -192,7 +192,7 @@ int lowerlayer_release(int cause) emm_sap.primitive = EMMREG_LOWERLAYER_RELEASE; emm_sap.u.emm_reg.ueid = 0; - rc = emm_sap_send(&emm_sap); + rc = emm_sap_send(user, &emm_sap); LOG_FUNC_RETURN (rc); } @@ -213,7 +213,7 @@ int lowerlayer_release(int cause) ** 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; int rc; @@ -226,7 +226,7 @@ int lowerlayer_data_ind(unsigned int ueid, const OctetString *data) esm_sap.ueid = ueid; esm_sap.recv = data; - rc = esm_sap_send(&esm_sap); + rc = esm_sap_send(user, &esm_sap); LOG_FUNC_RETURN (rc); } @@ -247,7 +247,7 @@ int lowerlayer_data_ind(unsigned int ueid, const OctetString *data) ** 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; @@ -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; /* Setup EPS NAS security data */ 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); } diff --git a/openair3/NAS/UE/EMM/LowerLayer.h b/openair3/NAS/UE/EMM/LowerLayer.h index 396de203d3..85229de686 100644 --- a/openair3/NAS/UE/EMM/LowerLayer.h +++ b/openair3/NAS/UE/EMM/LowerLayer.h @@ -43,6 +43,7 @@ Description Defines EMM procedures executed by the Non-Access Stratum #define __LOWERLAYER_H__ #include "OctetString.h" +#include "user_defs.h" /****************************************************************************/ /********************* 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 *); /****************** E X P O R T E D F U N C T I O N S ******************/ /****************************************************************************/ -int lowerlayer_success(unsigned int ueid); -int lowerlayer_failure(unsigned int ueid); -int lowerlayer_establish(void); -int lowerlayer_release(int cause); +// FIXME prototype with ueid +int lowerlayer_success(nas_user_t *user, unsigned int ueid); +int lowerlayer_failure(nas_user_t *user, unsigned int ueid); +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_req(unsigned int ueid, const OctetString *data); +int lowerlayer_data_ind(nas_user_t *user, unsigned int ueid, const OctetString *data); +int lowerlayer_data_req(nas_user_t *user, unsigned int ueid, const OctetString *data); #endif /* __LOWERLAYER_H__*/ diff --git a/openair3/NAS/UE/EMM/SAP/EmmDeregistered.c b/openair3/NAS/UE/EMM/SAP/EmmDeregistered.c index 801de96145..b92e7a0c60 100644 --- a/openair3/NAS/UE/EMM/SAP/EmmDeregistered.c +++ b/openair3/NAS/UE/EMM/SAP/EmmDeregistered.c @@ -86,7 +86,7 @@ Description Implements the EPS Mobility Management procedures executed ** 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; @@ -149,7 +149,7 @@ int EmmDeregistered(const emm_reg_t *evt) if (rc != RETURNerror) { /* Restart the attach procedure */ - rc = emm_proc_attach_restart(); + rc = emm_proc_attach_restart(user); } break; diff --git a/openair3/NAS/UE/EMM/SAP/EmmDeregisteredAttemptingToAttach.c b/openair3/NAS/UE/EMM/SAP/EmmDeregisteredAttemptingToAttach.c index ed1d079930..42476fd24d 100644 --- a/openair3/NAS/UE/EMM/SAP/EmmDeregisteredAttemptingToAttach.c +++ b/openair3/NAS/UE/EMM/SAP/EmmDeregisteredAttemptingToAttach.c @@ -79,7 +79,7 @@ Description Implements the EPS Mobility Management procedures executed ** 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; @@ -104,7 +104,7 @@ int EmmDeregisteredAttemptingToAttach(const emm_reg_t *evt) if (rc != RETURNerror) { /* Restart the attach procedure */ - rc = emm_proc_attach_restart(); + rc = emm_proc_attach_restart(user); } break; diff --git a/openair3/NAS/UE/EMM/SAP/EmmDeregisteredLimitedService.c b/openair3/NAS/UE/EMM/SAP/EmmDeregisteredLimitedService.c index 78d418c69c..31b52469fa 100644 --- a/openair3/NAS/UE/EMM/SAP/EmmDeregisteredLimitedService.c +++ b/openair3/NAS/UE/EMM/SAP/EmmDeregisteredLimitedService.c @@ -83,7 +83,7 @@ Description Implements the EPS Mobility Management procedures executed ** 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; @@ -109,7 +109,7 @@ int EmmDeregisteredLimitedService(const emm_reg_t *evt) /* * 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; case _EMMREG_ATTACH_REQ: diff --git a/openair3/NAS/UE/EMM/SAP/EmmDeregisteredNoCellAvailable.c b/openair3/NAS/UE/EMM/SAP/EmmDeregisteredNoCellAvailable.c index 9f1f526e83..517d574dc7 100644 --- a/openair3/NAS/UE/EMM/SAP/EmmDeregisteredNoCellAvailable.c +++ b/openair3/NAS/UE/EMM/SAP/EmmDeregisteredNoCellAvailable.c @@ -84,7 +84,7 @@ Description Implements the EPS Mobility Management procedures executed ** 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; @@ -118,7 +118,7 @@ int EmmDeregisteredNoCellAvailable(const emm_reg_t *evt) /* * 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; diff --git a/openair3/NAS/UE/EMM/SAP/EmmDeregisteredNormalService.c b/openair3/NAS/UE/EMM/SAP/EmmDeregisteredNormalService.c index 85f98c4bd7..a3ac3bbdab 100644 --- a/openair3/NAS/UE/EMM/SAP/EmmDeregisteredNormalService.c +++ b/openair3/NAS/UE/EMM/SAP/EmmDeregisteredNormalService.c @@ -84,7 +84,7 @@ extern uint8_t usim_test; ** 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; @@ -112,11 +112,11 @@ int EmmDeregisteredNormalService(const emm_reg_t *evt) */ if(usim_test == 0) { - rc = emm_proc_attach(EMM_ATTACH_TYPE_EPS); + rc = emm_proc_attach(user, EMM_ATTACH_TYPE_EPS); } 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; diff --git a/openair3/NAS/UE/EMM/SAP/EmmDeregisteredPlmnSearch.c b/openair3/NAS/UE/EMM/SAP/EmmDeregisteredPlmnSearch.c index d9865c9b72..692e9a9e85 100644 --- a/openair3/NAS/UE/EMM/SAP/EmmDeregisteredPlmnSearch.c +++ b/openair3/NAS/UE/EMM/SAP/EmmDeregisteredPlmnSearch.c @@ -82,7 +82,7 @@ Description Implements the EPS Mobility Management procedures executed ** 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; @@ -122,7 +122,7 @@ int EmmDeregisteredPlmnSearch(const emm_reg_t *evt) /* * Perform network selection procedure */ - rc = emm_proc_plmn_selection(evt->u.regist.index); + rc = emm_proc_plmn_selection(user, evt->u.regist.index); break; case _EMMREG_REGISTER_REJ: diff --git a/openair3/NAS/UE/EMM/SAP/EmmNull.c b/openair3/NAS/UE/EMM/SAP/EmmNull.c index e482281a71..5da067bfe8 100644 --- a/openair3/NAS/UE/EMM/SAP/EmmNull.c +++ b/openair3/NAS/UE/EMM/SAP/EmmNull.c @@ -76,7 +76,7 @@ Description Implements the EPS Mobility Management procedures executed ** 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; @@ -104,7 +104,7 @@ int EmmNull(const emm_reg_t *evt) * establish an EMM context and make the UE reachable by an MME. */ if (rc != RETURNerror) { - rc = emm_proc_initialize(); + rc = emm_proc_initialize(user); } break; diff --git a/openair3/NAS/UE/EMM/SAP/EmmRegistered.c b/openair3/NAS/UE/EMM/SAP/EmmRegistered.c index dcbeee167e..83bb9ea37a 100644 --- a/openair3/NAS/UE/EMM/SAP/EmmRegistered.c +++ b/openair3/NAS/UE/EMM/SAP/EmmRegistered.c @@ -81,7 +81,7 @@ Description Implements the EPS Mobility Management procedures executed ** 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; @@ -96,7 +96,7 @@ int EmmRegistered(const emm_reg_t *evt) /* * 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; case _EMMREG_DETACH_REQ: diff --git a/openair3/NAS/UE/EMM/SAP/EmmRegisteredInitiated.c b/openair3/NAS/UE/EMM/SAP/EmmRegisteredInitiated.c index 688b168b53..71c9eb0a1d 100644 --- a/openair3/NAS/UE/EMM/SAP/EmmRegisteredInitiated.c +++ b/openair3/NAS/UE/EMM/SAP/EmmRegisteredInitiated.c @@ -78,7 +78,7 @@ Description Implements the EPS Mobility Management procedures executed ** 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; @@ -103,7 +103,7 @@ int EmmRegisteredInitiated(const emm_reg_t *evt) if (rc != RETURNerror) { /* Restart the attach procedure */ - rc = emm_proc_attach_restart(); + rc = emm_proc_attach_restart(user); } break; @@ -209,7 +209,7 @@ int EmmRegisteredInitiated(const emm_reg_t *evt) /* * 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; case _EMMREG_DETACH_REQ: diff --git a/openair3/NAS/UE/EMM/SAP/emm_as.c b/openair3/NAS/UE/EMM/SAP/emm_as.c index 7650f97ee8..8e0c661b09 100644 --- a/openair3/NAS/UE/EMM/SAP/emm_as.c +++ b/openair3/NAS/UE/EMM/SAP/emm_as.c @@ -99,19 +99,19 @@ static const char *_emm_as_primitive_str[] = { * Functions executed to process EMM procedures upon receiving * 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); -static int _emm_as_establish_cnf(const emm_as_establish_t *msg, int *emm_cause); -static int _emm_as_establish_rej(void); -static int _emm_as_release_ind(const emm_as_release_t *msg); +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(nas_user_t *user); +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_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_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 @@ -133,7 +133,7 @@ static int _emm_as_encrypt( int length, 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 *, ul_info_transfer_req_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_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_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 ** ** ** ***************************************************************************/ -void emm_as_initialize(void) +void emm_as_initialize(nas_user_t *user) { LOG_FUNC_IN; @@ -188,7 +188,7 @@ void emm_as_initialize(void) ** 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; @@ -203,21 +203,21 @@ int emm_as_send(const emm_as_t *msg) switch (primitive) { 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; break; 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; case _EMMAS_ESTABLISH_REJ: - rc = _emm_as_establish_rej(); + rc = _emm_as_establish_rej(user); break; case _EMMAS_RELEASE_IND: - rc = _emm_as_release_ind(&msg->u.release); + rc = _emm_as_release_ind(user, &msg->u.release); break; case _EMMAS_PAGE_IND: @@ -234,7 +234,7 @@ int emm_as_send(const emm_as_t *msg) default: /* Other primitives are forwarded to the Access Stratum */ - rc = _emm_as_send(msg); + rc = _emm_as_send(user, msg); if (rc != RETURNok) { LOG_TRACE(ERROR, "EMMAS-SAP - " @@ -306,7 +306,7 @@ int emm_as_send(const emm_as_t *msg) ** 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) { LOG_FUNC_IN; @@ -342,30 +342,30 @@ static int _emm_as_recv(unsigned int ueid, const char *msg, int len, break; case IDENTITY_REQUEST: - rc = emm_recv_identity_request(&emm_msg->identity_request, + rc = emm_recv_identity_request(user, &emm_msg->identity_request, emm_cause); break; case AUTHENTICATION_REQUEST: - rc = emm_recv_authentication_request( + rc = emm_recv_authentication_request(user, &emm_msg->authentication_request, emm_cause); break; case AUTHENTICATION_REJECT: - rc = emm_recv_authentication_reject( + rc = emm_recv_authentication_reject(user, &emm_msg->authentication_reject, emm_cause); break; case SECURITY_MODE_COMMAND: - rc = emm_recv_security_mode_command( + rc = emm_recv_security_mode_command(user, &emm_msg->security_mode_command, emm_cause); break; 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; @@ -406,7 +406,7 @@ static int _emm_as_recv(unsigned int ueid, const char *msg, int len, ** 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; @@ -443,23 +443,23 @@ static int _emm_as_data_ind(const emm_as_data_t *msg, int *emm_cause) } else if (header.protocol_discriminator == EPS_MOBILITY_MANAGEMENT_MESSAGE) { /* 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 == EPS_SESSION_MANAGEMENT_MESSAGE) { const OctetString data = {bytes, (uint8_t *)plain_msg}; /* 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); } } else { /* Process successfull lower layer transfer indication */ - rc = lowerlayer_success(msg->ueid); + rc = lowerlayer_success(user, msg->ueid); } } else { /* Process lower layer transmission failure of NAS message */ - rc = lowerlayer_failure(msg->ueid); + rc = lowerlayer_failure(user, msg->ueid); } LOG_FUNC_RETURN (rc); @@ -482,7 +482,7 @@ static int _emm_as_data_ind(const emm_as_data_t *msg, int *emm_cause) ** 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) { LOG_FUNC_IN; @@ -494,11 +494,11 @@ static int _emm_as_establish_cnf(const emm_as_establish_t *msg, if (msg->NASmsg.length > 0) { /* The NAS signalling connection is established */ - (void) lowerlayer_establish(); + (void) lowerlayer_establish(user); } else { /* The initial NAS message has been successfully delivered to * lower layers */ - rc = lowerlayer_success(0); + rc = lowerlayer_success(user, 0); LOG_FUNC_RETURN (rc); } @@ -523,11 +523,11 @@ static int _emm_as_establish_cnf(const emm_as_establish_t *msg, switch (emm_msg->header.message_type) { 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; 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; case DETACH_ACCEPT: @@ -563,7 +563,7 @@ static int _emm_as_establish_cnf(const emm_as_establish_t *msg, ** Others: None ** ** ** ***************************************************************************/ -static int _emm_as_establish_rej(void) +static int _emm_as_establish_rej(nas_user_t *user) { LOG_FUNC_IN; @@ -573,7 +573,7 @@ static int _emm_as_establish_rej(void) "failure"); /* Process lower layer transmission failure of initial NAS message */ - rc = lowerlayer_failure(0); + rc = lowerlayer_failure(user, 0); LOG_FUNC_RETURN (rc); } @@ -595,7 +595,7 @@ static int _emm_as_establish_rej(void) ** 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; @@ -605,7 +605,7 @@ static int _emm_as_release_ind(const emm_as_release_t *msg) "(cause=%d)", msg->cause); /* Process NAS signalling connection release indication */ - rc = lowerlayer_release(msg->cause); + rc = lowerlayer_release(user, msg->cause); LOG_FUNC_RETURN (rc); } @@ -928,7 +928,7 @@ _emm_as_encrypt( ** 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; diff --git a/openair3/NAS/UE/EMM/SAP/emm_as.h b/openair3/NAS/UE/EMM/SAP/emm_as.h index 04a14cf3cb..726a363d75 100644 --- a/openair3/NAS/UE/EMM/SAP/emm_as.h +++ b/openair3/NAS/UE/EMM/SAP/emm_as.h @@ -41,6 +41,7 @@ Description Defines the EMMAS Service Access Point that provides #define __EMM_AS_H__ #include "emm_asDef.h" +#include "user_defs.h" /****************************************************************************/ /********************* 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 /****************** 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__*/ diff --git a/openair3/NAS/UE/EMM/SAP/emm_esm.c b/openair3/NAS/UE/EMM/SAP/emm_esm.c index a12d71d79b..10b34f0a1d 100644 --- a/openair3/NAS/UE/EMM/SAP/emm_esm.c +++ b/openair3/NAS/UE/EMM/SAP/emm_esm.c @@ -108,7 +108,7 @@ void emm_esm_initialize(void) ** 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; @@ -123,7 +123,7 @@ int emm_esm_send(const emm_esm_t *msg) case _EMMESM_ESTABLISH_REQ: /* ESM requests EMM to initiate an attach procedure before * requesting subsequent connectivity to additional PDNs */ - rc = emm_proc_attach_restart(); + rc = emm_proc_attach_restart(user); break; case _EMMESM_ESTABLISH_CNF: @@ -138,7 +138,7 @@ int emm_esm_send(const emm_esm_t *msg) } } else { /* Consider the UE locally detached from the network */ - rc = emm_proc_attach_set_detach(); + rc = emm_proc_attach_set_detach(user); } break; @@ -149,7 +149,7 @@ int emm_esm_send(const emm_esm_t *msg) case _EMMESM_UNITDATA_REQ: /* 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; default: diff --git a/openair3/NAS/UE/EMM/SAP/emm_esm.h b/openair3/NAS/UE/EMM/SAP/emm_esm.h index 7a763d4759..11aa42213f 100644 --- a/openair3/NAS/UE/EMM/SAP/emm_esm.h +++ b/openair3/NAS/UE/EMM/SAP/emm_esm.h @@ -42,6 +42,7 @@ Description Defines the EMMESM Service Access Point that provides #define __EMM_ESM_H__ #include "emm_esmDef.h" +#include "user_defs.h" /****************************************************************************/ /********************* 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 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__*/ diff --git a/openair3/NAS/UE/EMM/SAP/emm_recv.c b/openair3/NAS/UE/EMM/SAP/emm_recv.c index 0ad41b09d8..5b7c6d7dda 100644 --- a/openair3/NAS/UE/EMM/SAP/emm_recv.c +++ b/openair3/NAS/UE/EMM/SAP/emm_recv.c @@ -125,7 +125,7 @@ int emm_recv_status(unsigned int ueid, emm_status_msg *msg, int *emm_cause) ** 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; @@ -224,7 +224,7 @@ int emm_recv_attach_accept(attach_accept_msg *msg, int *emm_cause) } /* 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, &msg->esmmessagecontainer.esmmessagecontainercontents); @@ -245,7 +245,7 @@ int emm_recv_attach_accept(attach_accept_msg *msg, int *emm_cause) ** 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; @@ -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) { /* 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); } else { /* 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); @@ -299,7 +299,7 @@ int emm_recv_attach_reject(attach_reject_msg *msg, int *emm_cause) ** 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; @@ -311,7 +311,7 @@ int emm_recv_detach_accept(detach_accept_msg *msg, int *emm_cause) * Message processing */ /* 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); } @@ -330,7 +330,7 @@ int emm_recv_detach_accept(detach_accept_msg *msg, int *emm_cause) ** 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; @@ -358,7 +358,7 @@ int emm_recv_identity_request(identity_request_msg *msg, int *emm_cause) } /* 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); } @@ -377,7 +377,7 @@ int emm_recv_identity_request(identity_request_msg *msg, int *emm_cause) ** 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) { LOG_FUNC_IN; @@ -404,7 +404,7 @@ int emm_recv_authentication_request(authentication_request_msg *msg, * Message processing */ /* 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.naskeysetidentifier, &msg->authenticationparameterrand.rand, @@ -427,7 +427,7 @@ int emm_recv_authentication_request(authentication_request_msg *msg, ** 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) { LOG_FUNC_IN; @@ -440,7 +440,7 @@ int emm_recv_authentication_reject(authentication_reject_msg *msg, * Message processing */ /* Execute the authentication procedure not accepted by the network */ - rc = emm_proc_authentication_reject(); + rc = emm_proc_authentication_reject(user); LOG_FUNC_RETURN (rc); } @@ -459,7 +459,7 @@ int emm_recv_authentication_reject(authentication_reject_msg *msg, ** 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) { LOG_FUNC_IN; @@ -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 */ 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.naskeysetidentifier, msg->selectednassecurityalgorithms.typeofcipheringalgorithm, diff --git a/openair3/NAS/UE/EMM/SAP/emm_recv.h b/openair3/NAS/UE/EMM/SAP/emm_recv.h index cec52a8c1f..ead59e3851 100644 --- a/openair3/NAS/UE/EMM/SAP/emm_recv.h +++ b/openair3/NAS/UE/EMM/SAP/emm_recv.h @@ -59,7 +59,7 @@ Description Defines functions executed at the EMMAS Service Access #include "EmmInformation.h" #include "DownlinkNasTransport.h" #include "CsServiceNotification.h" - +#include "user_defs.h" /****************************************************************************/ /********************* 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); * 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_reject(attach_reject_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(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_authentication_request(authentication_request_msg *msg, +int emm_recv_identity_request(nas_user_t *user, identity_request_msg *msg, int *emm_cause); +int emm_recv_authentication_request(nas_user_t *user, authentication_request_msg *msg, 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_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); #endif /* __EMM_RECV_H__*/ diff --git a/openair3/NAS/UE/EMM/SAP/emm_sap.c b/openair3/NAS/UE/EMM/SAP/emm_sap.c index d8312ee74c..6887982786 100644 --- a/openair3/NAS/UE/EMM/SAP/emm_sap.c +++ b/openair3/NAS/UE/EMM/SAP/emm_sap.c @@ -46,6 +46,7 @@ Description Defines the EMM Service Access Points at which the EPS #include "emm_reg.h" #include "emm_esm.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 ****************/ @@ -73,13 +74,13 @@ Description Defines the EMM Service Access Points at which the EPS ** Others: NONE ** ** ** ***************************************************************************/ -void emm_sap_initialize(void) +void emm_sap_initialize(nas_user_t *user) { LOG_FUNC_IN; emm_reg_initialize(); emm_esm_initialize(); - emm_as_initialize(); + emm_as_initialize(user); LOG_FUNC_OUT; } @@ -98,7 +99,7 @@ void emm_sap_initialize(void) ** 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; @@ -116,12 +117,12 @@ int emm_sap_send(emm_sap_t *msg) (primitive < (emm_primitive_t)EMMESM_PRIMITIVE_MAX) ) { /* Forward to the EMMESM-SAP */ 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) && (primitive < (emm_primitive_t)EMMAS_PRIMITIVE_MAX) ) { /* Forward to the EMMAS-SAP */ msg->u.emm_as.primitive = primitive; - rc = emm_as_send(&msg->u.emm_as); + rc = emm_as_send(user, &msg->u.emm_as); } else { LOG_TRACE(WARNING, "EMM-SAP - Out of range primitive (%d)", primitive); diff --git a/openair3/NAS/UE/EMM/SAP/emm_sap.h b/openair3/NAS/UE/EMM/SAP/emm_sap.h index f27e8d4e58..b84fd7808b 100644 --- a/openair3/NAS/UE/EMM/SAP/emm_sap.h +++ b/openair3/NAS/UE/EMM/SAP/emm_sap.h @@ -46,6 +46,7 @@ Description Defines the EMM Service Access Points at which the EPS #include "emm_regDef.h" #include "emm_esmDef.h" #include "emm_asDef.h" +#include "user_defs.h" /****************************************************************************/ /********************* G L O B A L C O N S T A N T 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 ******************/ /****************************************************************************/ -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__*/ diff --git a/openair3/NAS/UE/EMM/SecurityModeControl.c b/openair3/NAS/UE/EMM/SecurityModeControl.c index f27eb7b4af..05f094b22d 100644 --- a/openair3/NAS/UE/EMM/SecurityModeControl.c +++ b/openair3/NAS/UE/EMM/SecurityModeControl.c @@ -145,7 +145,7 @@ static void _security_release(emm_security_context_t *ctx); ** 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) { LOG_FUNC_IN; @@ -334,7 +334,7 @@ int emm_proc_security_mode_command(int native_ksi, int ksi, /* Setup EPS NAS security data */ emm_as_set_security_data(&emm_sap.u.emm_as.u.security.sctx, _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); } diff --git a/openair3/NAS/UE/EMM/emm_main.c b/openair3/NAS/UE/EMM/emm_main.c index 2eb4d8fa24..e3342ed3ba 100644 --- a/openair3/NAS/UE/EMM/emm_main.c +++ b/openair3/NAS/UE/EMM/emm_main.c @@ -100,7 +100,7 @@ static int _emm_main_callback(int); ** 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; @@ -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 */ - IdleMode_initialize(&_emm_main_callback); + IdleMode_initialize(user, &_emm_main_callback); LOG_FUNC_OUT; } diff --git a/openair3/NAS/UE/EMM/emm_main.h b/openair3/NAS/UE/EMM/emm_main.h index c41dc0b664..403a87507d 100644 --- a/openair3/NAS/UE/EMM/emm_main.h +++ b/openair3/NAS/UE/EMM/emm_main.h @@ -41,6 +41,7 @@ Description Defines the EPS Mobility Management procedure call manager, #include "commonDef.h" #include "networkDef.h" +#include "user_defs.h" /****************************************************************************/ /********************* 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, /****************** 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); diff --git a/openair3/NAS/UE/EMM/emm_proc.h b/openair3/NAS/UE/EMM/emm_proc.h index 60f71f11c2..8bfe447e50 100644 --- a/openair3/NAS/UE/EMM/emm_proc.h +++ b/openair3/NAS/UE/EMM/emm_proc.h @@ -42,6 +42,7 @@ Description Defines the EPS Mobility Management procedures executed at #include "commonDef.h" #include "OctetString.h" #include "LowerLayer.h" +#include "user_defs.h" /****************************************************************************/ /********************* G L O B A L C O N S T A N T S *******************/ @@ -92,7 +93,7 @@ typedef enum { *--------------------------------------------------------------------------- */ 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); * UE's Idle mode procedure *--------------------------------------------------------------------------- */ -int emm_proc_initialize(void); -int emm_proc_plmn_selection(int index); -int emm_proc_plmn_selection_end(int found, tac_t tac, ci_t ci, AcT_t rat); +int emm_proc_initialize(nas_user_t *user); +int emm_proc_plmn_selection(nas_user_t *user, int index); +int emm_proc_plmn_selection_end(nas_user_t *user, int found, tac_t tac, ci_t ci, AcT_t rat); /* * -------------------------------------------------------------------------- * 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_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, 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_failure(int is_initial, 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_detach(void); +// FIXME check prototype +int emm_proc_attach_set_detach(void *user); @@ -142,9 +144,9 @@ int emm_proc_attach_set_detach(void); * 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_accept(void); +int emm_proc_detach_accept(void *args); int emm_proc_detach_failure(int is_initial, void *args); int emm_proc_detach_release(void *args); @@ -154,7 +156,7 @@ int emm_proc_detach_release(void *args); * 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); * 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); -int emm_proc_authentication_reject(void); +int emm_proc_authentication_reject(nas_user_t *user); int emm_proc_authentication_delete(void); @@ -173,8 +175,8 @@ int emm_proc_authentication_delete(void); * Security mode control procedure * -------------------------------------------------------------------------- */ -int emm_proc_security_mode_command(int native_ksi, int ksi, int seea, int seia, - int reea, int reia,int imeisv_request); +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); /* *--------------------------------------------------------------------------- diff --git a/openair3/NAS/UE/ESM/DedicatedEpsBearerContextActivation.c b/openair3/NAS/UE/ESM/DedicatedEpsBearerContextActivation.c index 0ce27b1fcf..1863b14a34 100644 --- a/openair3/NAS/UE/ESM/DedicatedEpsBearerContextActivation.c +++ b/openair3/NAS/UE/ESM/DedicatedEpsBearerContextActivation.c @@ -104,13 +104,13 @@ Description Defines the dedicated EPS bearer context activation ESM ** 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_tft_t *tft, int *esm_cause) { LOG_FUNC_IN; - + esm_data_t *esm_data = _esm_data; int rc = RETURNerror; 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, int old_pid, old_bid; /* Locally deactivate the existing EPS bearer context and proceed * 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); if (rc != RETURNok) { @@ -206,7 +206,7 @@ int esm_proc_dedicated_eps_bearer_context_request(esm_data_t *esm_data, int ebi, ** 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) { LOG_FUNC_IN; @@ -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_esm->msg.length = msg->length; emm_esm->msg.value = msg->value; - rc = emm_sap_send(&emm_sap); + rc = emm_sap_send(user, &emm_sap); if (rc != RETURNerror) { /* 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, ** 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) { LOG_FUNC_IN; @@ -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_esm->msg.length = msg->length; emm_esm->msg.value = msg->value; - rc = emm_sap_send(&emm_sap); + rc = emm_sap_send(user, &emm_sap); } LOG_FUNC_RETURN (rc); diff --git a/openair3/NAS/UE/ESM/DefaultEpsBearerContextActivation.c b/openair3/NAS/UE/ESM/DefaultEpsBearerContextActivation.c index 0d1a307c96..21dc81cdf5 100644 --- a/openair3/NAS/UE/ESM/DefaultEpsBearerContextActivation.c +++ b/openair3/NAS/UE/ESM/DefaultEpsBearerContextActivation.c @@ -104,12 +104,12 @@ static struct { ** 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, int *esm_cause) { LOG_FUNC_IN; - + esm_data_t *esm_data = _esm_data; int rc = RETURNerror; 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 int old_pid, old_bid; /* Locally deactivate the existing EPS bearer context and proceed * 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); if (rc != RETURNok) { @@ -188,7 +188,7 @@ int esm_proc_default_eps_bearer_context_request(esm_data_t *esm_data, int pid, i ** 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) { LOG_FUNC_IN; @@ -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_esm->msg.length = msg->length; emm_esm->msg.value = msg->value; - rc = emm_sap_send(&emm_sap); + rc = emm_sap_send(user, &emm_sap); } if (rc != RETURNerror) { @@ -256,7 +256,7 @@ int esm_proc_default_eps_bearer_context_accept(int is_standalone, int ebi, ** 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) { LOG_FUNC_IN; @@ -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_esm->msg.length = msg->length; emm_esm->msg.value = msg->value; - rc = emm_sap_send(&emm_sap); + rc = emm_sap_send(user, &emm_sap); } else { /* An error is returned to notify EMM that the default EPS bearer * activation procedure initiated as part of the initial attach @@ -346,7 +346,7 @@ int esm_proc_default_eps_bearer_context_complete(void) ** 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; @@ -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"); /* 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) { /* Reset default EPS bearer context internal data */ diff --git a/openair3/NAS/UE/ESM/EpsBearerContextDeactivation.c b/openair3/NAS/UE/ESM/EpsBearerContextDeactivation.c index 21aaeb262a..2bafb9c18e 100644 --- a/openair3/NAS/UE/ESM/EpsBearerContextDeactivation.c +++ b/openair3/NAS/UE/ESM/EpsBearerContextDeactivation.c @@ -74,7 +74,7 @@ Description Defines the EPS bearer context deactivation ESM procedure * 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 ** 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) { LOG_FUNC_IN; int rc = RETURNerror; int i; - + esm_data_t *esm_data = _esm_data; if (is_local) { if (ebi != ESM_SAP_ALL_EBI) { /* Locally release the EPS bearer context */ - rc = _eps_bearer_release(esm_data, ebi, pid, bid); + rc = _eps_bearer_release(user, ebi, pid, bid); } else { /* Locally release all the EPS bearer contexts */ *bid = 0; for (*pid = 0; *pid < ESM_DATA_PDN_MAX; (*pid)++) { 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) { break; @@ -189,18 +189,19 @@ int esm_proc_eps_bearer_context_deactivate(esm_data_t *esm_data, int is_local, i ** 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; int pid, bid; int rc = RETURNok; + esm_data_t *esm_data = _esm_data; LOG_TRACE(INFO, "ESM-PROC - EPS bearer context deactivation " "requested by the network (ebi=%d)", ebi); /* 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"); *esm_cause = ESM_CAUSE_PROTOCOL_ERROR; LOG_FUNC_RETURN (RETURNerror); @@ -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.data.pdn_connect.is_defined = TRUE; 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 ** 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) { LOG_FUNC_IN; @@ -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.u.data.msg.length = msg->length; 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) { @@ -352,14 +353,14 @@ int esm_proc_eps_bearer_context_deactivate_accept(int is_standalone, int ebi, ** 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; int rc = RETURNerror; /* 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) { LOG_TRACE(WARNING, "ESM-PROC - Failed to release EPS bearer context"); diff --git a/openair3/NAS/UE/ESM/EsmStatusHdl.c b/openair3/NAS/UE/ESM/EsmStatusHdl.c index 48e86f4a60..f42cdb02ae 100644 --- a/openair3/NAS/UE/ESM/EsmStatusHdl.c +++ b/openair3/NAS/UE/ESM/EsmStatusHdl.c @@ -161,7 +161,7 @@ int esm_proc_status_ind( ** 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 ue_triggered) { @@ -179,7 +179,7 @@ int esm_proc_status(int is_standalone, 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.value = msg->value; - rc = emm_sap_send(&emm_sap); + rc = emm_sap_send(user, &emm_sap); LOG_FUNC_RETURN (rc); } diff --git a/openair3/NAS/UE/ESM/PdnConnectivity.c b/openair3/NAS/UE/ESM/PdnConnectivity.c index 46be3fef14..161e88669a 100644 --- a/openair3/NAS/UE/ESM/PdnConnectivity.c +++ b/openair3/NAS/UE/ESM/PdnConnectivity.c @@ -279,7 +279,7 @@ int esm_proc_pdn_connectivity(esm_data_t *esm_data, int cid, int is_to_define, ** 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) { LOG_FUNC_IN; @@ -298,7 +298,7 @@ int esm_proc_pdn_connectivity_request(int is_standalone, int pti, emm_sap.u.emm_esm.ueid = 0; emm_esm->msg.length = msg->length; emm_esm->msg.value = msg->value; - rc = emm_sap_send(&emm_sap); + rc = emm_sap_send(user, &emm_sap); if (rc != RETURNerror) { /* Start T3482 retransmission timer */ @@ -346,12 +346,12 @@ int esm_proc_pdn_connectivity_request(int is_standalone, int pti, ** 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 *apn, int *esm_cause) { LOG_FUNC_IN; - + esm_data_t *esm_data = _esm_data; int rc; int pid = RETURNerror; 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 ** 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; @@ -489,7 +489,7 @@ int esm_proc_pdn_connectivity_reject(int pti, int *esm_cause) ** Others: None ** ** ** ***************************************************************************/ -int esm_proc_pdn_connectivity_complete(void) +int esm_proc_pdn_connectivity_complete(nas_user_t *user) { LOG_FUNC_IN; @@ -530,7 +530,7 @@ int esm_proc_pdn_connectivity_complete(void) ** 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; @@ -603,6 +603,7 @@ int esm_proc_pdn_connectivity_failure(int is_pending) ** Others: None ** ** ** ***************************************************************************/ +// FIXME static void *_pdn_connectivity_t3482_handler(void *args) { LOG_FUNC_IN; @@ -610,7 +611,8 @@ static void *_pdn_connectivity_t3482_handler(void *args) int rc; /* 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 */ data->count += 1; @@ -629,7 +631,7 @@ static void *_pdn_connectivity_t3482_handler(void *args) emm_sap.u.emm_esm.ueid = 0; emm_esm->msg.length = data->msg.length; emm_esm->msg.value = data->msg.value; - rc = emm_sap_send(&emm_sap); + rc = emm_sap_send(user, &emm_sap); if (rc != RETURNerror) { /* Restart the timer T3482 */ diff --git a/openair3/NAS/UE/ESM/PdnDisconnect.c b/openair3/NAS/UE/ESM/PdnDisconnect.c index 082463aa46..18ffe34a99 100644 --- a/openair3/NAS/UE/ESM/PdnDisconnect.c +++ b/openair3/NAS/UE/ESM/PdnDisconnect.c @@ -168,7 +168,7 @@ int esm_proc_pdn_disconnect(esm_data_t *esm_data, int cid, unsigned int *pti, un ** 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) { LOG_FUNC_IN; @@ -187,7 +187,7 @@ int esm_proc_pdn_disconnect_request(int is_standalone, int pti, emm_sap.u.emm_esm.ueid = 0; emm_esm->msg.length = msg->length; emm_esm->msg.value = msg->value; - rc = emm_sap_send(&emm_sap); + rc = emm_sap_send(user, &emm_sap); if (rc != RETURNerror) { /* Start T3482 retransmission timer */ @@ -284,10 +284,10 @@ int esm_proc_pdn_disconnect_accept(int pti, int *esm_cause) ** 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; - + esm_data_t *esm_data = _esm_data; int rc; 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 esm_sap.recv = NULL; esm_sap.send.length = 0; 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) { *esm_cause = ESM_CAUSE_PROTOCOL_ERROR; @@ -383,7 +383,8 @@ static void *_pdn_disconnect_t3492_handler(void *args) { LOG_FUNC_IN; // FIXME check callback call - esm_data_t *esm_data = args;; + nas_user_t *user = args; + esm_data_t *esm_data = _esm_data;; int rc; /* Get retransmission timer parameters data */ @@ -406,7 +407,7 @@ static void *_pdn_disconnect_t3492_handler(void *args) emm_sap.u.emm_esm.ueid = 0; emm_esm->msg.length = data->msg.length; emm_esm->msg.value = data->msg.value; - rc = emm_sap_send(&emm_sap); + rc = emm_sap_send(user, &emm_sap); if (rc != RETURNerror) { /* Restart the timer T3492 */ @@ -449,7 +450,7 @@ static void *_pdn_disconnect_t3492_handler(void *args) esm_sap.recv = NULL; esm_sap.send.length = 0; esm_sap.data.eps_bearer_context_deactivate.ebi = ebi; - rc = esm_sap_send(&esm_sap); + rc = esm_sap_send(user, &esm_sap); } } } diff --git a/openair3/NAS/UE/ESM/SAP/esm_recv.c b/openair3/NAS/UE/ESM/SAP/esm_recv.c index 63262c6829..ecf9dedcbe 100644 --- a/openair3/NAS/UE/ESM/SAP/esm_recv.c +++ b/openair3/NAS/UE/ESM/SAP/esm_recv.c @@ -135,7 +135,7 @@ int esm_recv_status(int pti, int ebi, const esm_status_msg *msg) ** 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) { LOG_FUNC_IN; @@ -179,7 +179,7 @@ int esm_recv_pdn_connectivity_reject(esm_data_t *esm_data, int pti, int ebi, esm_cause = msg->esmcause; /* 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) { esm_cause = ESM_CAUSE_SUCCESS; @@ -206,7 +206,7 @@ int esm_recv_pdn_connectivity_reject(esm_data_t *esm_data, int pti, int ebi, ** 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) { LOG_FUNC_IN; @@ -250,7 +250,7 @@ int esm_recv_pdn_disconnect_reject(esm_data_t *esm_data, int pti, int ebi, esm_cause = msg->esmcause; /* 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) { esm_cause = ESM_CAUSE_SUCCESS; @@ -278,11 +278,10 @@ int esm_recv_pdn_disconnect_reject(esm_data_t *esm_data, int pti, int ebi, ** 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) { LOG_FUNC_IN; - int esm_cause = ESM_CAUSE_SUCCESS; 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 } /* 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->accesspointname.accesspointnamevalue, &esm_cause); if (pid != RETURNerror) { /* 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); if (rc != RETURNerror) { @@ -406,7 +405,7 @@ int esm_recv_activate_default_eps_bearer_context_request(esm_data_t *esm_data, i ** 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) { LOG_FUNC_IN; @@ -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 */ - 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, &qos, &tft, &esm_cause); @@ -614,7 +613,7 @@ int esm_recv_activate_dedicated_eps_bearer_context_request(esm_data_t *esm_data, ** 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) { LOG_FUNC_IN; @@ -670,7 +669,7 @@ int esm_recv_deactivate_eps_bearer_context_request(esm_data_t *esm_data, int pti if (rc != RETURNerror) { /* 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) { esm_cause = ESM_CAUSE_SUCCESS; diff --git a/openair3/NAS/UE/ESM/SAP/esm_recv.h b/openair3/NAS/UE/ESM/SAP/esm_recv.h index f1641bd939..ae36d650e3 100644 --- a/openair3/NAS/UE/ESM/SAP/esm_recv.h +++ b/openair3/NAS/UE/ESM/SAP/esm_recv.h @@ -42,6 +42,7 @@ Description Defines functions executed at the ESM Service Access #include "EsmStatus.h" #include "emmData.h" +#include "user_defs.h" #include "PdnConnectivityReject.h" #include "PdnDisconnectReject.h" @@ -88,23 +89,23 @@ int esm_recv_status(int pti, int ebi, const esm_status_msg *msg); * 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); -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); /* * 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); -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); -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); diff --git a/openair3/NAS/UE/ESM/SAP/esm_sap.c b/openair3/NAS/UE/ESM/SAP/esm_sap.c index ca9e0c2c6f..dbc6925175 100644 --- a/openair3/NAS/UE/ESM/SAP/esm_sap.c +++ b/openair3/NAS/UE/ESM/SAP/esm_sap.c @@ -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 *******************/ /****************************************************************************/ -// FIXME NOT SURE FOR THIS ONE -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, 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); @@ -145,7 +144,7 @@ void esm_sap_initialize(void) ** 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; // FIXME @@ -193,7 +192,7 @@ int esm_sap_send(esm_sap_t *msg) if (rc != RETURNerror) { /* Send PDN connectivity request */ - rc = _esm_sap_send(PDN_CONNECTIVITY_REQUEST, + rc = _esm_sap_send(user, PDN_CONNECTIVITY_REQUEST, msg->is_standalone, pti, EPS_BEARER_IDENTITY_UNASSIGNED, &msg->data, &msg->send); @@ -214,11 +213,11 @@ int esm_sap_send(esm_sap_t *msg) pdn_connect->is_emergency, NULL); } else if (msg->recv != NULL) { /* 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); } else { /* The PDN connectivity procedure locally failed */ - rc = esm_proc_pdn_connectivity_failure(TRUE); + rc = esm_proc_pdn_connectivity_failure(user, TRUE); } } break; @@ -234,7 +233,7 @@ int esm_sap_send(esm_sap_t *msg) if (rc != RETURNerror) { /* 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); } } @@ -257,7 +256,7 @@ int esm_sap_send(esm_sap_t *msg) case ESM_DEFAULT_EPS_BEARER_CONTEXT_ACTIVATE_REQ: /* 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->recv, &msg->send, &msg->err); break; @@ -270,7 +269,7 @@ int esm_sap_send(esm_sap_t *msg) rc = esm_proc_default_eps_bearer_context_complete(); if (rc != RETURNerror) { - rc = esm_proc_pdn_connectivity_complete(); + rc = esm_proc_pdn_connectivity_complete(user); } break; @@ -279,10 +278,10 @@ int esm_sap_send(esm_sap_t *msg) /* * 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) { - rc = esm_proc_pdn_connectivity_failure(FALSE); + rc = esm_proc_pdn_connectivity_failure(user, FALSE); } break; @@ -310,7 +309,7 @@ int esm_sap_send(esm_sap_t *msg) /* * 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); } break; @@ -319,7 +318,7 @@ int esm_sap_send(esm_sap_t *msg) break; 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); break; @@ -364,7 +363,7 @@ int esm_sap_send(esm_sap_t *msg) ** 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, 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, * received from the MME */ 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); 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, * received from the MME */ 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); 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, * Process deactivate EPS bearer context request message * 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); 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, /* * 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); 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, /* * 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); 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, } /* 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) { /* 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, ** 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, OctetString *rsp) { @@ -784,7 +783,7 @@ static int _esm_sap_send(int msg_type, int is_standalone, /* Execute the relevant 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); } } diff --git a/openair3/NAS/UE/ESM/SAP/esm_sap.h b/openair3/NAS/UE/ESM/SAP/esm_sap.h index 7364a4b661..b464e18900 100644 --- a/openair3/NAS/UE/ESM/SAP/esm_sap.h +++ b/openair3/NAS/UE/ESM/SAP/esm_sap.h @@ -41,6 +41,7 @@ Description Defines the ESM Service Access Points at which the EPS #define __ESM_SAP_H__ #include "esm_sapDef.h" +#include "user_defs.h" /****************************************************************************/ /********************* 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 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__*/ diff --git a/openair3/NAS/UE/ESM/esm_ebr_context.c b/openair3/NAS/UE/ESM/esm_ebr_context.c index 48b8c83bba..d678ad2ec5 100644 --- a/openair3/NAS/UE/ESM/esm_ebr_context.c +++ b/openair3/NAS/UE/ESM/esm_ebr_context.c @@ -330,8 +330,7 @@ int esm_ebr_context_create( ** Others: _esm_data ** ** ** ***************************************************************************/ -int esm_ebr_context_release( - esm_data_t *esm_data, +int esm_ebr_context_release(nas_user_t *user, int ebi, int *pid, int *bid) { int found = FALSE; @@ -342,7 +341,7 @@ int esm_ebr_context_release( LOG_FUNC_IN; - esm_ctx = esm_data; + esm_ctx = _esm_data; if (ebi != ESM_EBI_UNASSIGNED) { /* @@ -492,7 +491,7 @@ int esm_ebr_context_release( emm_sap_t emm_sap; emm_sap.primitive = EMMESM_ESTABLISH_CNF; 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 * If due to the EPS bearer context deactivation only the PDN @@ -505,7 +504,7 @@ int esm_ebr_context_release( emm_sap.primitive = EMMESM_ESTABLISH_CNF; emm_sap.u.emm_esm.u.establish.is_attached = 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); diff --git a/openair3/NAS/UE/ESM/esm_ebr_context.h b/openair3/NAS/UE/ESM/esm_ebr_context.h index 739ee0d3fe..ceb6553846 100644 --- a/openair3/NAS/UE/ESM/esm_ebr_context.h +++ b/openair3/NAS/UE/ESM/esm_ebr_context.h @@ -39,6 +39,7 @@ Description Defines functions used to handle EPS bearer contexts. #define __ESM_EBR_CONTEXT_H__ #include "networkDef.h" +#include "user_defs.h" /****************************************************************************/ /********************* G L O B A L C O N S T A N T S *******************/ @@ -68,7 +69,7 @@ typedef enum { 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); -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); diff --git a/openair3/NAS/UE/ESM/esm_proc.h b/openair3/NAS/UE/ESM/esm_proc.h index 7f29166bbf..9b533c6117 100644 --- a/openair3/NAS/UE/ESM/esm_proc.h +++ b/openair3/NAS/UE/ESM/esm_proc.h @@ -43,6 +43,7 @@ Description Defines the EPS Session Management procedures executed at #include "OctetString.h" #include "emmData.h" #include "ProtocolConfigurationOptions.h" +#include "user_defs.h" /****************************************************************************/ /********************* G L O B A L C O N S T A N T S *******************/ @@ -78,7 +79,7 @@ typedef enum { * Type of the ESM procedure callback executed when requested by the UE * 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 */ typedef network_qos_t esm_proc_qos_t; @@ -112,7 +113,7 @@ typedef struct { * -------------------------------------------------------------------------- */ 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); @@ -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, esm_proc_pdn_type_t pdn_type, const OctetString *apn, int is_emergency, 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); -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); -int esm_proc_pdn_connectivity_reject(int pti, int *esm_cause); -int esm_proc_pdn_connectivity_complete(void); -int esm_proc_pdn_connectivity_failure(int is_pending); +int esm_proc_pdn_connectivity_reject(nas_user_t *user, int pti, int *esm_cause); +int esm_proc_pdn_connectivity_complete(nas_user_t *user); +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); * -------------------------------------------------------------------------- */ 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); 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 * -------------------------------------------------------------------------- */ -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); 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); -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); /* @@ -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); -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); -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); /* @@ -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 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); #endif /* __ESM_PROC_H__*/ diff --git a/openair3/NAS/UE/ESM/esm_pt.c b/openair3/NAS/UE/ESM/esm_pt.c index 8e819fbd0b..1d8c8bc525 100644 --- a/openair3/NAS/UE/ESM/esm_pt.c +++ b/openair3/NAS/UE/ESM/esm_pt.c @@ -308,6 +308,7 @@ int esm_pt_start_timer(int pti, const OctetString *msg, * time interval */ ctx->timer.id = nas_timer_start(sec, cb, ctx->args); ctx->timer.sec = sec; + // FIXME add user } } diff --git a/openair3/NAS/UE/ESM/esm_pt.h b/openair3/NAS/UE/ESM/esm_pt.h index 7cc0c54780..c39d7f98bd 100644 --- a/openair3/NAS/UE/ESM/esm_pt.h +++ b/openair3/NAS/UE/ESM/esm_pt.h @@ -40,6 +40,7 @@ Description Defines functions used to handle ESM procedure transactions. #include "OctetString.h" #include "nas_timer.h" +#include "user_defs.h" #include "ProcedureTransactionIdentity.h" @@ -67,6 +68,7 @@ typedef struct { unsigned char pti; /* Procedure transaction identity */ unsigned int count; /* Retransmission counter */ OctetString msg; /* Encoded ESM message to re-transmit */ + nas_user_t *user; /* user reference */ } esm_pt_timer_data_t; /****************************************************************************/ diff --git a/openair3/NAS/UE/nas_proc.c b/openair3/NAS/UE/nas_proc.c index 17397a01a9..112ac62de2 100644 --- a/openair3/NAS/UE/nas_proc.c +++ b/openair3/NAS/UE/nas_proc.c @@ -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; /* Initialize the EMM procedure manager */ - emm_main_initialize(emm_cb, imei); + emm_main_initialize(user, emm_cb, imei); /* Initialize the ESM procedure manager */ _esm_data = esm_main_initialize(esm_cb); @@ -175,7 +175,7 @@ int nas_proc_enable_s1_mode(nas_user_t *user) */ user->proc.EPS_capability_status = TRUE; emm_sap.primitive = EMMREG_S1_ENABLED; - rc = emm_sap_send(&emm_sap); + rc = emm_sap_send(user, &emm_sap); LOG_FUNC_RETURN (rc); } @@ -208,7 +208,7 @@ int nas_proc_disable_s1_mode(nas_user_t *user) */ user->proc.EPS_capability_status = FALSE; emm_sap.primitive = EMMREG_S1_DISABLED; - rc = emm_sap_send(&emm_sap); + rc = emm_sap_send(user, &emm_sap); LOG_FUNC_RETURN (rc); } @@ -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.primitive = EMMREG_REGISTER_REQ; 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); @@ -574,7 +574,7 @@ int nas_proc_detach(nas_user_t *user, int switch_off) /* Initiate an Detach procedure */ emm_sap.primitive = EMMREG_DETACH_INIT; 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); @@ -605,7 +605,7 @@ int nas_proc_attach(nas_user_t *user) /* Initiate an Attach procedure */ emm_sap.primitive = EMMREG_ATTACH_INIT; 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); @@ -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 * the specified APN */ - rc = esm_sap_send(&esm_sap); + rc = esm_sap_send(user, &esm_sap); LOG_FUNC_RETURN (rc); } @@ -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 */ - rc = esm_sap_send(&esm_sap); + rc = esm_sap_send(user, &esm_sap); 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 emm_sap.u.emm_as.u.cell_info.tac = tac; 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); } @@ -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.u.emm_as.u.establish.NASmsg.length = len; 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); } @@ -1106,7 +1106,7 @@ int nas_proc_establish_rej(nas_user_t *user) * from lower layers */ emm_sap.primitive = EMMAS_ESTABLISH_REJ; - rc = emm_sap_send(&emm_sap); + rc = emm_sap_send(user, &emm_sap); LOG_FUNC_RETURN (rc); } @@ -1139,7 +1139,7 @@ int nas_proc_release_ind(nas_user_t *user, int cause) */ emm_sap.primitive = EMMAS_RELEASE_IND; 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); } @@ -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.delivered = TRUE; 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); } @@ -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.delivered = FALSE; 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); } @@ -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.NASmsg.length = len; 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); @@ -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.data.pdn_connect.is_defined = TRUE; esm_sap.data.pdn_connect.cid = cid; - rc = esm_sap_send(&esm_sap); + rc = esm_sap_send(user, &esm_sap); LOG_FUNC_RETURN (rc); } @@ -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.primitive = ESM_PDN_DISCONNECT_REQ; esm_sap.data.pdn_disconnect.cid = cid; - rc = esm_sap_send(&esm_sap); + rc = esm_sap_send(user, &esm_sap); } else { /* For EPS, if an attempt is made to disconnect the last PDN * connection, then the MT responds with an error */