diff --git a/openair3/NAS/UE/ESM/DefaultEpsBearerContextActivation.c b/openair3/NAS/UE/ESM/DefaultEpsBearerContextActivation.c index 68d1ce8eab1ed67e3e03f30716c986eb2bc8d7ba..02d5671808f44b38f6d0c7af5c99538cf5f80f02 100644 --- a/openair3/NAS/UE/ESM/DefaultEpsBearerContextActivation.c +++ b/openair3/NAS/UE/ESM/DefaultEpsBearerContextActivation.c @@ -63,19 +63,6 @@ Description Defines the default EPS bearer context activation ESM /******************* L O C A L D E F I N I T I O N S *******************/ /****************************************************************************/ -/* - * -------------------------------------------------------------------------- - * Internal data handled by the default EPS bearer context activation - * procedure in the UE - * -------------------------------------------------------------------------- - */ -static struct { - int ebi; /* EPS bearer identity of the default EPS bearer associated - * to the PDN connection to be activated */ -} _default_eps_bearer_context_data = {ESM_EBI_UNASSIGNED}; - - - /****************************************************************************/ /****************** E X P O R T E D F U N C T I O N S ******************/ /****************************************************************************/ @@ -101,7 +88,6 @@ static struct { ** Outputs: esm_cause: Cause code returned upon ESM procedure ** ** failure ** ** Return: RETURNok, RETURNerror ** - ** Others: _default_eps_bearer_context_data ** ** ** ***************************************************************************/ int esm_proc_default_eps_bearer_context_request(nas_user_t *user, int pid, int ebi, @@ -110,6 +96,7 @@ int esm_proc_default_eps_bearer_context_request(nas_user_t *user, int pid, int e { LOG_FUNC_IN; esm_data_t *esm_data = user->esm_data; + default_eps_bearer_context_data_t *default_eps_bearer_context_data = user->default_eps_bearer_context_data; int rc = RETURNerror; LOG_TRACE(INFO, "ESM-PROC - Default EPS bearer context activation " @@ -144,7 +131,7 @@ int esm_proc_default_eps_bearer_context_request(nas_user_t *user, int pid, int e if (ebi != ESM_EBI_UNASSIGNED) { /* Default EPS bearer contextx successfully created */ - _default_eps_bearer_context_data.ebi = ebi; + default_eps_bearer_context_data->ebi = ebi; rc = RETURNok; } else { /* No resource available */ @@ -311,10 +298,9 @@ int esm_proc_default_eps_bearer_context_reject(nas_user_t *user, int is_standalo ** ** ** Outputs: None ** ** Return: RETURNok, RETURNerror ** - ** Others: _default_eps_bearer_context_data ** ** ** ***************************************************************************/ -int esm_proc_default_eps_bearer_context_complete(void) +int esm_proc_default_eps_bearer_context_complete(default_eps_bearer_context_data_t *default_eps_bearer_context_data) { LOG_FUNC_IN; @@ -322,7 +308,7 @@ int esm_proc_default_eps_bearer_context_complete(void) "ESM-PROC - Default EPS bearer context activation complete"); /* Reset default EPS bearer context internal data */ - _default_eps_bearer_context_data.ebi = ESM_EBI_UNASSIGNED; + default_eps_bearer_context_data->ebi = ESM_EBI_UNASSIGNED; LOG_FUNC_RETURN (RETURNok); } @@ -340,18 +326,17 @@ int esm_proc_default_eps_bearer_context_complete(void) ** ACCEPT message was sent. ** ** ** ** Inputs: None ** - ** Others: _default_eps_bearer_context_data ** ** ** ** Outputs: None ** ** Return: RETURNok, RETURNerror ** - ** Others: _default_eps_bearer_context_data ** ** ** ***************************************************************************/ int esm_proc_default_eps_bearer_context_failure(nas_user_t *user) { LOG_FUNC_IN; + default_eps_bearer_context_data_t *default_eps_bearer_context_data = user->default_eps_bearer_context_data; - int ebi = _default_eps_bearer_context_data.ebi; + int ebi = default_eps_bearer_context_data->ebi; int pid, bid; LOG_TRACE(WARNING, @@ -362,18 +347,8 @@ int esm_proc_default_eps_bearer_context_failure(nas_user_t *user) if (rc != RETURNerror) { /* Reset default EPS bearer context internal data */ - _default_eps_bearer_context_data.ebi = ESM_EBI_UNASSIGNED; + default_eps_bearer_context_data->ebi = ESM_EBI_UNASSIGNED; } LOG_FUNC_RETURN (rc); } - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - -/* - * -------------------------------------------------------------------------- - * Timer handlers - * -------------------------------------------------------------------------- - */ diff --git a/openair3/NAS/UE/ESM/SAP/esm_sap.c b/openair3/NAS/UE/ESM/SAP/esm_sap.c index ae895af3e966a6813cf20f46b63829d54a4f351c..7ff1e57380bbb20b1dfb8b444593edd202809e87 100644 --- a/openair3/NAS/UE/ESM/SAP/esm_sap.c +++ b/openair3/NAS/UE/ESM/SAP/esm_sap.c @@ -260,7 +260,7 @@ int esm_sap_send(nas_user_t *user, esm_sap_t *msg) * The activate default ESP bearer context accept message * has been successfully delivered to the other side */ - rc = esm_proc_default_eps_bearer_context_complete(); + rc = esm_proc_default_eps_bearer_context_complete(user->default_eps_bearer_context_data); if (rc != RETURNerror) { rc = esm_proc_pdn_connectivity_complete(user); diff --git a/openair3/NAS/UE/ESM/esmData.h b/openair3/NAS/UE/ESM/esmData.h index 75947dabc938d69a018003a8b738dbe2f8005011..ef7f523435664132d2e49358d45f60f44b0ac557 100644 --- a/openair3/NAS/UE/ESM/esmData.h +++ b/openair3/NAS/UE/ESM/esmData.h @@ -58,6 +58,17 @@ Description Defines internal private data handled by EPS Session /************************ G L O B A L T Y P E S ************************/ /****************************************************************************/ +/* + * -------------------------------------------------------------------------- + * Internal data handled by the default EPS bearer context activation + * procedure in the UE + * -------------------------------------------------------------------------- + */ +typedef struct { + int ebi; /* EPS bearer identity of the default EPS bearer associated + * to the PDN connection to be activated */ +} default_eps_bearer_context_data_t; + /* * Minimal and maximal value of an EPS bearer identity: * The EPS Bearer Identity (EBI) identifies a message flow @@ -73,8 +84,6 @@ typedef enum { ESM_EBR_STATE_MAX } esm_ebr_state; - - /* * ----------------------- * EPS bearer context data diff --git a/openair3/NAS/UE/ESM/esm_main.c b/openair3/NAS/UE/ESM/esm_main.c index f79b40cfecf689b0d94d139353f99ea9c35015f6..1b4099ce5b1ddb1772c7be053993b891af8cb67f 100644 --- a/openair3/NAS/UE/ESM/esm_main.c +++ b/openair3/NAS/UE/ESM/esm_main.c @@ -77,12 +77,21 @@ void esm_main_initialize(nas_user_t *user, esm_indication_callback_t cb) LOG_FUNC_IN; int i; + esm_data_t *esm_data = calloc(1, sizeof(esm_data_t)); if ( esm_data == NULL ) { LOG_TRACE(ERROR, "ESM-MAIN - Can't malloc esm_data"); // FIXME Stop here !!! } user->esm_data = esm_data; + + default_eps_bearer_context_data_t *default_eps_bearer_context = calloc(1, sizeof(default_eps_bearer_context_data_t)); + if ( default_eps_bearer_context == NULL ) { + LOG_TRACE(ERROR, "ESM-MAIN - Can't malloc default_eps_bearer_context"); + // FIXME Stop here !!! + } + default_eps_bearer_context->ebi = ESM_EBI_UNASSIGNED; + user->default_eps_bearer_context_data = default_eps_bearer_context; /* Total number of active EPS bearer contexts */ esm_data->n_ebrs = 0; /* List of active PDN connections */ diff --git a/openair3/NAS/UE/ESM/esm_proc.h b/openair3/NAS/UE/ESM/esm_proc.h index 7ea23015e8f845e4a114a72d810a4fb7279e735c..3d7260b83b7400c8a8d140dc648c7937fa9c6194 100644 --- a/openair3/NAS/UE/ESM/esm_proc.h +++ b/openair3/NAS/UE/ESM/esm_proc.h @@ -154,7 +154,7 @@ int esm_proc_pdn_disconnect_reject(nas_user_t *user, int pti, int *esm_cause); 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_complete(default_eps_bearer_context_data_t *default_eps_bearer_context_data); int esm_proc_default_eps_bearer_context_failure(nas_user_t *user); int esm_proc_default_eps_bearer_context_accept(nas_user_t *user, int is_standalone, int ebi, diff --git a/openair3/NAS/UE/user_defs.h b/openair3/NAS/UE/user_defs.h index 685e5c05e982ed4102fc4dd2dee6001f81c05391..0661543047770fb27f12c65c010aae7d15cc5e03 100644 --- a/openair3/NAS/UE/user_defs.h +++ b/openair3/NAS/UE/user_defs.h @@ -64,6 +64,7 @@ typedef struct { esm_data_t *esm_data; // ESM internal data (used within ESM only) esm_pt_data_t *esm_pt_data; esm_ebr_data_t *esm_ebr_data; // EPS bearer contexts + default_eps_bearer_context_data_t *default_eps_bearer_context_data; // Eps Mobility Management emm_fsm_state_t emm_fsm_status; // Current EPS Mobility Management status emm_data_t *emm_data; // EPS mobility management data