Commit c67aafd2 authored by Cedric Roux's avatar Cedric Roux

- 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;
......
......@@ -37,10 +37,12 @@ messages_hdr = \
$(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 = \
......
......@@ -43,7 +43,7 @@
#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 ();
}
......@@ -157,7 +155,7 @@ int main(int argc, const char* argv[])
** 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,7 +204,8 @@ static void* _nas_network_mngr(void* args)
}
}
/* Close the connection to the network sublayer */LOG_TRACE (WARNING, "MME-MAIN - "
/* Close the connection to the network sublayer */LOG_TRACE (WARNING,
"MME-MAIN - "
"The network connection endpoint manager exited");
LOG_FUNC_RETURN(NULL);
......@@ -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;
}
......
This diff is collapsed.
......@@ -62,16 +62,16 @@ Description Implements the EPS Mobility Management procedures executed
** 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)
{
switch (evt->primitive) {
case _EMMREG_PROC_ABORT:
/*
* The EMM procedure that initiated EMM common procedure aborted
......
......@@ -67,7 +67,7 @@ Description Implements the EPS Mobility Management procedures executed
** Others: emm_fsm_status **
** **
***************************************************************************/
int EmmDeregistered(const emm_reg_t* evt)
int EmmDeregistered(const emm_reg_t *evt)
{
LOG_FUNC_IN;
......@@ -94,8 +94,7 @@ int EmmDeregistered(const emm_reg_t* evt)
*/
#endif
switch (evt->primitive)
{
switch (evt->primitive) {
#ifdef NAS_UE
case _EMMREG_NO_IMSI:
......
......@@ -60,7 +60,7 @@ Description Implements the EPS Mobility Management procedures executed
** Others: emm_fsm_status **
** **
***************************************************************************/
int EmmDeregisteredAttachNeeded(const emm_reg_t* evt)
int EmmDeregisteredAttachNeeded(const emm_reg_t *evt)
{
LOG_FUNC_IN;
......
......@@ -62,7 +62,7 @@ Description Implements the EPS Mobility Management procedures executed
** Others: emm_fsm_status **
** **
***************************************************************************/
int EmmDeregisteredAttemptingToAttach(const emm_reg_t* evt)
int EmmDeregisteredAttemptingToAttach(const emm_reg_t *evt)
{
LOG_FUNC_IN;
......@@ -70,8 +70,7 @@ int EmmDeregisteredAttemptingToAttach(const emm_reg_t* evt)
assert(emm_fsm_get_status() == EMM_DEREGISTERED_ATTEMPTING_TO_ATTACH);
switch (evt->primitive)
{
switch (evt->primitive) {
case _EMMREG_ATTACH_INIT:
/*
* Attach procedure has to be restarted (timers T3402 or T3411
......
......@@ -60,7 +60,7 @@ Description Implements the EPS Mobility Management procedures executed
** Others: emm_fsm_status **
** **
***************************************************************************/
int EmmDeregisteredInitiated(const emm_reg_t* evt)
int EmmDeregisteredInitiated(const emm_reg_t *evt)
{
LOG_FUNC_IN;
......@@ -73,8 +73,7 @@ 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:
/*
......
......@@ -66,7 +66,7 @@ Description Implements the EPS Mobility Management procedures executed
** Others: emm_fsm_status **
** **
***************************************************************************/
int EmmDeregisteredLimitedService(const emm_reg_t* evt)
int EmmDeregisteredLimitedService(const emm_reg_t *evt)
{
LOG_FUNC_IN;
......@@ -74,8 +74,7 @@ int EmmDeregisteredLimitedService(const emm_reg_t* evt)
assert(emm_fsm_get_status() == EMM_DEREGISTERED_LIMITED_SERVICE);
switch (evt->primitive)
{
switch (evt->primitive) {
case _EMMREG_REGISTER_REQ:
/*
* The user manually re-selected a PLMN to register to
......
......@@ -67,7 +67,7 @@ Description Implements the EPS Mobility Management procedures executed
** Others: emm_fsm_status **
** **
***************************************************************************/
int EmmDeregisteredNoCellAvailable(const emm_reg_t* evt)
int EmmDeregisteredNoCellAvailable(const emm_reg_t *evt)
{
LOG_FUNC_IN;
......@@ -75,8 +75,7 @@ int EmmDeregisteredNoCellAvailable(const emm_reg_t* evt)
assert(emm_fsm_get_status() == EMM_DEREGISTERED_NO_CELL_AVAILABLE);
switch (evt->primitive)
{
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
......
......@@ -61,7 +61,7 @@ Description Implements the EPS Mobility Management procedures executed
** Others: emm_fsm_status **
** **
***************************************************************************/
int EmmDeregisteredNoImsi(const emm_reg_t* evt)
int EmmDeregisteredNoImsi(const emm_reg_t *evt)
{
LOG_FUNC_IN;
......
......@@ -66,7 +66,7 @@ Description Implements the EPS Mobility Management procedures executed
** Others: emm_fsm_status **
** **
***************************************************************************/
int EmmDeregisteredNormalService(const emm_reg_t* evt)
int EmmDeregisteredNormalService(const emm_reg_t *evt)
{
LOG_FUNC_IN;
......@@ -74,8 +74,7 @@ int EmmDeregisteredNormalService(const emm_reg_t* evt)
assert(emm_fsm_get_status() == EMM_DEREGISTERED_NORMAL_SERVICE);
switch (evt->primitive)
{
switch (evt->primitive) {
case _EMMREG_REGISTER_REQ:
/*
* The user manually re-selected a PLMN to register to
......
......@@ -65,7 +65,7 @@ Description Implements the EPS Mobility Management procedures executed
** Others: emm_fsm_status **
** **
***************************************************************************/
int EmmDeregisteredPlmnSearch(const emm_reg_t* evt)
int EmmDeregisteredPlmnSearch(const emm_reg_t *evt)
{
LOG_FUNC_IN;
......@@ -73,8 +73,7 @@ int EmmDeregisteredPlmnSearch(const emm_reg_t* evt)
assert(emm_fsm_get_status() == EMM_DEREGISTERED_PLMN_SEARCH);
switch (evt->primitive)
{
switch (evt->primitive) {
case _EMMREG_NO_CELL:
/*
* No suitable cell of the selected PLMN has been found to camp on
......
......@@ -59,7 +59,7 @@ Description Implements the EPS Mobility Management procedures executed
** Others: emm_fsm_status **
** **
***************************************************************************/
int EmmNull(const emm_reg_t* evt)
int EmmNull(const emm_reg_t *evt)
{
LOG_FUNC_IN;
......@@ -73,8 +73,7 @@ int EmmNull(const emm_reg_t* evt)
LOG_FUNC_RETURN (rc);
}
switch (evt->primitive)
{
switch (evt->primitive) {
case _EMMREG_S1_ENABLED:
/*
* The EPS capability has been enabled in the UE:
......
......@@ -63,7 +63,7 @@ Description Implements the EPS Mobility Management procedures executed
** Others: emm_fsm_status **
** **
***************************************************************************/
int EmmRegistered(const emm_reg_t* evt)
int EmmRegistered(const emm_reg_t *evt)
{
LOG_FUNC_IN;
......@@ -76,8 +76,7 @@ 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:
/*
......
......@@ -62,7 +62,7 @@ Description Implements the EPS Mobility Management procedures executed
** Others: emm_fsm_status **
** **
***************************************************************************/
int EmmRegisteredAttemptingToUpdate(const emm_reg_t* evt)
int EmmRegisteredAttemptingToUpdate(const emm_reg_t *evt)
{
LOG_FUNC_IN;
......
......@@ -61,7 +61,7 @@ Description Implements the EPS Mobility Management procedures executed
** Others: emm_fsm_status **
** **
***************************************************************************/
int EmmRegisteredImsiDetachInitiated(const emm_reg_t* evt)
int EmmRegisteredImsiDetachInitiated(const emm_reg_t *evt)
{
LOG_FUNC_IN;
......
......@@ -61,7 +61,7 @@ Description Implements the EPS Mobility Management procedures executed
** Others: emm_fsm_status **
** **
***************************************************************************/
int EmmRegisteredInitiated(const emm_reg_t* evt)
int EmmRegisteredInitiated(const emm_reg_t *evt)
{
LOG_FUNC_IN;
......@@ -69,8 +69,7 @@ int EmmRegisteredInitiated(const emm_reg_t* evt)
assert(emm_fsm_get_status() == EMM_REGISTERED_INITIATED);
switch (evt->primitive)
{
switch (evt->primitive) {
case _EMMREG_ATTACH_INIT:
/*
* Attach procedure has to be restarted (timers T3402 or T3411
......
......@@ -57,7 +57,7 @@ Description Implements the EPS Mobility Management procedures executed
** Others: emm_fsm_status **
** **
***************************************************************************/
int EmmRegisteredLimitedService(const emm_reg_t* evt)
int EmmRegisteredLimitedService(const emm_reg_t *evt)
{
LOG_FUNC_IN;
......
......@@ -58,7 +58,7 @@ Description Implements the EPS Mobility Management procedures executed
** Others: emm_fsm_status **
** **
***************************************************************************/
int EmmRegisteredNoCellAvailable(const emm_reg_t* evt)
int EmmRegisteredNoCellAvailable(const emm_reg_t *evt)
{
LOG_FUNC_IN;
......
......@@ -57,7 +57,7 @@ Description Implements the EPS Mobility Management procedures executed
** Others: emm_fsm_status **
** **
***************************************************************************/
int EmmRegisteredNormalService(const emm_reg_t* evt)
int EmmRegisteredNormalService(const emm_reg_t *evt)
{
LOG_FUNC_IN;
......
......@@ -57,7 +57,7 @@ Description Implements the EPS Mobility Management procedures executed
** Others: emm_fsm_status **
** **
***************************************************************************/
int EmmRegisteredPlmnSearch(const emm_reg_t* evt)
int EmmRegisteredPlmnSearch(const emm_reg_t *evt)
{
LOG_FUNC_IN;
......@@ -84,7 +84,7 @@ int EmmRegisteredPlmnSearch(const emm_reg_t* evt)
** Others: emm_fsm_status **
** **
***************************************************************************/
int EmmRegisteredPlmnSearch_xxx(const emm_reg_t* evt)
int EmmRegisteredPlmnSearch_xxx(const emm_reg_t *evt)
{
LOG_FUNC_IN;
......
......@@ -63,7 +63,7 @@ Description Implements the EPS Mobility Management procedures executed
** Others: emm_fsm_status **
** **
***************************************************************************/
int EmmRegisteredUpdateNeeded(const emm_reg_t* evt)
int EmmRegisteredUpdateNeeded(const emm_reg_t *evt)
{
LOG_FUNC_IN;
......
......@@ -59,7 +59,7 @@ Description Implements the EPS Mobility Management procedures executed
** Others: emm_fsm_status **
** **
***************************************************************************/
int EmmServiceRequestInitiated(const emm_reg_t* evt)
int EmmServiceRequestInitiated(const emm_reg_t *evt)
{
LOG_FUNC_IN;
......
......@@ -59,7 +59,7 @@ Description Implements the EPS Mobility Management procedures executed
** Others: emm_fsm_status **
** **
***************************************************************************/
int EmmTrackingAreaUpdatingInitiated(const emm_reg_t* evt)
int EmmTrackingAreaUpdatingInitiated(const emm_reg_t *evt)
{
LOG_FUNC_IN;
......
......@@ -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__*/
......@@ -60,8 +60,8 @@ typedef struct {
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 */
const OctetString *k_enc; /* NAS cyphering key */
const OctetString *k_int; /* NAS integrity key */
} emm_as_security_data_t;
/****************************************************************************/
......@@ -88,10 +88,10 @@ typedef struct {
* 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 */
const OctetString *rand; /* Random challenge number */
const OctetString *autn; /* Authentication token */
const OctetString *res; /* Authentication response */
const OctetString *auts; /* Synchronisation failure */
/*
* Security Mode Command
*/
......@@ -124,7 +124,7 @@ typedef struct {
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 */
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 */
......@@ -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,
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__*/
......@@ -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",
......@@ -94,7 +94,7 @@ void emm_esm_initialize(void)
** Others: None **
** **
***************************************************************************/
int emm_esm_send(const emm_esm_t* msg)
int emm_esm_send(const emm_esm_t *msg)
{
LOG_FUNC_IN;
......@@ -104,8 +104,7 @@ int emm_esm_send(const emm_esm_t* msg)
LOG_TRACE(INFO, "EMMESM-SAP - Received primitive %s (%d)",
_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
......@@ -122,8 +121,7 @@ int emm_esm_send(const emm_esm_t* msg)
* only */
rc = emm_proc_attach_set_emergency();
}
}
else {
} else {
/* Consider the UE locally detached from the network */
rc = emm_proc_attach_set_detach();
}
......
......@@ -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__*/
......@@ -52,7 +52,7 @@ Description Defines the EPS Mobility Management procedures executed at
*/
/* 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
......@@ -131,41 +130,40 @@ static const char* _emm_fsm_status_str[EMM_STATE_MAX] =
*/
/* Type of the EPS Mobility Management state machine handler */
typedef int(*emm_fsm_handler_t)(const emm_reg_t*);
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
......@@ -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);
......@@ -326,7 +324,7 @@ 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;
......@@ -354,7 +352,7 @@ emm_fsm_state_t emm_fsm_get_status(unsigned int ueid, void *ctx)
** 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,7 +366,7 @@ 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);
......
......@@ -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__*/
......@@ -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_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_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_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_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_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_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__*/
......@@ -78,7 +78,7 @@ void emm_reg_initialize(void)
** Others: None **
** **
***************************************************************************/
int emm_reg_send(const emm_reg_t* msg)
int emm_reg_send(const emm_reg_t *msg)
{
LOG_FUNC_IN;
......
......@@ -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__*/
......@@ -80,7 +80,7 @@ void emm_sap_initialize(void)
** Others: None **
** **
***************************************************************************/
int emm_sap_send(emm_sap_t* msg)
int emm_sap_send(emm_sap_t *msg)
{
LOG_FUNC_IN;
......@@ -94,20 +94,17 @@ int emm_sap_send(emm_sap_t* msg)
/* 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) &&
} 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) &&
} 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 {
} else {
LOG_TRACE(WARNING, "EMM-SAP - Out of range primitive (%d)", primitive);
}
......
......@@ -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__*/
......@@ -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_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_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 *);
#endif
#endif /* __EMM_SEND_H__*/
......@@ -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
static int _dedicated_eps_bearer_activate(unsigned int ueid, int ebi,
const OctetString* msg);
const OctetString *msg);
#endif // NAS_MME
/****************************************************************************/
......@@ -103,11 +103,11 @@ static int _dedicated_eps_bearer_activate(unsigned int ueid, int ebi,
** **
***************************************************************************/
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;
......@@ -163,7 +163,7 @@ int esm_proc_dedicated_eps_bearer_context(unsigned int ueid, int pid,
***************************************************************************/
int esm_proc_dedicated_eps_bearer_context_request(int is_standalone,
unsigned int ueid, int ebi,
OctetString* msg, int ue_triggered)
OctetString *msg, int ue_triggered)
{
LOG_FUNC_IN;
......@@ -212,7 +212,7 @@ int esm_proc_dedicated_eps_bearer_context_request(int is_standalone,
** **
***************************************************************************/
int esm_proc_dedicated_eps_bearer_context_accept(unsigned int ueid, int ebi,
int* esm_cause)
int *esm_cause)
{
LOG_FUNC_IN;
......@@ -263,7 +263,7 @@ int esm_proc_dedicated_eps_bearer_context_accept(unsigned int ueid, int ebi,
** **
***************************************************************************/
int esm_proc_dedicated_eps_bearer_context_reject(unsigned int ueid, int ebi,
int* esm_cause)
int *esm_cause)
{
LOG_FUNC_IN;
......@@ -317,9 +317,9 @@ int esm_proc_dedicated_eps_bearer_context_reject(unsigned int ueid, int ebi,
** **
***************************************************************************/
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;
......@@ -356,8 +356,7 @@ int esm_proc_dedicated_eps_bearer_context_request(int ebi, int default_ebi,
if (rc != RETURNok) {
/* Failed to release EPS bearer context */
*esm_cause = ESM_CAUSE_PROTOCOL_ERROR;
}
else {
} else {
/* Assign new dedicated EPS bearer context */
ebi = esm_ebr_assign(ebi, pid+1, FALSE);
}
......@@ -372,15 +371,13 @@ int esm_proc_dedicated_eps_bearer_context_request(int ebi, int default_ebi,
LOG_TRACE(WARNING, "ESM-PROC - Syntactical errors in packet "
"filters");
*esm_cause = ESM_CAUSE_SYNTACTICAL_ERROR_IN_PACKET_FILTER;
}
else {
} 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 {
} else {
/* No resource available */
LOG_TRACE(WARNING, "ESM-PROC - Failed to create new dedicated "
"EPS bearer context");
......@@ -417,7 +414,7 @@ int esm_proc_dedicated_eps_bearer_context_request(int ebi, int default_ebi,
** **
***************************************************************************/
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;
......@@ -476,7 +473,7 @@ int esm_proc_dedicated_eps_bearer_context_accept(int is_standalone, int ebi,
** **
***************************************************************************/
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;
......@@ -492,8 +489,7 @@ int esm_proc_dedicated_eps_bearer_context_reject(int is_standalone, int ebi,
if (rc != RETURNok) {
LOG_TRACE(WARNING, "ESM-PROC - Failed to release EPS bearer data");
}
else {
} else {
emm_sap_t emm_sap;
emm_esm_data_t *emm_esm = &emm_sap.u.emm_esm.u.data;
/*
......@@ -543,14 +539,14 @@ int esm_proc_dedicated_eps_bearer_context_reject(int is_standalone, int ebi,
** 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;
......@@ -563,8 +559,7 @@ static void* _dedicated_eps_bearer_activate_t3485_handler(void* args)
/* Re-send activate dedicated EPS bearer context request message
* to the UE */
rc = _dedicated_eps_bearer_activate(data->ueid, data->ebi, &data->msg);
}
else {
} else {
/*
* The maximum number of activate dedicated EPS bearer context request
* message retransmission has exceed
......@@ -607,7 +602,7 @@ static void* _dedicated_eps_bearer_activate_t3485_handler(void* args)
** **
***************************************************************************/
static int _dedicated_eps_bearer_activate(unsigned int ueid, int ebi,
const OctetString* msg)
const OctetString *msg)
{
LOG_FUNC_IN;
......
......@@ -69,14 +69,14 @@ static struct {
/*
* Timer handlers
*/
static void* _default_eps_bearer_activate_t3485_handler(void*);
static void *_default_eps_bearer_activate_t3485_handler(void *);
/* Maximum value of the activate default EPS bearer context request
* retransmission counter */
#define DEFAULT_EPS_BEARER_ACTIVATE_COUNTER_MAX 5
static int _default_eps_bearer_activate(unsigned int ueid, int ebi,
const OctetString* msg);
const OctetString *msg);
#endif // NAS_MME
/****************************************************************************/
......@@ -110,9 +110,9 @@ static int _default_eps_bearer_activate(unsigned int ueid, int ebi,
** **
***************************************************************************/
int esm_proc_default_eps_bearer_context(unsigned int ueid, int pid,
unsigned int* ebi,
const esm_proc_qos_t* qos,
int* esm_cause)
unsigned int *ebi,
const esm_proc_qos_t *qos,
int *esm_cause)
{
LOG_FUNC_IN;
......@@ -171,7 +171,7 @@ int esm_proc_default_eps_bearer_context(unsigned int ueid, int pid,
***************************************************************************/
int esm_proc_default_eps_bearer_context_request(int is_standalone,
unsigned int ueid, int ebi,
OctetString* msg, int ue_triggered)
OctetString *msg, int ue_triggered)
{
LOG_FUNC_IN;
......@@ -222,7 +222,7 @@ int esm_proc_default_eps_bearer_context_request(int is_standalone,
** **
***************************************************************************/
int esm_proc_default_eps_bearer_context_accept(unsigned int ueid, int ebi,
int* esm_cause)
int *esm_cause)
{
LOG_FUNC_IN;
......@@ -269,7 +269,7 @@ int esm_proc_default_eps_bearer_context_accept(unsigned int ueid, int ebi,
** **
***************************************************************************/
int esm_proc_default_eps_bearer_context_reject(unsigned int ueid, int ebi,
int* esm_cause)
int *esm_cause)
{
LOG_FUNC_IN;
......@@ -371,8 +371,8 @@ int esm_proc_default_eps_bearer_context_failure(unsigned int ueid)
** **
***************************************************************************/
int esm_proc_default_eps_bearer_context_request(int pid, int ebi,
const esm_proc_qos_t* qos,
int* esm_cause)
const esm_proc_qos_t *qos,
int *esm_cause)
{
LOG_FUNC_IN;
......@@ -396,8 +396,7 @@ int esm_proc_default_eps_bearer_context_request(int pid, int ebi,
if (rc != RETURNok) {
/* Failed to release EPS bearer context */
*esm_cause = ESM_CAUSE_PROTOCOL_ERROR;
}
else {
} else {
/* Assign new default EPS bearer context */
ebi = esm_ebr_assign(ebi, pid+1, TRUE);
}
......@@ -410,8 +409,7 @@ int esm_proc_default_eps_bearer_context_request(int pid, int ebi,
/* Default EPS bearer contextx successfully created */
_default_eps_bearer_context_data.ebi = ebi;
rc = RETURNok;
}
else {
} else {
/* No resource available */
LOG_TRACE(WARNING, "ESM-PROC - Failed to create new default EPS "
"bearer context");
......@@ -454,7 +452,7 @@ int esm_proc_default_eps_bearer_context_request(int pid, int ebi,
** **
***************************************************************************/
int esm_proc_default_eps_bearer_context_accept(int is_standalone, int ebi,
OctetString* msg, int ue_triggered)
OctetString *msg, int ue_triggered)
{
LOG_FUNC_IN;
......@@ -521,7 +519,7 @@ int esm_proc_default_eps_bearer_context_accept(int is_standalone, int ebi,
** **
***************************************************************************/
int esm_proc_default_eps_bearer_context_reject(int is_standalone, int ebi,
OctetString* msg, int ue_triggered)
OctetString *msg, int ue_triggered)
{
LOG_FUNC_IN;
......@@ -537,8 +535,7 @@ int esm_proc_default_eps_bearer_context_reject(int is_standalone, int ebi,
if (rc != RETURNok) {
LOG_TRACE(WARNING, "ESM-PROC - Failed to release EPS bearer data");
}
else if (is_standalone) {
} else if (is_standalone) {
emm_sap_t emm_sap;
emm_esm_data_t *emm_esm = &emm_sap.u.emm_esm.u.data;
/*
......@@ -549,8 +546,7 @@ int esm_proc_default_eps_bearer_context_reject(int is_standalone, int ebi,
emm_esm->msg.length = msg->length;
emm_esm->msg.value = msg->value;
rc = emm_sap_send(&emm_sap);
}
else {
} else {
/* An error is returned to notify EMM that the default EPS bearer
* activation procedure initiated as part of the initial attach
* procedure has failed
......@@ -665,14 +661,14 @@ int esm_proc_default_eps_bearer_context_failure(void)
** Others: None **
** **
***************************************************************************/
static void* _default_eps_bearer_activate_t3485_handler(void* args)
static void *_default_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;
......@@ -685,8 +681,7 @@ static void* _default_eps_bearer_activate_t3485_handler(void* args)
/* Re-send activate default EPS bearer context request message
* to the UE */
rc = _default_eps_bearer_activate(data->ueid, data->ebi, &data->msg);
}
else {
} else {
/*
* The maximum number of activate default EPS bearer context request
* message retransmission has exceed
......@@ -729,7 +724,7 @@ static void* _default_eps_bearer_activate_t3485_handler(void* args)
** **
***************************************************************************/
static int _default_eps_bearer_activate(unsigned int ueid, int ebi,
const OctetString* msg)
const OctetString *msg)
{
LOG_FUNC_IN;
......
......@@ -75,7 +75,7 @@ int esm_proc_status_ind(
#ifdef NAS_MME
unsigned int ueid,
#endif
int pti, int ebi, int* esm_cause)
int pti, int ebi, int *esm_cause)
{
LOG_FUNC_IN;
......@@ -86,8 +86,7 @@ int esm_proc_status_ind(
LOG_TRACE(DEBUG, "ESM-PROC - To be implemented");
switch (*esm_cause)
{
switch (*esm_cause) {
case ESM_CAUSE_INVALID_EPS_BEARER_IDENTITY:
/*
* Abort any ongoing ESM procedure related to the received EPS
......@@ -151,7 +150,7 @@ int esm_proc_status(int is_standalone,
#ifdef NAS_MME
unsigned int ueid,
#endif
int ebi, OctetString* msg,
int ebi, OctetString *msg,
int ue_triggered)
{
LOG_FUNC_IN;
......
......@@ -90,7 +90,7 @@ typedef struct {
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_bearer_t *bearer[ESM_DATA_EPS_BEARER_MAX];
} esm_pdn_t;
/*
......@@ -112,7 +112,7 @@ typedef struct {
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 */
esm_pdn_t *data; /* Active PDN connection data */
} pdn[ESM_DATA_PDN_MAX+1];
} esm_data_context_t;
......@@ -150,7 +150,7 @@ typedef struct {
* ------------
*/
#define ESM_DATA_NB_UE_MAX (MME_API_NB_UE_MAX + 1)
esm_data_context_t* ctx[ESM_DATA_NB_UE_MAX];
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__*/
......@@ -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
......@@ -77,7 +77,7 @@ typedef struct {
#endif
#ifdef NAS_MME
struct nas_timer_t timer; /* Retransmission timer */
esm_ebr_timer_data_t* args; /* Retransmission timer parameters data */
esm_ebr_timer_data_t *args; /* Retransmission timer parameters data */
#endif
} esm_ebr_context_t;
......@@ -90,7 +90,7 @@ static struct {
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];
/*
......@@ -147,7 +147,7 @@ void esm_ebr_initialize(
#ifdef NAS_UE
esm_indication_callback_t cb
#endif
)
)
{
int ueid, i;
LOG_FUNC_IN;
......@@ -210,17 +210,14 @@ int esm_ebr_assign(unsigned int ueid, int ebi)
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) {
} 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
{
} else {
/* Search for an available EPS bearer identity */
i = _esm_ebr_get_available_entry(ueid);
if (i < 0) {
......@@ -232,7 +229,7 @@ int esm_ebr_assign(unsigned int ueid, int ebi)
/* 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);
}
......@@ -298,7 +295,7 @@ int esm_ebr_release(
}
/* 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);
......@@ -356,7 +353,7 @@ int esm_ebr_release(
** Others: _esm_ebr_data **
** **
***************************************************************************/
int esm_ebr_start_timer( unsigned int ueid, int ebi, const OctetString* msg,
int esm_ebr_start_timer( unsigned int ueid, int ebi, const OctetString *msg,
long sec, nas_timer_callback_t cb)
{
LOG_FUNC_IN;
......@@ -369,7 +366,7 @@ int esm_ebr_start_timer( unsigned int ueid, int ebi, const OctetString* msg,
}
/* 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);
......@@ -380,10 +377,9 @@ int esm_ebr_start_timer( unsigned int ueid, int ebi, const OctetString* msg,
/* Re-start the retransmission timer */
ctx->timer.id = nas_timer_restart(ctx->timer.id);
}
}
else {
} else {
/* Setup the retransmission timer parameters */
ctx->args = (esm_ebr_timer_data_t*)malloc(sizeof(esm_ebr_timer_data_t));
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;
......@@ -392,7 +388,7 @@ int esm_ebr_start_timer( unsigned int ueid, int ebi, const OctetString* msg,
/* 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.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);
......@@ -441,7 +437,7 @@ int esm_ebr_stop_timer( unsigned int ueid, int ebi)
}
/* 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);
......@@ -490,8 +486,12 @@ 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;
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;
}
......@@ -546,7 +546,7 @@ int esm_ebr_set_status(
}
/* 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 "
......@@ -692,13 +692,17 @@ 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;
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;
if (_esm_ebr_data[ueid].context[i] != NULL) {
continue;
}
return i;
}
/* No available EBI entry found */
return (-1);
}
}
......@@ -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);
......
......@@ -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,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",
......
......@@ -139,7 +139,7 @@ void esm_main_cleanup(void)
/* 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;
esm_pdn_t *pdn = _esm_data.pdn[pid].data;
if (pdn->apn.length > 0) {
free(pdn->apn.value);
}
......@@ -252,7 +252,7 @@ int esm_main_has_emergency(void)
** 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;
......@@ -260,12 +260,10 @@ int esm_main_get_pdn_status(int cid, int* state)
if (pid >= ESM_DATA_PDN_MAX) {
return (FALSE);
}
else if (pid != _esm_data.pdn[pid].pid) {
} 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) {
} else if (_esm_data.pdn[pid].data == NULL) {
LOG_TRACE(ERROR, "ESM-MAIN - PDN connection %d has not been allocated",
cid);
return (FALSE);
......@@ -298,8 +296,8 @@ int esm_main_get_pdn_status(int cid, int* state)
** 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;
......@@ -307,12 +305,10 @@ int esm_main_get_pdn(int cid, int* type, const char** apn,
if (pid >= ESM_DATA_PDN_MAX) {
return (RETURNerror);
}
else if (pid != _esm_data.pdn[pid].pid) {
} 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) {
} else if (_esm_data.pdn[pid].data == NULL) {
LOG_TRACE(ERROR, "ESM-MAIN - PDN connection %d has not been allocated",
cid);
return (RETURNerror);
......@@ -322,7 +318,7 @@ int esm_main_get_pdn(int cid, int* type, const char** apn,
*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;
}
......@@ -350,7 +346,7 @@ int esm_main_get_pdn(int cid, int* type, const char** apn,
** 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;
......@@ -358,17 +354,14 @@ int esm_main_get_pdn_addr(int cid, const char** ipv4addr, const char** ipv6addr)
if (pid >= ESM_DATA_PDN_MAX) {
return (RETURNerror);
}
else if (pid != _esm_data.pdn[pid].pid) {
} 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) {
} 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) {
} else if (!_esm_data.pdn[pid].is_active) {
/* No any IP address has been assigned to this PDN connection */
return (RETURNok);
}
......@@ -376,12 +369,10 @@ int esm_main_get_pdn_addr(int cid, const char** ipv4addr, const char** ipv6addr)
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) {
} else if (_esm_data.pdn[pid].data->type == NET_PDN_TYPE_IPV6) {
/* Get IPv6 address */
*ipv6addr = _esm_data.pdn[pid].data->ip_addr;
}
else {
} 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;
......
......@@ -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
......
......@@ -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"
};
......@@ -60,7 +60,7 @@ 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 */
esm_pt_timer_data_t *args; /* Retransmission timer parameters data */
} esm_pt_context_t;
/*
......@@ -72,7 +72,7 @@ static struct {
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
......@@ -139,7 +139,7 @@ int esm_pt_assign(void)
/* 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);
}
......@@ -187,7 +187,7 @@ int esm_pt_release(int pti)
}
/* 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);
......@@ -242,7 +242,7 @@ int esm_pt_release(int pti)
** Others: _esm_pt_data **
** **
***************************************************************************/
int esm_pt_start_timer(int pti, const OctetString* msg,
int esm_pt_start_timer(int pti, const OctetString *msg,
long sec, nas_timer_callback_t cb)
{
LOG_FUNC_IN;
......@@ -252,7 +252,7 @@ int esm_pt_start_timer(int pti, const OctetString* msg,
}
/* 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);
......@@ -263,17 +263,16 @@ int esm_pt_start_timer(int pti, const OctetString* msg,
/* Re-start the retransmission timer */
ctx->timer.id = nas_timer_restart(ctx->timer.id);
}
}
else {
} else {
/* Setup the retransmission timer parameters */
ctx->args = (esm_pt_timer_data_t*)malloc(sizeof(esm_pt_timer_data_t));
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.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);
......@@ -318,7 +317,7 @@ int esm_pt_stop_timer(int pti)
}
/* 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);
......@@ -370,7 +369,7 @@ int esm_pt_set_status(int pti, esm_pt_state status)
}
/* 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 "
......@@ -448,8 +447,12 @@ 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;
if (_esm_pt_data.context[i] == NULL) {
continue;
}
if (_esm_pt_data.context[i]->status != status) {
continue;
}
/* PDN connection entry found */
break;
}
......@@ -530,14 +533,18 @@ 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;
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;
if (_esm_pt_data.context[i] != NULL) {
continue;
}
return i;
}
/* No available PTI entry found */
return (-1);
}
}
#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);
......
......@@ -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__*/
......@@ -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__*/
......@@ -91,7 +91,7 @@ typedef struct {
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 */
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 */
......@@ -134,7 +134,7 @@ typedef struct {
* message */
unsigned int ueid; /* Local UE identifier */
esm_sap_error_t err; /* ESM-SAP error code */
const OctetString* recv; /* Encoded ESM message received */
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;
......
......@@ -70,7 +70,7 @@ Description Defines functions executed at the ESM Service Access
** 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;
......@@ -118,8 +118,8 @@ int esm_send_status(int pti, int ebi, esm_status_msg* msg, int esm_cause)
** **
***************************************************************************/
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;
......@@ -153,7 +153,7 @@ int esm_send_pdn_connectivity_request(int pti, int is_emergency, int pdn_type,
msg->presencemask |=
PDN_CONNECTIVITY_REQUEST_ACCESS_POINT_NAME_PRESENT;
msg->accesspointname.accesspointnamevalue.length = len;
msg->accesspointname.accesspointnamevalue.value = (uint8_t*)apn;
msg->accesspointname.accesspointnamevalue.value = (uint8_t *)apn;
}
}
......@@ -185,7 +185,7 @@ int esm_send_pdn_connectivity_request(int pti, int is_emergency, int pdn_type,
** **
***************************************************************************/
int esm_send_pdn_disconnect_request(int pti, int ebi,
pdn_disconnect_request_msg* msg)
pdn_disconnect_request_msg *msg)
{
LOG_FUNC_IN;
......@@ -226,7 +226,7 @@ int esm_send_pdn_disconnect_request(int pti, int ebi,
** **
***************************************************************************/
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;
......@@ -266,7 +266,7 @@ int esm_send_activate_default_eps_bearer_context_accept(int ebi,
** **
***************************************************************************/
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;
......@@ -309,7 +309,7 @@ int esm_send_activate_default_eps_bearer_context_reject(int ebi,
** **
***************************************************************************/
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;
......@@ -350,7 +350,7 @@ int esm_send_activate_dedicated_eps_bearer_context_accept(int ebi,
** **
***************************************************************************/
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;
......@@ -390,7 +390,7 @@ int esm_send_activate_dedicated_eps_bearer_context_reject(int ebi,
** **
***************************************************************************/
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;
......@@ -436,7 +436,7 @@ int esm_send_deactivate_eps_bearer_context_accept(int ebi,
** Others: None **
** **
***************************************************************************/
int esm_send_pdn_connectivity_reject(int pti, pdn_connectivity_reject_msg* msg,
int esm_send_pdn_connectivity_reject(int pti, pdn_connectivity_reject_msg *msg,
int esm_cause)
{
LOG_FUNC_IN;
......@@ -477,7 +477,7 @@ int esm_send_pdn_connectivity_reject(int pti, pdn_connectivity_reject_msg* msg,
** Others: None **
** **
***************************************************************************/
int esm_send_pdn_disconnect_reject(int pti, pdn_disconnect_reject_msg* msg,
int esm_send_pdn_disconnect_reject(int pti, pdn_disconnect_reject_msg *msg,
int esm_cause)
{
LOG_FUNC_IN;
......@@ -525,10 +525,10 @@ int esm_send_pdn_disconnect_reject(int pti, pdn_disconnect_reject_msg* msg,
** **
***************************************************************************/
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;
......@@ -591,9 +591,9 @@ int esm_send_activate_default_eps_bearer_context_request(int pti, int ebi,
** **
***************************************************************************/
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,8 +611,7 @@ 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++)
{
for (i = 0; i < msg->tft.numberofpacketfilters; i++) {
msg->tft.packetfilterlist.createtft[i] = (*pkfs)[i];
}
......@@ -647,7 +646,7 @@ int esm_send_activate_dedicated_eps_bearer_context_request(int pti, int ebi,
** **
***************************************************************************/
int esm_send_deactivate_eps_bearer_context_request(int pti, int ebi,
deactivate_eps_bearer_context_request_msg* msg,
deactivate_eps_bearer_context_request_msg *msg,
int esm_cause)
{
LOG_FUNC_IN;
......
......@@ -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__*/
This diff is collapsed.
......@@ -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__*/
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -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__*/
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment