Commit cce3f9cf authored by Frédéric Leroy's avatar Frédéric Leroy

UE/EMM/SAP: move _emm_fsm_status to nas_user_t

parent 0850db05
......@@ -54,6 +54,7 @@ Description Implements the EPS Mobility Management procedures executed
#include "nas_log.h"
#include "emm_proc.h"
#include "user_defs.h"
#include <assert.h>
......@@ -92,10 +93,11 @@ int EmmDeregistered(nas_user_t *user, const emm_reg_t *evt)
int rc = RETURNerror;
assert(emm_fsm_get_status() == EMM_DEREGISTERED);
assert(emm_fsm_get_status(user) == EMM_DEREGISTERED);
/* Delete the authentication data RAND and RES */
// FIXME REVIEW
rc = emm_proc_authentication_delete();
if (rc != RETURNok) {
......@@ -116,7 +118,7 @@ int EmmDeregistered(nas_user_t *user, const emm_reg_t *evt)
/*
* The UE was powered on without a valid USIM application present
*/
rc = emm_fsm_set_status(EMM_DEREGISTERED_NO_IMSI);
rc = emm_fsm_set_status(user, EMM_DEREGISTERED_NO_IMSI);
break;
case _EMMREG_REGISTER_REQ:
......@@ -124,11 +126,11 @@ int EmmDeregistered(nas_user_t *user, const emm_reg_t *evt)
* The default EMM primary substate when the UE is switched on
* with valid USIM application shall be PLMN-SEARCH
*/
rc = emm_fsm_set_status(EMM_DEREGISTERED_PLMN_SEARCH);
rc = emm_fsm_set_status(user, EMM_DEREGISTERED_PLMN_SEARCH);
if (rc != RETURNerror) {
/* Process the network registration request */
rc = emm_fsm_process(evt);
rc = emm_fsm_process(user, evt);
}
break;
......@@ -142,9 +144,9 @@ int EmmDeregistered(nas_user_t *user, const emm_reg_t *evt)
/* Move to the corresponding initial EMM state */
if (evt->u.attach.is_emergency) {
rc = emm_fsm_set_status(EMM_DEREGISTERED_LIMITED_SERVICE);
rc = emm_fsm_set_status(user, EMM_DEREGISTERED_LIMITED_SERVICE);
} else {
rc = emm_fsm_set_status(EMM_DEREGISTERED_NORMAL_SERVICE);
rc = emm_fsm_set_status(user, EMM_DEREGISTERED_NORMAL_SERVICE);
}
if (rc != RETURNerror) {
......
......@@ -47,6 +47,7 @@ Description Implements the EPS Mobility Management procedures executed
#include "emm_fsm.h"
#include "commonDef.h"
#include "nas_log.h"
#include "user_defs.h"
#include <assert.h>
......@@ -77,11 +78,11 @@ Description Implements the EPS Mobility Management procedures executed
** Others: emm_fsm_status **
** **
***************************************************************************/
int EmmDeregisteredAttachNeeded(const emm_reg_t *evt)
int EmmDeregisteredAttachNeeded(nas_user_t *user, const emm_reg_t *evt)
{
LOG_FUNC_IN;
assert(emm_fsm_get_status() == EMM_DEREGISTERED_ATTACH_NEEDED);
assert(emm_fsm_get_status(user) == EMM_DEREGISTERED_ATTACH_NEEDED);
/* TODO */
......
......@@ -85,7 +85,7 @@ int EmmDeregisteredAttemptingToAttach(nas_user_t *user, const emm_reg_t *evt)
int rc = RETURNerror;
assert(emm_fsm_get_status() == EMM_DEREGISTERED_ATTEMPTING_TO_ATTACH);
assert(emm_fsm_get_status(user) == EMM_DEREGISTERED_ATTEMPTING_TO_ATTACH);
switch (evt->primitive) {
case _EMMREG_ATTACH_INIT:
......@@ -97,9 +97,9 @@ int EmmDeregisteredAttemptingToAttach(nas_user_t *user, const emm_reg_t *evt)
/* Move to the corresponding initial EMM state */
if (evt->u.attach.is_emergency) {
rc = emm_fsm_set_status(EMM_DEREGISTERED_LIMITED_SERVICE);
rc = emm_fsm_set_status(user, EMM_DEREGISTERED_LIMITED_SERVICE);
} else {
rc = emm_fsm_set_status(EMM_DEREGISTERED_NORMAL_SERVICE);
rc = emm_fsm_set_status(user, EMM_DEREGISTERED_NORMAL_SERVICE);
}
if (rc != RETURNerror) {
......
......@@ -78,13 +78,13 @@ Description Implements the EPS Mobility Management procedures executed
** Others: emm_fsm_status **
** **
***************************************************************************/
int EmmDeregisteredInitiated(const emm_reg_t *evt)
int EmmDeregisteredInitiated(nas_user_t *user, const emm_reg_t *evt)
{
LOG_FUNC_IN;
int rc = RETURNerror;
assert(emm_fsm_get_status() == EMM_DEREGISTERED_INITIATED);
assert(emm_fsm_get_status(user) == EMM_DEREGISTERED_INITIATED);
switch (evt->primitive) {
......@@ -94,7 +94,7 @@ int EmmDeregisteredInitiated(const emm_reg_t *evt)
* bearer contexts have been deactivated as UE initiated
* detach procedure successfully completed)
*/
rc = emm_fsm_set_status(EMM_DEREGISTERED);
rc = emm_fsm_set_status(user, EMM_DEREGISTERED);
break;
case _EMMREG_DETACH_FAILED:
......@@ -103,9 +103,9 @@ int EmmDeregisteredInitiated(const emm_reg_t *evt)
* The detach procedure failed
*/
if (evt->u.detach.type == EMM_DETACH_TYPE_IMSI) {
rc = emm_fsm_set_status(EMM_REGISTERED_NORMAL_SERVICE);
rc = emm_fsm_set_status(user, EMM_REGISTERED_NORMAL_SERVICE);
} else {
rc = emm_fsm_set_status(EMM_DEREGISTERED);
rc = emm_fsm_set_status(user, EMM_DEREGISTERED);
}
break;
......@@ -123,6 +123,7 @@ int EmmDeregisteredInitiated(const emm_reg_t *evt)
* Lower layer failure or release of the NAS signalling connection
* before the Detach Accept is received
*/
// FIXME review
rc = emm_proc_lowerlayer_release();
break;
......
......@@ -89,18 +89,18 @@ int EmmDeregisteredLimitedService(nas_user_t *user, const emm_reg_t *evt)
int rc = RETURNerror;
assert(emm_fsm_get_status() == EMM_DEREGISTERED_LIMITED_SERVICE);
assert(emm_fsm_get_status(user) == EMM_DEREGISTERED_LIMITED_SERVICE);
switch (evt->primitive) {
case _EMMREG_REGISTER_REQ:
/*
* The user manually re-selected a PLMN to register to
*/
rc = emm_fsm_set_status(EMM_DEREGISTERED_PLMN_SEARCH);
rc = emm_fsm_set_status(user, EMM_DEREGISTERED_PLMN_SEARCH);
if (rc != RETURNerror) {
/* Process the network registration request */
rc = emm_fsm_process(evt);
rc = emm_fsm_process(user, evt);
}
break;
......@@ -118,7 +118,7 @@ int EmmDeregisteredLimitedService(nas_user_t *user, const emm_reg_t *evt)
* (Attach Request message successfully delivered to the network);
* enter state EMM-REGISTERED-INITIATED
*/
rc = emm_fsm_set_status(EMM_REGISTERED_INITIATED);
rc = emm_fsm_set_status(user, EMM_REGISTERED_INITIATED);
break;
case _EMMREG_LOWERLAYER_SUCCESS:
......
......@@ -90,7 +90,7 @@ int EmmDeregisteredNoCellAvailable(nas_user_t *user, const emm_reg_t *evt)
int rc = RETURNerror;
assert(emm_fsm_get_status() == EMM_DEREGISTERED_NO_CELL_AVAILABLE);
assert(emm_fsm_get_status(user) == EMM_DEREGISTERED_NO_CELL_AVAILABLE);
switch (evt->primitive) {
/* TODO: network re-selection is not allowed when in No Cell
......@@ -101,13 +101,14 @@ int EmmDeregisteredNoCellAvailable(nas_user_t *user, const emm_reg_t *evt)
/*
* The user manually re-selected a PLMN to register to
*/
rc = emm_fsm_set_status(EMM_DEREGISTERED_PLMN_SEARCH);
rc = emm_fsm_set_status(user, EMM_DEREGISTERED_PLMN_SEARCH);
if (rc != RETURNerror) {
/*
* Notify EMM that the MT is currently searching an operator
* to register to
*/
// FIXME REVIEW
rc = emm_proc_registration_notify(NET_REG_STATE_ON);
if (rc != RETURNok) {
......
......@@ -78,11 +78,11 @@ Description Implements the EPS Mobility Management procedures executed
** Others: emm_fsm_status **
** **
***************************************************************************/
int EmmDeregisteredNoImsi(const emm_reg_t *evt)
int EmmDeregisteredNoImsi(nas_user_t *user, const emm_reg_t *evt)
{
LOG_FUNC_IN;
assert(emm_fsm_get_status() == EMM_DEREGISTERED_NO_IMSI);
assert(emm_fsm_get_status(user) == EMM_DEREGISTERED_NO_IMSI);
LOG_TRACE(ERROR, "EMM-FSM - USIM is not present or not valid");
......
......@@ -90,18 +90,18 @@ int EmmDeregisteredNormalService(nas_user_t *user, const emm_reg_t *evt)
int rc = RETURNerror;
assert(emm_fsm_get_status() == EMM_DEREGISTERED_NORMAL_SERVICE);
assert(emm_fsm_get_status(user) == EMM_DEREGISTERED_NORMAL_SERVICE);
switch (evt->primitive) {
case _EMMREG_REGISTER_REQ:
/*
* The user manually re-selected a PLMN to register to
*/
rc = emm_fsm_set_status(EMM_DEREGISTERED_PLMN_SEARCH);
rc = emm_fsm_set_status(user, EMM_DEREGISTERED_PLMN_SEARCH);
if (rc != RETURNerror) {
/* Process the network registration request */
rc = emm_fsm_process(evt);
rc = emm_fsm_process(user, evt);
}
break;
......@@ -126,7 +126,7 @@ int EmmDeregisteredNormalService(nas_user_t *user, const emm_reg_t *evt)
* message successfully delivered to the network);
* enter state EMM-REGISTERED-INITIATED
*/
rc = emm_fsm_set_status(EMM_REGISTERED_INITIATED);
rc = emm_fsm_set_status(user, EMM_REGISTERED_INITIATED);
break;
case _EMMREG_LOWERLAYER_SUCCESS:
......@@ -157,7 +157,7 @@ int EmmDeregisteredNormalService(nas_user_t *user, const emm_reg_t *evt)
* context activated;
* enter state EMM-REGISTERED.
*/
rc = emm_fsm_set_status(EMM_REGISTERED);
rc = emm_fsm_set_status(user, EMM_REGISTERED);
break;
default:
......
......@@ -88,7 +88,7 @@ int EmmDeregisteredPlmnSearch(nas_user_t *user, const emm_reg_t *evt)
int rc = RETURNerror;
assert(emm_fsm_get_status() == EMM_DEREGISTERED_PLMN_SEARCH);
assert(emm_fsm_get_status(user) == EMM_DEREGISTERED_PLMN_SEARCH);
switch (evt->primitive) {
case _EMMREG_NO_CELL:
......@@ -102,7 +102,7 @@ int EmmDeregisteredPlmnSearch(nas_user_t *user, const emm_reg_t *evt)
"Failed to notify registration update");
}
rc = emm_fsm_set_status(EMM_DEREGISTERED_NO_CELL_AVAILABLE);
rc = emm_fsm_set_status(user, EMM_DEREGISTERED_NO_CELL_AVAILABLE);
break;
case _EMMREG_REGISTER_REQ:
......@@ -130,14 +130,14 @@ int EmmDeregisteredPlmnSearch(nas_user_t *user, const emm_reg_t *evt)
* The selected cell is known not to be able to provide normal
* service
*/
rc = emm_fsm_set_status(EMM_DEREGISTERED_LIMITED_SERVICE);
rc = emm_fsm_set_status(user, EMM_DEREGISTERED_LIMITED_SERVICE);
break;
case _EMMREG_REGISTER_CNF:
/*
* A suitable cell of the selected PLMN has been found to camp on
*/
rc = emm_fsm_set_status(EMM_DEREGISTERED_NORMAL_SERVICE);
rc = emm_fsm_set_status(user, EMM_DEREGISTERED_NORMAL_SERVICE);
break;
default:
......
......@@ -46,6 +46,7 @@ Description Implements the EPS Mobility Management procedures executed
#include "nas_log.h"
#include "emm_proc.h"
#include "user_defs.h"
#include <assert.h>
......@@ -82,7 +83,7 @@ int EmmNull(nas_user_t *user, const emm_reg_t *evt)
int rc;
assert(emm_fsm_get_status() == EMM_NULL);
assert(emm_fsm_get_status(user) == EMM_NULL);
/* Delete the authentication data RAND and RES */
rc = emm_proc_authentication_delete();
......@@ -97,7 +98,7 @@ int EmmNull(nas_user_t *user, const emm_reg_t *evt)
* The EPS capability has been enabled in the UE:
* Move to the DEREGISTERED state;
*/
rc = emm_fsm_set_status(EMM_DEREGISTERED);
rc = emm_fsm_set_status(user, EMM_DEREGISTERED);
/*
* And initialize the EMM procedure call manager in order to
......
......@@ -87,7 +87,7 @@ int EmmRegistered(nas_user_t *user, const emm_reg_t *evt)
int rc = RETURNerror;
assert(emm_fsm_get_status() == EMM_REGISTERED);
assert(emm_fsm_get_status(user) == EMM_REGISTERED);
switch (evt->primitive) {
......@@ -105,7 +105,7 @@ int EmmRegistered(nas_user_t *user, const emm_reg_t *evt)
* message successfully delivered to the network);
* enter state EMM-DEREGISTERED-INITIATED
*/
rc = emm_fsm_set_status(EMM_DEREGISTERED_INITIATED);
rc = emm_fsm_set_status(user, EMM_DEREGISTERED_INITIATED);
break;
case _EMMREG_DETACH_CNF:
......@@ -113,7 +113,7 @@ int EmmRegistered(nas_user_t *user, const emm_reg_t *evt)
* The UE implicitly detached from the network (all EPS
* bearer contexts may have been deactivated)
*/
rc = emm_fsm_set_status(EMM_DEREGISTERED);
rc = emm_fsm_set_status(user, EMM_DEREGISTERED);
break;
case _EMMREG_TAU_REQ:
......
......@@ -78,11 +78,11 @@ Description Implements the EPS Mobility Management procedures executed
** Others: emm_fsm_status **
** **
***************************************************************************/
int EmmRegisteredAttemptingToUpdate(const emm_reg_t *evt)
int EmmRegisteredAttemptingToUpdate(nas_user_t *user, const emm_reg_t *evt)
{
LOG_FUNC_IN;
assert(emm_fsm_get_status() == EMM_REGISTERED_ATTEMPTING_TO_UPDATE);
assert(emm_fsm_get_status(user) == EMM_REGISTERED_ATTEMPTING_TO_UPDATE);
/* TODO */
......
......@@ -78,11 +78,11 @@ Description Implements the EPS Mobility Management procedures executed
** Others: emm_fsm_status **
** **
***************************************************************************/
int EmmRegisteredImsiDetachInitiated(const emm_reg_t *evt)
int EmmRegisteredImsiDetachInitiated(nas_user_t *user, const emm_reg_t *evt)
{
LOG_FUNC_IN;
assert(emm_fsm_get_status() == EMM_REGISTERED_IMSI_DETACH_INITIATED);
assert(emm_fsm_get_status(user) == EMM_REGISTERED_IMSI_DETACH_INITIATED);
/* TODO */
......
......@@ -84,7 +84,7 @@ int EmmRegisteredInitiated(nas_user_t *user, const emm_reg_t *evt)
int rc = RETURNerror;
assert(emm_fsm_get_status() == EMM_REGISTERED_INITIATED);
assert(emm_fsm_get_status(user) == EMM_REGISTERED_INITIATED);
switch (evt->primitive) {
case _EMMREG_ATTACH_INIT:
......@@ -96,9 +96,9 @@ int EmmRegisteredInitiated(nas_user_t *user, const emm_reg_t *evt)
/* Move to the corresponding initial EMM state */
if (evt->u.attach.is_emergency) {
rc = emm_fsm_set_status(EMM_DEREGISTERED_LIMITED_SERVICE);
rc = emm_fsm_set_status(user, EMM_DEREGISTERED_LIMITED_SERVICE);
} else {
rc = emm_fsm_set_status(EMM_DEREGISTERED_NORMAL_SERVICE);
rc = emm_fsm_set_status(user, EMM_DEREGISTERED_NORMAL_SERVICE);
}
if (rc != RETURNerror) {
......@@ -114,7 +114,7 @@ int EmmRegisteredInitiated(nas_user_t *user, const emm_reg_t *evt)
* timer T3410 expired). The network attach procedure shall be
* restarted when timer T3411 expires.
*/
rc = emm_fsm_set_status(EMM_DEREGISTERED_ATTEMPTING_TO_ATTACH);
rc = emm_fsm_set_status(user, EMM_DEREGISTERED_ATTEMPTING_TO_ATTACH);
break;
case _EMMREG_ATTACH_EXCEEDED:
......@@ -126,7 +126,7 @@ int EmmRegisteredInitiated(nas_user_t *user, const emm_reg_t *evt)
* SEARCH in order to perform a PLMN selection.
*/
/* TODO: ATTEMPTING-TO-ATTACH or PLMN-SEARCH ??? */
rc = emm_fsm_set_status(EMM_DEREGISTERED_ATTEMPTING_TO_ATTACH);
rc = emm_fsm_set_status(user, EMM_DEREGISTERED_ATTEMPTING_TO_ATTACH);
break;
case _EMMREG_ATTACH_CNF:
......@@ -134,7 +134,7 @@ int EmmRegisteredInitiated(nas_user_t *user, const emm_reg_t *evt)
* EPS network attach accepted by the network;
* enter state EMM-REGISTERED.
*/
rc = emm_fsm_set_status(EMM_REGISTERED);
rc = emm_fsm_set_status(user, EMM_REGISTERED);
if (rc != RETURNerror) {
/*
......@@ -161,7 +161,7 @@ int EmmRegisteredInitiated(nas_user_t *user, const emm_reg_t *evt)
* EPS network attach rejected by the network;
* enter state EMM-DEREGISTERED.
*/
rc = emm_fsm_set_status(EMM_DEREGISTERED);
rc = emm_fsm_set_status(user, EMM_DEREGISTERED);
if (rc != RETURNerror) {
/*
......@@ -181,11 +181,11 @@ int EmmRegisteredInitiated(nas_user_t *user, const emm_reg_t *evt)
/*
* The UE has to select a new PLMN to register to
*/
rc = emm_fsm_set_status(EMM_DEREGISTERED_PLMN_SEARCH);
rc = emm_fsm_set_status(user, EMM_DEREGISTERED_PLMN_SEARCH);
if (rc != RETURNerror) {
/* Process the network registration request */
rc = emm_fsm_process(evt);
rc = emm_fsm_process(user, evt);
}
break;
......@@ -194,7 +194,7 @@ int EmmRegisteredInitiated(nas_user_t *user, const emm_reg_t *evt)
/*
* The UE failed to register to the network for normal EPS service
*/
rc = emm_fsm_set_status(EMM_DEREGISTERED_LIMITED_SERVICE);
rc = emm_fsm_set_status(user, EMM_DEREGISTERED_LIMITED_SERVICE);
break;
case _EMMREG_NO_IMSI:
......@@ -202,7 +202,7 @@ int EmmRegisteredInitiated(nas_user_t *user, const emm_reg_t *evt)
* The UE failed to register to the network for emergency
* bearer services
*/
rc = emm_fsm_set_status(EMM_DEREGISTERED_NO_IMSI);
rc = emm_fsm_set_status(user, EMM_DEREGISTERED_NO_IMSI);
break;
case _EMMREG_DETACH_INIT:
......@@ -218,7 +218,7 @@ int EmmRegisteredInitiated(nas_user_t *user, const emm_reg_t *evt)
* message successfully delivered to the network);
* enter state EMM-DEREGISTERED-INITIATED
*/
rc = emm_fsm_set_status(EMM_DEREGISTERED_INITIATED);
rc = emm_fsm_set_status(user, EMM_DEREGISTERED_INITIATED);
break;
case _EMMREG_LOWERLAYER_SUCCESS:
......
......@@ -74,11 +74,11 @@ Description Implements the EPS Mobility Management procedures executed
** Others: emm_fsm_status **
** **
***************************************************************************/
int EmmRegisteredLimitedService(const emm_reg_t *evt)
int EmmRegisteredLimitedService(nas_user_t *user, const emm_reg_t *evt)
{
LOG_FUNC_IN;
assert(emm_fsm_get_status() == EMM_REGISTERED_LIMITED_SERVICE);
assert(emm_fsm_get_status(user) == EMM_REGISTERED_LIMITED_SERVICE);
/* TODO */
......
......@@ -75,11 +75,11 @@ Description Implements the EPS Mobility Management procedures executed
** Others: emm_fsm_status **
** **
***************************************************************************/
int EmmRegisteredNoCellAvailable(const emm_reg_t *evt)
int EmmRegisteredNoCellAvailable(nas_user_t *user, const emm_reg_t *evt)
{
LOG_FUNC_IN;
assert(emm_fsm_get_status() == EMM_REGISTERED_NO_CELL_AVAILABLE);
assert(emm_fsm_get_status(user) == EMM_REGISTERED_NO_CELL_AVAILABLE);
/* TODO */
......
......@@ -74,11 +74,11 @@ Description Implements the EPS Mobility Management procedures executed
** Others: emm_fsm_status **
** **
***************************************************************************/
int EmmRegisteredNormalService(const emm_reg_t *evt)
int EmmRegisteredNormalService(nas_user_t *user, const emm_reg_t *evt)
{
LOG_FUNC_IN;
assert(emm_fsm_get_status() == EMM_REGISTERED_NORMAL_SERVICE);
assert(emm_fsm_get_status(user) == EMM_REGISTERED_NORMAL_SERVICE);
/* TODO */
......
......@@ -74,46 +74,13 @@ Description Implements the EPS Mobility Management procedures executed
** Others: emm_fsm_status **
** **
***************************************************************************/
int EmmRegisteredPlmnSearch(const emm_reg_t *evt)
int EmmRegisteredPlmnSearch(nas_user_t *user, const emm_reg_t *evt)
{
LOG_FUNC_IN;
assert(emm_fsm_get_status() == EMM_REGISTERED_PLMN_SEARCH);
assert(emm_fsm_get_status(user) == EMM_REGISTERED_PLMN_SEARCH);
/* TODO */
LOG_FUNC_RETURN (RETURNok);
}
#if 0
/****************************************************************************
** **
** Name: EmmRegisteredPlmnSearch_xxx() **
** **
** Description: Procedure executed when xxx **
** while the EMM-SAP is in EMM-REGISTERED.PLMN-SEARCH state. **
** **
** Inputs: evt: The received EMM-SAP event **
** Others: emm_fsm_status **
** **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: emm_fsm_status **
** **
***************************************************************************/
int EmmRegisteredPlmnSearch_xxx(const emm_reg_t *evt)
{
LOG_FUNC_IN;
assert(emm_fsm_get_status() == EMM_REGISTERED_PLMN_SEARCH);
/* TODO */
LOG_FUNC_RETURN (RETURNok);
}
#endif
/****************************************************************************/
/********************* L O C A L F U N C T I O N S *********************/
/****************************************************************************/
......@@ -80,11 +80,11 @@ Description Implements the EPS Mobility Management procedures executed
** Others: emm_fsm_status **
** **
***************************************************************************/
int EmmRegisteredUpdateNeeded(const emm_reg_t *evt)
int EmmRegisteredUpdateNeeded(nas_user_t *user, const emm_reg_t *evt)
{
LOG_FUNC_IN;
assert(emm_fsm_get_status() == EMM_REGISTERED_UPDATE_NEEDED);
assert(emm_fsm_get_status(user) == EMM_REGISTERED_UPDATE_NEEDED);
/* TODO */
......
......@@ -76,11 +76,11 @@ Description Implements the EPS Mobility Management procedures executed
** Others: emm_fsm_status **
** **
***************************************************************************/
int EmmServiceRequestInitiated(const emm_reg_t *evt)
int EmmServiceRequestInitiated(nas_user_t *user, const emm_reg_t *evt)
{
LOG_FUNC_IN;
assert(emm_fsm_get_status() == EMM_SERVICE_REQUEST_INITIATED);
assert(emm_fsm_get_status(user) == EMM_SERVICE_REQUEST_INITIATED);
/* TODO */
......
......@@ -76,11 +76,11 @@ Description Implements the EPS Mobility Management procedures executed
** Others: emm_fsm_status **
** **
***************************************************************************/
int EmmTrackingAreaUpdatingInitiated(const emm_reg_t *evt)
int EmmTrackingAreaUpdatingInitiated(nas_user_t *user, const emm_reg_t *evt)
{
LOG_FUNC_IN;
assert(emm_fsm_get_status() == EMM_TRACKING_AREA_UPDATING_INITIATED);
assert(emm_fsm_get_status(user) == EMM_TRACKING_AREA_UPDATING_INITIATED);
/* TODO */
......
......@@ -43,6 +43,7 @@ Description Defines the EPS Mobility Management procedures executed at
#include "nas_log.h"
#include "emmData.h"
#include "user_defs.h"
......@@ -127,30 +128,30 @@ static const char *_emm_fsm_status_str[EMM_STATE_MAX] = {
*/
/* Type of the EPS Mobility Management state machine handler */
typedef int(*emm_fsm_handler_t)(const emm_reg_t *);
int EmmNull(const emm_reg_t *);
int EmmDeregistered(const emm_reg_t *);
int EmmRegistered(const emm_reg_t *);
int EmmDeregisteredInitiated(const emm_reg_t *);
int EmmDeregisteredNormalService(const emm_reg_t *);
int EmmDeregisteredLimitedService(const emm_reg_t *);
int EmmDeregisteredAttemptingToAttach(const emm_reg_t *);
int EmmDeregisteredPlmnSearch(const emm_reg_t *);
int EmmDeregisteredNoImsi(const emm_reg_t *);
int EmmDeregisteredAttachNeeded(const emm_reg_t *);
int EmmDeregisteredNoCellAvailable(const emm_reg_t *);
int EmmRegisteredInitiated(const emm_reg_t *);
int EmmRegisteredNormalService(const emm_reg_t *);
int EmmRegisteredAttemptingToUpdate(const emm_reg_t *);
int EmmRegisteredLimitedService(const emm_reg_t *);
int EmmRegisteredPlmnSearch(const emm_reg_t *);
int EmmRegisteredUpdateNeeded(const emm_reg_t *);
int EmmRegisteredNoCellAvailable(const emm_reg_t *);
int EmmRegisteredAttemptingToUpdate(const emm_reg_t *);
int EmmRegisteredImsiDetachInitiated(const emm_reg_t *);
int EmmTrackingAreaUpdatingInitiated(const emm_reg_t *);
int EmmServiceRequestInitiated(const emm_reg_t *);
typedef int(*emm_fsm_handler_t)(nas_user_t *user, const emm_reg_t *);
int EmmNull(nas_user_t *user, const emm_reg_t *);
int EmmDeregistered(nas_user_t *user, const emm_reg_t *);
int EmmRegistered(nas_user_t *user, const emm_reg_t *);
int EmmDeregisteredInitiated(nas_user_t *user, const emm_reg_t *);
int EmmDeregisteredNormalService(nas_user_t *user, const emm_reg_t *);
int EmmDeregisteredLimitedService(nas_user_t *user, const emm_reg_t *);
int EmmDeregisteredAttemptingToAttach(nas_user_t *user, const emm_reg_t *);
int EmmDeregisteredPlmnSearch(nas_user_t *user, const emm_reg_t *);
int EmmDeregisteredNoImsi(nas_user_t *user, const emm_reg_t *);
int EmmDeregisteredAttachNeeded(nas_user_t *user, const emm_reg_t *);
int EmmDeregisteredNoCellAvailable(nas_user_t *user, const emm_reg_t *);
int EmmRegisteredInitiated(nas_user_t *user, const emm_reg_t *);
int EmmRegisteredNormalService(nas_user_t *user, const emm_reg_t *);
int EmmRegisteredAttemptingToUpdate(nas_user_t *user, const emm_reg_t *);
int EmmRegisteredLimitedService(nas_user_t *user, const emm_reg_t *);
int EmmRegisteredPlmnSearch(nas_user_t *user, const emm_reg_t *);
int EmmRegisteredUpdateNeeded(nas_user_t *user, const emm_reg_t *);
int EmmRegisteredNoCellAvailable(nas_user_t *user, const emm_reg_t *);
int EmmRegisteredAttemptingToUpdate(nas_user_t *user, const emm_reg_t *);
int EmmRegisteredImsiDetachInitiated(nas_user_t *user, const emm_reg_t *);
int EmmTrackingAreaUpdatingInitiated(nas_user_t *user, const emm_reg_t *);
int EmmServiceRequestInitiated(nas_user_t *user, const emm_reg_t *);
/* EMM state machine handlers */
......@@ -180,14 +181,6 @@ static const emm_fsm_handler_t _emm_fsm_handlers[EMM_STATE_MAX] = {
EmmServiceRequestInitiated,
};
/*
* -----------------------------------------------------------------------------
* Current EPS Mobility Management status
* -----------------------------------------------------------------------------
*/
emm_fsm_state_t _emm_fsm_status[EMM_FSM_NB_UE_MAX];
/****************************************************************************/
/****************** E X P O R T E D F U N C T I O N S ******************/
/****************************************************************************/
......@@ -206,14 +199,12 @@ emm_fsm_state_t _emm_fsm_status[EMM_FSM_NB_UE_MAX];
** Others: _emm_fsm_status **
** **
***************************************************************************/
void emm_fsm_initialize(void)
emm_fsm_state_t emm_fsm_initialize()
{
//int ueid;
LOG_FUNC_IN;
_emm_fsm_status[0] = EMM_NULL;
LOG_FUNC_OUT;
return EMM_NULL;
}
/****************************************************************************
......@@ -231,22 +222,18 @@ void emm_fsm_initialize(void)
** Others: _emm_fsm_status **
** **
***************************************************************************/
int emm_fsm_set_status(
int emm_fsm_set_status(nas_user_t *user,
emm_fsm_state_t status)
{
LOG_FUNC_IN;
unsigned int ueid = 0;
if ( (status < EMM_STATE_MAX) && (ueid < EMM_FSM_NB_UE_MAX) ) {
if ( status < EMM_STATE_MAX ) {
LOG_TRACE(INFO, "EMM-FSM - Status changed: %s ===> %s",
_emm_fsm_status_str[_emm_fsm_status[ueid]],
_emm_fsm_status_str[user->emm_fsm_status],
_emm_fsm_status_str[status]);
if (status != _emm_fsm_status[ueid]) {
_emm_fsm_status[ueid] = status;
if (status != user->emm_fsm_status) {
user->emm_fsm_status = status;
}
LOG_FUNC_RETURN (RETURNok);
......@@ -270,9 +257,9 @@ int emm_fsm_set_status(
** Others: None **
** **
***************************************************************************/
emm_fsm_state_t emm_fsm_get_status(void)
emm_fsm_state_t emm_fsm_get_status(nas_user_t *user)
{
return (_emm_fsm_status[0]);
return user->emm_fsm_status;
}
/****************************************************************************
......@@ -289,7 +276,7 @@ emm_fsm_state_t emm_fsm_get_status(void)
** Others: None **
** **
***************************************************************************/
int emm_fsm_process(const emm_reg_t *evt)
int emm_fsm_process(nas_user_t *user, const emm_reg_t *evt)
{
int rc;
emm_fsm_state_t status;
......@@ -299,7 +286,7 @@ int emm_fsm_process(const emm_reg_t *evt)
primitive = evt->primitive;
status = _emm_fsm_status[0];
status = user->emm_fsm_status;
LOG_TRACE(INFO, "EMM-FSM - Received event %s (%d) in state %s",
_emm_fsm_event_str[primitive - _EMMREG_START - 1], primitive,
......@@ -307,7 +294,7 @@ int emm_fsm_process(const emm_reg_t *evt)
/* Execute the EMM state machine */
rc = (_emm_fsm_handlers[status])(evt);
rc = (_emm_fsm_handlers[status])(user, evt);
LOG_FUNC_RETURN (rc);
}
......
......@@ -41,48 +41,13 @@ Description Defines the EPS Mobility Management procedures executed at
#define __EMM_FSM_H__
#include "emm_regDef.h"
#include "emm_fsm_defs.h"
#include "user_defs.h"
/****************************************************************************/
/********************* G L O B A L C O N S T A N T S *******************/
/****************************************************************************/
/****************************************************************************/
/************************ G L O B A L T Y P E S ************************/
/****************************************************************************/
/*
* States of the EPS Mobility Management sublayer
* ----------------------------------------------
* The EMM protocol of the UE and the network is described by means of two
* different state machines.
*/
typedef enum {
EMM_INVALID,
EMM_NULL,
EMM_DEREGISTERED,
EMM_REGISTERED,
EMM_DEREGISTERED_INITIATED,
EMM_DEREGISTERED_NORMAL_SERVICE,
EMM_DEREGISTERED_LIMITED_SERVICE,
EMM_DEREGISTERED_ATTEMPTING_TO_ATTACH,
EMM_DEREGISTERED_PLMN_SEARCH,
EMM_DEREGISTERED_NO_IMSI,
EMM_DEREGISTERED_ATTACH_NEEDED,
EMM_DEREGISTERED_NO_CELL_AVAILABLE,
EMM_REGISTERED_INITIATED,
EMM_REGISTERED_NORMAL_SERVICE,
EMM_REGISTERED_ATTEMPTING_TO_UPDATE,
EMM_REGISTERED_LIMITED_SERVICE,
EMM_REGISTERED_PLMN_SEARCH,
EMM_REGISTERED_UPDATE_NEEDED,
EMM_REGISTERED_NO_CELL_AVAILABLE,
EMM_REGISTERED_ATTEMPTING_TO_UPDATE_MM,
EMM_REGISTERED_IMSI_DETACH_INITIATED,
EMM_TRACKING_AREA_UPDATING_INITIATED,
EMM_SERVICE_REQUEST_INITIATED,
EMM_STATE_MAX
} emm_fsm_state_t;
/****************************************************************************/
/******************** G L O B A L V A R I A B L E S ********************/
/****************************************************************************/
......@@ -91,12 +56,12 @@ typedef enum {
/****************** E X P O R T E D F U N C T I O N S ******************/
/****************************************************************************/
void emm_fsm_initialize(void);
emm_fsm_state_t emm_fsm_initialize(void);
int emm_fsm_set_status(emm_fsm_state_t status);
emm_fsm_state_t emm_fsm_get_status(void);
int emm_fsm_set_status(nas_user_t *user, emm_fsm_state_t status);
emm_fsm_state_t emm_fsm_get_status(nas_user_t *user);
int emm_fsm_process(const emm_reg_t *evt);
int emm_fsm_process(nas_user_t *user, const emm_reg_t *evt);
#endif /* __EMM_FSM_H__*/
......@@ -73,12 +73,12 @@ Description Defines the EMMREG Service Access Point that provides
** Others: NONE **
** **
***************************************************************************/
void emm_reg_initialize(void)
void emm_reg_initialize(nas_user_t *user)
{
LOG_FUNC_IN;
/* Initialize the EMM state machine */
emm_fsm_initialize();
user->emm_fsm_status = emm_fsm_initialize();
LOG_FUNC_OUT;
}
......@@ -97,7 +97,7 @@ void emm_reg_initialize(void)
** Others: None **
** **
***************************************************************************/
int emm_reg_send(const emm_reg_t *msg)
int emm_reg_send(nas_user_t *user, const emm_reg_t *msg)
{
LOG_FUNC_IN;
......@@ -111,7 +111,7 @@ int emm_reg_send(const emm_reg_t *msg)
(void)primitive;
/* Execute the EMM procedure */
rc = emm_fsm_process(msg);
rc = emm_fsm_process(user, msg);
LOG_FUNC_RETURN (rc);
}
......
......@@ -42,6 +42,7 @@ Description Defines the EMMREG Service Access Point that provides
#define __EMM_REG_H__
#include "emm_regDef.h"
#include "user_defs.h"
/****************************************************************************/
/********************* G L O B A L C O N S T A N T S *******************/
......@@ -59,8 +60,8 @@ Description Defines the EMMREG Service Access Point that provides
/****************** E X P O R T E D F U N C T I O N S ******************/
/****************************************************************************/
void emm_reg_initialize(void);
void emm_reg_initialize(nas_user_t *user);
int emm_reg_send(const emm_reg_t *msg);
int emm_reg_send(nas_user_t *user, const emm_reg_t *msg);
#endif /* __EMM_REG_H__*/
......@@ -78,7 +78,7 @@ void emm_sap_initialize(nas_user_t *user)
{
LOG_FUNC_IN;
emm_reg_initialize();
emm_reg_initialize(user);
emm_esm_initialize();
emm_as_initialize(user);
......@@ -112,7 +112,7 @@ int emm_sap_send(nas_user_t *user, emm_sap_t *msg)
(primitive < (emm_primitive_t)EMMREG_PRIMITIVE_MAX) ) {
/* Forward to the EMMREG-SAP */
msg->u.emm_reg.primitive = primitive;
rc = emm_reg_send(&msg->u.emm_reg);
rc = emm_reg_send(user, &msg->u.emm_reg);
} else if ( (primitive > (emm_primitive_t)EMMESM_PRIMITIVE_MIN) &&
(primitive < (emm_primitive_t)EMMESM_PRIMITIVE_MAX) ) {
/* Forward to the EMMESM-SAP */
......
#ifndef _EMM_FSM_DEFS_H
#define _EMM_FSM_DEFS_H
/****************************************************************************/
/************************ G L O B A L T Y P E S ************************/
/****************************************************************************/
/*
* States of the EPS Mobility Management sublayer
* ----------------------------------------------
* The EMM protocol of the UE and the network is described by means of two
* different state machines.
*/
typedef enum {
EMM_INVALID,
EMM_NULL,
EMM_DEREGISTERED,
EMM_REGISTERED,
EMM_DEREGISTERED_INITIATED,
EMM_DEREGISTERED_NORMAL_SERVICE,
EMM_DEREGISTERED_LIMITED_SERVICE,
EMM_DEREGISTERED_ATTEMPTING_TO_ATTACH,
EMM_DEREGISTERED_PLMN_SEARCH,
EMM_DEREGISTERED_NO_IMSI,
EMM_DEREGISTERED_ATTACH_NEEDED,
EMM_DEREGISTERED_NO_CELL_AVAILABLE,
EMM_REGISTERED_INITIATED,
EMM_REGISTERED_NORMAL_SERVICE,
EMM_REGISTERED_ATTEMPTING_TO_UPDATE,
EMM_REGISTERED_LIMITED_SERVICE,
EMM_REGISTERED_PLMN_SEARCH,
EMM_REGISTERED_UPDATE_NEEDED,
EMM_REGISTERED_NO_CELL_AVAILABLE,
EMM_REGISTERED_ATTEMPTING_TO_UPDATE_MM,
EMM_REGISTERED_IMSI_DETACH_INITIATED,
EMM_TRACKING_AREA_UPDATING_INITIATED,
EMM_SERVICE_REQUEST_INITIATED,
EMM_STATE_MAX
} emm_fsm_state_t;
#endif
......@@ -48,12 +48,14 @@ Description NAS type definition to manage a user equipment
#include "nas_proc_defs.h"
#include "esmData.h"
#include "esm_pt_defs.h"
#include "EMM/emm_fsm_defs.h"
typedef struct {
int fd;
proc_data_t proc;
esm_data_t *esm_data; // ESM internal data (used within ESM only)
esm_pt_data_t *esm_pt_data;
emm_fsm_state_t emm_fsm_status; // Current EPS Mobility Management status
} nas_user_t;
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment