Commit 708013af authored by Cedric Roux's avatar Cedric Roux

- Mapped ESM/EBR data context to EMM data context in NAS MME

- Corrected Initial context setup req message

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4778 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent 56440427
......@@ -3,16 +3,16 @@
#ifndef NAS_MESSAGES_TYPES_H_
#define NAS_MESSAGES_TYPES_H_
#define NAS_UL_DATA_IND(mSGpTR) (mSGpTR)->ittiMsg.nas_ul_data_ind
#define NAS_DL_DATA_REQ(mSGpTR) (mSGpTR)->ittiMsg.nas_dl_data_req
#define NAS_DL_DATA_CNF(mSGpTR) (mSGpTR)->ittiMsg.nas_dl_data_cnf
#define NAS_CONN_EST_IND(mSGpTR) (mSGpTR)->ittiMsg.nas_conn_est_ind
#define NAS_CONN_EST_CNF(mSGpTR) (mSGpTR)->ittiMsg.nas_conn_est_cnf
#define NAS_BEARER_PARAM(mSGpTR) (mSGpTR)->ittiMsg.nas_bearer_param
#define NAS_AUTHENTICATION_REQ(mSGpTR) (mSGpTR)->ittiMsg.nas_auth_req
#define NAS_AUTHENTICATION_PARAM_REQ(mSGpTR) (mSGpTR)->ittiMsg.nas_auth_param_req
#define NAS_AUTHENTICATION_PARAM_RSP(mSGpTR) (mSGpTR)->ittiMsg.nas_auth_param_rsp
#define NAS_AUTHENTICATION_PARAM_FAIL(mSGpTR) (mSGpTR)->ittiMsg.nas_auth_param_fail
#define NAS_UL_DATA_IND(mSGpTR) (mSGpTR)->ittiMsg.nas_ul_data_ind
#define NAS_DL_DATA_REQ(mSGpTR) (mSGpTR)->ittiMsg.nas_dl_data_req
#define NAS_DL_DATA_CNF(mSGpTR) (mSGpTR)->ittiMsg.nas_dl_data_cnf
#define NAS_CONN_EST_IND(mSGpTR) (mSGpTR)->ittiMsg.nas_conn_est_ind
#define NAS_CONNECTION_ESTABLISHMENT_CNF(mSGpTR) (mSGpTR)->ittiMsg.nas_conn_est_cnf
#define NAS_BEARER_PARAM(mSGpTR) (mSGpTR)->ittiMsg.nas_bearer_param
#define NAS_AUTHENTICATION_REQ(mSGpTR) (mSGpTR)->ittiMsg.nas_auth_req
#define NAS_AUTHENTICATION_PARAM_REQ(mSGpTR) (mSGpTR)->ittiMsg.nas_auth_param_req
#define NAS_AUTHENTICATION_PARAM_RSP(mSGpTR) (mSGpTR)->ittiMsg.nas_auth_param_rsp
#define NAS_AUTHENTICATION_PARAM_FAIL(mSGpTR) (mSGpTR)->ittiMsg.nas_auth_param_fail
typedef struct nas_paging_ind_s {
......@@ -29,6 +29,7 @@ typedef struct nas_conn_est_ind_s {
typedef nas_establish_rsp_t nas_conn_est_rej_t;
#if defined(DISABLE_USE_NAS)
typedef struct nas_conn_est_cnf_s {
uint32_t ue_id;
......@@ -36,6 +37,9 @@ typedef struct nas_conn_est_cnf_s {
/* Transparent message from MME_APP to S1AP */
s1ap_initial_ctxt_setup_req_t transparent;
} nas_conn_est_cnf_t;
#else
typedef nas_establish_cnf_t nas_conn_est_cnf_t;
#endif
typedef struct nas_bearer_param_s {
unsigned eNB_ue_s1ap_id:24;
......
......@@ -1117,6 +1117,7 @@ int emm_proc_attach_request(unsigned int ueid, emm_proc_attach_type_t type,
(*emm_ctx)->esm_msg.value = NULL;
(*emm_ctx)->emm_cause = EMM_CAUSE_SUCCESS;
(*emm_ctx)->_emm_fsm_status = EMM_INVALID;
(*emm_ctx)->ueid = ueid;
emm_fsm_set_status(ueid, *emm_ctx, EMM_DEREGISTERED);
#if defined(EPC_BUILD)
......@@ -1130,7 +1131,6 @@ int emm_proc_attach_request(unsigned int ueid, emm_proc_attach_type_t type,
if (rc != RETURNok) {
LOG_TRACE(WARNING, "EMM-PROC - Failed to update EMM context");
/* Do not accept the UE to attach to the network */
(*emm_ctx)->ueid = ueid;
(*emm_ctx)->emm_cause = EMM_CAUSE_ILLEGAL_UE;
rc = _emm_attach_reject(*emm_ctx);
} else {
......@@ -1216,12 +1216,13 @@ int emm_proc_attach_reject(unsigned int ueid, int emm_cause)
***************************************************************************/
int emm_proc_attach_complete(unsigned int ueid, const OctetString *esm_msg)
{
LOG_FUNC_IN;
emm_data_context_t *emm_ctx = NULL;
int rc = RETURNerror;
emm_sap_t emm_sap;
esm_sap_t esm_sap;
LOG_FUNC_IN;
LOG_TRACE(INFO, "EMM-PROC - EPS attach complete (ueid=%u)", ueid);
/* Stop timer T3450 */
......@@ -1238,7 +1239,6 @@ int emm_proc_attach_complete(unsigned int ueid, const OctetString *esm_msg)
}
/* Get the UE context */
emm_data_context_t *emm_ctx = NULL;
#if defined(EPC_BUILD)
if (ueid > 0) {
......@@ -1263,6 +1263,7 @@ int emm_proc_attach_complete(unsigned int ueid, const OctetString *esm_msg)
esm_sap.is_standalone = FALSE;
esm_sap.ueid = ueid;
esm_sap.recv = esm_msg;
esm_sap.ctx = emm_ctx;
rc = esm_sap_send(&esm_sap);
} else {
LOG_TRACE(ERROR, "EMM-PROC - No EMM context exists");
......@@ -1276,6 +1277,7 @@ int emm_proc_attach_complete(unsigned int ueid, const OctetString *esm_msg)
*/
emm_sap.primitive = EMMREG_ATTACH_CNF;
emm_sap.u.emm_reg.ueid = ueid;
emm_sap.u.emm_reg.ctx = emm_ctx;
rc = emm_sap_send(&emm_sap);
} else if (esm_sap.err != ESM_SAP_DISCARDED) {
/*
......@@ -1283,6 +1285,7 @@ int emm_proc_attach_complete(unsigned int ueid, const OctetString *esm_msg)
*/
emm_sap.primitive = EMMREG_ATTACH_REJ;
emm_sap.u.emm_reg.ueid = ueid;
emm_sap.u.emm_reg.ctx = emm_ctx;
rc = emm_sap_send(&emm_sap);
} else {
/*
......@@ -1748,14 +1751,17 @@ static int _emm_attach_reject(void *args)
***************************************************************************/
static int _emm_attach_abort(void *args)
{
LOG_FUNC_IN;
int rc = RETURNerror;
emm_data_context_t *ctx = NULL;
attach_data_t *data;
attach_data_t *data = (attach_data_t *)(args);
LOG_FUNC_IN;
data = (attach_data_t *)(args);
if (data) {
unsigned int ueid = data->ueid;
esm_sap_t esm_sap;
LOG_TRACE(WARNING, "EMM-PROC - Abort the attach procedure (ueid=%u)",
ueid);
......@@ -1771,15 +1777,22 @@ static int _emm_attach_abort(void *args)
}
free(data);
#if defined(EPC_BUILD)
ctx = emm_data_context_get(&_emm_data, ueid);
#else
ctx = _emm_data.ctx[ueid];
#endif
/*
* Notify ESM that the network locally refused PDN connectivity
* to the UE
*/
esm_sap_t esm_sap;
esm_sap.primitive = ESM_PDN_CONNECTIVITY_REJ;
esm_sap.ueid = ueid;
esm_sap.ctx = ctx;
esm_sap.recv = NULL;
rc = esm_sap_send(&esm_sap);
if (rc != RETURNerror) {
/*
* Notify EMM that EPS attach procedure failed
......@@ -1787,16 +1800,9 @@ static int _emm_attach_abort(void *args)
emm_sap_t emm_sap;
emm_sap.primitive = EMMREG_ATTACH_REJ;
emm_sap.u.emm_reg.ueid = ueid;
emm_sap.u.emm_reg.ctx = ctx;
rc = emm_sap_send(&emm_sap);
if (rc != RETURNerror) {
struct emm_data_context_s *ctx = NULL;
#if defined(EPC_BUILD)
ctx = emm_data_context_get(&_emm_data, ueid);
#else
ctx = _emm_data.ctx[ueid];
#endif
/* Release the UE context */
rc = _emm_attach_release(ctx);
}
......@@ -2098,6 +2104,7 @@ static int _emm_attach(void *args)
esm_sap.primitive = ESM_PDN_CONNECTIVITY_REQ;
esm_sap.is_standalone = FALSE;
esm_sap.ueid = emm_ctx->ueid;
esm_sap.ctx = emm_ctx;
esm_sap.recv = &emm_ctx->esm_msg;
rc = esm_sap_send(&esm_sap);
......@@ -2214,6 +2221,7 @@ static int _emm_attach_accept(emm_data_context_t *emm_ctx, attach_data_t *data)
* Notify EMM-AS SAP that Attach Accept message together with an Activate
* Default EPS Bearer Context Request message has to be sent to the UE
*/
emm_sap.primitive = EMMAS_ESTABLISH_CNF;
emm_sap.u.emm_as.u.establish.ueid = emm_ctx->ueid;
if (emm_ctx->guti_is_new && emm_ctx->old_guti) {
......@@ -2387,6 +2395,26 @@ static int _emm_attach_update(emm_data_context_t *ctx, unsigned int ueid,
} else {
return (RETURNerror);
}
} else {
if (ctx->guti == NULL) {
ctx->guti = (GUTI_t *)malloc(sizeof(GUTI_t));
}
if (ctx->guti != NULL) {
/* TODO: FIXME */
ctx->guti->gummei.plmn.MCCdigit1 = 2;
ctx->guti->gummei.plmn.MCCdigit2 = 0;
ctx->guti->gummei.plmn.MCCdigit3 = 8;
ctx->guti->gummei.plmn.MNCdigit1 = 9;
ctx->guti->gummei.plmn.MNCdigit2 = 2;
ctx->guti->gummei.plmn.MNCdigit3 = 15;
ctx->guti->gummei.MMEcode = 0;
ctx->guti->gummei.MMEgid = 0;
ctx->guti->m_tmsi = (uint32_t) ctx;
} else {
return (RETURNerror);
}
}
/* The IMSI if provided by the UE */
if (imsi) {
......
......@@ -512,6 +512,7 @@ int emm_proc_detach_request(unsigned int ueid, emm_proc_detach_type_t type,
esm_sap_t esm_sap;
esm_sap.primitive = ESM_EPS_BEARER_CONTEXT_DEACTIVATE_REQ;
esm_sap.ueid = ueid;
esm_sap.ctx = emm_ctx;
esm_sap.data.eps_bearer_context_deactivate.ebi = ESM_SAP_ALL_EBI;
rc = esm_sap_send(&esm_sap);
......@@ -522,6 +523,7 @@ int emm_proc_detach_request(unsigned int ueid, emm_proc_detach_type_t type,
*/
emm_sap.primitive = EMMREG_DETACH_REQ;
emm_sap.u.emm_reg.ueid = ueid;
emm_sap.u.emm_reg.ctx = emm_ctx;
rc = emm_sap_send(&emm_sap);
}
}
......
......@@ -202,14 +202,26 @@ int lowerlayer_release(int cause)
***************************************************************************/
int lowerlayer_data_ind(unsigned int ueid, const OctetString *data)
{
LOG_FUNC_IN;
esm_sap_t esm_sap;
int rc;
#if defined(NAS_MME)
emm_data_context_t *emm_ctx;
#endif
LOG_FUNC_IN;
#if defined(NAS_MME)
if (ueid > 0) {
emm_ctx = emm_data_context_get(&_emm_data, ueid);
}
#endif
esm_sap.primitive = ESM_UNITDATA_IND;
esm_sap.is_standalone = TRUE;
esm_sap.ueid = ueid;
#if defined(NAS_MME)
esm_sap.ctx = emm_ctx;
#endif
esm_sap.recv = data;
rc = esm_sap_send(&esm_sap);
......
......@@ -28,6 +28,8 @@ Description Defines internal private data handled by EPS Mobility
#include "OctetString.h"
#include "nas_timer.h"
#include "esmData.h"
#ifdef NAS_MME
#include "emm_fsm.h"
#include "mme_api.h"
......@@ -348,6 +350,8 @@ typedef struct emm_data_context_s {
int emm_cause; /* EMM failure cause code */
emm_fsm_state_t _emm_fsm_status;
esm_data_context_t esm_data_ctx;
} emm_data_context_t;
/*
......
......@@ -1092,7 +1092,7 @@ static int _emm_as_send(const emm_as_t *msg)
LOG_FUNC_RETURN (RETURNok);
} break;
case AS_NAS_ESTABLISH_RSP: {
case AS_NAS_ESTABLISH_CNF: {
if (as_msg.msg.nas_establish_rsp.errCode != AS_SUCCESS) {
nas_itti_dl_data_req(as_msg.msg.nas_establish_rsp.UEid,
as_msg.msg.nas_establish_rsp.nasMsg.data,
......@@ -1100,6 +1100,11 @@ static int _emm_as_send(const emm_as_t *msg)
LOG_FUNC_RETURN (RETURNok);
} else {
/* Handle success case */
nas_itti_establish_cnf(as_msg.msg.nas_establish_rsp.UEid,
as_msg.msg.nas_establish_rsp.errCode,
as_msg.msg.nas_establish_rsp.nasMsg.data,
as_msg.msg.nas_establish_rsp.nasMsg.length);
LOG_FUNC_RETURN (RETURNok);
}
} break;
......@@ -1670,7 +1675,7 @@ static int _emm_as_establish_cnf(const emm_as_establish_t *msg,
LOG_FUNC_IN;
LOG_TRACE(INFO, "EMMAS-SAP - Send AS connection establish response");
LOG_TRACE(INFO, "EMMAS-SAP - Send AS connection establish confirmation");
nas_message_t nas_msg;
memset(&nas_msg, 0 , sizeof(nas_message_t));
......@@ -1678,6 +1683,7 @@ static int _emm_as_establish_cnf(const emm_as_establish_t *msg,
/* Setup the AS message */
as_msg->UEid = msg->ueid;
if (msg->UEid.guti == NULL) {
LOG_TRACE(WARNING, "EMMAS-SAP - GUTI is NULL...");
LOG_FUNC_RETURN (0);
}
as_msg->s_tmsi.MMEcode = msg->UEid.guti->gummei.MMEcode;
......@@ -1703,9 +1709,11 @@ static int _emm_as_establish_cnf(const emm_as_establish_t *msg,
int bytes = _emm_as_encode(&as_msg->nasMsg, &nas_msg, size);
if (bytes > 0) {
as_msg->errCode = AS_SUCCESS;
LOG_FUNC_RETURN (AS_NAS_ESTABLISH_RSP);
LOG_FUNC_RETURN (AS_NAS_ESTABLISH_CNF);
}
}
LOG_TRACE(WARNING, "EMMAS-SAP - Size <= 0");
LOG_FUNC_RETURN (0);
}
......
......@@ -24,6 +24,7 @@ Description Defines the EMMESM Service Access Point that provides
#define __EMM_ESMDEF_H__
#include "OctetString.h"
#include "emmData.h"
/****************************************************************************/
/********************* G L O B A L C O N S T A N T S *******************/
......@@ -76,6 +77,9 @@ typedef struct {
typedef struct {
emm_esm_primitive_t primitive;
unsigned int ueid;
#if defined(NAS_MME)
emm_data_context_t *ctx;
#endif
union {
emm_esm_establish_t establish;
emm_esm_data_t data;
......
......@@ -23,6 +23,7 @@ Description Defines the EMM Service Access Points at which the EPS
#ifndef __EMM_SAP_H__
#define __EMM_SAP_H__
#include "emmData.h"
#include "emm_regDef.h"
#include "emm_esmDef.h"
#include "emm_asDef.h"
......
......@@ -65,7 +65,7 @@ static void *_dedicated_eps_bearer_activate_t3485_handler(void *);
* retransmission counter */
#define DEDICATED_EPS_BEARER_ACTIVATE_COUNTER_MAX 5
static int _dedicated_eps_bearer_activate(unsigned int ueid, int ebi,
static int _dedicated_eps_bearer_activate(emm_data_context_t *ctx, int ebi,
const OctetString *msg);
#endif // NAS_MME
......@@ -102,7 +102,7 @@ static int _dedicated_eps_bearer_activate(unsigned int ueid, int ebi,
** Others: None **
** **
***************************************************************************/
int esm_proc_dedicated_eps_bearer_context(unsigned int ueid, int pid,
int esm_proc_dedicated_eps_bearer_context(emm_data_context_t *ctx, int pid,
unsigned int *ebi,
unsigned int *default_ebi,
const esm_proc_qos_t *qos,
......@@ -112,14 +112,14 @@ int esm_proc_dedicated_eps_bearer_context(unsigned int ueid, int pid,
LOG_FUNC_IN;
LOG_TRACE(INFO, "ESM-PROC - Dedicated EPS bearer context activation "
"(ueid=%u, pid=%d)", ueid, pid);
"(ueid=%u, pid=%d)", ctx->ueid, pid);
/* Assign new EPS bearer context */
*ebi = esm_ebr_assign(ueid, ESM_EBI_UNASSIGNED);
*ebi = esm_ebr_assign(ctx, ESM_EBI_UNASSIGNED);
if (*ebi != ESM_EBI_UNASSIGNED) {
/* Create dedicated EPS bearer context */
*default_ebi = esm_ebr_context_create(ueid, pid, *ebi, FALSE, qos, tft);
*default_ebi = esm_ebr_context_create(ctx, pid, *ebi, FALSE, qos, tft);
if (*default_ebi == ESM_EBI_UNASSIGNED) {
/* No resource available */
LOG_TRACE(WARNING, "ESM-PROC - Failed to create dedicated EPS "
......@@ -162,7 +162,7 @@ int esm_proc_dedicated_eps_bearer_context(unsigned int ueid, int pid,
** **
***************************************************************************/
int esm_proc_dedicated_eps_bearer_context_request(int is_standalone,
unsigned int ueid, int ebi,
emm_data_context_t *ctx, int ebi,
OctetString *msg, int ue_triggered)
{
LOG_FUNC_IN;
......@@ -170,15 +170,15 @@ int esm_proc_dedicated_eps_bearer_context_request(int is_standalone,
int rc = RETURNok;
LOG_TRACE(INFO,"ESM-PROC - Initiate dedicated EPS bearer context "
"activation (ueid=%d, ebi=%d)", ueid, ebi);
"activation (ueid=%d, ebi=%d)", ctx->ueid, ebi);
/* Send activate dedicated EPS bearer context request message and
* start timer T3485 */
rc = _dedicated_eps_bearer_activate(ueid, ebi, msg);
rc = _dedicated_eps_bearer_activate(ctx, ebi, msg);
if (rc != RETURNerror) {
/* Set the EPS bearer context state to ACTIVE PENDING */
rc = esm_ebr_set_status(ueid, ebi, ESM_EBR_ACTIVE_PENDING, ue_triggered);
rc = esm_ebr_set_status(ctx, ebi, ESM_EBR_ACTIVE_PENDING, ue_triggered);
if (rc != RETURNok) {
/* The EPS bearer context was already in ACTIVE PENDING state */
LOG_TRACE(WARNING, "ESM-PROC - EBI %d was already ACTIVE PENDING",
......@@ -211,7 +211,7 @@ int esm_proc_dedicated_eps_bearer_context_request(int is_standalone,
** Others: None **
** **
***************************************************************************/
int esm_proc_dedicated_eps_bearer_context_accept(unsigned int ueid, int ebi,
int esm_proc_dedicated_eps_bearer_context_accept(emm_data_context_t *ctx, int ebi,
int *esm_cause)
{
LOG_FUNC_IN;
......@@ -219,13 +219,13 @@ int esm_proc_dedicated_eps_bearer_context_accept(unsigned int ueid, int ebi,
int rc;
LOG_TRACE(INFO, "ESM-PROC - Dedicated EPS bearer context activation "
"accepted by the UE (ueid=%u, ebi=%d)", ueid, ebi);
"accepted by the UE (ueid=%u, ebi=%d)", ctx->ueid, ebi);
/* Stop T3485 timer */
rc = esm_ebr_stop_timer(ueid, ebi);
rc = esm_ebr_stop_timer(ctx, ebi);
if (rc != RETURNerror) {
/* Set the EPS bearer context state to ACTIVE */
rc = esm_ebr_set_status(ueid, ebi, ESM_EBR_ACTIVE, FALSE);
rc = esm_ebr_set_status(ctx, ebi, ESM_EBR_ACTIVE, FALSE);
if (rc != RETURNok) {
/* The EPS bearer context was already in ACTIVE state */
LOG_TRACE(WARNING, "ESM-PROC - EBI %d was already ACTIVE", ebi);
......@@ -262,22 +262,22 @@ int esm_proc_dedicated_eps_bearer_context_accept(unsigned int ueid, int ebi,
** Others: None **
** **
***************************************************************************/
int esm_proc_dedicated_eps_bearer_context_reject(unsigned int ueid, int ebi,
int esm_proc_dedicated_eps_bearer_context_reject(emm_data_context_t *ctx, int ebi,
int *esm_cause)
{
LOG_FUNC_IN;
int rc;
LOG_FUNC_IN;
LOG_TRACE(WARNING, "ESM-PROC - Dedicated EPS bearer context activation "
"not accepted by the UE (ueid=%u, ebi=%d)", ueid, ebi);
"not accepted by the UE (ueid=%u, ebi=%d)", ctx->ueid, ebi);
/* Stop T3485 timer if running */
rc = esm_ebr_stop_timer(ueid, ebi);
rc = esm_ebr_stop_timer(ctx, ebi);
if (rc != RETURNerror) {
int pid, bid;
/* Release the dedicated EPS bearer context and enter state INACTIVE */
rc = esm_proc_eps_bearer_context_deactivate(ueid, TRUE, ebi,
rc = esm_proc_eps_bearer_context_deactivate(ctx, TRUE, ebi,
&pid, &bid, NULL);
if (rc != RETURNok) {
/* Failed to release the dedicated EPS bearer context */
......@@ -558,7 +558,7 @@ static void *_dedicated_eps_bearer_activate_t3485_handler(void *args)
if (data->count < DEDICATED_EPS_BEARER_ACTIVATE_COUNTER_MAX) {
/* Re-send activate dedicated EPS bearer context request message
* to the UE */
rc = _dedicated_eps_bearer_activate(data->ueid, data->ebi, &data->msg);
rc = _dedicated_eps_bearer_activate(data->ctx, data->ebi, &data->msg);
} else {
/*
* The maximum number of activate dedicated EPS bearer context request
......@@ -566,12 +566,12 @@ static void *_dedicated_eps_bearer_activate_t3485_handler(void *args)
*/
int pid, bid;
/* Release the dedicated EPS bearer context and enter state INACTIVE */
rc = esm_proc_eps_bearer_context_deactivate(data->ueid, TRUE,
rc = esm_proc_eps_bearer_context_deactivate(data->ctx, TRUE,
data->ebi, &pid, &bid,
NULL);
if (rc != RETURNerror) {
/* Stop timer T3485 */
rc = esm_ebr_stop_timer(data->ueid, data->ebi);
rc = esm_ebr_stop_timer(data->ctx, data->ebi);
}
}
......@@ -601,7 +601,7 @@ static void *_dedicated_eps_bearer_activate_t3485_handler(void *args)
** Others: T3485 **
** **
***************************************************************************/
static int _dedicated_eps_bearer_activate(unsigned int ueid, int ebi,
static int _dedicated_eps_bearer_activate(emm_data_context_t *ctx, int ebi,
const OctetString *msg)
{
LOG_FUNC_IN;
......@@ -615,13 +615,14 @@ static int _dedicated_eps_bearer_activate(unsigned int ueid, int ebi,
*/
emm_esm_data_t *emm_esm = &emm_sap.u.emm_esm.u.data;
emm_sap.primitive = EMMESM_UNITDATA_REQ;
emm_sap.u.emm_esm.ueid = ueid;
emm_sap.u.emm_esm.ueid = ctx->ueid;
emm_sap.u.emm_esm.ctx = ctx;
emm_esm->msg = *msg;
rc = emm_sap_send(&emm_sap);
if (rc != RETURNerror) {
/* Start T3485 retransmission timer */
rc = esm_ebr_start_timer(ueid, ebi, msg, T3485_DEFAULT_VALUE,
rc = esm_ebr_start_timer(ctx, ebi, msg, T3485_DEFAULT_VALUE,
_dedicated_eps_bearer_activate_t3485_handler);
}
......
......@@ -75,7 +75,7 @@ static void *_default_eps_bearer_activate_t3485_handler(void *);
* retransmission counter */
#define DEFAULT_EPS_BEARER_ACTIVATE_COUNTER_MAX 5
static int _default_eps_bearer_activate(unsigned int ueid, int ebi,
static int _default_eps_bearer_activate(emm_data_context_t *ctx, int ebi,
const OctetString *msg);
#endif // NAS_MME
......@@ -109,7 +109,7 @@ static int _default_eps_bearer_activate(unsigned int ueid, int ebi,
** Others: None **
** **
***************************************************************************/
int esm_proc_default_eps_bearer_context(unsigned int ueid, int pid,
int esm_proc_default_eps_bearer_context(emm_data_context_t *ctx, int pid,
unsigned int *ebi,
const esm_proc_qos_t *qos,
int *esm_cause)
......@@ -117,14 +117,14 @@ int esm_proc_default_eps_bearer_context(unsigned int ueid, int pid,
LOG_FUNC_IN;
LOG_TRACE(INFO, "ESM-PROC - Default EPS bearer context activation "
"(ueid=%u, pid=%d)", ueid, pid);
"(ueid=%u, pid=%d)", ctx->ueid, pid);
/* Assign new EPS bearer context */
*ebi = esm_ebr_assign(ueid, ESM_EBI_UNASSIGNED);
*ebi = esm_ebr_assign(ctx, ESM_EBI_UNASSIGNED);
if (*ebi != ESM_EBI_UNASSIGNED) {
/* Create default EPS bearer context */
*ebi = esm_ebr_context_create(ueid, pid, *ebi, TRUE, qos, NULL);
*ebi = esm_ebr_context_create(ctx, pid, *ebi, TRUE, qos, NULL);
if (*ebi == ESM_EBI_UNASSIGNED) {
/* No resource available */
LOG_TRACE(WARNING, "ESM-PROC - Failed to create new default EPS "
......@@ -170,25 +170,25 @@ int esm_proc_default_eps_bearer_context(unsigned int ueid, int pid,
** **
***************************************************************************/
int esm_proc_default_eps_bearer_context_request(int is_standalone,
unsigned int ueid, int ebi,
emm_data_context_t *ctx, int ebi,
OctetString *msg, int ue_triggered)
{
LOG_FUNC_IN;
int rc = RETURNok;
LOG_FUNC_IN;
LOG_TRACE(INFO,"ESM-PROC - Initiate default EPS bearer context activation "
"(ueid=%d, ebi=%d)", ueid, ebi);
"(ueid=%u, ebi=%d)", ctx->ueid, ebi);
if (is_standalone) {
/* Send activate default EPS bearer context request message and
* start timer T3485 */
rc = _default_eps_bearer_activate(ueid, ebi, msg);
rc = _default_eps_bearer_activate(ctx, ebi, msg);
}
if (rc != RETURNerror) {
/* Set the EPS bearer context state to ACTIVE PENDING */
rc = esm_ebr_set_status(ueid, ebi, ESM_EBR_ACTIVE_PENDING, ue_triggered);
rc = esm_ebr_set_status(ctx, ebi, ESM_EBR_ACTIVE_PENDING, ue_triggered);
if (rc != RETURNok) {
/* The EPS bearer context was already in ACTIVE PENDING state */
LOG_TRACE(WARNING, "ESM-PROC - EBI %d was already ACTIVE PENDING",
......@@ -221,7 +221,7 @@ int esm_proc_default_eps_bearer_context_request(int is_standalone,
** Others: None **
** **
***************************************************************************/
int esm_proc_default_eps_bearer_context_accept(unsigned int ueid, int ebi,
int esm_proc_default_eps_bearer_context_accept(emm_data_context_t *ctx, int ebi,
int *esm_cause)
{
LOG_FUNC_IN;
......@@ -229,13 +229,13 @@ int esm_proc_default_eps_bearer_context_accept(unsigned int ueid, int ebi,
int rc;
LOG_TRACE(INFO, "ESM-PROC - Default EPS bearer context activation "
"accepted by the UE (ueid=%u, ebi=%d)", ueid, ebi);
"accepted by the UE (ueid=%u, ebi=%d)", ctx->ueid, ebi);
/* Stop T3485 timer if running */
rc = esm_ebr_stop_timer(ueid, ebi);
rc = esm_ebr_stop_timer(ctx, ebi);
if (rc != RETURNerror) {
/* Set the EPS bearer context state to ACTIVE */
rc = esm_ebr_set_status(ueid, ebi, ESM_EBR_ACTIVE, FALSE);
rc = esm_ebr_set_status(ctx, ebi, ESM_EBR_ACTIVE, FALSE);
if (rc != RETURNok) {
/* The EPS bearer context was already in ACTIVE state */
LOG_TRACE(WARNING, "ESM-PROC - EBI %d was already ACTIVE", ebi);
......@@ -268,7 +268,7 @@ int esm_proc_default_eps_bearer_context_accept(unsigned int ueid, int ebi,
** Others: None **
** **
***************************************************************************/
int esm_proc_default_eps_bearer_context_reject(unsigned int ueid, int ebi,
int esm_proc_default_eps_bearer_context_reject(emm_data_context_t *ctx, int ebi,
int *esm_cause)
{
LOG_FUNC_IN;
......@@ -276,14 +276,14 @@ int esm_proc_default_eps_bearer_context_reject(unsigned int ueid, int ebi,
int rc;
LOG_TRACE(WARNING, "ESM-PROC - Default EPS bearer context activation "
"not accepted by the UE (ueid=%u, ebi=%d)", ueid, ebi);
"not accepted by the UE (ueid=%u, ebi=%d)", ctx->ueid, ebi);
/* Stop T3485 timer if running */
rc = esm_ebr_stop_timer(ueid, ebi);
rc = esm_ebr_stop_timer(ctx, ebi);
if (rc != RETURNerror) {
int pid, bid;
/* Release the default EPS bearer context and enter state INACTIVE */
rc = esm_proc_eps_bearer_context_deactivate(ueid, TRUE, ebi,
rc = esm_proc_eps_bearer_context_deactivate(ctx, TRUE, ebi,
&pid, &bid, NULL);
if (rc != RETURNok) {
/* Failed to release the default EPS bearer context */
......@@ -318,23 +318,23 @@ int esm_proc_default_eps_bearer_context_reject(unsigned int ueid, int ebi,
** Others: None **
** **
***************************************************************************/
int esm_proc_default_eps_bearer_context_failure(unsigned int ueid)
int esm_proc_default_eps_bearer_context_failure(emm_data_context_t *ctx)
{
LOG_FUNC_IN;
int rc = RETURNerror;
int pid;
LOG_FUNC_IN;
LOG_TRACE(WARNING, "ESM-PROC - Default EPS bearer context activation "
"failure (ueid=%u)", ueid);
"failure (ueid=%u)", ctx->ueid);
/* Get the EPS bearer identity of the EPS bearer context which is still
* pending in the active pending state */
int ebi = esm_ebr_get_pending_ebi(ueid, ESM_EBR_ACTIVE_PENDING);
int ebi = esm_ebr_get_pending_ebi(ctx, ESM_EBR_ACTIVE_PENDING);
if (ebi != ESM_EBI_UNASSIGNED) {
int bid;
/* Release the default EPS bearer context and enter state INACTIVE */
rc = esm_proc_eps_bearer_context_deactivate(ueid, TRUE, ebi,
rc = esm_proc_eps_bearer_context_deactivate(ctx, TRUE, ebi,
&pid, &bid, NULL);
}
......@@ -680,7 +680,7 @@ static void *_default_eps_bearer_activate_t3485_handler(void *args)
if (data->count < DEFAULT_EPS_BEARER_ACTIVATE_COUNTER_MAX) {
/* Re-send activate default EPS bearer context request message
* to the UE */
rc = _default_eps_bearer_activate(data->ueid, data->ebi, &data->msg);
rc = _default_eps_bearer_activate(data->ctx, data->ebi, &data->msg);
} else {
/*
* The maximum number of activate default EPS bearer context request
......@@ -688,12 +688,12 @@ static void *_default_eps_bearer_activate_t3485_handler(void *args)
*/
int pid, bid;
/* Release the default EPS bearer context and enter state INACTIVE */
rc = esm_proc_eps_bearer_context_deactivate(data->ueid, TRUE,
rc = esm_proc_eps_bearer_context_deactivate(data->ctx, TRUE,
data->ebi, &pid, &bid,
NULL);
if (rc != RETURNerror) {
/* Stop timer T3485 */
rc = esm_ebr_stop_timer(data->ueid, data->ebi);
rc = esm_ebr_stop_timer(data->ctx, data->ebi);
}
}
......@@ -723,7 +723,7 @@ static void *_default_eps_bearer_activate_t3485_handler(void *args)
** Others: T3485 **
** **
***************************************************************************/
static int _default_eps_bearer_activate(unsigned int ueid, int ebi,
static int _default_eps_bearer_activate(emm_data_context_t *ctx, int ebi,
const OctetString *msg)
{
LOG_FUNC_IN;
......@@ -737,13 +737,14 @@ static int _default_eps_bearer_activate(unsigned int ueid, int ebi,
*/
emm_esm_data_t *emm_esm = &emm_sap.u.emm_esm.u.data;