Commit c67aafd2 authored by Cedric Roux's avatar Cedric Roux
Browse files

- 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
parent f355cc61
......@@ -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)
......
......@@ -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 {
......
//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)
#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;
......
//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)
#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 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 {
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;
......
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 \
......
......@@ -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)
......
......@@ -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