Commit 46438c7c authored by Frédéric Leroy's avatar Frédéric Leroy

UE/ESM: move _default_eps_bearer_context_data to nas_user_t

parent 404c3461
......@@ -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
* --------------------------------------------------------------------------
*/
......@@ -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);
......
......@@ -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
......
......@@ -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 */
......
......@@ -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,
......
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment