- Formatted some NAS files

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4553 818b1a75-f10b-46b9-bf7c-635c3b92a50f
This commit is contained in:
Cedric Roux
2013-12-02 09:50:14 +00:00
parent 0fdd3f099c
commit f355cc6177
20 changed files with 4615 additions and 4537 deletions
+2 -1
View File
@@ -200,6 +200,7 @@ static void* _nas_user_mngr(void* args)
int exit_loop = FALSE; int exit_loop = FALSE;
int nb_command; int nb_command;
int bytes; int bytes;
int i;
int *fd = (int*) args; int *fd = (int*) args;
@@ -227,7 +228,7 @@ static void* _nas_user_mngr(void* args)
/* Decode the user data message */ /* Decode the user data message */
nb_command = user_api_decode_data (bytes); nb_command = user_api_decode_data (bytes);
for (int i = 0; i < nb_command; i++) for (i = 0; i < nb_command; i++)
{ {
/* Get the user data to be processed */ /* Get the user data to be processed */
const void* data = user_api_get_data (i); const void* data = user_api_get_data (i);
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+261 -251
View File
@@ -1,28 +1,28 @@
/***************************************************************************** /*****************************************************************************
Eurecom OpenAirInterface 3 Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom Copyright(c) 2012 Eurecom
Source Detach.c Source Detach.c
Version 0.1 Version 0.1
Date 2013/05/07 Date 2013/05/07
Product NAS stack Product NAS stack
Subsystem EPS Mobility Management Subsystem EPS Mobility Management
Author Frederic Maurel Author Frederic Maurel
Description Defines the detach related EMM procedure executed by the Description Defines the detach related EMM procedure executed by the
Non-Access Stratum. Non-Access Stratum.
The detach procedure is used by the UE to detach for EPS servi- The detach procedure is used by the UE to detach for EPS servi-
ces, to disconnect from the last PDN it is connected to; by the ces, to disconnect from the last PDN it is connected to; by the
network to inform the UE that it is detached for EPS services network to inform the UE that it is detached for EPS services
or non-EPS services or both, to disconnect the UE from the last or non-EPS services or both, to disconnect the UE from the last
PDN to which it is connected and to inform the UE to re-attach PDN to which it is connected and to inform the UE to re-attach
to the network and re-establish all PDN connections. to the network and re-establish all PDN connections.
*****************************************************************************/ *****************************************************************************/
@@ -35,7 +35,7 @@ Description Defines the detach related EMM procedure executed by the
#include "emm_sap.h" #include "emm_sap.h"
#include "esm_sap.h" #include "esm_sap.h"
#include <stdlib.h> // free #include <stdlib.h> // free
/****************************************************************************/ /****************************************************************************/
/**************** E X T E R N A L D E F I N I T I O N S ****************/ /**************** E X T E R N A L D E F I N I T I O N S ****************/
@@ -46,21 +46,21 @@ Description Defines the detach related EMM procedure executed by the
/****************************************************************************/ /****************************************************************************/
/* String representation of the detach type */ /* String representation of the detach type */
static const char* _emm_detach_type_str[] = { static const char *_emm_detach_type_str[] = {
"EPS", "IMSI", "EPS/IMSI", "EPS", "IMSI", "EPS/IMSI",
"RE-ATTACH REQUIRED", "RE-ATTACH NOT REQUIRED", "RESERVED" "RE-ATTACH REQUIRED", "RE-ATTACH NOT REQUIRED", "RESERVED"
}; };
/* /*
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Internal data handled by the detach procedure in the UE * Internal data handled by the detach procedure in the UE
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
#ifdef NAS_UE #ifdef NAS_UE
/* /*
* Timer handlers * Timer handlers
*/ */
void* _emm_detach_t3421_handler(void*); void *_emm_detach_t3421_handler(void *);
/* /*
* Abnormal case detach procedures * Abnormal case detach procedures
@@ -71,18 +71,18 @@ static int _emm_detach_abort(emm_proc_detach_type_t type);
* Internal data used for detach procedure * Internal data used for detach procedure
*/ */
static struct { static struct {
#define EMM_DETACH_COUNTER_MAX 5 #define EMM_DETACH_COUNTER_MAX 5
unsigned int count; /* Counter used to limit the number of unsigned int count; /* Counter used to limit the number of
* subsequently detach attempts */ * subsequently detach attempts */
int switch_off; /* UE switch-off indicator */ int switch_off; /* UE switch-off indicator */
emm_proc_detach_type_t type; /* Type of the detach procedure emm_proc_detach_type_t type; /* Type of the detach procedure
* currently in progress */ * currently in progress */
} _emm_detach_data = {0, FALSE, EMM_DETACH_TYPE_RESERVED}; } _emm_detach_data = {0, FALSE, EMM_DETACH_TYPE_RESERVED};
#endif // NAS_UE #endif // NAS_UE
/* /*
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Internal data handled by the detach procedure in the MME * Internal data handled by the detach procedure in the MME
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
#ifdef NAS_MME #ifdef NAS_MME
@@ -94,31 +94,31 @@ static struct {
/* /*
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Detach procedure executed by the UE * Detach procedure executed by the UE
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
#ifdef NAS_UE #ifdef NAS_UE
/**************************************************************************** /****************************************************************************
** ** ** **
** Name: emm_proc_detach() ** ** Name: emm_proc_detach() **
** ** ** **
** Description: Initiates the detach procedure in order for the UE to de- ** ** Description: Initiates the detach procedure in order for the UE to de- **
** tach for EPS services. ** ** tach for EPS services. **
** ** ** **
** 3GPP TS 24.301, section 5.5.2.2.1 ** ** 3GPP TS 24.301, section 5.5.2.2.1 **
** In state EMM-REGISTERED or EMM-REGISTERED-INITIATED, the ** ** In state EMM-REGISTERED or EMM-REGISTERED-INITIATED, the **
** UE initiates the detach procedure by sending a DETACH RE- ** ** UE initiates the detach procedure by sending a DETACH RE- **
** QUEST message to the network, starting timer T3421 and ** ** QUEST message to the network, starting timer T3421 and **
** entering state EMM-DEREGISTERED-INITIATED. ** ** entering state EMM-DEREGISTERED-INITIATED. **
** ** ** **
** Inputs: type: Type of the requested detach ** ** Inputs: type: Type of the requested detach **
** switch_off: Indicates whether the detach is required ** ** switch_off: Indicates whether the detach is required **
** because the UE is switched off or not ** ** because the UE is switched off or not **
** Others: _emm_data ** ** Others: _emm_data **
** ** ** **
** Outputs: None ** ** Outputs: None **
** Return: RETURNok, RETURNerror ** ** Return: RETURNok, RETURNerror **
** Others: _emm_detach_data ** ** Others: _emm_detach_data **
** ** ** **
***************************************************************************/ ***************************************************************************/
int emm_proc_detach(emm_proc_detach_type_t type, int switch_off) int emm_proc_detach(emm_proc_detach_type_t type, int switch_off)
@@ -130,7 +130,7 @@ int emm_proc_detach(emm_proc_detach_type_t type, int switch_off)
int rc; int rc;
LOG_TRACE(INFO, "EMM-PROC - Initiate EPS detach type = %s (%d)", LOG_TRACE(INFO, "EMM-PROC - Initiate EPS detach type = %s (%d)",
_emm_detach_type_str[type], type); _emm_detach_type_str[type], type);
/* Initialize the detach procedure internal data */ /* Initialize the detach procedure internal data */
_emm_detach_data.count = 0; _emm_detach_data.count = 0;
@@ -140,11 +140,11 @@ int emm_proc_detach(emm_proc_detach_type_t type, int switch_off)
/* Setup EMM procedure handler to be executed upon receiving /* Setup EMM procedure handler to be executed upon receiving
* lower layer notification */ * lower layer notification */
rc = emm_proc_lowerlayer_initialize(emm_proc_detach_request, rc = emm_proc_lowerlayer_initialize(emm_proc_detach_request,
emm_proc_detach_failure, emm_proc_detach_failure,
emm_proc_detach_release, NULL); emm_proc_detach_release, NULL);
if (rc != RETURNok) { if (rc != RETURNok) {
LOG_TRACE(WARNING, "Failed to initialize EMM procedure handler"); LOG_TRACE(WARNING, "Failed to initialize EMM procedure handler");
LOG_FUNC_RETURN (RETURNerror); LOG_FUNC_RETURN (RETURNerror);
} }
/* Setup NAS information message to transfer */ /* Setup NAS information message to transfer */
@@ -173,21 +173,21 @@ int emm_proc_detach(emm_proc_detach_type_t type, int switch_off)
/**************************************************************************** /****************************************************************************
** ** ** **
** Name: emm_proc_detach_request() ** ** Name: emm_proc_detach_request() **
** ** ** **
** Description: Performs the detach procedure upon receipt of indication ** ** Description: Performs the detach procedure upon receipt of indication **
** from lower layers that Detach Request message has been ** ** from lower layers that Detach Request message has been **
** successfully delivered to the network. ** ** successfully delivered to the network. **
** ** ** **
** Inputs: args: Not used ** ** Inputs: args: Not used **
** Others: None ** ** Others: None **
** ** ** **
** Outputs: None ** ** Outputs: None **
** Return: RETURNok, RETURNerror ** ** Return: RETURNok, RETURNerror **
** Others: T3421 ** ** Others: T3421 **
** ** ** **
***************************************************************************/ ***************************************************************************/
int emm_proc_detach_request(void* args) int emm_proc_detach_request(void *args)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
@@ -195,10 +195,10 @@ int emm_proc_detach_request(void* args)
int rc; int rc;
if ( !_emm_detach_data.switch_off ) { if ( !_emm_detach_data.switch_off ) {
/* Start T3421 timer */ /* Start T3421 timer */
T3421.id = nas_timer_start(T3421.sec, _emm_detach_t3421_handler, NULL); T3421.id = nas_timer_start(T3421.sec, _emm_detach_t3421_handler, NULL);
LOG_TRACE(INFO, "EMM-PROC - Timer T3421 (%d) expires in %ld seconds", LOG_TRACE(INFO, "EMM-PROC - Timer T3421 (%d) expires in %ld seconds",
T3421.id, T3421.sec); T3421.id, T3421.sec);
} }
/* /*
@@ -212,24 +212,24 @@ int emm_proc_detach_request(void* args)
/**************************************************************************** /****************************************************************************
** ** ** **
** Name: emm_proc_detach_accept() ** ** Name: emm_proc_detach_accept() **
** ** ** **
** Description: Performs the UE initiated detach procedure for EPS servi- ** ** Description: Performs the UE initiated detach procedure for EPS servi- **
** ces only When the DETACH ACCEPT message is received from ** ** ces only When the DETACH ACCEPT message is received from **
** the network. ** ** the network. **
** ** ** **
** 3GPP TS 24.301, section 5.5.2.2.2 ** ** 3GPP TS 24.301, section 5.5.2.2.2 **
** Upon receiving the DETACH ACCEPT message, the UE shall ** ** Upon receiving the DETACH ACCEPT message, the UE shall **
** stop timer T3421, locally deactivate all EPS bearer con- ** ** stop timer T3421, locally deactivate all EPS bearer con- **
** texts without peer-to-peer signalling and enter state EMM-** ** texts without peer-to-peer signalling and enter state EMM-**
** DEREGISTERED. ** ** DEREGISTERED. **
** ** ** **
** Inputs: None ** ** Inputs: None **
** Others: None ** ** Others: None **
** ** ** **
** Outputs: None ** ** Outputs: None **
** Return: RETURNok, RETURNerror ** ** Return: RETURNok, RETURNerror **
** Others: T3421 ** ** Others: T3421 **
** ** ** **
***************************************************************************/ ***************************************************************************/
int emm_proc_detach_accept(void) int emm_proc_detach_accept(void)
@@ -264,24 +264,24 @@ int emm_proc_detach_accept(void)
/**************************************************************************** /****************************************************************************
** ** ** **
** Name: emm_proc_detach_failure() ** ** Name: emm_proc_detach_failure() **
** ** ** **
** Description: Performs the detach procedure abnormal case upon receipt ** ** Description: Performs the detach procedure abnormal case upon receipt **
** of transmission failure of Detach Request message. ** ** of transmission failure of Detach Request message. **
** ** ** **
** 3GPP TS 24.301, section 5.5.2.2.4, case h ** ** 3GPP TS 24.301, section 5.5.2.2.4, case h **
** The UE shall restart the detach procedure. ** ** The UE shall restart the detach procedure. **
** ** ** **
** Inputs: is_initial: Not used ** ** Inputs: is_initial: Not used **
** args: Not used ** ** args: Not used **
** Others: _emm_detach_data ** ** Others: _emm_detach_data **
** ** ** **
** Outputs: None ** ** Outputs: None **
** Return: RETURNok, RETURNerror ** ** Return: RETURNok, RETURNerror **
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
int emm_proc_detach_failure(int is_initial, void* args) int emm_proc_detach_failure(int is_initial, void *args)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
@@ -308,24 +308,24 @@ int emm_proc_detach_failure(int is_initial, void* args)
/**************************************************************************** /****************************************************************************
** ** ** **
** Name: emm_proc_detach_release() ** ** Name: emm_proc_detach_release() **
** ** ** **
** Description: Performs the detach procedure abnormal case upon receipt ** ** Description: Performs the detach procedure abnormal case upon receipt **
** of NAS signalling connection release indication before ** ** of NAS signalling connection release indication before **
** reception of Detach Accept message. ** ** reception of Detach Accept message. **
** ** ** **
** 3GPP TS 24.301, section 5.5.2.2.4, case b ** ** 3GPP TS 24.301, section 5.5.2.2.4, case b **
** The detach procedure shall be aborted. ** ** The detach procedure shall be aborted. **
** ** ** **
** Inputs: args: not used ** ** Inputs: args: not used **
** Others: _emm_detach_data ** ** Others: _emm_detach_data **
** ** ** **
** Outputs: None ** ** Outputs: None **
** Return: RETURNok, RETURNerror ** ** Return: RETURNok, RETURNerror **
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
int emm_proc_detach_release(void* args) int emm_proc_detach_release(void *args)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
@@ -340,31 +340,31 @@ int emm_proc_detach_release(void* args)
/* /*
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Detach procedure executed by the MME * Detach procedure executed by the MME
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
#ifdef NAS_MME #ifdef NAS_MME
/**************************************************************************** /****************************************************************************
** ** ** **
** Name: emm_proc_detach() ** ** Name: emm_proc_detach() **
** ** ** **
** Description: Initiate the detach procedure to inform the UE that it is ** ** Description: Initiate the detach procedure to inform the UE that it is **
** detached for EPS services, or to re-attach to the network ** ** detached for EPS services, or to re-attach to the network **
** and re-establish all PDN connections. ** ** and re-establish all PDN connections. **
** ** ** **
** 3GPP TS 24.301, section 5.5.2.3.1 ** ** 3GPP TS 24.301, section 5.5.2.3.1 **
** In state EMM-REGISTERED the network initiates the detach ** ** In state EMM-REGISTERED the network initiates the detach **
** procedure by sending a DETACH REQUEST message to the UE, ** ** procedure by sending a DETACH REQUEST message to the UE, **
** starting timer T3422 and entering state EMM-DEREGISTERED- ** ** starting timer T3422 and entering state EMM-DEREGISTERED- **
** INITIATED. ** ** INITIATED. **
** ** ** **
** Inputs: ueid: UE lower layer identifier ** ** Inputs: ueid: UE lower layer identifier **
** type: Type of the requested detach ** ** type: Type of the requested detach **
** Others: _emm_detach_type_str ** ** Others: _emm_detach_type_str **
** ** ** **
** Outputs: None ** ** Outputs: None **
** Return: RETURNok, RETURNerror ** ** Return: RETURNok, RETURNerror **
** Others: T3422 ** ** Others: T3422 **
** ** ** **
***************************************************************************/ ***************************************************************************/
int emm_proc_detach(unsigned int ueid, emm_proc_detach_type_t type) int emm_proc_detach(unsigned int ueid, emm_proc_detach_type_t type)
@@ -374,7 +374,7 @@ int emm_proc_detach(unsigned int ueid, emm_proc_detach_type_t type)
int rc = RETURNerror; int rc = RETURNerror;
LOG_TRACE(INFO, "EMM-PROC - Initiate detach type = %s (%d)", LOG_TRACE(INFO, "EMM-PROC - Initiate detach type = %s (%d)",
_emm_detach_type_str[type], type); _emm_detach_type_str[type], type);
/* TODO */ /* TODO */
@@ -383,51 +383,51 @@ int emm_proc_detach(unsigned int ueid, emm_proc_detach_type_t type)
/**************************************************************************** /****************************************************************************
** ** ** **
** Name: emm_proc_detach_request() ** ** Name: emm_proc_detach_request() **
** ** ** **
** Description: Performs the UE initiated detach procedure for EPS servi- ** ** Description: Performs the UE initiated detach procedure for EPS servi- **
** ces only When the DETACH REQUEST message is received by ** ** ces only When the DETACH REQUEST message is received by **
** the network. ** ** the network. **
** ** ** **
** 3GPP TS 24.301, section 5.5.2.2.2 ** ** 3GPP TS 24.301, section 5.5.2.2.2 **
** Upon receiving the DETACH REQUEST message the network ** ** Upon receiving the DETACH REQUEST message the network **
** shall send a DETACH ACCEPT message to the UE and store ** ** shall send a DETACH ACCEPT message to the UE and store **
** the current EPS security context, if the detach type IE ** ** the current EPS security context, if the detach type IE **
** does not indicate "switch off". Otherwise, the procedure ** ** does not indicate "switch off". Otherwise, the procedure **
** is completed when the network receives the DETACH REQUEST ** ** is completed when the network receives the DETACH REQUEST **
** message. ** ** message. **
** The network shall deactivate the EPS bearer context(s) ** ** The network shall deactivate the EPS bearer context(s) **
** for this UE locally without peer-to-peer signalling and ** ** for this UE locally without peer-to-peer signalling and **
** shall enter state EMM-DEREGISTERED. ** ** shall enter state EMM-DEREGISTERED. **
** ** ** **
** Inputs: ueid: UE lower layer identifier ** ** Inputs: ueid: UE lower layer identifier **
** type: Type of the requested detach ** ** type: Type of the requested detach **
** switch_off: Indicates whether the detach is required ** ** switch_off: Indicates whether the detach is required **
** because the UE is switched off or not ** ** because the UE is switched off or not **
** native_ksi: TRUE if the security context is of type ** ** native_ksi: TRUE if the security context is of type **
** native ** ** native **
** ksi: The NAS ket sey identifier ** ** ksi: The NAS ket sey identifier **
** guti: The GUTI if provided by the UE ** ** guti: The GUTI if provided by the UE **
** imsi: The IMSI if provided by the UE ** ** imsi: The IMSI if provided by the UE **
** imei: The IMEI if provided by the UE ** ** imei: The IMEI if provided by the UE **
** Others: _emm_data ** ** Others: _emm_data **
** ** ** **
** Outputs: None ** ** Outputs: None **
** Return: RETURNok, RETURNerror ** ** Return: RETURNok, RETURNerror **
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
int emm_proc_detach_request(unsigned int ueid, emm_proc_detach_type_t type, int emm_proc_detach_request(unsigned int ueid, emm_proc_detach_type_t type,
int switch_off, int native_ksi, int ksi, int switch_off, int native_ksi, int ksi,
GUTI_t* guti, imsi_t* imsi, imei_t* imei) GUTI_t *guti, imsi_t *imsi, imei_t *imei)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
int rc; int rc;
emm_data_context_t* emm_ctx = NULL; emm_data_context_t *emm_ctx = NULL;
LOG_TRACE(INFO, "EMM-PROC - Detach type = %s (%d) requested (ueid=%u)", LOG_TRACE(INFO, "EMM-PROC - Detach type = %s (%d) requested (ueid=%u)",
_emm_detach_type_str[type], type, ueid); _emm_detach_type_str[type], type, ueid);
/* Get the UE context */ /* Get the UE context */
#if defined(EPC_BUILD) #if defined(EPC_BUILD)
@@ -436,82 +436,94 @@ int emm_proc_detach_request(unsigned int ueid, emm_proc_detach_type_t type,
} }
#else #else
if (ueid < EMM_DATA_NB_UE_MAX) { if (ueid < EMM_DATA_NB_UE_MAX) {
emm_ctx = _emm_data.ctx[ueid]; emm_ctx = _emm_data.ctx[ueid];
} }
#endif #endif
if (emm_ctx == NULL) { if (emm_ctx == NULL) {
LOG_TRACE(WARNING, "No EMM context exists for the UE (ueid=%u)", ueid); LOG_TRACE(WARNING, "No EMM context exists for the UE (ueid=%u)", ueid);
LOG_FUNC_RETURN(RETURNok); LOG_FUNC_RETURN(RETURNok);
} }
if (switch_off) if (switch_off) {
{ /* The UE is switched off */
/* The UE is switched off */ if (emm_ctx->guti) {
if (emm_ctx->guti) free(emm_ctx->guti); free(emm_ctx->guti);
if (emm_ctx->imsi) free(emm_ctx->imsi); }
if (emm_ctx->imei) free(emm_ctx->imei); if (emm_ctx->imsi) {
if (emm_ctx->esm_msg.length > 0) free(emm_ctx->esm_msg.value); free(emm_ctx->imsi);
/* Release NAS security context */ }
if (emm_ctx->security) { if (emm_ctx->imei) {
emm_security_context_t* security = emm_ctx->security; free(emm_ctx->imei);
if (security->kasme.value) free(security->kasme.value); }
if (security->knas_enc.value) free(security->knas_enc.value); if (emm_ctx->esm_msg.length > 0) {
if (security->knas_int.value) free(security->knas_int.value); free(emm_ctx->esm_msg.value);
free(emm_ctx->security); }
} /* Release NAS security context */
/* Release the EMM context */ if (emm_ctx->security) {
emm_security_context_t *security = emm_ctx->security;
if (security->kasme.value) {
free(security->kasme.value);
}
if (security->knas_enc.value) {
free(security->knas_enc.value);
}
if (security->knas_int.value) {
free(security->knas_int.value);
}
free(emm_ctx->security);
}
/* Release the EMM context */
#if defined(EPC_BUILD) #if defined(EPC_BUILD)
emm_data_context_remove(&_emm_data, emm_ctx); emm_data_context_remove(&_emm_data, emm_ctx);
free(emm_ctx); free(emm_ctx);
#else #else
free(_emm_data.ctx[ueid]); free(_emm_data.ctx[ueid]);
_emm_data.ctx[ueid] = NULL; _emm_data.ctx[ueid] = NULL;
#endif #endif
rc = RETURNok; rc = RETURNok;
} } else {
else { /* Normal detach without UE switch-off */
/* Normal detach without UE switch-off */ emm_sap_t emm_sap;
emm_sap_t emm_sap; emm_as_data_t *emm_as = &emm_sap.u.emm_as.u.data;
emm_as_data_t *emm_as = &emm_sap.u.emm_as.u.data;
/* Setup NAS information message to transfer */ /* Setup NAS information message to transfer */
emm_as->NASinfo = EMM_AS_NAS_INFO_DETACH; emm_as->NASinfo = EMM_AS_NAS_INFO_DETACH;
emm_as->NASmsg.length = 0; emm_as->NASmsg.length = 0;
emm_as->NASmsg.value = NULL; emm_as->NASmsg.value = NULL;
/* Set the UE identifier */ /* Set the UE identifier */
emm_as->guti = NULL; emm_as->guti = NULL;
emm_as->ueid = ueid; emm_as->ueid = ueid;
/* Setup EPS NAS security data */ /* Setup EPS NAS security data */
emm_as_set_security_data(&emm_as->sctx, emm_ctx->security, FALSE, TRUE); emm_as_set_security_data(&emm_as->sctx, emm_ctx->security, FALSE, TRUE);
/* /*
* Notify EMM-AS SAP that Detach Accept message has to * Notify EMM-AS SAP that Detach Accept message has to
* be sent to the network * be sent to the network
*/ */
emm_sap.primitive = EMMAS_DATA_REQ; emm_sap.primitive = EMMAS_DATA_REQ;
rc = emm_sap_send(&emm_sap); rc = emm_sap_send(&emm_sap);
} }
if (rc != RETURNerror) { if (rc != RETURNerror) {
/* /*
* Notify ESM that all EPS bearer contexts allocated for this UE have * Notify ESM that all EPS bearer contexts allocated for this UE have
* to be locally deactivated * to be locally deactivated
*/ */
esm_sap_t esm_sap; esm_sap_t esm_sap;
esm_sap.primitive = ESM_EPS_BEARER_CONTEXT_DEACTIVATE_REQ; esm_sap.primitive = ESM_EPS_BEARER_CONTEXT_DEACTIVATE_REQ;
esm_sap.ueid = ueid; esm_sap.ueid = ueid;
esm_sap.data.eps_bearer_context_deactivate.ebi = ESM_SAP_ALL_EBI; esm_sap.data.eps_bearer_context_deactivate.ebi = ESM_SAP_ALL_EBI;
rc = esm_sap_send(&esm_sap); rc = esm_sap_send(&esm_sap);
if (rc != RETURNerror) { if (rc != RETURNerror) {
emm_sap_t emm_sap; emm_sap_t emm_sap;
/* /*
* Notify EMM that the UE has been implicitly detached * Notify EMM that the UE has been implicitly detached
*/ */
emm_sap.primitive = EMMREG_DETACH_REQ; emm_sap.primitive = EMMREG_DETACH_REQ;
emm_sap.u.emm_reg.ueid = ueid; emm_sap.u.emm_reg.ueid = ueid;
rc = emm_sap_send(&emm_sap); rc = emm_sap_send(&emm_sap);
} }
} }
LOG_FUNC_RETURN(rc); LOG_FUNC_RETURN(rc);
@@ -525,31 +537,31 @@ int emm_proc_detach_request(unsigned int ueid, emm_proc_detach_type_t type,
#ifdef NAS_UE #ifdef NAS_UE
/* /*
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Timer handlers * Timer handlers
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
/**************************************************************************** /****************************************************************************
** ** ** **
** Name: _emm_detach_t3421_handler() ** ** Name: _emm_detach_t3421_handler() **
** ** ** **
** Description: T3421 timeout handler ** ** Description: T3421 timeout handler **
** ** ** **
** 3GPP TS 24.301, section 5.5.2.2.4 case c ** ** 3GPP TS 24.301, section 5.5.2.2.4 case c **
** On the first four expiries of the timer, the UE shall re- ** ** On the first four expiries of the timer, the UE shall re- **
** transmit the DETACH REQUEST message and shall reset and ** ** transmit the DETACH REQUEST message and shall reset and **
** restart timer T3421. On the fifth expiry of timer T3421, ** ** restart timer T3421. On the fifth expiry of timer T3421, **
** the detach procedure shall be aborted. ** ** the detach procedure shall be aborted. **
** ** ** **
** Inputs: args: handler parameters ** ** Inputs: args: handler parameters **
** Others: _emm_detach_data ** ** Others: _emm_detach_data **
** ** ** **
** Outputs: None ** ** Outputs: None **
** Return: None ** ** Return: None **
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
void* _emm_detach_t3421_handler(void* args) void *_emm_detach_t3421_handler(void *args)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
@@ -559,49 +571,47 @@ void* _emm_detach_t3421_handler(void* args)
_emm_detach_data.count += 1; _emm_detach_data.count += 1;
LOG_TRACE(WARNING, "EMM-PROC - T3421 timer expired, " LOG_TRACE(WARNING, "EMM-PROC - T3421 timer expired, "
"retransmission counter = %d", _emm_detach_data.count); "retransmission counter = %d", _emm_detach_data.count);
if (_emm_detach_data.count < EMM_DETACH_COUNTER_MAX) if (_emm_detach_data.count < EMM_DETACH_COUNTER_MAX) {
{ /* Retransmit the Detach Request message */
/* Retransmit the Detach Request message */ emm_sap_t emm_sap;
emm_sap_t emm_sap; emm_as_data_t *emm_as = &emm_sap.u.emm_as.u.data;
emm_as_data_t *emm_as = &emm_sap.u.emm_as.u.data;
/* Stop timer T3421 */ /* Stop timer T3421 */
T3421.id = nas_timer_stop(T3421.id); T3421.id = nas_timer_stop(T3421.id);
/* Setup NAS information message to transfer */ /* Setup NAS information message to transfer */
emm_as->NASinfo = EMM_AS_NAS_INFO_DETACH; emm_as->NASinfo = EMM_AS_NAS_INFO_DETACH;
emm_as->NASmsg.length = 0; emm_as->NASmsg.length = 0;
emm_as->NASmsg.value = NULL; emm_as->NASmsg.value = NULL;
/* Set the detach type */ /* Set the detach type */
emm_as->type = _emm_detach_data.type; emm_as->type = _emm_detach_data.type;
/* Set the switch-off indicator */ /* Set the switch-off indicator */
emm_as->switch_off = _emm_detach_data.switch_off; emm_as->switch_off = _emm_detach_data.switch_off;
/* Set the EPS mobile identity */ /* Set the EPS mobile identity */
emm_as->guti = _emm_data.guti; emm_as->guti = _emm_data.guti;
emm_as->ueid = 0; emm_as->ueid = 0;
/* Setup EPS NAS security data */ /* Setup EPS NAS security data */
emm_as_set_security_data(&emm_as->sctx, _emm_data.security, emm_as_set_security_data(&emm_as->sctx, _emm_data.security,
FALSE, TRUE); FALSE, TRUE);
/* /*
* Notify EMM-AS SAP that Detach Request message has to * Notify EMM-AS SAP that Detach Request message has to
* be sent to the network * be sent to the network
*/ */
emm_sap.primitive = EMMAS_DATA_REQ; emm_sap.primitive = EMMAS_DATA_REQ;
rc = emm_sap_send(&emm_sap); rc = emm_sap_send(&emm_sap);
if (rc != RETURNerror) { if (rc != RETURNerror) {
/* Start T3421 timer */ /* Start T3421 timer */
T3421.id = nas_timer_start(T3421.sec, _emm_detach_t3421_handler, NULL); T3421.id = nas_timer_start(T3421.sec, _emm_detach_t3421_handler, NULL);
LOG_TRACE(INFO, "EMM-PROC - Timer T3421 (%d) expires in %ld " LOG_TRACE(INFO, "EMM-PROC - Timer T3421 (%d) expires in %ld "
"seconds", T3421.id, T3421.sec); "seconds", T3421.id, T3421.sec);
} }
} } else {
else { /* Abort the detach procedure */
/* Abort the detach procedure */ rc = _emm_detach_abort(_emm_detach_data.type);
rc = _emm_detach_abort(_emm_detach_data.type);
} }
LOG_FUNC_RETURN(NULL); LOG_FUNC_RETURN(NULL);
@@ -609,22 +619,22 @@ void* _emm_detach_t3421_handler(void* args)
/* /*
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Abnormal cases in the UE * Abnormal cases in the UE
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
/**************************************************************************** /****************************************************************************
** ** ** **
** Name: _emm_detach_abort() ** ** Name: _emm_detach_abort() **
** ** ** **
** Description: Aborts the detach procedure ** ** Description: Aborts the detach procedure **
** ** ** **
** Inputs: type: not used ** ** Inputs: type: not used **
** Others: _emm_detach_data ** ** Others: _emm_detach_data **
** ** ** **
** Outputs: None ** ** Outputs: None **
** Return: RETURNok, RETURNerror ** ** Return: RETURNok, RETURNerror **
** Others: T3421 ** ** Others: T3421 **
** ** ** **
***************************************************************************/ ***************************************************************************/
static int _emm_detach_abort(emm_proc_detach_type_t type) static int _emm_detach_abort(emm_proc_detach_type_t type)
+101 -101
View File
@@ -1,30 +1,30 @@
/***************************************************************************** /*****************************************************************************
Eurecom OpenAirInterface 3 Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom Copyright(c) 2012 Eurecom
Source EmmCommon.h Source EmmCommon.h
Version 0.1 Version 0.1
Date 2013/04/19 Date 2013/04/19
Product NAS stack Product NAS stack
Subsystem EPS Mobility Management Subsystem EPS Mobility Management
Author Frederic Maurel Author Frederic Maurel
Description Defines callback functions executed within EMM common procedures Description Defines callback functions executed within EMM common procedures
by the Non-Access Stratum running at the network side. by the Non-Access Stratum running at the network side.
Following EMM common procedures can always be initiated by the Following EMM common procedures can always be initiated by the
network whilst a NAS signalling connection exists: network whilst a NAS signalling connection exists:
GUTI reallocation GUTI reallocation
authentication authentication
security mode control security mode control
identification identification
EMM information EMM information
*****************************************************************************/ *****************************************************************************/
@@ -36,7 +36,7 @@ Description Defines callback functions executed within EMM common procedures
#include "nas_log.h" #include "nas_log.h"
#include "emmData.h" #include "emmData.h"
#include <stdlib.h> // malloc, free #include <stdlib.h> // malloc, free
#include <string.h> #include <string.h>
#include <assert.h> #include <assert.h>
@@ -52,10 +52,10 @@ Description Defines callback functions executed within EMM common procedures
/******************* L O C A L D E F I N I T I O N S *******************/ /******************* L O C A L D E F I N I T I O N S *******************/
/****************************************************************************/ /****************************************************************************/
/* EMM procedure callback cleanup function */ /* EMM procedure callback cleanup function */
static void _emm_common_cleanup(unsigned int ueid); static void _emm_common_cleanup(unsigned int ueid);
/* Ongoing EMM procedure callback functions */ /* Ongoing EMM procedure callback functions */
typedef struct emm_common_data_s { typedef struct emm_common_data_s {
unsigned int ueid; unsigned int ueid;
int ref_count; int ref_count;
@@ -63,7 +63,7 @@ typedef struct emm_common_data_s {
emm_common_reject_callback_t reject; emm_common_reject_callback_t reject;
emm_common_failure_callback_t failure; emm_common_failure_callback_t failure;
emm_common_abort_callback_t abort; emm_common_abort_callback_t abort;
void* args; void *args;
#if defined(EPC_BUILD) #if defined(EPC_BUILD)
RB_ENTRY(emm_common_data_s) entries; RB_ENTRY(emm_common_data_s) entries;
@@ -117,7 +117,7 @@ struct emm_common_data_s *emm_common_data_context_get(
return RB_FIND(emm_common_data_map, &root->emm_common_data_root, &reference); return RB_FIND(emm_common_data_map, &root->emm_common_data_root, &reference);
} }
#else #else
static emm_common_data_t* _emm_common_data[EMM_DATA_NB_UE_MAX]; static emm_common_data_t *_emm_common_data[EMM_DATA_NB_UE_MAX];
#endif #endif
/****************************************************************************/ /****************************************************************************/
@@ -126,34 +126,34 @@ static emm_common_data_t* _emm_common_data[EMM_DATA_NB_UE_MAX];
/**************************************************************************** /****************************************************************************
** ** ** **
** Name: emm_proc_common_initialize() ** ** Name: emm_proc_common_initialize() **
** ** ** **
** Description: Initialize EMM procedure callback functions executed for ** ** Description: Initialize EMM procedure callback functions executed for **
** the UE with the given identifier ** ** the UE with the given identifier **
** ** ** **
** Inputs: ueid: UE lower layer identifier ** ** Inputs: ueid: UE lower layer identifier **
** success: EMM procedure executed upon successful EMM ** ** success: EMM procedure executed upon successful EMM **
** common procedure completion ** ** common procedure completion **
** reject: EMM procedure executed if the EMM common ** ** reject: EMM procedure executed if the EMM common **
** procedure failed or is rejected ** ** procedure failed or is rejected **
** failure: EMM procedure executed upon transmission ** ** failure: EMM procedure executed upon transmission **
** failure reported by lower layer ** ** failure reported by lower layer **
** abort: EMM common procedure executed when the on- ** ** abort: EMM common procedure executed when the on- **
** going EMM procedure is aborted ** ** going EMM procedure is aborted **
** args: EMM common procedure argument parameters ** ** args: EMM common procedure argument parameters **
** Others: None ** ** Others: None **
** ** ** **
** Outputs: None ** ** Outputs: None **
** Return: RETURNok, RETURNerror ** ** Return: RETURNok, RETURNerror **
** Others: _emm_common_data ** ** Others: _emm_common_data **
** ** ** **
***************************************************************************/ ***************************************************************************/
int emm_proc_common_initialize(unsigned int ueid, int emm_proc_common_initialize(unsigned int ueid,
emm_common_success_callback_t _success, emm_common_success_callback_t _success,
emm_common_reject_callback_t _reject, emm_common_reject_callback_t _reject,
emm_common_failure_callback_t _failure, emm_common_failure_callback_t _failure,
emm_common_abort_callback_t _abort, emm_common_abort_callback_t _abort,
void* args) void *args)
{ {
struct emm_common_data_s *emm_common_data_ctx = NULL; struct emm_common_data_s *emm_common_data_ctx = NULL;
LOG_FUNC_IN; LOG_FUNC_IN;
@@ -166,7 +166,7 @@ int emm_proc_common_initialize(unsigned int ueid,
#endif #endif
if (emm_common_data_ctx == NULL) { if (emm_common_data_ctx == NULL) {
emm_common_data_ctx = (emm_common_data_t*)malloc(sizeof(emm_common_data_t)); emm_common_data_ctx = (emm_common_data_t *)malloc(sizeof(emm_common_data_t));
emm_common_data_ctx->ueid = ueid; emm_common_data_ctx->ueid = ueid;
#if defined(EPC_BUILD) #if defined(EPC_BUILD)
RB_INSERT(emm_common_data_map, &emm_common_data_head.emm_common_data_root, RB_INSERT(emm_common_data_map, &emm_common_data_head.emm_common_data_root,
@@ -191,19 +191,19 @@ int emm_proc_common_initialize(unsigned int ueid,
/**************************************************************************** /****************************************************************************
** ** ** **
** Name: emm_proc_common_success() ** ** Name: emm_proc_common_success() **
** ** ** **
** Description: The EMM common procedure initiated between the UE with ** ** Description: The EMM common procedure initiated between the UE with **
** the specified identifier and the MME completed success- ** ** the specified identifier and the MME completed success- **
** fully. The network performs required actions related to ** ** fully. The network performs required actions related to **
** the ongoing EMM procedure. ** ** the ongoing EMM procedure. **
** ** ** **
** Inputs: ueid: UE lower layer identifier ** ** Inputs: ueid: UE lower layer identifier **
** Others: _emm_common_data, _emm_data ** ** Others: _emm_common_data, _emm_data **
** ** ** **
** Outputs: None ** ** Outputs: None **
** Return: RETURNok, RETURNerror ** ** Return: RETURNok, RETURNerror **
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
int emm_proc_common_success(unsigned int ueid) int emm_proc_common_success(unsigned int ueid)
@@ -244,19 +244,19 @@ int emm_proc_common_success(unsigned int ueid)
/**************************************************************************** /****************************************************************************
** ** ** **
** Name: emm_proc_common_reject() ** ** Name: emm_proc_common_reject() **
** ** ** **
** Description: The EMM common procedure initiated between the UE with ** ** Description: The EMM common procedure initiated between the UE with **
** the specified identifier and the MME failed or has been ** ** the specified identifier and the MME failed or has been **
** rejected. The network performs required actions related ** ** rejected. The network performs required actions related **
** to the ongoing EMM procedure. ** ** to the ongoing EMM procedure. **
** ** ** **
** Inputs: ueid: UE lower layer identifier ** ** Inputs: ueid: UE lower layer identifier **
** Others: _emm_common_data, _emm_data ** ** Others: _emm_common_data, _emm_data **
** ** ** **
** Outputs: None ** ** Outputs: None **
** Return: RETURNok, RETURNerror ** ** Return: RETURNok, RETURNerror **
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
int emm_proc_common_reject(unsigned int ueid) int emm_proc_common_reject(unsigned int ueid)
@@ -297,20 +297,20 @@ int emm_proc_common_reject(unsigned int ueid)
/**************************************************************************** /****************************************************************************
** ** ** **
** Name: emm_proc_common_failure() ** ** Name: emm_proc_common_failure() **
** ** ** **
** Description: The EMM common procedure has been initiated between the ** ** Description: The EMM common procedure has been initiated between the **
** UE with the specified identifier and the MME, and a lower ** ** UE with the specified identifier and the MME, and a lower **
** layer failure occurred before the EMM common procedure ** ** layer failure occurred before the EMM common procedure **
** being completed. The network performs required actions ** ** being completed. The network performs required actions **
** related to the ongoing EMM procedure. ** ** related to the ongoing EMM procedure. **
** ** ** **
** Inputs: ueid: UE lower layer identifier ** ** Inputs: ueid: UE lower layer identifier **
** Others: _emm_common_data, _emm_data ** ** Others: _emm_common_data, _emm_data **
** ** ** **
** Outputs: None ** ** Outputs: None **
** Return: RETURNok, RETURNerror ** ** Return: RETURNok, RETURNerror **
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
int emm_proc_common_failure(unsigned int ueid) int emm_proc_common_failure(unsigned int ueid)
@@ -350,19 +350,19 @@ int emm_proc_common_failure(unsigned int ueid)
/**************************************************************************** /****************************************************************************
** ** ** **
** Name: emm_proc_common_abort() ** ** Name: emm_proc_common_abort() **
** ** ** **
** Description: The ongoing EMM procedure has been aborted. The network ** ** Description: The ongoing EMM procedure has been aborted. The network **
** performs required actions related to the EMM common pro- ** ** performs required actions related to the EMM common pro- **
** cedure previously initiated between the UE with the spe- ** ** cedure previously initiated between the UE with the spe- **
** cified identifier and the MME. ** ** cified identifier and the MME. **
** ** ** **
** Inputs: ueid: UE lower layer identifier ** ** Inputs: ueid: UE lower layer identifier **
** Others: _emm_common_data ** ** Others: _emm_common_data **
** ** ** **
** Outputs: None ** ** Outputs: None **
** Return: RETURNok, RETURNerror ** ** Return: RETURNok, RETURNerror **
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
int emm_proc_common_abort(unsigned int ueid) int emm_proc_common_abort(unsigned int ueid)
@@ -402,21 +402,21 @@ int emm_proc_common_abort(unsigned int ueid)
/**************************************************************************** /****************************************************************************
** ** ** **
** Name: emm_proc_common_get_args() ** ** Name: emm_proc_common_get_args() **
** ** ** **
** Description: Returns pointer to the EMM common procedure argument pa- ** ** Description: Returns pointer to the EMM common procedure argument pa- **
** rameters allocated for the UE with the given identifier. ** ** rameters allocated for the UE with the given identifier. **
** ** ** **
** Inputs: ueid: UE lower layer identifier ** ** Inputs: ueid: UE lower layer identifier **
** Others: _emm_common_data ** ** Others: _emm_common_data **
** ** ** **
** Outputs: None ** ** Outputs: None **
** Return: pointer to the EMM common procedure argu- ** ** Return: pointer to the EMM common procedure argu- **
** ment parameters ** ** ment parameters **
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
void* emm_proc_common_get_args(unsigned int ueid) void *emm_proc_common_get_args(unsigned int ueid)
{ {
emm_common_data_t *emm_common_data_ctx = NULL; emm_common_data_t *emm_common_data_ctx = NULL;
LOG_FUNC_IN; LOG_FUNC_IN;
@@ -439,19 +439,19 @@ void* emm_proc_common_get_args(unsigned int ueid)
/**************************************************************************** /****************************************************************************
** ** ** **
** Name: emm_proc_common_cleanup() ** ** Name: emm_proc_common_cleanup() **
** ** ** **
** Description: Cleans EMM procedure callback functions upon completion ** ** Description: Cleans EMM procedure callback functions upon completion **
** of an EMM common procedure previously initiated within an ** ** of an EMM common procedure previously initiated within an **
** EMM procedure currently in progress between the network ** ** EMM procedure currently in progress between the network **
** and the UE with the specified identifier. ** ** and the UE with the specified identifier. **
** ** ** **
** Inputs: ueid: UE lower layer identifier ** ** Inputs: ueid: UE lower layer identifier **
** Others: None ** ** Others: None **
** ** ** **
** Outputs: None ** ** Outputs: None **
** Return: None ** ** Return: None **
** Others: _emm_common_data ** ** Others: _emm_common_data **
** ** ** **
***************************************************************************/ ***************************************************************************/
static void _emm_common_cleanup(unsigned int ueid) static void _emm_common_cleanup(unsigned int ueid)
@@ -469,7 +469,7 @@ static void _emm_common_cleanup(unsigned int ueid)
if (emm_common_data_ctx) { if (emm_common_data_ctx) {
emm_common_data_ctx->ref_count -= 1; emm_common_data_ctx->ref_count -= 1;
if (emm_common_data_ctx->ref_count == 0) { if (emm_common_data_ctx->ref_count == 0) {
/* Release the callback functions */ /* Release the callback functions */
#if defined(EPC_BUILD) #if defined(EPC_BUILD)
RB_REMOVE(emm_common_data_map, RB_REMOVE(emm_common_data_map,
&emm_common_data_head.emm_common_data_root, &emm_common_data_head.emm_common_data_root,
@@ -477,7 +477,7 @@ static void _emm_common_cleanup(unsigned int ueid)
#endif #endif
free(emm_common_data_ctx); free(emm_common_data_ctx);
emm_common_data_ctx = NULL; emm_common_data_ctx = NULL;
} }
} }
} }
#endif // NAS_MME #endif // NAS_MME
+27 -27
View File
@@ -1,30 +1,30 @@
/***************************************************************************** /*****************************************************************************
Eurecom OpenAirInterface 3 Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom Copyright(c) 2012 Eurecom
Source EmmCommon.h Source EmmCommon.h
Version 0.1 Version 0.1
Date 2013/04/19 Date 2013/04/19
Product NAS stack Product NAS stack
Subsystem EPS Mobility Management Subsystem EPS Mobility Management
Author Frederic Maurel Author Frederic Maurel
Description Defines callback functions executed within EMM common procedures Description Defines callback functions executed within EMM common procedures
by the Non-Access Stratum running at the network side. by the Non-Access Stratum running at the network side.
Following EMM common procedures can always be initiated by the Following EMM common procedures can always be initiated by the
network whilst a NAS signalling connection exists: network whilst a NAS signalling connection exists:
GUTI reallocation GUTI reallocation
authentication authentication
security mode control security mode control
identification identification
EMM information EMM information
*****************************************************************************/ *****************************************************************************/
#ifndef __EMM_COMMON_H__ #ifndef __EMM_COMMON_H__
@@ -47,9 +47,9 @@ Description Defines callback functions executed within EMM common procedures
* - The EMM common procedure failed or is rejected * - The EMM common procedure failed or is rejected
* - Lower layer failure occured before the EMM common procedure completion * - Lower layer failure occured before the EMM common procedure completion
*/ */
typedef int (*emm_common_success_callback_t)(void*); typedef int (*emm_common_success_callback_t)(void *);
typedef int (*emm_common_reject_callback_t) (void*); typedef int (*emm_common_reject_callback_t) (void *);
typedef int (*emm_common_failure_callback_t)(void*); typedef int (*emm_common_failure_callback_t)(void *);
/* /*
* Type of EMM common procedure callback function * Type of EMM common procedure callback function
@@ -57,7 +57,7 @@ typedef int (*emm_common_failure_callback_t)(void*);
* EMM common procedure to be executed when the ongoing EMM procedure is * EMM common procedure to be executed when the ongoing EMM procedure is
* aborted. * aborted.
*/ */
typedef int (*emm_common_abort_callback_t)(void*); typedef int (*emm_common_abort_callback_t)(void *);
/****************************************************************************/ /****************************************************************************/
/******************** G L O B A L V A R I A B L E S ********************/ /******************** G L O B A L V A R I A B L E S ********************/
@@ -68,17 +68,17 @@ typedef int (*emm_common_abort_callback_t)(void*);
/****************************************************************************/ /****************************************************************************/
int emm_proc_common_initialize(unsigned int ueid, int emm_proc_common_initialize(unsigned int ueid,
emm_common_success_callback_t success, emm_common_success_callback_t success,
emm_common_reject_callback_t reject, emm_common_reject_callback_t reject,
emm_common_failure_callback_t failure, emm_common_failure_callback_t failure,
emm_common_abort_callback_t abort, emm_common_abort_callback_t abort,
void* args); void *args);
int emm_proc_common_success(unsigned int ueid); int emm_proc_common_success(unsigned int ueid);
int emm_proc_common_reject(unsigned int ueid); int emm_proc_common_reject(unsigned int ueid);
int emm_proc_common_failure(unsigned int ueid); int emm_proc_common_failure(unsigned int ueid);
int emm_proc_common_abort(unsigned int ueid); int emm_proc_common_abort(unsigned int ueid);
void* emm_proc_common_get_args(unsigned int ueid); void *emm_proc_common_get_args(unsigned int ueid);
#endif /* __EMM_COMMON_H__*/ #endif /* __EMM_COMMON_H__*/
@@ -1,26 +1,26 @@
/***************************************************************************** /*****************************************************************************
Eurecom OpenAirInterface 3 Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom Copyright(c) 2012 Eurecom
Source Emmstatus.c Source Emmstatus.c
Version 0.1 Version 0.1
Date 2013/06/26 Date 2013/06/26
Product NAS stack Product NAS stack
Subsystem EPS Mobility Management Subsystem EPS Mobility Management
Author Frederic Maurel Author Frederic Maurel
Description Defines the EMM status procedure executed by the Non-Access Description Defines the EMM status procedure executed by the Non-Access
Stratum. Stratum.
The purpose of the sending of the EMM STATUS message is to The purpose of the sending of the EMM STATUS message is to
report at any time certain error conditions detected upon report at any time certain error conditions detected upon
receipt of EMM protocol data. The EMM STATUS message can be receipt of EMM protocol data. The EMM STATUS message can be
sent by both the MME and the UE. sent by both the MME and the UE.
*****************************************************************************/ *****************************************************************************/
@@ -47,22 +47,22 @@ Description Defines the EMM status procedure executed by the Non-Access
/**************************************************************************** /****************************************************************************
** ** ** **
** Name: emm_proc_status_ind() ** ** Name: emm_proc_status_ind() **
** ** ** **
** Description: Processes received EMM status message. ** ** Description: Processes received EMM status message. **
** ** ** **
** 3GPP TS 24.301, section 5.7 ** ** 3GPP TS 24.301, section 5.7 **
** On receipt of an EMM STATUS message no state transition ** ** On receipt of an EMM STATUS message no state transition **
** and no specific action shall be taken. Local actions are ** ** and no specific action shall be taken. Local actions are **
** possible and are implementation dependent. ** ** possible and are implementation dependent. **
** ** ** **
** Inputs: ueid: UE lower layer identifier ** ** Inputs: ueid: UE lower layer identifier **
** emm_cause: Received EMM cause code ** ** emm_cause: Received EMM cause code **
** Others: None ** ** Others: None **
** ** ** **
** Outputs: None ** ** Outputs: None **
** Return: RETURNok, RETURNerror ** ** Return: RETURNok, RETURNerror **
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
int emm_proc_status_ind(unsigned int ueid, int emm_cause) int emm_proc_status_ind(unsigned int ueid, int emm_cause)
@@ -72,7 +72,7 @@ int emm_proc_status_ind(unsigned int ueid, int emm_cause)
int rc; int rc;
LOG_TRACE(INFO,"EMM-PROC - EMM status procedure requested (cause=%d)", LOG_TRACE(INFO,"EMM-PROC - EMM status procedure requested (cause=%d)",
emm_cause); emm_cause);
LOG_TRACE(DEBUG, "EMM-PROC - To be implemented"); LOG_TRACE(DEBUG, "EMM-PROC - To be implemented");
@@ -84,17 +84,17 @@ int emm_proc_status_ind(unsigned int ueid, int emm_cause)
/**************************************************************************** /****************************************************************************
** ** ** **
** Name: emm_proc_status() ** ** Name: emm_proc_status() **
** ** ** **
** Description: Initiates EMM status procedure. ** ** Description: Initiates EMM status procedure. **
** ** ** **
** Inputs: ueid: UE lower layer identifier ** ** Inputs: ueid: UE lower layer identifier **
** emm_cause: EMM cause code to be reported ** ** emm_cause: EMM cause code to be reported **
** Others: None ** ** Others: None **
** ** ** **
** Outputs: None ** ** Outputs: None **
** Return: RETURNok, RETURNerror ** ** Return: RETURNok, RETURNerror **
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
int emm_proc_status(unsigned int ueid, int emm_cause) int emm_proc_status(unsigned int ueid, int emm_cause)
@@ -133,7 +133,7 @@ int emm_proc_status(unsigned int ueid, int emm_cause)
#endif #endif
/* Setup EPS NAS security data */ /* Setup EPS NAS security data */
emm_as_set_security_data(&emm_sap.u.emm_as.u.status.sctx, sctx, emm_as_set_security_data(&emm_sap.u.emm_as.u.status.sctx, sctx,
FALSE, TRUE); FALSE, TRUE);
rc = emm_sap_send(&emm_sap); rc = emm_sap_send(&emm_sap);
@@ -1,25 +1,25 @@
/***************************************************************************** /*****************************************************************************
Eurecom OpenAirInterface 3 Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom Copyright(c) 2012 Eurecom
Source Identification.c Source Identification.c
Version 0.1 Version 0.1
Date 2013/04/09 Date 2013/04/09
Product NAS stack Product NAS stack
Subsystem EPS Mobility Management Subsystem EPS Mobility Management
Author Frederic Maurel Author Frederic Maurel
Description Defines the identification EMM procedure executed by the Description Defines the identification EMM procedure executed by the
Non-Access Stratum. Non-Access Stratum.
The identification procedure is used by the network to request The identification procedure is used by the network to request
a particular UE to provide specific identification parameters a particular UE to provide specific identification parameters
(IMSI, IMEI). (IMSI, IMEI).
*****************************************************************************/ *****************************************************************************/
@@ -31,8 +31,8 @@ Description Defines the identification EMM procedure executed by the
#include "emm_sap.h" #include "emm_sap.h"
#include <stdlib.h> // malloc, free #include <stdlib.h> // malloc, free
#include <string.h> // memcpy #include <string.h> // memcpy
/****************************************************************************/ /****************************************************************************/
/**************** E X T E R N A L D E F I N I T I O N S ****************/ /**************** E X T E R N A L D E F I N I T I O N S ****************/
@@ -43,50 +43,50 @@ Description Defines the identification EMM procedure executed by the
/****************************************************************************/ /****************************************************************************/
/* String representation of the requested identity type */ /* String representation of the requested identity type */
static const char* _emm_identity_type_str[] = { static const char *_emm_identity_type_str[] = {
"NOT AVAILABLE", "IMSI", "IMEI", "IMEISV", "TMSI" "NOT AVAILABLE", "IMSI", "IMEI", "IMEISV", "TMSI"
}; };
/* /*
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Internal data handled by the identification procedure in the UE * Internal data handled by the identification procedure in the UE
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
#ifdef NAS_UE #ifdef NAS_UE
#endif // NAS_UE #endif // NAS_UE
/* /*
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Internal data handled by the identification procedure in the MME * Internal data handled by the identification procedure in the MME
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
#ifdef NAS_MME #ifdef NAS_MME
/* /*
* Timer handlers * Timer handlers
*/ */
static void* _identification_t3470_handler(void*); static void *_identification_t3470_handler(void *);
/* /*
* Function executed whenever the ongoing EMM procedure that initiated * Function executed whenever the ongoing EMM procedure that initiated
* the identification procedure is aborted or the maximum value of the * the identification procedure is aborted or the maximum value of the
* retransmission timer counter is exceed * retransmission timer counter is exceed
*/ */
static int _identification_abort(void*); static int _identification_abort(void *);
/* /*
* Internal data used for identification procedure * Internal data used for identification procedure
*/ */
typedef struct { typedef struct {
unsigned int ueid; /* UE identifier */ unsigned int ueid; /* UE identifier */
#define IDENTIFICATION_COUNTER_MAX 5 #define IDENTIFICATION_COUNTER_MAX 5
unsigned int retransmission_count; /* Retransmission counter */ unsigned int retransmission_count; /* Retransmission counter */
emm_proc_identity_type_t type; /* Type of UE identity */ emm_proc_identity_type_t type; /* Type of UE identity */
int notify_failure; /* Indicates whether the identification int notify_failure; /* Indicates whether the identification
* procedure failure shall be notified * procedure failure shall be notified
* to the ongoing EMM procedure */ * to the ongoing EMM procedure */
} identification_data_t; } identification_data_t;
static int _identification_request(identification_data_t* data); static int _identification_request(identification_data_t *data);
#endif // NAS_MME #endif // NAS_MME
/****************************************************************************/ /****************************************************************************/
@@ -95,28 +95,28 @@ static int _identification_request(identification_data_t* data);
/* /*
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Identification procedure executed by the UE * Identification procedure executed by the UE
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
#ifdef NAS_UE #ifdef NAS_UE
/**************************************************************************** /****************************************************************************
** ** ** **
** Name: emm_proc_identification_request() ** ** Name: emm_proc_identification_request() **
** ** ** **
** Description: Performs the MME requested identification procedure. ** ** Description: Performs the MME requested identification procedure. **
** ** ** **
** 3GPP TS 24.301, section 5.4.4.3 ** ** 3GPP TS 24.301, section 5.4.4.3 **
** Upon receiving the IDENTITY REQUEST message, the UE shall ** ** Upon receiving the IDENTITY REQUEST message, the UE shall **
** send an IDENTITY RESPONSE message to the network. The ** ** send an IDENTITY RESPONSE message to the network. The **
** IDENTITY RESPONSE message shall contain the identifica- ** ** IDENTITY RESPONSE message shall contain the identifica- **
** tion parameters as requested by the network. ** ** tion parameters as requested by the network. **
** ** ** **
** Inputs: type: Type of the requested identity ** ** Inputs: type: Type of the requested identity **
** Others: None ** ** Others: None **
** ** ** **
** Outputs: None ** ** Outputs: None **
** Return: RETURNok, RETURNerror ** ** Return: RETURNok, RETURNerror **
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
int emm_proc_identification_request(emm_proc_identity_type_t type) int emm_proc_identification_request(emm_proc_identity_type_t type)
@@ -127,48 +127,47 @@ int emm_proc_identification_request(emm_proc_identity_type_t type)
emm_sap_t emm_sap; emm_sap_t emm_sap;
LOG_TRACE(INFO, "EMM-PROC - Identification requested type = %s (%d)", LOG_TRACE(INFO, "EMM-PROC - Identification requested type = %s (%d)",
_emm_identity_type_str[type], type); _emm_identity_type_str[type], type);
/* Setup EMM procedure handler to be executed upon receiving /* Setup EMM procedure handler to be executed upon receiving
* lower layer notification */ * lower layer notification */
rc = emm_proc_lowerlayer_initialize(NULL, NULL, NULL, NULL); rc = emm_proc_lowerlayer_initialize(NULL, NULL, NULL, NULL);
if (rc != RETURNok) { if (rc != RETURNok) {
LOG_TRACE(WARNING, LOG_TRACE(WARNING,
"EMM-PROC - Failed to initialize EMM procedure handler"); "EMM-PROC - Failed to initialize EMM procedure handler");
LOG_FUNC_RETURN (RETURNerror); LOG_FUNC_RETURN (RETURNerror);
} }
emm_sap.u.emm_as.u.security.identType = EMM_IDENT_TYPE_NOT_AVAILABLE; emm_sap.u.emm_as.u.security.identType = EMM_IDENT_TYPE_NOT_AVAILABLE;
switch (type) switch (type) {
{ case EMM_IDENT_TYPE_IMSI:
case EMM_IDENT_TYPE_IMSI: /* International Mobile Subscriber Identity is requested */
/* International Mobile Subscriber Identity is requested */ if (_emm_data.imsi) {
if (_emm_data.imsi) { emm_sap.u.emm_as.u.security.identType = EMM_IDENT_TYPE_IMSI;
emm_sap.u.emm_as.u.security.identType = EMM_IDENT_TYPE_IMSI; emm_sap.u.emm_as.u.security.imsi = _emm_data.imsi;
emm_sap.u.emm_as.u.security.imsi = _emm_data.imsi; }
} break;
break;
case EMM_IDENT_TYPE_IMEI: case EMM_IDENT_TYPE_IMEI:
/* International Mobile Equipment Identity is requested */ /* International Mobile Equipment Identity is requested */
if (_emm_data.imei) { if (_emm_data.imei) {
emm_sap.u.emm_as.u.security.identType = EMM_IDENT_TYPE_IMEI; emm_sap.u.emm_as.u.security.identType = EMM_IDENT_TYPE_IMEI;
emm_sap.u.emm_as.u.security.imei = _emm_data.imei; emm_sap.u.emm_as.u.security.imei = _emm_data.imei;
} }
break; break;
case EMM_IDENT_TYPE_TMSI: case EMM_IDENT_TYPE_TMSI:
/* Temporary Mobile Subscriber Identity is requested */ /* Temporary Mobile Subscriber Identity is requested */
if (_emm_data.guti) { if (_emm_data.guti) {
emm_sap.u.emm_as.u.security.identType = EMM_IDENT_TYPE_TMSI; emm_sap.u.emm_as.u.security.identType = EMM_IDENT_TYPE_TMSI;
emm_sap.u.emm_as.u.security.tmsi = _emm_data.guti->m_tmsi; emm_sap.u.emm_as.u.security.tmsi = _emm_data.guti->m_tmsi;
} }
break; break;
default: default:
/* Other identities are not available */ /* Other identities are not available */
break; break;
} }
/* /*
@@ -181,7 +180,7 @@ int emm_proc_identification_request(emm_proc_identity_type_t type)
emm_sap.u.emm_as.u.security.msgType = EMM_AS_MSG_TYPE_IDENT; emm_sap.u.emm_as.u.security.msgType = EMM_AS_MSG_TYPE_IDENT;
/* Setup EPS NAS security data */ /* Setup EPS NAS security data */
emm_as_set_security_data(&emm_sap.u.emm_as.u.security.sctx, emm_as_set_security_data(&emm_sap.u.emm_as.u.security.sctx,
_emm_data.security, FALSE, TRUE); _emm_data.security, FALSE, TRUE);
rc = emm_sap_send(&emm_sap); rc = emm_sap_send(&emm_sap);
LOG_FUNC_RETURN (rc); LOG_FUNC_RETURN (rc);
@@ -190,86 +189,86 @@ int emm_proc_identification_request(emm_proc_identity_type_t type)
/* /*
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Identification procedure executed by the MME * Identification procedure executed by the MME
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
#ifdef NAS_MME #ifdef NAS_MME
/**************************************************************************** /****************************************************************************
** ** ** **
** Name: emm_proc_identification() ** ** Name: emm_proc_identification() **
** ** ** **
** Description: Initiates an identification procedure. ** ** Description: Initiates an identification procedure. **
** ** ** **
** 3GPP TS 24.301, section 5.4.4.2 ** ** 3GPP TS 24.301, section 5.4.4.2 **
** The network initiates the identification procedure by ** ** The network initiates the identification procedure by **
** sending an IDENTITY REQUEST message to the UE and star- ** ** sending an IDENTITY REQUEST message to the UE and star- **
** ting the timer T3470. The IDENTITY REQUEST message speci- ** ** ting the timer T3470. The IDENTITY REQUEST message speci- **
** fies the requested identification parameters in the Iden- ** ** fies the requested identification parameters in the Iden- **
** tity type information element. ** ** tity type information element. **
** ** ** **
** Inputs: ueid: UE lower layer identifier ** ** Inputs: ueid: UE lower layer identifier **
** type: Type of the requested identity ** ** type: Type of the requested identity **
** success: Callback function executed when the identi-** ** success: Callback function executed when the identi-**
** fication procedure successfully completes ** ** fication procedure successfully completes **
** reject: Callback function executed when the identi-** ** reject: Callback function executed when the identi-**
** fication procedure fails or is rejected ** ** fication procedure fails or is rejected **
** failure: Callback function executed whener a lower ** ** failure: Callback function executed whener a lower **
** layer failure occured before the identifi- ** ** layer failure occured before the identifi- **
** cation procedure comnpletes ** ** cation procedure comnpletes **
** Others: None ** ** Others: None **
** ** ** **
** Outputs: None ** ** Outputs: None **
** Return: RETURNok, RETURNerror ** ** Return: RETURNok, RETURNerror **
** Others: _emm_data ** ** Others: _emm_data **
** ** ** **
***************************************************************************/ ***************************************************************************/
int emm_proc_identification(unsigned int ueid, int emm_proc_identification(unsigned int ueid,
emm_data_context_t *emm_ctx, emm_data_context_t *emm_ctx,
emm_proc_identity_type_t type, emm_proc_identity_type_t type,
emm_common_success_callback_t success, emm_common_success_callback_t success,
emm_common_reject_callback_t reject, emm_common_reject_callback_t reject,
emm_common_failure_callback_t failure) emm_common_failure_callback_t failure)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
int rc = RETURNerror; int rc = RETURNerror;
LOG_TRACE(INFO, "EMM-PROC - Initiate identification type = %s (%d)", LOG_TRACE(INFO, "EMM-PROC - Initiate identification type = %s (%d)",
_emm_identity_type_str[type], type); _emm_identity_type_str[type], type);
/* Allocate parameters of the retransmission timer callback */ /* Allocate parameters of the retransmission timer callback */
identification_data_t* data = identification_data_t *data =
(identification_data_t*)malloc(sizeof(identification_data_t)); (identification_data_t *)malloc(sizeof(identification_data_t));
if (data != NULL) { if (data != NULL) {
/* Setup ongoing EMM procedure callback functions */ /* Setup ongoing EMM procedure callback functions */
rc = emm_proc_common_initialize(ueid, success, reject, failure, rc = emm_proc_common_initialize(ueid, success, reject, failure,
_identification_abort, data); _identification_abort, data);
if (rc != RETURNok) { if (rc != RETURNok) {
LOG_TRACE(WARNING, "Failed to initialize EMM callback functions"); LOG_TRACE(WARNING, "Failed to initialize EMM callback functions");
free(data); free(data);
LOG_FUNC_RETURN (RETURNerror); LOG_FUNC_RETURN (RETURNerror);
} }
/* Set the UE identifier */ /* Set the UE identifier */
data->ueid = ueid; data->ueid = ueid;
/* Reset the retransmission counter */ /* Reset the retransmission counter */
data->retransmission_count = 0; data->retransmission_count = 0;
/* Set the type of the requested identity */ /* Set the type of the requested identity */
data->type = type; data->type = type;
/* Set the failure notification indicator */ /* Set the failure notification indicator */
data->notify_failure = FALSE; data->notify_failure = FALSE;
/* Send identity request message to the UE */ /* Send identity request message to the UE */
rc = _identification_request(data); rc = _identification_request(data);
if (rc != RETURNerror) { if (rc != RETURNerror) {
/* /*
* Notify EMM that common procedure has been initiated * Notify EMM that common procedure has been initiated
*/ */
emm_sap_t emm_sap; emm_sap_t emm_sap;
emm_sap.primitive = EMMREG_COMMON_PROC_REQ; emm_sap.primitive = EMMREG_COMMON_PROC_REQ;
emm_sap.u.emm_reg.ueid = ueid; emm_sap.u.emm_reg.ueid = ueid;
emm_sap.u.emm_reg.ctx = emm_ctx; emm_sap.u.emm_reg.ctx = emm_ctx;
rc = emm_sap_send(&emm_sap); rc = emm_sap_send(&emm_sap);
} }
} }
LOG_FUNC_RETURN (rc); LOG_FUNC_RETURN (rc);
@@ -277,33 +276,33 @@ int emm_proc_identification(unsigned int ueid,
/**************************************************************************** /****************************************************************************
** ** ** **
** Name: emm_proc_identification_complete() ** ** Name: emm_proc_identification_complete() **
** ** ** **
** Description: Performs the identification completion procedure executed ** ** Description: Performs the identification completion procedure executed **
** by the network. ** ** by the network. **
** ** ** **
** 3GPP TS 24.301, section 5.4.4.4 ** ** 3GPP TS 24.301, section 5.4.4.4 **
** Upon receiving the IDENTITY RESPONSE message, the MME ** ** Upon receiving the IDENTITY RESPONSE message, the MME **
** shall stop timer T3470. ** ** shall stop timer T3470. **
** ** ** **
** Inputs: ueid: UE lower layer identifier ** ** Inputs: ueid: UE lower layer identifier **
** imsi: The IMSI received from the UE ** ** imsi: The IMSI received from the UE **
** imei: The IMEI received from the UE ** ** imei: The IMEI received from the UE **
** tmsi: The TMSI received from the UE ** ** tmsi: The TMSI received from the UE **
** Others: None ** ** Others: None **
** ** ** **
** Outputs: None ** ** Outputs: None **
** Return: RETURNok, RETURNerror ** ** Return: RETURNok, RETURNerror **
** Others: _emm_data, T3470 ** ** Others: _emm_data, T3470 **
** ** ** **
***************************************************************************/ ***************************************************************************/
int emm_proc_identification_complete(unsigned int ueid, const imsi_t* imsi, int emm_proc_identification_complete(unsigned int ueid, const imsi_t *imsi,
const imei_t* imei, UInt32_t* tmsi) const imei_t *imei, UInt32_t *tmsi)
{ {
int rc = RETURNerror; int rc = RETURNerror;
emm_sap_t emm_sap; emm_sap_t emm_sap;
emm_data_context_t* emm_ctx = NULL; emm_data_context_t *emm_ctx = NULL;
LOG_FUNC_IN; LOG_FUNC_IN;
@@ -314,9 +313,11 @@ int emm_proc_identification_complete(unsigned int ueid, const imsi_t* imsi,
T3470.id = nas_timer_stop(T3470.id); T3470.id = nas_timer_stop(T3470.id);
/* Release retransmission timer paramaters */ /* Release retransmission timer paramaters */
identification_data_t* data = identification_data_t *data =
(identification_data_t*)(emm_proc_common_get_args(ueid)); (identification_data_t *)(emm_proc_common_get_args(ueid));
if (data) free(data); if (data) {
free(data);
}
/* Get the UE context */ /* Get the UE context */
#if defined(EPC_BUILD) #if defined(EPC_BUILD)
@@ -330,49 +331,46 @@ int emm_proc_identification_complete(unsigned int ueid, const imsi_t* imsi,
#endif #endif
if (emm_ctx) { if (emm_ctx) {
if (imsi) { if (imsi) {
/* Update the IMSI */ /* Update the IMSI */
if (emm_ctx->imsi == NULL) { if (emm_ctx->imsi == NULL) {
emm_ctx->imsi = (imsi_t*)malloc(sizeof(imsi_t)); emm_ctx->imsi = (imsi_t *)malloc(sizeof(imsi_t));
} }
if (emm_ctx->imsi) { if (emm_ctx->imsi) {
memcpy(emm_ctx->imsi, imsi, sizeof(imsi_t)); memcpy(emm_ctx->imsi, imsi, sizeof(imsi_t));
} }
} } else if (imei) {
else if (imei) { /* Update the IMEI */
/* Update the IMEI */ if (emm_ctx->imei == NULL) {
if (emm_ctx->imei == NULL) { emm_ctx->imei = (imei_t *)malloc(sizeof(imei_t));
emm_ctx->imei = (imei_t*)malloc(sizeof(imei_t)); }
} if (emm_ctx->imei) {
if (emm_ctx->imei) { memcpy(emm_ctx->imei, imei, sizeof(imei_t));
memcpy(emm_ctx->imei, imei, sizeof(imei_t)); }
} } else if (tmsi) {
} /* Update the GUTI */
else if (tmsi) { if (emm_ctx->guti == NULL) {
/* Update the GUTI */ emm_ctx->guti = (GUTI_t *)malloc(sizeof(GUTI_t));
if (emm_ctx->guti == NULL) { }
emm_ctx->guti = (GUTI_t*)malloc(sizeof(GUTI_t)); if (emm_ctx->guti) {
} memcpy(&emm_ctx->guti->gummei,
if (emm_ctx->guti) { &_emm_data.conf.gummei, sizeof(gummei_t));
memcpy(&emm_ctx->guti->gummei, emm_ctx->guti->m_tmsi = *tmsi;
&_emm_data.conf.gummei, sizeof(gummei_t)); }
emm_ctx->guti->m_tmsi = *tmsi; }
} /*
} * Notify EMM that the identification procedure successfully completed
/* */
* Notify EMM that the identification procedure successfully completed emm_sap.primitive = EMMREG_COMMON_PROC_CNF;
*/ emm_sap.u.emm_reg.ueid = ueid;
emm_sap.primitive = EMMREG_COMMON_PROC_CNF; emm_sap.u.emm_reg.u.common.is_attached = emm_ctx->is_attached;
emm_sap.u.emm_reg.ueid = ueid; } else {
emm_sap.u.emm_reg.u.common.is_attached = emm_ctx->is_attached; LOG_TRACE(ERROR, "EMM-PROC - No EMM context exists");
} /*
else { * Notify EMM that the identification procedure failed
LOG_TRACE(ERROR, "EMM-PROC - No EMM context exists"); */
/* emm_sap.primitive = EMMREG_COMMON_PROC_REJ;
* Notify EMM that the identification procedure failed emm_sap.u.emm_reg.ueid = ueid;
*/
emm_sap.primitive = EMMREG_COMMON_PROC_REJ;
emm_sap.u.emm_reg.ueid = ueid;
} }
rc = emm_sap_send(&emm_sap); rc = emm_sap_send(&emm_sap);
@@ -389,53 +387,52 @@ int emm_proc_identification_complete(unsigned int ueid, const imsi_t* imsi,
#ifdef NAS_MME #ifdef NAS_MME
/* /*
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Timer handlers * Timer handlers
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
/**************************************************************************** /****************************************************************************
** ** ** **
** Name: _identification_t3470_handler() ** ** Name: _identification_t3470_handler() **
** ** ** **
** Description: T3470 timeout handler ** ** Description: T3470 timeout handler **
** Upon T3470 timer expiration, the identification request ** ** Upon T3470 timer expiration, the identification request **
** message is retransmitted and the timer restarted. When ** ** message is retransmitted and the timer restarted. When **
** retransmission counter is exceed, the MME shall abort the ** ** retransmission counter is exceed, the MME shall abort the **
** identification procedure and any ongoing EMM procedure. ** ** identification procedure and any ongoing EMM procedure. **
** ** ** **
** 3GPP TS 24.301, section 5.4.4.6, case b ** ** 3GPP TS 24.301, section 5.4.4.6, case b **
** ** ** **
** Inputs: args: handler parameters ** ** Inputs: args: handler parameters **
** Others: None ** ** Others: None **
** ** ** **
** Outputs: None ** ** Outputs: None **
** Return: None ** ** Return: None **
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
static void* _identification_t3470_handler(void* args) static void *_identification_t3470_handler(void *args)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
int rc; int rc;
identification_data_t* data = (identification_data_t*)(args); identification_data_t *data = (identification_data_t *)(args);
/* Increment the retransmission counter */ /* Increment the retransmission counter */
data->retransmission_count += 1; data->retransmission_count += 1;
LOG_TRACE(WARNING, "EMM-PROC - T3470 timer expired, retransmission " LOG_TRACE(WARNING, "EMM-PROC - T3470 timer expired, retransmission "
"counter = %d", data->retransmission_count); "counter = %d", data->retransmission_count);
if (data->retransmission_count < IDENTIFICATION_COUNTER_MAX) { if (data->retransmission_count < IDENTIFICATION_COUNTER_MAX) {
/* Send identity request message to the UE */ /* Send identity request message to the UE */
rc = _identification_request(data); rc = _identification_request(data);
} } else {
else { /* Set the failure notification indicator */
/* Set the failure notification indicator */ data->notify_failure = TRUE;
data->notify_failure = TRUE; /* Abort the identification procedure */
/* Abort the identification procedure */ rc = _identification_abort(data);
rc = _identification_abort(data);
} }
LOG_FUNC_RETURN (NULL); LOG_FUNC_RETURN (NULL);
@@ -443,25 +440,25 @@ static void* _identification_t3470_handler(void* args)
/* /*
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* MME specific local functions * MME specific local functions
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
/**************************************************************************** /****************************************************************************
** ** ** **
** Name: _identification_request() ** ** Name: _identification_request() **
** ** ** **
** Description: Sends IDENTITY REQUEST message and start timer T3470. ** ** Description: Sends IDENTITY REQUEST message and start timer T3470. **
** ** ** **
** Inputs: args: handler parameters ** ** Inputs: args: handler parameters **
** Others: None ** ** Others: None **
** ** ** **
** Outputs: None ** ** Outputs: None **
** Return: None ** ** Return: None **
** Others: T3470 ** ** Others: T3470 **
** ** ** **
***************************************************************************/ ***************************************************************************/
int _identification_request(identification_data_t* data) int _identification_request(identification_data_t *data)
{ {
emm_sap_t emm_sap; emm_sap_t emm_sap;
int rc; int rc;
@@ -495,16 +492,16 @@ int _identification_request(identification_data_t* data)
rc = emm_sap_send(&emm_sap); rc = emm_sap_send(&emm_sap);
if (rc != RETURNerror) { if (rc != RETURNerror) {
if (T3470.id != NAS_TIMER_INACTIVE_ID) { if (T3470.id != NAS_TIMER_INACTIVE_ID) {
/* Re-start T3470 timer */ /* Re-start T3470 timer */
T3470.id = nas_timer_restart(T3470.id); T3470.id = nas_timer_restart(T3470.id);
} else { } else {
/* Start T3470 timer */ /* Start T3470 timer */
T3470.id = nas_timer_start(T3470.sec, _identification_t3470_handler, T3470.id = nas_timer_start(T3470.sec, _identification_t3470_handler,
data); data);
} }
LOG_TRACE(INFO,"EMM-PROC - Timer T3470 (%d) expires in %ld seconds", LOG_TRACE(INFO,"EMM-PROC - Timer T3470 (%d) expires in %ld seconds",
T3470.id, T3470.sec); T3470.id, T3470.sec);
} }
LOG_FUNC_RETURN (rc); LOG_FUNC_RETURN (rc);
@@ -512,53 +509,52 @@ int _identification_request(identification_data_t* data)
/**************************************************************************** /****************************************************************************
** ** ** **
** Name: _identification_abort() ** ** Name: _identification_abort() **
** ** ** **
** Description: Aborts the identification procedure currently in progress ** ** Description: Aborts the identification procedure currently in progress **
** ** ** **
** Inputs: args: Identification data to be released ** ** Inputs: args: Identification data to be released **
** Others: None ** ** Others: None **
** ** ** **
** Outputs: None ** ** Outputs: None **
** Return: None ** ** Return: None **
** Others: T3470 ** ** Others: T3470 **
** ** ** **
***************************************************************************/ ***************************************************************************/
static int _identification_abort(void* args) static int _identification_abort(void *args)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
int rc = RETURNerror; int rc = RETURNerror;
identification_data_t* data = (identification_data_t*)(args); identification_data_t *data = (identification_data_t *)(args);
if (data) if (data) {
{ unsigned int ueid = data->ueid;
unsigned int ueid = data->ueid; int notify_failure = data->notify_failure;
int notify_failure = data->notify_failure;
LOG_TRACE(WARNING, "EMM-PROC - Abort identification procedure " LOG_TRACE(WARNING, "EMM-PROC - Abort identification procedure "
"(ueid=%u)", ueid); "(ueid=%u)", ueid);
/* Stop timer T3470 */ /* Stop timer T3470 */
if (T3470.id != NAS_TIMER_INACTIVE_ID) { if (T3470.id != NAS_TIMER_INACTIVE_ID) {
LOG_TRACE(INFO, "EMM-PROC - Stop timer T3470 (%d)", T3470.id); LOG_TRACE(INFO, "EMM-PROC - Stop timer T3470 (%d)", T3470.id);
T3470.id = nas_timer_stop(T3470.id); T3470.id = nas_timer_stop(T3470.id);
} }
/* Release retransmission timer paramaters */ /* Release retransmission timer paramaters */
free(data); free(data);
/* /*
* Notify EMM that the identification procedure failed * Notify EMM that the identification procedure failed
*/ */
if (notify_failure) { if (notify_failure) {
emm_sap_t emm_sap; emm_sap_t emm_sap;
emm_sap.primitive = EMMREG_COMMON_PROC_REJ; emm_sap.primitive = EMMREG_COMMON_PROC_REJ;
emm_sap.u.emm_reg.ueid = ueid; emm_sap.u.emm_reg.ueid = ueid;
rc = emm_sap_send(&emm_sap); rc = emm_sap_send(&emm_sap);
} else { } else {
rc = RETURNok; rc = RETURNok;
} }
} }
LOG_FUNC_RETURN(rc); LOG_FUNC_RETURN(rc);
File diff suppressed because it is too large Load Diff
+19 -17
View File
@@ -1,22 +1,22 @@
/***************************************************************************** /*****************************************************************************
Eurecom OpenAirInterface 3 Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom Copyright(c) 2012 Eurecom
Source IdleMode.h Source IdleMode.h
Version 0.1 Version 0.1
Date 2012/10/23 Date 2012/10/23
Product NAS stack Product NAS stack
Subsystem EPS Mobility Management Subsystem EPS Mobility Management
Author Frederic Maurel Author Frederic Maurel
Description Defines the functions used to get information from the list Description Defines the functions used to get information from the list
of available PLMNs locally maintained when the UE is in of available PLMNs locally maintained when the UE is in
idle mode. idle mode.
*****************************************************************************/ *****************************************************************************/
#ifndef __IDLEMODE_H__ #ifndef __IDLEMODE_H__
@@ -51,12 +51,14 @@ int IdleMode_get_splmn_index(void);
int IdleMode_update_plmn_list(int index); int IdleMode_update_plmn_list(int index);
const char* IdleMode_get_plmn_fullname(const plmn_t* plmn, int index, size_t* len); const char *IdleMode_get_plmn_fullname(const plmn_t *plmn, int index,
const char* IdleMode_get_plmn_shortname(const plmn_t* plmn, int index, size_t* len); size_t *len);
const char* IdleMode_get_plmn_id(const plmn_t* plmn, int index, size_t* len); const char *IdleMode_get_plmn_shortname(const plmn_t *plmn, int index,
size_t *len);
const char *IdleMode_get_plmn_id(const plmn_t *plmn, int index, size_t *len);
int IdleMode_get_plmn_fullname_index(const char* plmn); int IdleMode_get_plmn_fullname_index(const char *plmn);
int IdleMode_get_plmn_shortname_index(const char* plmn); int IdleMode_get_plmn_shortname_index(const char *plmn);
int IdleMode_get_plmn_id_index(const char* plmn); int IdleMode_get_plmn_id_index(const char *plmn);
#endif /* __IDLEMODE_H__*/ #endif /* __IDLEMODE_H__*/
+152 -153
View File
@@ -1,24 +1,24 @@
/***************************************************************************** /*****************************************************************************
Eurecom OpenAirInterface 3 Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom Copyright(c) 2012 Eurecom
Source LowerLayer.c Source LowerLayer.c
Version 0.1 Version 0.1
Date 2012/03/14 Date 2012/03/14
Product NAS stack Product NAS stack
Subsystem EPS Mobility Management Subsystem EPS Mobility Management
Author Frederic Maurel Author Frederic Maurel
Description Defines EMM procedures executed by the Non-Access Stratum Description Defines EMM procedures executed by the Non-Access Stratum
upon receiving notifications from lower layers so that data upon receiving notifications from lower layers so that data
transfer succeed or failed, or NAS signalling connection is transfer succeed or failed, or NAS signalling connection is
released, or ESM unit data has been received from under layer, released, or ESM unit data has been received from under layer,
and to request ESM unit data transfer to under layer. and to request ESM unit data transfer to under layer.
*****************************************************************************/ *****************************************************************************/
@@ -31,7 +31,7 @@ Description Defines EMM procedures executed by the Non-Access Stratum
#include "emm_sap.h" #include "emm_sap.h"
#include "esm_sap.h" #include "esm_sap.h"
#include <string.h> // memset #include <string.h> // memset
/****************************************************************************/ /****************************************************************************/
/**************** E X T E R N A L D E F I N I T I O N S ****************/ /**************** E X T E R N A L D E F I N I T I O N S ****************/
@@ -47,10 +47,10 @@ Description Defines EMM procedures executed by the Non-Access Stratum
* receiving lower layer notifications * receiving lower layer notifications
*/ */
static struct { static struct {
lowerlayer_success_callback_t success; /* Successful data delivery */ lowerlayer_success_callback_t success; /* Successful data delivery */
lowerlayer_failure_callback_t failure; /* Lower layer failure */ lowerlayer_failure_callback_t failure; /* Lower layer failure */
lowerlayer_release_callback_t release; /* NAS signalling release */ lowerlayer_release_callback_t release; /* NAS signalling release */
void* args; /* EMM procedure argument parameters */ void *args; /* EMM procedure argument parameters */
} _lowerlayer_data; } _lowerlayer_data;
#endif #endif
@@ -60,23 +60,23 @@ static struct {
/* /*
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Lower layer notification handlers * Lower layer notification handlers
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
/**************************************************************************** /****************************************************************************
** ** ** **
** Name: lowerlayer_success() ** ** Name: lowerlayer_success() **
** ** ** **
** Description: Notify the EPS Mobility Management entity that data have ** ** Description: Notify the EPS Mobility Management entity that data have **
** been successfully delivered to the network ** ** been successfully delivered to the network **
** ** ** **
** Inputs: ueid: UE lower layer identifier ** ** Inputs: ueid: UE lower layer identifier **
** Others: None ** ** Others: None **
** ** ** **
** Outputs: None ** ** Outputs: None **
** Return: RETURNok, RETURNerror ** ** Return: RETURNok, RETURNerror **
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
int lowerlayer_success(unsigned int ueid) int lowerlayer_success(unsigned int ueid)
@@ -95,17 +95,17 @@ int lowerlayer_success(unsigned int ueid)
/**************************************************************************** /****************************************************************************
** ** ** **
** Name: lowerlayer_failure() ** ** Name: lowerlayer_failure() **
** ** ** **
** Description: Notify the EPS Mobility Management entity that lower la- ** ** Description: Notify the EPS Mobility Management entity that lower la- **
** yers failed to deliver data to the network ** ** yers failed to deliver data to the network **
** ** ** **
** Inputs: ueid: UE lower layer identifier ** ** Inputs: ueid: UE lower layer identifier **
** Others: None ** ** Others: None **
** ** ** **
** Outputs: None ** ** Outputs: None **
** Return: RETURNok, RETURNerror ** ** Return: RETURNok, RETURNerror **
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
int lowerlayer_failure(unsigned int ueid) int lowerlayer_failure(unsigned int ueid)
@@ -124,18 +124,18 @@ int lowerlayer_failure(unsigned int ueid)
/**************************************************************************** /****************************************************************************
** ** ** **
** Name: lowerlayer_establish() ** ** Name: lowerlayer_establish() **
** ** ** **
** Description: Update the EPS connection management status upon recei- ** ** Description: Update the EPS connection management status upon recei- **
** ving indication so that the NAS signalling connection is ** ** ving indication so that the NAS signalling connection is **
** established ** ** established **
** ** ** **
** Inputs: None ** ** Inputs: None **
** Others: None ** ** Others: None **
** ** ** **
** Outputs: None ** ** Outputs: None **
** Return: RETURNok, RETURNerror ** ** Return: RETURNok, RETURNerror **
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
int lowerlayer_establish(void) int lowerlayer_establish(void)
@@ -152,17 +152,17 @@ int lowerlayer_establish(void)
/**************************************************************************** /****************************************************************************
** ** ** **
** Name: lowerlayer_release() ** ** Name: lowerlayer_release() **
** ** ** **
** Description: Notify the EPS Mobility Management entity that NAS signal-** ** Description: Notify the EPS Mobility Management entity that NAS signal-**
** ling connection has been released ** ** ling connection has been released **
** ** ** **
** Inputs: cause: Release cause ** ** Inputs: cause: Release cause **
** Others: None ** ** Others: None **
** ** ** **
** Outputs: None ** ** Outputs: None **
** Return: RETURNok, RETURNerror ** ** Return: RETURNok, RETURNerror **
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
int lowerlayer_release(int cause) int lowerlayer_release(int cause)
@@ -186,21 +186,21 @@ int lowerlayer_release(int cause)
/**************************************************************************** /****************************************************************************
** ** ** **
** Name: lowerlayer_data_ind() ** ** Name: lowerlayer_data_ind() **
** ** ** **
** Description: Notify the EPS Session Management entity that data have ** ** Description: Notify the EPS Session Management entity that data have **
** been received from lower layers ** ** been received from lower layers **
** ** ** **
** Inputs: ueid: UE lower layer identifier ** ** Inputs: ueid: UE lower layer identifier **
** data: Data transfered from lower layers ** ** data: Data transfered from lower layers **
** Others: None ** ** Others: None **
** ** ** **
** Outputs: None ** ** Outputs: None **
** Return: RETURNok, RETURNerror ** ** Return: RETURNok, RETURNerror **
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
int lowerlayer_data_ind(unsigned int ueid, const OctetString* data) int lowerlayer_data_ind(unsigned int ueid, const OctetString *data)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
@@ -218,21 +218,21 @@ int lowerlayer_data_ind(unsigned int ueid, const OctetString* data)
/**************************************************************************** /****************************************************************************
** ** ** **
** Name: lowerlayer_data_req() ** ** Name: lowerlayer_data_req() **
** ** ** **
** Description: Notify the EPS Mobility Management entity that data have ** ** Description: Notify the EPS Mobility Management entity that data have **
** to be transfered to lower layers ** ** to be transfered to lower layers **
** ** ** **
** Inputs: ueid: UE lower layer identifier ** ** Inputs: ueid: UE lower layer identifier **
** data: Data to be transfered to lower layers ** ** data: Data to be transfered to lower layers **
** Others: None ** ** Others: None **
** ** ** **
** Outputs: None ** ** Outputs: None **
** Return: RETURNok, RETURNerror ** ** Return: RETURNok, RETURNerror **
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
int lowerlayer_data_req(unsigned int ueid, const OctetString* data) int lowerlayer_data_req(unsigned int ueid, const OctetString *data)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
@@ -275,35 +275,35 @@ int lowerlayer_data_req(unsigned int ueid, const OctetString* data)
/* /*
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* EMM procedure handlers * EMM procedure handlers
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
#ifdef NAS_UE #ifdef NAS_UE
/**************************************************************************** /****************************************************************************
** ** ** **
** Name: emm_proc_lowerlayer_initialize() ** ** Name: emm_proc_lowerlayer_initialize() **
** ** ** **
** Description: Initialize EMM procedure handler ** ** Description: Initialize EMM procedure handler **
** ** ** **
** Inputs: success: EMM procedure executed when data have been ** ** Inputs: success: EMM procedure executed when data have been **
** successfully delivered by lower layers ** ** successfully delivered by lower layers **
** failure: EMM procedure executed upon transmission ** ** failure: EMM procedure executed upon transmission **
** failure reported by lower layers ** ** failure reported by lower layers **
** release: EMM procedure executed when lower layers ** ** release: EMM procedure executed when lower layers **
** report that NAS signalling connection has ** ** report that NAS signalling connection has **
** been released ** ** been released **
** args: EMM procedure argument parameters ** ** args: EMM procedure argument parameters **
** Others: None ** ** Others: None **
** ** ** **
** Outputs: None ** ** Outputs: None **
** Return: RETURNok, RETURNerror ** ** Return: RETURNok, RETURNerror **
** Others: _lowerlayer_data ** ** Others: _lowerlayer_data **
** ** ** **
***************************************************************************/ ***************************************************************************/
int emm_proc_lowerlayer_initialize(lowerlayer_success_callback_t success, int emm_proc_lowerlayer_initialize(lowerlayer_success_callback_t success,
lowerlayer_failure_callback_t failure, lowerlayer_failure_callback_t failure,
lowerlayer_release_callback_t release, lowerlayer_release_callback_t release,
void* args) void *args)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
@@ -317,18 +317,18 @@ int emm_proc_lowerlayer_initialize(lowerlayer_success_callback_t success,
/**************************************************************************** /****************************************************************************
** ** ** **
** Name: emm_proc_lowerlayer_success() ** ** Name: emm_proc_lowerlayer_success() **
** ** ** **
** Description: Handles EMM procedure to be executed upon receiving noti- ** ** Description: Handles EMM procedure to be executed upon receiving noti- **
** fication that data have been successfully delivered to ** ** fication that data have been successfully delivered to **
** the network. ** ** the network. **
** ** ** **
** Inputs: None ** ** Inputs: None **
** Others: None ** ** Others: None **
** ** ** **
** Outputs: None ** ** Outputs: None **
** Return: RETURNok, RETURNerror ** ** Return: RETURNok, RETURNerror **
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
int emm_proc_lowerlayer_success(void) int emm_proc_lowerlayer_success(void)
@@ -340,8 +340,8 @@ int emm_proc_lowerlayer_success(void)
lowerlayer_success_callback_t emm_callback = _lowerlayer_data.success; lowerlayer_success_callback_t emm_callback = _lowerlayer_data.success;
if (emm_callback) { if (emm_callback) {
rc = (*emm_callback)(_lowerlayer_data.args); rc = (*emm_callback)(_lowerlayer_data.args);
_lowerlayer_data.success = NULL; _lowerlayer_data.success = NULL;
} }
LOG_FUNC_RETURN (rc); LOG_FUNC_RETURN (rc);
@@ -349,18 +349,18 @@ int emm_proc_lowerlayer_success(void)
/**************************************************************************** /****************************************************************************
** ** ** **
** Name: emm_proc_lowerlayer_failure() ** ** Name: emm_proc_lowerlayer_failure() **
** ** ** **
** Description: Handles EMM procedure to be executed upon receiving noti- ** ** Description: Handles EMM procedure to be executed upon receiving noti- **
** fication that data failed to be delivered to the network. ** ** fication that data failed to be delivered to the network. **
** ** ** **
** Inputs: is_initial: TRUE if the NAS message that failed to be ** ** Inputs: is_initial: TRUE if the NAS message that failed to be **
** transfered is an initial NAS message ** ** transfered is an initial NAS message **
** Others: None ** ** Others: None **
** ** ** **
** Outputs: None ** ** Outputs: None **
** Return: RETURNok, RETURNerror ** ** Return: RETURNok, RETURNerror **
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
int emm_proc_lowerlayer_failure(int is_initial) int emm_proc_lowerlayer_failure(int is_initial)
@@ -372,8 +372,8 @@ int emm_proc_lowerlayer_failure(int is_initial)
lowerlayer_failure_callback_t emm_callback = _lowerlayer_data.failure; lowerlayer_failure_callback_t emm_callback = _lowerlayer_data.failure;
if (emm_callback) { if (emm_callback) {
rc = (*emm_callback)(is_initial, _lowerlayer_data.args); rc = (*emm_callback)(is_initial, _lowerlayer_data.args);
_lowerlayer_data.failure = NULL; _lowerlayer_data.failure = NULL;
} }
LOG_FUNC_RETURN (rc); LOG_FUNC_RETURN (rc);
@@ -381,17 +381,17 @@ int emm_proc_lowerlayer_failure(int is_initial)
/**************************************************************************** /****************************************************************************
** ** ** **
** Name: emm_proc_lowerlayer_release() ** ** Name: emm_proc_lowerlayer_release() **
** ** ** **
** Description: Handles EMM procedure to be executed upon receiving noti- ** ** Description: Handles EMM procedure to be executed upon receiving noti- **
** fication that NAS signalling connection has been released ** ** fication that NAS signalling connection has been released **
** ** ** **
** Inputs: None ** ** Inputs: None **
** Others: None ** ** Others: None **
** ** ** **
** Outputs: None ** ** Outputs: None **
** Return: RETURNok, RETURNerror ** ** Return: RETURNok, RETURNerror **
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
int emm_proc_lowerlayer_release(void) int emm_proc_lowerlayer_release(void)
@@ -403,8 +403,8 @@ int emm_proc_lowerlayer_release(void)
lowerlayer_release_callback_t emm_callback = _lowerlayer_data.release; lowerlayer_release_callback_t emm_callback = _lowerlayer_data.release;
if (emm_callback) { if (emm_callback) {
rc = (*emm_callback)(_lowerlayer_data.args); rc = (*emm_callback)(_lowerlayer_data.args);
_lowerlayer_data.release = NULL; _lowerlayer_data.release = NULL;
} }
LOG_FUNC_RETURN (rc); LOG_FUNC_RETURN (rc);
@@ -413,60 +413,59 @@ int emm_proc_lowerlayer_release(void)
/**************************************************************************** /****************************************************************************
** ** ** **
** Name: emm_as_set_security_data() ** ** Name: emm_as_set_security_data() **
** ** ** **
** Description: Setup security data according to the given EPS security ** ** Description: Setup security data according to the given EPS security **
** context when data transfer to lower layers is requested ** ** context when data transfer to lower layers is requested **
** ** ** **
** Inputs: args: EPS security context currently in use ** ** Inputs: args: EPS security context currently in use **
** is_new: Indicates whether a new security context ** ** is_new: Indicates whether a new security context **
** has just been taken into use ** ** has just been taken into use **
** is_ciphered: Indicates whether the NAS message has to ** ** is_ciphered: Indicates whether the NAS message has to **
** be sent ciphered ** ** be sent ciphered **
** Others: None ** ** Others: None **
** ** ** **
** Outputs: data: EPS NAS security data to be setup ** ** Outputs: data: EPS NAS security data to be setup **
** Return: None ** ** Return: None **
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
void emm_as_set_security_data(emm_as_security_data_t* data, const void* args, void emm_as_set_security_data(emm_as_security_data_t *data, const void *args,
int is_new, int is_ciphered) int is_new, int is_ciphered)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
const emm_security_context_t* context = (emm_security_context_t*)(args); const emm_security_context_t *context = (emm_security_context_t *)(args);
memset(data, 0, sizeof(emm_as_security_data_t)); memset(data, 0, sizeof(emm_as_security_data_t));
if ( context && (context->type != EMM_KSI_NOT_AVAILABLE) ) { if ( context && (context->type != EMM_KSI_NOT_AVAILABLE) ) {
/* 3GPP TS 24.301, sections 5.4.3.3 and 5.4.3.4 /* 3GPP TS 24.301, sections 5.4.3.3 and 5.4.3.4
* Once a valid EPS security context exists and has been taken * Once a valid EPS security context exists and has been taken
* into use, UE and MME shall cipher and integrity protect all * into use, UE and MME shall cipher and integrity protect all
* NAS signalling messages with the selected NAS ciphering and * NAS signalling messages with the selected NAS ciphering and
* NAS integrity algorithms */ * NAS integrity algorithms */
data->is_new = is_new; data->is_new = is_new;
data->ksi = context->eksi; data->ksi = context->eksi;
data->sqn = context->ul_count.seq_num; data->sqn = context->ul_count.seq_num;
data->count = *(UInt32_t*)(&context->ul_count); data->count = *(UInt32_t *)(&context->ul_count);
/* NAS integrity and cyphering keys may not be available if the /* NAS integrity and cyphering keys may not be available if the
* current security context is a partial EPS security context * current security context is a partial EPS security context
* and not a full native EPS security context */ * and not a full native EPS security context */
data->k_int = &context->knas_int; data->k_int = &context->knas_int;
if (is_ciphered) { if (is_ciphered) {
/* 3GPP TS 24.301, sections 4.4.5 /* 3GPP TS 24.301, sections 4.4.5
* When the UE establishes a new NAS signalling connection, * When the UE establishes a new NAS signalling connection,
* it shall send initial NAS messages integrity protected * it shall send initial NAS messages integrity protected
* and unciphered */ * and unciphered */
/* 3GPP TS 24.301, section 5.4.3.2 /* 3GPP TS 24.301, section 5.4.3.2
* The MME shall send the SECURITY MODE COMMAND message integrity * The MME shall send the SECURITY MODE COMMAND message integrity
* protected and unciphered */ * protected and unciphered */
data->k_enc = &context->knas_enc; data->k_enc = &context->knas_enc;
} }
} } else {
else { /* No valid EPS security context exists */
/* No valid EPS security context exists */ data->ksi = EMM_AS_NO_KEY_AVAILABLE;
data->ksi = EMM_AS_NO_KEY_AVAILABLE;
} }
LOG_FUNC_OUT; LOG_FUNC_OUT;
+18 -18
View File
@@ -1,24 +1,24 @@
/***************************************************************************** /*****************************************************************************
Eurecom OpenAirInterface 3 Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom Copyright(c) 2012 Eurecom
Source lowerlayer.h Source lowerlayer.h
Version 0.1 Version 0.1
Date 2013/06/19 Date 2013/06/19
Product NAS stack Product NAS stack
Subsystem EPS Mobility Management Subsystem EPS Mobility Management
Author Frederic Maurel Author Frederic Maurel
Description Defines EMM procedures executed by the Non-Access Stratum Description Defines EMM procedures executed by the Non-Access Stratum
upon receiving notifications from lower layers so that data upon receiving notifications from lower layers so that data
transfer succeed or failed, or NAS signalling connection is transfer succeed or failed, or NAS signalling connection is
released, or ESM unit data has been received from under layer, released, or ESM unit data has been received from under layer,
and to request ESM unit data transfer to under layer. and to request ESM unit data transfer to under layer.
*****************************************************************************/ *****************************************************************************/
#ifndef __LOWERLAYER_H__ #ifndef __LOWERLAYER_H__
@@ -35,19 +35,19 @@ Description Defines EMM procedures executed by the Non-Access Stratum
* Type of EMM procedure callback function executed whenever data are * Type of EMM procedure callback function executed whenever data are
* successfully delivered to the network * successfully delivered to the network
*/ */
typedef int (*lowerlayer_success_callback_t)(void*); typedef int (*lowerlayer_success_callback_t)(void *);
/* /*
* Type of EMM procedure callback function executed when data are not * Type of EMM procedure callback function executed when data are not
* delivered to the network because a lower layer failure occurred * delivered to the network because a lower layer failure occurred
*/ */
typedef int (*lowerlayer_failure_callback_t)(int, void*); typedef int (*lowerlayer_failure_callback_t)(int, void *);
/* /*
* Type of EMM procedure callback function executed when NAS signalling * Type of EMM procedure callback function executed when NAS signalling
* connection is released * connection is released
*/ */
typedef int (*lowerlayer_release_callback_t)(void*); typedef int (*lowerlayer_release_callback_t)(void *);
#endif #endif
/****************************************************************************/ /****************************************************************************/
@@ -67,7 +67,7 @@ int lowerlayer_failure(unsigned int ueid);
int lowerlayer_establish(void); int lowerlayer_establish(void);
int lowerlayer_release(int cause); int lowerlayer_release(int cause);
int lowerlayer_data_ind(unsigned int ueid, const OctetString* data); int lowerlayer_data_ind(unsigned int ueid, const OctetString *data);
int lowerlayer_data_req(unsigned int ueid, const OctetString* data); int lowerlayer_data_req(unsigned int ueid, const OctetString *data);
#endif /* __LOWERLAYER_H__*/ #endif /* __LOWERLAYER_H__*/
File diff suppressed because it is too large Load Diff
@@ -1,30 +1,30 @@
/***************************************************************************** /*****************************************************************************
Eurecom OpenAirInterface 3 Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom Copyright(c) 2012 Eurecom
Source ServiceRequest.c Source ServiceRequest.c
Version 0.1 Version 0.1
Date 2013/05/07 Date 2013/05/07
Product NAS stack Product NAS stack
Subsystem EPS Mobility Management Subsystem EPS Mobility Management
Author Frederic Maurel Author Frederic Maurel
Description Defines the service request EMM procedure executed by the Description Defines the service request EMM procedure executed by the
Non-Access Stratum. Non-Access Stratum.
The purpose of the service request procedure is to transfer The purpose of the service request procedure is to transfer
the EMM mode from EMM-IDLE to EMM-CONNECTED mode and establish the EMM mode from EMM-IDLE to EMM-CONNECTED mode and establish
the radio and S1 bearers when uplink user data or signalling the radio and S1 bearers when uplink user data or signalling
is to be sent. is to be sent.
This procedure is used when the network has downlink signalling This procedure is used when the network has downlink signalling
pending, the UE has uplink signalling pending, the UE or the pending, the UE has uplink signalling pending, the UE or the
network has user data pending and the UE is in EMM-IDLE mode. network has user data pending and the UE is in EMM-IDLE mode.
*****************************************************************************/ *****************************************************************************/
@@ -46,19 +46,19 @@ Description Defines the service request EMM procedure executed by the
/* /*
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Internal data handled by the service request procedure in the UE * Internal data handled by the service request procedure in the UE
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
#ifdef NAS_UE #ifdef NAS_UE
/* /*
* Timer handlers * Timer handlers
*/ */
void* _emm_service_t3417_handler(void*); void *_emm_service_t3417_handler(void *);
#endif // NAS_UE #endif // NAS_UE
/* /*
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Internal data handled by the service request procedure in the MME * Internal data handled by the service request procedure in the MME
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
#ifdef NAS_MME #ifdef NAS_MME
@@ -75,27 +75,27 @@ void* _emm_service_t3417_handler(void*);
#ifdef NAS_UE #ifdef NAS_UE
/* /*
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Timer handlers * Timer handlers
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
/**************************************************************************** /****************************************************************************
** ** ** **
** Name: _emm_service_t3417_handler() ** ** Name: _emm_service_t3417_handler() **
** ** ** **
** Description: T3417 timeout handler ** ** Description: T3417 timeout handler **
** ** ** **
** 3GPP TS 24.301, section 5.6.1.6 case c ** ** 3GPP TS 24.301, section 5.6.1.6 case c **
** ** ** **
** Inputs: args: handler parameters ** ** Inputs: args: handler parameters **
** Others: None ** ** Others: None **
** ** ** **
** Outputs: None ** ** Outputs: None **
** Return: None ** ** Return: None **
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
void* _emm_service_t3417_handler(void* args) void *_emm_service_t3417_handler(void *args)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
@@ -1,27 +1,27 @@
/***************************************************************************** /*****************************************************************************
Eurecom OpenAirInterface 3 Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom Copyright(c) 2012 Eurecom
Source TrackingAreaUpdate.c Source TrackingAreaUpdate.c
Version 0.1 Version 0.1
Date 2013/05/07 Date 2013/05/07
Product NAS stack Product NAS stack
Subsystem EPS Mobility Management Subsystem EPS Mobility Management
Author Frederic Maurel Author Frederic Maurel
Description Defines the tracking area update EMM procedure executed by the Description Defines the tracking area update EMM procedure executed by the
Non-Access Stratum. Non-Access Stratum.
The tracking area updating procedure is always initiated by the The tracking area updating procedure is always initiated by the
UE and is used to update the registration of the actual tracking UE and is used to update the registration of the actual tracking
area of a UE in the network, to periodically notify the availa- area of a UE in the network, to periodically notify the availa-
bility of the UE to the network, for MME load balancing, to up- bility of the UE to the network, for MME load balancing, to up-
date certain UE specific parameters in the network. date certain UE specific parameters in the network.
*****************************************************************************/ *****************************************************************************/
@@ -50,7 +50,7 @@ Description Defines the tracking area update EMM procedure executed by the
/* /*
* Timer handlers * Timer handlers
*/ */
void* _emm_tau_t3430_handler(void*); void *_emm_tau_t3430_handler(void *);
#endif // NAS_UE #endif // NAS_UE
/* /*
@@ -72,27 +72,27 @@ void* _emm_tau_t3430_handler(void*);
#ifdef NAS_UE #ifdef NAS_UE
/* /*
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Timer handlers * Timer handlers
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
/**************************************************************************** /****************************************************************************
** ** ** **
** Name: _emm_tau_t3430_handler() ** ** Name: _emm_tau_t3430_handler() **
** ** ** **
** Description: T3430 timeout handler ** ** Description: T3430 timeout handler **
** ** ** **
** 3GPP TS 24.301, section 5.5.3.2.6 case c ** ** 3GPP TS 24.301, section 5.5.3.2.6 case c **
** ** ** **
** Inputs: args: handler parameters ** ** Inputs: args: handler parameters **
** Others: None ** ** Others: None **
** ** ** **
** Outputs: None ** ** Outputs: None **
** Return: None ** ** Return: None **
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
void* _emm_tau_t3430_handler(void* args) void *_emm_tau_t3430_handler(void *args)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
+163 -163
View File
@@ -1,21 +1,21 @@
/***************************************************************************** /*****************************************************************************
Eurecom OpenAirInterface 3 Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom Copyright(c) 2012 Eurecom
Source emmData.h Source emmData.h
Version 0.1 Version 0.1
Date 2012/10/18 Date 2012/10/18
Product NAS stack Product NAS stack
Subsystem EPS Mobility Management Subsystem EPS Mobility Management
Author Frederic Maurel Author Frederic Maurel
Description Defines internal private data handled by EPS Mobility Description Defines internal private data handled by EPS Mobility
Management sublayer. Management sublayer.
*****************************************************************************/ *****************************************************************************/
#ifndef __EMMDATA_H__ #ifndef __EMMDATA_H__
@@ -45,37 +45,37 @@ Description Defines internal private data handled by EPS Mobility
* The name of the file used as non-volatile memory device to store * The name of the file used as non-volatile memory device to store
* persistent EMM data when the UE is switched off * persistent EMM data when the UE is switched off
*/ */
#define EMM_NVRAM_FILENAME ".ue_emm.nvram" #define EMM_NVRAM_FILENAME ".ue_emm.nvram"
/* /*
* The name of the environment variable which defines the directory * The name of the environment variable which defines the directory
* where the EMM data file is located * where the EMM data file is located
*/ */
#define EMM_NVRAM_DIRNAME "NVRAM_DIR" #define EMM_NVRAM_DIRNAME "NVRAM_DIR"
/* Network selection modes of operation */ /* Network selection modes of operation */
#define EMM_DATA_PLMN_AUTO NET_PLMN_AUTO #define EMM_DATA_PLMN_AUTO NET_PLMN_AUTO
#define EMM_DATA_PLMN_MANUAL NET_PLMN_MANUAL #define EMM_DATA_PLMN_MANUAL NET_PLMN_MANUAL
#endif // NAS_UE #endif // NAS_UE
/* Checks Mobile Country Code equality */ /* Checks Mobile Country Code equality */
#define MCCS_ARE_EQUAL(n1, n2) (((n1).MCCdigit1 == (n2).MCCdigit1) && \ #define MCCS_ARE_EQUAL(n1, n2) (((n1).MCCdigit1 == (n2).MCCdigit1) && \
((n1).MCCdigit2 == (n2).MCCdigit2) && \ ((n1).MCCdigit2 == (n2).MCCdigit2) && \
((n1).MCCdigit3 == (n2).MCCdigit3)) ((n1).MCCdigit3 == (n2).MCCdigit3))
/* Checks Mobile Network Code equality */ /* Checks Mobile Network Code equality */
#define MNCS_ARE_EQUAL(n1, n2) (((n1).MNCdigit1 == (n2).MNCdigit1) && \ #define MNCS_ARE_EQUAL(n1, n2) (((n1).MNCdigit1 == (n2).MNCdigit1) && \
((n1).MNCdigit2 == (n2).MNCdigit2) && \ ((n1).MNCdigit2 == (n2).MNCdigit2) && \
((n1).MNCdigit3 == (n2).MNCdigit3)) ((n1).MNCdigit3 == (n2).MNCdigit3))
/* Checks PLMNs equality */ /* Checks PLMNs equality */
#define PLMNS_ARE_EQUAL(p1, p2) ((MCCS_ARE_EQUAL((p1),(p2))) && \ #define PLMNS_ARE_EQUAL(p1, p2) ((MCCS_ARE_EQUAL((p1),(p2))) && \
(MNCS_ARE_EQUAL((p1),(p2)))) (MNCS_ARE_EQUAL((p1),(p2))))
/* Checks TAIs equality */ /* Checks TAIs equality */
#define TAIS_ARE_EQUAL(t1, t2) ((PLMNS_ARE_EQUAL((t1).plmn,(t2).plmn)) && \ #define TAIS_ARE_EQUAL(t1, t2) ((PLMNS_ARE_EQUAL((t1).plmn,(t2).plmn)) && \
((t1).tac == (t2).tac)) ((t1).tac == (t2).tac))
/****************************************************************************/ /****************************************************************************/
/************************ G L O B A L T Y P E S ************************/ /************************ G L O B A L T Y P E S ************************/
@@ -96,21 +96,21 @@ typedef enum {
/* EPS NAS security context structure */ /* EPS NAS security context structure */
typedef struct { typedef struct {
emm_ksi_t type; /* Type of security context */ emm_ksi_t type; /* Type of security context */
int eksi; /* NAS key set identifier for E-UTRAN */ int eksi; /* NAS key set identifier for E-UTRAN */
OctetString kasme; /* ASME security key (native context) */ OctetString kasme; /* ASME security key (native context) */
//OctetString ksgsn; /* SGSN security key (mapped context) */ //OctetString ksgsn; /* SGSN security key (mapped context) */
OctetString knas_enc; /* NAS cyphering key */ OctetString knas_enc; /* NAS cyphering key */
OctetString knas_int; /* NAS integrity key */ OctetString knas_int; /* NAS integrity key */
struct { struct {
UInt32_t spare:8; UInt32_t spare:8;
UInt32_t overflow:16; UInt32_t overflow:16;
UInt32_t seq_num:8; UInt32_t seq_num:8;
} dl_count, ul_count; /* Downlink and uplink count parameters */ } dl_count, ul_count; /* Downlink and uplink count parameters */
struct { struct {
UInt8_t encryption:4; /* algorithm used for ciphering */ UInt8_t encryption:4; /* algorithm used for ciphering */
UInt8_t integrity:4; /* algorithm used for integrity protection */ UInt8_t integrity:4; /* algorithm used for integrity protection */
} capability; /* UE network capability */ } capability; /* UE network capability */
} emm_security_context_t; } emm_security_context_t;
/* /*
@@ -129,11 +129,11 @@ typedef struct {
* *
* EU1: The last attach or tracking area updating attempt was successful. * EU1: The last attach or tracking area updating attempt was successful.
* EU2: The last attach, service request or tracking area updating attempt * EU2: The last attach, service request or tracking area updating attempt
* failed procedurally, i.e. no response or reject message was received * failed procedurally, i.e. no response or reject message was received
* from the MME. * from the MME.
* EU3: The last attach, service request or tracking area updating attempt * EU3: The last attach, service request or tracking area updating attempt
* was correctly performed, but the answer from the MME was negative * was correctly performed, but the answer from the MME was negative
* (because of roaming or subscription restrictions). * (because of roaming or subscription restrictions).
*/ */
typedef enum { typedef enum {
EU1_UPDATED, EU1_UPDATED,
@@ -144,10 +144,10 @@ typedef enum {
/* /*
* EPS Connection Management states * EPS Connection Management states
* -------------------------------- * --------------------------------
* ECM-IDLE: No NAS signalling connection between UE and network exists. * ECM-IDLE: No NAS signalling connection between UE and network exists.
* No UE context exists in the network. * No UE context exists in the network.
* ECM-CONNECTED: The signalling connection is established between the UE * ECM-CONNECTED: The signalling connection is established between the UE
* and the MME (RRC connection and S1_MME connection). * and the MME (RRC connection and S1_MME connection).
*/ */
typedef enum { typedef enum {
ECM_IDLE, ECM_IDLE,
@@ -171,9 +171,9 @@ typedef enum {
*/ */
typedef struct { typedef struct {
imsi_t imsi; imsi_t imsi;
plmn_t rplmn; /* The registered PLMN */ plmn_t rplmn; /* The registered PLMN */
/* List of equivalent PLMNs */ /* List of equivalent PLMNs */
#define EMM_DATA_EPLMN_MAX 16 #define EMM_DATA_EPLMN_MAX 16
PLMN_LIST_T(EMM_DATA_EPLMN_MAX) eplmn; PLMN_LIST_T(EMM_DATA_EPLMN_MAX) eplmn;
} emm_nvdata_t; } emm_nvdata_t;
@@ -182,17 +182,17 @@ typedef struct {
* ------------------------- * -------------------------
*/ */
typedef struct { typedef struct {
int usim_is_valid; /* Indication of USIM data validity */ int usim_is_valid; /* Indication of USIM data validity */
imei_t *imei; /* IMEI read from the UE's non-volatile memory */ imei_t *imei; /* IMEI read from the UE's non-volatile memory */
const imsi_t *imsi; /* The valid IMSI read from the USIM */ const imsi_t *imsi; /* The valid IMSI read from the USIM */
GUTI_t *guti; /* The valid GUTI read from the USIM */ GUTI_t *guti; /* The valid GUTI read from the USIM */
tai_t *tai; /* Last visited registered Tracking Area Id */ tai_t *tai; /* Last visited registered Tracking Area Id */
emm_eps_update_t status; /* The current EPS update status */ emm_eps_update_t status; /* The current EPS update status */
emm_ecm_state_t ecm_status; /* The EPS Connection Management status */ emm_ecm_state_t ecm_status; /* The EPS Connection Management status */
int is_attached; /* Network attachment indicator */ int is_attached; /* Network attachment indicator */
int is_emergency; /* Emergency bearer services indicator */ int is_emergency; /* Emergency bearer services indicator */
/* Tracking Areas list the UE is registered to /* Tracking Areas list the UE is registered to
* Contains the list of TAIs that identify the tracking areas that * Contains the list of TAIs that identify the tracking areas that
@@ -200,84 +200,84 @@ typedef struct {
* procedure. The TAIs in a TAI list assigned by an MME to a UE * procedure. The TAIs in a TAI list assigned by an MME to a UE
* pertain to the same MME area. * pertain to the same MME area.
*/ */
#define EMM_DATA_TAI_MAX 16 #define EMM_DATA_TAI_MAX 16
TAI_LIST_T(EMM_DATA_TAI_MAX) ltai; TAI_LIST_T(EMM_DATA_TAI_MAX) ltai;
int plmn_mode; /* Network selection operating mode */ int plmn_mode; /* Network selection operating mode */
int plmn_index; /* Manually selected PLMN */ int plmn_index; /* Manually selected PLMN */
int plmn_rat; /* Manually selected Radio Access Technology */ int plmn_rat; /* Manually selected Radio Access Technology */
plmn_t splmn; /* The currently selected PLMN */ plmn_t splmn; /* The currently selected PLMN */
int is_rplmn; /* splmn is the registered PLMN */ int is_rplmn; /* splmn is the registered PLMN */
int is_eplmn; /* splmn is in the list of equivalent PLMNs */ int is_eplmn; /* splmn is in the list of equivalent PLMNs */
Stat_t stat; /* Current network registration status */ Stat_t stat; /* Current network registration status */
tac_t tac; /* Tracking area code */ tac_t tac; /* Tracking area code */
ci_t ci; /* GERAN/UTRAN/E-UTRAN serving cell identifier */ ci_t ci; /* GERAN/UTRAN/E-UTRAN serving cell identifier */
AcT_t rat; /* Radio Access Technology of the serving cell */ AcT_t rat; /* Radio Access Technology of the serving cell */
/* An octet string representation of operators present in the network */ /* An octet string representation of operators present in the network */
struct { struct {
#define EMM_DATA_BUFFER_SIZE 2048 #define EMM_DATA_BUFFER_SIZE 2048
char buffer[EMM_DATA_BUFFER_SIZE+1]; char buffer[EMM_DATA_BUFFER_SIZE+1];
} plist; } plist;
/* /*
* Data used for PLMN selection procedure * Data used for PLMN selection procedure
* -------------------------------------- * --------------------------------------
*/ */
plmn_t hplmn; /* The Home PLMN derived from the IMSI */ plmn_t hplmn; /* The Home PLMN derived from the IMSI */
/* List of Forbidden PLMNs /* List of Forbidden PLMNs
* Contains the list of PLMN identities for which a Location * Contains the list of PLMN identities for which a Location
* Registration has been rejected with EMM cause code #11 (PLMN * Registration has been rejected with EMM cause code #11 (PLMN
* not allowed). A PLMN is removed from this list if, after a * not allowed). A PLMN is removed from this list if, after a
* subsequent manual selection of that PLMN, there is a successful * subsequent manual selection of that PLMN, there is a successful
* Location Request. */ * Location Request. */
#define EMM_DATA_FPLMN_MAX 4 #define EMM_DATA_FPLMN_MAX 4
PLMN_LIST_T(EMM_DATA_FPLMN_MAX) fplmn; PLMN_LIST_T(EMM_DATA_FPLMN_MAX) fplmn;
/* List of Forbidden PLMNs for GPRS service /* List of Forbidden PLMNs for GPRS service
* Contains the list of PLMN identities for which an Attach Request * Contains the list of PLMN identities for which an Attach Request
* has been rejected with EMM cause code #14 (GPRS/EPS services not * has been rejected with EMM cause code #14 (GPRS/EPS services not
* allowed in this PLMN). A PLMN is removed from this list if, after * allowed in this PLMN). A PLMN is removed from this list if, after
* a subsequent manual selection of that PLMN, there is a successful * a subsequent manual selection of that PLMN, there is a successful
* GPRS attach or EPS attach. */ * GPRS attach or EPS attach. */
#define EMM_DATA_FPLMN_GPRS_MAX 4 #define EMM_DATA_FPLMN_GPRS_MAX 4
PLMN_LIST_T(EMM_DATA_FPLMN_GPRS_MAX) fplmn_gprs; PLMN_LIST_T(EMM_DATA_FPLMN_GPRS_MAX) fplmn_gprs;
/* List of Equivalent HPLMNs */ /* List of Equivalent HPLMNs */
#define EMM_DATA_EHPLMN_MAX 4 #define EMM_DATA_EHPLMN_MAX 4
PLMN_LIST_T(EMM_DATA_EHPLMN_MAX) ehplmn; PLMN_LIST_T(EMM_DATA_EHPLMN_MAX) ehplmn;
/* List of user controlled PLMNs */ /* List of user controlled PLMNs */
#define EMM_DATA_PLMN_MAX 4 #define EMM_DATA_PLMN_MAX 4
PLMN_LIST_T(EMM_DATA_PLMN_MAX) plmn; PLMN_LIST_T(EMM_DATA_PLMN_MAX) plmn;
UInt16_t userAcT[EMM_DATA_PLMN_MAX]; UInt16_t userAcT[EMM_DATA_PLMN_MAX];
/* List of operator controlled PLMNs */ /* List of operator controlled PLMNs */
#define EMM_DATA_OPLMN_MAX 4 #define EMM_DATA_OPLMN_MAX 4
PLMN_LIST_T(EMM_DATA_OPLMN_MAX) oplmn; PLMN_LIST_T(EMM_DATA_OPLMN_MAX) oplmn;
UInt16_t operAcT[EMM_DATA_OPLMN_MAX]; UInt16_t operAcT[EMM_DATA_OPLMN_MAX];
/* List of operator network name records */ /* List of operator network name records */
#define EMM_DATA_OPNN_MAX 16 #define EMM_DATA_OPNN_MAX 16
UInt8_t n_opnns; UInt8_t n_opnns;
struct { struct {
const plmn_t *plmn; const plmn_t *plmn;
const char *fullname; const char *fullname;
const char *shortname; const char *shortname;
} opnn[EMM_DATA_OPNN_MAX]; } opnn[EMM_DATA_OPNN_MAX];
/* /*
* Data used for roaming service * Data used for roaming service
* ----------------------------- * -----------------------------
*/ */
/* List of Forbidden Tracking Areas /* List of Forbidden Tracking Areas
* Contains the list of TAIs for which an attach request has been * Contains the list of TAIs for which an attach request has been
* rejected with EMM cause code #12 (tracking area not allowed). * rejected with EMM cause code #12 (tracking area not allowed).
*/ */
#define EMM_DATA_FTAI_MAX 40 #define EMM_DATA_FTAI_MAX 40
TAI_LIST_T(EMM_DATA_FTAI_MAX) ftai; TAI_LIST_T(EMM_DATA_FTAI_MAX) ftai;
/* List of Forbidden Tracking Areas for roaming /* List of Forbidden Tracking Areas for roaming
* Contains the list of TAIs for which an attach request has been * Contains the list of TAIs for which an attach request has been
* rejected with EMM cause code #13 (roaming not allowed in this * rejected with EMM cause code #13 (roaming not allowed in this
* tracking area). * tracking area).
*/ */
#define EMM_DATA_FTAI_ROAMING_MAX 40 #define EMM_DATA_FTAI_ROAMING_MAX 40
TAI_LIST_T(EMM_DATA_FTAI_ROAMING_MAX) ftai_roaming; TAI_LIST_T(EMM_DATA_FTAI_ROAMING_MAX) ftai_roaming;
/* /*
@@ -302,8 +302,8 @@ typedef struct {
* EPS NAS security context * EPS NAS security context
* ------------------------ * ------------------------
*/ */
emm_security_context_t* security; /* current security context */ emm_security_context_t *security; /* current security context */
emm_security_context_t* non_current; /* non-current security context */ emm_security_context_t *non_current; /* non-current security context */
} emm_data_t; } emm_data_t;
@@ -320,28 +320,28 @@ typedef struct {
* --------------------------------------------------------------------------- * ---------------------------------------------------------------------------
*/ */
typedef struct emm_data_context_s { typedef struct emm_data_context_s {
unsigned int ueid; /* UE identifier */ unsigned int ueid; /* UE identifier */
int is_dynamic; /* Dynamically allocated context indicator */ int is_dynamic; /* Dynamically allocated context indicator */
int is_attached; /* Attachment indicator */ int is_attached; /* Attachment indicator */
int is_emergency; /* Emergency bearer services indicator */ int is_emergency; /* Emergency bearer services indicator */
imsi_t* imsi; /* The IMSI provided by the UE or the MME */ imsi_t *imsi; /* The IMSI provided by the UE or the MME */
imei_t* imei; /* The IMEI provided by the UE */ imei_t *imei; /* The IMEI provided by the UE */
int guti_is_new; /* New GUTI indicator */ int guti_is_new; /* New GUTI indicator */
GUTI_t* guti; /* The GUTI assigned to the UE */ GUTI_t *guti; /* The GUTI assigned to the UE */
GUTI_t* old_guti; /* The old GUTI */ GUTI_t *old_guti; /* The old GUTI */
int n_tacs; /* Number of concecutive tracking areas the UE is int n_tacs; /* Number of concecutive tracking areas the UE is
* registered to */ * registered to */
tac_t tac; /* Code of the first tracking area the UE is tac_t tac; /* Code of the first tracking area the UE is
* registered to */ * registered to */
int ksi; /* Security key set identifier provided by the UE */ int ksi; /* Security key set identifier provided by the UE */
int eea; /* EPS encryption algorithms supported by the UE */ int eea; /* EPS encryption algorithms supported by the UE */
int eia; /* EPS integrity algorithms supported by the UE */ int eia; /* EPS integrity algorithms supported by the UE */
auth_vector_t vector; /* EPS authentication vector */ auth_vector_t vector; /* EPS authentication vector */
emm_security_context_t* security; /* Current EPS NAS security context */ emm_security_context_t *security; /* Current EPS NAS security context */
OctetString esm_msg; /* ESM message contained within the initial request */ OctetString esm_msg; /* ESM message contained within the initial request */
int emm_cause; /* EMM failure cause code */ int emm_cause; /* EMM failure cause code */
emm_fsm_state_t _emm_fsm_status; emm_fsm_state_t _emm_fsm_status;
@@ -368,15 +368,15 @@ typedef struct {
/* Use a tree for ue data context within MME */ /* Use a tree for ue data context within MME */
RB_HEAD(emm_data_context_map, emm_data_context_s) ctx_map; RB_HEAD(emm_data_context_map, emm_data_context_s) ctx_map;
# else # else
# define EMM_DATA_NB_UE_MAX (MME_API_NB_UE_MAX + 1) # define EMM_DATA_NB_UE_MAX (MME_API_NB_UE_MAX + 1)
emm_data_context_t* ctx [EMM_DATA_NB_UE_MAX]; emm_data_context_t *ctx [EMM_DATA_NB_UE_MAX];
# endif # endif
} emm_data_t; } emm_data_t;
struct emm_data_context_s *emm_data_context_get( struct emm_data_context_s *emm_data_context_get(
emm_data_t *_emm_data, unsigned int _ueid); emm_data_t *_emm_data, unsigned int _ueid);
struct emm_data_context_s * emm_data_context_remove( struct emm_data_context_s *emm_data_context_remove(
emm_data_t *_emm_data, struct emm_data_context_s *elm); emm_data_t *_emm_data, struct emm_data_context_s *elm);
void emm_data_context_add(emm_data_t *emm_data, struct emm_data_context_s *elm); void emm_data_context_add(emm_data_t *emm_data, struct emm_data_context_s *elm);
@@ -389,58 +389,58 @@ void emm_data_context_add(emm_data_t *emm_data, struct emm_data_context_s *elm);
/* /*
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* EPS mobility management data (used within EMM only) * EPS mobility management data (used within EMM only)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
emm_data_t _emm_data; emm_data_t _emm_data;
/* /*
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* EPS mobility management timers – UE side * EPS mobility management timers – UE side
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
#ifdef NAS_UE #ifdef NAS_UE
#define T3402_DEFAULT_VALUE 720 /* 12 minutes */ #define T3402_DEFAULT_VALUE 720 /* 12 minutes */
#define T3410_DEFAULT_VALUE 15 /* 15 seconds */ #define T3410_DEFAULT_VALUE 15 /* 15 seconds */
#define T3411_DEFAULT_VALUE 10 /* 10 seconds */ #define T3411_DEFAULT_VALUE 10 /* 10 seconds */
#define T3412_DEFAULT_VALUE 3240 /* 54 minutes */ #define T3412_DEFAULT_VALUE 3240 /* 54 minutes */
#define T3416_DEFAULT_VALUE 30 /* 30 seconds */ #define T3416_DEFAULT_VALUE 30 /* 30 seconds */
#define T3417_DEFAULT_VALUE 5 /* 5 seconds */ #define T3417_DEFAULT_VALUE 5 /* 5 seconds */
#define T3417ext_DEFAULT_VALUE 10 /* 10 seconds */ #define T3417ext_DEFAULT_VALUE 10 /* 10 seconds */
#define T3418_DEFAULT_VALUE 20 /* 20 seconds */ #define T3418_DEFAULT_VALUE 20 /* 20 seconds */
#define T3420_DEFAULT_VALUE 15 /* 15 seconds */ #define T3420_DEFAULT_VALUE 15 /* 15 seconds */
#define T3421_DEFAULT_VALUE 15 /* 15 seconds */ #define T3421_DEFAULT_VALUE 15 /* 15 seconds */
#define T3423_DEFAULT_VALUE T3412_DEFAULT_VALUE #define T3423_DEFAULT_VALUE T3412_DEFAULT_VALUE
#define T3430_DEFAULT_VALUE 15 /* 15 seconds */ #define T3430_DEFAULT_VALUE 15 /* 15 seconds */
#define T3440_DEFAULT_VALUE 10 /* 10 seconds */ #define T3440_DEFAULT_VALUE 10 /* 10 seconds */
struct nas_timer_t T3402; /* attach failure timer */ struct nas_timer_t T3402; /* attach failure timer */
struct nas_timer_t T3410; /* attach timer */ struct nas_timer_t T3410; /* attach timer */
struct nas_timer_t T3411; /* attach restart timer */ struct nas_timer_t T3411; /* attach restart timer */
struct nas_timer_t T3412; /* periodic tracking area update timer */ struct nas_timer_t T3412; /* periodic tracking area update timer */
struct nas_timer_t T3416; /* EPS authentication challenge timer */ struct nas_timer_t T3416; /* EPS authentication challenge timer */
struct nas_timer_t T3417; /* Service request timer */ struct nas_timer_t T3417; /* Service request timer */
struct nas_timer_t T3418; /* MAC authentication failure timer */ struct nas_timer_t T3418; /* MAC authentication failure timer */
struct nas_timer_t T3420; /* Synch authentication failure timer */ struct nas_timer_t T3420; /* Synch authentication failure timer */
struct nas_timer_t T3421; /* Detach timer */ struct nas_timer_t T3421; /* Detach timer */
struct nas_timer_t T3430; /* tracking area update timer */ struct nas_timer_t T3430; /* tracking area update timer */
struct nas_timer_t T3423; /* E-UTRAN deactivate ISR timer */ struct nas_timer_t T3423; /* E-UTRAN deactivate ISR timer */
#endif #endif
/* /*
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* EPS mobility management timers – Network side * EPS mobility management timers – Network side
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
#ifdef NAS_MME #ifdef NAS_MME
#define T3450_DEFAULT_VALUE 6 /* 6 seconds */ #define T3450_DEFAULT_VALUE 6 /* 6 seconds */
#define T3460_DEFAULT_VALUE 6 /* 6 seconds */ #define T3460_DEFAULT_VALUE 6 /* 6 seconds */
#define T3470_DEFAULT_VALUE 6 /* 6 seconds */ #define T3470_DEFAULT_VALUE 6 /* 6 seconds */
struct nas_timer_t T3450; /* EMM message retransmission timer */ struct nas_timer_t T3450; /* EMM message retransmission timer */
struct nas_timer_t T3460; /* Authentication timer */ struct nas_timer_t T3460; /* Authentication timer */
struct nas_timer_t T3470; /* Identification timer */ struct nas_timer_t T3470; /* Identification timer */
/* /*
* mobile reachable timer * mobile reachable timer
@@ -45,7 +45,7 @@ struct emm_data_context_s *emm_data_context_get(
return RB_FIND(emm_data_context_map, &emm_data->ctx_map, &reference); return RB_FIND(emm_data_context_map, &emm_data->ctx_map, &reference);
} }
struct emm_data_context_s * emm_data_context_remove( struct emm_data_context_s *emm_data_context_remove(
emm_data_t *emm_data, struct emm_data_context_s *elm) emm_data_t *emm_data, struct emm_data_context_s *elm)
{ {
return RB_REMOVE(emm_data_context_map, &emm_data->ctx_map, elm); return RB_REMOVE(emm_data_context_map, &emm_data->ctx_map, elm);
File diff suppressed because it is too large Load Diff
+17 -17
View File
@@ -1,21 +1,21 @@
/***************************************************************************** /*****************************************************************************
Eurecom OpenAirInterface 3 Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom Copyright(c) 2012 Eurecom
Source emm_main.h Source emm_main.h
Version 0.1 Version 0.1
Date 2012/10/10 Date 2012/10/10
Product NAS stack Product NAS stack
Subsystem EPS Mobility Management Subsystem EPS Mobility Management
Author Frederic Maurel Author Frederic Maurel
Description Defines the EPS Mobility Management procedure call manager, Description Defines the EPS Mobility Management procedure call manager,
the main entry point for elementary EMM processing. the main entry point for elementary EMM processing.
*****************************************************************************/ *****************************************************************************/
#ifndef __EMM_MAIN_H__ #ifndef __EMM_MAIN_H__
@@ -41,7 +41,7 @@ Description Defines the EPS Mobility Management procedure call manager,
/****************************************************************************/ /****************************************************************************/
#ifdef NAS_UE #ifdef NAS_UE
void emm_main_initialize(emm_indication_callback_t cb, const char* imei); void emm_main_initialize(emm_indication_callback_t cb, const char *imei);
#endif #endif
#ifdef NAS_MME #ifdef NAS_MME
void emm_main_initialize(void); void emm_main_initialize(void);
@@ -51,24 +51,24 @@ void emm_main_cleanup(void);
#ifdef NAS_UE #ifdef NAS_UE
/* User's getter of UE's identity */ /* User's getter of UE's identity */
const imsi_t* emm_main_get_imsi(void); const imsi_t *emm_main_get_imsi(void);
/* User's getter of the subscriber dialing number */ /* User's getter of the subscriber dialing number */
const msisdn_t* emm_main_get_msisdn(void); const msisdn_t *emm_main_get_msisdn(void);
/* User's getter/setter for network selection */ /* User's getter/setter for network selection */
int emm_main_set_plmn_selection_mode(int mode, int format, int emm_main_set_plmn_selection_mode(int mode, int format,
const network_plmn_t* plmn, int rat); const network_plmn_t *plmn, int rat);
int emm_main_get_plmn_selection_mode(void); int emm_main_get_plmn_selection_mode(void);
int emm_main_get_plmn_list(const char** plist); int emm_main_get_plmn_list(const char **plist);
const char* emm_main_get_selected_plmn(network_plmn_t* plmn, int format); const char *emm_main_get_selected_plmn(network_plmn_t *plmn, int format);
/* User's getter for network registration */ /* User's getter for network registration */
Stat_t emm_main_get_plmn_status(void); Stat_t emm_main_get_plmn_status(void);
tac_t emm_main_get_plmn_tac(void); tac_t emm_main_get_plmn_tac(void);
ci_t emm_main_get_plmn_ci(void); ci_t emm_main_get_plmn_ci(void);
AcT_t emm_main_get_plmn_rat(void); AcT_t emm_main_get_plmn_rat(void);
const char* emm_main_get_registered_plmn(network_plmn_t* plmn, int format); const char *emm_main_get_registered_plmn(network_plmn_t *plmn, int format);
/* User's getter for network attachment */ /* User's getter for network attachment */
int emm_main_is_attached(void); int emm_main_is_attached(void);
+55 -45
View File
@@ -1,21 +1,21 @@
/***************************************************************************** /*****************************************************************************
Eurecom OpenAirInterface 3 Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom Copyright(c) 2012 Eurecom
Source emm_proc.h Source emm_proc.h
Version 0.1 Version 0.1
Date 2012/10/16 Date 2012/10/16
Product NAS stack Product NAS stack
Subsystem EPS Mobility Management Subsystem EPS Mobility Management
Author Frederic Maurel Author Frederic Maurel
Description Defines the EPS Mobility Management procedures executed at Description Defines the EPS Mobility Management procedures executed at
the EMM Service Access Points. the EMM Service Access Points.
*****************************************************************************/ *****************************************************************************/
#ifndef __EMM_PROC_H__ #ifndef __EMM_PROC_H__
@@ -78,7 +78,7 @@ typedef enum {
/* /*
*--------------------------------------------------------------------------- *---------------------------------------------------------------------------
* EMM status procedure * EMM status procedure
*--------------------------------------------------------------------------- *---------------------------------------------------------------------------
*/ */
int emm_proc_status_ind(unsigned int ueid, int emm_cause); int emm_proc_status_ind(unsigned int ueid, int emm_cause);
@@ -86,14 +86,14 @@ int emm_proc_status(unsigned int ueid, int emm_cause);
/* /*
*--------------------------------------------------------------------------- *---------------------------------------------------------------------------
* Lower layer procedure * Lower layer procedure
*--------------------------------------------------------------------------- *---------------------------------------------------------------------------
*/ */
#ifdef NAS_UE #ifdef NAS_UE
int emm_proc_lowerlayer_initialize(lowerlayer_success_callback_t success, int emm_proc_lowerlayer_initialize(lowerlayer_success_callback_t success,
lowerlayer_failure_callback_t failure, lowerlayer_failure_callback_t failure,
lowerlayer_release_callback_t release, lowerlayer_release_callback_t release,
void* args); void *args);
int emm_proc_lowerlayer_success(void); int emm_proc_lowerlayer_success(void);
int emm_proc_lowerlayer_failure(int is_initial); int emm_proc_lowerlayer_failure(int is_initial);
int emm_proc_lowerlayer_release(void); int emm_proc_lowerlayer_release(void);
@@ -101,7 +101,7 @@ int emm_proc_lowerlayer_release(void);
/* /*
*--------------------------------------------------------------------------- *---------------------------------------------------------------------------
* UE's Idle mode procedure * UE's Idle mode procedure
*--------------------------------------------------------------------------- *---------------------------------------------------------------------------
*/ */
#ifdef NAS_UE #ifdef NAS_UE
@@ -112,17 +112,19 @@ int emm_proc_plmn_selection_end(int found, tac_t tac, ci_t ci, AcT_t rat);
/* /*
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Attach procedure * Attach procedure
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
#ifdef NAS_UE #ifdef NAS_UE
int emm_proc_attach(emm_proc_attach_type_t type); int emm_proc_attach(emm_proc_attach_type_t type);
int emm_proc_attach_request(void* args); int emm_proc_attach_request(void *args);
int emm_proc_attach_accept(long T3412, long T3402, long T3423, int n_tais, tai_t* tai, GUTI_t* guti, int n_eplmns, plmn_t* eplmn, const OctetString* esm_msg); int emm_proc_attach_accept(long T3412, long T3402, long T3423, int n_tais,
int emm_proc_attach_reject(int emm_cause, const OctetString* esm_msg); tai_t *tai, GUTI_t *guti, int n_eplmns, plmn_t *eplmn,
int emm_proc_attach_complete(void* args); const OctetString *esm_msg);
int emm_proc_attach_failure(int is_initial, void* args); int emm_proc_attach_reject(int emm_cause, const OctetString *esm_msg);
int emm_proc_attach_release(void* args); 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(void);
int emm_proc_attach_set_emergency(void); int emm_proc_attach_set_emergency(void);
@@ -130,32 +132,36 @@ int emm_proc_attach_set_detach(void);
#endif #endif
#ifdef NAS_MME #ifdef NAS_MME
int emm_proc_attach_request(unsigned int ueid, emm_proc_attach_type_t type, int native_ksi, int ksi, int native_guti, GUTI_t* guti, imsi_t* imsi, imei_t* imei, tai_t* tai, int eea, int eia, const OctetString* esm_msg); int emm_proc_attach_request(unsigned int ueid, emm_proc_attach_type_t type,
int native_ksi, int ksi, int native_guti, GUTI_t *guti, imsi_t *imsi,
imei_t *imei, tai_t *tai, int eea, int eia, const OctetString *esm_msg);
int emm_proc_attach_reject(unsigned int ueid, int emm_cause); int emm_proc_attach_reject(unsigned int ueid, int emm_cause);
int emm_proc_attach_complete(unsigned int ueid, const OctetString* esm_msg); int emm_proc_attach_complete(unsigned int ueid, const OctetString *esm_msg);
#endif #endif
/* /*
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Detach procedure * Detach procedure
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
#ifdef NAS_UE #ifdef NAS_UE
int emm_proc_detach(emm_proc_detach_type_t type, int switch_off); int emm_proc_detach(emm_proc_detach_type_t type, int switch_off);
int emm_proc_detach_request(void* args); int emm_proc_detach_request(void *args);
int emm_proc_detach_accept(void); int emm_proc_detach_accept(void);
int emm_proc_detach_failure(int is_initial, void* args); int emm_proc_detach_failure(int is_initial, void *args);
int emm_proc_detach_release(void* args); int emm_proc_detach_release(void *args);
#endif #endif
#ifdef NAS_MME #ifdef NAS_MME
int emm_proc_detach(unsigned int ueid, emm_proc_detach_type_t type); int emm_proc_detach(unsigned int ueid, emm_proc_detach_type_t type);
int emm_proc_detach_request(unsigned int ueid, emm_proc_detach_type_t type, int switch_off, int native_ksi, int ksi, GUTI_t* guti, imsi_t* imsi, imei_t* imei); int emm_proc_detach_request(unsigned int ueid, emm_proc_detach_type_t type,
int switch_off, int native_ksi, int ksi, GUTI_t *guti, imsi_t *imsi,
imei_t *imei);
#endif #endif
/* /*
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Identification procedure * Identification procedure
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
#ifdef NAS_UE #ifdef NAS_UE
@@ -169,50 +175,54 @@ int emm_proc_identification(unsigned int ueid,
emm_common_success_callback_t success, emm_common_success_callback_t success,
emm_common_reject_callback_t reject, emm_common_reject_callback_t reject,
emm_common_failure_callback_t failure); emm_common_failure_callback_t failure);
int emm_proc_identification_complete(unsigned int ueid, const imsi_t* imsi, const imei_t* imei, UInt32_t* tmsi); int emm_proc_identification_complete(unsigned int ueid, const imsi_t *imsi,
const imei_t *imei, UInt32_t *tmsi);
#endif #endif
/* /*
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Authentication procedure * Authentication procedure
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
#ifdef NAS_UE #ifdef NAS_UE
int emm_proc_authentication_request(int native_ksi, int ksi, const OctetString* rand, const OctetString* autn); int emm_proc_authentication_request(int native_ksi, int ksi,
const OctetString *rand, const OctetString *autn);
int emm_proc_authentication_reject(void); int emm_proc_authentication_reject(void);
int emm_proc_authentication_delete(void); int emm_proc_authentication_delete(void);
#endif #endif
#ifdef NAS_MME #ifdef NAS_MME
int emm_proc_authentication(unsigned int ueid, int ksi, int emm_proc_authentication(unsigned int ueid, int ksi,
const OctetString* rand, const OctetString* autn, const OctetString *rand, const OctetString *autn,
emm_common_success_callback_t success, emm_common_success_callback_t success,
emm_common_reject_callback_t reject, emm_common_reject_callback_t reject,
emm_common_failure_callback_t failure); emm_common_failure_callback_t failure);
int emm_proc_authentication_complete(unsigned int ueid, int emm_cause, const OctetString* res); int emm_proc_authentication_complete(unsigned int ueid, int emm_cause,
const OctetString *res);
#endif #endif
/* /*
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Security mode control procedure * Security mode control procedure
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
#ifdef NAS_UE #ifdef NAS_UE
int emm_proc_security_mode_command(int native_ksi, int ksi, int seea, int seia, int reea, int reia); int emm_proc_security_mode_command(int native_ksi, int ksi, int seea, int seia,
int reea, int reia);
#endif #endif
#ifdef NAS_MME #ifdef NAS_MME
int emm_proc_security_mode_control(unsigned int ueid, int ksi, int eea, int eia, int emm_proc_security_mode_control(unsigned int ueid, int ksi, int eea, int eia,
emm_common_success_callback_t success, emm_common_success_callback_t success,
emm_common_reject_callback_t reject, emm_common_reject_callback_t reject,
emm_common_failure_callback_t failure); emm_common_failure_callback_t failure);
int emm_proc_security_mode_complete(unsigned int ueid); int emm_proc_security_mode_complete(unsigned int ueid);
int emm_proc_security_mode_reject(unsigned int ueid); int emm_proc_security_mode_reject(unsigned int ueid);
#endif #endif
/* /*
*--------------------------------------------------------------------------- *---------------------------------------------------------------------------
* Network indication handlers * Network indication handlers
*--------------------------------------------------------------------------- *---------------------------------------------------------------------------
*/ */
#ifdef NAS_UE #ifdef NAS_UE