- Fixed origin task id of sctp date req message

- Unified structures names
- Added nas ul data ind between S1AP and NAS
- Fixed indentation of NAS files

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4554 818b1a75-f10b-46b9-bf7c-635c3b92a50f
This commit is contained in:
Cedric Roux
2013-12-02 12:51:30 +00:00
parent f355cc6177
commit c67aafd2a6
94 changed files with 11726 additions and 11720 deletions
+2 -1
View File
@@ -5,7 +5,8 @@ MESSAGE_DEF(NAS_CONNECTION_ESTABLISHMENT_IND, MESSAGE_PRIORITY_MED, nas_conn_est
MESSAGE_DEF(NAS_CONNECTION_ESTABLISHMENT_RSP, MESSAGE_PRIORITY_MED, nas_conn_est_rsp_t, nas_conn_est_rsp)
MESSAGE_DEF(NAS_CONNECTION_RELEASE_IND, MESSAGE_PRIORITY_MED, nas_conn_rel_ind_t, nas_conn_rel_ind)
MESSAGE_DEF(NAS_UPLINK_DATA_IND, MESSAGE_PRIORITY_MED, nas_ul_data_ind_t, nas_ul_data_ind)
MESSAGE_DEF(NAS_DOWNLINK_DATA_IND, MESSAGE_PRIORITY_MED, nas_dl_data_ind_t, nas_dl_data_ind)
MESSAGE_DEF(NAS_DOWNLINK_DATA_REQ, MESSAGE_PRIORITY_MED, nas_dl_data_req_t, nas_dl_data_req)
MESSAGE_DEF(NAS_DOWNLINK_DATA_CNF, MESSAGE_PRIORITY_MED, nas_dl_data_cnf_t, nas_dl_data_cnf)
MESSAGE_DEF(NAS_NON_DELIVERY_IND, MESSAGE_PRIORITY_MED, nas_non_del_ind_t, nas_non_del_ind)
MESSAGE_DEF(NAS_RAB_ESTABLISHMENT_REQ, MESSAGE_PRIORITY_MED, nas_rab_est_req_t, nas_rab_est_req)
MESSAGE_DEF(NAS_RAB_ESTABLISHMENT_RESP, MESSAGE_PRIORITY_MED, nas_rab_est_rsp_t, nas_rab_est_rsp)
+7 -4
View File
@@ -3,6 +3,10 @@
#ifndef NAS_MESSAGES_TYPES_H_
#define NAS_MESSAGES_TYPES_H_
#define NAS_UL_DATA_IND(mSGpTR) (mSGpTR)->ittiMsg.nas_ul_data_ind
#define NAS_DL_DATA_REQ(mSGpTR) (mSGpTR)->ittiMsg.nas_dl_data_req
#define NAS_DL_DATA_CNF(mSGpTR) (mSGpTR)->ittiMsg.nas_dl_data_cnf
typedef struct {
} nas_paging_ind_t;
@@ -24,11 +28,10 @@ typedef struct {
} nas_conn_rel_ind_t;
typedef struct {
} nas_ul_data_ind_t;
typedef ul_info_transfer_ind_t nas_ul_data_ind_t;
typedef dl_info_transfer_req_t nas_dl_data_ind_t;
typedef dl_info_transfer_req_t nas_dl_data_req_t;
typedef dl_info_transfer_cnf_t nas_dl_data_cnf_t;
typedef struct {
-1
View File
@@ -1,4 +1,3 @@
//WARNING: Do not include this header directly. Use intertask_interface.h instead.
MESSAGE_DEF(S1AP_SCTP_NEW_MESSAGE_IND, MESSAGE_PRIORITY_MED, s1ap_sctp_new_msg_ind_t, s1ap_sctp_new_msg_ind)
MESSAGE_DEF(S1AP_UE_CAPABILITIES_IND, MESSAGE_PRIORITY_MED, s1ap_ue_cap_ind_t, s1ap_ue_cap_ind)
-9
View File
@@ -1,15 +1,6 @@
#ifndef S1AP_MESSAGES_TYPES_H_
#define S1AP_MESSAGES_TYPES_H_
typedef struct {
uint8_t *buffer; ///< SCTP buffer
uint32_t buf_length; ///< SCTP buffer length
int32_t assoc_id; ///< SCTP physical association ID
uint8_t stream; ///< Stream number on which data had been received
uint16_t instreams; ///< Number of input streams for the SCTP connection between peers
uint16_t outstreams; ///< Number of output streams for the SCTP connection between peers
} s1ap_sctp_new_msg_ind_t;
typedef struct s1ap_initial_ue_message_s {
unsigned eNB_ue_s1ap_id:24;
uint32_t mme_ue_s1ap_id;
+2 -1
View File
@@ -1,6 +1,7 @@
//WARNING: Do not include this header directly. Use intertask_interface.h instead.
MESSAGE_DEF(SCTP_INIT_MSG, MESSAGE_PRIORITY_MED, SctpInit, sctpInit)
MESSAGE_DEF(SCTP_NEW_DATA_REQ, MESSAGE_PRIORITY_MED, SctpNewDataReq, sctpNewDataReq)
MESSAGE_DEF(SCTP_DATA_REQ, MESSAGE_PRIORITY_MED, sctp_data_req_t, sctp_data_req)
MESSAGE_DEF(SCTP_DATA_IND, MESSAGE_PRIORITY_MED, sctp_data_ind_t, sctp_data_ind)
MESSAGE_DEF(SCTP_NEW_ASSOCIATION, MESSAGE_PRIORITY_MAX, sctp_new_peer_t, sctp_new_peer)
MESSAGE_DEF(SCTP_CLOSE_ASSOCIATION, MESSAGE_PRIORITY_MAX, sctp_close_association_t, sctp_close_association)
+19 -5
View File
@@ -1,14 +1,28 @@
#ifndef SCTP_MESSAGES_TYPES_H_
#define SCTP_MESSAGES_TYPES_H_
typedef struct {
#define SCTP_DATA_IND(mSGpTR) (mSGpTR)->ittiMsg.sctp_data_ind
#define SCTP_DATA_REQ(mSGpTR) (mSGpTR)->ittiMsg.sctp_data_req
#define SCTP_INIT(mSGpTR) (mSGpTR)->ittiMsg.sctpInit
#define SCTP_CLOSE_ASSOCIATION(mSGpTR) (mSGpTR)->ittiMsg.sctp_close_association
typedef struct sctp_data_req_s {
uint8_t *buffer;
uint32_t bufLen;
uint32_t assocId;
uint16_t stream;
} SctpNewDataReq;
} sctp_data_req_t;
typedef struct {
typedef struct sctp_data_ind_s {
uint8_t *buffer; ///< SCTP buffer
uint32_t buf_length; ///< SCTP buffer length
int32_t assoc_id; ///< SCTP physical association ID
uint8_t stream; ///< Stream number on which data had been received
uint16_t instreams; ///< Number of input streams for the SCTP connection between peers
uint16_t outstreams; ///< Number of output streams for the SCTP connection between peers
} sctp_data_ind_t;
typedef struct sctp_init_s {
/* Request usage of ipv4 */
unsigned ipv4:1;
/* Request usage of ipv6 */
@@ -21,11 +35,11 @@ typedef struct {
uint32_t ppid;
} SctpInit;
typedef struct {
typedef struct sctp_close_association_s {
uint32_t assoc_id;
} sctp_close_association_t;
typedef struct {
typedef struct sctp_new_peer_s {
uint32_t instreams;
uint32_t outstreams;
uint32_t assoc_id;
+33 -31
View File
@@ -1,9 +1,9 @@
ACLOCAL_AMFLAGS = -I m4
AM_CFLAGS = @ADD_CFLAGS@ \
-I$(top_srcdir)/COMMON \
-I$(top_srcdir)/UTILS \
-I$(top_srcdir)/NAS/EURECOM-NAS/src/api/network \
AM_CFLAGS = @ADD_CFLAGS@ \
-I$(top_srcdir)/COMMON \
-I$(top_srcdir)/UTILS \
-I$(top_srcdir)/NAS/EURECOM-NAS/src/api/network \
-I$(top_srcdir)/NAS/EURECOM-NAS/src/include \
-I$(top_srcdir)/INTERTASK_INTERFACE
@@ -12,52 +12,54 @@ BUILT_SOURCES = \
messages.xml \
messages_xml.h
messages_hdr = \
messages_hdr = \
$(top_srcdir)/INTERTASK_INTERFACE/intertask_messages_def.h \
$(top_srcdir)/INTERTASK_INTERFACE/timer_messages_def.h \
$(top_srcdir)/INTERTASK_INTERFACE/timer_messages_types.h \
$(top_srcdir)/COMMON/tasks_def.h \
$(top_srcdir)/COMMON/messages_def.h \
$(top_srcdir)/COMMON/messages_types.h \
$(top_srcdir)/COMMON/gtpv1_u_messages_def.h \
$(top_srcdir)/COMMON/gtpv1_u_messages_types.h \
$(top_srcdir)/COMMON/nas_messages_def.h \
$(top_srcdir)/COMMON/nas_messages_types.h \
$(top_srcdir)/COMMON/s11_messages_def.h \
$(top_srcdir)/COMMON/s11_messages_types.h \
$(top_srcdir)/COMMON/s1ap_messages_def.h \
$(top_srcdir)/COMMON/s1ap_messages_types.h \
$(top_srcdir)/COMMON/s6a_messages_def.h \
$(top_srcdir)/COMMON/s6a_messages_types.h \
$(top_srcdir)/COMMON/sgw_lite_def.h \
$(top_srcdir)/COMMON/sgw_lite_messages_types.h \
$(top_srcdir)/COMMON/sctp_messages_def.h \
$(top_srcdir)/COMMON/sctp_messages_types.h \
$(top_srcdir)/COMMON/udp_messages_def.h \
$(top_srcdir)/COMMON/tasks_def.h \
$(top_srcdir)/COMMON/messages_def.h \
$(top_srcdir)/COMMON/messages_types.h \
$(top_srcdir)/COMMON/gtpv1_u_messages_def.h \
$(top_srcdir)/COMMON/gtpv1_u_messages_types.h \
$(top_srcdir)/COMMON/nas_messages_def.h \
$(top_srcdir)/COMMON/nas_messages_types.h \
$(top_srcdir)/COMMON/s11_messages_def.h \
$(top_srcdir)/COMMON/s11_messages_types.h \
$(top_srcdir)/COMMON/s1ap_messages_def.h \
$(top_srcdir)/COMMON/s1ap_messages_types.h \
$(top_srcdir)/COMMON/s6a_messages_def.h \
$(top_srcdir)/COMMON/s6a_messages_types.h \
$(top_srcdir)/COMMON/sgw_lite_def.h \
$(top_srcdir)/COMMON/sgw_lite_messages_types.h \
$(top_srcdir)/COMMON/sctp_messages_def.h \
$(top_srcdir)/COMMON/sctp_messages_types.h \
$(top_srcdir)/COMMON/udp_messages_def.h \
$(top_srcdir)/COMMON/udp_messages_types.h
messages.xml: $(top_srcdir)/INTERTASK_INTERFACE/intertask_interface_types.h $(messages_hdr)
gccxml $(AM_CFLAGS) $< -fxml=$(top_builddir)/$@
@echo "Generating $<"
@gccxml $(AM_CFLAGS) $< -fxml=$(top_builddir)/$@
messages_xml.h: messages.xml
sed -e 's/[ ]*//' -e 's/"/\\"/g' -e 's/^/"/' -e 's/$$/"/' messages.xml > messages_xml.h
@echo "Generating $<"
@sed -e 's/[ ]*//' -e 's/"/\\"/g' -e 's/^/"/' -e 's/$$/"/' messages.xml > messages_xml.h
endif
SUBDIRS = \
. \
. \
GTPV1-U \
GTPV2-C \
INTERTASK_INTERFACE \
SGI \
NAS \
INTERTASK_INTERFACE \
SGI \
NAS \
SCTP \
S11 \
S11 \
S1AP \
S6A \
SECU \
SGW-LITE \
UTILS \
UDP \
UDP \
MME_APP \
TEST \
OAISIM_MME \
+59 -65
View File
@@ -2,19 +2,19 @@
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Source MMEprocess.c
Source MMEprocess.c
Version 0.1
Version 0.1
Date 2013/02/26
Date 2013/02/26
Product NAS stack
Product NAS stack
Subsystem MME NAS main process
Subsystem MME NAS main process
Author Frederic Maurel
Author Frederic Maurel
Description Implements the Non-Access Stratum protocol for Evolved Packet
Description Implements the Non-Access Stratum protocol for Evolved Packet
system (EPS) running at the Network side.
*****************************************************************************/
@@ -27,10 +27,10 @@
#include "nas_network.h"
#include "nas_parser.h"
#include <stdlib.h> // exit
#include <poll.h> // poll
#include <string.h> // memset
#include <signal.h> // sigaction
#include <stdlib.h> // exit
#include <poll.h> // poll
#include <string.h> // memset
#include <signal.h> // sigaction
#include <pthread.h>
/****************************************************************************/
@@ -41,9 +41,9 @@
/******************* L O C A L D E F I N I T I O N S *******************/
/****************************************************************************/
#define NAS_SLEEP_TIMEOUT 1000 /* 1 second */
#define NAS_SLEEP_TIMEOUT 1000 /* 1 second */
static void* _nas_network_mngr(void*);
static void *_nas_network_mngr(void *);
static int _nas_set_signal_handler(int signal, void (handler)(int));
static void _nas_signal_handler(int signal);
@@ -55,13 +55,12 @@ static void _nas_clean(int net_fd);
/****************************************************************************/
/****************************************************************************/
int main(int argc, const char* argv[])
int main(int argc, const char *argv[])
{
/*
* Get the command line options
*/
if (nas_parser_get_options (argc, argv) != RETURNok)
{
if (nas_parser_get_options (argc, argv) != RETURNok) {
nas_parser_print_usage (FIRMWARE_VERSION);
exit (EXIT_FAILURE);
}
@@ -71,17 +70,17 @@ int main(int argc, const char* argv[])
*/
nas_log_init (nas_parser_get_trace_level ());
const char* nhost = nas_parser_get_network_host ();
const char* nport = nas_parser_get_network_port ();
const char *nhost = nas_parser_get_network_host ();
const char *nport = nas_parser_get_network_port ();
LOG_TRACE (INFO, "MME-MAIN - %s -nhost %s -nport %s -trace 0x%x", argv[0], nhost, nport,
LOG_TRACE (INFO, "MME-MAIN - %s -nhost %s -nport %s -trace 0x%x", argv[0],
nhost, nport,
nas_parser_get_trace_level ());
/*
* Initialize the Network interface
*/
if (network_api_initialize (nhost, nport) != RETURNok)
{
if (network_api_initialize (nhost, nport) != RETURNok) {
LOG_TRACE (ERROR, "MME-MAIN - network_api_initialize() failed");
exit (EXIT_FAILURE);
}
@@ -112,8 +111,8 @@ int main(int argc, const char* argv[])
* Start thread use to manage the network connection endpoint
*/
pthread_t network_mngr;
if (pthread_create (&network_mngr, &attr, _nas_network_mngr, &network_fd) != 0)
{
if (pthread_create (&network_mngr, &attr, _nas_network_mngr,
&network_fd) != 0) {
LOG_TRACE (ERROR, "MME-MAIN - "
"Failed to create the network management thread");
network_api_close (network_fd);
@@ -125,8 +124,7 @@ int main(int argc, const char* argv[])
* Suspend execution of the main process until the network connection
* endpoint is still active
*/
while (network_fd != -1)
{
while (network_fd != -1) {
poll (NULL, 0, NAS_SLEEP_TIMEOUT);
network_fd = network_api_get_fd ();
}
@@ -144,20 +142,20 @@ int main(int argc, const char* argv[])
/****************************************************************************
** **
** Name: _nas_network_mngr() **
** Name: _nas_network_mngr() **
** **
** Description: Manages the connection endpoint use to communicate with **
** the network sublayer **
** the network sublayer **
** **
** Inputs: fd: The descriptor of the network connection **
** endpoint **
** Others: None **
** Inputs: fd: The descriptor of the network connection **
** endpoint **
** Others: None **
** **
** Outputs: Return: None **
** Others: None **
** Outputs: Return: None **
** Others: None **
** **
***************************************************************************/
static void* _nas_network_mngr(void* args)
static void *_nas_network_mngr(void *args)
{
LOG_FUNC_IN;
@@ -165,17 +163,15 @@ static void* _nas_network_mngr(void* args)
int network_message_id;
int bytes;
int *fd = (int*) args;
int *fd = (int *) args;
LOG_TRACE (INFO, "MME-MAIN - Network connection manager started (%d)", *fd);
/* Network receiving loop */
while (TRUE)
{
while (TRUE) {
/* Read the network data message */
bytes = network_api_read_data (*fd);
if (bytes == RETURNerror)
{
if (bytes == RETURNerror) {
/* Failed to read data from the network sublayer;
* exit from the receiving loop */
LOG_TRACE (ERROR, "MME-MAIN - "
@@ -183,24 +179,22 @@ static void* _nas_network_mngr(void* args)
break;
}
if (bytes == 0)
{
if (bytes == 0) {
/* A signal was caught before any data were available */
continue;
}
/* Decode the network data message */
network_message_id = network_api_decode_data (bytes);
if (network_message_id == RETURNerror)
{
if (network_message_id == RETURNerror) {
/* Failed to decode data read from the network sublayer */
continue;
}
/* Process the network data message */
ret_code = nas_network_process_data (network_message_id, network_api_get_data ());
if (ret_code != RETURNok)
{
ret_code = nas_network_process_data (network_message_id,
network_api_get_data ());
if (ret_code != RETURNok) {
/* The network data message has not been successfully
* processed */
LOG_TRACE
@@ -210,24 +204,25 @@ static void* _nas_network_mngr(void* args)
}
}
/* Close the connection to the network sublayer */LOG_TRACE (WARNING, "MME-MAIN - "
"The network connection endpoint manager exited");
/* Close the connection to the network sublayer */LOG_TRACE (WARNING,
"MME-MAIN - "
"The network connection endpoint manager exited");
LOG_FUNC_RETURN(NULL);
}
/****************************************************************************
** **
** Name: _nas_set_signal_handler() **
** Name: _nas_set_signal_handler() **
** **
** Description: Set up a signal handler **
** **
** Inputs: signal: Signal number **
** handler: Signal handler **
** Others: None **
** Inputs: signal: Signal number **
** handler: Signal handler **
** Others: None **
** **
** Outputs: Return: RETURNerror, RETURNok **
** Others: None **
** Outputs: Return: RETURNerror, RETURNok **
** Others: None **
** **
***************************************************************************/
static int _nas_set_signal_handler(int signal, void (handler)(int))
@@ -255,8 +250,7 @@ static int _nas_set_signal_handler(int signal, void (handler)(int))
/* Initialize signal handler */
act.sa_handler = handler;
if (sigaction (signal, &act, 0) < 0)
{
if (sigaction (signal, &act, 0) < 0) {
return RETURNerror;
}
@@ -267,15 +261,15 @@ static int _nas_set_signal_handler(int signal, void (handler)(int))
/****************************************************************************
** **
** Name: _nas_signal_handler() **
** Name: _nas_signal_handler() **
** **
** Description: Signal handler **
** **
** Inputs: signal: Signal number **
** Others: None **
** Inputs: signal: Signal number **
** Others: None **
** **
** Outputs: Return: None **
** Others: None **
** Outputs: Return: None **
** Others: None **
** **
***************************************************************************/
static void _nas_signal_handler(int signal)
@@ -292,15 +286,15 @@ static void _nas_signal_handler(int signal)
/****************************************************************************
** **
** Name: _nas_clean() **
** Name: _nas_clean() **
** **
** Description: Performs termination cleanup **
** **
** Inputs: net_fd: Network's connection file descriptor **
** Others: None **
** Inputs: net_fd: Network's connection file descriptor **
** Others: None **
** **
** Outputs: Return: None **
** Others: None **
** Outputs: Return: None **
** Others: None **
** **
***************************************************************************/
static void _nas_clean(int net_fd)
+84 -100
View File
@@ -2,19 +2,19 @@
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Source UEprocess.c
Source UEprocess.c
Version 0.1
Version 0.1
Date 2012/02/27
Date 2012/02/27
Product NAS stack
Product NAS stack
Subsystem UE NAS main process
Subsystem UE NAS main process
Author Frederic Maurel
Author Frederic Maurel
Description Implements the Non-Access Stratum protocol for Evolved Packet
Description Implements the Non-Access Stratum protocol for Evolved Packet
system (EPS) running at the User Equipment side.
*****************************************************************************/
@@ -29,10 +29,10 @@
#include "nas_network.h"
#include "nas_parser.h"
#include <stdlib.h> // exit
#include <poll.h> // poll
#include <string.h> // memset
#include <signal.h> // sigaction
#include <stdlib.h> // exit
#include <poll.h> // poll
#include <string.h> // memset
#include <signal.h> // sigaction
#include <pthread.h>
/****************************************************************************/
@@ -43,10 +43,10 @@
/******************* L O C A L D E F I N I T I O N S *******************/
/****************************************************************************/
#define NAS_SLEEP_TIMEOUT 1000 /* 1 second */
#define NAS_SLEEP_TIMEOUT 1000 /* 1 second */
static void* _nas_user_mngr(void*);
static void* _nas_network_mngr(void*);
static void *_nas_user_mngr(void *);
static void *_nas_network_mngr(void *);
static int _nas_set_signal_handler(int signal, void (handler)(int));
static void _nas_signal_handler(int signal);
@@ -58,13 +58,12 @@ static void _nas_clean(int usr_fd, int net_fd);
/****************************************************************************/
/****************************************************************************/
int main(int argc, const char* argv[])
int main(int argc, const char *argv[])
{
/*
* Get the command line options
*/
if (nas_parser_get_options (argc, argv) != RETURNok)
{
if (nas_parser_get_options (argc, argv) != RETURNok) {
nas_parser_print_usage (FIRMWARE_VERSION);
exit (EXIT_FAILURE);
}
@@ -74,22 +73,22 @@ int main(int argc, const char* argv[])
*/
nas_log_init (nas_parser_get_trace_level ());
const char* uhost = nas_parser_get_user_host ();
const char* uport = nas_parser_get_user_port ();
const char* devpath = nas_parser_get_device_path ();
const char* devparams = nas_parser_get_device_params ();
const char* nhost = nas_parser_get_network_host ();
const char* nport = nas_parser_get_network_port ();
const char *uhost = nas_parser_get_user_host ();
const char *uport = nas_parser_get_user_port ();
const char *devpath = nas_parser_get_device_path ();
const char *devparams = nas_parser_get_device_params ();
const char *nhost = nas_parser_get_network_host ();
const char *nport = nas_parser_get_network_port ();
LOG_TRACE (INFO, "UE-MAIN - %s -ueid %d -uhost %s -uport %s -nhost %s -nport %s -dev %s -params %s -trace 0x%x",
LOG_TRACE (INFO,
"UE-MAIN - %s -ueid %d -uhost %s -uport %s -nhost %s -nport %s -dev %s -params %s -trace 0x%x",
argv[0], nas_parser_get_ueid (), uhost, uport, nhost, nport, devpath, devparams,
nas_parser_get_trace_level ());
/*
* Initialize the User interface
*/
if (user_api_initialize (uhost, uport, devpath, devparams) != RETURNok)
{
if (user_api_initialize (uhost, uport, devpath, devparams) != RETURNok) {
LOG_TRACE (ERROR, "UE-MAIN - user_api_initialize() failed");
exit (EXIT_FAILURE);
}
@@ -98,8 +97,7 @@ int main(int argc, const char* argv[])
/*
* Initialize the Network interface
*/
if (network_api_initialize (nhost, nport) != RETURNok)
{
if (network_api_initialize (nhost, nport) != RETURNok) {
LOG_TRACE (ERROR, "UE-MAIN - network_api_initialize() failed");
user_api_close (user_fd);
exit (EXIT_FAILURE);
@@ -109,7 +107,8 @@ int main(int argc, const char* argv[])
/*
* Initialize the NAS contexts
*/
nas_user_initialize (&user_api_emm_callback, &user_api_esm_callback, FIRMWARE_VERSION);
nas_user_initialize (&user_api_emm_callback, &user_api_esm_callback,
FIRMWARE_VERSION);
nas_network_initialize ();
/*
@@ -132,8 +131,7 @@ int main(int argc, const char* argv[])
* Start thread use to manage the user connection endpoint
*/
pthread_t user_mngr;
if (pthread_create (&user_mngr, &attr, _nas_user_mngr, &user_fd) != 0)
{
if (pthread_create (&user_mngr, &attr, _nas_user_mngr, &user_fd) != 0) {
LOG_TRACE (ERROR, "UE-MAIN - "
"Failed to create the user management thread");
user_api_close (user_fd);
@@ -145,8 +143,8 @@ int main(int argc, const char* argv[])
* Start thread use to manage the network connection endpoint
*/
pthread_t network_mngr;
if (pthread_create (&network_mngr, &attr, _nas_network_mngr, &network_fd) != 0)
{
if (pthread_create (&network_mngr, &attr, _nas_network_mngr,
&network_fd) != 0) {
LOG_TRACE (ERROR, "UE-MAIN - "
"Failed to create the network management thread");
user_api_close (user_fd);
@@ -159,8 +157,7 @@ int main(int argc, const char* argv[])
* Suspend execution of the main process until all connection
* endpoints are still active
*/
while ((user_fd != -1) && (network_fd != -1))
{
while ((user_fd != -1) && (network_fd != -1)) {
poll (NULL, 0, NAS_SLEEP_TIMEOUT);
user_fd = user_api_get_fd ();
network_fd = network_api_get_fd ();
@@ -179,20 +176,20 @@ int main(int argc, const char* argv[])
/****************************************************************************
** **
** Name: _nas_user_mngr() **
** Name: _nas_user_mngr() **
** **
** Description: Manages the connection endpoint use to communicate with **
** the user application layer **
** the user application layer **
** **
** Inputs: fd: The descriptor of the user connection end- **
** point **
** Others: None **
** Inputs: fd: The descriptor of the user connection end- **
** point **
** Others: None **
** **
** Outputs: Return: None **
** Others: None **
** Outputs: Return: None **
** Others: None **
** **
***************************************************************************/
static void* _nas_user_mngr(void* args)
static void *_nas_user_mngr(void *args)
{
LOG_FUNC_IN;
@@ -202,17 +199,15 @@ static void* _nas_user_mngr(void* args)
int bytes;
int i;
int *fd = (int*) args;
int *fd = (int *) args;
LOG_TRACE (INFO, "UE-MAIN - User connection manager started (%d)", *fd);
/* User receiving loop */
while (!exit_loop)
{
while (!exit_loop) {
/* Read the user data message */
bytes = user_api_read_data (*fd);
if (bytes == RETURNerror)
{
if (bytes == RETURNerror) {
/* Failed to read data from the user application layer;
* exit from the receiving loop */
LOG_TRACE (ERROR, "UE-MAIN - "
@@ -220,20 +215,17 @@ static void* _nas_user_mngr(void* args)
break;
}
if (bytes == 0)
{
if (bytes == 0) {
/* A signal was caught before any data were available */
continue;
}
/* Decode the user data message */
nb_command = user_api_decode_data (bytes);
for (i = 0; i < nb_command; i++)
{
for (i = 0; i < nb_command; i++) {
/* Get the user data to be processed */
const void* data = user_api_get_data (i);
if (data == NULL)
{
const void *data = user_api_get_data (i);
if (data == NULL) {
/* Failed to get user data at the given index;
* go ahead and process the next user data */
LOG_TRACE (ERROR, "UE-MAIN - "
@@ -244,8 +236,7 @@ static void* _nas_user_mngr(void* args)
/* Process the user data message */
ret_code = nas_user_process_data (data);
if (ret_code != RETURNok)
{
if (ret_code != RETURNok) {
/* The user data message has not been successfully
* processed; cause code will be encoded and sent back
* to the user */
@@ -256,8 +247,7 @@ static void* _nas_user_mngr(void* args)
/* Encode the user data message */
bytes = user_api_encode_data (nas_user_get_data (), i == nb_command - 1);
if (bytes == RETURNerror)
{
if (bytes == RETURNerror) {
/* Failed to encode the user data message;
* go ahead and process the next user data */
continue;
@@ -265,8 +255,7 @@ static void* _nas_user_mngr(void* args)
/* Send the data message to the user */
bytes = user_api_send_data (*fd, bytes);
if (bytes == RETURNerror)
{
if (bytes == RETURNerror) {
/* Failed to send data to the user application layer;
* exit from the receiving loop */
LOG_TRACE (ERROR, "UE-MAIN - "
@@ -287,20 +276,20 @@ static void* _nas_user_mngr(void* args)
/****************************************************************************
** **
** Name: _nas_network_mngr() **
** Name: _nas_network_mngr() **
** **
** Description: Manages the connection endpoint use to communicate with **
** the network sublayer **
** the network sublayer **
** **
** Inputs: fd: The descriptor of the network connection **
** endpoint **
** Others: None **
** Inputs: fd: The descriptor of the network connection **
** endpoint **
** Others: None **
** **
** Outputs: Return: None **
** Others: None **
** Outputs: Return: None **
** Others: None **
** **
***************************************************************************/
static void* _nas_network_mngr(void* args)
static void *_nas_network_mngr(void *args)
{
LOG_FUNC_IN;
@@ -308,17 +297,15 @@ static void* _nas_network_mngr(void* args)
int network_message_id;
int bytes;
int *fd = (int*) args;
int *fd = (int *) args;
LOG_TRACE (INFO, "UE-MAIN - Network connection manager started (%d)", *fd);
/* Network receiving loop */
while (TRUE)
{
while (TRUE) {
/* Read the network data message */
bytes = network_api_read_data (*fd);
if (bytes == RETURNerror)
{
if (bytes == RETURNerror) {
/* Failed to read data from the network sublayer;
* exit from the receiving loop */
LOG_TRACE (ERROR, "UE-MAIN - "
@@ -326,24 +313,22 @@ static void* _nas_network_mngr(void* args)
break;
}
if (bytes == 0)
{
if (bytes == 0) {
/* A signal was caught before any data were available */
continue;
}
/* Decode the network data message */
network_message_id = network_api_decode_data (bytes);
if (network_message_id == RETURNerror)
{
if (network_message_id == RETURNerror) {
/* Failed to decode data read from the network sublayer */
continue;
}
/* Process the network data message */
ret_code = nas_network_process_data (network_message_id, network_api_get_data ());
if (ret_code != RETURNok)
{
ret_code = nas_network_process_data (network_message_id,
network_api_get_data ());
if (ret_code != RETURNok) {
/* The network data message has not been successfully
* processed */
LOG_TRACE
@@ -363,16 +348,16 @@ static void* _nas_network_mngr(void* args)
/****************************************************************************
** **
** Name: _nas_set_signal_handler() **
** Name: _nas_set_signal_handler() **
** **
** Description: Set up a signal handler **
** **
** Inputs: signal: Signal number **
** handler: Signal handler **
** Others: None **
** Inputs: signal: Signal number **
** handler: Signal handler **
** Others: None **
** **
** Outputs: Return: RETURNerror, RETURNok **
** Others: None **
** Outputs: Return: RETURNerror, RETURNok **
** Others: None **
** **
***************************************************************************/
static int _nas_set_signal_handler(int signal, void (handler)(int))
@@ -400,8 +385,7 @@ static int _nas_set_signal_handler(int signal, void (handler)(int))
/* Initialize signal handler */
act.sa_handler = handler;
if (sigaction (signal, &act, 0) < 0)
{
if (sigaction (signal, &act, 0) < 0) {
return RETURNerror;
}
@@ -412,15 +396,15 @@ static int _nas_set_signal_handler(int signal, void (handler)(int))
/****************************************************************************
** **
** Name: _nas_signal_handler() **
** Name: _nas_signal_handler() **
** **
** Description: Signal handler **
** **
** Inputs: signal: Signal number **
** Others: None **
** Inputs: signal: Signal number **
** Others: None **
** **
** Outputs: Return: None **
** Others: None **
** Outputs: Return: None **
** Others: None **
** **
***************************************************************************/
static void _nas_signal_handler(int signal)
@@ -437,16 +421,16 @@ static void _nas_signal_handler(int signal)
/****************************************************************************
** **
** Name: _nas_clean() **
** Name: _nas_clean() **
** **
** Description: Performs termination cleanup **
** **
** Inputs: usr_fd: User's connection file descriptor **
** net_fd: Network's connection file descriptor **
** Others: None **
** Inputs: usr_fd: User's connection file descriptor **
** net_fd: Network's connection file descriptor **
** Others: None **
** **
** Outputs: Return: None **
** Others: None **
** Outputs: Return: None **
** Others: None **
** **
***************************************************************************/
static void _nas_clean(int usr_fd, int net_fd)
@@ -413,7 +413,7 @@ 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 **
** context when data transfer to lower layers is requested **
@@ -1,25 +1,25 @@
/*****************************************************************************
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Source EmmCommonProcedureInitiated.c
Source EmmCommonProcedureInitiated.c
Version 0.1
Version 0.1
Date 2012/10/03
Date 2012/10/03
Product NAS stack
Product NAS stack
Subsystem EPS Mobility Management
Subsystem EPS Mobility Management
Author Frederic Maurel
Author Frederic Maurel
Description Implements the EPS Mobility Management procedures executed
when the EMM-SAP is in EMM-COMMON-PROCEDURE-INITIATED state.
Description Implements the EPS Mobility Management procedures executed
when the EMM-SAP is in EMM-COMMON-PROCEDURE-INITIATED state.
In EMM-COMMON-PROCEDURE-INITIATED state, the MME has started
a common EMM procedure and is waiting for a response from the
UE.
In EMM-COMMON-PROCEDURE-INITIATED state, the MME has started
a common EMM procedure and is waiting for a response from the
UE.
*****************************************************************************/
@@ -47,102 +47,102 @@ Description Implements the EPS Mobility Management procedures executed
/****************************************************************************
** **
** Name: EmmCommonProcedureInitiated() **
** Name: EmmCommonProcedureInitiated() **
** **
** Description: Handles the behaviour of the MME while the EMM-SAP is in **
** EMM_COMMON_PROCEDURE_INITIATED state. **
** EMM_COMMON_PROCEDURE_INITIATED state. **
** **
** 3GPP TS 24.301, section 5.1.3.4.2 **
** **
** Inputs: evt: The received EMM-SAP event **
** Others: emm_fsm_status **
** Inputs: evt: The received EMM-SAP event **
** Others: emm_fsm_status **
** **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: emm_fsm_status **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: emm_fsm_status **
** **
***************************************************************************/
int EmmCommonProcedureInitiated(const emm_reg_t* evt)
int EmmCommonProcedureInitiated(const emm_reg_t *evt)
{
int rc = RETURNerror;
LOG_FUNC_IN;
assert(emm_fsm_get_status(evt->ueid, evt->ctx) == EMM_COMMON_PROCEDURE_INITIATED);
assert(emm_fsm_get_status(evt->ueid,
evt->ctx) == EMM_COMMON_PROCEDURE_INITIATED);
switch (evt->primitive)
{
case _EMMREG_PROC_ABORT:
/*
* The EMM procedure that initiated EMM common procedure aborted
*/
rc = emm_proc_common_abort(evt->ueid);
break;
switch (evt->primitive) {
case _EMMREG_PROC_ABORT:
/*
* The EMM procedure that initiated EMM common procedure aborted
*/
rc = emm_proc_common_abort(evt->ueid);
break;
case _EMMREG_COMMON_PROC_CNF:
/*
* An EMM common procedure successfully completed;
*/
if (evt->u.common.is_attached) {
case _EMMREG_COMMON_PROC_CNF:
/*
* An EMM common procedure successfully completed;
*/
if (evt->u.common.is_attached) {
rc = emm_fsm_set_status(evt->ueid, evt->ctx, EMM_REGISTERED);
} else {
} else {
rc = emm_fsm_set_status(evt->ueid, evt->ctx, EMM_DEREGISTERED);
}
if (rc != RETURNerror) {
rc = emm_proc_common_success(evt->ueid);
}
break;
}
if (rc != RETURNerror) {
rc = emm_proc_common_success(evt->ueid);
}
break;
case _EMMREG_COMMON_PROC_REJ:
/*
* An EMM common procedure failed;
* enter state EMM-DEREGISTERED.
*/
case _EMMREG_COMMON_PROC_REJ:
/*
* An EMM common procedure failed;
* enter state EMM-DEREGISTERED.
*/
rc = emm_fsm_set_status(evt->ueid, evt->ctx, EMM_DEREGISTERED);
if (rc != RETURNerror) {
rc = emm_proc_common_reject(evt->ueid);
}
break;
if (rc != RETURNerror) {
rc = emm_proc_common_reject(evt->ueid);
}
break;
case _EMMREG_ATTACH_CNF:
/*
* Attach procedure successful and default EPS bearer
* context activated;
* enter state EMM-REGISTERED.
*/
case _EMMREG_ATTACH_CNF:
/*
* Attach procedure successful and default EPS bearer
* context activated;
* enter state EMM-REGISTERED.
*/
rc = emm_fsm_set_status(evt->ueid, evt->ctx, EMM_REGISTERED);
break;
break;
case _EMMREG_ATTACH_REJ:
/*
* Attach procedure failed;
* enter state EMM-DEREGISTERED.
*/
case _EMMREG_ATTACH_REJ:
/*
* Attach procedure failed;
* enter state EMM-DEREGISTERED.
*/
rc = emm_fsm_set_status(evt->ueid, evt->ctx, EMM_DEREGISTERED);
break;
break;
case _EMMREG_LOWERLAYER_SUCCESS:
/*
* Data successfully delivered to the network
*/
rc = RETURNok;
break;
case _EMMREG_LOWERLAYER_SUCCESS:
/*
* Data successfully delivered to the network
*/
rc = RETURNok;
break;
case _EMMREG_LOWERLAYER_FAILURE:
/*
* Transmission failure occurred before the EMM common
* procedure being completed
*/
rc = emm_proc_common_failure(evt->ueid);
if (rc != RETURNerror) {
case _EMMREG_LOWERLAYER_FAILURE:
/*
* Transmission failure occurred before the EMM common
* procedure being completed
*/
rc = emm_proc_common_failure(evt->ueid);
if (rc != RETURNerror) {
rc = emm_fsm_set_status(evt->ueid, evt->ctx, EMM_DEREGISTERED);
}
break;
}
break;
default:
LOG_TRACE(ERROR, "EMM-FSM - Primitive is not valid (%d)",
evt->primitive);
break;
default:
LOG_TRACE(ERROR, "EMM-FSM - Primitive is not valid (%d)",
evt->primitive);
break;
}
LOG_FUNC_RETURN (rc);
@@ -1,31 +1,31 @@
/*****************************************************************************
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Source EmmDeregistered.c
Source EmmDeregistered.c
Version 0.1
Version 0.1
Date 2012/10/03
Date 2012/10/03
Product NAS stack
Product NAS stack
Subsystem EPS Mobility Management
Subsystem EPS Mobility Management
Author Frederic Maurel
Author Frederic Maurel
Description Implements the EPS Mobility Management procedures executed
when the EMM-SAP is in EMM-DEREGISTERED state.
Description Implements the EPS Mobility Management procedures executed
when the EMM-SAP is in EMM-DEREGISTERED state.
In EMM-DEREGISTERED state, no EMM context has been established
or the EMM context is marked as detached.
The UE shall start the attach or combined attach procedure to
establish an EMM context.
In EMM-DEREGISTERED state, no EMM context has been established
or the EMM context is marked as detached.
The UE shall start the attach or combined attach procedure to
establish an EMM context.
The MME may answer to an attach or a combined attach procedure
initiated by the UE. It may also answer to a tracking area
updating procedure or combined tracking area updating procedure
initiated by a UE if the EMM context is marked as detached.
The MME may answer to an attach or a combined attach procedure
initiated by the UE. It may also answer to a tracking area
updating procedure or combined tracking area updating procedure
initiated by a UE if the EMM context is marked as detached.
*****************************************************************************/
@@ -52,22 +52,22 @@ Description Implements the EPS Mobility Management procedures executed
/****************************************************************************
** **
** Name: EmmDeregistered() **
** Name: EmmDeregistered() **
** **
** Description: Handles the behaviour of the UE and the MME while the **
** EMM-SAP is in EMM-DEREGISTERED state. **
** EMM-SAP is in EMM-DEREGISTERED state. **
** **
** 3GPP TS 24.301, section 5.2.2.2 **
** **
** Inputs: evt: The received EMM-SAP event **
** Others: emm_fsm_status **
** Inputs: evt: The received EMM-SAP event **
** Others: emm_fsm_status **
** **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: emm_fsm_status **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: emm_fsm_status **
** **
***************************************************************************/
int EmmDeregistered(const emm_reg_t* evt)
int EmmDeregistered(const emm_reg_t *evt)
{
LOG_FUNC_IN;
@@ -84,7 +84,7 @@ int EmmDeregistered(const emm_reg_t* evt)
/* Delete the authentication data RAND and RES */
rc = emm_proc_authentication_delete();
if (rc != RETURNok) {
LOG_FUNC_RETURN (rc);
LOG_FUNC_RETURN (rc);
}
/* TODO: 3GPP TS 24.301, section 4.4.2.1
* The UE shall store the current native EPS security context as specified
@@ -94,94 +94,93 @@ int EmmDeregistered(const emm_reg_t* evt)
*/
#endif
switch (evt->primitive)
{
switch (evt->primitive) {
#ifdef NAS_UE
case _EMMREG_NO_IMSI:
/*
* The UE was powered on without a valid USIM application present
*/
rc = emm_fsm_set_status(EMM_DEREGISTERED_NO_IMSI);
break;
case _EMMREG_NO_IMSI:
/*
* The UE was powered on without a valid USIM application present
*/
rc = emm_fsm_set_status(EMM_DEREGISTERED_NO_IMSI);
break;
case _EMMREG_REGISTER_REQ:
/*
* 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);
if (rc != RETURNerror) {
/* Process the network registration request */
rc = emm_fsm_process(evt);
}
break;
case _EMMREG_REGISTER_REQ:
/*
* 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);
if (rc != RETURNerror) {
/* Process the network registration request */
rc = emm_fsm_process(evt);
}
break;
case _EMMREG_ATTACH_INIT:
/*
* Attach procedure has to be restarted (timers T3402 or T3411
* expired) while the UE locally detached from the network
*/
case _EMMREG_ATTACH_INIT:
/*
* Attach procedure has to be restarted (timers T3402 or T3411
* expired) while the UE locally detached from the network
*/
/* Move to the corresponding initial EMM state */
if (evt->u.attach.is_emergency) {
rc = emm_fsm_set_status(EMM_DEREGISTERED_LIMITED_SERVICE);
} else {
rc = emm_fsm_set_status(EMM_DEREGISTERED_NORMAL_SERVICE);
}
if (rc != RETURNerror) {
/* Restart the attach procedure */
rc = emm_proc_attach_restart();
}
break;
/* Move to the corresponding initial EMM state */
if (evt->u.attach.is_emergency) {
rc = emm_fsm_set_status(EMM_DEREGISTERED_LIMITED_SERVICE);
} else {
rc = emm_fsm_set_status(EMM_DEREGISTERED_NORMAL_SERVICE);
}
if (rc != RETURNerror) {
/* Restart the attach procedure */
rc = emm_proc_attach_restart();
}
break;
#endif
#ifdef NAS_MME
case _EMMREG_PROC_ABORT:
/*
* Ongoing EMM procedure aborted
*/
rc = RETURNok;
break;
case _EMMREG_PROC_ABORT:
/*
* Ongoing EMM procedure aborted
*/
rc = RETURNok;
break;
case _EMMREG_COMMON_PROC_REQ:
/*
* An EMM common procedure has been initiated;
* enter state EMM-COMMON-PROCEDURE-INITIATED.
*/
case _EMMREG_COMMON_PROC_REQ:
/*
* An EMM common procedure has been initiated;
* enter state EMM-COMMON-PROCEDURE-INITIATED.
*/
rc = emm_fsm_set_status(evt->ueid, evt->ctx, EMM_COMMON_PROCEDURE_INITIATED);
break;
break;
case _EMMREG_ATTACH_CNF:
/*
* Attach procedure successful and default EPS bearer
* context activated;
* enter state EMM-REGISTERED.
*/
case _EMMREG_ATTACH_CNF:
/*
* Attach procedure successful and default EPS bearer
* context activated;
* enter state EMM-REGISTERED.
*/
rc = emm_fsm_set_status(evt->ueid, evt->ctx, EMM_REGISTERED);
break;
break;
#endif
case _EMMREG_LOWERLAYER_SUCCESS:
/*
* Data successfully delivered to the network
*/
rc = RETURNok;
break;
case _EMMREG_LOWERLAYER_SUCCESS:
/*
* Data successfully delivered to the network
*/
rc = RETURNok;
break;
case _EMMREG_LOWERLAYER_FAILURE:
/*
* Data failed to be delivered to the network
*/
rc = RETURNok;
break;
case _EMMREG_LOWERLAYER_FAILURE:
/*
* Data failed to be delivered to the network
*/
rc = RETURNok;
break;
default:
LOG_TRACE(ERROR, "EMM-FSM - Primitive is not valid (%d)",
evt->primitive);
break;
default:
LOG_TRACE(ERROR, "EMM-FSM - Primitive is not valid (%d)",
evt->primitive);
break;
}
#ifdef NAS_UE
@@ -1,27 +1,27 @@
/*****************************************************************************
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Source EmmDeregisteredAttachNeeded.c
Source EmmDeregisteredAttachNeeded.c
Version 0.1
Version 0.1
Date 2012/10/03
Date 2012/10/03
Product NAS stack
Product NAS stack
Subsystem EPS Mobility Management
Subsystem EPS Mobility Management
Author Frederic Maurel
Author Frederic Maurel
Description Implements the EPS Mobility Management procedures executed
when the EMM-SAP is in EMM-DEREGISTERED.ATTACH-NEEDED state.
Description Implements the EPS Mobility Management procedures executed
when the EMM-SAP is in EMM-DEREGISTERED.ATTACH-NEEDED state.
In EMM-DEREGISTERED.ATTACH-NEEDED state, Valid subscriber
data are available for the UE and for some reason an attach
must be performed as soon as possible. The access class may
be blocked due to access class control, or the network rejec-
ted the NAS signalling connection establishment.
In EMM-DEREGISTERED.ATTACH-NEEDED state, Valid subscriber
data are available for the UE and for some reason an attach
must be performed as soon as possible. The access class may
be blocked due to access class control, or the network rejec-
ted the NAS signalling connection establishment.
*****************************************************************************/
@@ -47,20 +47,20 @@ Description Implements the EPS Mobility Management procedures executed
/****************************************************************************
** **
** Name: EmmDeregisteredAttachNeeded() **
** Name: EmmDeregisteredAttachNeeded() **
** **
** Description: Handles the behaviour of the UE while the EMM-SAP is in **
** EMM-DEREGISTERED.ATTACH-NEEDED state. **
** EMM-DEREGISTERED.ATTACH-NEEDED state. **
** **
** Inputs: evt: The received EMM-SAP event **
** Others: emm_fsm_status **
** Inputs: evt: The received EMM-SAP event **
** Others: emm_fsm_status **
** **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: emm_fsm_status **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: emm_fsm_status **
** **
***************************************************************************/
int EmmDeregisteredAttachNeeded(const emm_reg_t* evt)
int EmmDeregisteredAttachNeeded(const emm_reg_t *evt)
{
LOG_FUNC_IN;
@@ -1,25 +1,25 @@
/*****************************************************************************
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Source EmmDeregisteredAttemptingToAttach.c
Source EmmDeregisteredAttemptingToAttach.c
Version 0.1
Version 0.1
Date 2012/10/03
Date 2012/10/03
Product NAS stack
Product NAS stack
Subsystem EPS Mobility Management
Subsystem EPS Mobility Management
Author Frederic Maurel
Author Frederic Maurel
Description Implements the EPS Mobility Management procedures executed
when the EMM-SAP is in EMM-DEREGISTERED.ATTEMPTING-TO-ATTACH
state.
Description Implements the EPS Mobility Management procedures executed
when the EMM-SAP is in EMM-DEREGISTERED.ATTEMPTING-TO-ATTACH
state.
In EMM-DEREGISTERED.ATTEMPTING-TO-ATTACH state, the EPS update
status is EU2, and a previous attach was not successful.
In EMM-DEREGISTERED.ATTEMPTING-TO-ATTACH state, the EPS update
status is EU2, and a previous attach was not successful.
*****************************************************************************/
@@ -47,22 +47,22 @@ Description Implements the EPS Mobility Management procedures executed
/****************************************************************************
** **
** Name: EmmDeregisteredAttemptingToAttach() **
** Name: EmmDeregisteredAttemptingToAttach() **
** **
** Description: Handles the behaviour of the UE while the EMM-SAP is in **
** EMM-DEREGISTERED.ATTEMPTING-TO-ATTACH state. **
** EMM-DEREGISTERED.ATTEMPTING-TO-ATTACH state. **
** **
** 3GPP TS 24.301, section 5.2.2.3.3 **
** **
** Inputs: evt: The received EMM-SAP event **
** Others: emm_fsm_status **
** Inputs: evt: The received EMM-SAP event **
** Others: emm_fsm_status **
** **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: emm_fsm_status **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: emm_fsm_status **
** **
***************************************************************************/
int EmmDeregisteredAttemptingToAttach(const emm_reg_t* evt)
int EmmDeregisteredAttemptingToAttach(const emm_reg_t *evt)
{
LOG_FUNC_IN;
@@ -70,44 +70,43 @@ int EmmDeregisteredAttemptingToAttach(const emm_reg_t* evt)
assert(emm_fsm_get_status() == EMM_DEREGISTERED_ATTEMPTING_TO_ATTACH);
switch (evt->primitive)
{
case _EMMREG_ATTACH_INIT:
/*
* Attach procedure has to be restarted (timers T3402 or T3411
* expired)
*/
switch (evt->primitive) {
case _EMMREG_ATTACH_INIT:
/*
* Attach procedure has to be restarted (timers T3402 or T3411
* expired)
*/
/* Move to the corresponding initial EMM state */
if (evt->u.attach.is_emergency) {
rc = emm_fsm_set_status(EMM_DEREGISTERED_LIMITED_SERVICE);
} else {
rc = emm_fsm_set_status(EMM_DEREGISTERED_NORMAL_SERVICE);
}
if (rc != RETURNerror) {
/* Restart the attach procedure */
rc = emm_proc_attach_restart();
}
break;
/* Move to the corresponding initial EMM state */
if (evt->u.attach.is_emergency) {
rc = emm_fsm_set_status(EMM_DEREGISTERED_LIMITED_SERVICE);
} else {
rc = emm_fsm_set_status(EMM_DEREGISTERED_NORMAL_SERVICE);
}
if (rc != RETURNerror) {
/* Restart the attach procedure */
rc = emm_proc_attach_restart();
}
break;
case _EMMREG_LOWERLAYER_SUCCESS:
/*
* Data successfully delivered to the network
*/
rc = emm_proc_lowerlayer_success();
break;
case _EMMREG_LOWERLAYER_SUCCESS:
/*
* Data successfully delivered to the network
*/
rc = emm_proc_lowerlayer_success();
break;
case _EMMREG_LOWERLAYER_FAILURE:
/*
* Data failed to be delivered to the network
*/
rc = emm_proc_lowerlayer_failure(FALSE);
break;
case _EMMREG_LOWERLAYER_FAILURE:
/*
* Data failed to be delivered to the network
*/
rc = emm_proc_lowerlayer_failure(FALSE);
break;
default:
LOG_TRACE(ERROR, "EMM-FSM - Primitive is not valid (%d)",
evt->primitive);
break;
default:
LOG_TRACE(ERROR, "EMM-FSM - Primitive is not valid (%d)",
evt->primitive);
break;
}
LOG_FUNC_RETURN (rc);
@@ -1,27 +1,27 @@
/*****************************************************************************
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Source EmmDeregisteredInitiated.c
Source EmmDeregisteredInitiated.c
Version 0.1
Version 0.1
Date 2012/10/03
Date 2012/10/03
Product NAS stack
Product NAS stack
Subsystem EPS Mobility Management
Subsystem EPS Mobility Management
Author Frederic Maurel
Author Frederic Maurel
Description Implements the EPS Mobility Management procedures executed
when the EMM-SAP is in EMM-DEREGISTERED-INITIATED state.
Description Implements the EPS Mobility Management procedures executed
when the EMM-SAP is in EMM-DEREGISTERED-INITIATED state.
In EMM-DEREGISTERED-INITIATED state, the UE has requested
release of the EMM context by starting the detach or combined
detach procedure and is waiting for a response from the MME.
The MME has started a detach procedure and is waiting for a
response from the UE.
In EMM-DEREGISTERED-INITIATED state, the UE has requested
release of the EMM context by starting the detach or combined
detach procedure and is waiting for a response from the MME.
The MME has started a detach procedure and is waiting for a
response from the UE.
*****************************************************************************/
@@ -47,20 +47,20 @@ Description Implements the EPS Mobility Management procedures executed
/****************************************************************************
** **
** Name: EmmDeregisteredInitiated() **
** Name: EmmDeregisteredInitiated() **
** **
** Description: Handles the behaviour of the UE and the MME while the **
** EMM-SAP is in EMM-DEREGISTERED-INITIATED state. **
** EMM-SAP is in EMM-DEREGISTERED-INITIATED state. **
** **
** Inputs: evt: The received EMM-SAP event **
** Others: emm_fsm_status **
** Inputs: evt: The received EMM-SAP event **
** Others: emm_fsm_status **
** **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: emm_fsm_status **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: emm_fsm_status **
** **
***************************************************************************/
int EmmDeregisteredInitiated(const emm_reg_t* evt)
int EmmDeregisteredInitiated(const emm_reg_t *evt)
{
LOG_FUNC_IN;
@@ -73,50 +73,49 @@ int EmmDeregisteredInitiated(const emm_reg_t* evt)
assert(emm_fsm_get_status(evt->ueid, evt->ctx) == EMM_DEREGISTERED_INITIATED);
#endif
switch (evt->primitive)
{
switch (evt->primitive) {
#ifdef NAS_UE
case _EMMREG_DETACH_CNF:
/*
* The UE explicitly detached from the network (all EPS
* bearer contexts have been deactivated as UE initiated
* detach procedure successfully completed)
*/
rc = emm_fsm_set_status(EMM_DEREGISTERED);
break;
case _EMMREG_DETACH_CNF:
/*
* The UE explicitly detached from the network (all EPS
* bearer contexts have been deactivated as UE initiated
* detach procedure successfully completed)
*/
rc = emm_fsm_set_status(EMM_DEREGISTERED);
break;
case _EMMREG_DETACH_FAILED:
/*
* The detach procedure failed
*/
if (evt->u.detach.type == EMM_DETACH_TYPE_IMSI) {
rc = emm_fsm_set_status(EMM_REGISTERED_NORMAL_SERVICE);
} else {
rc = emm_fsm_set_status(EMM_DEREGISTERED);
}
break;
case _EMMREG_DETACH_FAILED:
/*
* The detach procedure failed
*/
if (evt->u.detach.type == EMM_DETACH_TYPE_IMSI) {
rc = emm_fsm_set_status(EMM_REGISTERED_NORMAL_SERVICE);
} else {
rc = emm_fsm_set_status(EMM_DEREGISTERED);
}
break;
case _EMMREG_LOWERLAYER_SUCCESS:
/*
* Ignore Detach Request message successful retransmission
*/
rc = RETURNok;
break;
case _EMMREG_LOWERLAYER_SUCCESS:
/*
* Ignore Detach Request message successful retransmission
*/
rc = RETURNok;
break;
case _EMMREG_LOWERLAYER_FAILURE:
case _EMMREG_LOWERLAYER_RELEASE:
/*
* Lower layer failure or release of the NAS signalling connection
* before the Detach Accept is received
*/
rc = emm_proc_lowerlayer_release();
break;
case _EMMREG_LOWERLAYER_FAILURE:
case _EMMREG_LOWERLAYER_RELEASE:
/*
* Lower layer failure or release of the NAS signalling connection
* before the Detach Accept is received
*/
rc = emm_proc_lowerlayer_release();
break;
#endif
default:
LOG_TRACE(ERROR, "EMM-FSM - Primitive is not valid (%d)",
evt->primitive);
break;
default:
LOG_TRACE(ERROR, "EMM-FSM - Primitive is not valid (%d)",
evt->primitive);
break;
}
LOG_FUNC_RETURN (rc);
@@ -1,25 +1,25 @@
/*****************************************************************************
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Source EmmDeregisteredLimitedService.c
Source EmmDeregisteredLimitedService.c
Version 0.1
Version 0.1
Date 2012/10/03
Date 2012/10/03
Product NAS stack
Product NAS stack
Subsystem EPS Mobility Management
Subsystem EPS Mobility Management
Author Frederic Maurel
Author Frederic Maurel
Description Implements the EPS Mobility Management procedures executed
when the EMM-SAP is in EMM-DEREGISTERED.LIMITED-SERVICE state.
Description Implements the EPS Mobility Management procedures executed
when the EMM-SAP is in EMM-DEREGISTERED.LIMITED-SERVICE state.
In EMM-DEREGISTERED.LIMITED-SERVICE state, the EPS update
status is EU3, and it is known that a selected cell is unable
to provide normal service.
In EMM-DEREGISTERED.LIMITED-SERVICE state, the EPS update
status is EU3, and it is known that a selected cell is unable
to provide normal service.
*****************************************************************************/
@@ -48,25 +48,25 @@ Description Implements the EPS Mobility Management procedures executed
/****************************************************************************
** **
** Name: EmmDeregisteredLimitedService() **
** Name: EmmDeregisteredLimitedService() **
** **
** Description: Handles the behaviour of the UE while the EMM-SAP is in **
** EMM-DEREGISTERED.LIMITED-SERVICE state. **
** EMM-DEREGISTERED.LIMITED-SERVICE state. **
** **
** 3GPP TS 24.301, section 5.2.2.3.2 **
** The UE shall initiate an attach or combined attach proce- **
** dure when entering a cell which provides normal service. **
** It may initiate attach for emergency bearer services. **
** The UE shall initiate an attach or combined attach proce- **
** dure when entering a cell which provides normal service. **
** It may initiate attach for emergency bearer services. **
** **
** Inputs: evt: The received EMM-SAP event **
** Others: emm_fsm_status **
** Inputs: evt: The received EMM-SAP event **
** Others: emm_fsm_status **
** **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: emm_fsm_status **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: emm_fsm_status **
** **
***************************************************************************/
int EmmDeregisteredLimitedService(const emm_reg_t* evt)
int EmmDeregisteredLimitedService(const emm_reg_t *evt)
{
LOG_FUNC_IN;
@@ -74,61 +74,60 @@ int EmmDeregisteredLimitedService(const emm_reg_t* evt)
assert(emm_fsm_get_status() == 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);
if (rc != RETURNerror) {
/* Process the network registration request */
rc = emm_fsm_process(evt);
}
break;
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);
if (rc != RETURNerror) {
/* Process the network registration request */
rc = emm_fsm_process(evt);
}
break;
case _EMMREG_ATTACH_INIT:
/*
* Initiate attach procedure for emergency bearer services
*/
rc = emm_proc_attach(EMM_ATTACH_TYPE_EMERGENCY);
break;
case _EMMREG_ATTACH_INIT:
/*
* Initiate attach procedure for emergency bearer services
*/
rc = emm_proc_attach(EMM_ATTACH_TYPE_EMERGENCY);
break;
case _EMMREG_ATTACH_REQ:
/*
* An attach for bearer emergency services has been requested
* (Attach Request message successfully delivered to the network);
* enter state EMM-REGISTERED-INITIATED
*/
rc = emm_fsm_set_status(EMM_REGISTERED_INITIATED);
break;
case _EMMREG_ATTACH_REQ:
/*
* An attach for bearer emergency services has been requested
* (Attach Request message successfully delivered to the network);
* enter state EMM-REGISTERED-INITIATED
*/
rc = emm_fsm_set_status(EMM_REGISTERED_INITIATED);
break;
case _EMMREG_LOWERLAYER_SUCCESS:
/*
* Initial NAS message has been successfully delivered
* to the network
*/
rc = emm_proc_lowerlayer_success();
break;
case _EMMREG_LOWERLAYER_SUCCESS:
/*
* Initial NAS message has been successfully delivered
* to the network
*/
rc = emm_proc_lowerlayer_success();
break;
case _EMMREG_LOWERLAYER_FAILURE:
/*
* Initial NAS message failed to be delivered to the network
*/
rc = emm_proc_lowerlayer_failure(TRUE);
break;
case _EMMREG_LOWERLAYER_FAILURE:
/*
* Initial NAS message failed to be delivered to the network
*/
rc = emm_proc_lowerlayer_failure(TRUE);
break;
case _EMMREG_LOWERLAYER_RELEASE:
/*
* NAS signalling connection has been released
*/
rc = emm_proc_lowerlayer_release();
break;
case _EMMREG_LOWERLAYER_RELEASE:
/*
* NAS signalling connection has been released
*/
rc = emm_proc_lowerlayer_release();
break;
default:
LOG_TRACE(ERROR, "EMM-FSM - Primitive is not valid (%d)",
evt->primitive);
break;
default:
LOG_TRACE(ERROR, "EMM-FSM - Primitive is not valid (%d)",
evt->primitive);
break;
}
LOG_FUNC_RETURN (rc);
@@ -1,27 +1,27 @@
/*****************************************************************************
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Source EmmDeregisteredNoCellAvailable.c
Source EmmDeregisteredNoCellAvailable.c
Version 0.1
Version 0.1
Date 2012/10/03
Date 2012/10/03
Product NAS stack
Product NAS stack
Subsystem EPS Mobility Management
Subsystem EPS Mobility Management
Author Frederic Maurel
Author Frederic Maurel
Description Implements the EPS Mobility Management procedures executed
when the EMM-SAP is in EMM-DEREGISTERED.NO-CELL-AVAILABLE
state.
Description Implements the EPS Mobility Management procedures executed
when the EMM-SAP is in EMM-DEREGISTERED.NO-CELL-AVAILABLE
state.
In EMM-DEREGISTERED.NO-CELL-AVAILABLE state, no E-UTRAN cell
can be selected. A first intensive search failed when in
substate EMM_DEREGISTERED.PLMN-SEARCH. Cells are searched for
at a low rhythm. No EPS services are offered.
In EMM-DEREGISTERED.NO-CELL-AVAILABLE state, no E-UTRAN cell
can be selected. A first intensive search failed when in
substate EMM_DEREGISTERED.PLMN-SEARCH. Cells are searched for
at a low rhythm. No EPS services are offered.
*****************************************************************************/
@@ -50,24 +50,24 @@ Description Implements the EPS Mobility Management procedures executed
/****************************************************************************
** **
** Name: EmmDeregisteredNoCellAvailable() **
** Name: EmmDeregisteredNoCellAvailable() **
** **
** Description: Handles the behaviour of the UE while the EMM-SAP is in **
** EMM-DEREGISTERED.NO-CELL-AVAILABLE state. **
** EMM-DEREGISTERED.NO-CELL-AVAILABLE state. **
** **
** 3GPP TS 24.301, section 5.2.2.3.7 **
** The UE shall perform cell selection and choose an appro- **
** priate substate when a cell is found. **
** The UE shall perform cell selection and choose an appro- **
** priate substate when a cell is found. **
** **
** Inputs: evt: The received EMM-SAP event **
** Others: emm_fsm_status **
** Inputs: evt: The received EMM-SAP event **
** Others: emm_fsm_status **
** **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: emm_fsm_status **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: emm_fsm_status **
** **
***************************************************************************/
int EmmDeregisteredNoCellAvailable(const emm_reg_t* evt)
int EmmDeregisteredNoCellAvailable(const emm_reg_t *evt)
{
LOG_FUNC_IN;
@@ -75,39 +75,38 @@ int EmmDeregisteredNoCellAvailable(const emm_reg_t* evt)
assert(emm_fsm_get_status() == EMM_DEREGISTERED_NO_CELL_AVAILABLE);
switch (evt->primitive)
{
/* TODO: network re-selection is not allowed when in No Cell
* Available substate. The AS should search for a suitable cell
* and notify the NAS when such a cell is found (TS 24.008 section
* 4.2.4.1.2) */
case _EMMREG_REGISTER_REQ:
/*
* The user manually re-selected a PLMN to register to
*/
rc = emm_fsm_set_status(EMM_DEREGISTERED_PLMN_SEARCH);
switch (evt->primitive) {
/* TODO: network re-selection is not allowed when in No Cell
* Available substate. The AS should search for a suitable cell
* and notify the NAS when such a cell is found (TS 24.008 section
* 4.2.4.1.2) */
case _EMMREG_REGISTER_REQ:
/*
* The user manually re-selected a PLMN to register to
*/
rc = emm_fsm_set_status(EMM_DEREGISTERED_PLMN_SEARCH);
if (rc != RETURNerror) {
/*
* Notify EMM that the MT is currently searching an operator
* to register to
*/
rc = emm_proc_registration_notify(NET_REG_STATE_ON);
if (rc != RETURNok) {
LOG_TRACE(WARNING, "EMM-FSM - "
"Failed to notify registration update");
}
/*
* Perform network re-selection procedure
*/
rc = emm_proc_plmn_selection(evt->u.regist.index);
}
break;
if (rc != RETURNerror) {
/*
* Notify EMM that the MT is currently searching an operator
* to register to
*/
rc = emm_proc_registration_notify(NET_REG_STATE_ON);
if (rc != RETURNok) {
LOG_TRACE(WARNING, "EMM-FSM - "
"Failed to notify registration update");
}
/*
* Perform network re-selection procedure
*/
rc = emm_proc_plmn_selection(evt->u.regist.index);
}
break;
default:
LOG_TRACE(ERROR, "EMM-FSM - Primitive is not valid (%d)",
evt->primitive);
break;
default:
LOG_TRACE(ERROR, "EMM-FSM - Primitive is not valid (%d)",
evt->primitive);
break;
}
LOG_FUNC_RETURN (rc);
@@ -1,24 +1,24 @@
/*****************************************************************************
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Source EmmDeregisteredNoImsi.c
Source EmmDeregisteredNoImsi.c
Version 0.1
Version 0.1
Date 2012/10/03
Date 2012/10/03
Product NAS stack
Product NAS stack
Subsystem EPS Mobility Management
Subsystem EPS Mobility Management
Author Frederic Maurel
Author Frederic Maurel
Description Implements the EPS Mobility Management procedures executed
when the EMM-SAP is in EMM-DEREGISTERED.NO-IMSI state.
Description Implements the EPS Mobility Management procedures executed
when the EMM-SAP is in EMM-DEREGISTERED.NO-IMSI state.
In EMM-DEREGISTERED.NO-IMSI state, the UE is switched on
without a valid USIM inserted.
In EMM-DEREGISTERED.NO-IMSI state, the UE is switched on
without a valid USIM inserted.
*****************************************************************************/
@@ -44,24 +44,24 @@ Description Implements the EPS Mobility Management procedures executed
/****************************************************************************
** **
** Name: EmmDeregisteredNoImsi() **
** Name: EmmDeregisteredNoImsi() **
** **
** Description: Handles the behaviour of the UE while the EMM-SAP is in **
** EMM-DEREGISTERED.NO-IMSI state. **
** EMM-DEREGISTERED.NO-IMSI state. **
** **
** 3GPP TS 24.301, section 5.2.2.3.5 **
** The UE shall perform cell selection and may initiate **
** attach for emergency bearer services. **
** The UE shall perform cell selection and may initiate **
** attach for emergency bearer services. **
** **
** Inputs: evt: The received EMM-SAP event **
** Others: emm_fsm_status **
** Inputs: evt: The received EMM-SAP event **
** Others: emm_fsm_status **
** **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: emm_fsm_status **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: emm_fsm_status **
** **
***************************************************************************/
int EmmDeregisteredNoImsi(const emm_reg_t* evt)
int EmmDeregisteredNoImsi(const emm_reg_t *evt)
{
LOG_FUNC_IN;
@@ -1,26 +1,26 @@
/*****************************************************************************
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Source EmmDeregisteredNormalService.c
Source EmmDeregisteredNormalService.c
Version 0.1
Version 0.1
Date 2012/10/03
Date 2012/10/03
Product NAS stack
Product NAS stack
Subsystem EPS Mobility Management
Subsystem EPS Mobility Management
Author Frederic Maurel
Author Frederic Maurel
Description Implements the EPS Mobility Management procedures executed
when the EMM-SAP is in EMM-DEREGISTERED.NORMAL-SERVICE state.
Description Implements the EPS Mobility Management procedures executed
when the EMM-SAP is in EMM-DEREGISTERED.NORMAL-SERVICE state.
In EMM-DEREGISTERED.NORMAL-SERVICE state, the EPS update
status is EU1 or EU2, in the meantime a suitable cell has
been found and the PLMN or tracking area is not in the
forbidden list.
In EMM-DEREGISTERED.NORMAL-SERVICE state, the EPS update
status is EU1 or EU2, in the meantime a suitable cell has
been found and the PLMN or tracking area is not in the
forbidden list.
*****************************************************************************/
@@ -49,24 +49,24 @@ Description Implements the EPS Mobility Management procedures executed
/****************************************************************************
** **
** Name: EmmDeregisteredNormalService() **
** Name: EmmDeregisteredNormalService() **
** **
** Description: Handles the behaviour of the UE while the EMM-SAP is in **
** EMM-DEREGISTERED.NORMAL-SERVICE state. **
** EMM-DEREGISTERED.NORMAL-SERVICE state. **
** **
** 3GPP TS 24.301, section 5.2.2.3.1 **
** The UE shall initiate an attach or combined attach proce- **
** dure. **
** The UE shall initiate an attach or combined attach proce- **
** dure. **
** **
** Inputs: evt: The received EMM-SAP event **
** Others: emm_fsm_status **
** Inputs: evt: The received EMM-SAP event **
** Others: emm_fsm_status **
** **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: emm_fsm_status **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: emm_fsm_status **
** **
***************************************************************************/
int EmmDeregisteredNormalService(const emm_reg_t* evt)
int EmmDeregisteredNormalService(const emm_reg_t *evt)
{
LOG_FUNC_IN;
@@ -74,56 +74,55 @@ int EmmDeregisteredNormalService(const emm_reg_t* evt)
assert(emm_fsm_get_status() == 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);
if (rc != RETURNerror) {
/* Process the network registration request */
rc = emm_fsm_process(evt);
}
break;
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);
if (rc != RETURNerror) {
/* Process the network registration request */
rc = emm_fsm_process(evt);
}
break;
case _EMMREG_ATTACH_INIT:
/*
* Initiate the attach procedure for EPS services
*/
rc = emm_proc_attach(EMM_ATTACH_TYPE_EPS);
break;
case _EMMREG_ATTACH_INIT:
/*
* Initiate the attach procedure for EPS services
*/
rc = emm_proc_attach(EMM_ATTACH_TYPE_EPS);
break;
case _EMMREG_ATTACH_REQ:
/*
* An EPS network attach has been requested (Attach Request
* message successfully delivered to the network);
* enter state EMM-REGISTERED-INITIATED
*/
rc = emm_fsm_set_status(EMM_REGISTERED_INITIATED);
break;
case _EMMREG_ATTACH_REQ:
/*
* An EPS network attach has been requested (Attach Request
* message successfully delivered to the network);
* enter state EMM-REGISTERED-INITIATED
*/
rc = emm_fsm_set_status(EMM_REGISTERED_INITIATED);
break;
case _EMMREG_LOWERLAYER_SUCCESS:
/*
* Initial NAS message has been successfully delivered
* to the network
*/
rc = emm_proc_lowerlayer_success();
break;
case _EMMREG_LOWERLAYER_SUCCESS:
/*
* Initial NAS message has been successfully delivered
* to the network
*/
rc = emm_proc_lowerlayer_success();
break;
case _EMMREG_LOWERLAYER_FAILURE:
/*
* Initial NAS message failed to be delivered to the network
*/
rc = emm_proc_lowerlayer_failure(TRUE);
break;
case _EMMREG_LOWERLAYER_FAILURE:
/*
* Initial NAS message failed to be delivered to the network
*/
rc = emm_proc_lowerlayer_failure(TRUE);
break;
case _EMMREG_LOWERLAYER_RELEASE:
/*
* NAS signalling connection has been released
*/
rc = emm_proc_lowerlayer_release();
break;
case _EMMREG_LOWERLAYER_RELEASE:
/*
* NAS signalling connection has been released
*/
rc = emm_proc_lowerlayer_release();
break;
case _EMMREG_ATTACH_CNF:
/*
@@ -134,10 +133,10 @@ int EmmDeregisteredNormalService(const emm_reg_t* evt)
rc = emm_fsm_set_status(EMM_REGISTERED);
break;
default:
LOG_TRACE(ERROR, "EMM-FSM - Primitive is not valid (%d)",
evt->primitive);
break;
default:
LOG_TRACE(ERROR, "EMM-FSM - Primitive is not valid (%d)",
evt->primitive);
break;
}
LOG_FUNC_RETURN (rc);
@@ -1,24 +1,24 @@
/*****************************************************************************
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Source EmmDeregisteredPlmnSearch.c
Source EmmDeregisteredPlmnSearch.c
Version 0.1
Version 0.1
Date 2012/10/03
Date 2012/10/03
Product NAS stack
Product NAS stack
Subsystem EPS Mobility Management
Subsystem EPS Mobility Management
Author Frederic Maurel
Author Frederic Maurel
Description Implements the EPS Mobility Management procedures executed
when the EMM-SAP is in EMM-DEREGISTERED.PLMN-SEARCH state.
Description Implements the EPS Mobility Management procedures executed
when the EMM-SAP is in EMM-DEREGISTERED.PLMN-SEARCH state.
In EMM-DEREGISTERED.PLMN-SEARCH state, the UE with a valid
USIM is switched on.
In EMM-DEREGISTERED.PLMN-SEARCH state, the UE with a valid
USIM is switched on.
*****************************************************************************/
@@ -47,25 +47,25 @@ Description Implements the EPS Mobility Management procedures executed
/****************************************************************************
** **
** Name: EmmDeregisteredPlmnSearch() **
** Name: EmmDeregisteredPlmnSearch() **
** **
** Description: Handles the behaviour of the UE while the EMM-SAP is in **
** EMM-DEREGISTERED.PLMN-SEARCH state. **
** EMM-DEREGISTERED.PLMN-SEARCH state. **
** **
** 3GPP TS 24.301, section 5.2.2.3.4 **
** The UE shall perform PLMN selection. If a new PLMN is **
** selected, the UE shall reset the attach attempt counter **
** and initiate the attach or combined attach procedure. **
** The UE shall perform PLMN selection. If a new PLMN is **
** selected, the UE shall reset the attach attempt counter **
** and initiate the attach or combined attach procedure. **
** **
** Inputs: evt: The received EMM-SAP event **
** Others: emm_fsm_status **
** Inputs: evt: The received EMM-SAP event **
** Others: emm_fsm_status **
** **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: emm_fsm_status **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: emm_fsm_status **
** **
***************************************************************************/
int EmmDeregisteredPlmnSearch(const emm_reg_t* evt)
int EmmDeregisteredPlmnSearch(const emm_reg_t *evt)
{
LOG_FUNC_IN;
@@ -73,57 +73,56 @@ int EmmDeregisteredPlmnSearch(const emm_reg_t* evt)
assert(emm_fsm_get_status() == EMM_DEREGISTERED_PLMN_SEARCH);
switch (evt->primitive)
{
case _EMMREG_NO_CELL:
/*
* No suitable cell of the selected PLMN has been found to camp on
*/
rc = emm_proc_registration_notify(NET_REG_STATE_DENIED);
if (rc != RETURNok) {
LOG_TRACE(WARNING, "EMM-FSM - "
"Failed to notify registration update");
}
rc = emm_fsm_set_status(EMM_DEREGISTERED_NO_CELL_AVAILABLE);
break;
switch (evt->primitive) {
case _EMMREG_NO_CELL:
/*
* No suitable cell of the selected PLMN has been found to camp on
*/
rc = emm_proc_registration_notify(NET_REG_STATE_DENIED);
if (rc != RETURNok) {
LOG_TRACE(WARNING, "EMM-FSM - "
"Failed to notify registration update");
}
rc = emm_fsm_set_status(EMM_DEREGISTERED_NO_CELL_AVAILABLE);
break;
case _EMMREG_REGISTER_REQ:
/*
* The UE has been switched on and is currently searching an
* operator to register to. The particular PLMN to be contacted
* may be selected either automatically or manually.
* Or the user manually re-selected a PLMN to register to.
*/
rc = emm_proc_registration_notify(NET_REG_STATE_ON);
if (rc != RETURNok) {
LOG_TRACE(WARNING, "EMM-FSM - "
"Failed to notify registration update");
}
/*
* Perform network selection procedure
*/
rc = emm_proc_plmn_selection(evt->u.regist.index);
break;
case _EMMREG_REGISTER_REQ:
/*
* The UE has been switched on and is currently searching an
* operator to register to. The particular PLMN to be contacted
* may be selected either automatically or manually.
* Or the user manually re-selected a PLMN to register to.
*/
rc = emm_proc_registration_notify(NET_REG_STATE_ON);
if (rc != RETURNok) {
LOG_TRACE(WARNING, "EMM-FSM - "
"Failed to notify registration update");
}
/*
* Perform network selection procedure
*/
rc = emm_proc_plmn_selection(evt->u.regist.index);
break;
case _EMMREG_REGISTER_REJ:
/*
* The selected cell is known not to be able to provide normal
* service
*/
rc = emm_fsm_set_status(EMM_DEREGISTERED_LIMITED_SERVICE);
break;
case _EMMREG_REGISTER_REJ:
/*
* The selected cell is known not to be able to provide normal
* service
*/
rc = emm_fsm_set_status(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);
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);
break;
default:
LOG_TRACE(ERROR, "EMM-FSM - Primitive is not valid (%d)",
evt->primitive);
break;
default:
LOG_TRACE(ERROR, "EMM-FSM - Primitive is not valid (%d)",
evt->primitive);
break;
}
LOG_FUNC_RETURN (rc);
@@ -1,24 +1,24 @@
/*****************************************************************************
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Source EmmNull.c
Source EmmNull.c
Version 0.1
Version 0.1
Date 2012/10/03
Date 2012/10/03
Product NAS stack
Product NAS stack
Subsystem EPS Mobility Management
Subsystem EPS Mobility Management
Author Frederic Maurel
Author Frederic Maurel
Description Implements the EPS Mobility Management procedures executed
when the EMM-SAP is in EMM-NULL state.
Description Implements the EPS Mobility Management procedures executed
when the EMM-SAP is in EMM-NULL state.
In EMM-NULL state, the EPS capability is disabled in the UE.
No EPS mobility management function shall be performed.
In EMM-NULL state, the EPS capability is disabled in the UE.
No EPS mobility management function shall be performed.
*****************************************************************************/
@@ -46,20 +46,20 @@ Description Implements the EPS Mobility Management procedures executed
/****************************************************************************
** **
** Name: EmmNull() **
** Name: EmmNull() **
** **
** Description: Handles the behaviour of the UE while the EMM-SAP is in **
** EMM-NULL state. **
** EMM-NULL state. **
** **
** Inputs: evt: The received EMM-SAP event **
** Others: emm_fsm_status **
** Inputs: evt: The received EMM-SAP event **
** Others: emm_fsm_status **
** **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: emm_fsm_status **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: emm_fsm_status **
** **
***************************************************************************/
int EmmNull(const emm_reg_t* evt)
int EmmNull(const emm_reg_t *evt)
{
LOG_FUNC_IN;
@@ -70,34 +70,33 @@ int EmmNull(const emm_reg_t* evt)
/* Delete the authentication data RAND and RES */
rc = emm_proc_authentication_delete();
if (rc != RETURNok) {
LOG_FUNC_RETURN (rc);
LOG_FUNC_RETURN (rc);
}
switch (evt->primitive)
{
case _EMMREG_S1_ENABLED:
/*
* The EPS capability has been enabled in the UE:
* Move to the DEREGISTERED state;
*/
rc = emm_fsm_set_status(EMM_DEREGISTERED);
switch (evt->primitive) {
case _EMMREG_S1_ENABLED:
/*
* The EPS capability has been enabled in the UE:
* Move to the DEREGISTERED state;
*/
rc = emm_fsm_set_status(EMM_DEREGISTERED);
/*
* And initialize the EMM procedure call manager in order to
* establish an EMM context and make the UE reachable by an MME.
*/
if (rc != RETURNerror) {
rc = emm_proc_initialize();
}
break;
/*
* And initialize the EMM procedure call manager in order to
* establish an EMM context and make the UE reachable by an MME.
*/
if (rc != RETURNerror) {
rc = emm_proc_initialize();
}
break;
default:
rc = RETURNerror;
LOG_TRACE(ERROR, "EMM-FSM - Primitive is not valid (%d)",
evt->primitive);
LOG_TRACE(WARNING, "EMM-FSM - Set phone functionnality to "
"enable EPS capability (+cfun=1)");
break;
default:
rc = RETURNerror;
LOG_TRACE(ERROR, "EMM-FSM - Primitive is not valid (%d)",
evt->primitive);
LOG_TRACE(WARNING, "EMM-FSM - Set phone functionnality to "
"enable EPS capability (+cfun=1)");
break;
}
LOG_FUNC_RETURN (rc);
@@ -1,29 +1,29 @@
/*****************************************************************************
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Source EmmRegistered.c
Source EmmRegistered.c
Version 0.1
Version 0.1
Date 2012/10/03
Date 2012/10/03
Product NAS stack
Product NAS stack
Subsystem EPS Mobility Management
Subsystem EPS Mobility Management
Author Frederic Maurel
Author Frederic Maurel
Description Implements the EPS Mobility Management procedures executed
when the EMM-SAP is in EMM-REGISTERED state.
Description Implements the EPS Mobility Management procedures executed
when the EMM-SAP is in EMM-REGISTERED state.
In EMM-REGISTERED state, an EMM context has been established
and a default EPS bearer context has been activated in the UE
and the MME.
The UE may initiate sending and receiving user data and signal-
ling information and reply to paging. Additionally, tracking
area updating or combined tracking area updating procedure is
performed.
In EMM-REGISTERED state, an EMM context has been established
and a default EPS bearer context has been activated in the UE
and the MME.
The UE may initiate sending and receiving user data and signal-
ling information and reply to paging. Additionally, tracking
area updating or combined tracking area updating procedure is
performed.
*****************************************************************************/
@@ -50,20 +50,20 @@ Description Implements the EPS Mobility Management procedures executed
/****************************************************************************
** **
** Name: EmmRegistered() **
** Name: EmmRegistered() **
** **
** Description: Handles the behaviour of the UE and the MME while the **
** EMM-SAP is in EMM-REGISTERED state. **
** EMM-SAP is in EMM-REGISTERED state. **
** **
** Inputs: evt: The received EMM-SAP event **
** Others: emm_fsm_status **
** Inputs: evt: The received EMM-SAP event **
** Others: emm_fsm_status **
** **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: emm_fsm_status **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: emm_fsm_status **
** **
***************************************************************************/
int EmmRegistered(const emm_reg_t* evt)
int EmmRegistered(const emm_reg_t *evt)
{
LOG_FUNC_IN;
@@ -76,115 +76,114 @@ int EmmRegistered(const emm_reg_t* evt)
assert(emm_fsm_get_status(evt->ueid, evt->ctx) == EMM_REGISTERED);
#endif
switch (evt->primitive)
{
switch (evt->primitive) {
#ifdef NAS_UE
case _EMMREG_DETACH_INIT:
/*
* Initiate detach procedure for EPS services
*/
rc = emm_proc_detach(EMM_DETACH_TYPE_EPS, evt->u.detach.switch_off);
break;
case _EMMREG_DETACH_INIT:
/*
* Initiate detach procedure for EPS services
*/
rc = emm_proc_detach(EMM_DETACH_TYPE_EPS, evt->u.detach.switch_off);
break;
case _EMMREG_DETACH_REQ:
/*
* Network detach has been requested (Detach Request
* message successfully delivered to the network);
* enter state EMM-DEREGISTERED-INITIATED
*/
rc = emm_fsm_set_status(EMM_DEREGISTERED_INITIATED);
break;
case _EMMREG_DETACH_REQ:
/*
* Network detach has been requested (Detach Request
* message successfully delivered to the network);
* enter state EMM-DEREGISTERED-INITIATED
*/
rc = emm_fsm_set_status(EMM_DEREGISTERED_INITIATED);
break;
case _EMMREG_DETACH_CNF:
/*
* The UE implicitly detached from the network (all EPS
* bearer contexts may have been deactivated)
*/
rc = emm_fsm_set_status(EMM_DEREGISTERED);
break;
case _EMMREG_DETACH_CNF:
/*
* The UE implicitly detached from the network (all EPS
* bearer contexts may have been deactivated)
*/
rc = emm_fsm_set_status(EMM_DEREGISTERED);
break;
case _EMMREG_TAU_REQ:
/*
* TODO: Tracking Area Update has been requested
*/
LOG_TRACE(ERROR, "EMM-FSM - Tracking Area Update procedure "
"is not implemented");
break;
case _EMMREG_TAU_REQ:
/*
* TODO: Tracking Area Update has been requested
*/
LOG_TRACE(ERROR, "EMM-FSM - Tracking Area Update procedure "
"is not implemented");
break;
case _EMMREG_SERVICE_REQ:
/*
* TODO: Service Request has been requested
*/
LOG_TRACE(ERROR, "EMM-FSM - Service Request procedure "
"is not implemented");
break;
case _EMMREG_SERVICE_REQ:
/*
* TODO: Service Request has been requested
*/
LOG_TRACE(ERROR, "EMM-FSM - Service Request procedure "
"is not implemented");
break;
case _EMMREG_LOWERLAYER_SUCCESS:
/*
* Data transfer message has been successfully delivered
*/
rc = emm_proc_lowerlayer_success();
break;
case _EMMREG_LOWERLAYER_SUCCESS:
/*
* Data transfer message has been successfully delivered
*/
rc = emm_proc_lowerlayer_success();
break;
case _EMMREG_LOWERLAYER_FAILURE:
/*
* Data transfer message failed to be delivered
*/
rc = emm_proc_lowerlayer_failure(FALSE);
break;
case _EMMREG_LOWERLAYER_FAILURE:
/*
* Data transfer message failed to be delivered
*/
rc = emm_proc_lowerlayer_failure(FALSE);
break;
case _EMMREG_LOWERLAYER_RELEASE:
/*
* NAS signalling connection has been released
*/
rc = emm_proc_lowerlayer_release();
break;
case _EMMREG_LOWERLAYER_RELEASE:
/*
* NAS signalling connection has been released
*/
rc = emm_proc_lowerlayer_release();
break;
#endif
#ifdef NAS_MME
case _EMMREG_DETACH_REQ:
/*
* Network detach has been requested (implicit detach);
* enter state EMM-DEREGISTERED
*/
case _EMMREG_DETACH_REQ:
/*
* Network detach has been requested (implicit detach);
* enter state EMM-DEREGISTERED
*/
rc = emm_fsm_set_status(evt->ueid, evt->ctx, EMM_DEREGISTERED);
break;
break;
case _EMMREG_COMMON_PROC_REQ:
/*
* An EMM common procedure has been initiated;
* enter state EMM-COMMON-PROCEDURE-INITIATED.
*/
case _EMMREG_COMMON_PROC_REQ:
/*
* An EMM common procedure has been initiated;
* enter state EMM-COMMON-PROCEDURE-INITIATED.
*/
rc = emm_fsm_set_status(evt->ueid, evt->ctx, EMM_COMMON_PROCEDURE_INITIATED);
break;
break;
case _EMMREG_TAU_REJ:
/*
* TODO: Tracking Area Update has been rejected
*/
LOG_TRACE(ERROR, "EMM-FSM - Tracking Area Update procedure "
"is not implemented");
break;
case _EMMREG_TAU_REJ:
/*
* TODO: Tracking Area Update has been rejected
*/
LOG_TRACE(ERROR, "EMM-FSM - Tracking Area Update procedure "
"is not implemented");
break;
case _EMMREG_LOWERLAYER_SUCCESS:
/*
* Data successfully delivered to the network
*/
rc = RETURNok;
break;
case _EMMREG_LOWERLAYER_SUCCESS:
/*
* Data successfully delivered to the network
*/
rc = RETURNok;
break;
case _EMMREG_LOWERLAYER_FAILURE:
/*
* Data failed to be delivered to the network
*/
rc = RETURNok;
break;
case _EMMREG_LOWERLAYER_FAILURE:
/*
* Data failed to be delivered to the network
*/
rc = RETURNok;
break;
#endif
default:
LOG_TRACE(ERROR, "EMM-FSM - Primitive is not valid (%d)",
evt->primitive);
break;
default:
LOG_TRACE(ERROR, "EMM-FSM - Primitive is not valid (%d)",
evt->primitive);
break;
}
LOG_FUNC_RETURN (rc);
@@ -1,29 +1,29 @@
/*****************************************************************************
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Source EmmRegisteredAttemptingToUpdate.c
Source EmmRegisteredAttemptingToUpdate.c
Version 0.1
Version 0.1
Date 2012/10/03
Date 2012/10/03
Product NAS stack
Product NAS stack
Subsystem EPS Mobility Management
Subsystem EPS Mobility Management
Author Frederic Maurel
Author Frederic Maurel
Description Implements the EPS Mobility Management procedures executed
when the EMM-SAP is in EMM-REGISTERED.ATTEMPTING-TO-UPDATE
state.
Description Implements the EPS Mobility Management procedures executed
when the EMM-SAP is in EMM-REGISTERED.ATTEMPTING-TO-UPDATE
state.
In EMM-REGISTERED.ATTEMPTING-TO-UPDATE state, the tracking
area updating or combined tracking area updating procedure
failed due to a missing response from the network.
No EMM procedure except the tracking area updating or com-
bined tracking area updating procedure shall be initiated
by the UE in this substate. No data shall be sent or received.
In EMM-REGISTERED.ATTEMPTING-TO-UPDATE state, the tracking
area updating or combined tracking area updating procedure
failed due to a missing response from the network.
No EMM procedure except the tracking area updating or com-
bined tracking area updating procedure shall be initiated
by the UE in this substate. No data shall be sent or received.
*****************************************************************************/
@@ -49,20 +49,20 @@ Description Implements the EPS Mobility Management procedures executed
/****************************************************************************
** **
** Name: EmmRegisteredAttemptingToUpdate() **
** Name: EmmRegisteredAttemptingToUpdate() **
** **
** Description: Handles the behaviour of the UE while the EMM-SAP is in **
** EMM-REGISTERED.ATTEMPTING-TO-UPDATE state. **
** EMM-REGISTERED.ATTEMPTING-TO-UPDATE state. **
** **
** Inputs: evt: The received EMM-SAP event **
** Others: emm_fsm_status **
** Inputs: evt: The received EMM-SAP event **
** Others: emm_fsm_status **
** **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: emm_fsm_status **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: emm_fsm_status **
** **
***************************************************************************/
int EmmRegisteredAttemptingToUpdate(const emm_reg_t* evt)
int EmmRegisteredAttemptingToUpdate(const emm_reg_t *evt)
{
LOG_FUNC_IN;
@@ -1,28 +1,28 @@
/*****************************************************************************
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Source EmmRegisteredImsiDetachInitiated.c
Source EmmRegisteredImsiDetachInitiated.c
Version 0.1
Version 0.1
Date 2012/10/03
Date 2012/10/03
Product NAS stack
Product NAS stack
Subsystem EPS Mobility Management
Subsystem EPS Mobility Management
Author Frederic Maurel
Author Frederic Maurel
Description Implements the EPS Mobility Management procedures executed
when the EMM-SAP is in EMM-REGISTERED.IMSI-DETACH-INITIATED
state.
Description Implements the EPS Mobility Management procedures executed
when the EMM-SAP is in EMM-REGISTERED.IMSI-DETACH-INITIATED
state.
In EMM-REGISTERED.IMSI-DETACH-INITIATED state, the UE performs
a combined detach procedure for non-EPS services only.
The UE was attached for EPS and non-EPS services and wants to
detach for non-EPS services only. User data and signalling
information may be sent and received.
In EMM-REGISTERED.IMSI-DETACH-INITIATED state, the UE performs
a combined detach procedure for non-EPS services only.
The UE was attached for EPS and non-EPS services and wants to
detach for non-EPS services only. User data and signalling
information may be sent and received.
*****************************************************************************/
@@ -48,20 +48,20 @@ Description Implements the EPS Mobility Management procedures executed
/****************************************************************************
** **
** Name: EmmRegisteredImsiDetachInitiated() **
** Name: EmmRegisteredImsiDetachInitiated() **
** **
** Description: Handles the behaviour of the UE while the EMM-SAP is in **
** EMM-REGISTERED.IMSI-DETACH-INITIATED state. **
** EMM-REGISTERED.IMSI-DETACH-INITIATED state. **
** **
** Inputs: evt: The received EMM-SAP event **
** Others: emm_fsm_status **
** Inputs: evt: The received EMM-SAP event **
** Others: emm_fsm_status **
** **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: emm_fsm_status **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: emm_fsm_status **
** **
***************************************************************************/
int EmmRegisteredImsiDetachInitiated(const emm_reg_t* evt)
int EmmRegisteredImsiDetachInitiated(const emm_reg_t *evt)
{
LOG_FUNC_IN;
@@ -1,25 +1,25 @@
/*****************************************************************************
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Source EmmRegisteredInitiated.c
Source EmmRegisteredInitiated.c
Version 0.1
Version 0.1
Date 2012/10/03
Date 2012/10/03
Product NAS stack
Product NAS stack
Subsystem EPS Mobility Management
Subsystem EPS Mobility Management
Author Frederic Maurel
Author Frederic Maurel
Description Implements the EPS Mobility Management procedures executed
when the EMM-SAP is in EMM-REGISTERED-INITIATED state.
Description Implements the EPS Mobility Management procedures executed
when the EMM-SAP is in EMM-REGISTERED-INITIATED state.
In EMM-REGISTERED-INITIATED state, the attach or the combined
attach procedure has been started and the UE is waiting for a
response from the MME.
In EMM-REGISTERED-INITIATED state, the attach or the combined
attach procedure has been started and the UE is waiting for a
response from the MME.
*****************************************************************************/
@@ -48,20 +48,20 @@ Description Implements the EPS Mobility Management procedures executed
/****************************************************************************
** **
** Name: EmmRegisteredInitiated() **
** Name: EmmRegisteredInitiated() **
** **
** Description: Handles the behaviour of the UE while the EMM-SAP is in **
** EMM-REGISTERED-INITIATED state. **
** EMM-REGISTERED-INITIATED state. **
** **
** Inputs: evt: The received EMM-SAP event **
** Others: emm_fsm_status **
** Inputs: evt: The received EMM-SAP event **
** Others: emm_fsm_status **
** **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: emm_fsm_status **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: emm_fsm_status **
** **
***************************************************************************/
int EmmRegisteredInitiated(const emm_reg_t* evt)
int EmmRegisteredInitiated(const emm_reg_t *evt)
{
LOG_FUNC_IN;
@@ -69,165 +69,164 @@ int EmmRegisteredInitiated(const emm_reg_t* evt)
assert(emm_fsm_get_status() == EMM_REGISTERED_INITIATED);
switch (evt->primitive)
{
case _EMMREG_ATTACH_INIT:
/*
* Attach procedure has to be restarted (timers T3402 or T3411
* expired)
*/
switch (evt->primitive) {
case _EMMREG_ATTACH_INIT:
/*
* Attach procedure has to be restarted (timers T3402 or T3411
* expired)
*/
/* Move to the corresponding initial EMM state */
if (evt->u.attach.is_emergency) {
rc = emm_fsm_set_status(EMM_DEREGISTERED_LIMITED_SERVICE);
} else {
rc = emm_fsm_set_status(EMM_DEREGISTERED_NORMAL_SERVICE);
}
if (rc != RETURNerror) {
/* Restart the attach procedure */
rc = emm_proc_attach_restart();
}
break;
/* Move to the corresponding initial EMM state */
if (evt->u.attach.is_emergency) {
rc = emm_fsm_set_status(EMM_DEREGISTERED_LIMITED_SERVICE);
} else {
rc = emm_fsm_set_status(EMM_DEREGISTERED_NORMAL_SERVICE);
}
if (rc != RETURNerror) {
/* Restart the attach procedure */
rc = emm_proc_attach_restart();
}
break;
case _EMMREG_ATTACH_FAILED:
/*
* Attempt to attach to the network failed (abnormal case or
* timer T3410 expired). The network attach procedure shall be
* restarted when timer T3411 expires.
*/
rc = emm_fsm_set_status(EMM_DEREGISTERED_ATTEMPTING_TO_ATTACH);
break;
case _EMMREG_ATTACH_FAILED:
/*
* Attempt to attach to the network failed (abnormal case or
* timer T3410 expired). The network attach procedure shall be
* restarted when timer T3411 expires.
*/
rc = emm_fsm_set_status(EMM_DEREGISTERED_ATTEMPTING_TO_ATTACH);
break;
case _EMMREG_ATTACH_EXCEEDED:
/*
* Attempt to attach to the network failed (abnormal case or
* timer T3410 expired) and the attach attempt counter reached
* its maximum value. The state is changed to EMM-DEREGISTERED.
* ATTEMPTING-TO-ATTACH or optionally to EMM-DEREGISTERED.PLMN-
* 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);
break;
case _EMMREG_ATTACH_EXCEEDED:
/*
* Attempt to attach to the network failed (abnormal case or
* timer T3410 expired) and the attach attempt counter reached
* its maximum value. The state is changed to EMM-DEREGISTERED.
* ATTEMPTING-TO-ATTACH or optionally to EMM-DEREGISTERED.PLMN-
* 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);
break;
case _EMMREG_ATTACH_CNF:
/*
* EPS network attach accepted by the network;
* enter state EMM-REGISTERED.
*/
rc = emm_fsm_set_status(EMM_REGISTERED);
case _EMMREG_ATTACH_CNF:
/*
* EPS network attach accepted by the network;
* enter state EMM-REGISTERED.
*/
rc = emm_fsm_set_status(EMM_REGISTERED);
if (rc != RETURNerror) {
/*
* Notify EMM that the MT is registered
*/
rc = emm_proc_registration_notify(NET_REG_STATE_HN);
if (rc != RETURNok) {
LOG_TRACE(WARNING, "EMM-FSM - "
"Failed to notify registration update");
}
}
break;
if (rc != RETURNerror) {
/*
* Notify EMM that the MT is registered
*/
rc = emm_proc_registration_notify(NET_REG_STATE_HN);
if (rc != RETURNok) {
LOG_TRACE(WARNING, "EMM-FSM - "
"Failed to notify registration update");
}
}
break;
case _EMMREG_AUTH_REJ:
/*
* UE authentication rejected by the network;
* abort any EMM signalling procedure
*/
case _EMMREG_ATTACH_REJ:
/*
* EPS network attach rejected by the network;
* enter state EMM-DEREGISTERED.
*/
rc = emm_fsm_set_status(EMM_DEREGISTERED);
case _EMMREG_AUTH_REJ:
/*
* UE authentication rejected by the network;
* abort any EMM signalling procedure
*/
case _EMMREG_ATTACH_REJ:
/*
* EPS network attach rejected by the network;
* enter state EMM-DEREGISTERED.
*/
rc = emm_fsm_set_status(EMM_DEREGISTERED);
if (rc != RETURNerror) {
/*
* Notify EMM that the MT's registration is denied
*/
rc = emm_proc_registration_notify(NET_REG_STATE_DENIED);
if (rc != RETURNok) {
LOG_TRACE(WARNING, "EMM-FSM - "
"Failed to notify registration update");
}
}
break;
if (rc != RETURNerror) {
/*
* Notify EMM that the MT's registration is denied
*/
rc = emm_proc_registration_notify(NET_REG_STATE_DENIED);
if (rc != RETURNok) {
LOG_TRACE(WARNING, "EMM-FSM - "
"Failed to notify registration update");
}
}
break;
case _EMMREG_REGISTER_REQ:
/*
* The UE has to select a new PLMN to register to
*/
rc = emm_fsm_set_status(EMM_DEREGISTERED_PLMN_SEARCH);
if (rc != RETURNerror) {
/* Process the network registration request */
rc = emm_fsm_process(evt);
}
break;
case _EMMREG_REGISTER_REQ:
/*
* The UE has to select a new PLMN to register to
*/
rc = emm_fsm_set_status(EMM_DEREGISTERED_PLMN_SEARCH);
if (rc != RETURNerror) {
/* Process the network registration request */
rc = emm_fsm_process(evt);
}
break;
case _EMMREG_REGISTER_REJ:
/*
* The UE failed to register to the network for normal EPS service
*/
rc = emm_fsm_set_status(EMM_DEREGISTERED_LIMITED_SERVICE);
break;
case _EMMREG_REGISTER_REJ:
/*
* The UE failed to register to the network for normal EPS service
*/
rc = emm_fsm_set_status(EMM_DEREGISTERED_LIMITED_SERVICE);
break;
case _EMMREG_NO_IMSI:
/*
* The UE failed to register to the network for emergency
* bearer services
*/
rc = emm_fsm_set_status(EMM_DEREGISTERED_NO_IMSI);
break;
case _EMMREG_NO_IMSI:
/*
* The UE failed to register to the network for emergency
* bearer services
*/
rc = emm_fsm_set_status(EMM_DEREGISTERED_NO_IMSI);
break;
case _EMMREG_DETACH_INIT:
/*
* Initiate detach procedure for EPS services
*/
rc = emm_proc_detach(EMM_DETACH_TYPE_EPS, evt->u.detach.switch_off);
break;
case _EMMREG_DETACH_INIT:
/*
* Initiate detach procedure for EPS services
*/
rc = emm_proc_detach(EMM_DETACH_TYPE_EPS, evt->u.detach.switch_off);
break;
case _EMMREG_DETACH_REQ:
/*
* An EPS network detach has been requested (Detach Request
* message successfully delivered to the network);
* enter state EMM-DEREGISTERED-INITIATED
*/
rc = emm_fsm_set_status(EMM_DEREGISTERED_INITIATED);
break;
case _EMMREG_DETACH_REQ:
/*
* An EPS network detach has been requested (Detach Request
* message successfully delivered to the network);
* enter state EMM-DEREGISTERED-INITIATED
*/
rc = emm_fsm_set_status(EMM_DEREGISTERED_INITIATED);
break;
case _EMMREG_LOWERLAYER_SUCCESS:
/*
* Data transfer message has been successfully delivered;
* The NAS message may be Attach Complete, Detach Request or
* any message transfered by EMM common procedures requested
* by the network.
*/
rc = emm_proc_lowerlayer_success();
break;
case _EMMREG_LOWERLAYER_SUCCESS:
/*
* Data transfer message has been successfully delivered;
* The NAS message may be Attach Complete, Detach Request or
* any message transfered by EMM common procedures requested
* by the network.
*/
rc = emm_proc_lowerlayer_success();
break;
case _EMMREG_LOWERLAYER_FAILURE:
/*
* Data transfer message failed to be delivered;
* The NAS message may be Attach Complete, Detach Request or
* any message transfered by EMM common procedures requested
* by the network.
*/
rc = emm_proc_lowerlayer_failure(FALSE);
break;
case _EMMREG_LOWERLAYER_FAILURE:
/*
* Data transfer message failed to be delivered;
* The NAS message may be Attach Complete, Detach Request or
* any message transfered by EMM common procedures requested
* by the network.
*/
rc = emm_proc_lowerlayer_failure(FALSE);
break;
case _EMMREG_LOWERLAYER_RELEASE:
/*
* NAS signalling connection has been released before the Attach
* Accept, Attach Reject, or any message transfered by EMM common
* procedures requested by the network, is received.
*/
rc = emm_proc_lowerlayer_release();
break;
case _EMMREG_LOWERLAYER_RELEASE:
/*
* NAS signalling connection has been released before the Attach
* Accept, Attach Reject, or any message transfered by EMM common
* procedures requested by the network, is received.
*/
rc = emm_proc_lowerlayer_release();
break;
default:
LOG_TRACE(ERROR, "EMM-FSM - Primitive is not valid (%d)",
evt->primitive);
break;
default:
LOG_TRACE(ERROR, "EMM-FSM - Primitive is not valid (%d)",
evt->primitive);
break;
}
LOG_FUNC_RETURN (rc);
@@ -1,24 +1,24 @@
/*****************************************************************************
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Source EmmRegisteredLimitedService.c
Source EmmRegisteredLimitedService.c
Version 0.1
Version 0.1
Date 2012/10/03
Date 2012/10/03
Product NAS stack
Product NAS stack
Subsystem EPS Mobility Management
Subsystem EPS Mobility Management
Author Frederic Maurel
Author Frederic Maurel
Description Implements the EPS Mobility Management procedures executed
when the EMM-SAP is in EMM-REGISTERED.LIMITED-SERVICE state.
Description Implements the EPS Mobility Management procedures executed
when the EMM-SAP is in EMM-REGISTERED.LIMITED-SERVICE state.
In EMM-REGISTERED.LIMITED-SERVICE state, the cell the UE
selected is known not to be able to provide normal service.
In EMM-REGISTERED.LIMITED-SERVICE state, the cell the UE
selected is known not to be able to provide normal service.
*****************************************************************************/
@@ -44,20 +44,20 @@ Description Implements the EPS Mobility Management procedures executed
/****************************************************************************
** **
** Name: EmmRegisteredLimitedService() **
** Name: EmmRegisteredLimitedService() **
** **
** Description: Handles the behaviour of the UE while the EMM-SAP is in **
** EMM-REGISTERED.LIMITED-SERVICE state. **
** EMM-REGISTERED.LIMITED-SERVICE state. **
** **
** Inputs: evt: The received EMM-SAP event **
** Others: emm_fsm_status **
** Inputs: evt: The received EMM-SAP event **
** Others: emm_fsm_status **
** **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: emm_fsm_status **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: emm_fsm_status **
** **
***************************************************************************/
int EmmRegisteredLimitedService(const emm_reg_t* evt)
int EmmRegisteredLimitedService(const emm_reg_t *evt)
{
LOG_FUNC_IN;
@@ -1,25 +1,25 @@
/*****************************************************************************
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Source EmmRegisteredNoCellAvailable.c
Source EmmRegisteredNoCellAvailable.c
Version 0.1
Version 0.1
Date 2012/10/03
Date 2012/10/03
Product NAS stack
Product NAS stack
Subsystem EPS Mobility Management
Subsystem EPS Mobility Management
Author Frederic Maurel
Author Frederic Maurel
Description Implements the EPS Mobility Management procedures executed
when the EMM-SAP is in EMM-REGISTERED.NO-CELL-AVAILABLE state.
Description Implements the EPS Mobility Management procedures executed
when the EMM-SAP is in EMM-REGISTERED.NO-CELL-AVAILABLE state.
In EMM-REGISTERED.NO-CELL-AVAILABLE state, E-UTRAN coverage
has been lost. The UE shall not initiate any EMM procedures
except for cell and PLMN reselection.
In EMM-REGISTERED.NO-CELL-AVAILABLE state, E-UTRAN coverage
has been lost. The UE shall not initiate any EMM procedures
except for cell and PLMN reselection.
*****************************************************************************/
@@ -45,20 +45,20 @@ Description Implements the EPS Mobility Management procedures executed
/****************************************************************************
** **
** Name: EmmRegisteredNoCellAvailable() **
** Name: EmmRegisteredNoCellAvailable() **
** **
** Description: Handles the behaviour of the UE while the EMM-SAP is in **
** EMM-REGISTERED.NO-CELL-AVAILABLE state. **
** EMM-REGISTERED.NO-CELL-AVAILABLE state. **
** **
** Inputs: evt: The received EMM-SAP event **
** Others: emm_fsm_status **
** Inputs: evt: The received EMM-SAP event **
** Others: emm_fsm_status **
** **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: emm_fsm_status **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: emm_fsm_status **
** **
***************************************************************************/
int EmmRegisteredNoCellAvailable(const emm_reg_t* evt)
int EmmRegisteredNoCellAvailable(const emm_reg_t *evt)
{
LOG_FUNC_IN;
@@ -1,24 +1,24 @@
/*****************************************************************************
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Source EmmRegisteredNormalService.c
Source EmmRegisteredNormalService.c
Version 0.1
Version 0.1
Date 2012/10/03
Date 2012/10/03
Product NAS stack
Product NAS stack
Subsystem EPS Mobility Management
Subsystem EPS Mobility Management
Author Frederic Maurel
Author Frederic Maurel
Description Implements the EPS Mobility Management procedures executed
when the EMM-SAP is in EMM-REGISTERED.NORMAL-SERVICE state.
Description Implements the EPS Mobility Management procedures executed
when the EMM-SAP is in EMM-REGISTERED.NORMAL-SERVICE state.
The EMM-REGISTERED.NORMAL-SERVICE state is the primary
substate choosen when the UE enters the state EMM-REGISTERED.
The EMM-REGISTERED.NORMAL-SERVICE state is the primary
substate choosen when the UE enters the state EMM-REGISTERED.
*****************************************************************************/
@@ -44,20 +44,20 @@ Description Implements the EPS Mobility Management procedures executed
/****************************************************************************
** **
** Name: EmmRegisteredNormalService() **
** Name: EmmRegisteredNormalService() **
** **
** Description: Handles the behaviour of the UE while the EMM-SAP is in **
** EMM-REGISTERED.NORMAL-SERVICE state. **
** EMM-REGISTERED.NORMAL-SERVICE state. **
** **
** Inputs: evt: The received EMM-SAP event **
** Others: emm_fsm_status **
** Inputs: evt: The received EMM-SAP event **
** Others: emm_fsm_status **
** **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: emm_fsm_status **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: emm_fsm_status **
** **
***************************************************************************/
int EmmRegisteredNormalService(const emm_reg_t* evt)
int EmmRegisteredNormalService(const emm_reg_t *evt)
{
LOG_FUNC_IN;
@@ -1,24 +1,24 @@
/*****************************************************************************
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Source EmmRegisteredPlmnSearch.c
Source EmmRegisteredPlmnSearch.c
Version 0.1
Version 0.1
Date 2012/10/03
Date 2012/10/03
Product NAS stack
Product NAS stack
Subsystem EPS Mobility Management
Subsystem EPS Mobility Management
Author Frederic Maurel
Author Frederic Maurel
Description Implements the EPS Mobility Management procedures executed
when the EMM-SAP is in EMM-REGISTERED.PLMN-SEARCH state.
Description Implements the EPS Mobility Management procedures executed
when the EMM-SAP is in EMM-REGISTERED.PLMN-SEARCH state.
In EMM-REGISTERED.PLMN-SEARCH state, the UE is searching
for PLMNs.
In EMM-REGISTERED.PLMN-SEARCH state, the UE is searching
for PLMNs.
*****************************************************************************/
@@ -44,20 +44,20 @@ Description Implements the EPS Mobility Management procedures executed
/****************************************************************************
** **
** Name: EmmRegisteredPlmnSearch() **
** Name: EmmRegisteredPlmnSearch() **
** **
** Description: Handles the behaviour of the UE while the EMM-SAP is in **
** EMM-REGISTERED.PLMN-SEARCH state. **
** EMM-REGISTERED.PLMN-SEARCH state. **
** **
** Inputs: evt: The received EMM-SAP event **
** Others: emm_fsm_status **
** Inputs: evt: The received EMM-SAP event **
** Others: emm_fsm_status **
** **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: emm_fsm_status **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: emm_fsm_status **
** **
***************************************************************************/
int EmmRegisteredPlmnSearch(const emm_reg_t* evt)
int EmmRegisteredPlmnSearch(const emm_reg_t *evt)
{
LOG_FUNC_IN;
@@ -71,20 +71,20 @@ int EmmRegisteredPlmnSearch(const emm_reg_t* evt)
#if 0
/****************************************************************************
** **
** Name: EmmRegisteredPlmnSearch_xxx() **
** Name: EmmRegisteredPlmnSearch_xxx() **
** **
** Description: Procedure executed when xxx **
** while the EMM-SAP is in EMM-REGISTERED.PLMN-SEARCH state. **
** while the EMM-SAP is in EMM-REGISTERED.PLMN-SEARCH state. **
** **
** Inputs: evt: The received EMM-SAP event **
** Others: emm_fsm_status **
** Inputs: evt: The received EMM-SAP event **
** Others: emm_fsm_status **
** **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: emm_fsm_status **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: emm_fsm_status **
** **
***************************************************************************/
int EmmRegisteredPlmnSearch_xxx(const emm_reg_t* evt)
int EmmRegisteredPlmnSearch_xxx(const emm_reg_t *evt)
{
LOG_FUNC_IN;
@@ -1,30 +1,30 @@
/*****************************************************************************
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Source EmmRegisteredUpdateNeeded.c
Source EmmRegisteredUpdateNeeded.c
Version 0.1
Version 0.1
Date 2012/10/03
Date 2012/10/03
Product NAS stack
Product NAS stack
Subsystem EPS Mobility Management
Subsystem EPS Mobility Management
Author Frederic Maurel
Author Frederic Maurel
Description Implements the EPS Mobility Management procedures executed
when the EMM-SAP is in EMM-REGISTERED.UPDATE-NEEDED state.
Description Implements the EPS Mobility Management procedures executed
when the EMM-SAP is in EMM-REGISTERED.UPDATE-NEEDED state.
In EMM-REGISTERED.UPDATE-NEEDED state, the UE has to perform
a tracking area updating or combined tracking area updating
procedure, but access to the current cell is barred. The access
class may be blocked due to access class control, or the
network rejected the NAS signalling connection establishment.
No EMM procedure except tracking area updating or combined
tracking area updating or service request as a response to
paging shall be initiated by the UE in this substate.
In EMM-REGISTERED.UPDATE-NEEDED state, the UE has to perform
a tracking area updating or combined tracking area updating
procedure, but access to the current cell is barred. The access
class may be blocked due to access class control, or the
network rejected the NAS signalling connection establishment.
No EMM procedure except tracking area updating or combined
tracking area updating or service request as a response to
paging shall be initiated by the UE in this substate.
*****************************************************************************/
@@ -50,20 +50,20 @@ Description Implements the EPS Mobility Management procedures executed
/****************************************************************************
** **
** Name: EmmRegisteredUpdateNeeded() **
** Name: EmmRegisteredUpdateNeeded() **
** **
** Description: Handles the behaviour of the UE while the EMM-SAP is in **
** EMM-REGISTERED.UPDATE-NEEDED state. **
** EMM-REGISTERED.UPDATE-NEEDED state. **
** **
** Inputs: evt: The received EMM-SAP event **
** Others: emm_fsm_status **
** Inputs: evt: The received EMM-SAP event **
** Others: emm_fsm_status **
** **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: emm_fsm_status **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: emm_fsm_status **
** **
***************************************************************************/
int EmmRegisteredUpdateNeeded(const emm_reg_t* evt)
int EmmRegisteredUpdateNeeded(const emm_reg_t *evt)
{
LOG_FUNC_IN;
@@ -1,26 +1,26 @@
/*****************************************************************************
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Source EmmServiceRequestInitiated.c
Source EmmServiceRequestInitiated.c
Version 0.1
Version 0.1
Date 2012/10/03
Date 2012/10/03
Product NAS stack
Product NAS stack
Subsystem EPS Mobility Management
Subsystem EPS Mobility Management
Author Frederic Maurel
Author Frederic Maurel
Description Implements the EPS Mobility Management procedures executed
when the EMM-SAP is in EMM-SERVICE-REQUEST-INITIATED
state.
Description Implements the EPS Mobility Management procedures executed
when the EMM-SAP is in EMM-SERVICE-REQUEST-INITIATED
state.
In EMM-SERVICE-REQUEST-INITIATED state, the UE has started
the service request procedure and is waiting for a response
from the MME.
In EMM-SERVICE-REQUEST-INITIATED state, the UE has started
the service request procedure and is waiting for a response
from the MME.
*****************************************************************************/
@@ -46,20 +46,20 @@ Description Implements the EPS Mobility Management procedures executed
/****************************************************************************
** **
** Name: EmmServiceRequestInitiated() **
** Name: EmmServiceRequestInitiated() **
** **
** Description: Handles the behaviour of the UE while the EMM-SAP is in **
** EMM-SERVICE-REQUEST-INITIATED state. **
** EMM-SERVICE-REQUEST-INITIATED state. **
** **
** Inputs: evt: The received EMM-SAP event **
** Others: emm_fsm_status **
** Inputs: evt: The received EMM-SAP event **
** Others: emm_fsm_status **
** **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: emm_fsm_status **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: emm_fsm_status **
** **
***************************************************************************/
int EmmServiceRequestInitiated(const emm_reg_t* evt)
int EmmServiceRequestInitiated(const emm_reg_t *evt)
{
LOG_FUNC_IN;
@@ -1,26 +1,26 @@
/*****************************************************************************
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Source EmmTrackingAreaUpdatingInitiated.c
Source EmmTrackingAreaUpdatingInitiated.c
Version 0.1
Version 0.1
Date 2012/10/03
Date 2012/10/03
Product NAS stack
Product NAS stack
Subsystem EPS Mobility Management
Subsystem EPS Mobility Management
Author Frederic Maurel
Author Frederic Maurel
Description Implements the EPS Mobility Management procedures executed
when the EMM-SAP is in EMM-TRACKING-AREA-UPDATING-INITIATED
state.
Description Implements the EPS Mobility Management procedures executed
when the EMM-SAP is in EMM-TRACKING-AREA-UPDATING-INITIATED
state.
In EMM-TRACKING-AREA-UPDATING-INITIATED state, the UE has
started the tracking area updating or combined tracking area
updating procedure and is waiting for a response from the MME.
In EMM-TRACKING-AREA-UPDATING-INITIATED state, the UE has
started the tracking area updating or combined tracking area
updating procedure and is waiting for a response from the MME.
*****************************************************************************/
@@ -46,20 +46,20 @@ Description Implements the EPS Mobility Management procedures executed
/****************************************************************************
** **
** Name: EmmTrackingAreaUpdatingInitiated() **
** Name: EmmTrackingAreaUpdatingInitiated() **
** **
** Description: Handles the behaviour of the UE while the EMM-SAP is in **
** EMM-TRACKING-AREA-UPDATING-INITIATED state. **
** EMM-TRACKING-AREA-UPDATING-INITIATED state. **
** **
** Inputs: evt: The received EMM-SAP event **
** Others: emm_fsm_status **
** Inputs: evt: The received EMM-SAP event **
** Others: emm_fsm_status **
** **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: emm_fsm_status **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: emm_fsm_status **
** **
***************************************************************************/
int EmmTrackingAreaUpdatingInitiated(const emm_reg_t* evt)
int EmmTrackingAreaUpdatingInitiated(const emm_reg_t *evt)
{
LOG_FUNC_IN;
File diff suppressed because it is too large Load Diff
+12 -12
View File
@@ -1,22 +1,22 @@
/*****************************************************************************
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Source emm_as.h
Source emm_as.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 EMMAS Service Access Point that provides
services to the EPS Mobility Management for NAS message
transfer to/from the Access Stratum sublayer.
Description Defines the EMMAS Service Access Point that provides
services to the EPS Mobility Management for NAS message
transfer to/from the Access Stratum sublayer.
*****************************************************************************/
#ifndef __EMM_AS_H__
@@ -42,6 +42,6 @@ Description Defines the EMMAS Service Access Point that provides
void emm_as_initialize(void);
int emm_as_send(const emm_as_t* msg);
int emm_as_send(const emm_as_t *msg);
#endif /* __EMM_AS_H__*/
+117 -117
View File
@@ -1,22 +1,22 @@
/*****************************************************************************
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Source emm_asDef.h
Source emm_asDef.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 EMM primitives available at the EMMAS Service
Access Point to transfer NAS messages to/from the Access
Stratum sublayer.
Description Defines the EMM primitives available at the EMMAS Service
Access Point to transfer NAS messages to/from the Access
Stratum sublayer.
*****************************************************************************/
#ifndef __EMM_ASDEF_H__
@@ -34,34 +34,34 @@ Description Defines the EMM primitives available at the EMMAS Service
*/
typedef enum {
_EMMAS_START = 200,
_EMMAS_SECURITY_REQ, /* EMM->AS: Security request */
_EMMAS_SECURITY_IND, /* AS->EMM: Security indication */
_EMMAS_SECURITY_RES, /* EMM->AS: Security response */
_EMMAS_SECURITY_REJ, /* EMM->AS: Security reject */
_EMMAS_ESTABLISH_REQ, /* EMM->AS: Connection establish request */
_EMMAS_ESTABLISH_CNF, /* AS->EMM: Connection establish confirm */
_EMMAS_ESTABLISH_REJ, /* AS->EMM: Connection establish reject */
_EMMAS_RELEASE_REQ, /* EMM->AS: Connection release request */
_EMMAS_RELEASE_IND, /* AS->EMM: Connection release indication */
_EMMAS_DATA_REQ, /* EMM->AS: Data transfer request */
_EMMAS_DATA_IND, /* AS->EMM: Data transfer indication */
_EMMAS_PAGE_IND, /* AS->EMM: Paging data indication */
_EMMAS_STATUS_IND, /* AS->EMM: Status indication */
_EMMAS_CELL_INFO_REQ, /* EMM->AS: Cell information request */
_EMMAS_CELL_INFO_RES, /* AS->EMM: Cell information response */
_EMMAS_CELL_INFO_IND, /* AS->EMM: Cell information indication */
_EMMAS_SECURITY_REQ, /* EMM->AS: Security request */
_EMMAS_SECURITY_IND, /* AS->EMM: Security indication */
_EMMAS_SECURITY_RES, /* EMM->AS: Security response */
_EMMAS_SECURITY_REJ, /* EMM->AS: Security reject */
_EMMAS_ESTABLISH_REQ, /* EMM->AS: Connection establish request */
_EMMAS_ESTABLISH_CNF, /* AS->EMM: Connection establish confirm */
_EMMAS_ESTABLISH_REJ, /* AS->EMM: Connection establish reject */
_EMMAS_RELEASE_REQ, /* EMM->AS: Connection release request */
_EMMAS_RELEASE_IND, /* AS->EMM: Connection release indication */
_EMMAS_DATA_REQ, /* EMM->AS: Data transfer request */
_EMMAS_DATA_IND, /* AS->EMM: Data transfer indication */
_EMMAS_PAGE_IND, /* AS->EMM: Paging data indication */
_EMMAS_STATUS_IND, /* AS->EMM: Status indication */
_EMMAS_CELL_INFO_REQ, /* EMM->AS: Cell information request */
_EMMAS_CELL_INFO_RES, /* AS->EMM: Cell information response */
_EMMAS_CELL_INFO_IND, /* AS->EMM: Cell information indication */
_EMMAS_END
} emm_as_primitive_t;
/* Data used to setup EPS NAS security */
typedef struct {
UInt8_t is_new; /* New security data indicator */
#define EMM_AS_NO_KEY_AVAILABLE 0xff
UInt8_t ksi; /* NAS key set identifier */
UInt8_t sqn; /* Sequence number */
UInt32_t count; /* NAS counter */
const OctetString* k_enc; /* NAS cyphering key */
const OctetString* k_int; /* NAS integrity key */
UInt8_t is_new; /* New security data indicator */
#define EMM_AS_NO_KEY_AVAILABLE 0xff
UInt8_t ksi; /* NAS key set identifier */
UInt8_t sqn; /* Sequence number */
UInt32_t count; /* NAS counter */
const OctetString *k_enc; /* NAS cyphering key */
const OctetString *k_int; /* NAS integrity key */
} emm_as_security_data_t;
/****************************************************************************/
@@ -73,35 +73,35 @@ typedef struct {
* ----------------------------
*/
typedef struct {
UInt32_t ueid; /* UE lower layer identifier */
const GUTI_t *guti; /* GUTI temporary mobile identity */
emm_as_security_data_t sctx;/* EPS NAS security context */
int emm_cause; /* EMM failure cause code */
UInt32_t ueid; /* UE lower layer identifier */
const GUTI_t *guti; /* GUTI temporary mobile identity */
emm_as_security_data_t sctx;/* EPS NAS security context */
int emm_cause; /* EMM failure cause code */
/*
* Identity request/response
*/
UInt8_t identType; /* Type of requested UE's identity */
const imsi_t *imsi; /* The requested IMSI of the UE */
const imei_t *imei; /* The requested IMEI of the UE */
UInt32_t tmsi; /* The requested TMSI of the UE */
UInt8_t identType; /* Type of requested UE's identity */
const imsi_t *imsi; /* The requested IMSI of the UE */
const imei_t *imei; /* The requested IMEI of the UE */
UInt32_t tmsi; /* The requested TMSI of the UE */
/*
* Authentication request/response
*/
UInt8_t ksi; /* NAS key set identifier */
const OctetString* rand; /* Random challenge number */
const OctetString* autn; /* Authentication token */
const OctetString* res; /* Authentication response */
const OctetString* auts; /* Synchronisation failure */
UInt8_t ksi; /* NAS key set identifier */
const OctetString *rand; /* Random challenge number */
const OctetString *autn; /* Authentication token */
const OctetString *res; /* Authentication response */
const OctetString *auts; /* Synchronisation failure */
/*
* Security Mode Command
*/
UInt8_t eea; /* Replayed EPS encryption algorithms */
UInt8_t eia; /* Replayed EPS integrity algorithms */
UInt8_t eea; /* Replayed EPS encryption algorithms */
UInt8_t eia; /* Replayed EPS integrity algorithms */
#define EMM_AS_MSG_TYPE_IDENT 0x01 /* Identification message */
#define EMM_AS_MSG_TYPE_AUTH 0x02 /* Authentication message */
#define EMM_AS_MSG_TYPE_SMC 0x03 /* Security Mode Command */
UInt8_t msgType; /* Type of NAS security message to transfer */
#define EMM_AS_MSG_TYPE_IDENT 0x01 /* Identification message */
#define EMM_AS_MSG_TYPE_AUTH 0x02 /* Authentication message */
#define EMM_AS_MSG_TYPE_SMC 0x03 /* Security Mode Command */
UInt8_t msgType; /* Type of NAS security message to transfer */
} emm_as_security_t;
/*
@@ -109,39 +109,39 @@ typedef struct {
* --------------------------------------------
*/
typedef struct {
const GUTI_t *guti; /* The GUTI, if valid */
const tai_t *tai; /* The last visited registered Tracking
* Area Identity, if available */
const imsi_t *imsi; /* IMSI in case of "AttachWithImsi" */
const imei_t *imei; /* UE's IMEI for emergency bearer services */
const GUTI_t *guti; /* The GUTI, if valid */
const tai_t *tai; /* The last visited registered Tracking
* Area Identity, if available */
const imsi_t *imsi; /* IMSI in case of "AttachWithImsi" */
const imei_t *imei; /* UE's IMEI for emergency bearer services */
} emm_as_EPS_identity_t;
typedef struct {
UInt32_t ueid; /* UE lower layer identifier */
emm_as_EPS_identity_t UEid; /* UE's EPS mobile identity */
emm_as_security_data_t sctx;/* EPS NAS security context */
int switch_off; /* TRUE if the UE is switched off */
UInt8_t type; /* Network attach/detach type */
UInt8_t RRCcause; /* Connection establishment cause */
UInt8_t RRCtype; /* Associated call type */
const plmn_t* plmnID; /* Identifier of the selected PLMN */
UInt8_t ksi; /* NAS key set identifier */
UInt8_t encryption:4; /* Ciphering algorithm */
UInt8_t integrity:4; /* Integrity protection algorithm */
int emm_cause; /* EMM failure cause code */
const GUTI_t *new_guti; /* New GUTI, if re-allocated */
int n_tacs; /* Number of concecutive tracking areas
* the UE is registered to */
tac_t tac; /* Code of the first tracking area the UE
* is registered to */
#define EMM_AS_NAS_INFO_ATTACH 0x01 /* Attach request */
#define EMM_AS_NAS_INFO_DETACH 0x02 /* Detach request */
#define EMM_AS_NAS_INFO_TAU 0x03 /* Tracking Area Update request */
#define EMM_AS_NAS_INFO_SR 0x04 /* Service Request */
#define EMM_AS_NAS_INFO_EXTSR 0x05 /* Extended Service Request */
UInt8_t NASinfo; /* Type of initial NAS information to transfer */
OctetString NASmsg; /* NAS message to be transfered within
* initial NAS information message */
UInt32_t ueid; /* UE lower layer identifier */
emm_as_EPS_identity_t UEid; /* UE's EPS mobile identity */
emm_as_security_data_t sctx;/* EPS NAS security context */
int switch_off; /* TRUE if the UE is switched off */
UInt8_t type; /* Network attach/detach type */
UInt8_t RRCcause; /* Connection establishment cause */
UInt8_t RRCtype; /* Associated call type */
const plmn_t *plmnID; /* Identifier of the selected PLMN */
UInt8_t ksi; /* NAS key set identifier */
UInt8_t encryption:4; /* Ciphering algorithm */
UInt8_t integrity:4; /* Integrity protection algorithm */
int emm_cause; /* EMM failure cause code */
const GUTI_t *new_guti; /* New GUTI, if re-allocated */
int n_tacs; /* Number of concecutive tracking areas
* the UE is registered to */
tac_t tac; /* Code of the first tracking area the UE
* is registered to */
#define EMM_AS_NAS_INFO_ATTACH 0x01 /* Attach request */
#define EMM_AS_NAS_INFO_DETACH 0x02 /* Detach request */
#define EMM_AS_NAS_INFO_TAU 0x03 /* Tracking Area Update request */
#define EMM_AS_NAS_INFO_SR 0x04 /* Service Request */
#define EMM_AS_NAS_INFO_EXTSR 0x05 /* Extended Service Request */
UInt8_t NASinfo; /* Type of initial NAS information to transfer */
OctetString NASmsg; /* NAS message to be transfered within
* initial NAS information message */
} emm_as_establish_t;
/*
@@ -149,11 +149,11 @@ typedef struct {
* --------------------------------------
*/
typedef struct {
UInt32_t ueid; /* UE lower layer identifier */
const GUTI_t *guti; /* GUTI temporary mobile identity */
#define EMM_AS_CAUSE_AUTHENTICATION 0x01 /* Authentication failure */
#define EMM_AS_CAUSE_DETACH 0x02 /* Detach requested */
UInt8_t cause; /* Release cause */
UInt32_t ueid; /* UE lower layer identifier */
const GUTI_t *guti; /* GUTI temporary mobile identity */
#define EMM_AS_CAUSE_AUTHENTICATION 0x01 /* Authentication failure */
#define EMM_AS_CAUSE_DETACH 0x02 /* Detach requested */
UInt8_t cause; /* Release cause */
} emm_as_release_t;
/*
@@ -161,16 +161,16 @@ typedef struct {
* ---------------------------------
*/
typedef struct {
UInt32_t ueid; /* UE lower layer identifier */
const GUTI_t *guti; /* GUTI temporary mobile identity */
emm_as_security_data_t sctx;/* EPS NAS security context */
int switch_off; /* TRUE if the UE is switched off */
UInt8_t type; /* Network detach type */
UInt8_t delivered; /* Data message delivery indicator */
#define EMM_AS_NAS_DATA_ATTACH 0x01 /* Attach complete */
#define EMM_AS_NAS_DATA_DETACH 0x02 /* Detach request */
UInt8_t NASinfo; /* Type of NAS information to transfer */
OctetString NASmsg; /* NAS message to be transfered */
UInt32_t ueid; /* UE lower layer identifier */
const GUTI_t *guti; /* GUTI temporary mobile identity */
emm_as_security_data_t sctx;/* EPS NAS security context */
int switch_off; /* TRUE if the UE is switched off */
UInt8_t type; /* Network detach type */
UInt8_t delivered; /* Data message delivery indicator */
#define EMM_AS_NAS_DATA_ATTACH 0x01 /* Attach complete */
#define EMM_AS_NAS_DATA_DETACH 0x02 /* Detach request */
UInt8_t NASinfo; /* Type of NAS information to transfer */
OctetString NASmsg; /* NAS message to be transfered */
} emm_as_data_t;
/*
@@ -184,10 +184,10 @@ typedef struct {} emm_as_page_t;
* -------------------------------------
*/
typedef struct {
UInt32_t ueid; /* UE lower layer identifier */
const GUTI_t *guti; /* GUTI temporary mobile identity */
emm_as_security_data_t sctx;/* EPS NAS security context */
int emm_cause; /* EMM failure cause code */
UInt32_t ueid; /* UE lower layer identifier */
const GUTI_t *guti; /* GUTI temporary mobile identity */
emm_as_security_data_t sctx;/* EPS NAS security context */
int emm_cause; /* EMM failure cause code */
} emm_as_status_t;
/*
@@ -195,13 +195,13 @@ typedef struct {
* ------------------------------------
*/
typedef struct {
UInt8_t found; /* Indicates whether a suitable cell is found */
#define EMM_AS_PLMN_LIST_SIZE 6
UInt8_t found; /* Indicates whether a suitable cell is found */
#define EMM_AS_PLMN_LIST_SIZE 6
PLMN_LIST_T(EMM_AS_PLMN_LIST_SIZE) plmnIDs;
/* List of identifiers of available PLMNs */
Byte_t rat; /* Bitmap of Radio Access Technologies */
tac_t tac; /* Tracking Area Code */
ci_t cellID; /* cell identity */
/* List of identifiers of available PLMNs */
Byte_t rat; /* Bitmap of Radio Access Technologies */
tac_t tac; /* Tracking Area Code */
ci_t cellID; /* cell identity */
} emm_as_cell_info_t;
/*
@@ -212,13 +212,13 @@ typedef struct {
typedef struct {
emm_as_primitive_t primitive;
union {
emm_as_security_t security;
emm_as_establish_t establish;
emm_as_release_t release;
emm_as_data_t data;
emm_as_page_t page;
emm_as_status_t status;
emm_as_cell_info_t cell_info;
emm_as_security_t security;
emm_as_establish_t establish;
emm_as_release_t release;
emm_as_data_t data;
emm_as_page_t page;
emm_as_status_t status;
emm_as_cell_info_t cell_info;
} u;
} emm_as_t;
@@ -234,7 +234,7 @@ typedef struct {
* Defined in LowerLayer.c
* Setup security data according to the given EPS security context
*/
void emm_as_set_security_data(emm_as_security_data_t* data, const void* context,
int is_new, int is_ciphered);
void emm_as_set_security_data(emm_as_security_data_t *data, const void *context,
int is_new, int is_ciphered);
#endif /* __EMM_ASDEF_H__*/
@@ -1,23 +1,23 @@
/*****************************************************************************
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Source emm_esm.c
Source emm_esm.c
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 EMMESM Service Access Point that provides
interlayer services to the EPS Session Management sublayer
for service registration and activate/deactivate PDN
connections.
Description Defines the EMMESM Service Access Point that provides
interlayer services to the EPS Session Management sublayer
for service registration and activate/deactivate PDN
connections.
*****************************************************************************/
@@ -42,7 +42,7 @@ Description Defines the EMMESM Service Access Point that provides
/*
* String representation of EMMESM-SAP primitives
*/
static const char* _emm_esm_primitive_str[] = {
static const char *_emm_esm_primitive_str[] = {
#ifdef NAS_UE
"EMMESM_ESTABLISH_REQ",
"EMMESM_ESTABLISH_CNF",
@@ -59,16 +59,16 @@ static const char* _emm_esm_primitive_str[] = {
/****************************************************************************
** **
** Name: emm_esm_initialize() **
** Name: emm_esm_initialize() **
** **
** Description: Initializes the EMMESM Service Access Point **
** **
** Inputs: None **
** Others: None **
** Inputs: None **
** Others: None **
** **
** Outputs: None **
** Return: None **
** Others: NONE **
** Outputs: None **
** Return: None **
** Others: NONE **
** **
***************************************************************************/
void emm_esm_initialize(void)
@@ -82,19 +82,19 @@ void emm_esm_initialize(void)
/****************************************************************************
** **
** Name: emm_esm_send() **
** Name: emm_esm_send() **
** **
** Description: Processes the EMMESM Service Access Point primitive **
** **
** Inputs: msg: The EMMESM-SAP primitive to process **
** Others: None **
** Inputs: msg: The EMMESM-SAP primitive to process **
** Others: None **
** **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: None **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: None **
** **
***************************************************************************/
int emm_esm_send(const emm_esm_t* msg)
int emm_esm_send(const emm_esm_t *msg)
{
LOG_FUNC_IN;
@@ -102,51 +102,49 @@ int emm_esm_send(const emm_esm_t* msg)
emm_esm_primitive_t primitive = msg->primitive;
LOG_TRACE(INFO, "EMMESM-SAP - Received primitive %s (%d)",
_emm_esm_primitive_str[primitive - _EMMESM_START - 1], primitive);
_emm_esm_primitive_str[primitive - _EMMESM_START - 1], primitive);
switch (primitive)
{
switch (primitive) {
#ifdef NAS_UE
case _EMMESM_ESTABLISH_REQ:
/* ESM requests EMM to initiate an attach procedure before
* requesting subsequent connectivity to additional PDNs */
rc = emm_proc_attach_restart();
break;
case _EMMESM_ESTABLISH_REQ:
/* ESM requests EMM to initiate an attach procedure before
* requesting subsequent connectivity to additional PDNs */
rc = emm_proc_attach_restart();
break;
case _EMMESM_ESTABLISH_CNF:
/* ESM notifies EMM that PDN connectivity procedure successfully
* processed */
if (msg->u.establish.is_attached) {
if (msg->u.establish.is_emergency) {
/* Consider the UE attached for emergency bearer services
* only */
rc = emm_proc_attach_set_emergency();
}
}
else {
/* Consider the UE locally detached from the network */
rc = emm_proc_attach_set_detach();
}
break;
case _EMMESM_ESTABLISH_CNF:
/* ESM notifies EMM that PDN connectivity procedure successfully
* processed */
if (msg->u.establish.is_attached) {
if (msg->u.establish.is_emergency) {
/* Consider the UE attached for emergency bearer services
* only */
rc = emm_proc_attach_set_emergency();
}
} else {
/* Consider the UE locally detached from the network */
rc = emm_proc_attach_set_detach();
}
break;
case _EMMESM_ESTABLISH_REJ:
/* ESM notifies EMM that PDN connectivity procedure failed */
break;
case _EMMESM_ESTABLISH_REJ:
/* ESM notifies EMM that PDN connectivity procedure failed */
break;
#endif
case _EMMESM_UNITDATA_REQ:
/* ESM requests EMM to transfer ESM data unit to lower layer */
rc = lowerlayer_data_req(msg->ueid, &msg->u.data.msg);
break;
case _EMMESM_UNITDATA_REQ:
/* ESM requests EMM to transfer ESM data unit to lower layer */
rc = lowerlayer_data_req(msg->ueid, &msg->u.data.msg);
break;
default:
break;
default:
break;
}
if (rc != RETURNok) {
LOG_TRACE(WARNING, "EMMESM-SAP - Failed to process primitive %s (%d)",
_emm_esm_primitive_str[primitive - _EMMESM_START - 1],
primitive);
LOG_TRACE(WARNING, "EMMESM-SAP - Failed to process primitive %s (%d)",
_emm_esm_primitive_str[primitive - _EMMESM_START - 1],
primitive);
}
LOG_FUNC_RETURN (rc);
@@ -1,22 +1,22 @@
/*****************************************************************************
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Source emm_esm.h
Source emm_esm.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 EMMESM Service Access Point that provides
interlayer services to the EPS Session Management sublayer
for service registration and activate/deactivate PDP context.
Description Defines the EMMESM Service Access Point that provides
interlayer services to the EPS Session Management sublayer
for service registration and activate/deactivate PDP context.
*****************************************************************************/
#ifndef __EMM_ESM_H__
@@ -42,6 +42,6 @@ Description Defines the EMMESM Service Access Point that provides
void emm_esm_initialize(void);
int emm_esm_send(const emm_esm_t* msg);
int emm_esm_send(const emm_esm_t *msg);
#endif /* __EMM_ESM_H__*/
@@ -1,23 +1,23 @@
/*****************************************************************************
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Source emm_esmDef.h
Source emm_esmDef.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 EMMESM Service Access Point that provides
interlayer services to the EPS Session Management sublayer
for service registration and activate/deactivate PDN
connections.
Description Defines the EMMESM Service Access Point that provides
interlayer services to the EPS Session Management sublayer
for service registration and activate/deactivate PDN
connections.
*****************************************************************************/
#ifndef __EMM_ESMDEF_H__
@@ -54,10 +54,10 @@ typedef enum {
* ---------------------------------------------
*/
typedef struct {
int is_emergency; /* Indicates whether the PDN connection is established
* for emergency bearer services only */
int is_attached; /* Indicates whether the UE remains attached to the
* network */
int is_emergency; /* Indicates whether the PDN connection is established
* for emergency bearer services only */
int is_attached; /* Indicates whether the UE remains attached to the
* network */
} emm_esm_establish_t;
/*
@@ -65,7 +65,7 @@ typedef struct {
* ----------------------------------
*/
typedef struct {
OctetString msg; /* ESM message to be transfered */
OctetString msg; /* ESM message to be transfered */
} emm_esm_data_t;
/*
@@ -77,8 +77,8 @@ typedef struct {
emm_esm_primitive_t primitive;
unsigned int ueid;
union {
emm_esm_establish_t establish;
emm_esm_data_t data;
emm_esm_establish_t establish;
emm_esm_data_t data;
} u;
/* TODO: complete emm_esm_t structure definition */
} emm_esm_t;
@@ -1,21 +1,21 @@
/*****************************************************************************
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Source emm_fsm.c
Source emm_fsm.c
Version 0.1
Version 0.1
Date 2012/10/03
Date 2012/10/03
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
the EMMREG Service Access Point.
Description Defines the EPS Mobility Management procedures executed at
the EMMREG Service Access Point.
*****************************************************************************/
@@ -35,10 +35,10 @@ Description Defines the EPS Mobility Management procedures executed at
/****************************************************************************/
#ifdef NAS_UE
#define EMM_FSM_NB_UE_MAX 1
#define EMM_FSM_NB_UE_MAX 1
#endif
#ifdef NAS_MME
#define EMM_FSM_NB_UE_MAX (MME_API_NB_UE_MAX + 1)
#define EMM_FSM_NB_UE_MAX (MME_API_NB_UE_MAX + 1)
#endif
/****************************************************************************/
@@ -47,12 +47,12 @@ Description Defines the EPS Mobility Management procedures executed at
/*
* -----------------------------------------------------------------------------
* Data used for trace logging
* Data used for trace logging
* -----------------------------------------------------------------------------
*/
/* String representation of EMM events */
static const char* _emm_fsm_event_str[] = {
static const char *_emm_fsm_event_str[] = {
#ifdef NAS_UE
"S1_ENABLED",
"S1_DISABLED",
@@ -91,8 +91,7 @@ static const char* _emm_fsm_event_str[] = {
};
/* String representation of EMM status */
static const char* _emm_fsm_status_str[EMM_STATE_MAX] =
{
static const char *_emm_fsm_status_str[EMM_STATE_MAX] = {
#ifdef NAS_UE
"NULL",
#endif
@@ -126,46 +125,45 @@ static const char* _emm_fsm_status_str[EMM_STATE_MAX] =
/*
* -----------------------------------------------------------------------------
* EPS Mobility Management state machine handlers
* EPS Mobility Management state machine handlers
* -----------------------------------------------------------------------------
*/
/* Type of the EPS Mobility Management state machine handler */
typedef int(*emm_fsm_handler_t)(const emm_reg_t*);
typedef int(*emm_fsm_handler_t)(const emm_reg_t *);
#ifdef NAS_UE
int EmmNull(const emm_reg_t*);
int EmmNull(const emm_reg_t *);
#endif
int EmmDeregistered(const emm_reg_t*);
int EmmRegistered(const emm_reg_t*);
int EmmDeregisteredInitiated(const emm_reg_t*);
int EmmDeregistered(const emm_reg_t *);
int EmmRegistered(const emm_reg_t *);
int EmmDeregisteredInitiated(const emm_reg_t *);
#ifdef NAS_UE
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*);
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 *);
#endif
#ifdef NAS_MME
int EmmCommonProcedureInitiated(const emm_reg_t*);
int EmmCommonProcedureInitiated(const emm_reg_t *);
#endif
/* EMM state machine handlers */
static const emm_fsm_handler_t _emm_fsm_handlers[EMM_STATE_MAX] =
{
static const emm_fsm_handler_t _emm_fsm_handlers[EMM_STATE_MAX] = {
#ifdef NAS_UE
EmmNull,
#endif
@@ -199,7 +197,7 @@ static const emm_fsm_handler_t _emm_fsm_handlers[EMM_STATE_MAX] =
/*
* -----------------------------------------------------------------------------
* Current EPS Mobility Management status
* Current EPS Mobility Management status
* -----------------------------------------------------------------------------
*/
@@ -213,16 +211,16 @@ emm_fsm_state_t _emm_fsm_status[EMM_FSM_NB_UE_MAX];
/****************************************************************************
** **
** Name: emm_fsm_initialize() **
** Name: emm_fsm_initialize() **
** **
** Description: Initializes the EMM state machine **
** **
** Inputs: None **
** Others: None **
** Inputs: None **
** Others: None **
** **
** Outputs: None **
** Return: None **
** Others: _emm_fsm_status **
** Outputs: None **
** Return: None **
** Others: _emm_fsm_status **
** **
***************************************************************************/
void emm_fsm_initialize(void)
@@ -236,7 +234,7 @@ void emm_fsm_initialize(void)
#if defined(NAS_MME) && !defined(EPC_BUILD)
for (ueid = 0; ueid < EMM_FSM_NB_UE_MAX; ueid++) {
_emm_fsm_status[ueid] = EMM_DEREGISTERED;
_emm_fsm_status[ueid] = EMM_DEREGISTERED;
}
#endif
@@ -245,25 +243,25 @@ void emm_fsm_initialize(void)
/****************************************************************************
** **
** Name: emm_fsm_set_status() **
** Name: emm_fsm_set_status() **
** **
** Description: Set the EPS Mobility Management status to the given state **
** **
** Inputs: ueid: Lower layers UE identifier **
** status: The new EMM status **
** Others: None **
** Inputs: ueid: Lower layers UE identifier **
** status: The new EMM status **
** Others: None **
** **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: _emm_fsm_status **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: _emm_fsm_status **
** **
***************************************************************************/
int emm_fsm_set_status(
#ifdef NAS_MME
unsigned int ueid,
void *ctx,
unsigned int ueid,
void *ctx,
#endif
emm_fsm_state_t status)
emm_fsm_state_t status)
{
LOG_FUNC_IN;
@@ -272,7 +270,7 @@ int emm_fsm_set_status(
#endif
#if defined(EPC_BUILD)
emm_data_context_t *emm_ctx = (emm_data_context_t*)ctx;
emm_data_context_t *emm_ctx = (emm_data_context_t *)ctx;
DevAssert(emm_ctx != NULL);
@@ -287,13 +285,13 @@ int emm_fsm_set_status(
}
#else
if ( (status < EMM_STATE_MAX) && (ueid < EMM_FSM_NB_UE_MAX) ) {
LOG_TRACE(INFO, "EMM-FSM - Status changed: %s ===> %s",
_emm_fsm_status_str[_emm_fsm_status[ueid]],
_emm_fsm_status_str[status]);
if (status != _emm_fsm_status[ueid]) {
_emm_fsm_status[ueid] = status;
}
LOG_FUNC_RETURN (RETURNok);
LOG_TRACE(INFO, "EMM-FSM - Status changed: %s ===> %s",
_emm_fsm_status_str[_emm_fsm_status[ueid]],
_emm_fsm_status_str[status]);
if (status != _emm_fsm_status[ueid]) {
_emm_fsm_status[ueid] = status;
}
LOG_FUNC_RETURN (RETURNok);
}
#endif
@@ -302,17 +300,17 @@ int emm_fsm_set_status(
/****************************************************************************
** **
** Name: emm_fsm_get_status() **
** Name: emm_fsm_get_status() **
** **
** Description: Get the current value of the EPS Mobility Management **
** status **
** status **
** **
** Inputs: ueid: Lower layers UE identifier **
** Others: _emm_fsm_status **
** Inputs: ueid: Lower layers UE identifier **
** Others: _emm_fsm_status **
** **
** Outputs: None **
** Return: The current value of the EMM status **
** Others: None **
** Outputs: None **
** Return: The current value of the EMM status **
** Others: None **
** **
***************************************************************************/
#ifdef NAS_UE
@@ -326,14 +324,14 @@ emm_fsm_state_t emm_fsm_get_status(void)
emm_fsm_state_t emm_fsm_get_status(unsigned int ueid, void *ctx)
{
# if defined(EPC_BUILD)
emm_data_context_t *emm_ctx = (emm_data_context_t*)ctx;
emm_data_context_t *emm_ctx = (emm_data_context_t *)ctx;
if (emm_ctx != NULL) {
return emm_ctx->_emm_fsm_status;
}
# else
if (ueid < EMM_FSM_NB_UE_MAX) {
return (_emm_fsm_status[ueid]);
return (_emm_fsm_status[ueid]);
}
#endif
return EMM_STATE_MAX;
@@ -342,19 +340,19 @@ emm_fsm_state_t emm_fsm_get_status(unsigned int ueid, void *ctx)
/****************************************************************************
** **
** Name: emm_fsm_process() **
** Name: emm_fsm_process() **
** **
** Description: Executes the EMM state machine **
** **
** Inputs: evt: The EMMREG-SAP event to process **
** Others: _emm_fsm_status **
** Inputs: evt: The EMMREG-SAP event to process **
** Others: _emm_fsm_status **
** **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: None **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: None **
** **
***************************************************************************/
int emm_fsm_process(const emm_reg_t* evt)
int emm_fsm_process(const emm_reg_t *evt)
{
emm_fsm_state_t status;
@@ -368,22 +366,22 @@ int emm_fsm_process(const emm_reg_t* evt)
#endif
#ifdef NAS_MME
# if defined(EPC_BUILD)
emm_data_context_t *emm_ctx = (emm_data_context_t*)evt->ctx;
emm_data_context_t *emm_ctx = (emm_data_context_t *)evt->ctx;
DevAssert(emm_ctx != NULL);
status = emm_ctx->_emm_fsm_status;
# else
if (evt->ueid >= EMM_FSM_NB_UE_MAX) {
LOG_FUNC_RETURN (RETURNerror);
LOG_FUNC_RETURN (RETURNerror);
}
status = _emm_fsm_status[evt->ueid];
# endif
#endif
LOG_TRACE(INFO, "EMM-FSM - Received event %s (%d) in state %s",
_emm_fsm_event_str[primitive - _EMMREG_START - 1], primitive,
_emm_fsm_status_str[status]);
_emm_fsm_event_str[primitive - _EMMREG_START - 1], primitive,
_emm_fsm_status_str[status]);
/* Execute the EMM state machine */
rc = (_emm_fsm_handlers[status])(evt);
@@ -1,21 +1,21 @@
/*****************************************************************************
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Source emm_fsm.h
Source emm_fsm.h
Version 0.1
Version 0.1
Date 2012/10/03
Date 2012/10/03
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
the EMMREG Service Access Point.
Description Defines the EPS Mobility Management procedures executed at
the EMMREG Service Access Point.
*****************************************************************************/
#ifndef __EMM_FSM_H__
@@ -90,6 +90,6 @@ int emm_fsm_set_status(unsigned int ueid, void *ctx, emm_fsm_state_t status);
emm_fsm_state_t emm_fsm_get_status(unsigned int ueid, void *ctx);
#endif
int emm_fsm_process(const emm_reg_t* evt);
int emm_fsm_process(const emm_reg_t *evt);
#endif /* __EMM_FSM_H__*/
File diff suppressed because it is too large Load Diff
@@ -1,22 +1,22 @@
/*****************************************************************************
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Source emm_recv.h
Source emm_recv.h
Version 0.1
Version 0.1
Date 2013/01/30
Date 2013/01/30
Product NAS stack
Product NAS stack
Subsystem EPS Mobility Management
Subsystem EPS Mobility Management
Author Frederic Maurel
Author Frederic Maurel
Description Defines functions executed at the EMMAS Service Access
Point upon receiving EPS Mobility Management messages
from the Access Stratum sublayer.
Description Defines functions executed at the EMMAS Service Access
Point upon receiving EPS Mobility Management messages
from the Access Stratum sublayer.
*****************************************************************************/
#ifndef __EMM_RECV_H__
@@ -80,7 +80,7 @@ Description Defines functions executed at the EMMAS Service Access
* Functions executed by both the UE and the MME upon receiving EMM messages
* --------------------------------------------------------------------------
*/
int emm_recv_status(unsigned int ueid, emm_status_msg* msg, int* emm_cause);
int emm_recv_status(unsigned int ueid, emm_status_msg *msg, int *emm_cause);
/*
* --------------------------------------------------------------------------
@@ -88,15 +88,18 @@ int emm_recv_status(unsigned int ueid, emm_status_msg* msg, int* emm_cause);
* --------------------------------------------------------------------------
*/
#ifdef NAS_UE
int emm_recv_attach_accept(attach_accept_msg* msg, int* emm_cause);
int emm_recv_attach_reject(attach_reject_msg* msg, int* emm_cause);
int emm_recv_attach_accept(attach_accept_msg *msg, int *emm_cause);
int emm_recv_attach_reject(attach_reject_msg *msg, int *emm_cause);
int emm_recv_detach_accept(detach_accept_msg* msg, int* emm_cause);
int emm_recv_detach_accept(detach_accept_msg *msg, int *emm_cause);
int emm_recv_identity_request(identity_request_msg* msg, int* emm_cause);
int emm_recv_authentication_request(authentication_request_msg* msg, int* emm_cause);
int emm_recv_authentication_reject(authentication_reject_msg* msg, int* emm_cause);
int emm_recv_security_mode_command(security_mode_command_msg* msg, int* emm_cause);
int emm_recv_identity_request(identity_request_msg *msg, int *emm_cause);
int emm_recv_authentication_request(authentication_request_msg *msg,
int *emm_cause);
int emm_recv_authentication_reject(authentication_reject_msg *msg,
int *emm_cause);
int emm_recv_security_mode_command(security_mode_command_msg *msg,
int *emm_cause);
#endif
/*
@@ -105,16 +108,24 @@ int emm_recv_security_mode_command(security_mode_command_msg* msg, int* emm_caus
* --------------------------------------------------------------------------
*/
#ifdef NAS_MME
int emm_recv_attach_request(unsigned int ueid, const attach_request_msg* msg, int* emm_cause);
int emm_recv_attach_complete(unsigned int ueid, const attach_complete_msg* msg, int* emm_cause);
int emm_recv_attach_request(unsigned int ueid, const attach_request_msg *msg,
int *emm_cause);
int emm_recv_attach_complete(unsigned int ueid, const attach_complete_msg *msg,
int *emm_cause);
int emm_recv_detach_request(unsigned int ueid, const detach_request_msg* msg, int* emm_cause);
int emm_recv_detach_request(unsigned int ueid, const detach_request_msg *msg,
int *emm_cause);
int emm_recv_identity_response(unsigned int ueid, identity_response_msg* msg, int* emm_cause);
int emm_recv_authentication_response(unsigned int ueid, authentication_response_msg* msg, int* emm_cause);
int emm_recv_authentication_failure(unsigned int ueid, authentication_failure_msg* msg, int* emm_cause);
int emm_recv_security_mode_complete(unsigned int ueid, security_mode_complete_msg* msg, int* emm_cause);
int emm_recv_security_mode_reject(unsigned int ueid, security_mode_reject_msg* msg, int* emm_cause);
int emm_recv_identity_response(unsigned int ueid, identity_response_msg *msg,
int *emm_cause);
int emm_recv_authentication_response(unsigned int ueid,
authentication_response_msg *msg, int *emm_cause);
int emm_recv_authentication_failure(unsigned int ueid,
authentication_failure_msg *msg, int *emm_cause);
int emm_recv_security_mode_complete(unsigned int ueid,
security_mode_complete_msg *msg, int *emm_cause);
int emm_recv_security_mode_reject(unsigned int ueid,
security_mode_reject_msg *msg, int *emm_cause);
#endif
#endif /* __EMM_RECV_H__*/
@@ -1,22 +1,22 @@
/*****************************************************************************
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Source emm_reg.c
Source emm_reg.c
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 EMMREG Service Access Point that provides
registration services for location updating and attach/detach
procedures.
Description Defines the EMMREG Service Access Point that provides
registration services for location updating and attach/detach
procedures.
*****************************************************************************/
@@ -42,16 +42,16 @@ Description Defines the EMMREG Service Access Point that provides
/****************************************************************************
** **
** Name: emm_reg_initialize() **
** Name: emm_reg_initialize() **
** **
** Description: Initializes the EMMREG Service Access Point **
** **
** Inputs: None **
** Others: None **
** Inputs: None **
** Others: None **
** **
** Outputs: None **
** Return: None **
** Others: NONE **
** Outputs: None **
** Return: None **
** Others: NONE **
** **
***************************************************************************/
void emm_reg_initialize(void)
@@ -66,19 +66,19 @@ void emm_reg_initialize(void)
/****************************************************************************
** **
** Name: emm_reg_send() **
** Name: emm_reg_send() **
** **
** Description: Processes the EMMREG Service Access Point primitive **
** **
** Inputs: msg: The EMMREG-SAP primitive to process **
** Others: None **
** Inputs: msg: The EMMREG-SAP primitive to process **
** Others: None **
** **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: None **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: None **
** **
***************************************************************************/
int emm_reg_send(const emm_reg_t* msg)
int emm_reg_send(const emm_reg_t *msg)
{
LOG_FUNC_IN;
@@ -1,22 +1,22 @@
/*****************************************************************************
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Source emm_reg.h
Source emm_reg.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 EMMREG Service Access Point that provides
registration services for location updating and attach/detach
procedures.
Description Defines the EMMREG Service Access Point that provides
registration services for location updating and attach/detach
procedures.
*****************************************************************************/
#ifndef __EMM_REG_H__
@@ -42,6 +42,6 @@ Description Defines the EMMREG Service Access Point that provides
void emm_reg_initialize(void);
int emm_reg_send(const emm_reg_t* msg);
int emm_reg_send(const emm_reg_t *msg);
#endif /* __EMM_REG_H__*/
@@ -1,22 +1,22 @@
/*****************************************************************************
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Source emm_regDef.h
Source emm_regDef.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 EMMREG Service Access Point that provides
registration services for location updating and attach/detach
procedures.
Description Defines the EMMREG Service Access Point that provides
registration services for location updating and attach/detach
procedures.
*****************************************************************************/
#ifndef __EMM_REGDEF_H__
@@ -34,40 +34,40 @@ Description Defines the EMMREG Service Access Point that provides
typedef enum {
_EMMREG_START = 0,
#ifdef NAS_UE
_EMMREG_S1_ENABLED, /* S1 mode is enabled */
_EMMREG_S1_DISABLED, /* S1 mode is disabled */
_EMMREG_NO_IMSI, /* The UE is powered on without a valid USIM */
_EMMREG_NO_CELL, /* No available cell has been found */
_EMMREG_REGISTER_REQ, /* Network registration procedure requested */
_EMMREG_REGISTER_CNF, /* Network registration procedure succeed */
_EMMREG_REGISTER_REJ, /* Network registration procedure rejected */
_EMMREG_ATTACH_INIT, /* EPS network attach initiated */
_EMMREG_ATTACH_REQ, /* EPS network attach requested */
_EMMREG_ATTACH_FAILED, /* Attach attempt failed */
_EMMREG_ATTACH_EXCEEDED, /* Attach attempt exceeded */
_EMMREG_AUTH_REJ, /* Authentication rejected */
_EMMREG_S1_ENABLED, /* S1 mode is enabled */
_EMMREG_S1_DISABLED, /* S1 mode is disabled */
_EMMREG_NO_IMSI, /* The UE is powered on without a valid USIM */
_EMMREG_NO_CELL, /* No available cell has been found */
_EMMREG_REGISTER_REQ, /* Network registration procedure requested */
_EMMREG_REGISTER_CNF, /* Network registration procedure succeed */
_EMMREG_REGISTER_REJ, /* Network registration procedure rejected */
_EMMREG_ATTACH_INIT, /* EPS network attach initiated */
_EMMREG_ATTACH_REQ, /* EPS network attach requested */
_EMMREG_ATTACH_FAILED, /* Attach attempt failed */
_EMMREG_ATTACH_EXCEEDED, /* Attach attempt exceeded */
_EMMREG_AUTH_REJ, /* Authentication rejected */
#endif
#ifdef NAS_MME
_EMMREG_COMMON_PROC_REQ, /* EMM common procedure requested */
_EMMREG_COMMON_PROC_CNF, /* EMM common procedure successful */
_EMMREG_COMMON_PROC_REJ, /* EMM common procedure failed */
_EMMREG_PROC_ABORT, /* EMM procedure aborted */
_EMMREG_COMMON_PROC_REQ, /* EMM common procedure requested */
_EMMREG_COMMON_PROC_CNF, /* EMM common procedure successful */
_EMMREG_COMMON_PROC_REJ, /* EMM common procedure failed */
_EMMREG_PROC_ABORT, /* EMM procedure aborted */
#endif
_EMMREG_ATTACH_CNF, /* EPS network attach accepted */
_EMMREG_ATTACH_REJ, /* EPS network attach rejected */
_EMMREG_DETACH_INIT, /* Network detach initiated */
_EMMREG_DETACH_REQ, /* Network detach requested */
_EMMREG_DETACH_FAILED, /* Network detach attempt failed */
_EMMREG_DETACH_CNF, /* Network detach accepted */
_EMMREG_ATTACH_CNF, /* EPS network attach accepted */
_EMMREG_ATTACH_REJ, /* EPS network attach rejected */
_EMMREG_DETACH_INIT, /* Network detach initiated */
_EMMREG_DETACH_REQ, /* Network detach requested */
_EMMREG_DETACH_FAILED, /* Network detach attempt failed */
_EMMREG_DETACH_CNF, /* Network detach accepted */
_EMMREG_TAU_REQ,
_EMMREG_TAU_CNF,
_EMMREG_TAU_REJ,
_EMMREG_SERVICE_REQ,
_EMMREG_SERVICE_CNF,
_EMMREG_SERVICE_REJ,
_EMMREG_LOWERLAYER_SUCCESS, /* Data successfully delivered */
_EMMREG_LOWERLAYER_FAILURE, /* Lower layer failure indication */
_EMMREG_LOWERLAYER_RELEASE, /* NAS signalling connection released */
_EMMREG_LOWERLAYER_SUCCESS, /* Data successfully delivered */
_EMMREG_LOWERLAYER_FAILURE, /* Lower layer failure indication */
_EMMREG_LOWERLAYER_RELEASE, /* NAS signalling connection released */
_EMMREG_END
} emm_reg_primitive_t;
@@ -81,8 +81,8 @@ typedef enum {
* ----------------------------------------------------
*/
typedef struct {
int index; /* Index of the currently selected PLMN in the ordered
* list of available PLMNs */
int index; /* Index of the currently selected PLMN in the ordered
* list of available PLMNs */
} emm_reg_register_t;
#endif
@@ -91,8 +91,8 @@ typedef struct {
* -------------------------------------
*/
typedef struct {
int is_emergency; /* TRUE if the UE was attempting to register to
* the network for emergency services only */
int is_emergency; /* TRUE if the UE was attempting to register to
* the network for emergency services only */
} emm_reg_attach_t;
/*
@@ -100,8 +100,8 @@ typedef struct {
* -------------------------------------
*/
typedef struct {
int switch_off; /* TRUE if the UE is switched off */
int type; /* Network detach type */
int switch_off; /* TRUE if the UE is switched off */
int type; /* Network detach type */
} emm_reg_detach_t;
#ifdef NAS_MME
@@ -110,7 +110,7 @@ typedef struct {
* ------------------------------------------
*/
typedef struct {
int is_attached; /* UE context attach indicator */
int is_attached; /* UE context attach indicator */
} emm_reg_common_t;
#endif
@@ -123,13 +123,13 @@ typedef struct {
void *ctx;
union {
emm_reg_attach_t attach;
emm_reg_detach_t detach;
emm_reg_attach_t attach;
emm_reg_detach_t detach;
#ifdef NAS_UE
emm_reg_register_t regist;
emm_reg_register_t regist;
#endif
#ifdef NAS_MME
emm_reg_common_t common;
emm_reg_common_t common;
#endif
} u;
} emm_reg_t;
@@ -1,23 +1,23 @@
/*****************************************************************************
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Source emm_sap.c
Source emm_sap.c
Version 0.1
Version 0.1
Date 2012/10/01
Date 2012/10/01
Product NAS stack
Product NAS stack
Subsystem EPS Mobility Management
Subsystem EPS Mobility Management
Author Frederic Maurel
Author Frederic Maurel
Description Defines the EMM Service Access Points at which the EPS
Mobility Management sublayer provides procedures for the
control of security and mobility when the User Equipment
is using the Evolved UTRA Network.
Description Defines the EMM Service Access Points at which the EPS
Mobility Management sublayer provides procedures for the
control of security and mobility when the User Equipment
is using the Evolved UTRA Network.
*****************************************************************************/
@@ -43,16 +43,16 @@ Description Defines the EMM Service Access Points at which the EPS
/****************************************************************************
** **
** Name: emm_sap_initialize() **
** Name: emm_sap_initialize() **
** **
** Description: Initializes the EMM Service Access Points **
** **
** Inputs: None **
** Others: None **
** Inputs: None **
** Others: None **
** **
** Outputs: None **
** Return: None **
** Others: NONE **
** Outputs: None **
** Return: None **
** Others: NONE **
** **
***************************************************************************/
void emm_sap_initialize(void)
@@ -68,19 +68,19 @@ void emm_sap_initialize(void)
/****************************************************************************
** **
** Name: emm_sap_send() **
** Name: emm_sap_send() **
** **
** Description: Processes the EMM Service Access Point primitive **
** **
** Inputs: msg: The EMM-SAP primitive to process **
** Others: None **
** Inputs: msg: The EMM-SAP primitive to process **
** Others: None **
** **
** Outputs: msg: The EMM-SAP primitive to process **
** Return: RETURNok, RETURNerror **
** Others: None **
** Outputs: msg: The EMM-SAP primitive to process **
** Return: RETURNok, RETURNerror **
** Others: None **
** **
***************************************************************************/
int emm_sap_send(emm_sap_t* msg)
int emm_sap_send(emm_sap_t *msg)
{
LOG_FUNC_IN;
@@ -90,26 +90,23 @@ int emm_sap_send(emm_sap_t* msg)
/* Check the EMM-SAP primitive */
if ( (primitive > EMMREG_PRIMITIVE_MIN) &&
(primitive < EMMREG_PRIMITIVE_MAX) ) {
/* Forward to the EMMREG-SAP */
msg->u.emm_reg.primitive = primitive;
rc = emm_reg_send(&msg->u.emm_reg);
(primitive < EMMREG_PRIMITIVE_MAX) ) {
/* Forward to the EMMREG-SAP */
msg->u.emm_reg.primitive = primitive;
rc = emm_reg_send(&msg->u.emm_reg);
} else if ( (primitive > EMMESM_PRIMITIVE_MIN) &&
(primitive < EMMESM_PRIMITIVE_MAX) ) {
/* Forward to the EMMESM-SAP */
msg->u.emm_esm.primitive = primitive;
rc = emm_esm_send(&msg->u.emm_esm);
} else if ( (primitive > EMMAS_PRIMITIVE_MIN) &&
(primitive < EMMAS_PRIMITIVE_MAX) ) {
/* Forward to the EMMAS-SAP */
msg->u.emm_as.primitive = primitive;
rc = emm_as_send(&msg->u.emm_as);
} else {
LOG_TRACE(WARNING, "EMM-SAP - Out of range primitive (%d)", primitive);
}
else if ( (primitive > EMMESM_PRIMITIVE_MIN) &&
(primitive < EMMESM_PRIMITIVE_MAX) ) {
/* Forward to the EMMESM-SAP */
msg->u.emm_esm.primitive = primitive;
rc = emm_esm_send(&msg->u.emm_esm);
}
else if ( (primitive > EMMAS_PRIMITIVE_MIN) &&
(primitive < EMMAS_PRIMITIVE_MAX) ) {
/* Forward to the EMMAS-SAP */
msg->u.emm_as.primitive = primitive;
rc = emm_as_send(&msg->u.emm_as);
}
else {
LOG_TRACE(WARNING, "EMM-SAP - Out of range primitive (%d)", primitive);
}
LOG_FUNC_RETURN (rc);
}
@@ -1,23 +1,23 @@
/*****************************************************************************
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Source emm_sap.h
Source emm_sap.h
Version 0.1
Version 0.1
Date 2012/10/01
Date 2012/10/01
Product NAS stack
Product NAS stack
Subsystem EPS Mobility Management
Subsystem EPS Mobility Management
Author Frederic Maurel
Author Frederic Maurel
Description Defines the EMM Service Access Points at which the EPS
Mobility Management sublayer provides procedures for the
control of security and mobility when the User Equipment
is using the Evolved UTRA Network.
Description Defines the EMM Service Access Points at which the EPS
Mobility Management sublayer provides procedures for the
control of security and mobility when the User Equipment
is using the Evolved UTRA Network.
*****************************************************************************/
#ifndef __EMM_SAP_H__
@@ -44,81 +44,81 @@ Description Defines the EMM Service Access Points at which the EPS
typedef enum {
/* EMMREG-SAP */
#ifdef NAS_UE
EMMREG_S1_ENABLED = _EMMREG_S1_ENABLED,
EMMREG_S1_DISABLED = _EMMREG_S1_DISABLED,
EMMREG_NO_IMSI = _EMMREG_NO_IMSI,
EMMREG_NO_CELL = _EMMREG_NO_CELL,
EMMREG_REGISTER_REQ = _EMMREG_REGISTER_REQ,
EMMREG_REGISTER_CNF = _EMMREG_REGISTER_CNF,
EMMREG_REGISTER_REJ = _EMMREG_REGISTER_REJ,
EMMREG_ATTACH_INIT = _EMMREG_ATTACH_INIT,
EMMREG_ATTACH_REQ = _EMMREG_ATTACH_REQ,
EMMREG_ATTACH_FAILED = _EMMREG_ATTACH_FAILED,
EMMREG_ATTACH_EXCEEDED = _EMMREG_ATTACH_EXCEEDED,
EMMREG_AUTH_REJ = _EMMREG_AUTH_REJ,
EMMREG_S1_ENABLED = _EMMREG_S1_ENABLED,
EMMREG_S1_DISABLED = _EMMREG_S1_DISABLED,
EMMREG_NO_IMSI = _EMMREG_NO_IMSI,
EMMREG_NO_CELL = _EMMREG_NO_CELL,
EMMREG_REGISTER_REQ = _EMMREG_REGISTER_REQ,
EMMREG_REGISTER_CNF = _EMMREG_REGISTER_CNF,
EMMREG_REGISTER_REJ = _EMMREG_REGISTER_REJ,
EMMREG_ATTACH_INIT = _EMMREG_ATTACH_INIT,
EMMREG_ATTACH_REQ = _EMMREG_ATTACH_REQ,
EMMREG_ATTACH_FAILED = _EMMREG_ATTACH_FAILED,
EMMREG_ATTACH_EXCEEDED = _EMMREG_ATTACH_EXCEEDED,
EMMREG_AUTH_REJ = _EMMREG_AUTH_REJ,
#endif
#ifdef NAS_MME
EMMREG_COMMON_PROC_REQ = _EMMREG_COMMON_PROC_REQ,
EMMREG_COMMON_PROC_CNF = _EMMREG_COMMON_PROC_CNF,
EMMREG_COMMON_PROC_REJ = _EMMREG_COMMON_PROC_REJ,
EMMREG_PROC_ABORT = _EMMREG_PROC_ABORT,
EMMREG_COMMON_PROC_REQ = _EMMREG_COMMON_PROC_REQ,
EMMREG_COMMON_PROC_CNF = _EMMREG_COMMON_PROC_CNF,
EMMREG_COMMON_PROC_REJ = _EMMREG_COMMON_PROC_REJ,
EMMREG_PROC_ABORT = _EMMREG_PROC_ABORT,
#endif
EMMREG_ATTACH_CNF = _EMMREG_ATTACH_CNF,
EMMREG_ATTACH_REJ = _EMMREG_ATTACH_REJ,
EMMREG_DETACH_INIT = _EMMREG_DETACH_INIT,
EMMREG_DETACH_REQ = _EMMREG_DETACH_REQ,
EMMREG_DETACH_FAILED = _EMMREG_DETACH_FAILED,
EMMREG_DETACH_CNF = _EMMREG_DETACH_CNF,
EMMREG_TAU_REQ = _EMMREG_TAU_REQ,
EMMREG_TAU_CNF = _EMMREG_TAU_CNF,
EMMREG_TAU_REJ = _EMMREG_TAU_REJ,
EMMREG_SERVICE_REQ = _EMMREG_SERVICE_REQ,
EMMREG_SERVICE_CNF = _EMMREG_SERVICE_CNF,
EMMREG_SERVICE_REJ = _EMMREG_SERVICE_REJ,
EMMREG_LOWERLAYER_SUCCESS = _EMMREG_LOWERLAYER_SUCCESS,
EMMREG_LOWERLAYER_FAILURE = _EMMREG_LOWERLAYER_FAILURE,
EMMREG_LOWERLAYER_RELEASE = _EMMREG_LOWERLAYER_RELEASE,
EMMREG_ATTACH_CNF = _EMMREG_ATTACH_CNF,
EMMREG_ATTACH_REJ = _EMMREG_ATTACH_REJ,
EMMREG_DETACH_INIT = _EMMREG_DETACH_INIT,
EMMREG_DETACH_REQ = _EMMREG_DETACH_REQ,
EMMREG_DETACH_FAILED = _EMMREG_DETACH_FAILED,
EMMREG_DETACH_CNF = _EMMREG_DETACH_CNF,
EMMREG_TAU_REQ = _EMMREG_TAU_REQ,
EMMREG_TAU_CNF = _EMMREG_TAU_CNF,
EMMREG_TAU_REJ = _EMMREG_TAU_REJ,
EMMREG_SERVICE_REQ = _EMMREG_SERVICE_REQ,
EMMREG_SERVICE_CNF = _EMMREG_SERVICE_CNF,
EMMREG_SERVICE_REJ = _EMMREG_SERVICE_REJ,
EMMREG_LOWERLAYER_SUCCESS = _EMMREG_LOWERLAYER_SUCCESS,
EMMREG_LOWERLAYER_FAILURE = _EMMREG_LOWERLAYER_FAILURE,
EMMREG_LOWERLAYER_RELEASE = _EMMREG_LOWERLAYER_RELEASE,
/* EMMESM-SAP */
#ifdef NAS_UE
EMMESM_ESTABLISH_REQ = _EMMESM_ESTABLISH_REQ,
EMMESM_ESTABLISH_CNF = _EMMESM_ESTABLISH_CNF,
EMMESM_ESTABLISH_REJ = _EMMESM_ESTABLISH_REJ,
EMMESM_ESTABLISH_REQ = _EMMESM_ESTABLISH_REQ,
EMMESM_ESTABLISH_CNF = _EMMESM_ESTABLISH_CNF,
EMMESM_ESTABLISH_REJ = _EMMESM_ESTABLISH_REJ,
#endif
EMMESM_RELEASE_IND = _EMMESM_RELEASE_IND,
EMMESM_UNITDATA_REQ = _EMMESM_UNITDATA_REQ,
EMMESM_UNITDATA_IND = _EMMESM_UNITDATA_IND,
EMMESM_RELEASE_IND = _EMMESM_RELEASE_IND,
EMMESM_UNITDATA_REQ = _EMMESM_UNITDATA_REQ,
EMMESM_UNITDATA_IND = _EMMESM_UNITDATA_IND,
/* EMMAS-SAP */
EMMAS_SECURITY_REQ = _EMMAS_SECURITY_REQ,
EMMAS_SECURITY_IND = _EMMAS_SECURITY_IND,
EMMAS_SECURITY_RES = _EMMAS_SECURITY_RES,
EMMAS_SECURITY_REJ = _EMMAS_SECURITY_REJ,
EMMAS_ESTABLISH_REQ = _EMMAS_ESTABLISH_REQ,
EMMAS_ESTABLISH_CNF = _EMMAS_ESTABLISH_CNF,
EMMAS_ESTABLISH_REJ = _EMMAS_ESTABLISH_REJ,
EMMAS_RELEASE_REQ = _EMMAS_RELEASE_REQ,
EMMAS_RELEASE_IND = _EMMAS_RELEASE_IND,
EMMAS_DATA_REQ = _EMMAS_DATA_REQ,
EMMAS_DATA_IND = _EMMAS_DATA_IND,
EMMAS_PAGE_IND = _EMMAS_PAGE_IND,
EMMAS_STATUS_IND = _EMMAS_STATUS_IND,
EMMAS_CELL_INFO_REQ = _EMMAS_CELL_INFO_REQ,
EMMAS_CELL_INFO_RES = _EMMAS_CELL_INFO_RES,
EMMAS_CELL_INFO_IND = _EMMAS_CELL_INFO_IND,
EMMAS_SECURITY_REQ = _EMMAS_SECURITY_REQ,
EMMAS_SECURITY_IND = _EMMAS_SECURITY_IND,
EMMAS_SECURITY_RES = _EMMAS_SECURITY_RES,
EMMAS_SECURITY_REJ = _EMMAS_SECURITY_REJ,
EMMAS_ESTABLISH_REQ = _EMMAS_ESTABLISH_REQ,
EMMAS_ESTABLISH_CNF = _EMMAS_ESTABLISH_CNF,
EMMAS_ESTABLISH_REJ = _EMMAS_ESTABLISH_REJ,
EMMAS_RELEASE_REQ = _EMMAS_RELEASE_REQ,
EMMAS_RELEASE_IND = _EMMAS_RELEASE_IND,
EMMAS_DATA_REQ = _EMMAS_DATA_REQ,
EMMAS_DATA_IND = _EMMAS_DATA_IND,
EMMAS_PAGE_IND = _EMMAS_PAGE_IND,
EMMAS_STATUS_IND = _EMMAS_STATUS_IND,
EMMAS_CELL_INFO_REQ = _EMMAS_CELL_INFO_REQ,
EMMAS_CELL_INFO_RES = _EMMAS_CELL_INFO_RES,
EMMAS_CELL_INFO_IND = _EMMAS_CELL_INFO_IND,
} emm_primitive_t;
/*
* Minimal identifier for EMM-SAP primitives
*/
#define EMMREG_PRIMITIVE_MIN _EMMREG_START
#define EMMESM_PRIMITIVE_MIN _EMMESM_START
#define EMMAS_PRIMITIVE_MIN _EMMAS_START
#define EMMREG_PRIMITIVE_MIN _EMMREG_START
#define EMMESM_PRIMITIVE_MIN _EMMESM_START
#define EMMAS_PRIMITIVE_MIN _EMMAS_START
/*
* Maximal identifier for EMM-SAP primitives
*/
#define EMMREG_PRIMITIVE_MAX _EMMREG_END
#define EMMESM_PRIMITIVE_MAX _EMMESM_END
#define EMMAS_PRIMITIVE_MAX _EMMAS_END
#define EMMREG_PRIMITIVE_MAX _EMMREG_END
#define EMMESM_PRIMITIVE_MAX _EMMESM_END
#define EMMAS_PRIMITIVE_MAX _EMMAS_END
/****************************************************************************/
/************************ G L O B A L T Y P E S ************************/
@@ -130,9 +130,9 @@ typedef enum {
typedef struct {
emm_primitive_t primitive;
union {
emm_reg_t emm_reg; /* EMMREG-SAP primitives */
emm_esm_t emm_esm; /* EMMESM-SAP primitives */
emm_as_t emm_as; /* EMMAS-SAP primitives */
emm_reg_t emm_reg; /* EMMREG-SAP primitives */
emm_esm_t emm_esm; /* EMMESM-SAP primitives */
emm_as_t emm_as; /* EMMAS-SAP primitives */
} u;
} emm_sap_t;
@@ -146,6 +146,6 @@ typedef struct {
void emm_sap_initialize(void);
int emm_sap_send(emm_sap_t* msg);
int emm_sap_send(emm_sap_t *msg);
#endif /* __EMM_SAP_H__*/
File diff suppressed because it is too large Load Diff
@@ -1,22 +1,22 @@
/*****************************************************************************
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Source emm_send.h
Source emm_send.h
Version 0.1
Version 0.1
Date 2013/01/30
Date 2013/01/30
Product NAS stack
Product NAS stack
Subsystem EPS Mobility Management
Subsystem EPS Mobility Management
Author Frederic Maurel
Author Frederic Maurel
Description Defines functions executed at the EMMAS Service Access
Point to send EPS Mobility Management messages to the
Access Stratum sublayer.
Description Defines functions executed at the EMMAS Service Access
Point to send EPS Mobility Management messages to the
Access Stratum sublayer.
*****************************************************************************/
#ifndef __EMM_SEND_H__
@@ -82,9 +82,9 @@ Description Defines functions executed at the EMMAS Service Access
* Functions executed by both the UE and the MME to send EMM messages
* --------------------------------------------------------------------------
*/
int emm_send_status(const emm_as_status_t*, emm_status_msg*);
int emm_send_status(const emm_as_status_t *, emm_status_msg *);
int emm_send_detach_accept(const emm_as_data_t*, detach_accept_msg*);
int emm_send_detach_accept(const emm_as_data_t *, detach_accept_msg *);
/*
* --------------------------------------------------------------------------
@@ -92,24 +92,33 @@ int emm_send_detach_accept(const emm_as_data_t*, detach_accept_msg*);
* --------------------------------------------------------------------------
*/
#ifdef NAS_UE
int emm_send_attach_request(const emm_as_establish_t*, attach_request_msg*);
int emm_send_attach_complete(const emm_as_data_t*, attach_complete_msg*);
int emm_send_attach_request(const emm_as_establish_t *, attach_request_msg *);
int emm_send_attach_complete(const emm_as_data_t *, attach_complete_msg *);
int emm_send_initial_detach_request(const emm_as_establish_t*, detach_request_msg*);
int emm_send_detach_request(const emm_as_data_t*, detach_request_msg*);
int emm_send_initial_detach_request(const emm_as_establish_t *,
detach_request_msg *);
int emm_send_detach_request(const emm_as_data_t *, detach_request_msg *);
int emm_send_initial_tau_request(const emm_as_establish_t*, tracking_area_update_request_msg*);
int emm_send_initial_tau_request(const emm_as_establish_t *,
tracking_area_update_request_msg *);
int emm_send_initial_sr_request(const emm_as_establish_t*, service_request_msg*);
int emm_send_initial_sr_request(const emm_as_establish_t *,
service_request_msg *);
int emm_send_initial_extsr_request(const emm_as_establish_t*, extended_service_request_msg*);
int emm_send_initial_extsr_request(const emm_as_establish_t *,
extended_service_request_msg *);
int emm_send_identity_response(const emm_as_security_t*, identity_response_msg*);
int emm_send_authentication_response(const emm_as_security_t*, authentication_response_msg*);
int emm_send_authentication_failure(const emm_as_security_t*, authentication_failure_msg*);
int emm_send_security_mode_complete(const emm_as_security_t*, security_mode_complete_msg*);
int emm_send_security_mode_reject(const emm_as_security_t*, security_mode_reject_msg*);
int emm_send_identity_response(const emm_as_security_t *,
identity_response_msg *);
int emm_send_authentication_response(const emm_as_security_t *,
authentication_response_msg *);
int emm_send_authentication_failure(const emm_as_security_t *,
authentication_failure_msg *);
int emm_send_security_mode_complete(const emm_as_security_t *,
security_mode_complete_msg *);
int emm_send_security_mode_reject(const emm_as_security_t *,
security_mode_reject_msg *);
#endif
/*
@@ -118,13 +127,15 @@ int emm_send_security_mode_reject(const emm_as_security_t*, security_mode_reject
* --------------------------------------------------------------------------
*/
#ifdef NAS_MME
int emm_send_attach_accept(const emm_as_establish_t*, attach_accept_msg*);
int emm_send_attach_reject(const emm_as_establish_t*, attach_reject_msg*);
int emm_send_attach_accept(const emm_as_establish_t *, attach_accept_msg *);
int emm_send_attach_reject(const emm_as_establish_t *, attach_reject_msg *);
int emm_send_identity_request(const emm_as_security_t*, identity_request_msg*);
int emm_send_authentication_request(const emm_as_security_t*, authentication_request_msg*);
int emm_send_authentication_reject(authentication_reject_msg*);
int emm_send_security_mode_command(const emm_as_security_t*, security_mode_command_msg*);
int emm_send_identity_request(const emm_as_security_t *, identity_request_msg *);
int emm_send_authentication_request(const emm_as_security_t *,
authentication_request_msg *);
int emm_send_authentication_reject(authentication_reject_msg *);
int emm_send_security_mode_command(const emm_as_security_t *,
security_mode_command_msg *);
#endif
#endif /* __EMM_SEND_H__*/
@@ -1,33 +1,33 @@
/*****************************************************************************
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Source DedicatedEpsBearerContextActivation.c
Source DedicatedEpsBearerContextActivation.c
Version 0.1
Version 0.1
Date 2013/07/16
Date 2013/07/16
Product NAS stack
Product NAS stack
Subsystem EPS Session Management
Subsystem EPS Session Management
Author Frederic Maurel
Author Frederic Maurel
Description Defines the dedicated EPS bearer context activation ESM
procedure executed by the Non-Access Stratum.
Description Defines the dedicated EPS bearer context activation ESM
procedure executed by the Non-Access Stratum.
The purpose of the dedicated EPS bearer context activation
procedure is to establish an EPS bearer context with specific
QoS and TFT between the UE and the EPC.
The purpose of the dedicated EPS bearer context activation
procedure is to establish an EPS bearer context with specific
QoS and TFT between the UE and the EPC.
The procedure is initiated by the network, but may be requested
by the UE by means of the UE requested bearer resource alloca-
tion procedure or the UE requested bearer resource modification
procedure.
It can be part of the attach procedure or be initiated together
with the default EPS bearer context activation procedure when
the UE initiated stand-alone PDN connectivity procedure.
The procedure is initiated by the network, but may be requested
by the UE by means of the UE requested bearer resource alloca-
tion procedure or the UE requested bearer resource modification
procedure.
It can be part of the attach procedure or be initiated together
with the default EPS bearer context activation procedure when
the UE initiated stand-alone PDN connectivity procedure.
*****************************************************************************/
@@ -59,14 +59,14 @@ Description Defines the dedicated EPS bearer context activation ESM
/*
* Timer handlers
*/
static void* _dedicated_eps_bearer_activate_t3485_handler(void*);
static void *_dedicated_eps_bearer_activate_t3485_handler(void *);
/* Maximum value of the activate dedicated EPS bearer context request
* retransmission counter */
#define DEDICATED_EPS_BEARER_ACTIVATE_COUNTER_MAX 5
#define DEDICATED_EPS_BEARER_ACTIVATE_COUNTER_MAX 5
static int _dedicated_eps_bearer_activate(unsigned int ueid, int ebi,
const OctetString* msg);
const OctetString *msg);
#endif // NAS_MME
/****************************************************************************/
@@ -81,53 +81,53 @@ static int _dedicated_eps_bearer_activate(unsigned int ueid, int ebi,
#ifdef NAS_MME
/****************************************************************************
** **
** Name: esm_proc_dedicated_eps_bearer_context() **
** Name: esm_proc_dedicated_eps_bearer_context() **
** **
** Description: Allocates resources required for activation of a dedica- **
** ted EPS bearer context. **
** ted EPS bearer context. **
** **
** Inputs: ueid: UE local identifier **
** pid: PDN connection identifier **
** esm_qos: EPS bearer level QoS parameters **
** tft: Traffic flow template parameters **
** Others: None **
** Inputs: ueid: UE local identifier **
** pid: PDN connection identifier **
** esm_qos: EPS bearer level QoS parameters **
** tft: Traffic flow template parameters **
** Others: None **
** **
** Outputs: ebi: EPS bearer identity assigned to the new **
** dedicated bearer context **
** default_ebi: EPS bearer identity of the associated de- **
** fault EPS bearer context **
** esm_cause: Cause code returned upon ESM procedure **
** failure **
** Return: RETURNok, RETURNerror **
** Others: None **
** Outputs: ebi: EPS bearer identity assigned to the new **
** dedicated bearer context **
** default_ebi: EPS bearer identity of the associated de- **
** fault EPS bearer context **
** esm_cause: Cause code returned upon ESM procedure **
** failure **
** Return: RETURNok, RETURNerror **
** Others: None **
** **
***************************************************************************/
int esm_proc_dedicated_eps_bearer_context(unsigned int ueid, int pid,
unsigned int* ebi,
unsigned int* default_ebi,
const esm_proc_qos_t* qos,
const esm_proc_tft_t* tft,
int* esm_cause)
unsigned int *ebi,
unsigned int *default_ebi,
const esm_proc_qos_t *qos,
const esm_proc_tft_t *tft,
int *esm_cause)
{
LOG_FUNC_IN;
LOG_TRACE(INFO, "ESM-PROC - Dedicated EPS bearer context activation "
"(ueid=%u, pid=%d)", ueid, pid);
"(ueid=%u, pid=%d)", ueid, pid);
/* Assign new EPS bearer context */
*ebi = esm_ebr_assign(ueid, ESM_EBI_UNASSIGNED);
if (*ebi != ESM_EBI_UNASSIGNED) {
/* Create dedicated EPS bearer context */
*default_ebi = esm_ebr_context_create(ueid, pid, *ebi, FALSE, qos, tft);
if (*default_ebi == ESM_EBI_UNASSIGNED) {
/* No resource available */
LOG_TRACE(WARNING, "ESM-PROC - Failed to create dedicated EPS "
"bearer context (ebi=%d)", *ebi);
*esm_cause = ESM_CAUSE_INSUFFICIENT_RESOURCES;
LOG_FUNC_RETURN (RETURNerror);
}
LOG_FUNC_RETURN (RETURNok);
/* Create dedicated EPS bearer context */
*default_ebi = esm_ebr_context_create(ueid, pid, *ebi, FALSE, qos, tft);
if (*default_ebi == ESM_EBI_UNASSIGNED) {
/* No resource available */
LOG_TRACE(WARNING, "ESM-PROC - Failed to create dedicated EPS "
"bearer context (ebi=%d)", *ebi);
*esm_cause = ESM_CAUSE_INSUFFICIENT_RESOURCES;
LOG_FUNC_RETURN (RETURNerror);
}
LOG_FUNC_RETURN (RETURNok);
}
LOG_TRACE(WARNING, "ESM-PROC - Failed to assign new EPS bearer context");
@@ -137,53 +137,53 @@ int esm_proc_dedicated_eps_bearer_context(unsigned int ueid, int pid,
/****************************************************************************
** **
** Name: esm_proc_dedicated_eps_bearer_context_request() **
** Name: esm_proc_dedicated_eps_bearer_context_request() **
** **
** Description: Initiates the dedicated EPS bearer context activation pro-**
** cedure **
** cedure **
** **
** 3GPP TS 24.301, section 6.4.2.2 **
** The MME initiates the dedicated EPS bearer context activa-**
** tion procedure by sending an ACTIVATE DEDICATED EPS BEA- **
** RER CONTEXT REQUEST message, starting timer T3485 and en- **
** tering state BEARER CONTEXT ACTIVE PENDING. **
** 3GPP TS 24.301, section 6.4.2.2 **
** The MME initiates the dedicated EPS bearer context activa-**
** tion procedure by sending an ACTIVATE DEDICATED EPS BEA- **
** RER CONTEXT REQUEST message, starting timer T3485 and en- **
** tering state BEARER CONTEXT ACTIVE PENDING. **
** **
** Inputs: is_standalone: Not used (always TRUE) **
** ueid: UE lower layer identifier **
** ebi: EPS bearer identity **
** msg: Encoded ESM message to be sent **
** ue_triggered: TRUE if the EPS bearer context procedure **
** was triggered by the UE **
** Others: None **
** Inputs: is_standalone: Not used (always TRUE) **
** ueid: UE lower layer identifier **
** ebi: EPS bearer identity **
** msg: Encoded ESM message to be sent **
** ue_triggered: TRUE if the EPS bearer context procedure **
** was triggered by the UE **
** Others: None **
** **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: None **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: None **
** **
***************************************************************************/
int esm_proc_dedicated_eps_bearer_context_request(int is_standalone,
unsigned int ueid, int ebi,
OctetString* msg, int ue_triggered)
unsigned int ueid, int ebi,
OctetString *msg, int ue_triggered)
{
LOG_FUNC_IN;
int rc = RETURNok;
LOG_TRACE(INFO,"ESM-PROC - Initiate dedicated EPS bearer context "
"activation (ueid=%d, ebi=%d)", ueid, ebi);
"activation (ueid=%d, ebi=%d)", ueid, ebi);
/* Send activate dedicated EPS bearer context request message and
* start timer T3485 */
rc = _dedicated_eps_bearer_activate(ueid, ebi, msg);
if (rc != RETURNerror) {
/* Set the EPS bearer context state to ACTIVE PENDING */
rc = esm_ebr_set_status(ueid, ebi, ESM_EBR_ACTIVE_PENDING, ue_triggered);
if (rc != RETURNok) {
/* The EPS bearer context was already in ACTIVE PENDING state */
LOG_TRACE(WARNING, "ESM-PROC - EBI %d was already ACTIVE PENDING",
ebi);
}
/* Set the EPS bearer context state to ACTIVE PENDING */
rc = esm_ebr_set_status(ueid, ebi, ESM_EBR_ACTIVE_PENDING, ue_triggered);
if (rc != RETURNok) {
/* The EPS bearer context was already in ACTIVE PENDING state */
LOG_TRACE(WARNING, "ESM-PROC - EBI %d was already ACTIVE PENDING",
ebi);
}
}
LOG_FUNC_RETURN (rc);
@@ -191,46 +191,46 @@ int esm_proc_dedicated_eps_bearer_context_request(int is_standalone,
/****************************************************************************
** **
** Name: esm_proc_dedicated_eps_bearer_context_accept() **
** Name: esm_proc_dedicated_eps_bearer_context_accept() **
** **
** Description: Performs dedicated EPS bearer context activation procedu- **
** re accepted by the UE. **
** re accepted by the UE. **
** **
** 3GPP TS 24.301, section 6.4.2.3 **
** Upon receipt of the ACTIVATE DEDICATED EPS BEARER CONTEXT **
** ACCEPT message, the MME shall stop the timer T3485 and **
** enter the state BEARER CONTEXT ACTIVE. **
** 3GPP TS 24.301, section 6.4.2.3 **
** Upon receipt of the ACTIVATE DEDICATED EPS BEARER CONTEXT **
** ACCEPT message, the MME shall stop the timer T3485 and **
** enter the state BEARER CONTEXT ACTIVE. **
** **
** Inputs: ueid: UE local identifier **
** ebi: EPS bearer identity **
** Others: None **
** Inputs: ueid: UE local identifier **
** ebi: EPS bearer identity **
** Others: None **
** **
** Outputs: esm_cause: Cause code returned upon ESM procedure **
** failure **
** Return: RETURNok, RETURNerror **
** Others: None **
** Outputs: esm_cause: Cause code returned upon ESM procedure **
** failure **
** Return: RETURNok, RETURNerror **
** Others: None **
** **
***************************************************************************/
int esm_proc_dedicated_eps_bearer_context_accept(unsigned int ueid, int ebi,
int* esm_cause)
int *esm_cause)
{
LOG_FUNC_IN;
int rc;
LOG_TRACE(INFO, "ESM-PROC - Dedicated EPS bearer context activation "
"accepted by the UE (ueid=%u, ebi=%d)", ueid, ebi);
"accepted by the UE (ueid=%u, ebi=%d)", ueid, ebi);
/* Stop T3485 timer */
rc = esm_ebr_stop_timer(ueid, ebi);
if (rc != RETURNerror) {
/* Set the EPS bearer context state to ACTIVE */
rc = esm_ebr_set_status(ueid, ebi, ESM_EBR_ACTIVE, FALSE);
if (rc != RETURNok) {
/* The EPS bearer context was already in ACTIVE state */
LOG_TRACE(WARNING, "ESM-PROC - EBI %d was already ACTIVE", ebi);
*esm_cause = ESM_CAUSE_PROTOCOL_ERROR;
}
/* Set the EPS bearer context state to ACTIVE */
rc = esm_ebr_set_status(ueid, ebi, ESM_EBR_ACTIVE, FALSE);
if (rc != RETURNok) {
/* The EPS bearer context was already in ACTIVE state */
LOG_TRACE(WARNING, "ESM-PROC - EBI %d was already ACTIVE", ebi);
*esm_cause = ESM_CAUSE_PROTOCOL_ERROR;
}
}
LOG_FUNC_RETURN (rc);
@@ -238,51 +238,51 @@ int esm_proc_dedicated_eps_bearer_context_accept(unsigned int ueid, int ebi,
/****************************************************************************
** **
** Name: esm_proc_dedicated_eps_bearer_context_reject() **
** Name: esm_proc_dedicated_eps_bearer_context_reject() **
** **
** Description: Performs dedicated EPS bearer context activation procedu- **
** re not accepted by the UE. **
** re not accepted by the UE. **
** **
** 3GPP TS 24.301, section 6.4.2.4 **
** Upon receipt of the ACTIVATE DEDICATED EPS BEARER CONTEXT **
** REJECT message, the MME shall stop the timer T3485, enter **
** the state BEARER CONTEXT INACTIVE and abort the dedicated **
** EPS bearer context activation procedure. **
** The MME also requests the lower layer to release the ra- **
** dio resources that were established during the dedicated **
** EPS bearer context activation. **
** 3GPP TS 24.301, section 6.4.2.4 **
** Upon receipt of the ACTIVATE DEDICATED EPS BEARER CONTEXT **
** REJECT message, the MME shall stop the timer T3485, enter **
** the state BEARER CONTEXT INACTIVE and abort the dedicated **
** EPS bearer context activation procedure. **
** The MME also requests the lower layer to release the ra- **
** dio resources that were established during the dedicated **
** EPS bearer context activation. **
** **
** Inputs: ueid: UE local identifier **
** ebi: EPS bearer identity **
** Others: None **
** Inputs: ueid: UE local identifier **
** ebi: EPS bearer identity **
** Others: None **
** **
** Outputs: esm_cause: Cause code returned upon ESM procedure **
** failure **
** Return: RETURNok, RETURNerror **
** Others: None **
** Outputs: esm_cause: Cause code returned upon ESM procedure **
** failure **
** Return: RETURNok, RETURNerror **
** Others: None **
** **
***************************************************************************/
int esm_proc_dedicated_eps_bearer_context_reject(unsigned int ueid, int ebi,
int* esm_cause)
int *esm_cause)
{
LOG_FUNC_IN;
int rc;
LOG_TRACE(WARNING, "ESM-PROC - Dedicated EPS bearer context activation "
"not accepted by the UE (ueid=%u, ebi=%d)", ueid, ebi);
"not accepted by the UE (ueid=%u, ebi=%d)", ueid, ebi);
/* Stop T3485 timer if running */
rc = esm_ebr_stop_timer(ueid, ebi);
if (rc != RETURNerror) {
int pid, bid;
/* Release the dedicated EPS bearer context and enter state INACTIVE */
rc = esm_proc_eps_bearer_context_deactivate(ueid, TRUE, ebi,
&pid, &bid, NULL);
if (rc != RETURNok) {
/* Failed to release the dedicated EPS bearer context */
*esm_cause = ESM_CAUSE_PROTOCOL_ERROR;
}
int pid, bid;
/* Release the dedicated EPS bearer context and enter state INACTIVE */
rc = esm_proc_eps_bearer_context_deactivate(ueid, TRUE, ebi,
&pid, &bid, NULL);
if (rc != RETURNok) {
/* Failed to release the dedicated EPS bearer context */
*esm_cause = ESM_CAUSE_PROTOCOL_ERROR;
}
}
LOG_FUNC_RETURN (rc);
@@ -297,96 +297,93 @@ int esm_proc_dedicated_eps_bearer_context_reject(unsigned int ueid, int ebi,
#ifdef NAS_UE
/****************************************************************************
** **
** Name: esm_proc_dedicated_eps_bearer_context_request() **
** Name: esm_proc_dedicated_eps_bearer_context_request() **
** **
** Description: Creates local dedicated EPS bearer context upon receipt **
** of the ACTIVATE DEDICATED EPS BEARER CONTEXT REQUEST **
** message. **
** of the ACTIVATE DEDICATED EPS BEARER CONTEXT REQUEST **
** message. **
** **
** Inputs: ebi: EPS bearer identity **
** default_ebi: EPS bearer identity of the associated de- **
** fault EPS bearer context **
** esm_qos: EPS bearer level QoS parameters **
** tft: Traffic flow template parameters **
** Others: None **
** Inputs: ebi: EPS bearer identity **
** default_ebi: EPS bearer identity of the associated de- **
** fault EPS bearer context **
** esm_qos: EPS bearer level QoS parameters **
** tft: Traffic flow template parameters **
** Others: None **
** **
** Outputs: esm_cause: Cause code returned upon ESM procedure **
** failure **
** Return: RETURNok, RETURNerror **
** Others: None **
** Outputs: esm_cause: Cause code returned upon ESM procedure **
** failure **
** Return: RETURNok, RETURNerror **
** Others: None **
** **
***************************************************************************/
int esm_proc_dedicated_eps_bearer_context_request(int ebi, int default_ebi,
const esm_proc_qos_t* qos,
const esm_proc_tft_t* tft,
int* esm_cause)
const esm_proc_qos_t *qos,
const esm_proc_tft_t *tft,
int *esm_cause)
{
LOG_FUNC_IN;
int rc = RETURNerror;
LOG_TRACE(INFO, "ESM-PROC - Dedicated EPS bearer context activation "
"requested by the network (ebi=%d)", ebi);
"requested by the network (ebi=%d)", ebi);
/* Get the PDN connection the dedicated EPS bearer is linked to */
int pid = esm_ebr_context_get_pid(default_ebi);
if (pid < 0) {
/* 3GPP TS 24.301, section 6.4.2.5, abnormal case c
* No default EPS bearer context with linked EPS bearer identity
* activated
*/
LOG_TRACE(WARNING, "ESM-PROC - Failed to get PDN connection the "
"dedicated EPS bearer is linked to (ebi=%d)", default_ebi);
*esm_cause = ESM_CAUSE_INVALID_EPS_BEARER_IDENTITY;
LOG_FUNC_RETURN (RETURNerror);
/* 3GPP TS 24.301, section 6.4.2.5, abnormal case c
* No default EPS bearer context with linked EPS bearer identity
* activated
*/
LOG_TRACE(WARNING, "ESM-PROC - Failed to get PDN connection the "
"dedicated EPS bearer is linked to (ebi=%d)", default_ebi);
*esm_cause = ESM_CAUSE_INVALID_EPS_BEARER_IDENTITY;
LOG_FUNC_RETURN (RETURNerror);
}
/* Assign dedicated EPS bearer context */
int new_ebi = esm_ebr_assign(ebi, pid+1, FALSE);
if (new_ebi == ESM_EBI_UNASSIGNED) {
/* 3GPP TS 24.301, section 6.4.2.5, abnormal cases a and b
* Dedicated EPS bearer context activation request for an already
* activated default or dedicated EPS bearer context
*/
int old_pid, old_bid;
/* Locally deactivate the existing EPS bearer context and proceed
* with the requested dedicated EPS bearer context activation */
rc = esm_proc_eps_bearer_context_deactivate(TRUE, ebi,
&old_pid, &old_bid);
if (rc != RETURNok) {
/* Failed to release EPS bearer context */
*esm_cause = ESM_CAUSE_PROTOCOL_ERROR;
}
else {
/* Assign new dedicated EPS bearer context */
ebi = esm_ebr_assign(ebi, pid+1, FALSE);
}
/* 3GPP TS 24.301, section 6.4.2.5, abnormal cases a and b
* Dedicated EPS bearer context activation request for an already
* activated default or dedicated EPS bearer context
*/
int old_pid, old_bid;
/* Locally deactivate the existing EPS bearer context and proceed
* with the requested dedicated EPS bearer context activation */
rc = esm_proc_eps_bearer_context_deactivate(TRUE, ebi,
&old_pid, &old_bid);
if (rc != RETURNok) {
/* Failed to release EPS bearer context */
*esm_cause = ESM_CAUSE_PROTOCOL_ERROR;
} else {
/* Assign new dedicated EPS bearer context */
ebi = esm_ebr_assign(ebi, pid+1, FALSE);
}
}
if (ebi != ESM_EBI_UNASSIGNED) {
/* Check syntactical errors in packet filters */
rc = esm_ebr_context_check_tft(pid, ebi, tft,
ESM_EBR_CONTEXT_TFT_CREATE);
if (rc != RETURNok) {
/* Syntactical errors in packet filters */
LOG_TRACE(WARNING, "ESM-PROC - Syntactical errors in packet "
"filters");
*esm_cause = ESM_CAUSE_SYNTACTICAL_ERROR_IN_PACKET_FILTER;
}
else {
/* Create new dedicated EPS bearer context */
default_ebi = esm_ebr_context_create(pid, ebi, FALSE, qos, tft);
if (default_ebi != ESM_EBI_UNASSIGNED) {
/* Dedicated EPS bearer contextx successfully created */
rc = RETURNok;
}
else {
/* No resource available */
LOG_TRACE(WARNING, "ESM-PROC - Failed to create new dedicated "
"EPS bearer context");
*esm_cause = ESM_CAUSE_INSUFFICIENT_RESOURCES;
}
}
/* Check syntactical errors in packet filters */
rc = esm_ebr_context_check_tft(pid, ebi, tft,
ESM_EBR_CONTEXT_TFT_CREATE);
if (rc != RETURNok) {
/* Syntactical errors in packet filters */
LOG_TRACE(WARNING, "ESM-PROC - Syntactical errors in packet "
"filters");
*esm_cause = ESM_CAUSE_SYNTACTICAL_ERROR_IN_PACKET_FILTER;
} else {
/* Create new dedicated EPS bearer context */
default_ebi = esm_ebr_context_create(pid, ebi, FALSE, qos, tft);
if (default_ebi != ESM_EBI_UNASSIGNED) {
/* Dedicated EPS bearer contextx successfully created */
rc = RETURNok;
} else {
/* No resource available */
LOG_TRACE(WARNING, "ESM-PROC - Failed to create new dedicated "
"EPS bearer context");
*esm_cause = ESM_CAUSE_INSUFFICIENT_RESOURCES;
}
}
}
LOG_FUNC_RETURN (rc);
@@ -394,37 +391,37 @@ int esm_proc_dedicated_eps_bearer_context_request(int ebi, int default_ebi,
/****************************************************************************
** **
** Name: esm_proc_dedicated_eps_bearer_context_accept() **
** Name: esm_proc_dedicated_eps_bearer_context_accept() **
** **
** Description: Performs dedicated EPS bearer context activation proce- **
** dure accepted by the UE. **
** dure accepted by the UE. **
** **
** 3GPP TS 24.301, section 6.4.2.3 **
** The UE accepts dedicated EPS bearer context activation by **
** sending ACTIVATE DEDICATED EPS BEARER CONTEXT ACCEPT mes- **
** sage and entering the state BEARER CONTEXT ACTIVE. **
** 3GPP TS 24.301, section 6.4.2.3 **
** The UE accepts dedicated EPS bearer context activation by **
** sending ACTIVATE DEDICATED EPS BEARER CONTEXT ACCEPT mes- **
** sage and entering the state BEARER CONTEXT ACTIVE. **
** **
** Inputs: is_standalone: Not used **
** ebi: EPS bearer identity **
** msg: Encoded ESM message to be sent **
** ue_triggered: TRUE if the EPS bearer context procedure **
** was triggered by the UE **
** Others: None **
** Inputs: is_standalone: Not used **
** ebi: EPS bearer identity **
** msg: Encoded ESM message to be sent **
** ue_triggered: TRUE if the EPS bearer context procedure **
** was triggered by the UE **
** Others: None **
** **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: None **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: None **
** **
***************************************************************************/
int esm_proc_dedicated_eps_bearer_context_accept(int is_standalone, int ebi,
OctetString* msg, int ue_triggered)
OctetString *msg, int ue_triggered)
{
LOG_FUNC_IN;
int rc;
LOG_TRACE(INFO,"ESM-PROC - Dedicated EPS bearer context activation "
"accepted by the UE (ebi=%d)", ebi);
"accepted by the UE (ebi=%d)", ebi);
emm_sap_t emm_sap;
emm_esm_data_t *emm_esm = &emm_sap.u.emm_esm.u.data;
@@ -438,15 +435,15 @@ int esm_proc_dedicated_eps_bearer_context_accept(int is_standalone, int ebi,
rc = emm_sap_send(&emm_sap);
if (rc != RETURNerror) {
/* Set the EPS bearer context state to ACTIVE */
rc = esm_ebr_set_status(ebi, ESM_EBR_ACTIVE, ue_triggered);
if (rc != RETURNok) {
/* The EPS bearer context was already in ACTIVE state */
LOG_TRACE(WARNING, "ESM-PROC - EBI %d was already ACTIVE", ebi);
/* Accept network retransmission of already accepted activate
* dedicated EPS bearer context request */
LOG_FUNC_RETURN (RETURNok);
}
/* Set the EPS bearer context state to ACTIVE */
rc = esm_ebr_set_status(ebi, ESM_EBR_ACTIVE, ue_triggered);
if (rc != RETURNok) {
/* The EPS bearer context was already in ACTIVE state */
LOG_TRACE(WARNING, "ESM-PROC - EBI %d was already ACTIVE", ebi);
/* Accept network retransmission of already accepted activate
* dedicated EPS bearer context request */
LOG_FUNC_RETURN (RETURNok);
}
}
LOG_FUNC_RETURN (rc);
@@ -454,56 +451,55 @@ int esm_proc_dedicated_eps_bearer_context_accept(int is_standalone, int ebi,
/****************************************************************************
** **
** Name: esm_proc_dedicated_eps_bearer_context_reject() **
** Name: esm_proc_dedicated_eps_bearer_context_reject() **
** **
** Description: Performs dedicated EPS bearer context activation proce- **
** dure not accepted by the UE. **
** dure not accepted by the UE. **
** **
** 3GPP TS 24.301, section 6.4.2.4 **
** The UE rejects dedicated EPS bearer context activation by **
** sending ACTIVATE DEDICATED EPS BEARER CONTEXT REJECT mes- **
** sage. **
** 3GPP TS 24.301, section 6.4.2.4 **
** The UE rejects dedicated EPS bearer context activation by **
** sending ACTIVATE DEDICATED EPS BEARER CONTEXT REJECT mes- **
** sage. **
** **
** Inputs: is_standalone: Not used **
** ebi: EPS bearer identity **
** msg: Encoded ESM message to be sent **
** ue_triggered: Not used **
** Others: None **
** Inputs: is_standalone: Not used **
** ebi: EPS bearer identity **
** msg: Encoded ESM message to be sent **
** ue_triggered: Not used **
** Others: None **
** **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: None **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: None **
** **
***************************************************************************/
int esm_proc_dedicated_eps_bearer_context_reject(int is_standalone, int ebi,
OctetString* msg, int ue_triggered)
OctetString *msg, int ue_triggered)
{
LOG_FUNC_IN;
int rc = RETURNok;
LOG_TRACE(WARNING, "ESM-PROC - Dedicated EPS bearer context activation "
"not accepted by the UE (ebi=%d)", ebi);
"not accepted by the UE (ebi=%d)", ebi);
if ( !esm_ebr_is_not_in_use(ebi) ) {
/* Release EPS bearer data currently in use */
rc = esm_ebr_release(ebi);
/* Release EPS bearer data currently in use */
rc = esm_ebr_release(ebi);
}
if (rc != RETURNok) {
LOG_TRACE(WARNING, "ESM-PROC - Failed to release EPS bearer data");
}
else {
emm_sap_t emm_sap;
emm_esm_data_t *emm_esm = &emm_sap.u.emm_esm.u.data;
/*
* Notity EMM that ESM PDU has to be forwarded to lower layers
*/
emm_sap.primitive = EMMESM_UNITDATA_REQ;
emm_sap.u.emm_esm.ueid = 0;
emm_esm->msg.length = msg->length;
emm_esm->msg.value = msg->value;
rc = emm_sap_send(&emm_sap);
LOG_TRACE(WARNING, "ESM-PROC - Failed to release EPS bearer data");
} else {
emm_sap_t emm_sap;
emm_esm_data_t *emm_esm = &emm_sap.u.emm_esm.u.data;
/*
* Notity EMM that ESM PDU has to be forwarded to lower layers
*/
emm_sap.primitive = EMMESM_UNITDATA_REQ;
emm_sap.u.emm_esm.ueid = 0;
emm_esm->msg.length = msg->length;
emm_esm->msg.value = msg->value;
rc = emm_sap_send(&emm_sap);
}
LOG_FUNC_RETURN (rc);
@@ -516,68 +512,67 @@ int esm_proc_dedicated_eps_bearer_context_reject(int is_standalone, int ebi,
/*
* --------------------------------------------------------------------------
* Timer handlers
* Timer handlers
* --------------------------------------------------------------------------
*/
#ifdef NAS_MME
/****************************************************************************
** **
** Name: _dedicated_eps_bearer_activate_t3485_handler() **
** Name: _dedicated_eps_bearer_activate_t3485_handler() **
** **
** Description: T3485 timeout handler **
** **
** 3GPP TS 24.301, section 6.4.2.6, case a **
** On the first expiry of the timer T3485, the MME shall re- **
** send the ACTIVATE DEDICATED EPS BEARER CONTEXT REQUEST **
** and shall reset and restart timer T3485. This retransmis- **
** sion is repeated four times, i.e. on the fifth expiry of **
** timer T3485, the MME shall abort the procedure, release **
** any resources allocated for this activation and enter the **
** state BEARER CONTEXT INACTIVE. **
** On the first expiry of the timer T3485, the MME shall re- **
** send the ACTIVATE DEDICATED EPS BEARER CONTEXT REQUEST **
** and shall reset and restart timer T3485. This retransmis- **
** sion is repeated four times, i.e. on the fifth expiry of **
** timer T3485, the MME shall abort the procedure, release **
** any resources allocated for this activation and enter the **
** state BEARER CONTEXT INACTIVE. **
** **
** Inputs: args: handler parameters **
** Others: None **
** Inputs: args: handler parameters **
** Others: None **
** **
** Outputs: None **
** Return: None **
** Others: None **
** Outputs: None **
** Return: None **
** Others: None **
** **
***************************************************************************/
static void* _dedicated_eps_bearer_activate_t3485_handler(void* args)
static void *_dedicated_eps_bearer_activate_t3485_handler(void *args)
{
LOG_FUNC_IN;
int rc;
/* Get retransmission timer parameters data */
esm_ebr_timer_data_t* data = (esm_ebr_timer_data_t*)(args);
esm_ebr_timer_data_t *data = (esm_ebr_timer_data_t *)(args);
/* Increment the retransmission counter */
data->count += 1;
LOG_TRACE(WARNING, "ESM-PROC - T3485 timer expired (ueid=%d, ebi=%d), "
"retransmission counter = %d",
data->ueid, data->ebi, data->count);
"retransmission counter = %d",
data->ueid, data->ebi, data->count);
if (data->count < DEDICATED_EPS_BEARER_ACTIVATE_COUNTER_MAX) {
/* Re-send activate dedicated EPS bearer context request message
* to the UE */
rc = _dedicated_eps_bearer_activate(data->ueid, data->ebi, &data->msg);
}
else {
/*
* The maximum number of activate dedicated EPS bearer context request
* message retransmission has exceed
*/
int pid, bid;
/* Release the dedicated EPS bearer context and enter state INACTIVE */
rc = esm_proc_eps_bearer_context_deactivate(data->ueid, TRUE,
data->ebi, &pid, &bid,
NULL);
if (rc != RETURNerror) {
/* Stop timer T3485 */
rc = esm_ebr_stop_timer(data->ueid, data->ebi);
}
/* Re-send activate dedicated EPS bearer context request message
* to the UE */
rc = _dedicated_eps_bearer_activate(data->ueid, data->ebi, &data->msg);
} else {
/*
* The maximum number of activate dedicated EPS bearer context request
* message retransmission has exceed
*/
int pid, bid;
/* Release the dedicated EPS bearer context and enter state INACTIVE */
rc = esm_proc_eps_bearer_context_deactivate(data->ueid, TRUE,
data->ebi, &pid, &bid,
NULL);
if (rc != RETURNerror) {
/* Stop timer T3485 */
rc = esm_ebr_stop_timer(data->ueid, data->ebi);
}
}
LOG_FUNC_RETURN (NULL);
@@ -585,29 +580,29 @@ static void* _dedicated_eps_bearer_activate_t3485_handler(void* args)
/*
* --------------------------------------------------------------------------
* MME specific local functions
* MME specific local functions
* --------------------------------------------------------------------------
*/
/****************************************************************************
** **
** Name: _dedicated_eps_bearer_activate() **
** Name: _dedicated_eps_bearer_activate() **
** **
** Description: Sends ACTIVATE DEDICATED EPS BEREAR CONTEXT REQUEST mes- **
** sage and starts timer T3485 **
** sage and starts timer T3485 **
** **
** Inputs: ueid: UE local identifier **
** ebi: EPS bearer identity **
** msg: Encoded ESM message to be sent **
** Others: None **
** Inputs: ueid: UE local identifier **
** ebi: EPS bearer identity **
** msg: Encoded ESM message to be sent **
** Others: None **
** **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: T3485 **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: T3485 **
** **
***************************************************************************/
static int _dedicated_eps_bearer_activate(unsigned int ueid, int ebi,
const OctetString* msg)
const OctetString *msg)
{
LOG_FUNC_IN;
@@ -625,9 +620,9 @@ static int _dedicated_eps_bearer_activate(unsigned int ueid, int ebi,
rc = emm_sap_send(&emm_sap);
if (rc != RETURNerror) {
/* Start T3485 retransmission timer */
rc = esm_ebr_start_timer(ueid, ebi, msg, T3485_DEFAULT_VALUE,
_dedicated_eps_bearer_activate_t3485_handler);
/* Start T3485 retransmission timer */
rc = esm_ebr_start_timer(ueid, ebi, msg, T3485_DEFAULT_VALUE,
_dedicated_eps_bearer_activate_t3485_handler);
}
LOG_FUNC_RETURN (rc);
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -1,29 +1,29 @@
/*****************************************************************************
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Source EsmStatus.c
Source EsmStatus.c
Version 0.1
Version 0.1
Date 2013/06/17
Date 2013/06/17
Product NAS stack
Product NAS stack
Subsystem EPS Session Management
Subsystem EPS Session Management
Author Frederic Maurel
Author Frederic Maurel
Description Defines the ESM status procedure executed by the Non-Access
Stratum.
Description Defines the ESM status procedure executed by the Non-Access
Stratum.
ESM status procedure can be related to an EPS bearer context
or to a procedure transaction.
ESM status procedure can be related to an EPS bearer context
or to a procedure transaction.
The purpose of the sending of the ESM STATUS message is to
report at any time certain error conditions detected upon
receipt of ESM protocol data. The ESM STATUS message can be
sent by both the MME and the UE.
The purpose of the sending of the ESM STATUS message is to
report at any time certain error conditions detected upon
receipt of ESM protocol data. The ESM STATUS message can be
sent by both the MME and the UE.
*****************************************************************************/
@@ -49,81 +49,80 @@ Description Defines the ESM status procedure executed by the Non-Access
/****************************************************************************
** **
** Name: esm_proc_status_ind() **
** Name: esm_proc_status_ind() **
** **
** Description: Processes received ESM status message. **
** **
** 3GPP TS 24.301, section 6.7 **
** Upon receiving ESM Status message the UE/MME shall take **
** different actions depending on the received ESM cause **
** value. **
** 3GPP TS 24.301, section 6.7 **
** Upon receiving ESM Status message the UE/MME shall take **
** different actions depending on the received ESM cause **
** value. **
** **
** Inputs: ueid: UE lower layer identifier **
** pti: Procedure transaction identity **
** ebi: EPS bearer identity **
** esm_cause: Received ESM cause code **
** failure **
** Others: None **
** Inputs: ueid: UE lower layer identifier **
** pti: Procedure transaction identity **
** ebi: EPS bearer identity **
** esm_cause: Received ESM cause code **
** failure **
** Others: None **
** **
** Outputs: esm_cause: Cause code returned upon ESM procedure **
** failure **
** Return: RETURNok, RETURNerror **
** Others: None **
** Outputs: esm_cause: Cause code returned upon ESM procedure **
** failure **
** Return: RETURNok, RETURNerror **
** Others: None **
** **
***************************************************************************/
int esm_proc_status_ind(
#ifdef NAS_MME
unsigned int ueid,
unsigned int ueid,
#endif
int pti, int ebi, int* esm_cause)
int pti, int ebi, int *esm_cause)
{
LOG_FUNC_IN;
int rc;
LOG_TRACE(INFO,"ESM-PROC - ESM status procedure requested (cause=%d)",
*esm_cause);
*esm_cause);
LOG_TRACE(DEBUG, "ESM-PROC - To be implemented");
switch (*esm_cause)
{
case ESM_CAUSE_INVALID_EPS_BEARER_IDENTITY:
/*
* Abort any ongoing ESM procedure related to the received EPS
* bearer identity, stop any related timer, and deactivate the
* corresponding EPS bearer context locally
*/
/* TODO */
rc = RETURNok;
break;
switch (*esm_cause) {
case ESM_CAUSE_INVALID_EPS_BEARER_IDENTITY:
/*
* Abort any ongoing ESM procedure related to the received EPS
* bearer identity, stop any related timer, and deactivate the
* corresponding EPS bearer context locally
*/
/* TODO */
rc = RETURNok;
break;
case ESM_CAUSE_INVALID_PTI_VALUE:
/*
* Abort any ongoing ESM procedure related to the received PTI
* value and stop any related timer
*/
/* TODO */
rc = RETURNok;
break;
case ESM_CAUSE_INVALID_PTI_VALUE:
/*
* Abort any ongoing ESM procedure related to the received PTI
* value and stop any related timer
*/
/* TODO */
rc = RETURNok;
break;
case ESM_CAUSE_MESSAGE_TYPE_NOT_IMPLEMENTED:
/*
* Abort any ongoing ESM procedure related to the PTI or
* EPS bearer identity and stop any related timer
*/
/* TODO */
rc = RETURNok;
break;
case ESM_CAUSE_MESSAGE_TYPE_NOT_IMPLEMENTED:
/*
* Abort any ongoing ESM procedure related to the PTI or
* EPS bearer identity and stop any related timer
*/
/* TODO */
rc = RETURNok;
break;
default:
/*
* No state transition and no specific action shall be taken;
* local actions are possible
*/
/* TODO */
rc = RETURNok;
break;
default:
/*
* No state transition and no specific action shall be taken;
* local actions are possible
*/
/* TODO */
rc = RETURNok;
break;
}
LOG_FUNC_RETURN (rc);
@@ -131,28 +130,28 @@ int esm_proc_status_ind(
/****************************************************************************
** **
** Name: esm_proc_status() **
** Name: esm_proc_status() **
** **
** Description: Initiates ESM status procedure. **
** **
** Inputs: is_standalone: Not used - Always TRUE **
** ueid: UE lower layer identifier **
** ebi: Not used **
** msg: Encoded ESM status message to be sent **
** ue_triggered: Not used **
** Others: None **
** Inputs: is_standalone: Not used - Always TRUE **
** ueid: UE lower layer identifier **
** ebi: Not used **
** msg: Encoded ESM status message to be sent **
** ue_triggered: Not used **
** Others: None **
** **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: None **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: None **
** **
***************************************************************************/
int esm_proc_status(int is_standalone,
#ifdef NAS_MME
unsigned int ueid,
unsigned int ueid,
#endif
int ebi, OctetString* msg,
int ue_triggered)
int ebi, OctetString *msg,
int ue_triggered)
{
LOG_FUNC_IN;
File diff suppressed because it is too large Load Diff
+344 -354
View File
@@ -1,27 +1,27 @@
/*****************************************************************************
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Source PdnDisconnect.c
Source PdnDisconnect.c
Version 0.1
Version 0.1
Date 2013/05/15
Date 2013/05/15
Product NAS stack
Product NAS stack
Subsystem EPS Session Management
Subsystem EPS Session Management
Author Frederic Maurel
Author Frederic Maurel
Description Defines the PDN disconnect ESM procedure executed by the
Non-Access Stratum.
Description Defines the PDN disconnect ESM procedure executed by the
Non-Access Stratum.
The PDN disconnect procedure is used by the UE to request
disconnection from one PDN.
The PDN disconnect procedure is used by the UE to request
disconnection from one PDN.
All EPS bearer contexts established towards this PDN, inclu-
ding the default EPS bearer context, are released.
All EPS bearer contexts established towards this PDN, inclu-
ding the default EPS bearer context, are released.
*****************************************************************************/
@@ -53,7 +53,7 @@ extern int _pdn_connectivity_delete(unsigned int ueid, int pid);
/*
* --------------------------------------------------------------------------
* Internal data handled by the PDN disconnect procedure in the UE
* Internal data handled by the PDN disconnect procedure in the UE
* --------------------------------------------------------------------------
*/
#ifdef NAS_UE
@@ -65,7 +65,7 @@ static int _pdn_disconnect_get_default_ebi(int pti);
/*
* Timer handlers
*/
static void* _pdn_disconnect_t3492_handler(void*);
static void *_pdn_disconnect_t3492_handler(void *);
/* Maximum value of the PDN disconnect request retransmission counter */
#define ESM_PDN_DISCONNECT_COUNTER_MAX 5
@@ -74,7 +74,7 @@ static void* _pdn_disconnect_t3492_handler(void*);
/*
* --------------------------------------------------------------------------
* Internal data handled by the PDN disconnect procedure in the MME
* Internal data handled by the PDN disconnect procedure in the MME
* --------------------------------------------------------------------------
*/
#ifdef NAS_MME
@@ -91,31 +91,31 @@ static int _pdn_disconnect_get_pid(unsigned int ueid, int pti);
/*
* --------------------------------------------------------------------------
* PDN disconnect procedure executed by the UE
* PDN disconnect procedure executed by the UE
* --------------------------------------------------------------------------
*/
#ifdef NAS_UE
/****************************************************************************
** **
** Name: esm_proc_pdn_disconnect() **
** Name: esm_proc_pdn_disconnect() **
** **
** Description: Return the procedure transaction identity assigned to the **
** PDN connection and the EPS bearer identity of the default **
** bearer associated to the PDN context with specified iden- **
** tifier **
** PDN connection and the EPS bearer identity of the default **
** bearer associated to the PDN context with specified iden- **
** tifier **
** **
** Inputs: cid: PDN context identifier **
** Others: _esm_data **
** Inputs: cid: PDN context identifier **
** Others: _esm_data **
** **
** Outputs: pti: Procedure transaction identity assigned to **
** the PDN connection to be released **
** ebi: EPS bearer identity of the default bearer **
** associated to the specified PDN context **
** Return: RETURNok, RETURNerror **
** Others: None **
** Outputs: pti: Procedure transaction identity assigned to **
** the PDN connection to be released **
** ebi: EPS bearer identity of the default bearer **
** associated to the specified PDN context **
** Return: RETURNok, RETURNerror **
** Others: None **
** **
***************************************************************************/
int esm_proc_pdn_disconnect(int cid, unsigned int* pti, unsigned int* ebi)
int esm_proc_pdn_disconnect(int cid, unsigned int *pti, unsigned int *ebi)
{
LOG_FUNC_IN;
@@ -123,26 +123,23 @@ int esm_proc_pdn_disconnect(int cid, unsigned int* pti, unsigned int* ebi)
int pid = cid - 1;
if (pid < ESM_DATA_PDN_MAX) {
if (pid != _esm_data.pdn[pid].pid) {
LOG_TRACE(WARNING, "ESM-PROC - PDN connection identifier %d is "
"not valid", pid);
}
else if (_esm_data.pdn[pid].data == NULL) {
LOG_TRACE(ERROR, "ESM-PROC - PDN connection %d has not been "
"allocated", pid);
}
else if (!_esm_data.pdn[pid].is_active) {
LOG_TRACE(WARNING, "ESM-PROC - PDN connection is not active");
}
else {
/* Get the procedure transaction identity assigned to the PDN
* connection to be released */
*pti = _esm_data.pdn[pid].data->pti;
/* Get the EPS bearer identity of the default bearer associated
* with the PDN to disconnect from */
*ebi = _esm_data.pdn[pid].data->bearer[0]->ebi;
rc = RETURNok;
}
if (pid != _esm_data.pdn[pid].pid) {
LOG_TRACE(WARNING, "ESM-PROC - PDN connection identifier %d is "
"not valid", pid);
} else if (_esm_data.pdn[pid].data == NULL) {
LOG_TRACE(ERROR, "ESM-PROC - PDN connection %d has not been "
"allocated", pid);
} else if (!_esm_data.pdn[pid].is_active) {
LOG_TRACE(WARNING, "ESM-PROC - PDN connection is not active");
} else {
/* Get the procedure transaction identity assigned to the PDN
* connection to be released */
*pti = _esm_data.pdn[pid].data->pti;
/* Get the EPS bearer identity of the default bearer associated
* with the PDN to disconnect from */
*ebi = _esm_data.pdn[pid].data->bearer[0]->ebi;
rc = RETURNok;
}
}
LOG_FUNC_RETURN(rc);
@@ -150,30 +147,30 @@ int esm_proc_pdn_disconnect(int cid, unsigned int* pti, unsigned int* ebi)
/****************************************************************************
** **
** Name: esm_proc_pdn_disconnect_request() **
** Name: esm_proc_pdn_disconnect_request() **
** **
** Description: Initiates PDN disconnection procedure in order to request **
** disconnection from a PDN. **
** disconnection from a PDN. **
** **
** 3GPP TS 24.301, section 6.5.2.2 **
** The UE requests PDN disconnection from a PDN by sending a **
** PDN DISCONNECT REQUEST message to the MME, starting timer **
** T3492 and entering state PROCEDURE TRANSACTION PENDING. **
** The UE requests PDN disconnection from a PDN by sending a **
** PDN DISCONNECT REQUEST message to the MME, starting timer **
** T3492 and entering state PROCEDURE TRANSACTION PENDING. **
** **
** Inputs: is_standalone: Should be always TRUE **
** pti: Procedure transaction identity **
** msg: Encoded PDN disconnect request message to **
** be sent **
** sent_by_ue: Not used **
** Others: None **
** Inputs: is_standalone: Should be always TRUE **
** pti: Procedure transaction identity **
** msg: Encoded PDN disconnect request message to **
** be sent **
** sent_by_ue: Not used **
** Others: None **
** **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: None **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: None **
** **
***************************************************************************/
int esm_proc_pdn_disconnect_request(int is_standalone, int pti,
OctetString* msg, int sent_by_ue)
OctetString *msg, int sent_by_ue)
{
LOG_FUNC_IN;
@@ -181,83 +178,81 @@ int esm_proc_pdn_disconnect_request(int is_standalone, int pti,
LOG_TRACE(INFO, "ESM-PROC - Initiate PDN disconnection (pti=%d)", pti);
if (is_standalone)
{
emm_sap_t emm_sap;
emm_esm_data_t *emm_esm = &emm_sap.u.emm_esm.u.data;
/*
* Notity EMM that ESM PDU has to be forwarded to lower layers
*/
emm_sap.primitive = EMMESM_UNITDATA_REQ;
emm_sap.u.emm_esm.ueid = 0;
emm_esm->msg.length = msg->length;
emm_esm->msg.value = msg->value;
rc = emm_sap_send(&emm_sap);
if (is_standalone) {
emm_sap_t emm_sap;
emm_esm_data_t *emm_esm = &emm_sap.u.emm_esm.u.data;
/*
* Notity EMM that ESM PDU has to be forwarded to lower layers
*/
emm_sap.primitive = EMMESM_UNITDATA_REQ;
emm_sap.u.emm_esm.ueid = 0;
emm_esm->msg.length = msg->length;
emm_esm->msg.value = msg->value;
rc = emm_sap_send(&emm_sap);
if (rc != RETURNerror) {
/* Start T3482 retransmission timer */
rc = esm_pt_start_timer(pti, msg, T3492_DEFAULT_VALUE,
_pdn_disconnect_t3492_handler);
}
if (rc != RETURNerror) {
/* Start T3482 retransmission timer */
rc = esm_pt_start_timer(pti, msg, T3492_DEFAULT_VALUE,
_pdn_disconnect_t3492_handler);
}
}
if (rc != RETURNerror) {
/* Set the procedure transaction state to PENDING */
rc = esm_pt_set_status(pti, ESM_PT_PENDING);
if (rc != RETURNok) {
/* The procedure transaction was already in PENDING state */
LOG_TRACE(WARNING, "ESM-PROC - PTI %d was already PENDING", pti);
}
/* Set the procedure transaction state to PENDING */
rc = esm_pt_set_status(pti, ESM_PT_PENDING);
if (rc != RETURNok) {
/* The procedure transaction was already in PENDING state */
LOG_TRACE(WARNING, "ESM-PROC - PTI %d was already PENDING", pti);
}
}
LOG_FUNC_RETURN(rc);
}
/****************************************************************************
** **
** Name: esm_proc_pdn_disconnect_accept() **
** Name: esm_proc_pdn_disconnect_accept() **
** **
** Description: Performs PDN disconnection procedure accepted by the net- **
** work. **
** work. **
** **
** 3GPP TS 24.301, section 6.5.2.3 **
** The shall stop timer T3492 and enter the state PROCEDURE **
** TRANSACTION INACTIVE. **
** The shall stop timer T3492 and enter the state PROCEDURE **
** TRANSACTION INACTIVE. **
** **
** Inputs: pti: Identifies the UE requested PDN disconnect **
** procedure accepted by the network **
** Others: None **
** Inputs: pti: Identifies the UE requested PDN disconnect **
** procedure accepted by the network **
** Others: None **
** **
** Outputs: esm_cause: Cause code returned upon ESM procedure **
** failure **
** Return: The identifier of the PDN context to de- **
** activate when successfully found; **
** RETURNerror otherwise. **
** Others: None **
** Outputs: esm_cause: Cause code returned upon ESM procedure **
** failure **
** Return: The identifier of the PDN context to de- **
** activate when successfully found; **
** RETURNerror otherwise. **
** Others: None **
** **
***************************************************************************/
int esm_proc_pdn_disconnect_accept(int pti, int* esm_cause)
int esm_proc_pdn_disconnect_accept(int pti, int *esm_cause)
{
LOG_FUNC_IN;
LOG_TRACE(INFO, "ESM-PROC - PDN disconnection accepted by the network "
"(pti=%d)", pti);
"(pti=%d)", pti);
/* Stop T3492 timer if running */
(void) esm_pt_stop_timer(pti);
/* Set the procedure transaction state to INACTIVE */
int rc = esm_pt_set_status(pti, ESM_PT_INACTIVE);
if (rc != RETURNok) {
/* The procedure transaction was already in INACTIVE state */
LOG_TRACE(WARNING, "ESM-PROC - PTI %d was already INACTIVE", pti);
*esm_cause = ESM_CAUSE_MESSAGE_TYPE_NOT_COMPATIBLE;
}
else {
/* Immediately release the transaction identity assigned to this
* procedure */
rc = esm_pt_release(pti);
if (rc != RETURNok) {
LOG_TRACE(WARNING, "ESM-PROC - Failed to release PTI %d", pti);
}
/* The procedure transaction was already in INACTIVE state */
LOG_TRACE(WARNING, "ESM-PROC - PTI %d was already INACTIVE", pti);
*esm_cause = ESM_CAUSE_MESSAGE_TYPE_NOT_COMPATIBLE;
} else {
/* Immediately release the transaction identity assigned to this
* procedure */
rc = esm_pt_release(pti);
if (rc != RETURNok) {
LOG_TRACE(WARNING, "ESM-PROC - Failed to release PTI %d", pti);
}
}
LOG_FUNC_RETURN (rc);
@@ -265,79 +260,76 @@ int esm_proc_pdn_disconnect_accept(int pti, int* esm_cause)
/****************************************************************************
** **
** Name: esm_proc_pdn_disconnect_reject() **
** Name: esm_proc_pdn_disconnect_reject() **
** **
** Description: Performs PDN disconnection procedure not accepted by the **
** network. **
** network. **
** **
** 3GPP TS 24.301, section 6.5.2.4 **
** Upon receipt of the PDN DISCONNECT REJECT message, the UE **
** shall stop timer T3492 and enter the state PROCEDURE **
** TRANSACTION INACTIVE and abort the PDN disconnection pro- **
** cedure. **
** Upon receipt of the PDN DISCONNECT REJECT message, the UE **
** shall stop timer T3492 and enter the state PROCEDURE **
** TRANSACTION INACTIVE and abort the PDN disconnection pro- **
** cedure. **
** **
** Inputs: pti: Identifies the UE requested PDN disconnec- **
** tion procedure rejected by the network **
** Others: None **
** Inputs: pti: Identifies the UE requested PDN disconnec- **
** tion procedure rejected by the network **
** Others: None **
** **
** Outputs: esm_cause: Cause code returned upon ESM procedure **
** failure **
** Return: RETURNok, RETURNerror **
** Others: None **
** Outputs: esm_cause: Cause code returned upon ESM procedure **
** failure **
** Return: RETURNok, RETURNerror **
** Others: None **
** **
***************************************************************************/
int esm_proc_pdn_disconnect_reject(int pti, int* esm_cause)
int esm_proc_pdn_disconnect_reject(int pti, int *esm_cause)
{
LOG_FUNC_IN;
int rc;
LOG_TRACE(WARNING, "ESM-PROC - PDN disconnection rejected by the network "
"(pti=%d), ESM cause = %d", pti, *esm_cause);
"(pti=%d), ESM cause = %d", pti, *esm_cause);
/* Stop T3492 timer if running */
(void) esm_pt_stop_timer(pti);
/* Set the procedure transaction state to INACTIVE */
rc = esm_pt_set_status(pti, ESM_PT_INACTIVE);
if (rc != RETURNok) {
/* The procedure transaction was already in INACTIVE state
* as the request may have already been rejected */
LOG_TRACE(WARNING, "ESM-PROC - PTI %d was already INACTIVE", pti);
*esm_cause = ESM_CAUSE_MESSAGE_TYPE_NOT_COMPATIBLE;
}
else {
/* Release the transaction identity assigned to this procedure */
rc = esm_pt_release(pti);
if (rc != RETURNok) {
LOG_TRACE(WARNING, "ESM-PROC - Failed to release PTI %d", pti);
*esm_cause = ESM_CAUSE_REQUEST_REJECTED_UNSPECIFIED;
}
else if (*esm_cause != ESM_CAUSE_LAST_PDN_DISCONNECTION_NOT_ALLOWED)
{
/* Get the identity of the default EPS bearer context allocated to
* the PDN connection entry assigned to this procedure transaction */
int ebi = _pdn_disconnect_get_default_ebi(pti);
if (ebi < 0) {
LOG_TRACE(ERROR, "ESM-PROC - No default EPS bearer found");
*esm_cause = ESM_CAUSE_PROTOCOL_ERROR;
LOG_FUNC_RETURN (RETURNerror);
}
/*
* Notify ESM that all EPS bearer contexts to this PDN have to be
* locally deactivated
*/
esm_sap_t esm_sap;
esm_sap.primitive = ESM_EPS_BEARER_CONTEXT_DEACTIVATE_REQ;
esm_sap.is_standalone = TRUE;
esm_sap.recv = NULL;
esm_sap.send.length = 0;
esm_sap.data.eps_bearer_context_deactivate.ebi = ebi;
rc = esm_sap_send(&esm_sap);
/* The procedure transaction was already in INACTIVE state
* as the request may have already been rejected */
LOG_TRACE(WARNING, "ESM-PROC - PTI %d was already INACTIVE", pti);
*esm_cause = ESM_CAUSE_MESSAGE_TYPE_NOT_COMPATIBLE;
} else {
/* Release the transaction identity assigned to this procedure */
rc = esm_pt_release(pti);
if (rc != RETURNok) {
LOG_TRACE(WARNING, "ESM-PROC - Failed to release PTI %d", pti);
*esm_cause = ESM_CAUSE_REQUEST_REJECTED_UNSPECIFIED;
} else if (*esm_cause != ESM_CAUSE_LAST_PDN_DISCONNECTION_NOT_ALLOWED) {
/* Get the identity of the default EPS bearer context allocated to
* the PDN connection entry assigned to this procedure transaction */
int ebi = _pdn_disconnect_get_default_ebi(pti);
if (ebi < 0) {
LOG_TRACE(ERROR, "ESM-PROC - No default EPS bearer found");
*esm_cause = ESM_CAUSE_PROTOCOL_ERROR;
LOG_FUNC_RETURN (RETURNerror);
}
/*
* Notify ESM that all EPS bearer contexts to this PDN have to be
* locally deactivated
*/
esm_sap_t esm_sap;
esm_sap.primitive = ESM_EPS_BEARER_CONTEXT_DEACTIVATE_REQ;
esm_sap.is_standalone = TRUE;
esm_sap.recv = NULL;
esm_sap.send.length = 0;
esm_sap.data.eps_bearer_context_deactivate.ebi = ebi;
rc = esm_sap_send(&esm_sap);
if (rc != RETURNok) {
*esm_cause = ESM_CAUSE_PROTOCOL_ERROR;
}
}
if (rc != RETURNok) {
*esm_cause = ESM_CAUSE_PROTOCOL_ERROR;
}
}
}
LOG_FUNC_RETURN(rc);
@@ -348,67 +340,64 @@ int esm_proc_pdn_disconnect_reject(int pti, int* esm_cause)
/*
* --------------------------------------------------------------------------
* PDN disconnect procedure executed by the MME
* PDN disconnect procedure executed by the MME
* --------------------------------------------------------------------------
*/
#ifdef NAS_MME
/****************************************************************************
** **
** Name: esm_proc_pdn_disconnect_request() **
** Name: esm_proc_pdn_disconnect_request() **
** **
** Description: Performs PDN disconnect procedure requested by the UE. **
** **
** 3GPP TS 24.301, section 6.5.2.3 **
** Upon receipt of the PDN DISCONNECT REQUEST message, if it **
** is accepted by the network, the MME shall initiate the **
** bearer context deactivation procedure. **
** Upon receipt of the PDN DISCONNECT REQUEST message, if it **
** is accepted by the network, the MME shall initiate the **
** bearer context deactivation procedure. **
** **
** Inputs: ueid: UE lower layer identifier **
** pti: Identifies the PDN disconnect procedure **
** requested by the UE **
** Others: _esm_data **
** Inputs: ueid: UE lower layer identifier **
** pti: Identifies the PDN disconnect procedure **
** requested by the UE **
** Others: _esm_data **
** **
** Outputs: esm_cause: Cause code returned upon ESM procedure **
** failure **
** Return: The identifier of the PDN connection to be **
** released, if it exists; **
** RETURNerror otherwise. **
** Others: None **
** Outputs: esm_cause: Cause code returned upon ESM procedure **
** failure **
** Return: The identifier of the PDN connection to be **
** released, if it exists; **
** RETURNerror otherwise. **
** Others: None **
** **
***************************************************************************/
int esm_proc_pdn_disconnect_request(unsigned int ueid, int pti, int* esm_cause)
int esm_proc_pdn_disconnect_request(unsigned int ueid, int pti, int *esm_cause)
{
LOG_FUNC_IN;
int pid = RETURNerror;
LOG_TRACE(INFO, "ESM-PROC - PDN disconnect requested by the UE "
"(ueid=%d, pti=%d)", ueid, pti);
"(ueid=%d, pti=%d)", ueid, pti);
if (ueid < ESM_DATA_NB_UE_MAX)
{
/* Get UE's ESM context */
esm_data_context_t* ctx = _esm_data.ctx[ueid];
if (_esm_data.ctx[ueid] == NULL) {
LOG_TRACE(ERROR, "ESM-PROC - No ESM context exists");
*esm_cause = ESM_CAUSE_PROTOCOL_ERROR;
}
else if (ctx->n_pdns > 1) {
/* Get the identifier of the PDN connection entry assigned to the
* procedure transaction identity */
pid = _pdn_disconnect_get_pid(ueid, pti);
if (pid < 0) {
LOG_TRACE(ERROR, "ESM-PROC - No PDN connection found (pti=%d)",
pti);
*esm_cause = ESM_CAUSE_PROTOCOL_ERROR;
LOG_FUNC_RETURN (RETURNerror);
}
}
else {
/* Attempt to disconnect from the last PDN disconnection
* is not allowed */
*esm_cause = ESM_CAUSE_LAST_PDN_DISCONNECTION_NOT_ALLOWED;
}
if (ueid < ESM_DATA_NB_UE_MAX) {
/* Get UE's ESM context */
esm_data_context_t *ctx = _esm_data.ctx[ueid];
if (_esm_data.ctx[ueid] == NULL) {
LOG_TRACE(ERROR, "ESM-PROC - No ESM context exists");
*esm_cause = ESM_CAUSE_PROTOCOL_ERROR;
} else if (ctx->n_pdns > 1) {
/* Get the identifier of the PDN connection entry assigned to the
* procedure transaction identity */
pid = _pdn_disconnect_get_pid(ueid, pti);
if (pid < 0) {
LOG_TRACE(ERROR, "ESM-PROC - No PDN connection found (pti=%d)",
pti);
*esm_cause = ESM_CAUSE_PROTOCOL_ERROR;
LOG_FUNC_RETURN (RETURNerror);
}
} else {
/* Attempt to disconnect from the last PDN disconnection
* is not allowed */
*esm_cause = ESM_CAUSE_LAST_PDN_DISCONNECTION_NOT_ALLOWED;
}
}
LOG_FUNC_RETURN(pid);
@@ -416,41 +405,41 @@ int esm_proc_pdn_disconnect_request(unsigned int ueid, int pti, int* esm_cause)
/****************************************************************************
** **
** Name: esm_proc_pdn_disconnect_accept() **
** Name: esm_proc_pdn_disconnect_accept() **
** **
** Description: Performs PDN disconnect procedure accepted by the UE. **
** **
** 3GPP TS 24.301, section 6.5.2.3 **
** On reception of DEACTIVATE EPS BEARER CONTEXT ACCEPT mes- **
** sage from the UE, the MME releases all the resources re- **
** served for the PDN in the network. **
** On reception of DEACTIVATE EPS BEARER CONTEXT ACCEPT mes- **
** sage from the UE, the MME releases all the resources re- **
** served for the PDN in the network. **
** **
** Inputs: ueid: UE lower layer identifier **
** pid: Identifier of the PDN connection to be **
** released **
** Others: _esm_data **
** Inputs: ueid: UE lower layer identifier **
** pid: Identifier of the PDN connection to be **
** released **
** Others: _esm_data **
** **
** Outputs: esm_cause: Cause code returned upon ESM procedure **
** failure **
** Return: RETURNok, RETURNerror **
** Others: None **
** Outputs: esm_cause: Cause code returned upon ESM procedure **
** failure **
** Return: RETURNok, RETURNerror **
** Others: None **
** **
***************************************************************************/
int esm_proc_pdn_disconnect_accept(unsigned int ueid, int pid, int* esm_cause)
int esm_proc_pdn_disconnect_accept(unsigned int ueid, int pid, int *esm_cause)
{
LOG_FUNC_IN;
LOG_TRACE(INFO, "ESM-PROC - PDN disconnect accepted by the UE "
"(ueid=%d, pid=%d)", ueid, pid);
"(ueid=%d, pid=%d)", ueid, pid);
/* Release the connectivity with the requested PDN */
int rc = mme_api_unsubscribe(NULL);
if (rc != RETURNerror) {
/* Delete the PDN connection entry */
int pti = _pdn_connectivity_delete(ueid, pid);
if (pti != ESM_PT_UNASSIGNED) {
LOG_FUNC_RETURN (RETURNok);
}
/* Delete the PDN connection entry */
int pti = _pdn_connectivity_delete(ueid, pid);
if (pti != ESM_PT_UNASSIGNED) {
LOG_FUNC_RETURN (RETURNok);
}
}
*esm_cause = ESM_CAUSE_PROTOCOL_ERROR;
LOG_FUNC_RETURN (RETURNerror);
@@ -458,31 +447,31 @@ int esm_proc_pdn_disconnect_accept(unsigned int ueid, int pid, int* esm_cause)
/****************************************************************************
** **
** Name: esm_proc_pdn_disconnect_reject() **
** Name: esm_proc_pdn_disconnect_reject() **
** **
** Description: Performs PDN disconnect procedure not accepted by the **
** network. **
** network. **
** **
** 3GPP TS 24.301, section 6.5.2.4 **
** Upon receipt of the PDN DISCONNECT REQUEST message, if it **
** is not accepted by the network, the MME shall send a PDN **
** DISCONNECT REJECT message to the UE. **
** Upon receipt of the PDN DISCONNECT REQUEST message, if it **
** is not accepted by the network, the MME shall send a PDN **
** DISCONNECT REJECT message to the UE. **
** **
** Inputs: is_standalone: Not used - Always TRUE **
** ueid: UE lower layer identifier **
** ebi: Not used **
** msg: Encoded PDN disconnect reject message to **
** be sent **
** ue_triggered: Not used **
** Others: None **
** Inputs: is_standalone: Not used - Always TRUE **
** ueid: UE lower layer identifier **
** ebi: Not used **
** msg: Encoded PDN disconnect reject message to **
** be sent **
** ue_triggered: Not used **
** Others: None **
** **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: None **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: None **
** **
***************************************************************************/
int esm_proc_pdn_disconnect_reject(int is_standalone, unsigned int ueid,
int ebi, OctetString* msg, int ue_triggered)
int ebi, OctetString *msg, int ue_triggered)
{
LOG_FUNC_IN;
@@ -490,7 +479,7 @@ int esm_proc_pdn_disconnect_reject(int is_standalone, unsigned int ueid,
emm_sap_t emm_sap;
LOG_TRACE(WARNING, "ESM-PROC - PDN disconnect not accepted by the network "
"(ueid=%d)", ueid);
"(ueid=%d)", ueid);
/*
* Notity EMM that ESM PDU has to be forwarded to lower layers
@@ -511,106 +500,103 @@ int esm_proc_pdn_disconnect_reject(int is_standalone, unsigned int ueid,
/*
* --------------------------------------------------------------------------
* Timer handlers
* Timer handlers
* --------------------------------------------------------------------------
*/
#ifdef NAS_UE
/****************************************************************************
** **
** Name: _pdn_disconnect_t3492_handler() **
** Name: _pdn_disconnect_t3492_handler() **
** **
** Description: T3492 timeout handler **
** **
** 3GPP TS 24.301, section 6.5.2.5, case a **
** On the first expiry of the timer T3492, the UE shall re- **
** send the PDN DISCONNECT REQUEST and shall reset and re- **
** start timer T3492. This retransmission is repeated four **
** times, i.e. on the fifth expiry of timer T3492, the UE **
** shall abort the procedure, deactivate all EPS bearer con- **
** texts for this PDN connection locally, release the PTI **
** allocated for this invocation and enter the state PROCE- **
** DURE TRANSACTION INACTIVE. **
** On the first expiry of the timer T3492, the UE shall re- **
** send the PDN DISCONNECT REQUEST and shall reset and re- **
** start timer T3492. This retransmission is repeated four **
** times, i.e. on the fifth expiry of timer T3492, the UE **
** shall abort the procedure, deactivate all EPS bearer con- **
** texts for this PDN connection locally, release the PTI **
** allocated for this invocation and enter the state PROCE- **
** DURE TRANSACTION INACTIVE. **
** **
** Inputs: args: handler parameters **
** Others: None **
** Inputs: args: handler parameters **
** Others: None **
** **
** Outputs: None **
** Return: None **
** Others: None **
** Outputs: None **
** Return: None **
** Others: None **
** **
***************************************************************************/
static void* _pdn_disconnect_t3492_handler(void* args)
static void *_pdn_disconnect_t3492_handler(void *args)
{
LOG_FUNC_IN;
int rc;
/* Get retransmission timer parameters data */
esm_pt_timer_data_t* data = (esm_pt_timer_data_t*)(args);
esm_pt_timer_data_t *data = (esm_pt_timer_data_t *)(args);
/* Increment the retransmission counter */
data->count += 1;
LOG_TRACE(WARNING, "ESM-PROC - T3492 timer expired (pti=%d), "
"retransmission counter = %d", data->pti, data->count);
"retransmission counter = %d", data->pti, data->count);
if (data->count < ESM_PDN_DISCONNECT_COUNTER_MAX) {
emm_sap_t emm_sap;
emm_esm_data_t *emm_esm = &emm_sap.u.emm_esm.u.data;
/*
* Notify EMM that the PDN connectivity request message
* has to be sent again
*/
emm_sap.primitive = EMMESM_UNITDATA_REQ;
emm_sap.u.emm_esm.ueid = 0;
emm_esm->msg.length = data->msg.length;
emm_esm->msg.value = data->msg.value;
rc = emm_sap_send(&emm_sap);
emm_sap_t emm_sap;
emm_esm_data_t *emm_esm = &emm_sap.u.emm_esm.u.data;
/*
* Notify EMM that the PDN connectivity request message
* has to be sent again
*/
emm_sap.primitive = EMMESM_UNITDATA_REQ;
emm_sap.u.emm_esm.ueid = 0;
emm_esm->msg.length = data->msg.length;
emm_esm->msg.value = data->msg.value;
rc = emm_sap_send(&emm_sap);
if (rc != RETURNerror) {
/* Restart the timer T3492 */
rc = esm_pt_start_timer(data->pti, &data->msg, T3492_DEFAULT_VALUE,
_pdn_disconnect_t3492_handler);
}
}
else {
/* Set the procedure transaction state to INACTIVE */
rc = esm_pt_set_status(data->pti, ESM_PT_INACTIVE);
if (rc != RETURNok) {
/* The procedure transaction was already in INACTIVE state */
LOG_TRACE(WARNING, "ESM-PROC - PTI %d was already INACTIVE",
data->pti);
}
else {
/* Release the transaction identity assigned to this procedure */
rc = esm_pt_release(data->pti);
if (rc != RETURNok) {
LOG_TRACE(WARNING, "ESM-PROC - Failed to release PTI %d",
data->pti);
}
else {
/* Get the identity of the default EPS bearer context
* allocated to the PDN connection entry assigned to
* this procedure transaction */
int ebi = _pdn_disconnect_get_default_ebi(data->pti);
if (ebi < 0) {
LOG_TRACE(ERROR, "ESM-PROC - No default EPS bearer found");
LOG_FUNC_RETURN (NULL);
}
/*
* Notify ESM that all EPS bearer contexts to this PDN have
* to be locally deactivated
*/
esm_sap_t esm_sap;
esm_sap.primitive = ESM_EPS_BEARER_CONTEXT_DEACTIVATE_REQ;
esm_sap.is_standalone = TRUE;
esm_sap.recv = NULL;
esm_sap.send.length = 0;
esm_sap.data.eps_bearer_context_deactivate.ebi = ebi;
rc = esm_sap_send(&esm_sap);
}
}
if (rc != RETURNerror) {
/* Restart the timer T3492 */
rc = esm_pt_start_timer(data->pti, &data->msg, T3492_DEFAULT_VALUE,
_pdn_disconnect_t3492_handler);
}
} else {
/* Set the procedure transaction state to INACTIVE */
rc = esm_pt_set_status(data->pti, ESM_PT_INACTIVE);
if (rc != RETURNok) {
/* The procedure transaction was already in INACTIVE state */
LOG_TRACE(WARNING, "ESM-PROC - PTI %d was already INACTIVE",
data->pti);
} else {
/* Release the transaction identity assigned to this procedure */
rc = esm_pt_release(data->pti);
if (rc != RETURNok) {
LOG_TRACE(WARNING, "ESM-PROC - Failed to release PTI %d",
data->pti);
} else {
/* Get the identity of the default EPS bearer context
* allocated to the PDN connection entry assigned to
* this procedure transaction */
int ebi = _pdn_disconnect_get_default_ebi(data->pti);
if (ebi < 0) {
LOG_TRACE(ERROR, "ESM-PROC - No default EPS bearer found");
LOG_FUNC_RETURN (NULL);
}
/*
* Notify ESM that all EPS bearer contexts to this PDN have
* to be locally deactivated
*/
esm_sap_t esm_sap;
esm_sap.primitive = ESM_EPS_BEARER_CONTEXT_DEACTIVATE_REQ;
esm_sap.is_standalone = TRUE;
esm_sap.recv = NULL;
esm_sap.send.length = 0;
esm_sap.data.eps_bearer_context_deactivate.ebi = ebi;
rc = esm_sap_send(&esm_sap);
}
}
}
LOG_FUNC_RETURN(NULL);
@@ -619,26 +605,26 @@ static void* _pdn_disconnect_t3492_handler(void* args)
/*
*---------------------------------------------------------------------------
* PDN disconnection handlers
* PDN disconnection handlers
*---------------------------------------------------------------------------
*/
#ifdef NAS_UE
/****************************************************************************
** **
** Name: _pdn_disconnect_get_default_ebi() **
** Name: _pdn_disconnect_get_default_ebi() **
** **
** Description: Returns the EPS bearer identity of the default EPS bearer **
** context allocated to the PDN connection to which the gi- **
** ven procedure transaction identity has been assigned **
** context allocated to the PDN connection to which the gi- **
** ven procedure transaction identity has been assigned **
** **
** Inputs: pti: The procedure transaction identity **
** Others: _esm_data **
** Inputs: pti: The procedure transaction identity **
** Others: _esm_data **
** **
** Outputs: None **
** Return: The EPS bearer identity of the default EPS **
** bearer context, if it exists; -1 otherwise **
** Others: None **
** Outputs: None **
** Return: The EPS bearer identity of the default EPS **
** bearer context, if it exists; -1 otherwise **
** Others: None **
** **
***************************************************************************/
static int _pdn_disconnect_get_default_ebi(int pti)
@@ -646,16 +632,18 @@ static int _pdn_disconnect_get_default_ebi(int pti)
int ebi = -1;
for (int i = 0; i < ESM_DATA_PDN_MAX; i++) {
if ( (_esm_data.pdn[i].pid != -1) && _esm_data.pdn[i].data ) {
if (_esm_data.pdn[i].data->pti != pti) continue;
/* PDN entry found */
if (_esm_data.pdn[i].data->bearer[0] != NULL) {
/* Get the EPS bearer identity of the default EPS bearer
* context associated to the PDN connection */
ebi = _esm_data.pdn[i].data->bearer[0]->ebi;
}
break;
}
if ( (_esm_data.pdn[i].pid != -1) && _esm_data.pdn[i].data ) {
if (_esm_data.pdn[i].data->pti != pti) {
continue;
}
/* PDN entry found */
if (_esm_data.pdn[i].data->bearer[0] != NULL) {
/* Get the EPS bearer identity of the default EPS bearer
* context associated to the PDN connection */
ebi = _esm_data.pdn[i].data->bearer[0]->ebi;
}
break;
}
}
return (ebi);
@@ -665,20 +653,20 @@ static int _pdn_disconnect_get_default_ebi(int pti)
#ifdef NAS_MME
/****************************************************************************
** **
** Name: _pdn_disconnect_get_pid() **
** Name: _pdn_disconnect_get_pid() **
** **
** Description: Returns the identifier of the PDN connection to which the **
** given procedure transaction identity has been assigned **
** to establish connectivity to the specified UE **
** given procedure transaction identity has been assigned **
** to establish connectivity to the specified UE **
** **
** Inputs: ueid: UE local identifier **
** pti: The procedure transaction identity **
** Others: _esm_data **
** Inputs: ueid: UE local identifier **
** pti: The procedure transaction identity **
** Others: _esm_data **
** **
** Outputs: None **
** Return: The identifier of the PDN connection if **
** found in the list; -1 otherwise. **
** Others: None **
** Outputs: None **
** Return: The identifier of the PDN connection if **
** found in the list; -1 otherwise. **
** Others: None **
** **
***************************************************************************/
static int _pdn_disconnect_get_pid(unsigned int ueid, int pti)
@@ -686,14 +674,16 @@ static int _pdn_disconnect_get_pid(unsigned int ueid, int pti)
int i = ESM_DATA_PDN_MAX;
if ( (ueid < ESM_DATA_NB_UE_MAX) && (_esm_data.ctx[ueid] != NULL) ) {
for (i = 0; i < ESM_DATA_PDN_MAX; i++) {
if ( (_esm_data.ctx[ueid]->pdn[i].pid != -1) &&
(_esm_data.ctx[ueid]->pdn[i].data != NULL) ) {
if (_esm_data.ctx[ueid]->pdn[i].data->pti != pti) continue;
/* PDN entry found */
break;
}
}
for (i = 0; i < ESM_DATA_PDN_MAX; i++) {
if ( (_esm_data.ctx[ueid]->pdn[i].pid != -1) &&
(_esm_data.ctx[ueid]->pdn[i].data != NULL) ) {
if (_esm_data.ctx[ueid]->pdn[i].data->pti != pti) {
continue;
}
/* PDN entry found */
break;
}
}
}
/* Return the identifier of the PDN connection */
+50 -50
View File
@@ -1,21 +1,21 @@
/*****************************************************************************
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Source esmData.h
Source esmData.h
Version 0.1
Version 0.1
Date 2012/12/04
Date 2012/12/04
Product NAS stack
Product NAS stack
Subsystem EPS Session Management
Subsystem EPS Session Management
Author Frederic Maurel
Author Frederic Maurel
Description Defines internal private data handled by EPS Session
Management sublayer.
Description Defines internal private data handled by EPS Session
Management sublayer.
*****************************************************************************/
#ifndef __ESMDATA_H__
@@ -28,14 +28,14 @@ Description Defines internal private data handled by EPS Session
#include "mme_api.h"
#endif
#include <stdio.h> // sprintf
#include <stdio.h> // sprintf
/****************************************************************************/
/********************* G L O B A L C O N S T A N T S *******************/
/****************************************************************************/
/* Total number of active EPS bearers */
#define ESM_DATA_EPS_BEARER_TOTAL 11
#define ESM_DATA_EPS_BEARER_TOTAL 11
/****************************************************************************/
/************************ G L O B A L T Y P E S ************************/
@@ -57,10 +57,10 @@ Description Defines internal private data handled by EPS Session
* applied within the EPC and E-UTRAN.
*/
typedef struct {
int bid; /* Identifier of the EPS bearer */
unsigned int ebi; /* EPS bearer identity */
network_qos_t qos; /* EPS bearer level QoS parameters */
network_tft_t tft; /* Traffic Flow Template for packet filtering */
int bid; /* Identifier of the EPS bearer */
unsigned int ebi; /* EPS bearer identity */
network_qos_t qos; /* EPS bearer level QoS parameters */
network_tft_t tft; /* Traffic Flow Template for packet filtering */
} esm_bearer_t;
/*
@@ -71,26 +71,26 @@ typedef struct {
* an Access Point Name (APN).
*/
typedef struct {
unsigned int pti; /* Identity of the procedure transaction executed
* to activate the PDN connection entry */
int is_emergency; /* Emergency bearer services indicator */
OctetString apn; /* Access Point Name currently in used */
int ambr; /* Aggregate Maximum Bit Rate of this APN */
int type; /* Address PDN type (IPv4, IPv6, IPv4v6) */
#define ESM_DATA_IPV4_ADDRESS_SIZE 4
#define ESM_DATA_IPV6_ADDRESS_SIZE 8
#define ESM_DATA_IP_ADDRESS_SIZE (ESM_DATA_IPV4_ADDRESS_SIZE + \
ESM_DATA_IPV6_ADDRESS_SIZE)
/* IPv4 PDN address and/or IPv6 prefix */
unsigned int pti; /* Identity of the procedure transaction executed
* to activate the PDN connection entry */
int is_emergency; /* Emergency bearer services indicator */
OctetString apn; /* Access Point Name currently in used */
int ambr; /* Aggregate Maximum Bit Rate of this APN */
int type; /* Address PDN type (IPv4, IPv6, IPv4v6) */
#define ESM_DATA_IPV4_ADDRESS_SIZE 4
#define ESM_DATA_IPV6_ADDRESS_SIZE 8
#define ESM_DATA_IP_ADDRESS_SIZE (ESM_DATA_IPV4_ADDRESS_SIZE + \
ESM_DATA_IPV6_ADDRESS_SIZE)
/* IPv4 PDN address and/or IPv6 prefix */
char ip_addr[ESM_DATA_IP_ADDRESS_SIZE+1];
int addr_realloc; /* Indicates whether the UE is allowed to subsequently
* request another PDN connectivity to the same APN
* using an address PDN type (IPv4 or IPv6) other
* than the one already activated */
int n_bearers; /* Number of allocated EPS bearers;
* default EPS bearer is defined at index 0 */
#define ESM_DATA_EPS_BEARER_MAX 4
esm_bearer_t* bearer[ESM_DATA_EPS_BEARER_MAX];
int addr_realloc; /* Indicates whether the UE is allowed to subsequently
* request another PDN connectivity to the same APN
* using an address PDN type (IPv4 or IPv6) other
* than the one already activated */
int n_bearers; /* Number of allocated EPS bearers;
* default EPS bearer is defined at index 0 */
#define ESM_DATA_EPS_BEARER_MAX 4
esm_bearer_t *bearer[ESM_DATA_EPS_BEARER_MAX];
} esm_pdn_t;
/*
@@ -102,17 +102,17 @@ typedef struct {
* a PDN connection.
*/
typedef struct {
int n_ebrs; /* Total number of active EPS bearer contexts */
int n_pdns; /* Number of active PDN connections */
int emergency; /* Indicates whether a PDN connection for emergency
* bearer services is established */
#define ESM_DATA_PDN_MAX 4
int n_ebrs; /* Total number of active EPS bearer contexts */
int n_pdns; /* Number of active PDN connections */
int emergency; /* Indicates whether a PDN connection for emergency
* bearer services is established */
#define ESM_DATA_PDN_MAX 4
struct {
int pid; /* Identifier of the PDN connection */
int is_active; /* TRUE/FALSE if the PDN connection is active/inactive
* or the process to activate/deactivate the PDN
* connection is in progress */
esm_pdn_t* data; /* Active PDN connection data */
int pid; /* Identifier of the PDN connection */
int is_active; /* TRUE/FALSE if the PDN connection is active/inactive
* or the process to activate/deactivate the PDN
* connection is in progress */
esm_pdn_t *data; /* Active PDN connection data */
} pdn[ESM_DATA_PDN_MAX+1];
} esm_data_context_t;
@@ -149,8 +149,8 @@ typedef struct {
* ESM contexts
* ------------
*/
#define ESM_DATA_NB_UE_MAX (MME_API_NB_UE_MAX + 1)
esm_data_context_t* ctx[ESM_DATA_NB_UE_MAX];
#define ESM_DATA_NB_UE_MAX (MME_API_NB_UE_MAX + 1)
esm_data_context_t *ctx[ESM_DATA_NB_UE_MAX];
} esm_data_t;
@@ -172,10 +172,10 @@ esm_data_t _esm_data;
extern char ip_addr_str[100];
extern inline char* esm_data_get_ipv4_addr(const OctetString* ip_addr);
extern inline char *esm_data_get_ipv4_addr(const OctetString *ip_addr);
extern inline char* esm_data_get_ipv6_addr(const OctetString* ip_addr);
extern inline char *esm_data_get_ipv6_addr(const OctetString *ip_addr);
extern inline char* esm_data_get_ipv4v6_addr(const OctetString* ip_addr);
extern inline char *esm_data_get_ipv4v6_addr(const OctetString *ip_addr);
#endif /* __ESMDATA_H__*/
+285 -281
View File
@@ -1,21 +1,21 @@
/*****************************************************************************
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Source esm_ebr.c
Source esm_ebr.c
Version 0.1
Version 0.1
Date 2013/01/29
Date 2013/01/29
Product NAS stack
Product NAS stack
Subsystem EPS Session Management
Subsystem EPS Session Management
Author Frederic Maurel
Author Frederic Maurel
Description Defines functions used to handle state of EPS bearer contexts
and manage ESM messages re-transmission.
Description Defines functions used to handle state of EPS bearer contexts
and manage ESM messages re-transmission.
*****************************************************************************/
@@ -25,8 +25,8 @@ Description Defines functions used to handle state of EPS bearer contexts
#include "mme_api.h"
#include <stdlib.h> // malloc, free
#include <string.h> // memcpy
#include <stdlib.h> // malloc, free
#include <string.h> // memcpy
/****************************************************************************/
/**************** E X T E R N A L D E F I N I T I O N S ****************/
@@ -36,14 +36,14 @@ Description Defines functions used to handle state of EPS bearer contexts
* Minimal and maximal value of an EPS bearer identity:
* The EPS Bearer Identity (EBI) identifies a message flow
*/
#define ESM_EBI_MIN (EPS_BEARER_IDENTITY_FIRST)
#define ESM_EBI_MAX (EPS_BEARER_IDENTITY_LAST)
#define ESM_EBI_MIN (EPS_BEARER_IDENTITY_FIRST)
#define ESM_EBI_MAX (EPS_BEARER_IDENTITY_LAST)
#ifdef NAS_UE
#define ESM_EBR_NB_UE_MAX 1
#define ESM_EBR_NB_UE_MAX 1
#endif
#ifdef NAS_MME
#define ESM_EBR_NB_UE_MAX (MME_API_NB_UE_MAX + 1)
#define ESM_EBR_NB_UE_MAX (MME_API_NB_UE_MAX + 1)
#endif
/****************************************************************************/
@@ -51,7 +51,7 @@ Description Defines functions used to handle state of EPS bearer contexts
/****************************************************************************/
/* String representation of EPS bearer context status */
static const char* _esm_ebr_state_str[ESM_EBR_STATE_MAX] = {
static const char *_esm_ebr_state_str[ESM_EBR_STATE_MAX] = {
"BEARER CONTEXT INACTIVE",
"BEARER CONTEXT ACTIVE",
#ifdef NAS_MME
@@ -67,17 +67,17 @@ static const char* _esm_ebr_state_str[ESM_EBR_STATE_MAX] = {
* -----------------------
*/
typedef struct {
unsigned char ebi; /* EPS bearer identity */
esm_ebr_state status; /* EPS bearer context status */
unsigned char ebi; /* EPS bearer identity */
esm_ebr_state status; /* EPS bearer context status */
#ifdef NAS_UE
int is_default_ebr; /* TRUE if the bearer context is associated
* to a default EPS bearer */
char cid; /* Identifier of the PDN context the EPS
* bearer context has been assigned to */
int is_default_ebr; /* TRUE if the bearer context is associated
* to a default EPS bearer */
char cid; /* Identifier of the PDN context the EPS
* bearer context has been assigned to */
#endif
#ifdef NAS_MME
struct nas_timer_t timer; /* Retransmission timer */
esm_ebr_timer_data_t* args; /* Retransmission timer parameters data */
struct nas_timer_t timer; /* Retransmission timer */
esm_ebr_timer_data_t *args; /* Retransmission timer parameters data */
#endif
} esm_ebr_context_t;
@@ -87,10 +87,10 @@ typedef struct {
* ----------------------------------
*/
static struct {
unsigned char index; /* Index of the next EPS bearer context
* identity to be used */
unsigned char index; /* Index of the next EPS bearer context
* identity to be used */
#define ESM_EBR_DATA_SIZE (ESM_EBI_MAX - ESM_EBI_MIN + 1)
esm_ebr_context_t* context[ESM_EBR_DATA_SIZE + 1];
esm_ebr_context_t *context[ESM_EBR_DATA_SIZE + 1];
} _esm_ebr_data[ESM_EBR_NB_UE_MAX];
/*
@@ -106,17 +106,17 @@ static esm_indication_callback_t _esm_ebr_callback;
static const network_pdn_state_t _esm_ebr_pdn_state[2][2][2] = {
/* Status modification triggerer by the network */
{
/* Dedicated EPS bearer */
{NET_PDN_NW_DEDICATED_DEACT, NET_PDN_NW_DEDICATED_ACT},
/* Default EPS bearer */
{NET_PDN_NW_DEFAULT_DEACT, 0}
/* Dedicated EPS bearer */
{NET_PDN_NW_DEDICATED_DEACT, NET_PDN_NW_DEDICATED_ACT},
/* Default EPS bearer */
{NET_PDN_NW_DEFAULT_DEACT, 0}
},
/* Status modification triggered by the UE */
{
/* Dedicated EPS bearer */
{NET_PDN_MT_DEDICATED_DEACT, NET_PDN_MT_DEDICATED_ACT},
/* Default EPS bearer */
{NET_PDN_MT_DEFAULT_DEACT, NET_PDN_MT_DEFAULT_ACT}
/* Dedicated EPS bearer */
{NET_PDN_MT_DEDICATED_DEACT, NET_PDN_MT_DEDICATED_ACT},
/* Default EPS bearer */
{NET_PDN_MT_DEFAULT_DEACT, NET_PDN_MT_DEFAULT_ACT}
}
};
#endif
@@ -131,33 +131,33 @@ static int _esm_ebr_get_available_entry(unsigned int ueid);
/****************************************************************************
** **
** Name: esm_ebr_initialize() **
** Name: esm_ebr_initialize() **
** **
** Description: Initialize EPS bearer context data **
** **
** Inputs: cb: User notification callback **
** Others: None **
** Inputs: cb: User notification callback **
** Others: None **
** **
** Outputs: None **
** Return: None **
** Others: _esm_ebr_data **
** Outputs: None **
** Return: None **
** Others: _esm_ebr_data **
** **
***************************************************************************/
void esm_ebr_initialize(
#ifdef NAS_UE
esm_indication_callback_t cb
esm_indication_callback_t cb
#endif
)
)
{
int ueid, i;
LOG_FUNC_IN;
for (ueid = 0; ueid < ESM_EBR_NB_UE_MAX; ueid++) {
_esm_ebr_data[ueid].index = 0;
/* Initialize EPS bearer context data */
for (i = 0; i < ESM_EBR_DATA_SIZE + 1; i++) {
_esm_ebr_data[ueid].context[i] = NULL;
}
_esm_ebr_data[ueid].index = 0;
/* Initialize EPS bearer context data */
for (i = 0; i < ESM_EBR_DATA_SIZE + 1; i++) {
_esm_ebr_data[ueid].context[i] = NULL;
}
}
#ifdef NAS_UE
/* Initialize the user notification callback */
@@ -169,23 +169,23 @@ void esm_ebr_initialize(
/****************************************************************************
** **
** Name: esm_ebr_assign() **
** Name: esm_ebr_assign() **
** **
** Description: Assigns a new EPS bearer context **
** **
** Inputs: ueid: Lower layers UE identifier **
** ebi: Identity of the new EPS bearer context **
** cid: Identifier of the PDN context the EPS bea- **
** rer context is associated to **
** default_ebr TRUE if the new bearer context is associa- **
** ted to a default EPS bearer **
** Others: None **
** Inputs: ueid: Lower layers UE identifier **
** ebi: Identity of the new EPS bearer context **
** cid: Identifier of the PDN context the EPS bea- **
** rer context is associated to **
** default_ebr TRUE if the new bearer context is associa- **
** ted to a default EPS bearer **
** Others: None **
** **
** Outputs: None **
** Return: The identity of the new EPS bearer context **
** if successfully assigned; **
** the not assigned EBI (0) otherwise. **
** Others: _esm_ebr_data **
** Outputs: None **
** Return: The identity of the new EPS bearer context **
** if successfully assigned; **
** the not assigned EBI (0) otherwise. **
** Others: _esm_ebr_data **
** **
***************************************************************************/
#ifdef NAS_UE
@@ -204,37 +204,34 @@ int esm_ebr_assign(unsigned int ueid, int ebi)
int i;
if (ueid >= ESM_EBR_NB_UE_MAX) {
LOG_FUNC_RETURN (ESM_EBI_UNASSIGNED);
LOG_FUNC_RETURN (ESM_EBI_UNASSIGNED);
}
if (ebi != ESM_EBI_UNASSIGNED) {
if ( (ebi < ESM_EBI_MIN) || (ebi > ESM_EBI_MAX) ) {
LOG_FUNC_RETURN (ESM_EBI_UNASSIGNED);
}
else if (_esm_ebr_data[ueid].context[ebi - ESM_EBI_MIN] != NULL) {
LOG_TRACE(WARNING, "ESM-FSM - EPS bearer context already "
"assigned (ebi=%d)", ebi);
LOG_FUNC_RETURN (ESM_EBI_UNASSIGNED);
}
/* The specified EPS bearer context is available */
i = ebi - ESM_EBI_MIN;
}
else
{
/* Search for an available EPS bearer identity */
i = _esm_ebr_get_available_entry(ueid);
if (i < 0) {
LOG_FUNC_RETURN(ESM_EBI_UNASSIGNED);
}
/* An available EPS bearer context is found */
ebi = i + ESM_EBI_MIN;
if ( (ebi < ESM_EBI_MIN) || (ebi > ESM_EBI_MAX) ) {
LOG_FUNC_RETURN (ESM_EBI_UNASSIGNED);
} else if (_esm_ebr_data[ueid].context[ebi - ESM_EBI_MIN] != NULL) {
LOG_TRACE(WARNING, "ESM-FSM - EPS bearer context already "
"assigned (ebi=%d)", ebi);
LOG_FUNC_RETURN (ESM_EBI_UNASSIGNED);
}
/* The specified EPS bearer context is available */
i = ebi - ESM_EBI_MIN;
} else {
/* Search for an available EPS bearer identity */
i = _esm_ebr_get_available_entry(ueid);
if (i < 0) {
LOG_FUNC_RETURN(ESM_EBI_UNASSIGNED);
}
/* An available EPS bearer context is found */
ebi = i + ESM_EBI_MIN;
}
/* Assign new EPS bearer context */
_esm_ebr_data[ueid].context[i] =
(esm_ebr_context_t*)malloc(sizeof(esm_ebr_context_t));
(esm_ebr_context_t *)malloc(sizeof(esm_ebr_context_t));
if (_esm_ebr_data[ueid].context[i] == NULL) {
LOG_FUNC_RETURN(ESM_EBI_UNASSIGNED);
LOG_FUNC_RETURN(ESM_EBI_UNASSIGNED);
}
/* Store the index of the next available EPS bearer identity */
_esm_ebr_data[ueid].index = i + 1;
@@ -262,27 +259,27 @@ int esm_ebr_assign(unsigned int ueid, int ebi)
/****************************************************************************
** **
** Name: esm_ebr_release() **
** Name: esm_ebr_release() **
** **
** Description: Release the given EPS bearer identity **
** **
** Inputs: ueid: Lower layers UE identifier **
** ebi: The identity of the EPS bearer context to **
** be released **
** Others: None **
** Inputs: ueid: Lower layers UE identifier **
** ebi: The identity of the EPS bearer context to **
** be released **
** Others: None **
** **
** Outputs: None **
** Return: RETURNok if the EPS bearer context has **
** been successfully released; **
** RETURNerror otherwise. **
** Others: _esm_ebr_data **
** Outputs: None **
** Return: RETURNok if the EPS bearer context has **
** been successfully released; **
** RETURNerror otherwise. **
** Others: _esm_ebr_data **
** **
***************************************************************************/
int esm_ebr_release(
#ifdef NAS_MME
unsigned int ueid,
unsigned int ueid,
#endif
int ebi)
int ebi)
{
LOG_FUNC_IN;
@@ -291,38 +288,38 @@ int esm_ebr_release(
#endif
if (ueid >= ESM_EBR_NB_UE_MAX) {
LOG_FUNC_RETURN (RETURNerror);
LOG_FUNC_RETURN (RETURNerror);
}
if ( (ebi < ESM_EBI_MIN) || (ebi > ESM_EBI_MAX) ) {
LOG_FUNC_RETURN (RETURNerror);
LOG_FUNC_RETURN (RETURNerror);
}
/* Get EPS bearer context data */
esm_ebr_context_t* ctx = _esm_ebr_data[ueid].context[ebi - ESM_EBI_MIN];
esm_ebr_context_t *ctx = _esm_ebr_data[ueid].context[ebi - ESM_EBI_MIN];
if ( (ctx == NULL) || (ctx->ebi != ebi) ) {
/* EPS bearer context not assigned */
LOG_FUNC_RETURN (RETURNerror);
/* EPS bearer context not assigned */
LOG_FUNC_RETURN (RETURNerror);
}
/* Do not release active EPS bearer context */
if (ctx->status != ESM_EBR_INACTIVE) {
LOG_TRACE(ERROR, "ESM-FSM - EPS bearer context is not INACTIVE");
LOG_FUNC_RETURN (RETURNerror);
LOG_TRACE(ERROR, "ESM-FSM - EPS bearer context is not INACTIVE");
LOG_FUNC_RETURN (RETURNerror);
}
#ifdef NAS_MME
/* Stop the retransmission timer if still running */
if (ctx->timer.id != NAS_TIMER_INACTIVE_ID) {
LOG_TRACE(INFO, "ESM-FSM - Stop retransmission timer %d",
ctx->timer.id);
ctx->timer.id = nas_timer_stop(ctx->timer.id);
LOG_TRACE(INFO, "ESM-FSM - Stop retransmission timer %d",
ctx->timer.id);
ctx->timer.id = nas_timer_stop(ctx->timer.id);
}
/* Release the retransmisison timer parameters */
if (ctx->args) {
if (ctx->args->msg.length > 0) {
free(ctx->args->msg.value);
}
free(ctx->args);
ctx->args = NULL;
if (ctx->args->msg.length > 0) {
free(ctx->args->msg.value);
}
free(ctx->args);
ctx->args = NULL;
}
#endif
@@ -337,96 +334,95 @@ int esm_ebr_release(
#ifdef NAS_MME
/****************************************************************************
** **
** Name: esm_ebr_start_timer() **
** Name: esm_ebr_start_timer() **
** **
** Description: Start the timer of the specified EPS bearer context to **
** expire after a given time interval. Timer expiration will **
** schedule execution of the callback function where stored **
** ESM message should be re-transmit. **
** expire after a given time interval. Timer expiration will **
** schedule execution of the callback function where stored **
** ESM message should be re-transmit. **
** **
** Inputs: ueid: Lower layers UE identifier **
** ebi: The identity of the EPS bearer **
** msg: The encoded ESM message to be stored **
** sec: The value of the time interval in seconds **
** cb: Function executed upon timer expiration **
** Others: None **
** Inputs: ueid: Lower layers UE identifier **
** ebi: The identity of the EPS bearer **
** msg: The encoded ESM message to be stored **
** sec: The value of the time interval in seconds **
** cb: Function executed upon timer expiration **
** Others: None **
** **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: _esm_ebr_data **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: _esm_ebr_data **
** **
***************************************************************************/
int esm_ebr_start_timer( unsigned int ueid, int ebi, const OctetString* msg,
long sec, nas_timer_callback_t cb)
int esm_ebr_start_timer( unsigned int ueid, int ebi, const OctetString *msg,
long sec, nas_timer_callback_t cb)
{
LOG_FUNC_IN;
if (ueid >= ESM_EBR_NB_UE_MAX) {
LOG_FUNC_RETURN (RETURNerror);
LOG_FUNC_RETURN (RETURNerror);
}
if ( (ebi < ESM_EBI_MIN) || (ebi > ESM_EBI_MAX) ) {
LOG_FUNC_RETURN (RETURNerror);
LOG_FUNC_RETURN (RETURNerror);
}
/* Get EPS bearer context data */
esm_ebr_context_t* ctx = _esm_ebr_data[ueid].context[ebi - ESM_EBI_MIN];
esm_ebr_context_t *ctx = _esm_ebr_data[ueid].context[ebi - ESM_EBI_MIN];
if ( (ctx == NULL) || (ctx->ebi != ebi) ) {
/* EPS bearer context not assigned */
LOG_FUNC_RETURN (RETURNerror);
/* EPS bearer context not assigned */
LOG_FUNC_RETURN (RETURNerror);
}
if (ctx->timer.id != NAS_TIMER_INACTIVE_ID) {
if (ctx->args) {
/* Re-start the retransmission timer */
ctx->timer.id = nas_timer_restart(ctx->timer.id);
}
if (ctx->args) {
/* Re-start the retransmission timer */
ctx->timer.id = nas_timer_restart(ctx->timer.id);
}
} else {
/* Setup the retransmission timer parameters */
ctx->args = (esm_ebr_timer_data_t *)malloc(sizeof(esm_ebr_timer_data_t));
if (ctx->args) {
/* Set the UE identifier */
ctx->args->ueid = ueid;
/* Set the EPS bearer identity */
ctx->args->ebi = ebi;
/* Reset the retransmission counter */
ctx->args->count = 0;
/* Set the ESM message to be re-transmited */
ctx->args->msg.value = (uint8_t *)malloc(msg->length);
ctx->args->msg.length = 0;
if (ctx->args->msg.value) {
memcpy(ctx->args->msg.value, msg->value, msg->length);
ctx->args->msg.length = msg->length;
}
/* Setup the retransmission timer to expire at the given
* time interval */
ctx->timer.id = nas_timer_start(sec, cb, ctx->args);
ctx->timer.sec = sec;
}
}
else {
/* Setup the retransmission timer parameters */
ctx->args = (esm_ebr_timer_data_t*)malloc(sizeof(esm_ebr_timer_data_t));
if (ctx->args) {
/* Set the UE identifier */
ctx->args->ueid = ueid;
/* Set the EPS bearer identity */
ctx->args->ebi = ebi;
/* Reset the retransmission counter */
ctx->args->count = 0;
/* Set the ESM message to be re-transmited */
ctx->args->msg.value = (uint8_t*)malloc(msg->length);
ctx->args->msg.length = 0;
if (ctx->args->msg.value) {
memcpy(ctx->args->msg.value, msg->value, msg->length);
ctx->args->msg.length = msg->length;
}
/* Setup the retransmission timer to expire at the given
* time interval */
ctx->timer.id = nas_timer_start(sec, cb, ctx->args);
ctx->timer.sec = sec;
}
}
if ( (ctx->args != NULL) && (ctx->timer.id != NAS_TIMER_INACTIVE_ID) ) {
LOG_TRACE(INFO, "ESM-FSM - Retransmission timer %d expires in "
"%ld seconds", ctx->timer.id, ctx->timer.sec);
LOG_FUNC_RETURN (RETURNok);
LOG_TRACE(INFO, "ESM-FSM - Retransmission timer %d expires in "
"%ld seconds", ctx->timer.id, ctx->timer.sec);
LOG_FUNC_RETURN (RETURNok);
}
LOG_FUNC_RETURN (RETURNerror);
}
/****************************************************************************
** **
** Name: esm_ebr_stop_timer() **
** Name: esm_ebr_stop_timer() **
** **
** Description: Stop the timer previously started for the given EPS bea- **
** rer context **
** rer context **
** **
** Inputs: ueid: Lower layers UE identifier **
** ebi: The identity of the EPS bearer **
** Others: None **
** Inputs: ueid: Lower layers UE identifier **
** ebi: The identity of the EPS bearer **
** Others: None **
** **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: _esm_ebr_data **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: _esm_ebr_data **
** **
***************************************************************************/
int esm_ebr_stop_timer( unsigned int ueid, int ebi)
@@ -434,33 +430,33 @@ int esm_ebr_stop_timer( unsigned int ueid, int ebi)
LOG_FUNC_IN;
if (ueid >= ESM_EBR_NB_UE_MAX) {
LOG_FUNC_RETURN (RETURNerror);
LOG_FUNC_RETURN (RETURNerror);
}
if ( (ebi < ESM_EBI_MIN) || (ebi > ESM_EBI_MAX) ) {
LOG_FUNC_RETURN (RETURNerror);
LOG_FUNC_RETURN (RETURNerror);
}
/* Get EPS bearer context data */
esm_ebr_context_t* ctx = _esm_ebr_data[ueid].context[ebi - ESM_EBI_MIN];
esm_ebr_context_t *ctx = _esm_ebr_data[ueid].context[ebi - ESM_EBI_MIN];
if ( (ctx == NULL) || (ctx->ebi != ebi) ) {
/* EPS bearer context not assigned */
LOG_FUNC_RETURN (RETURNerror);
/* EPS bearer context not assigned */
LOG_FUNC_RETURN (RETURNerror);
}
/* Stop the retransmission timer if still running */
if (ctx->timer.id != NAS_TIMER_INACTIVE_ID) {
LOG_TRACE(INFO, "ESM-FSM - Stop retransmission timer %d",
ctx->timer.id);
ctx->timer.id = nas_timer_stop(ctx->timer.id);
LOG_TRACE(INFO, "ESM-FSM - Stop retransmission timer %d",
ctx->timer.id);
ctx->timer.id = nas_timer_stop(ctx->timer.id);
}
/* Release the retransmisison timer parameters */
if (ctx->args) {
if (ctx->args->msg.length > 0) {
free(ctx->args->msg.value);
}
free(ctx->args);
ctx->args = NULL;
if (ctx->args->msg.length > 0) {
free(ctx->args->msg.value);
}
free(ctx->args);
ctx->args = NULL;
}
LOG_FUNC_RETURN (RETURNok);
@@ -468,20 +464,20 @@ int esm_ebr_stop_timer( unsigned int ueid, int ebi)
/****************************************************************************
** **
** Name: esm_ebr_get_pending_ebi() **
** Name: esm_ebr_get_pending_ebi() **
** **
** Description: Returns the EPS bearer identity assigned to the first EPS **
** bearer context entry which is pending in the given state **
** bearer context entry which is pending in the given state **
** **
** Inputs: ueid: Lower layers UE identifier **
** status: The EPS bearer context status **
** Others: _esm_ebr_data **
** Inputs: ueid: Lower layers UE identifier **
** status: The EPS bearer context status **
** Others: _esm_ebr_data **
** **
** Outputs: None **
** Return: The EPS bearer identity of the EPS bearer **
** context entry if it exists; **
** the not assigned EBI (0) otherwise. **
** Others: None **
** Outputs: None **
** Return: The EPS bearer identity of the EPS bearer **
** context entry if it exists; **
** the not assigned EBI (0) otherwise. **
** Others: None **
** **
***************************************************************************/
int esm_ebr_get_pending_ebi(unsigned int ueid, esm_ebr_state status)
@@ -490,14 +486,18 @@ int esm_ebr_get_pending_ebi(unsigned int ueid, esm_ebr_state status)
int i;
for (i = 0; i < ESM_EBR_DATA_SIZE; i++) {
if (_esm_ebr_data[ueid].context[i] == NULL) continue;
if (_esm_ebr_data[ueid].context[i]->status != status) continue;
/* EPS bearer context entry found */
break;
if (_esm_ebr_data[ueid].context[i] == NULL) {
continue;
}
if (_esm_ebr_data[ueid].context[i]->status != status) {
continue;
}
/* EPS bearer context entry found */
break;
}
if (i < ESM_EBR_DATA_SIZE) {
LOG_FUNC_RETURN (_esm_ebr_data[ueid].context[i]->ebi);
LOG_FUNC_RETURN (_esm_ebr_data[ueid].context[i]->ebi);
}
/* EPS bearer context entry not found */
LOG_FUNC_RETURN (ESM_EBI_UNASSIGNED);
@@ -506,29 +506,29 @@ int esm_ebr_get_pending_ebi(unsigned int ueid, esm_ebr_state status)
/****************************************************************************
** **
** Name: esm_ebr_set_status() **
** Name: esm_ebr_set_status() **
** **
** Description: Set the status of the specified EPS bearer context to the **
** given state **
** given state **
** **
** Inputs: ueid: Lower layers UE identifier **
** ebi: The identity of the EPS bearer **
** status: The new EPS bearer context status **
** ue_requested: TRUE/FALSE if the modification of the EPS **
** bearer context status was requested by the **
** UE/network **
** Others: None **
** Inputs: ueid: Lower layers UE identifier **
** ebi: The identity of the EPS bearer **
** status: The new EPS bearer context status **
** ue_requested: TRUE/FALSE if the modification of the EPS **
** bearer context status was requested by the **
** UE/network **
** Others: None **
** **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: _esm_ebr_data **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: _esm_ebr_data **
** **
***************************************************************************/
int esm_ebr_set_status(
#ifdef NAS_MME
unsigned int ueid,
unsigned int ueid,
#endif
int ebi, esm_ebr_state status, int ue_requested)
int ebi, esm_ebr_state status, int ue_requested)
{
LOG_FUNC_IN;
@@ -539,37 +539,37 @@ int esm_ebr_set_status(
#endif
if (ueid >= ESM_EBR_NB_UE_MAX) {
LOG_FUNC_RETURN (RETURNerror);
LOG_FUNC_RETURN (RETURNerror);
}
if ( (ebi < ESM_EBI_MIN) || (ebi > ESM_EBI_MAX) ) {
LOG_FUNC_RETURN (RETURNerror);
LOG_FUNC_RETURN (RETURNerror);
}
/* Get EPS bearer context data */
esm_ebr_context_t* ctx = _esm_ebr_data[ueid].context[ebi - ESM_EBI_MIN];
esm_ebr_context_t *ctx = _esm_ebr_data[ueid].context[ebi - ESM_EBI_MIN];
if ( (ctx == NULL) || (ctx->ebi != ebi) ) {
/* EPS bearer context not assigned */
LOG_TRACE(ERROR, "ESM-FSM - EPS bearer context not assigned "
"(ebi=%d)", ebi);
LOG_FUNC_RETURN (RETURNerror);
/* EPS bearer context not assigned */
LOG_TRACE(ERROR, "ESM-FSM - EPS bearer context not assigned "
"(ebi=%d)", ebi);
LOG_FUNC_RETURN (RETURNerror);
}
old_status = ctx->status;
if (status < ESM_EBR_STATE_MAX) {
LOG_TRACE(INFO, "ESM-FSM - Status of EPS bearer context %d changed:"
" %s ===> %s", ebi,
_esm_ebr_state_str[old_status], _esm_ebr_state_str[status]);
if (status != old_status) {
ctx->status = status;
LOG_TRACE(INFO, "ESM-FSM - Status of EPS bearer context %d changed:"
" %s ===> %s", ebi,
_esm_ebr_state_str[old_status], _esm_ebr_state_str[status]);
if (status != old_status) {
ctx->status = status;
#ifdef NAS_UE
/*
* Notify the user that the state of the EPS bearer has changed
*/
(*_esm_ebr_callback)(ctx->cid,
_esm_ebr_pdn_state[ue_requested][ctx->is_default_ebr][status]);
/*
* Notify the user that the state of the EPS bearer has changed
*/
(*_esm_ebr_callback)(ctx->cid,
_esm_ebr_pdn_state[ue_requested][ctx->is_default_ebr][status]);
#endif
LOG_FUNC_RETURN (RETURNok);
}
LOG_FUNC_RETURN (RETURNok);
}
}
LOG_FUNC_RETURN (RETURNerror);
@@ -577,58 +577,58 @@ int esm_ebr_set_status(
/****************************************************************************
** **
** Name: esm_ebr_get_status() **
** Name: esm_ebr_get_status() **
** **
** Description: Get the current status value of the specified EPS bearer **
** context **
** context **
** **
** Inputs: ueid: Lower layers UE identifier **
** ebi: The identity of the EPS bearer **
** Others: _esm_ebr_data **
** Inputs: ueid: Lower layers UE identifier **
** ebi: The identity of the EPS bearer **
** Others: _esm_ebr_data **
** **
** Outputs: None **
** Return: The current value of the EPS bearer con- **
** text status **
** Others: None **
** Outputs: None **
** Return: The current value of the EPS bearer con- **
** text status **
** Others: None **
** **
***************************************************************************/
esm_ebr_state esm_ebr_get_status(
#ifdef NAS_MME
unsigned int ueid,
unsigned int ueid,
#endif
int ebi)
int ebi)
{
#ifdef NAS_UE
unsigned int ueid = 0;
#endif
if ( (ebi < ESM_EBI_MIN) || (ebi > ESM_EBI_MAX) ) {
return (ESM_EBR_INACTIVE);
return (ESM_EBR_INACTIVE);
}
if (_esm_ebr_data[ueid].context[ebi - ESM_EBI_MIN] == NULL) {
/* EPS bearer context not allocated */
return (ESM_EBR_INACTIVE);
/* EPS bearer context not allocated */
return (ESM_EBR_INACTIVE);
}
if (_esm_ebr_data[ueid].context[ebi - ESM_EBI_MIN]->ebi != ebi) {
/* EPS bearer context not assigned */
return (ESM_EBR_INACTIVE);
/* EPS bearer context not assigned */
return (ESM_EBR_INACTIVE);
}
return (_esm_ebr_data[ueid].context[ebi - ESM_EBI_MIN]->status);
}
/****************************************************************************
** **
** Name: esm_ebr_is_reserved() **
** Name: esm_ebr_is_reserved() **
** **
** Description: Check whether the given EPS bearer identity is a reserved **
** value **
** value **
** **
** Inputs: ebi: The identity of the EPS bearer **
** Others: None **
** Inputs: ebi: The identity of the EPS bearer **
** Others: None **
** **
** Outputs: None **
** Return: TRUE, FALSE **
** Others: None **
** Outputs: None **
** Return: TRUE, FALSE **
** Others: None **
** **
***************************************************************************/
int esm_ebr_is_reserved(int ebi)
@@ -638,33 +638,33 @@ int esm_ebr_is_reserved(int ebi)
/****************************************************************************
** **
** Name: esm_ebr_is_not_in_use() **
** Name: esm_ebr_is_not_in_use() **
** **
** Description: Check whether the given EPS bearer identity does not **
** match an assigned EBI value currently in use **
** match an assigned EBI value currently in use **
** **
** Inputs: ueid: Lower layers UE identifier **
** ebi: The identity of the EPS bearer **
** Others: _esm_ebr_data **
** Inputs: ueid: Lower layers UE identifier **
** ebi: The identity of the EPS bearer **
** Others: _esm_ebr_data **
** **
** Outputs: None **
** Return: TRUE, FALSE **
** Others: None **
** Outputs: None **
** Return: TRUE, FALSE **
** Others: None **
** **
***************************************************************************/
int esm_ebr_is_not_in_use(
#ifdef NAS_MME
unsigned int ueid,
unsigned int ueid,
#endif
int ebi)
int ebi)
{
#ifdef NAS_UE
unsigned int ueid = 0;
#endif
return ( (ebi == ESM_EBI_UNASSIGNED) ||
(_esm_ebr_data[ueid].context[ebi - ESM_EBI_MIN] == NULL) ||
(_esm_ebr_data[ueid].context[ebi - ESM_EBI_MIN]->ebi) != ebi);
(_esm_ebr_data[ueid].context[ebi - ESM_EBI_MIN] == NULL) ||
(_esm_ebr_data[ueid].context[ebi - ESM_EBI_MIN]->ebi) != ebi);
}
/****************************************************************************/
@@ -673,32 +673,36 @@ int esm_ebr_is_not_in_use(
/****************************************************************************
** **
** Name: _esm_ebr_get_available_entry() **
** Name: _esm_ebr_get_available_entry() **
** **
** Description: Returns the index of the next available entry in the list **
** of EPS bearer context data **
** of EPS bearer context data **
** **
** Inputs: ueid: Lower layers UE identifier **
** Others: _esm_ebr_data **
** Inputs: ueid: Lower layers UE identifier **
** Others: _esm_ebr_data **
** **
** Outputs: None **
** Return: The index of the next available EPS bearer **
** context data entry; -1 if no any entry is **
** available. **
** Others: None **
** Outputs: None **
** Return: The index of the next available EPS bearer **
** context data entry; -1 if no any entry is **
** available. **
** Others: None **
** **
***************************************************************************/
static int _esm_ebr_get_available_entry(unsigned int ueid)
{
int i;
for (i = _esm_ebr_data[ueid].index; i < ESM_EBR_DATA_SIZE; i++) {
if (_esm_ebr_data[ueid].context[i] != NULL) continue;
return i;
if (_esm_ebr_data[ueid].context[i] != NULL) {
continue;
}
return i;
}
for (i = 0; i < _esm_ebr_data[ueid].index; i++) {
if (_esm_ebr_data[ueid].context[i] != NULL) continue;
return i;
if (_esm_ebr_data[ueid].context[i] != NULL) {
continue;
}
return i;
}
/* No available EBI entry found */
return (-1);
}
}
+28 -26
View File
@@ -1,21 +1,21 @@
/*****************************************************************************
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Source esm_ebr.h
Source esm_ebr.h
Version 0.1
Version 0.1
Date 2013/01/29
Date 2013/01/29
Product NAS stack
Product NAS stack
Subsystem EPS Session Management
Subsystem EPS Session Management
Author Frederic Maurel
Author Frederic Maurel
Description Defines functions used to handle state of EPS bearer contexts
and manage ESM messages re-transmission.
Description Defines functions used to handle state of EPS bearer contexts
and manage ESM messages re-transmission.
*****************************************************************************/
#ifndef __ESM_EBR_H__
@@ -35,7 +35,7 @@ Description Defines functions used to handle state of EPS bearer contexts
/****************************************************************************/
/* Unassigned EPS bearer identity value */
#define ESM_EBI_UNASSIGNED (EPS_BEARER_IDENTITY_UNASSIGNED)
#define ESM_EBI_UNASSIGNED (EPS_BEARER_IDENTITY_UNASSIGNED)
/****************************************************************************/
/************************ G L O B A L T Y P E S ************************/
@@ -43,16 +43,16 @@ Description Defines functions used to handle state of EPS bearer contexts
/* EPS bearer context states */
typedef enum {
ESM_EBR_INACTIVE, /* No EPS bearer context exists */
ESM_EBR_ACTIVE, /* The EPS bearer context is active,
* in the UE, in the network */
ESM_EBR_INACTIVE, /* No EPS bearer context exists */
ESM_EBR_ACTIVE, /* The EPS bearer context is active,
* in the UE, in the network */
#ifdef NAS_MME
ESM_EBR_INACTIVE_PENDING, /* The network has initiated an EPS bearer
* context deactivation towards the UE */
ESM_EBR_MODIFY_PENDING, /* The network has initiated an EPS bearer
* context modification towards the UE */
ESM_EBR_ACTIVE_PENDING, /* The network has initiated an EPS bearer
* context activation towards the UE */
ESM_EBR_INACTIVE_PENDING, /* The network has initiated an EPS bearer
* context deactivation towards the UE */
ESM_EBR_MODIFY_PENDING, /* The network has initiated an EPS bearer
* context modification towards the UE */
ESM_EBR_ACTIVE_PENDING, /* The network has initiated an EPS bearer
* context activation towards the UE */
#endif
ESM_EBR_STATE_MAX
} esm_ebr_state;
@@ -60,10 +60,10 @@ typedef enum {
#ifdef NAS_MME
/* ESM message timer retransmission data */
typedef struct {
unsigned int ueid; /* Lower layers UE identifier */
unsigned int ebi; /* EPS bearer identity */
unsigned int count; /* Retransmission counter */
OctetString msg; /* Encoded ESM message to re-transmit */
unsigned int ueid; /* Lower layers UE identifier */
unsigned int ebi; /* EPS bearer identity */
unsigned int count; /* Retransmission counter */
OctetString msg; /* Encoded ESM message to re-transmit */
} esm_ebr_timer_data_t;
#endif
@@ -93,12 +93,14 @@ void esm_ebr_initialize(void);
int esm_ebr_assign(unsigned int ueid, int ebi);
int esm_ebr_release(unsigned int ueid, int ebi);
int esm_ebr_start_timer(unsigned int ueid, int ebi, const OctetString* msg, long sec, nas_timer_callback_t cb);
int esm_ebr_start_timer(unsigned int ueid, int ebi, const OctetString *msg,
long sec, nas_timer_callback_t cb);
int esm_ebr_stop_timer(unsigned int ueid, int ebi);
int esm_ebr_get_pending_ebi(unsigned int ueid, esm_ebr_state status);
int esm_ebr_set_status(unsigned int ueid, int ebi, esm_ebr_state status, int ue_requested);
int esm_ebr_set_status(unsigned int ueid, int ebi, esm_ebr_state status,
int ue_requested);
esm_ebr_state esm_ebr_get_status(unsigned int ueid, int ebi);
int esm_ebr_is_not_in_use(unsigned int ueid, int ebi);
@@ -1,20 +1,20 @@
/*****************************************************************************
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Source esm_ebr_context.h
Source esm_ebr_context.h
Version 0.1
Version 0.1
Date 2013/05/28
Date 2013/05/28
Product NAS stack
Product NAS stack
Subsystem EPS Session Management
Subsystem EPS Session Management
Author Frederic Maurel
Author Frederic Maurel
Description Defines functions used to handle EPS bearer contexts.
Description Defines functions used to handle EPS bearer contexts.
*****************************************************************************/
@@ -27,8 +27,8 @@ Description Defines functions used to handle EPS bearer contexts.
#include "emm_sap.h"
#include <stdlib.h> // malloc, free
#include <string.h> // memset
#include <stdlib.h> // malloc, free
#include <string.h> // memset
/****************************************************************************/
/**************** E X T E R N A L D E F I N I T I O N S ****************/
@@ -39,8 +39,10 @@ Description Defines functions used to handle EPS bearer contexts.
/****************************************************************************/
#ifdef NAS_UE
static int _esm_ebr_context_check_identifiers(const network_tft_t*, const network_tft_t*);
static int _esm_ebr_context_check_precedence(const network_tft_t*, const network_tft_t*);
static int _esm_ebr_context_check_identifiers(const network_tft_t *,
const network_tft_t *);
static int _esm_ebr_context_check_precedence(const network_tft_t *,
const network_tft_t *);
#endif
/****************************************************************************/
@@ -49,139 +51,137 @@ static int _esm_ebr_context_check_precedence(const network_tft_t*, const network
/****************************************************************************
** **
** Name: esm_ebr_context_create() **
** Name: esm_ebr_context_create() **
** **
** Description: Creates a new EPS bearer context to the PDN with the spe- **
** cified PDN connection identifier **
** cified PDN connection identifier **
** **
** Inputs: ueid: UE identifier **
** pid: PDN connection identifier **
** ebi: EPS bearer identity **
** is_default: TRUE if the new bearer is a default EPS **
** bearer context **
** esm_qos: EPS bearer level QoS parameters **
** tft: Traffic flow template parameters **
** Others: _esm_data **
** Inputs: ueid: UE identifier **
** pid: PDN connection identifier **
** ebi: EPS bearer identity **
** is_default: TRUE if the new bearer is a default EPS **
** bearer context **
** esm_qos: EPS bearer level QoS parameters **
** tft: Traffic flow template parameters **
** Others: _esm_data **
** **
** Outputs: None **
** Return: The EPS bearer identity of the default EPS **
** bearer associated to the new EPS bearer **
** context if successfully created; **
** UNASSIGN EPS bearer value otherwise. **
** Others: _esm_data **
** Outputs: None **
** Return: The EPS bearer identity of the default EPS **
** bearer associated to the new EPS bearer **
** context if successfully created; **
** UNASSIGN EPS bearer value otherwise. **
** Others: _esm_data **
** **
***************************************************************************/
int esm_ebr_context_create(
#ifdef NAS_MME
unsigned int ueid,
unsigned int ueid,
#endif
int pid, int ebi, int is_default,
const network_qos_t* qos, const network_tft_t* tft)
int pid, int ebi, int is_default,
const network_qos_t *qos, const network_tft_t *tft)
{
LOG_FUNC_IN;
esm_data_context_t* ctx;
esm_data_context_t *ctx;
#ifdef NAS_UE
ctx = &_esm_data;
#endif
#ifdef NAS_MME
if (ueid < ESM_DATA_NB_UE_MAX) {
ctx = _esm_data.ctx[ueid];
ctx = _esm_data.ctx[ueid];
} else {
LOG_FUNC_RETURN (ESM_EBI_UNASSIGNED);
LOG_FUNC_RETURN (ESM_EBI_UNASSIGNED);
}
#endif
int bid = ESM_DATA_EPS_BEARER_MAX;
esm_pdn_t* pdn = NULL;
esm_pdn_t *pdn = NULL;
LOG_TRACE(INFO, "ESM-PROC - Create new %s EPS bearer context (ebi=%d) "
"for PDN connection (pid=%d)",
(is_default)? "default" : "dedicated", ebi, pid);
"for PDN connection (pid=%d)",
(is_default)? "default" : "dedicated", ebi, pid);
if (pid < ESM_DATA_PDN_MAX) {
if (pid != ctx->pdn[pid].pid) {
LOG_TRACE(ERROR, "ESM-PROC - PDN connection identifier %d is "
"not valid", pid);
}
else if (ctx->pdn[pid].data == NULL) {
LOG_TRACE(ERROR, "ESM-PROC - PDN connection %d has not been "
"allocated", pid);
}
/* Check the total number of active EPS bearers */
else if (ctx->n_ebrs > ESM_DATA_EPS_BEARER_TOTAL) {
LOG_TRACE(WARNING, "ESM-PROC - The total number of active EPS"
"bearers is exeeded");
}
else {
/* Get the PDN connection entry */
pdn = ctx->pdn[pid].data;
if (is_default) {
/* Default EPS bearer entry is defined at index 0 */
bid = 0;
if (pdn->bearer[bid] != NULL) {
LOG_TRACE(ERROR, "ESM-PROC - A default EPS bearer context "
"is already allocated");
LOG_FUNC_RETURN (ESM_EBI_UNASSIGNED);
}
}
else {
/* Search for an available EPS bearer context entry */
for (bid = 1; bid < ESM_DATA_EPS_BEARER_MAX; bid++) {
if (pdn->bearer[bid] != NULL) continue;
break;
}
}
}
if (pid != ctx->pdn[pid].pid) {
LOG_TRACE(ERROR, "ESM-PROC - PDN connection identifier %d is "
"not valid", pid);
} else if (ctx->pdn[pid].data == NULL) {
LOG_TRACE(ERROR, "ESM-PROC - PDN connection %d has not been "
"allocated", pid);
}
/* Check the total number of active EPS bearers */
else if (ctx->n_ebrs > ESM_DATA_EPS_BEARER_TOTAL) {
LOG_TRACE(WARNING, "ESM-PROC - The total number of active EPS"
"bearers is exeeded");
} else {
/* Get the PDN connection entry */
pdn = ctx->pdn[pid].data;
if (is_default) {
/* Default EPS bearer entry is defined at index 0 */
bid = 0;
if (pdn->bearer[bid] != NULL) {
LOG_TRACE(ERROR, "ESM-PROC - A default EPS bearer context "
"is already allocated");
LOG_FUNC_RETURN (ESM_EBI_UNASSIGNED);
}
} else {
/* Search for an available EPS bearer context entry */
for (bid = 1; bid < ESM_DATA_EPS_BEARER_MAX; bid++) {
if (pdn->bearer[bid] != NULL) {
continue;
}
break;
}
}
}
}
if (bid < ESM_DATA_EPS_BEARER_MAX) {
/* Create new EPS bearer context */
esm_bearer_t* ebr = (esm_bearer_t*)malloc(sizeof(esm_bearer_t));
if (ebr != NULL) {
memset(ebr, 0 , sizeof(esm_bearer_t));
/* Increment the total number of active EPS bearers */
ctx->n_ebrs += 1;
/* Increment the number of EPS bearer for this PDN connection */
pdn->n_bearers += 1;
/* Setup the EPS bearer data */
pdn->bearer[bid] = ebr;
ebr->bid = bid;
ebr->ebi = ebi;
if (qos != NULL) {
/* EPS bearer level QoS parameters */
ebr->qos = *qos;
}
if ( (tft != NULL) && (tft->n_pkfs < NET_PACKET_FILTER_MAX) ) {
/* Create new EPS bearer context */
esm_bearer_t *ebr = (esm_bearer_t *)malloc(sizeof(esm_bearer_t));
if (ebr != NULL) {
memset(ebr, 0 , sizeof(esm_bearer_t));
/* Increment the total number of active EPS bearers */
ctx->n_ebrs += 1;
/* Increment the number of EPS bearer for this PDN connection */
pdn->n_bearers += 1;
/* Setup the EPS bearer data */
pdn->bearer[bid] = ebr;
ebr->bid = bid;
ebr->ebi = ebi;
if (qos != NULL) {
/* EPS bearer level QoS parameters */
ebr->qos = *qos;
}
if ( (tft != NULL) && (tft->n_pkfs < NET_PACKET_FILTER_MAX) ) {
int i;
/* Traffic flow template parameters */
for (i = 0; i < tft->n_pkfs; i++)
{
ebr->tft.pkf[i] =
(network_pkf_t*)malloc(sizeof(network_pkf_t));
if (ebr->tft.pkf[i] != NULL) {
*(ebr->tft.pkf[i]) = *(tft->pkf[i]);
ebr->tft.n_pkfs += 1;
}
}
}
/* Traffic flow template parameters */
for (i = 0; i < tft->n_pkfs; i++) {
ebr->tft.pkf[i] =
(network_pkf_t *)malloc(sizeof(network_pkf_t));
if (ebr->tft.pkf[i] != NULL) {
*(ebr->tft.pkf[i]) = *(tft->pkf[i]);
ebr->tft.n_pkfs += 1;
}
}
}
if (is_default) {
/* Set the PDN connection activation indicator */
ctx->pdn[pid].is_active = TRUE;
/* Update the emergency bearer services indicator */
if (pdn->is_emergency) {
ctx->emergency = TRUE;
}
}
if (is_default) {
/* Set the PDN connection activation indicator */
ctx->pdn[pid].is_active = TRUE;
/* Update the emergency bearer services indicator */
if (pdn->is_emergency) {
ctx->emergency = TRUE;
}
}
/* Return the EPS bearer identity of the default EPS bearer
* associated to the new EPS bearer context */
LOG_FUNC_RETURN (pdn->bearer[0]->ebi);
}
LOG_TRACE(WARNING, "ESM-PROC - Failed to create new EPS bearer "
"context (ebi=%d)", ebi);
/* Return the EPS bearer identity of the default EPS bearer
* associated to the new EPS bearer context */
LOG_FUNC_RETURN (pdn->bearer[0]->ebi);
}
LOG_TRACE(WARNING, "ESM-PROC - Failed to create new EPS bearer "
"context (ebi=%d)", ebi);
}
LOG_FUNC_RETURN (ESM_EBI_UNASSIGNED);
@@ -189,218 +189,220 @@ int esm_ebr_context_create(
/****************************************************************************
** **
** Name: esm_ebr_context_release() **
** Name: esm_ebr_context_release() **
** **
** Description: Releases EPS bearer context entry previously allocated **
** to the EPS bearer with the specified EPS bearer identity **
** to the EPS bearer with the specified EPS bearer identity **
** **
** Inputs: ueid: UE identifier **
** ebi: EPS bearer identity **
** Others: _esm_data **
** Inputs: ueid: UE identifier **
** ebi: EPS bearer identity **
** Others: _esm_data **
** **
** Outputs: pid: Identifier of the PDN connection entry the **
** EPS bearer context belongs to **
** bid: Identifier of the released EPS bearer con- **
** text entry **
** Return: The EPS bearer identity associated to the **
** EPS bearer context if successfully relea- **
** sed; UNASSIGN EPS bearer value otherwise. **
** Others: _esm_data **
** Outputs: pid: Identifier of the PDN connection entry the **
** EPS bearer context belongs to **
** bid: Identifier of the released EPS bearer con- **
** text entry **
** Return: The EPS bearer identity associated to the **
** EPS bearer context if successfully relea- **
** sed; UNASSIGN EPS bearer value otherwise. **
** Others: _esm_data **
** **
***************************************************************************/
int esm_ebr_context_release(
#ifdef NAS_MME
unsigned int ueid,
unsigned int ueid,
#endif
int ebi, int* pid, int* bid)
int ebi, int *pid, int *bid)
{
LOG_FUNC_IN;
esm_data_context_t* ctx;
esm_data_context_t *ctx;
#ifdef NAS_UE
ctx = &_esm_data;
#endif
#ifdef NAS_MME
if (ueid < ESM_DATA_NB_UE_MAX) {
ctx = _esm_data.ctx[ueid];
ctx = _esm_data.ctx[ueid];
} else {
LOG_FUNC_RETURN (ESM_EBI_UNASSIGNED);
LOG_FUNC_RETURN (ESM_EBI_UNASSIGNED);
}
#endif
int found = FALSE;
esm_pdn_t* pdn = NULL;
esm_pdn_t *pdn = NULL;
if (ebi != ESM_EBI_UNASSIGNED) {
/*
* The identity of the EPS bearer to released is given;
* Release the EPS bearer context entry that match the specified EPS
* bearer identity
*/
/*
* The identity of the EPS bearer to released is given;
* Release the EPS bearer context entry that match the specified EPS
* bearer identity
*/
/* Search for active PDN connection */
for (*pid = 0; *pid < ESM_DATA_PDN_MAX; (*pid)++) {
if ( !ctx->pdn[*pid].is_active ) continue;
/* An active PDN connection is found */
if (ctx->pdn[*pid].data != NULL) {
pdn = ctx->pdn[*pid].data;
/* Search for the specified EPS bearer context entry */
for (*bid = 0; *bid < pdn->n_bearers; (*bid)++) {
if (pdn->bearer[*bid] != NULL) {
if (pdn->bearer[*bid]->ebi != ebi) continue;
/* The EPS bearer context entry is found */
found = TRUE;
break;
}
}
}
if (found) break;
}
}
else {
/*
* The identity of the EPS bearer to released is not given;
* Release the EPS bearer context entry allocated with the EPS
* bearer context identifier (bid) to establish connectivity to
* the PDN identified by the PDN connection identifier (pid).
* Default EPS bearer to a given PDN is always identified by the
* first EPS bearer context entry at index bid = 0
*/
if (*pid < ESM_DATA_PDN_MAX) {
if (*pid != ctx->pdn[*pid].pid) {
LOG_TRACE(ERROR, "ESM-PROC - PDN connection identifier %d "
"is not valid", *pid);
}
else if (!ctx->pdn[*pid].is_active) {
LOG_TRACE(WARNING,"ESM-PROC - PDN connection %d is not active",
*pid);
}
else if (ctx->pdn[*pid].data == NULL) {
LOG_TRACE(ERROR, "ESM-PROC - PDN connection %d has not been "
"allocated", *pid);
}
else {
pdn = ctx->pdn[*pid].data;
if (pdn->bearer[*bid] != NULL) {
ebi = pdn->bearer[*bid]->ebi;
found = TRUE;
}
}
}
/* Search for active PDN connection */
for (*pid = 0; *pid < ESM_DATA_PDN_MAX; (*pid)++) {
if ( !ctx->pdn[*pid].is_active ) {
continue;
}
/* An active PDN connection is found */
if (ctx->pdn[*pid].data != NULL) {
pdn = ctx->pdn[*pid].data;
/* Search for the specified EPS bearer context entry */
for (*bid = 0; *bid < pdn->n_bearers; (*bid)++) {
if (pdn->bearer[*bid] != NULL) {
if (pdn->bearer[*bid]->ebi != ebi) {
continue;
}
/* The EPS bearer context entry is found */
found = TRUE;
break;
}
}
}
if (found) {
break;
}
}
} else {
/*
* The identity of the EPS bearer to released is not given;
* Release the EPS bearer context entry allocated with the EPS
* bearer context identifier (bid) to establish connectivity to
* the PDN identified by the PDN connection identifier (pid).
* Default EPS bearer to a given PDN is always identified by the
* first EPS bearer context entry at index bid = 0
*/
if (*pid < ESM_DATA_PDN_MAX) {
if (*pid != ctx->pdn[*pid].pid) {
LOG_TRACE(ERROR, "ESM-PROC - PDN connection identifier %d "
"is not valid", *pid);
} else if (!ctx->pdn[*pid].is_active) {
LOG_TRACE(WARNING,"ESM-PROC - PDN connection %d is not active",
*pid);
} else if (ctx->pdn[*pid].data == NULL) {
LOG_TRACE(ERROR, "ESM-PROC - PDN connection %d has not been "
"allocated", *pid);
} else {
pdn = ctx->pdn[*pid].data;
if (pdn->bearer[*bid] != NULL) {
ebi = pdn->bearer[*bid]->ebi;
found = TRUE;
}
}
}
}
if (found) {
int i, j;
/*
* Delete the specified EPS bearer context entry
*/
if (pdn->bearer[*bid]->bid != *bid) {
LOG_TRACE(ERROR, "ESM-PROC - EPS bearer identifier %d is "
"not valid", *bid);
LOG_FUNC_RETURN (ESM_EBI_UNASSIGNED);
}
/*
* Delete the specified EPS bearer context entry
*/
if (pdn->bearer[*bid]->bid != *bid) {
LOG_TRACE(ERROR, "ESM-PROC - EPS bearer identifier %d is "
"not valid", *bid);
LOG_FUNC_RETURN (ESM_EBI_UNASSIGNED);
}
LOG_TRACE(WARNING, "ESM-PROC - Release EPS bearer context "
"(ebi=%d)", ebi);
LOG_TRACE(WARNING, "ESM-PROC - Release EPS bearer context "
"(ebi=%d)", ebi);
/* Delete the TFT */
for (i = 0; i < pdn->bearer[*bid]->tft.n_pkfs; i++) {
free(pdn->bearer[*bid]->tft.pkf[i]);
}
/* Release the specified EPS bearer data */
free(pdn->bearer[*bid]);
pdn->bearer[*bid] = NULL;
/* Decrement the number of EPS bearer context allocated
* to the PDN connection */
pdn->n_bearers -= 1;
/* Decrement the total number of active EPS bearers */
ctx->n_ebrs -= 1;
/* Delete the TFT */
for (i = 0; i < pdn->bearer[*bid]->tft.n_pkfs; i++) {
free(pdn->bearer[*bid]->tft.pkf[i]);
}
/* Release the specified EPS bearer data */
free(pdn->bearer[*bid]);
pdn->bearer[*bid] = NULL;
/* Decrement the number of EPS bearer context allocated
* to the PDN connection */
pdn->n_bearers -= 1;
/* Decrement the total number of active EPS bearers */
ctx->n_ebrs -= 1;
if (*bid == 0) {
/* 3GPP TS 24.301, section 6.4.4.3, 6.4.4.6
* If the EPS bearer identity is that of the default bearer to a
* PDN, the UE shall delete all EPS bearer contexts associated to
* that PDN connection.
*/
for (i = 1; pdn->n_bearers > 0; i++) {
if (pdn->bearer[i]) {
if (*bid == 0) {
/* 3GPP TS 24.301, section 6.4.4.3, 6.4.4.6
* If the EPS bearer identity is that of the default bearer to a
* PDN, the UE shall delete all EPS bearer contexts associated to
* that PDN connection.
*/
for (i = 1; pdn->n_bearers > 0; i++) {
if (pdn->bearer[i]) {
LOG_TRACE(WARNING, "ESM-PROC - Release EPS bearer context "
"(ebi=%d)", pdn->bearer[i]->ebi);
LOG_TRACE(WARNING, "ESM-PROC - Release EPS bearer context "
"(ebi=%d)", pdn->bearer[i]->ebi);
/* Delete the TFT */
for (j = 0; j < pdn->bearer[i]->tft.n_pkfs; j++) {
free(pdn->bearer[i]->tft.pkf[j]);
}
/* Set the EPS bearer context state to INACTIVE */
/* Delete the TFT */
for (j = 0; j < pdn->bearer[i]->tft.n_pkfs; j++) {
free(pdn->bearer[i]->tft.pkf[j]);
}
/* Set the EPS bearer context state to INACTIVE */
#ifdef NAS_UE
(void) esm_ebr_set_status(pdn->bearer[i]->ebi,
ESM_EBR_INACTIVE, TRUE);
(void) esm_ebr_set_status(pdn->bearer[i]->ebi,
ESM_EBR_INACTIVE, TRUE);
#endif
#ifdef NAS_MME
(void) esm_ebr_set_status(ueid, pdn->bearer[i]->ebi,
ESM_EBR_INACTIVE, TRUE);
(void) esm_ebr_set_status(ueid, pdn->bearer[i]->ebi,
ESM_EBR_INACTIVE, TRUE);
#endif
/* Release EPS bearer data */
/* Release EPS bearer data */
#ifdef NAS_UE
(void) esm_ebr_release(pdn->bearer[i]->ebi);
(void) esm_ebr_release(pdn->bearer[i]->ebi);
#endif
#ifdef NAS_MME
(void) esm_ebr_release(ueid, pdn->bearer[i]->ebi);
(void) esm_ebr_release(ueid, pdn->bearer[i]->ebi);
#endif
// esm_ebr_release()
/* Release dedicated EPS bearer data */
free(pdn->bearer[i]);
pdn->bearer[i] = NULL;
/* Decrement the number of EPS bearer context allocated
* to the PDN connection */
pdn->n_bearers -= 1;
/* Decrement the total number of active EPS bearers */
ctx->n_ebrs -= 1;
}
}
/* Reset the PDN connection activation indicator */
ctx->pdn[*pid].is_active = FALSE;
/* Update the emergency bearer services indicator */
if (pdn->is_emergency) {
ctx->emergency = FALSE;
}
}
// esm_ebr_release()
/* Release dedicated EPS bearer data */
free(pdn->bearer[i]);
pdn->bearer[i] = NULL;
/* Decrement the number of EPS bearer context allocated
* to the PDN connection */
pdn->n_bearers -= 1;
/* Decrement the total number of active EPS bearers */
ctx->n_ebrs -= 1;
}
}
/* Reset the PDN connection activation indicator */
ctx->pdn[*pid].is_active = FALSE;
/* Update the emergency bearer services indicator */
if (pdn->is_emergency) {
ctx->emergency = FALSE;
}
}
#ifdef NAS_UE
/* 3GPP TS 24.301, section 6.4.4.6
* If the UE locally deactivated all EPS bearer contexts, the UE
* shall perform a local detach and enter state EMM-DEREGISTERED.
*/
if (ctx->n_ebrs == 0) {
emm_sap_t emm_sap;
emm_sap.primitive = EMMESM_ESTABLISH_CNF;
emm_sap.u.emm_esm.u.establish.is_attached = FALSE;
(void) emm_sap_send(&emm_sap);
}
/* 3GPP TS 24.301, section 6.4.4.3, 6.4.4.6
* If due to the EPS bearer context deactivation only the PDN
* connection for emergency bearer services remains established,
* the UE shall consider itself attached for emergency bearer
* services only.
*/
else if ( ctx->emergency && (ctx->n_ebrs == 1) ) {
emm_sap_t emm_sap;
emm_sap.primitive = EMMESM_ESTABLISH_CNF;
emm_sap.u.emm_esm.u.establish.is_attached = TRUE;
emm_sap.u.emm_esm.u.establish.is_emergency = TRUE;
(void) emm_sap_send(&emm_sap);
}
/* 3GPP TS 24.301, section 6.4.4.6
* If the UE locally deactivated all EPS bearer contexts, the UE
* shall perform a local detach and enter state EMM-DEREGISTERED.
*/
if (ctx->n_ebrs == 0) {
emm_sap_t emm_sap;
emm_sap.primitive = EMMESM_ESTABLISH_CNF;
emm_sap.u.emm_esm.u.establish.is_attached = FALSE;
(void) emm_sap_send(&emm_sap);
}
/* 3GPP TS 24.301, section 6.4.4.3, 6.4.4.6
* If due to the EPS bearer context deactivation only the PDN
* connection for emergency bearer services remains established,
* the UE shall consider itself attached for emergency bearer
* services only.
*/
else if ( ctx->emergency && (ctx->n_ebrs == 1) ) {
emm_sap_t emm_sap;
emm_sap.primitive = EMMESM_ESTABLISH_CNF;
emm_sap.u.emm_esm.u.establish.is_attached = TRUE;
emm_sap.u.emm_esm.u.establish.is_emergency = TRUE;
(void) emm_sap_send(&emm_sap);
}
#endif // NAS_UE
#ifdef NAS_MME
if (ctx->n_ebrs == 0) {
/* TODO: Release the PDN connection and marked the UE as inactive
* in the network for EPS services (is_attached = FALSE) */
}
if (ctx->n_ebrs == 0) {
/* TODO: Release the PDN connection and marked the UE as inactive
* in the network for EPS services (is_attached = FALSE) */
}
#endif
LOG_FUNC_RETURN (ebi);
LOG_FUNC_RETURN (ebi);
}
LOG_FUNC_RETURN (ESM_EBI_UNASSIGNED);
@@ -409,21 +411,21 @@ int esm_ebr_context_release(
#ifdef NAS_UE
/****************************************************************************
** **
** Name: esm_ebr_context_get_pid() **
** Name: esm_ebr_context_get_pid() **
** **
** Description: Returns the identifier of the PDN connection entry the **
** default EPS bearer context with the specified EPS bearer **
** identity belongs to **
** default EPS bearer context with the specified EPS bearer **
** identity belongs to **
** **
** Inputs: ebi: The EPS bearer identity of the default EPS **
** bearer context **
** Others: _esm_data **
** Inputs: ebi: The EPS bearer identity of the default EPS **
** bearer context **
** Others: _esm_data **
** **
** Outputs: None **
** Return: The identifier of the PDN connection entry **
** associated to the specified default EPS **
** bearer context if it exists; -1 otherwise. **
** Others: None **
** Outputs: None **
** Return: The identifier of the PDN connection entry **
** associated to the specified default EPS **
** bearer context if it exists; -1 otherwise. **
** Others: None **
** **
***************************************************************************/
int esm_ebr_context_get_pid(int ebi)
@@ -433,75 +435,83 @@ int esm_ebr_context_get_pid(int ebi)
int pid;
for (pid = 0; pid < ESM_DATA_PDN_MAX; pid++) {
if (_esm_data.pdn[pid].data == NULL) continue;
if (_esm_data.pdn[pid].data->bearer[0] == NULL) continue;
if (_esm_data.pdn[pid].data->bearer[0]->ebi == ebi) break;
if (_esm_data.pdn[pid].data == NULL) {
continue;
}
if (_esm_data.pdn[pid].data->bearer[0] == NULL) {
continue;
}
if (_esm_data.pdn[pid].data->bearer[0]->ebi == ebi) {
break;
}
}
if (pid < ESM_DATA_PDN_MAX) {
LOG_FUNC_RETURN (pid);
LOG_FUNC_RETURN (pid);
}
LOG_FUNC_RETURN (-1);
LOG_FUNC_RETURN (-1);
}
/****************************************************************************
** **
** Name: esm_ebr_context_check_tft() **
** Name: esm_ebr_context_check_tft() **
** **
** Description: Checks syntactical errors in packet filters associated to **
** the EPS bearer context with the specified EPS bearer **
** identity for the PDN connection entry with the given **
** identifier **
** the EPS bearer context with the specified EPS bearer **
** identity for the PDN connection entry with the given **
** identifier **
** **
** Inputs: pid: Identifier of the PDN connection entry the **
** EPS bearer context belongs to **
** ebi: The EPS bearer identity of the EPS bearer **
** context with associated packet filter list **
** tft: The traffic flow template (set of packet **
** filters) to be checked **
** operation: Traffic flow template operation **
** Others: _esm_data **
** Inputs: pid: Identifier of the PDN connection entry the **
** EPS bearer context belongs to **
** ebi: The EPS bearer identity of the EPS bearer **
** context with associated packet filter list **
** tft: The traffic flow template (set of packet **
** filters) to be checked **
** operation: Traffic flow template operation **
** Others: _esm_data **
** **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: None **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: None **
** **
***************************************************************************/
int esm_ebr_context_check_tft(int pid, int ebi,
const network_tft_t* tft,
esm_ebr_context_tft_t operation)
const network_tft_t *tft,
esm_ebr_context_tft_t operation)
{
LOG_FUNC_IN;
int rc = RETURNerror;
if (pid < ESM_DATA_PDN_MAX) {
if (pid != _esm_data.pdn[pid].pid) {
LOG_TRACE(ERROR, "ESM-PROC - PDN connection identifier %d "
"is not valid", pid);
}
else if (_esm_data.pdn[pid].data == NULL) {
LOG_TRACE(ERROR, "ESM-PROC - PDN connection %d has not been "
"allocated", pid);
}
else if (operation == ESM_EBR_CONTEXT_TFT_CREATE) {
esm_pdn_t* pdn = _esm_data.pdn[pid].data;
/* For each EPS bearer context associated to the PDN connection */
for (int i = 0; i < pdn->n_bearers; i++) {
if (pdn->bearer[i]) {
if (pdn->bearer[i]->ebi == ebi) {
/* Check the packet filter identifiers */
rc = _esm_ebr_context_check_identifiers(tft,
&pdn->bearer[i]->tft);
if (rc != RETURNok) break;
}
/* Check the packet filter precedence values */
rc = _esm_ebr_context_check_precedence(tft,
&pdn->bearer[i]->tft);
if (rc != RETURNok) break;
}
}
}
if (pid != _esm_data.pdn[pid].pid) {
LOG_TRACE(ERROR, "ESM-PROC - PDN connection identifier %d "
"is not valid", pid);
} else if (_esm_data.pdn[pid].data == NULL) {
LOG_TRACE(ERROR, "ESM-PROC - PDN connection %d has not been "
"allocated", pid);
} else if (operation == ESM_EBR_CONTEXT_TFT_CREATE) {
esm_pdn_t *pdn = _esm_data.pdn[pid].data;
/* For each EPS bearer context associated to the PDN connection */
for (int i = 0; i < pdn->n_bearers; i++) {
if (pdn->bearer[i]) {
if (pdn->bearer[i]->ebi == ebi) {
/* Check the packet filter identifiers */
rc = _esm_ebr_context_check_identifiers(tft,
&pdn->bearer[i]->tft);
if (rc != RETURNok) {
break;
}
}
/* Check the packet filter precedence values */
rc = _esm_ebr_context_check_precedence(tft,
&pdn->bearer[i]->tft);
if (rc != RETURNok) {
break;
}
}
}
}
}
LOG_FUNC_RETURN (rc);
@@ -515,78 +525,78 @@ int esm_ebr_context_check_tft(int pid, int ebi,
#ifdef NAS_UE
/****************************************************************************
** **
** Name: _esm_ebr_context_check_identifiers() **
** Name: _esm_ebr_context_check_identifiers() **
** **
** Description: Compares traffic flow templates to check whether two or **
** more packet filters have identical packet filter identi- **
** fiers **
** more packet filters have identical packet filter identi- **
** fiers **
** **
** Inputs: tft1: The first set of packet filters **
** tft2: The second set of packet filters **
** Others: None **
** Inputs: tft1: The first set of packet filters **
** tft2: The second set of packet filters **
** Others: None **
** **
** Outputs: None **
** Return: RETURNerror if at least one packet filter **
** has same identifier in both traffic flow **
** templates; RETURNok otherwise. **
** Others: None **
** Outputs: None **
** Return: RETURNerror if at least one packet filter **
** has same identifier in both traffic flow **
** templates; RETURNok otherwise. **
** Others: None **
** **
***************************************************************************/
static int _esm_ebr_context_check_identifiers(const network_tft_t* tft1,
const network_tft_t* tft2)
static int _esm_ebr_context_check_identifiers(const network_tft_t *tft1,
const network_tft_t *tft2)
{
if ( (tft1 == NULL) || (tft2 == NULL) ) {
return (RETURNok);
return (RETURNok);
}
for (int i = 0; i < tft1->n_pkfs; i++) {
for (int j = 0; j < tft2->n_pkfs; j++) {
/* Packet filters should have been allocated */
if (tft1->pkf[i]->id == tft2->pkf[i]->id) {
/* 3GPP TS 24.301, section 6.4.2.5, abnormal cases d.1
* Packet filters have same identifier */
return (RETURNerror);
}
}
for (int j = 0; j < tft2->n_pkfs; j++) {
/* Packet filters should have been allocated */
if (tft1->pkf[i]->id == tft2->pkf[i]->id) {
/* 3GPP TS 24.301, section 6.4.2.5, abnormal cases d.1
* Packet filters have same identifier */
return (RETURNerror);
}
}
}
return (RETURNok);
}
/****************************************************************************
** **
** Name: _esm_ebr_context_check_precedence() **
** Name: _esm_ebr_context_check_precedence() **
** **
** Description: Compares traffic flow templates to check whether two or **
** more packet filters have identical precedence values **
** more packet filters have identical precedence values **
** **
** Inputs: tft1: The first set of packet filters **
** tft2: The second set of packet filters **
** Others: None **
** Inputs: tft1: The first set of packet filters **
** tft2: The second set of packet filters **
** Others: None **
** **
** Outputs: None **
** Return: RETURNerror if at least one packet filter **
** has same precedence value in both traffic **
** flow templates; RETURNerror otherwise. **
** Others: None **
** Outputs: None **
** Return: RETURNerror if at least one packet filter **
** has same precedence value in both traffic **
** flow templates; RETURNerror otherwise. **
** Others: None **
** **
***************************************************************************/
static int _esm_ebr_context_check_precedence(const network_tft_t* tft1,
const network_tft_t* tft2)
static int _esm_ebr_context_check_precedence(const network_tft_t *tft1,
const network_tft_t *tft2)
{
if ( (tft1 == NULL) || (tft2 == NULL) ) {
return (RETURNok);
return (RETURNok);
}
for (int i = 0; i < tft1->n_pkfs; i++) {
for (int j = 0; j < tft2->n_pkfs; j++) {
/* Packet filters should have been allocated */
if (tft1->pkf[i]->precedence == tft2->pkf[i]->precedence) {
/* 3GPP TS 24.301, section 6.4.2.5, abnormal cases d.2
* Packet filters have same precedence value */
/* TODO: Actually if the old packet filters do not belong
* to the default EPS bearer context, the UE shall not
* diagnose an error (see 6.4.2.5, abnormal cases d.2) */
return (RETURNerror);
}
}
for (int j = 0; j < tft2->n_pkfs; j++) {
/* Packet filters should have been allocated */
if (tft1->pkf[i]->precedence == tft2->pkf[i]->precedence) {
/* 3GPP TS 24.301, section 6.4.2.5, abnormal cases d.2
* Packet filters have same precedence value */
/* TODO: Actually if the old packet filters do not belong
* to the default EPS bearer context, the UE shall not
* diagnose an error (see 6.4.2.5, abnormal cases d.2) */
return (RETURNerror);
}
}
}
return (RETURNok);
}
@@ -1,20 +1,20 @@
/*****************************************************************************
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Source esm_ebr_context.h
Source esm_ebr_context.h
Version 0.1
Version 0.1
Date 2013/05/28
Date 2013/05/28
Product NAS stack
Product NAS stack
Subsystem EPS Session Management
Subsystem EPS Session Management
Author Frederic Maurel
Author Frederic Maurel
Description Defines functions used to handle EPS bearer contexts.
Description Defines functions used to handle EPS bearer contexts.
*****************************************************************************/
#ifndef __ESM_EBR_CONTEXT_H__
@@ -50,19 +50,22 @@ typedef enum {
/****************************************************************************/
#ifdef NAS_UE
int esm_ebr_context_create(int pid, int ebi, int is_default, const network_qos_t* qos, const network_tft_t* tft);
int esm_ebr_context_create(int pid, int ebi, int is_default,
const network_qos_t *qos, const network_tft_t *tft);
int esm_ebr_context_release(int ebi, int* pid, int* bid);
int esm_ebr_context_release(int ebi, int *pid, int *bid);
int esm_ebr_context_get_pid(int ebi);
int esm_ebr_context_check_tft(int pid, int ebi, const network_tft_t* tft, esm_ebr_context_tft_t operation);
int esm_ebr_context_check_tft(int pid, int ebi, const network_tft_t *tft,
esm_ebr_context_tft_t operation);
#endif
#ifdef NAS_MME
int esm_ebr_context_create(unsigned int ueid, int pid, int ebi, int is_default, const network_qos_t* qos, const network_tft_t* tft);
int esm_ebr_context_create(unsigned int ueid, int pid, int ebi, int is_default,
const network_qos_t *qos, const network_tft_t *tft);
int esm_ebr_context_release(unsigned int ueid, int ebi, int* pid, int* bid);
int esm_ebr_context_release(unsigned int ueid, int ebi, int *pid, int *bid);
#endif
#endif /* __ESM_EBR_CONTEXT_H__ */
+3 -3
View File
@@ -3,7 +3,7 @@
char ip_addr_str[100];
inline char* esm_data_get_ipv4_addr(const OctetString* ip_addr)
inline char *esm_data_get_ipv4_addr(const OctetString *ip_addr)
{
if (ip_addr->length > 0) {
sprintf(ip_addr_str, "%u.%u.%u.%u",
@@ -14,7 +14,7 @@ inline char* esm_data_get_ipv4_addr(const OctetString* ip_addr)
return (NULL);
}
inline char* esm_data_get_ipv6_addr(const OctetString* ip_addr)
inline char *esm_data_get_ipv6_addr(const OctetString *ip_addr)
{
if (ip_addr->length > 0) {
sprintf(ip_addr_str, "%x%.2x:%x%.2x:%x%.2x:%x%.2x",
@@ -27,7 +27,7 @@ inline char* esm_data_get_ipv6_addr(const OctetString* ip_addr)
return (NULL);
}
inline char* esm_data_get_ipv4v6_addr(const OctetString* ip_addr)
inline char *esm_data_get_ipv4v6_addr(const OctetString *ip_addr)
{
if (ip_addr->length > 0) {
sprintf(ip_addr_str, "%u.%u.%u.%u / %x%.2x:%x%.2x:%x%.2x:%x%.2x",
+150 -159
View File
@@ -1,21 +1,21 @@
/*****************************************************************************
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Source esm_main.c
Source esm_main.c
Version 0.1
Version 0.1
Date 2012/12/04
Date 2012/12/04
Product NAS stack
Product NAS stack
Subsystem EPS Session Management
Subsystem EPS Session Management
Author Frederic Maurel
Author Frederic Maurel
Description Defines the EPS Session Management procedure call manager,
the main entry point for elementary ESM processing.
Description Defines the EPS Session Management procedure call manager,
the main entry point for elementary ESM processing.
*****************************************************************************/
@@ -42,16 +42,16 @@ Description Defines the EPS Session Management procedure call manager,
#ifdef NAS_UE
/****************************************************************************
** **
** Name: esm_main_initialize() **
** Name: esm_main_initialize() **
** **
** Description: Initializes ESM internal data **
** **
** Inputs: cb: The user notification callback **
** Others: None **
** Inputs: cb: The user notification callback **
** Others: None **
** **
** Outputs: None **
** Return: None **
** Others: _esm_data **
** Outputs: None **
** Return: None **
** Others: _esm_data **
** **
***************************************************************************/
void esm_main_initialize(esm_indication_callback_t cb)
@@ -63,9 +63,9 @@ void esm_main_initialize(esm_indication_callback_t cb)
/* List of active PDN connections */
_esm_data.n_pdns = 0;
for (int i = 0; i < ESM_DATA_PDN_MAX + 1; i++) {
_esm_data.pdn[i].pid = -1;
_esm_data.pdn[i].is_active = FALSE;
_esm_data.pdn[i].data = NULL;
_esm_data.pdn[i].pid = -1;
_esm_data.pdn[i].is_active = FALSE;
_esm_data.pdn[i].data = NULL;
}
/* Emergency bearer services indicator */
_esm_data.emergency = FALSE;
@@ -82,16 +82,16 @@ void esm_main_initialize(esm_indication_callback_t cb)
#ifdef NAS_MME
/****************************************************************************
** **
** Name: esm_main_initialize() **
** Name: esm_main_initialize() **
** **
** Description: Initializes ESM internal data **
** **
** Inputs: None **
** Others: None **
** Inputs: None **
** Others: None **
** **
** Outputs: None **
** Return: None **
** Others: None **
** Outputs: None **
** Return: None **
** Others: None **
** **
***************************************************************************/
void esm_main_initialize(void)
@@ -102,12 +102,12 @@ void esm_main_initialize(void)
/* Retreive MME supported configuration data */
if (mme_api_get_esm_config(&_esm_data.conf) != RETURNok) {
LOG_TRACE(ERROR, "ESM-MAIN - Failed to get MME configuration data");
LOG_TRACE(ERROR, "ESM-MAIN - Failed to get MME configuration data");
}
/* Initialize ESM contexts */
for (i = 0; i < ESM_DATA_NB_UE_MAX; i++) {
_esm_data.ctx[i] = NULL;
_esm_data.ctx[i] = NULL;
}
/* Initialize the EPS bearer context manager */
@@ -119,16 +119,16 @@ void esm_main_initialize(void)
/****************************************************************************
** **
** Name: esm_main_cleanup() **
** Name: esm_main_cleanup() **
** **
** Description: Performs the EPS Session Management clean up procedure **
** **
** Inputs: None **
** Others: None **
** Inputs: None **
** Others: None **
** **
** Outputs: None **
** Return: None **
** Others: None **
** Outputs: None **
** Return: None **
** Others: None **
** **
***************************************************************************/
void esm_main_cleanup(void)
@@ -138,28 +138,28 @@ void esm_main_cleanup(void)
#ifdef NAS_UE
/* De-activate EPS bearers and clean up PDN connections */
for (int pid = 0; pid < ESM_DATA_PDN_MAX; pid++) {
if (_esm_data.pdn[pid].data) {
esm_pdn_t* pdn = _esm_data.pdn[pid].data;
if (pdn->apn.length > 0) {
free(pdn->apn.value);
}
/* Release EPS bearer contexts */
for (int bid = 0; bid < pdn->n_bearers; bid++) {
if (pdn->bearer[bid]) {
LOG_TRACE(WARNING, "ESM-MAIN - Release EPS bearer "
"context (ebi=%d)", pdn->bearer[bid]->ebi);
/* Delete the TFT */
for (int i = 0; i < pdn->bearer[bid]->tft.n_pkfs; i++) {
if (pdn->bearer[bid]->tft.pkf[i]) {
free(pdn->bearer[bid]->tft.pkf[i]);
}
}
free(pdn->bearer[bid]);
}
}
/* Release the PDN connection */
free(_esm_data.pdn[pid].data);
}
if (_esm_data.pdn[pid].data) {
esm_pdn_t *pdn = _esm_data.pdn[pid].data;
if (pdn->apn.length > 0) {
free(pdn->apn.value);
}
/* Release EPS bearer contexts */
for (int bid = 0; bid < pdn->n_bearers; bid++) {
if (pdn->bearer[bid]) {
LOG_TRACE(WARNING, "ESM-MAIN - Release EPS bearer "
"context (ebi=%d)", pdn->bearer[bid]->ebi);
/* Delete the TFT */
for (int i = 0; i < pdn->bearer[bid]->tft.n_pkfs; i++) {
if (pdn->bearer[bid]->tft.pkf[i]) {
free(pdn->bearer[bid]->tft.pkf[i]);
}
}
free(pdn->bearer[bid]);
}
}
/* Release the PDN connection */
free(_esm_data.pdn[pid].data);
}
}
#endif
@@ -169,18 +169,18 @@ void esm_main_cleanup(void)
#ifdef NAS_UE
/****************************************************************************
** **
** Name: esm_main_get_nb_pdn_max() **
** Name: esm_main_get_nb_pdn_max() **
** **
** Description: Get the maximum number of PDN connections that may be in **
** a defined state at the same time **
** a defined state at the same time **
** **
** Inputs: None **
** Others: _esm_data **
** Inputs: None **
** Others: _esm_data **
** **
** Outputs: None **
** Return: The maximum number of PDN connections that **
** may be defined **
** Others: None **
** Outputs: None **
** Return: The maximum number of PDN connections that **
** may be defined **
** Others: None **
** **
***************************************************************************/
int esm_main_get_nb_pdns_max(void)
@@ -192,16 +192,16 @@ int esm_main_get_nb_pdns_max(void)
/****************************************************************************
** **
** Name: esm_main_get_nb_pdns() **
** Name: esm_main_get_nb_pdns() **
** **
** Description: Get the number of active PDN connections **
** **
** Inputs: None **
** Others: _esm_data **
** Inputs: None **
** Others: _esm_data **
** **
** Outputs: None **
** Return: The number of active PDN connections **
** Others: None **
** Outputs: None **
** Return: The number of active PDN connections **
** Others: None **
** **
***************************************************************************/
int esm_main_get_nb_pdns(void)
@@ -213,18 +213,18 @@ int esm_main_get_nb_pdns(void)
/****************************************************************************
** **
** Name: esm_main_has_emergency() **
** Name: esm_main_has_emergency() **
** **
** Description: Check whether a PDN connection for emergency bearer ser- **
** vices is established **
** vices is established **
** **
** Inputs: None **
** Others: _esm_data **
** Inputs: None **
** Others: _esm_data **
** **
** Outputs: None **
** Return: TRUE if a PDN connection for emergency **
** bearer services is established **
** Others: None **
** Outputs: None **
** Return: TRUE if a PDN connection for emergency **
** bearer services is established **
** Others: None **
** **
***************************************************************************/
int esm_main_has_emergency(void)
@@ -236,46 +236,44 @@ int esm_main_has_emergency(void)
/****************************************************************************
** **
** Name: esm_main_get_pdn_status() **
** Name: esm_main_get_pdn_status() **
** **
** Description: Get the status of the specified PDN connection **
** **
** Inputs: cid: PDN connection identifier **
** Others: _esm_data **
** Inputs: cid: PDN connection identifier **
** Others: _esm_data **
** **
** Outputs: state: TRUE if the current state of the PDN con- **
** nection is ACTIVE; FALSE otherwise. **
** Return: TRUE if the specified PDN connection has a **
** PDN context defined; FALSE if no any PDN **
** context has been defined for the specified **
** connection. **
** Others: None **
** Outputs: state: TRUE if the current state of the PDN con- **
** nection is ACTIVE; FALSE otherwise. **
** Return: TRUE if the specified PDN connection has a **
** PDN context defined; FALSE if no any PDN **
** context has been defined for the specified **
** connection. **
** Others: None **
** **
***************************************************************************/
int esm_main_get_pdn_status(int cid, int* state)
int esm_main_get_pdn_status(int cid, int *state)
{
LOG_FUNC_IN;
unsigned int pid = cid - 1;
if (pid >= ESM_DATA_PDN_MAX) {
return (FALSE);
}
else if (pid != _esm_data.pdn[pid].pid) {
LOG_TRACE(WARNING, "ESM-MAIN - PDN connection %d is not defined", cid);
return (FALSE);
}
else if (_esm_data.pdn[pid].data == NULL) {
LOG_TRACE(ERROR, "ESM-MAIN - PDN connection %d has not been allocated",
cid);
return (FALSE);
return (FALSE);
} else if (pid != _esm_data.pdn[pid].pid) {
LOG_TRACE(WARNING, "ESM-MAIN - PDN connection %d is not defined", cid);
return (FALSE);
} else if (_esm_data.pdn[pid].data == NULL) {
LOG_TRACE(ERROR, "ESM-MAIN - PDN connection %d has not been allocated",
cid);
return (FALSE);
}
if (_esm_data.pdn[pid].data->bearer[0] != NULL) {
/* The status of a PDN connection is the status of the default EPS bearer
* that has been assigned to this PDN connection at activation time */
int ebi = _esm_data.pdn[pid].data->bearer[0]->ebi;
*state = (esm_ebr_get_status(ebi) == ESM_EBR_ACTIVE);
/* The status of a PDN connection is the status of the default EPS bearer
* that has been assigned to this PDN connection at activation time */
int ebi = _esm_data.pdn[pid].data->bearer[0]->ebi;
*state = (esm_ebr_get_status(ebi) == ESM_EBR_ACTIVE);
}
/* The PDN connection has not been activated yet */
LOG_FUNC_RETURN (TRUE);
@@ -283,48 +281,46 @@ int esm_main_get_pdn_status(int cid, int* state)
/****************************************************************************
** **
** Name: esm_main_get_pdn() **
** Name: esm_main_get_pdn() **
** **
** Description: Get parameters defined for the specified PDN connection **
** **
** Inputs: cid: PDN connection identifier **
** Others: _esm_data **
** Inputs: cid: PDN connection identifier **
** Others: _esm_data **
** **
** Outputs: type: PDN connection type (IPv4, IPv6, IPv4v6) **
** apn: Access Point logical Name in used **
** is_emergency: Emergency bearer services indicator **
** is_active: Active PDN connection indicator **
** Return: RETURNok, RETURNerror **
** Others: None **
** Outputs: type: PDN connection type (IPv4, IPv6, IPv4v6) **
** apn: Access Point logical Name in used **
** is_emergency: Emergency bearer services indicator **
** is_active: Active PDN connection indicator **
** Return: RETURNok, RETURNerror **
** Others: None **
** **
***************************************************************************/
int esm_main_get_pdn(int cid, int* type, const char** apn,
int* is_emergency, int* is_active)
int esm_main_get_pdn(int cid, int *type, const char **apn,
int *is_emergency, int *is_active)
{
LOG_FUNC_IN;
unsigned int pid = cid - 1;
if (pid >= ESM_DATA_PDN_MAX) {
return (RETURNerror);
}
else if (pid != _esm_data.pdn[pid].pid) {
LOG_TRACE(WARNING, "ESM-MAIN - PDN connection %d is not defined", cid);
return (RETURNerror);
}
else if (_esm_data.pdn[pid].data == NULL) {
LOG_TRACE(ERROR, "ESM-MAIN - PDN connection %d has not been allocated",
cid);
return (RETURNerror);
return (RETURNerror);
} else if (pid != _esm_data.pdn[pid].pid) {
LOG_TRACE(WARNING, "ESM-MAIN - PDN connection %d is not defined", cid);
return (RETURNerror);
} else if (_esm_data.pdn[pid].data == NULL) {
LOG_TRACE(ERROR, "ESM-MAIN - PDN connection %d has not been allocated",
cid);
return (RETURNerror);
}
/* Get the PDN type */
*type = _esm_data.pdn[pid].data->type;
/* Get the Access Point Name */
if (_esm_data.pdn[pid].data->apn.length > 0) {
*apn = (char*)(_esm_data.pdn[pid].data->apn.value);
*apn = (char *)(_esm_data.pdn[pid].data->apn.value);
} else {
*apn = NULL;
*apn = NULL;
}
/* Get the emergency bearer services indicator */
*is_emergency = _esm_data.pdn[pid].data->is_emergency;
@@ -336,55 +332,50 @@ int esm_main_get_pdn(int cid, int* type, const char** apn,
/****************************************************************************
** **
** Name: esm_main_get_pdn_addr() **
** Name: esm_main_get_pdn_addr() **
** **
** Description: Get IP address(es) assigned to the specified PDN connec- **
** tion **
** tion **
** **
** Inputs: cid: PDN connection identifier **
** Others: _esm_data **
** Inputs: cid: PDN connection identifier **
** Others: _esm_data **
** **
** Outputs: ipv4adddr: IPv4 address **
** ipv6adddr: IPv6 address **
** Return: RETURNok, RETURNerror **
** Others: None **
** Outputs: ipv4adddr: IPv4 address **
** ipv6adddr: IPv6 address **
** Return: RETURNok, RETURNerror **
** Others: None **
** **
***************************************************************************/
int esm_main_get_pdn_addr(int cid, const char** ipv4addr, const char** ipv6addr)
int esm_main_get_pdn_addr(int cid, const char **ipv4addr, const char **ipv6addr)
{
LOG_FUNC_IN;
unsigned int pid = cid - 1;
if (pid >= ESM_DATA_PDN_MAX) {
return (RETURNerror);
}
else if (pid != _esm_data.pdn[pid].pid) {
LOG_TRACE(WARNING, "ESM-MAIN - PDN connection %d is not defined", cid);
return (RETURNerror);
}
else if (_esm_data.pdn[pid].data == NULL) {
LOG_TRACE(ERROR, "ESM-MAIN - PDN connection %d has not been allocated",
cid);
return (RETURNerror);
}
else if (!_esm_data.pdn[pid].is_active) {
/* No any IP address has been assigned to this PDN connection */
return (RETURNok);
return (RETURNerror);
} else if (pid != _esm_data.pdn[pid].pid) {
LOG_TRACE(WARNING, "ESM-MAIN - PDN connection %d is not defined", cid);
return (RETURNerror);
} else if (_esm_data.pdn[pid].data == NULL) {
LOG_TRACE(ERROR, "ESM-MAIN - PDN connection %d has not been allocated",
cid);
return (RETURNerror);
} else if (!_esm_data.pdn[pid].is_active) {
/* No any IP address has been assigned to this PDN connection */
return (RETURNok);
}
if (_esm_data.pdn[pid].data->type == NET_PDN_TYPE_IPV4) {
/* Get IPv4 address */
*ipv4addr = _esm_data.pdn[pid].data->ip_addr;
}
else if (_esm_data.pdn[pid].data->type == NET_PDN_TYPE_IPV6) {
/* Get IPv6 address */
*ipv6addr = _esm_data.pdn[pid].data->ip_addr;
}
else {
/* IPv4v6 dual-stack terminal */
*ipv4addr = _esm_data.pdn[pid].data->ip_addr;
*ipv6addr = _esm_data.pdn[pid].data->ip_addr+ESM_DATA_IPV4_ADDRESS_SIZE;
/* Get IPv4 address */
*ipv4addr = _esm_data.pdn[pid].data->ip_addr;
} else if (_esm_data.pdn[pid].data->type == NET_PDN_TYPE_IPV6) {
/* Get IPv6 address */
*ipv6addr = _esm_data.pdn[pid].data->ip_addr;
} else {
/* IPv4v6 dual-stack terminal */
*ipv4addr = _esm_data.pdn[pid].data->ip_addr;
*ipv6addr = _esm_data.pdn[pid].data->ip_addr+ESM_DATA_IPV4_ADDRESS_SIZE;
}
LOG_FUNC_RETURN (RETURNok);
+14 -13
View File
@@ -1,21 +1,21 @@
/*****************************************************************************
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Source esm_main.h
Source esm_main.h
Version 0.1
Version 0.1
Date 2012/12/04
Date 2012/12/04
Product NAS stack
Product NAS stack
Subsystem EPS Session Management
Subsystem EPS Session Management
Author Frederic Maurel
Author Frederic Maurel
Description Defines the EPS Session Management procedure call manager,
the main entry point for elementary ESM processing.
Description Defines the EPS Session Management procedure call manager,
the main entry point for elementary ESM processing.
*****************************************************************************/
@@ -54,9 +54,10 @@ void esm_main_cleanup(void);
int esm_main_get_nb_pdns_max(void);
int esm_main_get_nb_pdns(void);
int esm_main_has_emergency(void);
int esm_main_get_pdn_status(int cid, int* state);
int esm_main_get_pdn(int cid, int* type, const char** apn, int* is_emergency, int* is_active);
int esm_main_get_pdn_addr(int cid, const char** ipv4addr, const char** ipv6addr);
int esm_main_get_pdn_status(int cid, int *state);
int esm_main_get_pdn(int cid, int *type, const char **apn, int *is_emergency,
int *is_active);
int esm_main_get_pdn_addr(int cid, const char **ipv4addr, const char **ipv6addr);
#endif // NAS_UE
+91 -59
View File
@@ -1,21 +1,21 @@
/*****************************************************************************
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Source esm_proc.h
Source esm_proc.h
Version 0.1
Version 0.1
Date 2013/01/02
Date 2013/01/02
Product NAS stack
Product NAS stack
Subsystem EPS Session Management
Subsystem EPS Session Management
Author Frederic Maurel
Author Frederic Maurel
Description Defines the EPS Session Management procedures executed at
the ESM Service Access Points.
Description Defines the EPS Session Management procedures executed at
the ESM Service Access Points.
*****************************************************************************/
#ifndef __ESM_PROC_H__
@@ -33,13 +33,13 @@ Description Defines the EPS Session Management procedures executed at
* -------------------------
*/
#ifdef NAS_UE
#define T3482_DEFAULT_VALUE 8 /* PDN connectivity request */
#define T3492_DEFAULT_VALUE 6 /* PDN disconnect request */
#define T3482_DEFAULT_VALUE 8 /* PDN connectivity request */
#define T3492_DEFAULT_VALUE 6 /* PDN disconnect request */
#endif
#ifdef NAS_MME
#define T3485_DEFAULT_VALUE 8 /* Activate EPS bearer request */
#define T3495_DEFAULT_VALUE 8 /* Deactivate EPS bearer request */
#define T3485_DEFAULT_VALUE 8 /* Activate EPS bearer request */
#define T3495_DEFAULT_VALUE 8 /* Deactivate EPS bearer request */
#endif
/* Type of PDN address */
@@ -65,10 +65,10 @@ typedef enum {
* or initiated by the network
*/
#ifdef NAS_UE
typedef int (*esm_proc_procedure_t) (int, int, OctetString*, int);
typedef int (*esm_proc_procedure_t) (int, int, OctetString *, int);
#endif
#ifdef NAS_MME
typedef int (*esm_proc_procedure_t) (int, unsigned int, int, OctetString*, int);
typedef int (*esm_proc_procedure_t) (int, unsigned int, int, OctetString *, int);
#endif
/* EPS bearer level QoS parameters */
@@ -96,121 +96,153 @@ typedef struct {
/*
* --------------------------------------------------------------------------
* ESM status procedure
* ESM status procedure
* --------------------------------------------------------------------------
*/
#ifdef NAS_UE
int esm_proc_status_ind(int pti, int ebi, int* esm_cause);
int esm_proc_status(int is_standalone, int pti, OctetString* msg, int sent_by_ue);
int esm_proc_status_ind(int pti, int ebi, int *esm_cause);
int esm_proc_status(int is_standalone, int pti, OctetString *msg,
int sent_by_ue);
#endif
#ifdef NAS_MME
int esm_proc_status_ind(unsigned int ueid, int pti, int ebi, int* esm_cause);
int esm_proc_status(int is_standalone, unsigned int ueid, int pti, OctetString* msg, int sent_by_ue);
int esm_proc_status_ind(unsigned int ueid, int pti, int ebi, int *esm_cause);
int esm_proc_status(int is_standalone, unsigned int ueid, int pti,
OctetString *msg, int sent_by_ue);
#endif
/*
* --------------------------------------------------------------------------
* PDN connectivity procedure
* PDN connectivity procedure
* --------------------------------------------------------------------------
*/
#ifdef NAS_UE
int esm_proc_pdn_connectivity(int cid, int to_define, esm_proc_pdn_type_t pdn_type, const OctetString* apn, int is_emergency, unsigned int* pti);
int esm_proc_pdn_connectivity_request(int is_standalone, int pti, OctetString* msg, int sent_by_ue);
int esm_proc_pdn_connectivity_accept(int pti, esm_proc_pdn_type_t pdn_type, const OctetString* pdn_address, const OctetString* apn, int* esm_cause);
int esm_proc_pdn_connectivity_reject(int pti, int* esm_cause);
int esm_proc_pdn_connectivity(int cid, int to_define,
esm_proc_pdn_type_t pdn_type, const OctetString *apn, int is_emergency,
unsigned int *pti);
int esm_proc_pdn_connectivity_request(int is_standalone, int pti,
OctetString *msg, int sent_by_ue);
int esm_proc_pdn_connectivity_accept(int pti, esm_proc_pdn_type_t pdn_type,
const OctetString *pdn_address, const OctetString *apn, int *esm_cause);
int esm_proc_pdn_connectivity_reject(int pti, int *esm_cause);
int esm_proc_pdn_connectivity_complete(void);
int esm_proc_pdn_connectivity_failure(int is_pending);
#endif
#ifdef NAS_MME
int esm_proc_pdn_connectivity_request(unsigned int ueid, int pti, esm_proc_pdn_request_t request_type, OctetString* apn, esm_proc_pdn_type_t pdn_type, OctetString* pdn_addr, esm_proc_qos_t* esm_qos, int* esm_cause);
int esm_proc_pdn_connectivity_request(unsigned int ueid, int pti,
esm_proc_pdn_request_t request_type, OctetString *apn,
esm_proc_pdn_type_t pdn_type, OctetString *pdn_addr, esm_proc_qos_t *esm_qos,
int *esm_cause);
int esm_proc_pdn_connectivity_reject(int is_standalone, unsigned int ueid, int ebi, OctetString* msg, int ue_triggered);
int esm_proc_pdn_connectivity_reject(int is_standalone, unsigned int ueid,
int ebi, OctetString *msg, int ue_triggered);
int esm_proc_pdn_connectivity_failure(unsigned int ueid, int pid);
#endif
/*
* --------------------------------------------------------------------------
* PDN disconnect procedure
* PDN disconnect procedure
* --------------------------------------------------------------------------
*/
#ifdef NAS_UE
int esm_proc_pdn_disconnect(int cid, unsigned int* pti, unsigned int* ebi);
int esm_proc_pdn_disconnect_request(int is_standalone, int pti, OctetString* msg, int sent_by_ue);
int esm_proc_pdn_disconnect(int cid, unsigned int *pti, unsigned int *ebi);
int esm_proc_pdn_disconnect_request(int is_standalone, int pti,
OctetString *msg, int sent_by_ue);
int esm_proc_pdn_disconnect_accept(int pti, int* esm_cause);
int esm_proc_pdn_disconnect_reject(int pti, int* esm_cause);
int esm_proc_pdn_disconnect_accept(int pti, int *esm_cause);
int esm_proc_pdn_disconnect_reject(int pti, int *esm_cause);
#endif
#ifdef NAS_MME
int esm_proc_pdn_disconnect_request(unsigned int ueid, int pti, int* esm_cause);
int esm_proc_pdn_disconnect_request(unsigned int ueid, int pti, int *esm_cause);
int esm_proc_pdn_disconnect_accept(unsigned int ueid, int pid, int* esm_cause);
int esm_proc_pdn_disconnect_reject(int is_standalone, unsigned int ueid, int ebi, OctetString* msg, int ue_triggered);
int esm_proc_pdn_disconnect_accept(unsigned int ueid, int pid, int *esm_cause);
int esm_proc_pdn_disconnect_reject(int is_standalone, unsigned int ueid,
int ebi, OctetString *msg, int ue_triggered);
#endif
/*
* --------------------------------------------------------------------------
* Default EPS bearer context activation procedure
* Default EPS bearer context activation procedure
* --------------------------------------------------------------------------
*/
#ifdef NAS_MME
int esm_proc_default_eps_bearer_context(unsigned int ueid, int pid, unsigned int* ebi, const esm_proc_qos_t* esm_qos, int* esm_cause);
int esm_proc_default_eps_bearer_context_request(int is_standalone, unsigned int ueid, int ebi, OctetString* msg, int ue_triggered);
int esm_proc_default_eps_bearer_context(unsigned int ueid, int pid,
unsigned int *ebi, const esm_proc_qos_t *esm_qos, int *esm_cause);
int esm_proc_default_eps_bearer_context_request(int is_standalone,
unsigned int ueid, int ebi, OctetString *msg, int ue_triggered);
int esm_proc_default_eps_bearer_context_failure(unsigned int ueid);
int esm_proc_default_eps_bearer_context_accept(unsigned int ueid, int ebi, int* esm_cause);
int esm_proc_default_eps_bearer_context_reject(unsigned int ueid, int ebi, int* esm_cause);
int esm_proc_default_eps_bearer_context_accept(unsigned int ueid, int ebi,
int *esm_cause);
int esm_proc_default_eps_bearer_context_reject(unsigned int ueid, int ebi,
int *esm_cause);
#endif
#ifdef NAS_UE
int esm_proc_default_eps_bearer_context_request(int pid, int ebi, const esm_proc_qos_t* esm_qos, int* esm_cause);
int esm_proc_default_eps_bearer_context_request(int pid, int ebi,
const esm_proc_qos_t *esm_qos, int *esm_cause);
int esm_proc_default_eps_bearer_context_complete(void);
int esm_proc_default_eps_bearer_context_failure(void);
int esm_proc_default_eps_bearer_context_accept(int is_standalone, int ebi, OctetString* msg, int ue_triggered);
int esm_proc_default_eps_bearer_context_reject(int is_standalone, int ebi, OctetString* msg, int ue_triggered);
int esm_proc_default_eps_bearer_context_accept(int is_standalone, int ebi,
OctetString *msg, int ue_triggered);
int esm_proc_default_eps_bearer_context_reject(int is_standalone, int ebi,
OctetString *msg, int ue_triggered);
#endif
/*
* --------------------------------------------------------------------------
* Dedicated EPS bearer context activation procedure
* Dedicated EPS bearer context activation procedure
* --------------------------------------------------------------------------
*/
#ifdef NAS_MME
int esm_proc_dedicated_eps_bearer_context(unsigned int ueid, int pid, unsigned int* ebi, unsigned int* default_ebi, const esm_proc_qos_t* qos, const esm_proc_tft_t* tft, int* esm_cause);
int esm_proc_dedicated_eps_bearer_context_request(int is_standalone, unsigned int ueid, int ebi, OctetString* msg, int ue_triggered);
int esm_proc_dedicated_eps_bearer_context(unsigned int ueid, int pid,
unsigned int *ebi, unsigned int *default_ebi, const esm_proc_qos_t *qos,
const esm_proc_tft_t *tft, int *esm_cause);
int esm_proc_dedicated_eps_bearer_context_request(int is_standalone,
unsigned int ueid, int ebi, OctetString *msg, int ue_triggered);
int esm_proc_dedicated_eps_bearer_context_accept(unsigned int ueid, int ebi, int* esm_cause);
int esm_proc_dedicated_eps_bearer_context_reject(unsigned int ueid, int ebi, int* esm_cause);
int esm_proc_dedicated_eps_bearer_context_accept(unsigned int ueid, int ebi,
int *esm_cause);
int esm_proc_dedicated_eps_bearer_context_reject(unsigned int ueid, int ebi,
int *esm_cause);
#endif
#ifdef NAS_UE
int esm_proc_dedicated_eps_bearer_context_request(int ebi, int default_ebi, const esm_proc_qos_t* qos, const esm_proc_tft_t* tft, int* esm_cause);
int esm_proc_dedicated_eps_bearer_context_request(int ebi, int default_ebi,
const esm_proc_qos_t *qos, const esm_proc_tft_t *tft, int *esm_cause);
int esm_proc_dedicated_eps_bearer_context_accept(int is_standalone, int ebi, OctetString* msg, int ue_triggered);
int esm_proc_dedicated_eps_bearer_context_reject(int is_standalone, int ebi, OctetString* msg, int ue_triggered);
int esm_proc_dedicated_eps_bearer_context_accept(int is_standalone, int ebi,
OctetString *msg, int ue_triggered);
int esm_proc_dedicated_eps_bearer_context_reject(int is_standalone, int ebi,
OctetString *msg, int ue_triggered);
#endif
/*
* --------------------------------------------------------------------------
* EPS bearer context deactivation procedure
* EPS bearer context deactivation procedure
* --------------------------------------------------------------------------
*/
#ifdef NAS_MME
int esm_proc_eps_bearer_context_deactivate(unsigned int ueid, int is_local, int ebi, int* pid, int* bid, int* esm_cause);
int esm_proc_eps_bearer_context_deactivate_request(int is_standalone, unsigned int ueid, int ebi, OctetString* msg, int ue_triggered);
int esm_proc_eps_bearer_context_deactivate(unsigned int ueid, int is_local,
int ebi, int *pid, int *bid, int *esm_cause);
int esm_proc_eps_bearer_context_deactivate_request(int is_standalone,
unsigned int ueid, int ebi, OctetString *msg, int ue_triggered);
int esm_proc_eps_bearer_context_deactivate_accept(unsigned int ueid, int ebi, int* esm_cause);
int esm_proc_eps_bearer_context_deactivate_accept(unsigned int ueid, int ebi,
int *esm_cause);
#endif
#ifdef NAS_UE
int esm_proc_eps_bearer_context_deactivate(int is_local, int ebi, int* pid, int* bid);
int esm_proc_eps_bearer_context_deactivate_request(int ebi, int* esm_cause);
int esm_proc_eps_bearer_context_deactivate(int is_local, int ebi, int *pid,
int *bid);
int esm_proc_eps_bearer_context_deactivate_request(int ebi, int *esm_cause);
int esm_proc_eps_bearer_context_deactivate_accept(int is_standalone, int ebi, OctetString* msg, int ue_triggered);
int esm_proc_eps_bearer_context_deactivate_accept(int is_standalone, int ebi,
OctetString *msg, int ue_triggered);
#endif
#endif /* __ESM_PROC_H__*/
+214 -207
View File
@@ -1,20 +1,20 @@
/*****************************************************************************
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Source esm_pt.c
Source esm_pt.c
Version 0.1
Version 0.1
Date 2013/01/03
Date 2013/01/03
Product NAS stack
Product NAS stack
Subsystem EPS Session Management
Subsystem EPS Session Management
Author Frederic Maurel
Author Frederic Maurel
Description Defines functions used to handle ESM procedure transactions.
Description Defines functions used to handle ESM procedure transactions.
*****************************************************************************/
@@ -24,8 +24,8 @@ Description Defines functions used to handle ESM procedure transactions.
#include "commonDef.h"
#include "nas_log.h"
#include <stdlib.h> // malloc, free
#include <string.h> // memcpy
#include <stdlib.h> // malloc, free
#include <string.h> // memcpy
#endif // NAS_UE
/****************************************************************************/
@@ -37,8 +37,8 @@ Description Defines functions used to handle ESM procedure transactions.
* The Procedure Transaction Identity (PTI) identifies bi-directional
* messages flows
*/
#define ESM_PTI_MIN (PROCEDURE_TRANSACTION_IDENTITY_FIRST)
#define ESM_PTI_MAX (PROCEDURE_TRANSACTION_IDENTITY_LAST)
#define ESM_PTI_MIN (PROCEDURE_TRANSACTION_IDENTITY_FIRST)
#define ESM_PTI_MAX (PROCEDURE_TRANSACTION_IDENTITY_LAST)
/****************************************************************************/
/******************* L O C A L D E F I N I T I O N S *******************/
@@ -46,7 +46,7 @@ Description Defines functions used to handle ESM procedure transactions.
#ifdef NAS_UE
/* String representation of ESM procedure transaction status */
static const char* _esm_pt_state_str[ESM_PT_STATE_MAX] = {
static const char *_esm_pt_state_str[ESM_PT_STATE_MAX] = {
"PROCEDURE TRANSACTION INACTIVE",
"PROCEDURE TRANSACTION PENDING"
};
@@ -57,10 +57,10 @@ static const char* _esm_pt_state_str[ESM_PT_STATE_MAX] = {
* --------------------------
*/
typedef struct {
unsigned char pti; /* Procedure transaction identity */
esm_pt_state status; /* Procedure transaction status */
struct nas_timer_t timer; /* Retransmission timer */
esm_pt_timer_data_t* args; /* Retransmission timer parameters data */
unsigned char pti; /* Procedure transaction identity */
esm_pt_state status; /* Procedure transaction status */
struct nas_timer_t timer; /* Retransmission timer */
esm_pt_timer_data_t *args; /* Retransmission timer parameters data */
} esm_pt_context_t;
/*
@@ -69,10 +69,10 @@ typedef struct {
* ------------------------------
*/
static struct {
unsigned char index; /* Index of the next procedure transaction
* identity to be used */
unsigned char index; /* Index of the next procedure transaction
* identity to be used */
#define ESM_PT_DATA_SIZE (ESM_PTI_MAX - ESM_PTI_MIN + 1)
esm_pt_context_t* context[ESM_PT_DATA_SIZE + 1];
esm_pt_context_t *context[ESM_PT_DATA_SIZE + 1];
} _esm_pt_data;
/* Return the index of the next available entry in the list of procedure
@@ -87,16 +87,16 @@ static int _esm_pt_get_available_entry(void);
#ifdef NAS_UE
/****************************************************************************
** **
** Name: esm_pt_initialize() **
** Name: esm_pt_initialize() **
** **
** Description: Initialize ESM procedure transaction data **
** **
** Inputs: None **
** Others: None **
** Inputs: None **
** Others: None **
** **
** Outputs: None **
** Return: None **
** Others: _esm_pt_data **
** Outputs: None **
** Return: None **
** Others: _esm_pt_data **
** **
***************************************************************************/
void esm_pt_initialize(void)
@@ -105,7 +105,7 @@ void esm_pt_initialize(void)
_esm_pt_data.index = 0;
for (int i = 0; i < ESM_PT_DATA_SIZE + 1; i++) {
_esm_pt_data.context[i] = NULL;
_esm_pt_data.context[i] = NULL;
}
LOG_FUNC_OUT;
@@ -113,18 +113,18 @@ void esm_pt_initialize(void)
/****************************************************************************
** **
** Name: esm_pt_assign() **
** Name: esm_pt_assign() **
** **
** Description: Assigns a new procedure transaction identity **
** **
** Inputs: None **
** Others: None **
** Inputs: None **
** Others: None **
** **
** Outputs: None **
** Return: The identity of the new procedure transac- **
** tion when successfully assigned; **
** the unassigned PTI (0) otherwise. **
** Others: _esm_pt_data **
** Outputs: None **
** Return: The identity of the new procedure transac- **
** tion when successfully assigned; **
** the unassigned PTI (0) otherwise. **
** Others: _esm_pt_data **
** **
***************************************************************************/
int esm_pt_assign(void)
@@ -134,14 +134,14 @@ int esm_pt_assign(void)
/* Search for an available procedure transaction identity */
int i = _esm_pt_get_available_entry();
if (i < 0) {
LOG_FUNC_RETURN (ESM_PT_UNASSIGNED);
LOG_FUNC_RETURN (ESM_PT_UNASSIGNED);
}
/* Assign new procedure transaction */
_esm_pt_data.context[i] =
(esm_pt_context_t*)malloc(sizeof(esm_pt_context_t));
(esm_pt_context_t *)malloc(sizeof(esm_pt_context_t));
if (_esm_pt_data.context[i] == NULL) {
LOG_FUNC_RETURN (ESM_PT_UNASSIGNED);
LOG_FUNC_RETURN (ESM_PT_UNASSIGNED);
}
/* Store the index of the next available procedure transaction identity */
@@ -157,25 +157,25 @@ int esm_pt_assign(void)
_esm_pt_data.context[i]->args = NULL;
LOG_TRACE(INFO, "ESM-FSM - Procedure transaction identity %d assigned",
_esm_pt_data.context[i]->pti);
_esm_pt_data.context[i]->pti);
LOG_FUNC_RETURN (_esm_pt_data.context[i]->pti);
}
/****************************************************************************
** **
** Name: esm_pt_release() **
** Name: esm_pt_release() **
** **
** Description: Release the given procedure transaction identity **
** **
** Inputs: pti: The identity of the procedure transaction **
** to release **
** Others: None **
** Inputs: pti: The identity of the procedure transaction **
** to release **
** Others: None **
** **
** Outputs: None **
** Return: RETURNok if the procedure transaction iden-**
** tity has been successfully released; **
** RETURNerror otherwise. **
** Others: _esm_pt_data **
** Outputs: None **
** Return: RETURNok if the procedure transaction iden-**
** tity has been successfully released; **
** RETURNerror otherwise. **
** Others: _esm_pt_data **
** **
***************************************************************************/
int esm_pt_release(int pti)
@@ -183,34 +183,34 @@ int esm_pt_release(int pti)
LOG_FUNC_IN;
if ( (pti < ESM_PTI_MIN) || (pti > ESM_PTI_MAX) ) {
LOG_FUNC_RETURN (RETURNerror);
LOG_FUNC_RETURN (RETURNerror);
}
/* Get procedure transaction data */
esm_pt_context_t* ctx = _esm_pt_data.context[pti - ESM_PTI_MIN];
esm_pt_context_t *ctx = _esm_pt_data.context[pti - ESM_PTI_MIN];
if ( (ctx == NULL) || (ctx->pti != pti) ) {
/* Procedure transaction not assigned */
LOG_FUNC_RETURN (RETURNerror);
/* Procedure transaction not assigned */
LOG_FUNC_RETURN (RETURNerror);
}
/* Do not release active procedure transaction */
if (ctx->status != ESM_PT_INACTIVE) {
LOG_TRACE(ERROR, "ESM-FSM - Procedure transaction is not INACTIVE");
LOG_FUNC_RETURN (RETURNerror);
LOG_TRACE(ERROR, "ESM-FSM - Procedure transaction is not INACTIVE");
LOG_FUNC_RETURN (RETURNerror);
}
/* Stop the retransmission timer if still running */
if (ctx->timer.id != NAS_TIMER_INACTIVE_ID) {
LOG_TRACE(INFO, "ESM-FSM - Stop retransmission timer %d",
ctx->timer.id);
ctx->timer.id = nas_timer_stop(ctx->timer.id);
LOG_TRACE(INFO, "ESM-FSM - Stop retransmission timer %d",
ctx->timer.id);
ctx->timer.id = nas_timer_stop(ctx->timer.id);
}
/* Release the retransmisison timer parameters */
if (ctx->args) {
if (ctx->args->msg.length > 0) {
free(ctx->args->msg.value);
}
free(ctx->args);
ctx->args = NULL;
if (ctx->args->msg.length > 0) {
free(ctx->args->msg.value);
}
free(ctx->args);
ctx->args = NULL;
}
/* Release transaction procedure data */
@@ -224,89 +224,88 @@ int esm_pt_release(int pti)
/****************************************************************************
** **
** Name: esm_pt_start_timer() **
** Name: esm_pt_start_timer() **
** **
** Description: Start the timer of the specified procedure transaction to **
** expire after a given time interval. Timer expiration will **
** schedule execution of the callback function where stored **
** ESM message should be re-transmit. **
** expire after a given time interval. Timer expiration will **
** schedule execution of the callback function where stored **
** ESM message should be re-transmit. **
** **
** Inputs: pti: The identity of the procedure transaction **
** msg: The encoded ESM message to be stored **
** sec: The value of the time interval in seconds **
** cb: Function executed upon timer expiration **
** Others: None **
** Inputs: pti: The identity of the procedure transaction **
** msg: The encoded ESM message to be stored **
** sec: The value of the time interval in seconds **
** cb: Function executed upon timer expiration **
** Others: None **
** **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: _esm_pt_data **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: _esm_pt_data **
** **
***************************************************************************/
int esm_pt_start_timer(int pti, const OctetString* msg,
long sec, nas_timer_callback_t cb)
int esm_pt_start_timer(int pti, const OctetString *msg,
long sec, nas_timer_callback_t cb)
{
LOG_FUNC_IN;
if ( (pti < ESM_PTI_MIN) || (pti > ESM_PTI_MAX) ) {
LOG_FUNC_RETURN (RETURNerror);
LOG_FUNC_RETURN (RETURNerror);
}
/* Get procedure transaction data */
esm_pt_context_t* ctx = _esm_pt_data.context[pti - ESM_PTI_MIN];
esm_pt_context_t *ctx = _esm_pt_data.context[pti - ESM_PTI_MIN];
if ( (ctx == NULL) || (ctx->pti != pti) ) {
/* Procedure transaction not assigned */
LOG_FUNC_RETURN (RETURNerror);
/* Procedure transaction not assigned */
LOG_FUNC_RETURN (RETURNerror);
}
if (ctx->timer.id != NAS_TIMER_INACTIVE_ID) {
if (ctx->args) {
/* Re-start the retransmission timer */
ctx->timer.id = nas_timer_restart(ctx->timer.id);
}
}
else {
/* Setup the retransmission timer parameters */
ctx->args = (esm_pt_timer_data_t*)malloc(sizeof(esm_pt_timer_data_t));
if (ctx->args) {
/* Set the EPS bearer identity */
ctx->args->pti = pti;
/* Reset the retransmission counter */
ctx->args->count = 0;
/* Set the ESM message to be re-transmited */
ctx->args->msg.value = (uint8_t*)malloc(msg->length);
ctx->args->msg.length = 0;
if (ctx->args->msg.value) {
memcpy(ctx->args->msg.value, msg->value, msg->length);
ctx->args->msg.length = msg->length;
}
/* Setup the retransmission timer to expire at the given
* time interval */
ctx->timer.id = nas_timer_start(sec, cb, ctx->args);
ctx->timer.sec = sec;
}
if (ctx->args) {
/* Re-start the retransmission timer */
ctx->timer.id = nas_timer_restart(ctx->timer.id);
}
} else {
/* Setup the retransmission timer parameters */
ctx->args = (esm_pt_timer_data_t *)malloc(sizeof(esm_pt_timer_data_t));
if (ctx->args) {
/* Set the EPS bearer identity */
ctx->args->pti = pti;
/* Reset the retransmission counter */
ctx->args->count = 0;
/* Set the ESM message to be re-transmited */
ctx->args->msg.value = (uint8_t *)malloc(msg->length);
ctx->args->msg.length = 0;
if (ctx->args->msg.value) {
memcpy(ctx->args->msg.value, msg->value, msg->length);
ctx->args->msg.length = msg->length;
}
/* Setup the retransmission timer to expire at the given
* time interval */
ctx->timer.id = nas_timer_start(sec, cb, ctx->args);
ctx->timer.sec = sec;
}
}
if ( (ctx->args != NULL) && (ctx->timer.id != NAS_TIMER_INACTIVE_ID) ) {
LOG_TRACE(INFO, "ESM-FSM - Retransmission timer %d expires in "
"%ld seconds", ctx->timer.id, ctx->timer.sec);
LOG_FUNC_RETURN (RETURNok);
LOG_TRACE(INFO, "ESM-FSM - Retransmission timer %d expires in "
"%ld seconds", ctx->timer.id, ctx->timer.sec);
LOG_FUNC_RETURN (RETURNok);
}
LOG_FUNC_RETURN (RETURNerror);
}
/****************************************************************************
** **
** Name: esm_pt_stop_timer() **
** Name: esm_pt_stop_timer() **
** **
** Description: Stop the timer previously started for the given procedure **
** transaction **
** transaction **
** **
** Inputs: pti: The identity of the procedure transaction **
** Others: None **
** Inputs: pti: The identity of the procedure transaction **
** Others: None **
** **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: _esm_pt_data **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: _esm_pt_data **
** **
***************************************************************************/
int esm_pt_stop_timer(int pti)
@@ -314,30 +313,30 @@ int esm_pt_stop_timer(int pti)
LOG_FUNC_IN;
if ( (pti < ESM_PTI_MIN) || (pti > ESM_PTI_MAX) ) {
LOG_FUNC_RETURN (RETURNerror);
LOG_FUNC_RETURN (RETURNerror);
}
/* Get procedure transaction data */
esm_pt_context_t* ctx = _esm_pt_data.context[pti - ESM_PTI_MIN];
esm_pt_context_t *ctx = _esm_pt_data.context[pti - ESM_PTI_MIN];
if ( (ctx == NULL) || (ctx->pti != pti) ) {
/* Procedure transaction not assigned */
LOG_FUNC_RETURN (RETURNerror);
/* Procedure transaction not assigned */
LOG_FUNC_RETURN (RETURNerror);
}
/* Stop the retransmission timer if still running */
if (ctx->timer.id != NAS_TIMER_INACTIVE_ID) {
LOG_TRACE(INFO, "ESM-FSM - Stop retransmission timer %d",
ctx->timer.id);
ctx->timer.id = nas_timer_stop(ctx->timer.id);
LOG_TRACE(INFO, "ESM-FSM - Stop retransmission timer %d",
ctx->timer.id);
ctx->timer.id = nas_timer_stop(ctx->timer.id);
}
/* Release the retransmisison timer parameters */
if (ctx->args) {
if (ctx->args->msg.length > 0) {
free(ctx->args->msg.value);
}
free(ctx->args);
ctx->args = NULL;
if (ctx->args->msg.length > 0) {
free(ctx->args->msg.value);
}
free(ctx->args);
ctx->args = NULL;
}
LOG_FUNC_RETURN (RETURNok);
@@ -345,18 +344,18 @@ int esm_pt_stop_timer(int pti)
/****************************************************************************
** **
** Name: esm_pt_set_status() **
** Name: esm_pt_set_status() **
** **
** Description: Set the status of the specified procedure transaction to **
** the given state **
** the given state **
** **
** Inputs: pti: The identity of the procedure transaction **
** status: The new ESM procedure transaction status **
** Others: None **
** Inputs: pti: The identity of the procedure transaction **
** status: The new ESM procedure transaction status **
** Others: None **
** **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: _esm_pt_data **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: _esm_pt_data **
** **
***************************************************************************/
int esm_pt_set_status(int pti, esm_pt_state status)
@@ -366,27 +365,27 @@ int esm_pt_set_status(int pti, esm_pt_state status)
esm_pt_state old_status;
if ( (pti < ESM_PTI_MIN) || (pti > ESM_PTI_MAX) ) {
LOG_FUNC_RETURN (RETURNerror);
LOG_FUNC_RETURN (RETURNerror);
}
/* Get procedure transaction data */
esm_pt_context_t* ctx = _esm_pt_data.context[pti - ESM_PTI_MIN];
esm_pt_context_t *ctx = _esm_pt_data.context[pti - ESM_PTI_MIN];
if ( (ctx == NULL) || (ctx->pti != pti) ) {
/* Procedure transaction not assigned */
LOG_TRACE(ERROR, "ESM-FSM - Procedure transaction not assigned "
"(pti=%d)", pti);
LOG_FUNC_RETURN (RETURNerror);
/* Procedure transaction not assigned */
LOG_TRACE(ERROR, "ESM-FSM - Procedure transaction not assigned "
"(pti=%d)", pti);
LOG_FUNC_RETURN (RETURNerror);
}
old_status = ctx->status;
if (status < ESM_PT_STATE_MAX) {
LOG_TRACE(INFO, "ESM-FSM - Status of procedure transaction %d changed:"
" %s ===> %s", pti,
_esm_pt_state_str[old_status], _esm_pt_state_str[status]);
if (status != old_status) {
ctx->status = status;
LOG_FUNC_RETURN (RETURNok);
}
LOG_TRACE(INFO, "ESM-FSM - Status of procedure transaction %d changed:"
" %s ===> %s", pti,
_esm_pt_state_str[old_status], _esm_pt_state_str[status]);
if (status != old_status) {
ctx->status = status;
LOG_FUNC_RETURN (RETURNok);
}
}
LOG_FUNC_RETURN (RETURNerror);
@@ -394,52 +393,52 @@ int esm_pt_set_status(int pti, esm_pt_state status)
/****************************************************************************
** **
** Name: esm_pt_get_status() **
** Name: esm_pt_get_status() **
** **
** Description: Get the current status value of the specified procedure **
** transaction **
** transaction **
** **
** Inputs: pti: The identity of the procedure transaction **
** Others: _esm_pt_data **
** Inputs: pti: The identity of the procedure transaction **
** Others: _esm_pt_data **
** **
** Outputs: None **
** Return: The current value of the ESM procedure **
** transaction status **
** Others: None **
** Outputs: None **
** Return: The current value of the ESM procedure **
** transaction status **
** Others: None **
** **
***************************************************************************/
esm_pt_state esm_pt_get_status(int pti)
{
if ( (pti < ESM_PTI_MIN) || (pti > ESM_PTI_MAX) ) {
return (ESM_PT_INACTIVE);
return (ESM_PT_INACTIVE);
}
if (_esm_pt_data.context[pti - ESM_PTI_MIN] == NULL) {
/* Procedure transaction not allocated */
return (ESM_PT_INACTIVE);
/* Procedure transaction not allocated */
return (ESM_PT_INACTIVE);
}
if (_esm_pt_data.context[pti - ESM_PTI_MIN]->pti != pti) {
/* Procedure transaction not assigned */
return (ESM_PT_INACTIVE);
/* Procedure transaction not assigned */
return (ESM_PT_INACTIVE);
}
return (_esm_pt_data.context[pti - ESM_PTI_MIN]->status);
}
/****************************************************************************
** **
** Name: esm_pt_get_pending_pti() **
** Name: esm_pt_get_pending_pti() **
** **
** Description: Returns the procedure transaction identity assigned to **
** the first PDN connection entry which is pending in the **
** given state **
** the first PDN connection entry which is pending in the **
** given state **
** **
** Inputs: status: The PDN connection status **
** Others: _esm_pt_data **
** Inputs: status: The PDN connection status **
** Others: _esm_pt_data **
** **
** Outputs: None **
** Return: The procedure transaction identity of the **
** PDN connection entry if it exists; **
** the unassigned PTI (0) otherwise. **
** Others: None **
** Outputs: None **
** Return: The procedure transaction identity of the **
** PDN connection entry if it exists; **
** the unassigned PTI (0) otherwise. **
** Others: None **
** **
***************************************************************************/
int esm_pt_get_pending_pti(esm_pt_state status)
@@ -448,14 +447,18 @@ int esm_pt_get_pending_pti(esm_pt_state status)
int i;
for (i = 0; i < ESM_PT_DATA_SIZE; i++) {
if (_esm_pt_data.context[i] == NULL) continue;
if (_esm_pt_data.context[i]->status != status) continue;
/* PDN connection entry found */
break;
if (_esm_pt_data.context[i] == NULL) {
continue;
}
if (_esm_pt_data.context[i]->status != status) {
continue;
}
/* PDN connection entry found */
break;
}
if (i < ESM_PT_DATA_SIZE) {
LOG_FUNC_RETURN (_esm_pt_data.context[i]->pti);
LOG_FUNC_RETURN (_esm_pt_data.context[i]->pti);
}
/* PDN connection entry not found */
LOG_FUNC_RETURN (ESM_PT_UNASSIGNED);
@@ -463,40 +466,40 @@ int esm_pt_get_pending_pti(esm_pt_state status)
/****************************************************************************
** **
** Name: esm_pt_is_not_in_use() **
** Name: esm_pt_is_not_in_use() **
** **
** Description: Check whether the given procedure transaction identity **
** does not match an assigned PTI value currently in use **
** does not match an assigned PTI value currently in use **
** **
** Inputs: pti: The identity of the procedure transaction **
** Others: _esm_pt_data **
** Inputs: pti: The identity of the procedure transaction **
** Others: _esm_pt_data **
** **
** Outputs: None **
** Return: TRUE, FALSE **
** Others: None **
** Outputs: None **
** Return: TRUE, FALSE **
** Others: None **
** **
***************************************************************************/
int esm_pt_is_not_in_use(int pti)
{
return ( (pti == ESM_PT_UNASSIGNED) ||
(_esm_pt_data.context[pti - ESM_PTI_MIN] == NULL) ||
(_esm_pt_data.context[pti - ESM_PTI_MIN]->pti) != pti);
(_esm_pt_data.context[pti - ESM_PTI_MIN] == NULL) ||
(_esm_pt_data.context[pti - ESM_PTI_MIN]->pti) != pti);
}
#endif // NAS_UE
/****************************************************************************
** **
** Name: esm_pt_is_reserved() **
** Name: esm_pt_is_reserved() **
** **
** Description: Check whether the given procedure transaction identity is **
** a reserved value **
** a reserved value **
** **
** Inputs: pti: The identity of the procedure transaction **
** Others: None **
** Inputs: pti: The identity of the procedure transaction **
** Others: None **
** **
** Outputs: None **
** Return: TRUE, FALSE **
** Others: None **
** Outputs: None **
** Return: TRUE, FALSE **
** Others: None **
** **
***************************************************************************/
int esm_pt_is_reserved(int pti)
@@ -511,33 +514,37 @@ int esm_pt_is_reserved(int pti)
#ifdef NAS_UE
/****************************************************************************
** **
** Name: _esm_pt_get_available_entry() **
** Name: _esm_pt_get_available_entry() **
** **
** Description: Returns the index of the next available entry in the list **
** of procedure transaction data **
** of procedure transaction data **
** **
** Inputs: None **
** Others: _esm_pt_data **
** Inputs: None **
** Others: _esm_pt_data **
** **
** Outputs: None **
** Return: The index of the next available procedure **
** transaction data entry; -1 if no any entry **
** is available. **
** Others: None **
** Outputs: None **
** Return: The index of the next available procedure **
** transaction data entry; -1 if no any entry **
** is available. **
** Others: None **
** **
***************************************************************************/
static int _esm_pt_get_available_entry(void)
{
int i;
for (i = _esm_pt_data.index; i < ESM_PT_DATA_SIZE; i++) {
if (_esm_pt_data.context[i] != NULL) continue;
return i;
if (_esm_pt_data.context[i] != NULL) {
continue;
}
return i;
}
for (i = 0; i < _esm_pt_data.index; i++) {
if (_esm_pt_data.context[i] != NULL) continue;
return i;
if (_esm_pt_data.context[i] != NULL) {
continue;
}
return i;
}
/* No available PTI entry found */
return (-1);
}
}
#endif // NAS_UE
+18 -17
View File
@@ -1,20 +1,20 @@
/*****************************************************************************
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Source esm_pt.h
Source esm_pt.h
Version 0.1
Version 0.1
Date 2013/01/03
Date 2013/01/03
Product NAS stack
Product NAS stack
Subsystem EPS Session Management
Subsystem EPS Session Management
Author Frederic Maurel
Author Frederic Maurel
Description Defines functions used to handle ESM procedure transactions.
Description Defines functions used to handle ESM procedure transactions.
*****************************************************************************/
#ifndef __ESM_PT_H__
@@ -32,7 +32,7 @@ Description Defines functions used to handle ESM procedure transactions.
/****************************************************************************/
/* Unassigned procedure transaction identity value */
#define ESM_PT_UNASSIGNED (PROCEDURE_TRANSACTION_IDENTITY_UNASSIGNED)
#define ESM_PT_UNASSIGNED (PROCEDURE_TRANSACTION_IDENTITY_UNASSIGNED)
/****************************************************************************/
/************************ G L O B A L T Y P E S ************************/
@@ -41,17 +41,17 @@ Description Defines functions used to handle ESM procedure transactions.
#ifdef NAS_UE
/* Procedure transaction states */
typedef enum {
ESM_PT_INACTIVE, /* No procedure transaction exists */
ESM_PT_PENDING, /* The UE has initiated a procedure transaction
* towards the network */
ESM_PT_INACTIVE, /* No procedure transaction exists */
ESM_PT_PENDING, /* The UE has initiated a procedure transaction
* towards the network */
ESM_PT_STATE_MAX
} esm_pt_state;
/* ESM message timer retransmission data */
typedef struct {
unsigned char pti; /* Procedure transaction identity */
unsigned int count; /* Retransmission counter */
OctetString msg; /* Encoded ESM message to re-transmit */
unsigned char pti; /* Procedure transaction identity */
unsigned int count; /* Retransmission counter */
OctetString msg; /* Encoded ESM message to re-transmit */
} esm_pt_timer_data_t;
#endif // NAS_UE
@@ -71,7 +71,8 @@ void esm_pt_initialize(void);
int esm_pt_assign(void);
int esm_pt_release(int pti);
int esm_pt_start_timer(int pti, const OctetString* msg, long sec, nas_timer_callback_t cb);
int esm_pt_start_timer(int pti, const OctetString *msg, long sec,
nas_timer_callback_t cb);
int esm_pt_stop_timer(int pti);
int esm_pt_set_status(int pti, esm_pt_state status);
File diff suppressed because it is too large Load Diff
@@ -1,22 +1,22 @@
/*****************************************************************************
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Source esm_recv.h
Source esm_recv.h
Version 0.1
Version 0.1
Date 2013/02/06
Date 2013/02/06
Product NAS stack
Product NAS stack
Subsystem EPS Session Management
Subsystem EPS Session Management
Author Frederic Maurel
Author Frederic Maurel
Description Defines functions executed at the ESM Service Access
Point upon receiving EPS Session Management messages
from the EPS Mobility Management sublayer.
Description Defines functions executed at the ESM Service Access
Point upon receiving EPS Session Management messages
from the EPS Mobility Management sublayer.
*****************************************************************************/
#ifndef __ESM_RECV_H__
@@ -77,10 +77,11 @@ Description Defines functions executed at the ESM Service Access
* --------------------------------------------------------------------------
*/
#ifdef NAS_UE
int esm_recv_status(int pti, int ebi, const esm_status_msg* msg);
int esm_recv_status(int pti, int ebi, const esm_status_msg *msg);
#endif
#ifdef NAS_MME
int esm_recv_status(unsigned int ueid, int pti, int ebi, const esm_status_msg* msg);
int esm_recv_status(unsigned int ueid, int pti, int ebi,
const esm_status_msg *msg);
#endif
/*
@@ -93,19 +94,24 @@ int esm_recv_status(unsigned int ueid, int pti, int ebi, const esm_status_msg* m
* Transaction related messages
* ----------------------------
*/
int esm_recv_pdn_connectivity_reject(int pti, int ebi, const pdn_connectivity_reject_msg* msg);
int esm_recv_pdn_connectivity_reject(int pti, int ebi,
const pdn_connectivity_reject_msg *msg);
int esm_recv_pdn_disconnect_reject(int pti, int ebi, const pdn_disconnect_reject_msg* msg);
int esm_recv_pdn_disconnect_reject(int pti, int ebi,
const pdn_disconnect_reject_msg *msg);
/*
* Messages related to EPS bearer contexts
* ---------------------------------------
*/
int esm_recv_activate_default_eps_bearer_context_request(int pti, int ebi, const activate_default_eps_bearer_context_request_msg* msg);
int esm_recv_activate_default_eps_bearer_context_request(int pti, int ebi,
const activate_default_eps_bearer_context_request_msg *msg);
int esm_recv_activate_dedicated_eps_bearer_context_request(int pti, int ebi, const activate_dedicated_eps_bearer_context_request_msg* msg);
int esm_recv_activate_dedicated_eps_bearer_context_request(int pti, int ebi,
const activate_dedicated_eps_bearer_context_request_msg *msg);
int esm_recv_deactivate_eps_bearer_context_request(int pti, int ebi, const deactivate_eps_bearer_context_request_msg* msg);
int esm_recv_deactivate_eps_bearer_context_request(int pti, int ebi,
const deactivate_eps_bearer_context_request_msg *msg);
#endif
/*
@@ -118,23 +124,30 @@ int esm_recv_deactivate_eps_bearer_context_request(int pti, int ebi, const deact
* Transaction related messages
* ----------------------------
*/
int esm_recv_pdn_connectivity_request(unsigned int ueid, int pti, int ebi, const pdn_connectivity_request_msg* msg, unsigned int* new_ebi, void* data);
int esm_recv_pdn_connectivity_request(unsigned int ueid, int pti, int ebi,
const pdn_connectivity_request_msg *msg, unsigned int *new_ebi, void *data);
int esm_recv_pdn_disconnect_request(unsigned int ueid, int pti, int ebi, const pdn_disconnect_request_msg* msg, unsigned int* linked_ebi);
int esm_recv_pdn_disconnect_request(unsigned int ueid, int pti, int ebi,
const pdn_disconnect_request_msg *msg, unsigned int *linked_ebi);
/*
* Messages related to EPS bearer contexts
* ---------------------------------------
*/
int esm_recv_activate_default_eps_bearer_context_accept(unsigned int ueid, int pti, int ebi, const activate_default_eps_bearer_context_accept_msg* msg);
int esm_recv_activate_default_eps_bearer_context_accept(unsigned int ueid,
int pti, int ebi, const activate_default_eps_bearer_context_accept_msg *msg);
int esm_recv_activate_default_eps_bearer_context_reject(unsigned int ueid, int pti, int ebi, const activate_default_eps_bearer_context_reject_msg* msg);
int esm_recv_activate_default_eps_bearer_context_reject(unsigned int ueid,
int pti, int ebi, const activate_default_eps_bearer_context_reject_msg *msg);
int esm_recv_activate_dedicated_eps_bearer_context_accept(unsigned int ueid, int pti, int ebi, const activate_dedicated_eps_bearer_context_accept_msg* msg);
int esm_recv_activate_dedicated_eps_bearer_context_accept(unsigned int ueid,
int pti, int ebi, const activate_dedicated_eps_bearer_context_accept_msg *msg);
int esm_recv_activate_dedicated_eps_bearer_context_reject(unsigned int ueid, int pti, int ebi, const activate_dedicated_eps_bearer_context_reject_msg* msg);
int esm_recv_activate_dedicated_eps_bearer_context_reject(unsigned int ueid,
int pti, int ebi, const activate_dedicated_eps_bearer_context_reject_msg *msg);
int esm_recv_deactivate_eps_bearer_context_accept(unsigned int ueid, int pti, int ebi, const deactivate_eps_bearer_context_accept_msg* msg);
int esm_recv_deactivate_eps_bearer_context_accept(unsigned int ueid, int pti,
int ebi, const deactivate_eps_bearer_context_accept_msg *msg);
#endif
#endif /* __ESM_RECV_H__*/
File diff suppressed because it is too large Load Diff
@@ -1,22 +1,22 @@
/*****************************************************************************
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Source esm_sap.h
Source esm_sap.h
Version 0.1
Version 0.1
Date 2012/11/22
Date 2012/11/22
Product NAS stack
Product NAS stack
Subsystem EPS Session Management
Subsystem EPS Session Management
Author Frederic Maurel
Author Frederic Maurel
Description Defines the ESM Service Access Points at which the EPS
Session Management sublayer provides procedures for the
EPS bearer context handling and resources allocation.
Description Defines the ESM Service Access Points at which the EPS
Session Management sublayer provides procedures for the
EPS bearer context handling and resources allocation.
*****************************************************************************/
#ifndef __ESM_SAP_H__
@@ -42,6 +42,6 @@ Description Defines the ESM Service Access Points at which the EPS
void esm_sap_initialize(void);
int esm_sap_send(esm_sap_t* msg);
int esm_sap_send(esm_sap_t *msg);
#endif /* __ESM_SAP_H__*/
@@ -1,21 +1,21 @@
/*****************************************************************************
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Source esm_sapDef.h
Source esm_sapDef.h
Version 0.1
Version 0.1
Date 2012/11/21
Date 2012/11/21
Product NAS stack
Product NAS stack
Subsystem EPS Session Management
Subsystem EPS Session Management
Author Frederic Maurel
Author Frederic Maurel
Description Defines the ESM Service Access Point that provides EPS
bearer context handling and resources allocation procedures.
Description Defines the ESM Service Access Point that provides EPS
bearer context handling and resources allocation procedures.
*****************************************************************************/
#ifndef __ESM_SAPDEF_H__
@@ -67,12 +67,12 @@ typedef enum {
* Error code returned upon processing ESM-SAP primitive
*/
typedef enum {
ESM_SAP_SUCCESS = 1, /* ESM-SAP primitive succeed */
ESM_SAP_DISCARDED, /* ESM-SAP primitive failed, the caller should
* ignore the error */
ESM_SAP_FAILED /* ESM-SAP primitive failed, the caller should
* take specific action and state transition may
* occurs */
ESM_SAP_SUCCESS = 1, /* ESM-SAP primitive succeed */
ESM_SAP_DISCARDED, /* ESM-SAP primitive failed, the caller should
* ignore the error */
ESM_SAP_FAILED /* ESM-SAP primitive failed, the caller should
* take specific action and state transition may
* occurs */
} esm_sap_error_t;
/*
@@ -87,14 +87,14 @@ typedef struct {
* --------------------------------------------
*/
typedef struct {
int cid; /* PDN connection local identifier */
int is_defined; /* Indicates whether a PDN context has been defined
* for the specified APN */
int pdn_type; /* PDN address type (IPv4, IPv6, IPv4v6) */
const char* apn; /* PDN's Access Point Name */
int is_emergency; /* Indicates whether the PDN context has been
* defined to establish connection for emergency
* bearer services */
int cid; /* PDN connection local identifier */
int is_defined; /* Indicates whether a PDN context has been defined
* for the specified APN */
int pdn_type; /* PDN address type (IPv4, IPv6, IPv4v6) */
const char *apn; /* PDN's Access Point Name */
int is_emergency; /* Indicates whether the PDN context has been
* defined to establish connection for emergency
* bearer services */
} esm_pdn_connectivity_t;
/*
@@ -102,7 +102,7 @@ typedef struct {
* ------------------------------------------
*/
typedef struct {
int cid; /* PDN connection local identifier */
int cid; /* PDN connection local identifier */
} esm_pdn_disconnect_t;
/*
@@ -110,9 +110,9 @@ typedef struct {
* ---------------------------------------------------------
*/
typedef struct {
#define ESM_SAP_ALL_EBI 0xff
unsigned int ebi; /* EPS bearer identity of the EPS bearer context
* to be deactivated */
#define ESM_SAP_ALL_EBI 0xff
unsigned int ebi; /* EPS bearer identity of the EPS bearer context
* to be deactivated */
} esm_eps_bearer_context_deactivate_t;
/*
@@ -127,16 +127,16 @@ typedef union {
} esm_sap_data_t;
typedef struct {
esm_primitive_t primitive; /* ESM-SAP primitive to process */
int is_standalone; /* Indicates whether the ESM message handled
* within this primitive has to be sent/received
* standalone or together within an EMM related
* message */
unsigned int ueid; /* Local UE identifier */
esm_sap_error_t err; /* ESM-SAP error code */
const OctetString* recv; /* Encoded ESM message received */
OctetString send; /* Encoded ESM message to be sent */
esm_sap_data_t data; /* ESM message data parameters */
esm_primitive_t primitive; /* ESM-SAP primitive to process */
int is_standalone; /* Indicates whether the ESM message handled
* within this primitive has to be sent/received
* standalone or together within an EMM related
* message */
unsigned int ueid; /* Local UE identifier */
esm_sap_error_t err; /* ESM-SAP error code */
const OctetString *recv; /* Encoded ESM message received */
OctetString send; /* Encoded ESM message to be sent */
esm_sap_data_t data; /* ESM message data parameters */
} esm_sap_t;
/****************************************************************************/
+226 -227
View File
@@ -1,22 +1,22 @@
/*****************************************************************************
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Source esm_send.c
Source esm_send.c
Version 0.1
Version 0.1
Date 2013/02/11
Date 2013/02/11
Product NAS stack
Product NAS stack
Subsystem EPS Session Management
Subsystem EPS Session Management
Author Frederic Maurel
Author Frederic Maurel
Description Defines functions executed at the ESM Service Access
Point to send EPS Session Management messages to the
EPS Mobility Management sublayer.
Description Defines functions executed at the ESM Service Access
Point to send EPS Session Management messages to the
EPS Mobility Management sublayer.
*****************************************************************************/
@@ -31,7 +31,7 @@ Description Defines functions executed at the ESM Service Access
#include "esm_msgDef.h"
#include "esm_cause.h"
#include <string.h> // strlen
#include <string.h> // strlen
/****************************************************************************/
/**************** E X T E R N A L D E F I N I T I O N S ****************/
@@ -52,25 +52,25 @@ Description Defines functions executed at the ESM Service Access
*/
/****************************************************************************
** **
** Name: esm_send_status() **
** Name: esm_send_status() **
** **
** Description: Builds ESM status message **
** **
** The ESM status message is sent by the network or the UE **
** to pass information on the status of the indicated EPS **
** bearer context and report certain error conditions. **
** The ESM status message is sent by the network or the UE **
** to pass information on the status of the indicated EPS **
** bearer context and report certain error conditions. **
** **
** Inputs: pti: Procedure transaction identity **
** ebi: EPS bearer identity **
** esm_cause: ESM cause code **
** Others: None **
** Inputs: pti: Procedure transaction identity **
** ebi: EPS bearer identity **
** esm_cause: ESM cause code **
** Others: None **
** **
** Outputs: msg: The ESM message to be sent **
** Return: RETURNok, RETURNerror **
** Others: None **
** Outputs: msg: The ESM message to be sent **
** Return: RETURNok, RETURNerror **
** Others: None **
** **
***************************************************************************/
int esm_send_status(int pti, int ebi, esm_status_msg* msg, int esm_cause)
int esm_send_status(int pti, int ebi, esm_status_msg *msg, int esm_cause)
{
LOG_FUNC_IN;
@@ -84,9 +84,9 @@ int esm_send_status(int pti, int ebi, esm_status_msg* msg, int esm_cause)
msg->esmcause = esm_cause;
LOG_TRACE(WARNING, "ESM-SAP - Send ESM Status message (pti=%d, ebi=%d)",
msg->proceduretransactionidentity, msg->epsbeareridentity);
msg->proceduretransactionidentity, msg->epsbeareridentity);
LOG_FUNC_RETURN(RETURNok);
LOG_FUNC_RETURN(RETURNok);
}
/*
@@ -97,29 +97,29 @@ int esm_send_status(int pti, int ebi, esm_status_msg* msg, int esm_cause)
#ifdef NAS_UE
/****************************************************************************
** **
** Name: esm_send_pdn_connectivity_request() **
** Name: esm_send_pdn_connectivity_request() **
** **
** Description: Builds PDN Connectivity Request message **
** **
** The PDN connectivity request message is sent by the UE to **
** the network to initiate establishment of a PDN connection.**
** The PDN connectivity request message is sent by the UE to **
** the network to initiate establishment of a PDN connection.**
** **
** Inputs: pti: Procedure transaction identity assigned to **
** the PDN connection **
** is_emergency: Indicates whether the PDN connectivity is **
** requested for emergency bearer services **
** pdn_type: PDN address type **
** apn: Access Point Name of the PDN to connect to **
** Others: None **
** Inputs: pti: Procedure transaction identity assigned to **
** the PDN connection **
** is_emergency: Indicates whether the PDN connectivity is **
** requested for emergency bearer services **
** pdn_type: PDN address type **
** apn: Access Point Name of the PDN to connect to **
** Others: None **
** **
** Outputs: msg: The ESM message to be sent **
** Return: RETURNok, RETURNerror **
** Others: None **
** Outputs: msg: The ESM message to be sent **
** Return: RETURNok, RETURNerror **
** Others: None **
** **
***************************************************************************/
int esm_send_pdn_connectivity_request(int pti, int is_emergency, int pdn_type,
const char* apn,
pdn_connectivity_request_msg* msg)
const char *apn,
pdn_connectivity_request_msg *msg)
{
LOG_FUNC_IN;
@@ -131,61 +131,61 @@ int esm_send_pdn_connectivity_request(int pti, int is_emergency, int pdn_type,
/* Mandatory - PDN connectivity request type */
if (is_emergency) {
msg->requesttype = REQUEST_TYPE_EMERGENCY;
msg->requesttype = REQUEST_TYPE_EMERGENCY;
} else {
msg->requesttype = REQUEST_TYPE_INITIAL_REQUEST;
msg->requesttype = REQUEST_TYPE_INITIAL_REQUEST;
}
/* Mandatory - PDN type */
if (pdn_type == NET_PDN_TYPE_IPV4) {
msg->pdntype = PDN_TYPE_IPV4;
msg->pdntype = PDN_TYPE_IPV4;
} else if (pdn_type == NET_PDN_TYPE_IPV6) {
msg->pdntype = PDN_TYPE_IPV6;
msg->pdntype = PDN_TYPE_IPV6;
} else if (pdn_type == NET_PDN_TYPE_IPV4V6) {
msg->pdntype = PDN_TYPE_IPV4V6;
msg->pdntype = PDN_TYPE_IPV4V6;
}
/* Optional - Access Point Name */
msg->presencemask = 0;
if (apn) {
size_t len = strlen(apn);
if (len > 0) {
msg->presencemask |=
PDN_CONNECTIVITY_REQUEST_ACCESS_POINT_NAME_PRESENT;
msg->accesspointname.accesspointnamevalue.length = len;
msg->accesspointname.accesspointnamevalue.value = (uint8_t*)apn;
}
size_t len = strlen(apn);
if (len > 0) {
msg->presencemask |=
PDN_CONNECTIVITY_REQUEST_ACCESS_POINT_NAME_PRESENT;
msg->accesspointname.accesspointnamevalue.length = len;
msg->accesspointname.accesspointnamevalue.value = (uint8_t *)apn;
}
}
LOG_TRACE(INFO, "ESM-SAP - Send PDN Connectivity Request message "
"(pti=%d, ebi=%d)",
msg->proceduretransactionidentity, msg->epsbeareridentity);
"(pti=%d, ebi=%d)",
msg->proceduretransactionidentity, msg->epsbeareridentity);
LOG_FUNC_RETURN(RETURNok);
}
/****************************************************************************
** **
** Name: esm_send_pdn_disconnect_request() **
** Name: esm_send_pdn_disconnect_request() **
** **
** Description: Builds PDN Disconnect Request message **
** **
** The PDN disconnect request message is sent by the UE to **
** the network to initiate release of a PDN connection. **
** The PDN disconnect request message is sent by the UE to **
** the network to initiate release of a PDN connection. **
** **
** Inputs: pti: Procedure transaction identity assigned to **
** the PDN connection **
** ebi: EPS bearer identity of the default bearer **
** associated with the PDN to disconnect from **
** Others: None **
** Inputs: pti: Procedure transaction identity assigned to **
** the PDN connection **
** ebi: EPS bearer identity of the default bearer **
** associated with the PDN to disconnect from **
** Others: None **
** **
** Outputs: msg: The ESM message to be sent **
** Return: RETURNok, RETURNerror **
** Others: None **
** Outputs: msg: The ESM message to be sent **
** Return: RETURNok, RETURNerror **
** Others: None **
** **
***************************************************************************/
int esm_send_pdn_disconnect_request(int pti, int ebi,
pdn_disconnect_request_msg* msg)
pdn_disconnect_request_msg *msg)
{
LOG_FUNC_IN;
@@ -201,32 +201,32 @@ int esm_send_pdn_disconnect_request(int pti, int ebi,
msg->presencemask = 0;
LOG_TRACE(INFO, "ESM-SAP - Send PDN Disconnect Request message "
"(pti=%d, ebi=%d)",
msg->proceduretransactionidentity, msg->epsbeareridentity);
"(pti=%d, ebi=%d)",
msg->proceduretransactionidentity, msg->epsbeareridentity);
LOG_FUNC_RETURN(RETURNok);
}
/****************************************************************************
** **
** Name: esm_send_activate_default_eps_bearer_context_accept() **
** Name: esm_send_activate_default_eps_bearer_context_accept() **
** **
** Description: Builds Activate Default EPS Bearer Context Accept message **
** **
** The activate default EPS bearer context accept message is **
** sent by the UE to the network to acknowledge activation **
** of a default EPS bearer context. **
** The activate default EPS bearer context accept message is **
** sent by the UE to the network to acknowledge activation **
** of a default EPS bearer context. **
** **
** Inputs: ebi: EPS bearer identity **
** Others: None **
** Inputs: ebi: EPS bearer identity **
** Others: None **
** **
** Outputs: msg: The ESM message to be sent **
** Return: RETURNok, RETURNerror **
** Others: None **
** Outputs: msg: The ESM message to be sent **
** Return: RETURNok, RETURNerror **
** Others: None **
** **
***************************************************************************/
int esm_send_activate_default_eps_bearer_context_accept(int ebi,
activate_default_eps_bearer_context_accept_msg* msg)
activate_default_eps_bearer_context_accept_msg *msg)
{
LOG_FUNC_IN;
@@ -240,33 +240,33 @@ int esm_send_activate_default_eps_bearer_context_accept(int ebi,
msg->presencemask = 0;
LOG_TRACE(INFO, "ESM-SAP - Send Activate Default EPS Bearer Context "
"Accept message (pti=%d, ebi=%d)",
msg->proceduretransactionidentity, msg->epsbeareridentity);
"Accept message (pti=%d, ebi=%d)",
msg->proceduretransactionidentity, msg->epsbeareridentity);
LOG_FUNC_RETURN(RETURNok);
}
/****************************************************************************
** **
** Name: esm_send_activate_default_eps_bearer_context_reject() **
** Name: esm_send_activate_default_eps_bearer_context_reject() **
** **
** Description: Builds Activate Default EPS Bearer Context Reject message **
** **
** The activate default EPS bearer context reject message is **
** sent by UE to the network to reject activation of a de- **
** fault EPS bearer context. **
** The activate default EPS bearer context reject message is **
** sent by UE to the network to reject activation of a de- **
** fault EPS bearer context. **
** **
** Inputs: ebi: EPS bearer identity **
** esm_cause: ESM cause code **
** Others: None **
** Inputs: ebi: EPS bearer identity **
** esm_cause: ESM cause code **
** Others: None **
** **
** Outputs: msg: The ESM message to be sent **
** Return: RETURNok, RETURNerror **
** Others: None **
** Outputs: msg: The ESM message to be sent **
** Return: RETURNok, RETURNerror **
** Others: None **
** **
***************************************************************************/
int esm_send_activate_default_eps_bearer_context_reject(int ebi,
activate_default_eps_bearer_context_reject_msg* msg, int esm_cause)
activate_default_eps_bearer_context_reject_msg *msg, int esm_cause)
{
LOG_FUNC_IN;
@@ -281,35 +281,35 @@ int esm_send_activate_default_eps_bearer_context_reject(int ebi,
msg->presencemask = 0;
LOG_TRACE(INFO, "ESM-SAP - Send Activate Default EPS Bearer Context "
"Reject message (pti=%d, ebi=%d)",
msg->proceduretransactionidentity, msg->epsbeareridentity);
"Reject message (pti=%d, ebi=%d)",
msg->proceduretransactionidentity, msg->epsbeareridentity);
LOG_FUNC_RETURN(RETURNok);
}
/****************************************************************************
** **
** Name: esm_send_activate_dedicated_eps_bearer_context_accept() **
** Name: esm_send_activate_dedicated_eps_bearer_context_accept() **
** **
** Description: Builds Activate Dedicated EPS Bearer Context Accept **
** message **
** message **
** **
** The activate dedicated EPS bearer context accept message **
** is sent by the UE to the network to acknowledge activa- **
** tion of a dedicated EPS bearer context associated with **
** the same PDN address(es) and APN as an already active EPS **
** bearer context. **
** The activate dedicated EPS bearer context accept message **
** is sent by the UE to the network to acknowledge activa- **
** tion of a dedicated EPS bearer context associated with **
** the same PDN address(es) and APN as an already active EPS **
** bearer context. **
** **
** Inputs: ebi: EPS bearer identity **
** Others: None **
** Inputs: ebi: EPS bearer identity **
** Others: None **
** **
** Outputs: msg: The ESM message to be sent **
** Return: RETURNok, RETURNerror **
** Others: None **
** Outputs: msg: The ESM message to be sent **
** Return: RETURNok, RETURNerror **
** Others: None **
** **
***************************************************************************/
int esm_send_activate_dedicated_eps_bearer_context_accept(int ebi,
activate_dedicated_eps_bearer_context_accept_msg* msg)
activate_dedicated_eps_bearer_context_accept_msg *msg)
{
LOG_FUNC_IN;
@@ -323,34 +323,34 @@ int esm_send_activate_dedicated_eps_bearer_context_accept(int ebi,
msg->presencemask = 0;
LOG_TRACE(INFO, "ESM-SAP - Send Activate Dedicated EPS Bearer Context "
"Accept message (pti=%d, ebi=%d)",
msg->proceduretransactionidentity, msg->epsbeareridentity);
"Accept message (pti=%d, ebi=%d)",
msg->proceduretransactionidentity, msg->epsbeareridentity);
LOG_FUNC_RETURN(RETURNok);
}
/****************************************************************************
** **
** Name: esm_send_activate_dedicated_eps_bearer_context_reject() **
** Name: esm_send_activate_dedicated_eps_bearer_context_reject() **
** **
** Description: Builds Activate Dedicated EPS Bearer Context Reject **
** message **
** message **
** **
** The activate dedicated EPS bearer context reject message **
** is sent by UE to the network to reject activation of a **
** dedicated EPS bearer context. **
** The activate dedicated EPS bearer context reject message **
** is sent by UE to the network to reject activation of a **
** dedicated EPS bearer context. **
** **
** Inputs: ebi: EPS bearer identity **
** esm_cause: ESM cause code **
** Others: None **
** Inputs: ebi: EPS bearer identity **
** esm_cause: ESM cause code **
** Others: None **
** **
** Outputs: msg: The ESM message to be sent **
** Return: RETURNok, RETURNerror **
** Others: None **
** Outputs: msg: The ESM message to be sent **
** Return: RETURNok, RETURNerror **
** Others: None **
** **
***************************************************************************/
int esm_send_activate_dedicated_eps_bearer_context_reject(int ebi,
activate_dedicated_eps_bearer_context_reject_msg* msg, int esm_cause)
activate_dedicated_eps_bearer_context_reject_msg *msg, int esm_cause)
{
LOG_FUNC_IN;
@@ -365,32 +365,32 @@ int esm_send_activate_dedicated_eps_bearer_context_reject(int ebi,
msg->presencemask = 0;
LOG_TRACE(INFO, "ESM-SAP - Send Activate Dedicated EPS Bearer Context "
"Reject message (pti=%d, ebi=%d)",
msg->proceduretransactionidentity, msg->epsbeareridentity);
"Reject message (pti=%d, ebi=%d)",
msg->proceduretransactionidentity, msg->epsbeareridentity);
LOG_FUNC_RETURN(RETURNok);
}
/****************************************************************************
** **
** Name: esm_send_deactivate_eps_bearer_context_accept() **
** Name: esm_send_deactivate_eps_bearer_context_accept() **
** **
** Description: Builds Deactivate EPS Bearer Context Accept message **
** **
** The deactivate EPS bearer context accept message is sent **
** by the UE to acknowledge deactivation of an EPS bearer **
** context. **
** The deactivate EPS bearer context accept message is sent **
** by the UE to acknowledge deactivation of an EPS bearer **
** context. **
** **
** Inputs: ebi: EPS bearer identity **
** Others: None **
** Inputs: ebi: EPS bearer identity **
** Others: None **
** **
** Outputs: msg: The ESM message to be sent **
** Return: RETURNok, RETURNerror **
** Others: None **
** Outputs: msg: The ESM message to be sent **
** Return: RETURNok, RETURNerror **
** Others: None **
** **
***************************************************************************/
int esm_send_deactivate_eps_bearer_context_accept(int ebi,
deactivate_eps_bearer_context_accept_msg* msg)
deactivate_eps_bearer_context_accept_msg *msg)
{
LOG_FUNC_IN;
@@ -404,8 +404,8 @@ int esm_send_deactivate_eps_bearer_context_accept(int ebi,
msg->presencemask = 0;
LOG_TRACE(INFO, "ESM-SAP - Send Deactivate EPS Bearer Context Accept"
" message (pti=%d, ebi=%d)",
msg->proceduretransactionidentity, msg->epsbeareridentity);
" message (pti=%d, ebi=%d)",
msg->proceduretransactionidentity, msg->epsbeareridentity);
LOG_FUNC_RETURN(RETURNok);
}
@@ -419,25 +419,25 @@ int esm_send_deactivate_eps_bearer_context_accept(int ebi,
#ifdef NAS_MME
/****************************************************************************
** **
** Name: esm_send_pdn_connectivity_reject() **
** Name: esm_send_pdn_connectivity_reject() **
** **
** Description: Builds PDN Connectivity Reject message **
** **
** The PDN connectivity reject message is sent by the net- **
** work to the UE to reject establishment of a PDN connec- **
** tion. **
** The PDN connectivity reject message is sent by the net- **
** work to the UE to reject establishment of a PDN connec- **
** tion. **
** **
** Inputs: pti: Procedure transaction identity **
** esm_cause: ESM cause code **
** Others: None **
** Inputs: pti: Procedure transaction identity **
** esm_cause: ESM cause code **
** Others: None **
** **
** Outputs: msg: The ESM message to be sent **
** Return: RETURNok, RETURNerror **
** Others: None **
** Outputs: msg: The ESM message to be sent **
** Return: RETURNok, RETURNerror **
** Others: None **
** **
***************************************************************************/
int esm_send_pdn_connectivity_reject(int pti, pdn_connectivity_reject_msg* msg,
int esm_cause)
int esm_send_pdn_connectivity_reject(int pti, pdn_connectivity_reject_msg *msg,
int esm_cause)
{
LOG_FUNC_IN;
@@ -453,32 +453,32 @@ int esm_send_pdn_connectivity_reject(int pti, pdn_connectivity_reject_msg* msg,
msg->presencemask = 0;
LOG_TRACE(INFO, "ESM-SAP - Send PDN Connectivity Reject message "
"(pti=%d, ebi=%d)",
msg->proceduretransactionidentity, msg->epsbeareridentity);
"(pti=%d, ebi=%d)",
msg->proceduretransactionidentity, msg->epsbeareridentity);
LOG_FUNC_RETURN(RETURNok);
}
/****************************************************************************
** **
** Name: esm_send_pdn_disconnect_reject() **
** Name: esm_send_pdn_disconnect_reject() **
** **
** Description: Builds PDN Disconnect Reject message **
** **
** The PDN disconnect reject message is sent by the network **
** to the UE to reject release of a PDN connection. **
** The PDN disconnect reject message is sent by the network **
** to the UE to reject release of a PDN connection. **
** **
** Inputs: pti: Procedure transaction identity **
** esm_cause: ESM cause code **
** Others: None **
** Inputs: pti: Procedure transaction identity **
** esm_cause: ESM cause code **
** Others: None **
** **
** Outputs: msg: The ESM message to be sent **
** Return: RETURNok, RETURNerror **
** Others: None **
** Outputs: msg: The ESM message to be sent **
** Return: RETURNok, RETURNerror **
** Others: None **
** **
***************************************************************************/
int esm_send_pdn_disconnect_reject(int pti, pdn_disconnect_reject_msg* msg,
int esm_cause)
int esm_send_pdn_disconnect_reject(int pti, pdn_disconnect_reject_msg *msg,
int esm_cause)
{
LOG_FUNC_IN;
@@ -494,41 +494,41 @@ int esm_send_pdn_disconnect_reject(int pti, pdn_disconnect_reject_msg* msg,
msg->presencemask = 0;
LOG_TRACE(INFO, "ESM-SAP - Send PDN Disconnect Reject message "
"(pti=%d, ebi=%d)",
msg->proceduretransactionidentity, msg->epsbeareridentity);
"(pti=%d, ebi=%d)",
msg->proceduretransactionidentity, msg->epsbeareridentity);
LOG_FUNC_RETURN(RETURNok);
}
/****************************************************************************
** **
** Name: esm_send_activate_default_eps_bearer_context_request() **
** Name: esm_send_activate_default_eps_bearer_context_request() **
** **
** Description: Builds Activate Default EPS Bearer Context Request **
** message **
** message **
** **
** The activate default EPS bearer context request message **
** is sent by the network to the UE to request activation of **
** a default EPS bearer context. **
** The activate default EPS bearer context request message **
** is sent by the network to the UE to request activation of **
** a default EPS bearer context. **
** **
** Inputs: pti: Procedure transaction identity **
** ebi: EPS bearer identity **
** qos: Subscribed EPS quality of service **
** apn: Access Point Name in used **
** pdn_addr: PDN IPv4 address and/or IPv6 suffix **
** esm_cause: ESM cause code **
** Others: None **
** Inputs: pti: Procedure transaction identity **
** ebi: EPS bearer identity **
** qos: Subscribed EPS quality of service **
** apn: Access Point Name in used **
** pdn_addr: PDN IPv4 address and/or IPv6 suffix **
** esm_cause: ESM cause code **
** Others: None **
** **
** Outputs: msg: The ESM message to be sent **
** Return: RETURNok, RETURNerror **
** Others: None **
** Outputs: msg: The ESM message to be sent **
** Return: RETURNok, RETURNerror **
** Others: None **
** **
***************************************************************************/
int esm_send_activate_default_eps_bearer_context_request(int pti, int ebi,
activate_default_eps_bearer_context_request_msg* msg,
const OctetString* apn,
int pdn_type, const OctetString* pdn_addr,
const EpsQualityOfService* qos, int esm_cause)
activate_default_eps_bearer_context_request_msg *msg,
const OctetString *apn,
int pdn_type, const OctetString *pdn_addr,
const EpsQualityOfService *qos, int esm_cause)
{
LOG_FUNC_IN;
@@ -551,49 +551,49 @@ int esm_send_activate_default_eps_bearer_context_request(int pti, int ebi,
/* Optional - ESM cause code */
msg->presencemask = 0;
if (esm_cause != ESM_CAUSE_SUCCESS) {
msg->presencemask |=
ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_ESM_CAUSE_PRESENT;
msg->esmcause = esm_cause;
msg->presencemask |=
ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_ESM_CAUSE_PRESENT;
msg->esmcause = esm_cause;
}
LOG_TRACE(INFO, "ESM-SAP - Send Activate Default EPS Bearer Context "
"Request message (pti=%d, ebi=%d)",
msg->proceduretransactionidentity, msg->epsbeareridentity);
"Request message (pti=%d, ebi=%d)",
msg->proceduretransactionidentity, msg->epsbeareridentity);
LOG_FUNC_RETURN(RETURNok);
}
/****************************************************************************
** **
** Name: esm_send_activate_dedicated_eps_bearer_context_request() **
** Name: esm_send_activate_dedicated_eps_bearer_context_request() **
** **
** Description: Builds Activate Dedicated EPS Bearer Context Request **
** message **
** message **
** **
** The activate dedicated EPS bearer context request message **
** is sent by the network to the UE to request activation of **
** a dedicated EPS bearer context associated with the same **
** PDN address(es) and APN as an already active default EPS **
** bearer context. **
** The activate dedicated EPS bearer context request message **
** is sent by the network to the UE to request activation of **
** a dedicated EPS bearer context associated with the same **
** PDN address(es) and APN as an already active default EPS **
** bearer context. **
** **
** Inputs: pti: Procedure transaction identity **
** ebi: EPS bearer identity **
** linked_ebi: EPS bearer identity of the default bearer **
** associated with the EPS dedicated bearer **
** to be activated **
** qos: EPS quality of service **
** tft: Traffic flow template **
** Others: None **
** Inputs: pti: Procedure transaction identity **
** ebi: EPS bearer identity **
** linked_ebi: EPS bearer identity of the default bearer **
** associated with the EPS dedicated bearer **
** to be activated **
** qos: EPS quality of service **
** tft: Traffic flow template **
** Others: None **
** **
** Outputs: msg: The ESM message to be sent **
** Return: RETURNok, RETURNerror **
** Others: None **
** Outputs: msg: The ESM message to be sent **
** Return: RETURNok, RETURNerror **
** Others: None **
** **
***************************************************************************/
int esm_send_activate_dedicated_eps_bearer_context_request(int pti, int ebi,
activate_dedicated_eps_bearer_context_request_msg* msg,
int linked_ebi, const EpsQualityOfService* qos,
PacketFilters* pkfs, int n_pkfs)
activate_dedicated_eps_bearer_context_request_msg *msg,
int linked_ebi, const EpsQualityOfService *qos,
PacketFilters *pkfs, int n_pkfs)
{
int i;
LOG_FUNC_IN;
@@ -611,44 +611,43 @@ int esm_send_activate_dedicated_eps_bearer_context_request(int pti, int ebi,
msg->tft.tftoperationcode = TRAFFIC_FLOW_TEMPLATE_OPCODE_CREATE;
msg->tft.ebit = TRAFFIC_FLOW_TEMPLATE_PARAMETER_LIST_IS_NOT_INCLUDED;
msg->tft.numberofpacketfilters = n_pkfs;
for (i = 0; i < msg->tft.numberofpacketfilters; i++)
{
msg->tft.packetfilterlist.createtft[i] = (*pkfs)[i];
for (i = 0; i < msg->tft.numberofpacketfilters; i++) {
msg->tft.packetfilterlist.createtft[i] = (*pkfs)[i];
}
/* Optional */
msg->presencemask = 0;
LOG_TRACE(INFO, "ESM-SAP - Send Activate Dedicated EPS Bearer Context "
"Request message (pti=%d, ebi=%d)",
msg->proceduretransactionidentity, msg->epsbeareridentity);
"Request message (pti=%d, ebi=%d)",
msg->proceduretransactionidentity, msg->epsbeareridentity);
LOG_FUNC_RETURN(RETURNok);
}
/****************************************************************************
** **
** Name: esm_send_deactivate_eps_bearer_context_request() **
** Name: esm_send_deactivate_eps_bearer_context_request() **
** **
** Description: Builds Deactivate EPS Bearer Context Request message **
** **
** The deactivate EPS bearer context request message is sent **
** by the network to request deactivation of an active EPS **
** bearer context. **
** The deactivate EPS bearer context request message is sent **
** by the network to request deactivation of an active EPS **
** bearer context. **
** **
** Inputs: pti: Procedure transaction identity **
** ebi: EPS bearer identity **
** esm_cause: ESM cause code **
** Others: None **
** Inputs: pti: Procedure transaction identity **
** ebi: EPS bearer identity **
** esm_cause: ESM cause code **
** Others: None **
** **
** Outputs: msg: The ESM message to be sent **
** Return: RETURNok, RETURNerror **
** Others: None **
** Outputs: msg: The ESM message to be sent **
** Return: RETURNok, RETURNerror **
** Others: None **
** **
***************************************************************************/
int esm_send_deactivate_eps_bearer_context_request(int pti, int ebi,
deactivate_eps_bearer_context_request_msg* msg,
int esm_cause)
deactivate_eps_bearer_context_request_msg *msg,
int esm_cause)
{
LOG_FUNC_IN;
@@ -664,8 +663,8 @@ int esm_send_deactivate_eps_bearer_context_request(int pti, int ebi,
msg->presencemask = 0;
LOG_TRACE(INFO, "ESM-SAP - Send Deactivate EPS Bearer Context Request "
"message (pti=%d, ebi=%d)",
msg->proceduretransactionidentity, msg->epsbeareridentity);
"message (pti=%d, ebi=%d)",
msg->proceduretransactionidentity, msg->epsbeareridentity);
LOG_FUNC_RETURN(RETURNok);
}
@@ -1,22 +1,22 @@
/*****************************************************************************
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Source esm_send.h
Source esm_send.h
Version 0.1
Version 0.1
Date 2013/02/11
Date 2013/02/11
Product NAS stack
Product NAS stack
Subsystem EPS Session Management
Subsystem EPS Session Management
Author Frederic Maurel
Author Frederic Maurel
Description Defines functions executed at the ESM Service Access
Point to send EPS Session Management messages to the
EPS Mobility Management sublayer.
Description Defines functions executed at the ESM Service Access
Point to send EPS Session Management messages to the
EPS Mobility Management sublayer.
*****************************************************************************/
#ifndef __ESM_SEND_H__
@@ -76,7 +76,7 @@ Description Defines functions executed at the ESM Service Access
* Functions executed by both the UE and the MME to send ESM messages
* --------------------------------------------------------------------------
*/
int esm_send_status(int pti, int ebi, esm_status_msg* msg, int esm_cause);
int esm_send_status(int pti, int ebi, esm_status_msg *msg, int esm_cause);
/*
* --------------------------------------------------------------------------
@@ -88,20 +88,27 @@ int esm_send_status(int pti, int ebi, esm_status_msg* msg, int esm_cause);
* Transaction related messages
* ----------------------------
*/
int esm_send_pdn_connectivity_request(int pti, int is_emergency, int pdn_type, const char* apn, pdn_connectivity_request_msg* msg);
int esm_send_pdn_disconnect_request(int pti, int ebi, pdn_disconnect_request_msg* msg);
int esm_send_pdn_connectivity_request(int pti, int is_emergency, int pdn_type,
const char *apn, pdn_connectivity_request_msg *msg);
int esm_send_pdn_disconnect_request(int pti, int ebi,
pdn_disconnect_request_msg *msg);
/*
* Messages related to EPS bearer contexts
* ---------------------------------------
*/
int esm_send_activate_default_eps_bearer_context_accept(int ebi, activate_default_eps_bearer_context_accept_msg* msg);
int esm_send_activate_default_eps_bearer_context_reject(int ebi, activate_default_eps_bearer_context_reject_msg* msg, int esm_cause);
int esm_send_activate_default_eps_bearer_context_accept(int ebi,
activate_default_eps_bearer_context_accept_msg *msg);
int esm_send_activate_default_eps_bearer_context_reject(int ebi,
activate_default_eps_bearer_context_reject_msg *msg, int esm_cause);
int esm_send_activate_dedicated_eps_bearer_context_accept(int ebi, activate_dedicated_eps_bearer_context_accept_msg* msg);
int esm_send_activate_dedicated_eps_bearer_context_reject(int ebi, activate_dedicated_eps_bearer_context_reject_msg* msg, int esm_cause);
int esm_send_activate_dedicated_eps_bearer_context_accept(int ebi,
activate_dedicated_eps_bearer_context_accept_msg *msg);
int esm_send_activate_dedicated_eps_bearer_context_reject(int ebi,
activate_dedicated_eps_bearer_context_reject_msg *msg, int esm_cause);
int esm_send_deactivate_eps_bearer_context_accept(int ebi, deactivate_eps_bearer_context_accept_msg* msg);
int esm_send_deactivate_eps_bearer_context_accept(int ebi,
deactivate_eps_bearer_context_accept_msg *msg);
#endif
@@ -115,19 +122,27 @@ int esm_send_deactivate_eps_bearer_context_accept(int ebi, deactivate_eps_bearer
* Transaction related messages
* ----------------------------
*/
int esm_send_pdn_connectivity_reject(int pti, pdn_connectivity_reject_msg* msg, int esm_cause);
int esm_send_pdn_connectivity_reject(int pti, pdn_connectivity_reject_msg *msg,
int esm_cause);
int esm_send_pdn_disconnect_reject(int pti, pdn_disconnect_reject_msg* msg, int esm_cause);
int esm_send_pdn_disconnect_reject(int pti, pdn_disconnect_reject_msg *msg,
int esm_cause);
/*
* Messages related to EPS bearer contexts
* ---------------------------------------
*/
int esm_send_activate_default_eps_bearer_context_request(int pti, int ebi, activate_default_eps_bearer_context_request_msg* msg, const OctetString* apn, int pdn_type, const OctetString* pdn_addr, const EpsQualityOfService* qos, int esm_cause);
int esm_send_activate_default_eps_bearer_context_request(int pti, int ebi,
activate_default_eps_bearer_context_request_msg *msg, const OctetString *apn,
int pdn_type, const OctetString *pdn_addr, const EpsQualityOfService *qos,
int esm_cause);
int esm_send_activate_dedicated_eps_bearer_context_request(int pti, int ebi, activate_dedicated_eps_bearer_context_request_msg* msg, int linked_ebi, const EpsQualityOfService* qos, PacketFilters* pkfs, int n_pkfs);
int esm_send_activate_dedicated_eps_bearer_context_request(int pti, int ebi,
activate_dedicated_eps_bearer_context_request_msg *msg, int linked_ebi,
const EpsQualityOfService *qos, PacketFilters *pkfs, int n_pkfs);
int esm_send_deactivate_eps_bearer_context_request(int pti, int ebi, deactivate_eps_bearer_context_request_msg* msg, int esm_cause);
int esm_send_deactivate_eps_bearer_context_request(int pti, int ebi,
deactivate_eps_bearer_context_request_msg *msg, int esm_cause);
#endif
@@ -1,20 +1,20 @@
/*****************************************************************************
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Source securityDef.h
Source securityDef.h
Version 0.1
Version 0.1
Date 2013/05/02
Date 2013/05/02
Product NAS stack
Product NAS stack
Subsystem include
Subsystem include
Author Frederic Maurel
Author Frederic Maurel
Description Contains global security definitions
Description Contains global security definitions
*****************************************************************************/
#ifndef __SECURITYDEF_H__
@@ -27,33 +27,33 @@ Description Contains global security definitions
/*
* Index of the first byte of each fields of the AUTN parameter
*/
#define AUTH_SQN_INDEX 0
#define AUTH_AMF_INDEX (AUTH_SQN_INDEX + AUTH_SQN_SIZE)
#define AUTH_MAC_INDEX (AUTH_AMF_INDEX + AUTH_AMF_SIZE)
#define AUTH_SQN_INDEX 0
#define AUTH_AMF_INDEX (AUTH_SQN_INDEX + AUTH_SQN_SIZE)
#define AUTH_MAC_INDEX (AUTH_AMF_INDEX + AUTH_AMF_SIZE)
/*
* Size of the authentication challenge parameters in bytes
*/
#define AUTH_SQN_SIZE 6 /* Sequence number: 48 bits */
#define AUTH_AK_SIZE 6 /* Anonymity key: 48 bits */
#define AUTH_AMF_SIZE 2 /* Authentication Management Field: 16 bits */
#define AUTH_MAC_SIZE 8 /* Message Authentication Code: 64 bits */
#define AUTH_AUTN_SIZE 16 /* Authentication token: 128 bits
AUTN = (SQN ⊕ AK) || AMF || MAC */
#define AUTH_MACS_SIZE 8 /* Re-synchronization MAC: 64 bits */
#define AUTH_AUTS_SIZE 16 /* Re-synchronization AUT: 128 bits */
#define AUTH_RAND_SIZE 16 /* Random challenge: 128 bits */
#define AUTH_CK_SIZE 16 /* Ciphering key: 128 bits */
#define AUTH_IK_SIZE 16 /* Integrity key: 128 bits */
#define AUTH_RES_SIZE 16 /* Authentication response: 128 bits */
#define AUTH_SNID_SIZE 3 /* Serving network's identity: 24 bits */
#define AUTH_KASME_SIZE 32 /* ASME security key: 256 bits */
#define AUTH_KNAS_INT_SIZE AUTH_KASME_SIZE /* NAS integrity key */
#define AUTH_KNAS_ENC_SIZE AUTH_KASME_SIZE /* NAS cyphering key */
#define AUTH_KENB_SIZE AUTH_KASME_SIZE /* eNodeB security key */
#define AUTH_SQN_SIZE 6 /* Sequence number: 48 bits */
#define AUTH_AK_SIZE 6 /* Anonymity key: 48 bits */
#define AUTH_AMF_SIZE 2 /* Authentication Management Field: 16 bits */
#define AUTH_MAC_SIZE 8 /* Message Authentication Code: 64 bits */
#define AUTH_AUTN_SIZE 16 /* Authentication token: 128 bits
AUTN = (SQN ⊕ AK) || AMF || MAC */
#define AUTH_MACS_SIZE 8 /* Re-synchronization MAC: 64 bits */
#define AUTH_AUTS_SIZE 16 /* Re-synchronization AUT: 128 bits */
#define AUTH_RAND_SIZE 16 /* Random challenge: 128 bits */
#define AUTH_CK_SIZE 16 /* Ciphering key: 128 bits */
#define AUTH_IK_SIZE 16 /* Integrity key: 128 bits */
#define AUTH_RES_SIZE 16 /* Authentication response: 128 bits */
#define AUTH_SNID_SIZE 3 /* Serving network's identity: 24 bits */
#define AUTH_KASME_SIZE 32 /* ASME security key: 256 bits */
#define AUTH_KNAS_INT_SIZE AUTH_KASME_SIZE /* NAS integrity key */
#define AUTH_KNAS_ENC_SIZE AUTH_KASME_SIZE /* NAS cyphering key */
#define AUTH_KENB_SIZE AUTH_KASME_SIZE /* eNodeB security key */
/* "Separation bit" of AMF field */
#define AUTH_AMF_SEPARATION_BIT(a) ((a) & 0x80)
#define AUTH_AMF_SEPARATION_BIT(a) ((a) & 0x80)
/****************************************************************************/
/************************ G L O B A L T Y P E S ************************/
@@ -63,14 +63,14 @@ Description Contains global security definitions
* EPS authentication vector
*/
typedef struct {
/* ASME security key */
/* ASME security key */
char kasme[AUTH_KASME_SIZE + 1];
/* Random challenge parameter */
/* Random challenge parameter */
char rand[AUTH_RAND_SIZE + 1];
/* Authentication token parameter */
/* Authentication token parameter */
char autn[AUTH_AUTN_SIZE + 1];
/* Expected Authentication response parameter */
#define AUTH_XRES_SIZE AUTH_RES_SIZE
/* Expected Authentication response parameter */
#define AUTH_XRES_SIZE AUTH_RES_SIZE
char xres[AUTH_XRES_SIZE + 1];
} auth_vector_t;
@@ -1,20 +1,20 @@
/*****************************************************************************
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Source userDef.h
Source userDef.h
Version 0.1
Version 0.1
Date 2012/09/21
Date 2012/09/21
Product NAS stack
Product NAS stack
Subsystem include
Subsystem include
Author Frederic Maurel
Author Frederic Maurel
Description Contains user's global definitions
Description Contains user's global definitions
*****************************************************************************/
#ifndef __USERDEF_H__
@@ -30,13 +30,13 @@ Description Contains user's global definitions
* The name of the file used as non-volatile memory device to store
* UE data parameters
*/
#define USER_NVRAM_FILENAME ".ue.nvram"
#define USER_NVRAM_FILENAME ".ue.nvram"
/*
* The name of the environment variable which defines the directory
* where the UE data file is located
*/
#define USER_NVRAM_DIRNAME "NVRAM_DIR"
#define USER_NVRAM_DIRNAME "NVRAM_DIR"
/****************************************************************************/
/************************ G L O B A L T Y P E S ************************/
@@ -48,17 +48,17 @@ Description Contains user's global definitions
* ------------------------------
*/
typedef struct {
/* International Mobile Equipment Identity */
#define USER_IMEI_SIZE 15
/* International Mobile Equipment Identity */
#define USER_IMEI_SIZE 15
char IMEI[USER_IMEI_SIZE+1];
/* Manufacturer identifier */
#define USER_MANUFACTURER_SIZE 16
/* Manufacturer identifier */
#define USER_MANUFACTURER_SIZE 16
char manufacturer[USER_MANUFACTURER_SIZE+1];
/* Model identifier */
#define USER_MODEL_SIZE 16
/* Model identifier */
#define USER_MODEL_SIZE 16
char model[USER_MODEL_SIZE+1];
/* SIM Personal Identification Number */
#define USER_PIN_SIZE 4
/* SIM Personal Identification Number */
#define USER_PIN_SIZE 4
char PIN[USER_PIN_SIZE+1];
} user_nvdata_t;
+127 -137
View File
@@ -1,20 +1,20 @@
/*****************************************************************************
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Source nas_network.h
Source nas_network.h
Version 0.1
Version 0.1
Date 2012/09/20
Date 2012/09/20
Product NAS stack
Product NAS stack
Subsystem NAS main process
Subsystem NAS main process
Author Frederic Maurel
Author Frederic Maurel
Description NAS procedure functions triggered by the network
Description NAS procedure functions triggered by the network
*****************************************************************************/
@@ -39,16 +39,16 @@ Description NAS procedure functions triggered by the network
/****************************************************************************
** **
** Name: nas_network_initialize() **
** Name: nas_network_initialize() **
** **
** Description: Initializes network internal data **
** **
** Inputs: None **
** Others: None **
** Inputs: None **
** Others: None **
** **
** Outputs: None **
** Return: None **
** Others: None **
** Outputs: None **
** Return: None **
** Others: None **
** **
***************************************************************************/
void nas_network_initialize(void)
@@ -65,16 +65,16 @@ void nas_network_initialize(void)
/****************************************************************************
** **
** Name: nas_network_cleanup() **
** Name: nas_network_cleanup() **
** **
** Description: Performs clean up procedure before the system is shutdown **
** **
** Inputs: None **
** Others: None **
** Inputs: None **
** Others: None **
** **
** Outputs: None **
** Return: None **
** Others: None **
** Outputs: None **
** Return: None **
** Others: None **
** **
***************************************************************************/
void nas_network_cleanup(void)
@@ -88,155 +88,145 @@ void nas_network_cleanup(void)
/****************************************************************************
** **
** Name: nas_network_process_data() **
** Name: nas_network_process_data() **
** **
** Description: Process Access Stratum messages received from the network **
** and call applicable NAS procedure function. **
** and call applicable NAS procedure function. **
** **
** Inputs: msg_id: AS message identifier **
** data: Generic pointer to data structure that has **
** to be processed **
** Others: None **
** Inputs: msg_id: AS message identifier **
** data: Generic pointer to data structure that has **
** to be processed **
** Others: None **
** **
** Outputs: None **
** Return: RETURNok if the message has been success- **
** fully processed; RETURNerror otherwise **
** Others: None **
** Outputs: None **
** Return: RETURNok if the message has been success- **
** fully processed; RETURNerror otherwise **
** Others: None **
** **
***************************************************************************/
int nas_network_process_data(int msg_id, const void* data)
int nas_network_process_data(int msg_id, const void *data)
{
LOG_FUNC_IN;
const as_message_t* msg = (as_message_t*)(data);
const as_message_t *msg = (as_message_t *)(data);
int rc = RETURNok;
/* Sanity check */
if (msg_id != msg->msgID) {
LOG_TRACE(ERROR, "NET-MAIN - Message identifier 0x%x to process "
"is different from that of the network data (0x%x)",
msg_id, msg->msgID);
LOG_FUNC_RETURN (RETURNerror);
LOG_TRACE(ERROR, "NET-MAIN - Message identifier 0x%x to process "
"is different from that of the network data (0x%x)",
msg_id, msg->msgID);
LOG_FUNC_RETURN (RETURNerror);
}
switch (msg_id)
{
switch (msg_id) {
#ifdef NAS_UE
case AS_BROADCAST_INFO_IND:
break;
case AS_BROADCAST_INFO_IND:
break;
case AS_CELL_INFO_CNF:
{
/* Received cell information confirm */
const cell_info_cnf_t* info = &msg->msg.cell_info_cnf;
int cell_found = (info->errCode == AS_SUCCESS);
rc = nas_proc_cell_info(cell_found, info->tac,
info->cellID, info->rat,
info->rsrp, info->rsrq);
break;
}
case AS_CELL_INFO_CNF: {
/* Received cell information confirm */
const cell_info_cnf_t *info = &msg->msg.cell_info_cnf;
int cell_found = (info->errCode == AS_SUCCESS);
rc = nas_proc_cell_info(cell_found, info->tac,
info->cellID, info->rat,
info->rsrp, info->rsrq);
break;
}
case AS_CELL_INFO_IND:
break;
case AS_CELL_INFO_IND:
break;
case AS_PAGING_IND:
break;
case AS_PAGING_IND:
break;
case AS_NAS_ESTABLISH_CNF:
{
/* Received NAS signalling connection establishment confirm */
const nas_establish_cnf_t* confirm = &msg->msg.nas_establish_cnf;
if ( (confirm->errCode == AS_SUCCESS) ||
(confirm->errCode == AS_TERMINATED_NAS) ) {
rc = nas_proc_establish_cnf(confirm->nasMsg.data,
confirm->nasMsg.length);
}
else {
LOG_TRACE(WARNING, "NET-MAIN - "
"Initial NAS message not delivered");
rc = nas_proc_establish_rej();
}
break;
}
case AS_NAS_ESTABLISH_CNF: {
/* Received NAS signalling connection establishment confirm */
const nas_establish_cnf_t *confirm = &msg->msg.nas_establish_cnf;
if ( (confirm->errCode == AS_SUCCESS) ||
(confirm->errCode == AS_TERMINATED_NAS) ) {
rc = nas_proc_establish_cnf(confirm->nasMsg.data,
confirm->nasMsg.length);
} else {
LOG_TRACE(WARNING, "NET-MAIN - "
"Initial NAS message not delivered");
rc = nas_proc_establish_rej();
}
break;
}
case AS_NAS_RELEASE_IND:
/* Received NAS signalling connection releaase indication */
rc = nas_proc_release_ind(msg->msg.nas_release_ind.cause);
break;
case AS_NAS_RELEASE_IND:
/* Received NAS signalling connection releaase indication */
rc = nas_proc_release_ind(msg->msg.nas_release_ind.cause);
break;
case AS_UL_INFO_TRANSFER_CNF:
/* Received uplink data transfer confirm */
if (msg->msg.ul_info_transfer_cnf.errCode != AS_SUCCESS) {
LOG_TRACE(WARNING, "NET-MAIN - "
"Uplink NAS message not delivered");
rc = nas_proc_ul_transfer_rej();
}
else {
rc = nas_proc_ul_transfer_cnf();
}
break;
case AS_UL_INFO_TRANSFER_CNF:
/* Received uplink data transfer confirm */
if (msg->msg.ul_info_transfer_cnf.errCode != AS_SUCCESS) {
LOG_TRACE(WARNING, "NET-MAIN - "
"Uplink NAS message not delivered");
rc = nas_proc_ul_transfer_rej();
} else {
rc = nas_proc_ul_transfer_cnf();
}
break;
case AS_DL_INFO_TRANSFER_IND:
{
const dl_info_transfer_ind_t* info = &msg->msg.dl_info_transfer_ind;
/* Received downlink data transfer indication */
rc = nas_proc_dl_transfer_ind(info->nasMsg.data,
info->nasMsg.length);
break;
}
case AS_DL_INFO_TRANSFER_IND: {
const dl_info_transfer_ind_t *info = &msg->msg.dl_info_transfer_ind;
/* Received downlink data transfer indication */
rc = nas_proc_dl_transfer_ind(info->nasMsg.data,
info->nasMsg.length);
break;
}
case AS_RAB_ESTABLISH_IND:
break;
case AS_RAB_ESTABLISH_IND:
break;
case AS_RAB_RELEASE_IND:
break;
case AS_RAB_RELEASE_IND:
break;
#endif
#ifdef NAS_MME
case AS_NAS_ESTABLISH_IND:
{
/* Received NAS signalling connection establishment indication */
const nas_establish_ind_t* indication = &msg->msg.nas_establish_ind;
rc = nas_proc_establish_ind(indication->UEid,
indication->tac,
indication->initialNasMsg.data,
indication->initialNasMsg.length);
break;
}
case AS_NAS_ESTABLISH_IND: {
/* Received NAS signalling connection establishment indication */
const nas_establish_ind_t *indication = &msg->msg.nas_establish_ind;
rc = nas_proc_establish_ind(indication->UEid,
indication->tac,
indication->initialNasMsg.data,
indication->initialNasMsg.length);
break;
}
case AS_DL_INFO_TRANSFER_CNF:
{
const dl_info_transfer_cnf_t* info = &msg->msg.dl_info_transfer_cnf;
/* Received downlink data transfer confirm */
if (info->errCode != AS_SUCCESS) {
LOG_TRACE(WARNING, "NET-MAIN - "
"Downlink NAS message not delivered");
rc = nas_proc_dl_transfer_rej(info->UEid);
}
else {
rc = nas_proc_dl_transfer_cnf(info->UEid);
}
break;
}
case AS_DL_INFO_TRANSFER_CNF: {
const dl_info_transfer_cnf_t *info = &msg->msg.dl_info_transfer_cnf;
/* Received downlink data transfer confirm */
if (info->errCode != AS_SUCCESS) {
LOG_TRACE(WARNING, "NET-MAIN - "
"Downlink NAS message not delivered");
rc = nas_proc_dl_transfer_rej(info->UEid);
} else {
rc = nas_proc_dl_transfer_cnf(info->UEid);
}
break;
}
case AS_UL_INFO_TRANSFER_IND:
{
const ul_info_transfer_ind_t* info = &msg->msg.ul_info_transfer_ind;
/* Received uplink data transfer indication */
rc = nas_proc_ul_transfer_ind(info->UEid,
info->nasMsg.data,
info->nasMsg.length);
break;
}
case AS_UL_INFO_TRANSFER_IND: {
const ul_info_transfer_ind_t *info = &msg->msg.ul_info_transfer_ind;
/* Received uplink data transfer indication */
rc = nas_proc_ul_transfer_ind(info->UEid,
info->nasMsg.data,
info->nasMsg.length);
break;
}
case AS_RAB_ESTABLISH_CNF:
break;
case AS_RAB_ESTABLISH_CNF:
break;
#endif
default:
default:
LOG_TRACE(ERROR, "NET-MAIN - Unexpected AS message type: 0x%x",
msg_id);
rc = RETURNerror;
break;
msg_id);
rc = RETURNerror;
break;
}
LOG_FUNC_RETURN (rc);
+11 -11
View File
@@ -1,20 +1,20 @@
/*****************************************************************************
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Source nas_network.h
Source nas_network.h
Version 0.1
Version 0.1
Date 2012/09/20
Date 2012/09/20
Product NAS stack
Product NAS stack
Subsystem NAS main process
Subsystem NAS main process
Author Frederic Maurel
Author Frederic Maurel
Description NAS procedure functions triggered by the network
Description NAS procedure functions triggered by the network
*****************************************************************************/
#ifndef __NAS_NETWORK_H__
@@ -40,8 +40,8 @@ void nas_network_initialize(void);
void nas_network_cleanup(void);
int nas_network_process_data(int command_id, const void* data);
int nas_network_process_data(int command_id, const void *data);
const void* nas_network_get_data(void);
const void *nas_network_get_data(void);
#endif /* __NAS_NETWORK_H__*/
+132 -129
View File
@@ -1,26 +1,26 @@
/*****************************************************************************
Source nas_parser.c
Source nas_parser.c
Version 0.1
Version 0.1
Date 2012/02/27
Date 2012/02/27
Product NAS stack
Product NAS stack
Subsystem NAS main process
Subsystem NAS main process
Author Frederic Maurel
Author Frederic Maurel
Description NAS command line parser
Description NAS command line parser
*****************************************************************************/
#include "nas_parser.h"
#include "parser.h"
#include <stdio.h> // fprintf
#include <stdlib.h> // atoi
#include <stdio.h> // fprintf
#include <stdlib.h> // atoi
/****************************************************************************/
/**************** E X T E R N A L D E F I N I T I O N S ****************/
@@ -33,23 +33,22 @@ Description NAS command line parser
/*
* Identifiers of the NAS command line options
*/
enum
{
enum {
#ifdef NAS_UE
NAS_PARSER_UE_ID, /* User Equipement Identifier */
NAS_PARSER_UE_ID, /* User Equipement Identifier */
#endif // NAS_UE
NAS_PARSER_TRACE_LEVEL, /* Logging trace level */
NAS_PARSER_TRACE_LEVEL, /* Logging trace level */
#ifdef NAS_UE
NAS_PARSER_USER_HOST, /* User app layer's hostname */
NAS_PARSER_USER_HOST, /* User app layer's hostname */
#endif // NAS_UE
NAS_PARSER_NETWORK_HOST, /* Network layer's hostname */
NAS_PARSER_NETWORK_HOST, /* Network layer's hostname */
#ifdef NAS_UE
NAS_PARSER_USER_PORT, /* User app layer's port number */
NAS_PARSER_USER_PORT, /* User app layer's port number */
#endif // NAS_UE
NAS_PARSER_NETWORK_PORT, /* Network layer's port number */
NAS_PARSER_NETWORK_PORT, /* Network layer's port number */
#ifdef NAS_UE
NAS_PARSER_DEVICE_PATH, /* Device pathname */
NAS_PARSER_DEVICE_ATTR, /* Device attribute parameters */
NAS_PARSER_DEVICE_PATH, /* Device pathname */
NAS_PARSER_DEVICE_ATTR, /* Device attribute parameters */
#endif // NAS_UE
NAS_PARSER_NB_OPTIONS
};
@@ -57,37 +56,49 @@ enum
/* -----------------------------------------------------
* Definition of the internal NAS command line structure
* -----------------------------------------------------
* The command line is defined with a name (default is "NASprocess"
* but it will be replaced by the command name actually used at
* runtime), a number of options and the list of options.
* An option is defined with a name, an argument following the name,
* the usage displayed by the usage function and a default value.
* The command line is defined with a name (default is "NASprocess"
* but it will be replaced by the command name actually used at
* runtime), a number of options and the list of options.
* An option is defined with a name, an argument following the name,
* the usage displayed by the usage function and a default value.
*/
static parser_command_line_t nasParserCommandLine = {
"NASprocess", /* Command name */
NAS_PARSER_NB_OPTIONS, /* Number of options */
{ /* Command line options */
"NASprocess", /* Command name */
NAS_PARSER_NB_OPTIONS, /* Number of options */
{ /* Command line options */
#ifdef NAS_UE
{"-ueid", "<ueid>", "UE identifier\t\t\t",
NAS_PARSER_DEFAULT_UE_ID},
{
"-ueid", "<ueid>", "UE identifier\t\t\t",
NAS_PARSER_DEFAULT_UE_ID
},
#endif // NAS_UE
{"-trace", "<mask>", "Logging trace level\t\t",
NAS_PARSER_DEFAULT_TRACE_LEVEL},
{
"-trace", "<mask>", "Logging trace level\t\t",
NAS_PARSER_DEFAULT_TRACE_LEVEL
},
#ifdef NAS_UE
{"-uhost", "<uhost>", "User app layer's hostname\t",
NAS_PARSER_DEFAULT_USER_HOSTNAME},
{
"-uhost", "<uhost>", "User app layer's hostname\t",
NAS_PARSER_DEFAULT_USER_HOSTNAME
},
#endif // NAS_UE
{"-nhost", "<nhost>", "Network layer's hostname\t",
NAS_PARSER_DEFAULT_NETWORK_HOSTNAME},
{
"-nhost", "<nhost>", "Network layer's hostname\t",
NAS_PARSER_DEFAULT_NETWORK_HOSTNAME
},
#ifdef NAS_UE
{"-uport", "<uport>", "User app layer's port number\t",
NAS_PARSER_DEFAULT_USER_PORT_NUMBER},
{
"-uport", "<uport>", "User app layer's port number\t",
NAS_PARSER_DEFAULT_USER_PORT_NUMBER
},
#endif // NAS_UE
{"-nport", "<nport>", "Network layer's port number\t",
NAS_PARSER_DEFAULT_NETWORK_PORT_NUMBER},
{
"-nport", "<nport>", "Network layer's port number\t",
NAS_PARSER_DEFAULT_NETWORK_PORT_NUMBER
},
#ifdef NAS_UE
{"-dev", "<devpath>", "Device pathname\t\t", "NULL"},
{"-params", "<params>", "Device attribute parameters", "NULL"},
{"-dev", "<devpath>", "Device pathname\t\t", "NULL"},
{"-params", "<params>", "Device attribute parameters", "NULL"},
#endif // NAS_UE
}
};
@@ -95,7 +106,7 @@ static parser_command_line_t nasParserCommandLine = {
/*
* Converts a string, containing hexadecimal formatted integer, to an integer
*/
static int atohex(const char* a_char);
static int atohex(const char *a_char);
/****************************************************************************/
/****************** E X P O R T E D F U N C T I O N S ******************/
@@ -103,20 +114,20 @@ static int atohex(const char* a_char);
/****************************************************************************
** **
** Name: nas_parser_print_usage() **
** Name: nas_parser_print_usage() **
** **
** Description: Displays the command line options used to run the NAS **
** process and the firmware version defined at compilation **
** time **
** process and the firmware version defined at compilation **
** time **
** **
** Inputs: version: Firmware version **
** Others: None **
** Inputs: version: Firmware version **
** Others: None **
** **
** Outputs: Return: None **
** Others: None **
** Outputs: Return: None **
** Others: None **
** **
***************************************************************************/
void nas_parser_print_usage(const char* version)
void nas_parser_print_usage(const char *version)
{
parser_print_usage(&nasParserCommandLine);
fprintf(stderr, "Version: %s\n", version);
@@ -124,35 +135,35 @@ void nas_parser_print_usage(const char* version)
/****************************************************************************
** **
** Name: nas_parser_get_options() **
** Name: nas_parser_get_options() **
** **
** Description: Gets the command line options used to run the NAS process **
** **
** Inputs: argc: Number of options **
** argv: Pointer to the list of options **
** Others: None **
** Inputs: argc: Number of options **
** argv: Pointer to the list of options **
** Others: None **
** **
** Outputs: Return: RETURNerror, RETURNok **
** Others: None **
** Outputs: Return: RETURNerror, RETURNok **
** Others: None **
** **
***************************************************************************/
int nas_parser_get_options(int argc, const char** argv)
int nas_parser_get_options(int argc, const char **argv)
{
return parser_get_options(argc, argv, &nasParserCommandLine);
}
/****************************************************************************
** **
** Name: nas_parser_get_nb_options() **
** Name: nas_parser_get_nb_options() **
** **
** Description: Returns the number of the command line options used to **
** run the NAS process **
** run the NAS process **
** **
** Inputs: None **
** Others: None **
** Inputs: None **
** Others: None **
** **
** Outputs: Return: Number of command line options **
** Others: None **
** Outputs: Return: Number of command line options **
** Others: None **
** **
***************************************************************************/
int nas_parser_get_nb_options(void)
@@ -162,15 +173,15 @@ int nas_parser_get_nb_options(void)
/****************************************************************************
** **
** Name: nas_parser_get_trace_level() **
** Name: nas_parser_get_trace_level() **
** **
** Description: Returns the value of the logging trace level **
** **
** Inputs: None **
** Others: None **
** Inputs: None **
** Others: None **
** **
** Outputs: Return: Value of the logging trace level **
** Others: None **
** Outputs: Return: Value of the logging trace level **
** Others: None **
** **
***************************************************************************/
int nas_parser_get_trace_level(void)
@@ -180,36 +191,36 @@ int nas_parser_get_trace_level(void)
/****************************************************************************
** **
** Name: nas_parser_get_network_host() **
** Name: nas_parser_get_network_host() **
** **
** Description: Returns the value of the network layer hostname **
** **
** Inputs: None **
** Others: None **
** Inputs: None **
** Others: None **
** **
** Outputs: Return: Value of the network layer hostname **
** Others: None **
** Outputs: Return: Value of the network layer hostname **
** Others: None **
** **
***************************************************************************/
const char* nas_parser_get_network_host(void)
const char *nas_parser_get_network_host(void)
{
return nasParserCommandLine.options[NAS_PARSER_NETWORK_HOST].pvalue;
}
/****************************************************************************
** **
** Name: nas_parser_get_network_port() **
** Name: nas_parser_get_network_port() **
** **
** Description: Returns the value of the network layer port number **
** **
** Inputs: None **
** Others: None **
** Inputs: None **
** Others: None **
** **
** Outputs: Return: Value of the network layer port number **
** Others: None **
** Outputs: Return: Value of the network layer port number **
** Others: None **
** **
***************************************************************************/
const char* nas_parser_get_network_port(void)
const char *nas_parser_get_network_port(void)
{
return nasParserCommandLine.options[NAS_PARSER_NETWORK_PORT].pvalue;
}
@@ -217,15 +228,15 @@ const char* nas_parser_get_network_port(void)
#ifdef NAS_UE
/****************************************************************************
** **
** Name: nas_parser_get_ueid() **
** Name: nas_parser_get_ueid() **
** **
** Description: Returns the value of the UE identifier option **
** **
** Inputs: None **
** Others: None **
** Inputs: None **
** Others: None **
** **
** Outputs: Return: Value of the UE identifier option **
** Others: None **
** Outputs: Return: Value of the UE identifier option **
** Others: None **
** **
***************************************************************************/
int nas_parser_get_ueid(void)
@@ -235,73 +246,73 @@ int nas_parser_get_ueid(void)
/****************************************************************************
** **
** Name: nas_parser_get_user_host() **
** Name: nas_parser_get_user_host() **
** **
** Description: Returns the value of the user application layer hostname **
** **
** Inputs: None **
** Others: None **
** Inputs: None **
** Others: None **
** **
** Outputs: Return: Value of the user app layer hostname **
** Others: None **
** Outputs: Return: Value of the user app layer hostname **
** Others: None **
** **
***************************************************************************/
const char* nas_parser_get_user_host(void)
const char *nas_parser_get_user_host(void)
{
return nasParserCommandLine.options[NAS_PARSER_USER_HOST].pvalue;
}
/****************************************************************************
** **
** Name: nas_parser_get_user_port() **
** Name: nas_parser_get_user_port() **
** **
** Description: Returns the value of the user application layer port **
** number **
** number **
** **
** Inputs: None **
** Others: None **
** Inputs: None **
** Others: None **
** **
** Outputs: Return: Value of the user app layer port number **
** Others: None **
** Outputs: Return: Value of the user app layer port number **
** Others: None **
** **
***************************************************************************/
const char* nas_parser_get_user_port(void)
const char *nas_parser_get_user_port(void)
{
return nasParserCommandLine.options[NAS_PARSER_USER_PORT].pvalue;
}
/****************************************************************************
** **
** Name: nas_parser_get_device_path() **
** Name: nas_parser_get_device_path() **
** **
** Description: Returns the value of the device pathname **
** **
** Inputs: None **
** Others: None **
** Inputs: None **
** Others: None **
** **
** Outputs: Return: Value of the device pathname **
** Others: None **
** Outputs: Return: Value of the device pathname **
** Others: None **
** **
***************************************************************************/
const char* nas_parser_get_device_path(void)
const char *nas_parser_get_device_path(void)
{
return nasParserCommandLine.options[NAS_PARSER_DEVICE_PATH].pvalue;
}
/****************************************************************************
** **
** Name: nas_parser_get_device_params() **
** Name: nas_parser_get_device_params() **
** **
** Description: Returns the value of the device attribute parameters **
** **
** Inputs: None **
** Others: None **
** Inputs: None **
** Others: None **
** **
** Outputs: Return: Value of the device attribute parameters **
** Others: None **
** Outputs: Return: Value of the device attribute parameters **
** Others: None **
** **
***************************************************************************/
const char* nas_parser_get_device_params(void)
const char *nas_parser_get_device_params(void)
{
return nasParserCommandLine.options[NAS_PARSER_DEVICE_ATTR].pvalue;
}
@@ -311,28 +322,20 @@ const char* nas_parser_get_device_params(void)
/********************* L O C A L F U N C T I O N S *********************/
/****************************************************************************/
static int atohex(const char* a_char)
static int atohex(const char *a_char)
{
int result;
for (result=0; a_char; a_char++)
{
if (*a_char >= '0' && *a_char <= '9')
{
result = (result << 4) + (*a_char - '0');
}
else if (*a_char >= 'A' && *a_char <= 'F')
{
result = (result << 4) + (*a_char - 'A' + 10);
}
else if (*a_char >= 'a' && *a_char <= 'f')
{
result = (result << 4) + (*a_char - 'a' + 10);
}
else
{
break;
}
for (result=0; a_char; a_char++) {
if (*a_char >= '0' && *a_char <= '9') {
result = (result << 4) + (*a_char - '0');
} else if (*a_char >= 'A' && *a_char <= 'F') {
result = (result << 4) + (*a_char - 'A' + 10);
} else if (*a_char >= 'a' && *a_char <= 'f') {
result = (result << 4) + (*a_char - 'a' + 10);
} else {
break;
}
}
return result;
}
+21 -21
View File
@@ -1,18 +1,18 @@
/*****************************************************************************
Source nas_parser.h
Source nas_parser.h
Version 0.1
Version 0.1
Date 2012/02/27
Date 2012/02/27
Product NAS stack
Product NAS stack
Subsystem NAS main process
Subsystem NAS main process
Author Frederic Maurel
Author Frederic Maurel
Description NAS command line parser
Description NAS command line parser
*****************************************************************************/
#ifndef __NAS_PARSER_H__
@@ -23,23 +23,23 @@ Description NAS command line parser
/****************************************************************************/
/* Logging trace level default value */
#define NAS_PARSER_DEFAULT_TRACE_LEVEL "0" /* No trace */
#define NAS_PARSER_DEFAULT_TRACE_LEVEL "0" /* No trace */
/* Network layer default hostname */
#define NAS_PARSER_DEFAULT_NETWORK_HOSTNAME "localhost"
#define NAS_PARSER_DEFAULT_NETWORK_HOSTNAME "localhost"
/* Network layer default port number */
#define NAS_PARSER_DEFAULT_NETWORK_PORT_NUMBER "12000"
#define NAS_PARSER_DEFAULT_NETWORK_PORT_NUMBER "12000"
#ifdef NAS_UE
/* User Identifier default value */
#define NAS_PARSER_DEFAULT_UE_ID "1"
#define NAS_PARSER_DEFAULT_UE_ID "1"
/* User application layer default hostname */
#define NAS_PARSER_DEFAULT_USER_HOSTNAME "localhost"
#define NAS_PARSER_DEFAULT_USER_HOSTNAME "localhost"
/* User application layer default port number */
#define NAS_PARSER_DEFAULT_USER_PORT_NUMBER "10000"
#define NAS_PARSER_DEFAULT_USER_PORT_NUMBER "10000"
#endif // NAS_UE
/****************************************************************************/
@@ -54,20 +54,20 @@ Description NAS command line parser
/****************** E X P O R T E D F U N C T I O N S ******************/
/****************************************************************************/
void nas_parser_print_usage(const char* version);
int nas_parser_get_options(int argc, const char** argv);
void nas_parser_print_usage(const char *version);
int nas_parser_get_options(int argc, const char **argv);
int nas_parser_get_nb_options(void);
int nas_parser_get_trace_level(void);
const char* nas_parser_get_network_host(void);
const char* nas_parser_get_network_port(void);
const char *nas_parser_get_network_host(void);
const char *nas_parser_get_network_port(void);
#ifdef NAS_UE
int nas_parser_get_ueid(void);
const char* nas_parser_get_user_host(void);
const char* nas_parser_get_user_port(void);
const char* nas_parser_get_device_path(void);
const char* nas_parser_get_device_params(void);
const char *nas_parser_get_user_host(void);
const char *nas_parser_get_user_port(void);
const char *nas_parser_get_device_path(void);
const char *nas_parser_get_device_params(void);
#endif // NAS_UE
#endif /* __NAS_PARSER_H__*/
File diff suppressed because it is too large Load Diff
+37 -30
View File
@@ -1,20 +1,20 @@
/*****************************************************************************
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Source nas_proc.h
Source nas_proc.h
Version 0.1
Version 0.1
Date 2012/09/20
Date 2012/09/20
Product NAS stack
Product NAS stack
Subsystem NAS main process
Subsystem NAS main process
Author Frederic Maurel
Author Frederic Maurel
Description NAS procedure call manager
Description NAS procedure call manager
*****************************************************************************/
#ifndef __NAS_PROC_H__
@@ -40,7 +40,8 @@ Description NAS procedure call manager
/****************************************************************************/
#ifdef NAS_UE
void nas_proc_initialize(emm_indication_callback_t emm_cb, esm_indication_callback_t esm_cb, const char* imei);
void nas_proc_initialize(emm_indication_callback_t emm_cb,
esm_indication_callback_t esm_cb, const char *imei);
#endif
#ifdef NAS_MME
void nas_proc_initialize(void);
@@ -50,67 +51,73 @@ void nas_proc_cleanup(void);
/*
* --------------------------------------------------------------------------
* NAS procedures triggered by the user
* NAS procedures triggered by the user
* --------------------------------------------------------------------------
*/
#ifdef NAS_UE
int nas_proc_enable_s1_mode(void);
int nas_proc_disable_s1_mode(void);
int nas_proc_get_eps(int* stat);
int nas_proc_get_eps(int *stat);
int nas_proc_get_imsi(char* imsi_str);
int nas_proc_get_msisdn(char* msisdn_str, int* ton_npi);
int nas_proc_get_imsi(char *imsi_str);
int nas_proc_get_msisdn(char *msisdn_str, int *ton_npi);
int nas_proc_get_signal_quality(int* rsrq, int* rsrp);
int nas_proc_get_signal_quality(int *rsrq, int *rsrp);
int nas_proc_register(int mode, int format, const network_plmn_t* oper, int AcT);
int nas_proc_register(int mode, int format, const network_plmn_t *oper, int AcT);
int nas_proc_deregister(void);
int nas_proc_get_reg_data(int* mode, int* selected, int format, network_plmn_t* oper, int* AcT);
int nas_proc_get_oper_list(const char** oper_list);
int nas_proc_get_reg_data(int *mode, int *selected, int format,
network_plmn_t *oper, int *AcT);
int nas_proc_get_oper_list(const char **oper_list);
int nas_proc_get_reg_status(int* stat);
int nas_proc_get_loc_info(char* tac, char* ci, int* AcT);
int nas_proc_get_reg_status(int *stat);
int nas_proc_get_loc_info(char *tac, char *ci, int *AcT);
int nas_proc_detach(int switch_off);
int nas_proc_attach(void);
int nas_proc_get_attach_status(void);
int nas_proc_reset_pdn(int cid);
int nas_proc_set_pdn(int cid, int type, const char* apn, int ipv4_addr, int emergency, int p_cscf, int im_cn_signal);
int nas_proc_set_pdn(int cid, int type, const char *apn, int ipv4_addr,
int emergency, int p_cscf, int im_cn_signal);
int nas_proc_get_pdn_range(void);
int nas_proc_get_pdn_status(int* cids, int* states, int n_pdn_max);
int nas_proc_get_pdn_param(int* cids, int* types, const char** apns, int n_pdn_max);
int nas_proc_get_pdn_addr(int cid, int* cids, const char** addr1, const char** addr2, int n_addr_max);
int nas_proc_get_pdn_status(int *cids, int *states, int n_pdn_max);
int nas_proc_get_pdn_param(int *cids, int *types, const char **apns,
int n_pdn_max);
int nas_proc_get_pdn_addr(int cid, int *cids, const char **addr1,
const char **addr2, int n_addr_max);
int nas_proc_deactivate_pdn(int cid);
int nas_proc_activate_pdn(int cid);
#endif
/*
* --------------------------------------------------------------------------
* NAS procedures triggered by the network
* NAS procedures triggered by the network
* --------------------------------------------------------------------------
*/
#ifdef NAS_UE
int nas_proc_cell_info(int found, tac_t tac, ci_t ci, AcT_t rat, UInt8_t rsrp, UInt8_t rsrq);
int nas_proc_cell_info(int found, tac_t tac, ci_t ci, AcT_t rat, UInt8_t rsrp,
UInt8_t rsrq);
int nas_proc_establish_cnf(const Byte_t* data, UInt32_t len);
int nas_proc_establish_cnf(const Byte_t *data, UInt32_t len);
int nas_proc_establish_rej(void);
int nas_proc_release_ind(int cause);
int nas_proc_ul_transfer_cnf(void);
int nas_proc_ul_transfer_rej(void);
int nas_proc_dl_transfer_ind(const Byte_t* data, UInt32_t len);
int nas_proc_dl_transfer_ind(const Byte_t *data, UInt32_t len);
#endif
#ifdef NAS_MME
int nas_proc_establish_ind(UInt32_t ueid, tac_t tac, const Byte_t* data, UInt32_t len);
int nas_proc_establish_ind(UInt32_t ueid, tac_t tac, const Byte_t *data,
UInt32_t len);
int nas_proc_dl_transfer_cnf(UInt32_t ueid);
int nas_proc_dl_transfer_rej(UInt32_t ueid);
int nas_proc_ul_transfer_ind(UInt32_t ueid, const Byte_t* data, UInt32_t len);
int nas_proc_ul_transfer_ind(UInt32_t ueid, const Byte_t *data, UInt32_t len);
#endif
#endif /* __NAS_PROC_H__*/
File diff suppressed because it is too large Load Diff
+11 -10
View File
@@ -1,18 +1,18 @@
/*****************************************************************************
Source nas_user.h
Source nas_user.h
Version 0.1
Version 0.1
Date 2012/03/09
Date 2012/03/09
Product NAS stack
Product NAS stack
Subsystem NAS main process
Subsystem NAS main process
Author Frederic Maurel
Author Frederic Maurel
Description NAS procedure functions triggered by the user
Description NAS procedure functions triggered by the user
*****************************************************************************/
#ifndef __NAS_USER_H__
@@ -37,10 +37,11 @@ Description NAS procedure functions triggered by the user
/****************** E X P O R T E D F U N C T I O N S ******************/
/****************************************************************************/
void nas_user_initialize(emm_indication_callback_t emm_cb, esm_indication_callback_t esm_cb, const char* version);
void nas_user_initialize(emm_indication_callback_t emm_cb,
esm_indication_callback_t esm_cb, const char *version);
int nas_user_process_data(const void* data);
int nas_user_process_data(const void *data);
const void* nas_user_get_data(void);
const void *nas_user_get_data(void);
#endif /* __NAS_USER_H__*/
+1
View File
@@ -31,5 +31,6 @@ else
include Makefile.inc
libnas_la_SOURCES = \
nas_main.c \
nas_itti_messaging.c nas_itti_messaging.h \
$(libnas_SRCS)
endif
+46
View File
@@ -0,0 +1,46 @@
/*******************************************************************************
Eurecom OpenAirInterface
Copyright(c) 1999 - 2013 Eurecom
This program is free software; you can redistribute it and/or modify it
under the terms and conditions of the GNU General Public License,
version 2, as published by the Free Software Foundation.
This program is distributed in the hope it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
The full GNU General Public License is included in this distribution in
the file called "COPYING".
Contact Information
Openair Admin: openair_admin@eurecom.fr
Openair Tech : openair_tech@eurecom.fr
Forums : http://forums.eurecom.fr/openairinterface
Address : EURECOM, Campus SophiaTech, 450 Route des Chappes
06410 Biot FRANCE
*******************************************************************************/
#include "intertask_interface.h"
#include "nas_itti_messaging.h"
int nas_itti_dl_data_req(const uint32_t ue_id, void * const data,
const uint32_t length)
{
MessageDef *message_p;
message_p = itti_alloc_new_message(TASK_NAS, NAS_DOWNLINK_DATA_REQ);
NAS_DL_DATA_REQ(message_p).UEid = ue_id;
NAS_DL_DATA_REQ(message_p).nasMsg.data = data;
NAS_DL_DATA_REQ(message_p).nasMsg.length = length;
return itti_send_msg_to_task(TASK_S1AP, INSTANCE_DEFAULT, message_p);
}
+37
View File
@@ -0,0 +1,37 @@
/*******************************************************************************
Eurecom OpenAirInterface
Copyright(c) 1999 - 2013 Eurecom
This program is free software; you can redistribute it and/or modify it
under the terms and conditions of the GNU General Public License,
version 2, as published by the Free Software Foundation.
This program is distributed in the hope it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
The full GNU General Public License is included in this distribution in
the file called "COPYING".
Contact Information
Openair Admin: openair_admin@eurecom.fr
Openair Tech : openair_tech@eurecom.fr
Forums : http://forums.eurecom.fr/openairinterface
Address : EURECOM, Campus SophiaTech, 450 Route des Chappes
06410 Biot FRANCE
*******************************************************************************/
#ifndef NAS_ITTI_MESSAGING_H_
#define NAS_ITTI_MESSAGING_H_
int nas_itti_dl_data_req(const uint32_t ue_id, void * const data,
const uint32_t length);
#endif /* NAS_ITTI_MESSAGING_H_ */
+14
View File
@@ -61,10 +61,12 @@ next_message:
nas_est_ind_p->initialNasMsg.length);
#endif
} break;
case NAS_ATTACH_ACCEPT: {
itti_send_msg_to_task(TASK_S1AP, INSTANCE_DEFAULT, received_message_p);
goto next_message;
} break;
case NAS_AUTHENTICATION_REQ: {
MessageDef *message_p;
nas_auth_resp_t *nas_resp_p;
@@ -79,9 +81,21 @@ next_message:
itti_send_msg_to_task(TASK_MME_APP, INSTANCE_DEFAULT, message_p);
} break;
case NAS_UPLINK_DATA_IND: {
nas_proc_ul_transfer_ind(NAS_UL_DATA_IND(received_message_p).UEid,
NAS_UL_DATA_IND(received_message_p).nasMsg.data,
NAS_UL_DATA_IND(received_message_p).nasMsg.length);
} break;
case NAS_DOWNLINK_DATA_CNF: {
nas_proc_dl_transfer_cnf(NAS_DL_DATA_CNF(received_message_p).UEid);
} break;
case TERMINATE_MESSAGE: {
itti_exit_task();
} break;
default: {
NAS_DEBUG("Unkwnon message ID %d:%s\n",
ITTI_MSG_ID(received_message_p),
+21 -13
View File
@@ -103,50 +103,58 @@ void *s1ap_mme_thread(void *args)
switch (ITTI_MSG_ID(received_message_p))
{
case S1AP_SCTP_NEW_MESSAGE_IND: {
case SCTP_DATA_IND: {
/* New message received from SCTP layer.
* Decode and handle it.
*/
s1ap_message message;
s1ap_sctp_new_msg_ind_t *s1ap_sctp_new_msg_ind_p;
s1ap_sctp_new_msg_ind_p = &received_message_p->ittiMsg.s1ap_sctp_new_msg_ind;
memset((void *)&message, 0, sizeof(s1ap_message));
/* Invoke S1AP message decoder */
if (s1ap_mme_decode_pdu(&message, s1ap_sctp_new_msg_ind_p->buffer, s1ap_sctp_new_msg_ind_p->buf_length) < 0) {
if (s1ap_mme_decode_pdu(&message,
SCTP_DATA_IND(received_message_p).buffer,
SCTP_DATA_IND(received_message_p).buf_length) < 0)
{
// TODO: Notify eNB of failure with right cause
S1AP_ERROR("Failed to decode new buffer\n");
} else {
s1ap_mme_handle_message(s1ap_sctp_new_msg_ind_p->assoc_id, s1ap_sctp_new_msg_ind_p->stream, &message);
s1ap_mme_handle_message(SCTP_DATA_IND(received_message_p).assoc_id,
SCTP_DATA_IND(received_message_p).stream,
&message);
}
// Free received PDU array
free(s1ap_sctp_new_msg_ind_p->buffer);
/* Free received PDU array */
free(SCTP_DATA_IND(received_message_p).buffer);
} break;
/* SCTP layer notifies S1AP of disconnection of a peer. */
case SCTP_CLOSE_ASSOCIATION: {
sctp_close_association_t *sctp_close_association_p;
sctp_close_association_p = &received_message_p->ittiMsg.sctp_close_association;
s1ap_handle_sctp_deconnection(sctp_close_association_p->assoc_id);
s1ap_handle_sctp_deconnection(SCTP_CLOSE_ASSOCIATION(received_message_p).assoc_id);
} break;
case SCTP_NEW_ASSOCIATION: {
s1ap_handle_new_association(&received_message_p->ittiMsg.sctp_new_peer);
} break;
case NAS_DOWNLINK_DATA_IND: {
case NAS_DOWNLINK_DATA_REQ: {
/* New message received from NAS task.
* This corresponds to a S1AP downlink nas transport message.
*/
s1ap_generate_downlink_nas_transport(&received_message_p->ittiMsg.nas_dl_data_ind);
s1ap_generate_downlink_nas_transport(&NAS_DL_DATA_REQ(received_message_p));
} break;
case NAS_ATTACH_ACCEPT: {
s1ap_handle_attach_accepted(&received_message_p->ittiMsg.nas_attach_accept);
} break;
case TIMER_HAS_EXPIRED: {
s1ap_handle_timer_expiry(&received_message_p->ittiMsg.timer_has_expired);
} break;
case TERMINATE_MESSAGE: {
itti_exit_task();
} break;
default: {
S1AP_DEBUG("Unkwnon message ID %d:%s\n",
ITTI_MSG_ID(received_message_p), ITTI_MSG_NAME(received_message_p));
+27 -10
View File
@@ -34,21 +34,38 @@ int s1ap_mme_itti_send_sctp_request(uint8_t *buffer, uint32_t length,
uint32_t assoc_id, uint16_t stream)
{
MessageDef *message_p;
SctpNewDataReq *sctpNewDataReq_p;
message_p = itti_alloc_new_message(TASK_SCTP, SCTP_NEW_DATA_REQ);
message_p = itti_alloc_new_message(TASK_S1AP, SCTP_DATA_REQ);
sctpNewDataReq_p = &message_p->ittiMsg.sctpNewDataReq;
sctpNewDataReq_p->buffer = buffer;
sctpNewDataReq_p->bufLen = length;
sctpNewDataReq_p->assocId = assoc_id;
sctpNewDataReq_p->stream = stream;
SCTP_DATA_REQ(message_p).buffer = buffer;
SCTP_DATA_REQ(message_p).bufLen = length;
SCTP_DATA_REQ(message_p).assocId = assoc_id;
SCTP_DATA_REQ(message_p).stream = stream;
return itti_send_msg_to_task(TASK_SCTP, INSTANCE_DEFAULT, message_p);
}
int s1ap_mme_itti_forward_nas_uplink(uint8_t *buffer, uint32_t length)
int s1ap_mme_itti_nas_uplink_ind(const uint32_t ue_id, uint8_t * const buffer,
const uint32_t length)
{
return 0;
MessageDef *message_p;
message_p = itti_alloc_new_message(TASK_S1AP, NAS_UPLINK_DATA_IND);
NAS_UL_DATA_IND(message_p).UEid = ue_id;
NAS_UL_DATA_IND(message_p).nasMsg.data = buffer;
NAS_UL_DATA_IND(message_p).nasMsg.length = length;
return itti_send_msg_to_task(TASK_NAS, INSTANCE_DEFAULT, message_p);
}
int s1ap_mme_itti_nas_downlink_cnf(const uint32_t ue_id)
{
MessageDef *message_p;
message_p = itti_alloc_new_message(TASK_S1AP, NAS_DOWNLINK_DATA_CNF);
NAS_DL_DATA_CNF(message_p).UEid = ue_id;
return itti_send_msg_to_task(TASK_NAS, INSTANCE_DEFAULT, message_p);
}
@@ -38,4 +38,9 @@
int s1ap_mme_itti_send_sctp_request(uint8_t *buffer, uint32_t length,
uint32_t assoc_id, uint16_t stream);
int s1ap_mme_itti_nas_uplink_ind(const uint32_t ue_id, uint8_t * const buffer,
const uint32_t length);
int s1ap_mme_itti_nas_downlink_cnf(const uint32_t ue_id);
#endif /* S1AP_MME_ITTI_MESSAGING_H_ */
+16 -8
View File
@@ -190,7 +190,12 @@ int s1ap_mme_handle_uplink_nas_transport(uint32_t assoc_id, uint32_t stream,
}
//TODO: forward NAS PDU to NAS
#if defined(DISABLE_USE_NAS)
DevMessage("TODO: forward NAS PDU to NAS\n");
#else
s1ap_mme_itti_nas_uplink_ind(uplinkNASTransport_p->mme_ue_s1ap_id, uplinkNASTransport_p->nas_pdu.buf,
uplinkNASTransport_p->nas_pdu.size);
#endif
return 0;
}
@@ -207,19 +212,21 @@ int s1ap_mme_handle_nas_non_delivery(uint32_t assoc_id, uint32_t stream,
return 0;
}
int s1ap_generate_downlink_nas_transport(nas_dl_data_ind_t *nas_dl_data_ind)
int s1ap_generate_downlink_nas_transport(nas_dl_data_req_t *nas_dl_data_req_p)
{
ue_description_t *ue_ref;
uint8_t *buffer_p;
uint32_t length;
DevAssert(nas_dl_data_ind != NULL);
DevAssert(nas_dl_data_req_p != NULL);
if ((ue_ref = s1ap_is_ue_mme_id_in_list(nas_dl_data_ind->UEid)) == NULL) {
if ((ue_ref = s1ap_is_ue_mme_id_in_list(nas_dl_data_req_p->UEid)) == NULL) {
/* If the UE-associated logical S1-connection is not established,
* the MME shall allocate a unique MME UE S1AP ID to be used for the UE.
*/
DevMessage("This case is not handled right now\n");
return -1;
} else {
/* We have fount the UE in the list.
* Create new IE list message and encode it.
@@ -239,16 +246,17 @@ int s1ap_generate_downlink_nas_transport(nas_dl_data_ind_t *nas_dl_data_ind)
downlinkNasTransport->mme_ue_s1ap_id = ue_ref->mme_ue_s1ap_id;
downlinkNasTransport->eNB_UE_S1AP_ID = ue_ref->eNB_ue_s1ap_id;
OCTET_STRING_fromBuf(&downlinkNasTransport->nas_pdu,
(char*)nas_dl_data_ind->nasMsg.data,
nas_dl_data_ind->nasMsg.length);
(char*)nas_dl_data_req_p->nasMsg.data,
nas_dl_data_req_p->nasMsg.length);
if (s1ap_mme_encode_pdu(&message, &buffer_p, &length) < 0) {
// TODO: handle something
return -1;
}
return s1ap_mme_itti_send_sctp_request(buffer_p, length,
ue_ref->eNB->sctp_assoc_id,
ue_ref->sctp_stream_send);
s1ap_mme_itti_send_sctp_request(buffer_p, length,
ue_ref->eNB->sctp_assoc_id,
ue_ref->sctp_stream_send);
s1ap_mme_itti_nas_downlink_cnf(ue_ref->mme_ue_s1ap_id);
}
return 0;
}
+1 -1
View File
@@ -66,6 +66,6 @@ int s1ap_mme_handle_nas_non_delivery(uint32_t assocId, uint32_t stream,
int s1ap_handle_attach_accepted(nas_attach_accept_t *attach_accept_p);
int s1ap_generate_downlink_nas_transport(nas_dl_data_ind_t *message);
int s1ap_generate_downlink_nas_transport(nas_dl_data_req_t *nas_dl_data_req);
#endif /* S1AP_MME_NAS_PROCEDURES_H_ */
+9 -12
View File
@@ -25,22 +25,19 @@ int sctp_itti_send_new_message_ind(int n, uint8_t *buffer, uint32_t assoc_id,
uint16_t stream,
uint16_t instreams, uint16_t outstreams)
{
MessageDef *message_p;
s1ap_sctp_new_msg_ind_t *sctp_new_msg_ind_p;
MessageDef *message_p;
message_p = itti_alloc_new_message(TASK_SCTP, S1AP_SCTP_NEW_MESSAGE_IND);
message_p = itti_alloc_new_message(TASK_SCTP, SCTP_DATA_IND);
sctp_new_msg_ind_p = &message_p->ittiMsg.s1ap_sctp_new_msg_ind;
SCTP_DATA_IND(message_p).buffer = malloc(sizeof(uint8_t) * n);
sctp_new_msg_ind_p->buffer = malloc(sizeof(uint8_t) * n);
memcpy((void *)SCTP_DATA_IND(message_p).buffer, (void *)buffer, n);
memcpy((void *)sctp_new_msg_ind_p->buffer, (void *)buffer, n);
sctp_new_msg_ind_p->stream = stream;
sctp_new_msg_ind_p->buf_length = n;
sctp_new_msg_ind_p->assoc_id = assoc_id;
sctp_new_msg_ind_p->instreams = instreams;
sctp_new_msg_ind_p->outstreams = outstreams;
SCTP_DATA_IND(message_p).stream = stream;
SCTP_DATA_IND(message_p).buf_length = n;
SCTP_DATA_IND(message_p).assoc_id = assoc_id;
SCTP_DATA_IND(message_p).instreams = instreams;
SCTP_DATA_IND(message_p).outstreams = outstreams;
return itti_send_msg_to_task(TASK_S1AP, INSTANCE_DEFAULT, message_p);
}
+10 -7
View File
@@ -598,26 +598,29 @@ static void *sctp_intertask_interface(void *args_p)
SCTP_ERROR("Failed to create new SCTP listener\n");
}
} break;
case SCTP_CLOSE_ASSOCIATION: {
} break;
case SCTP_NEW_DATA_REQ: {
SctpNewDataReq *sctpNewS1APDataReq;
sctpNewS1APDataReq = &received_message_p->ittiMsg.sctpNewDataReq;
if (sctp_send_msg(sctpNewS1APDataReq->assocId,
sctpNewS1APDataReq->stream,
sctpNewS1APDataReq->buffer,
sctpNewS1APDataReq->bufLen) < 0) {
case SCTP_DATA_REQ: {
if (sctp_send_msg(SCTP_DATA_REQ(received_message_p).assocId,
SCTP_DATA_REQ(received_message_p).stream,
SCTP_DATA_REQ(received_message_p).buffer,
SCTP_DATA_REQ(received_message_p).bufLen) < 0) {
SCTP_ERROR("Failed to send message over SCTP\n");
}
} break;
case MESSAGE_TEST: {
// int i = 10000;
// while(i--);
} break;
case TERMINATE_MESSAGE: {
itti_exit_task();
} break;
default: {
SCTP_DEBUG("Unkwnon message ID %d:%s\n",
ITTI_MSG_ID(received_message_p),