Commit f7af8d0e authored by winckel's avatar winckel

Differentiated downlink and uplink nas logging messages.

Renamed NAS MME task.
Modified visited PLMN information.

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4974 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent 5f1cac7b
//WARNING: Do not include this header directly. Use intertask_interface.h instead. //WARNING: Do not include this header directly. Use intertask_interface.h instead.
// Messages for NAS logging // Messages for NAS logging
MESSAGE_DEF(NAS_RAW_MSG, MESSAGE_PRIORITY_MED, nas_raw_msg_t, nas_raw_msg) MESSAGE_DEF(NAS_DL_RAW_MSG, MESSAGE_PRIORITY_MED, nas_raw_msg_t, nas_dl_raw_msg)
MESSAGE_DEF(NAS_UL_RAW_MSG, MESSAGE_PRIORITY_MED, nas_raw_msg_t, nas_ul_raw_msg)
MESSAGE_DEF(NAS_EMM_PLAIN_MSG, MESSAGE_PRIORITY_MED, nas_emm_plain_msg_t, nas_emm_plain_msg) MESSAGE_DEF(NAS_DL_EMM_PLAIN_MSG, MESSAGE_PRIORITY_MED, nas_emm_plain_msg_t, nas_dl_emm_plain_msg)
MESSAGE_DEF(NAS_EMM_PROTECTED_MSG, MESSAGE_PRIORITY_MED, nas_emm_protected_msg_t, nas_emm_protected_msg) MESSAGE_DEF(NAS_UL_EMM_PLAIN_MSG, MESSAGE_PRIORITY_MED, nas_emm_plain_msg_t, nas_ul_emm_plain_msg)
MESSAGE_DEF(NAS_DL_EMM_PROTECTED_MSG, MESSAGE_PRIORITY_MED, nas_emm_protected_msg_t, nas_dl_emm_protected_msg)
MESSAGE_DEF(NAS_UL_EMM_PROTECTED_MSG, MESSAGE_PRIORITY_MED, nas_emm_protected_msg_t, nas_ul_emm_protected_msg)
MESSAGE_DEF(NAS_ESM_PLAIN_MSG, MESSAGE_PRIORITY_MED, nas_esm_plain_msg_t, nas_esm_plain_msg) MESSAGE_DEF(NAS_DL_ESM_PLAIN_MSG, MESSAGE_PRIORITY_MED, nas_esm_plain_msg_t, nas_dl_esm_plain_msg)
MESSAGE_DEF(NAS_ESM_PROTECTED_MSG, MESSAGE_PRIORITY_MED, nas_esm_protected_msg_t, nas_esm_protected_msg) MESSAGE_DEF(NAS_UL_ESM_PLAIN_MSG, MESSAGE_PRIORITY_MED, nas_esm_plain_msg_t, nas_ul_esm_plain_msg)
MESSAGE_DEF(NAS_DL_ESM_PROTECTED_MSG, MESSAGE_PRIORITY_MED, nas_esm_protected_msg_t, nas_dl_esm_protected_msg)
MESSAGE_DEF(NAS_UL_ESM_PROTECTED_MSG, MESSAGE_PRIORITY_MED, nas_esm_protected_msg_t, nas_ul_esm_protected_msg)
/* */ /* */
MESSAGE_DEF(NAS_PAGING_IND, MESSAGE_PRIORITY_MED, nas_paging_ind_t, nas_paging_ind) MESSAGE_DEF(NAS_PAGING_IND, MESSAGE_PRIORITY_MED, nas_paging_ind_t, nas_paging_ind)
......
...@@ -4,13 +4,18 @@ ...@@ -4,13 +4,18 @@
#ifndef NAS_MESSAGES_TYPES_H_ #ifndef NAS_MESSAGES_TYPES_H_
#define NAS_MESSAGES_TYPES_H_ #define NAS_MESSAGES_TYPES_H_
#define NAS_RAW_MSG(mSGpTR) (mSGpTR)->ittiMsg.nas_raw_msg #define NAS_DL_RAW_MSG(mSGpTR) (mSGpTR)->ittiMsg.nas_dl_raw_msg
#define NAS_UL_RAW_MSG(mSGpTR) (mSGpTR)->ittiMsg.nas_ul_raw_msg
#define NAS_EMM_PROTECTED_MSG(mSGpTR) (mSGpTR)->ittiMsg.nas_emm_protected_msg
#define NAS_EMM_PLAIN_MSG(mSGpTR) (mSGpTR)->ittiMsg.nas_emm_plain_msg #define NAS_DL_EMM_PROTECTED_MSG(mSGpTR) (mSGpTR)->ittiMsg.nas_dl_emm_protected_msg
#define NAS_UL_EMM_PROTECTED_MSG(mSGpTR) (mSGpTR)->ittiMsg.nas_ul_emm_protected_msg
#define NAS_ESM_PROTECTED_MSG(mSGpTR) (mSGpTR)->ittiMsg.nas_esm_protected_msg #define NAS_DL_EMM_PLAIN_MSG(mSGpTR) (mSGpTR)->ittiMsg.nas_dl_emm_plain_msg
#define NAS_ESM_PLAIN_MSG(mSGpTR) (mSGpTR)->ittiMsg.nas_esm_plain_msg #define NAS_UL_EMM_PLAIN_MSG(mSGpTR) (mSGpTR)->ittiMsg.nas_ul_emm_plain_msg
#define NAS_DL_ESM_PROTECTED_MSG(mSGpTR) (mSGpTR)->ittiMsg.nas_dl_esm_protected_msg
#define NAS_UL_ESM_PROTECTED_MSG(mSGpTR) (mSGpTR)->ittiMsg.nas_ul_esm_protected_msg
#define NAS_DL_ESM_PLAIN_MSG(mSGpTR) (mSGpTR)->ittiMsg.nas_dl_esm_plain_msg
#define NAS_UL_ESM_PLAIN_MSG(mSGpTR) (mSGpTR)->ittiMsg.nas_ul_esm_plain_msg
#define NAS_UL_DATA_IND(mSGpTR) (mSGpTR)->ittiMsg.nas_ul_data_ind #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_REQ(mSGpTR) (mSGpTR)->ittiMsg.nas_dl_data_req
......
...@@ -10,7 +10,7 @@ TASK_DEF(TASK_FW_IP, TASK_PRIORITY_MED, 200) ...@@ -10,7 +10,7 @@ TASK_DEF(TASK_FW_IP, TASK_PRIORITY_MED, 200)
/// MME Applicative task /// MME Applicative task
TASK_DEF(TASK_MME_APP, TASK_PRIORITY_MED, 200) TASK_DEF(TASK_MME_APP, TASK_PRIORITY_MED, 200)
/// NAS task /// NAS task
TASK_DEF(TASK_NAS, TASK_PRIORITY_MED, 200) TASK_DEF(TASK_NAS_MME, TASK_PRIORITY_MED, 200)
/// S1AP task /// S1AP task
TASK_DEF(TASK_S11, TASK_PRIORITY_MED, 200) TASK_DEF(TASK_S11, TASK_PRIORITY_MED, 200)
/// S1AP task /// S1AP task
......
...@@ -285,7 +285,7 @@ request_auth: { ...@@ -285,7 +285,7 @@ request_auth: {
MME_APP_IMSI_TO_STRING(imsi, nas_auth_req_p->imsi); MME_APP_IMSI_TO_STRING(imsi, nas_auth_req_p->imsi);
nas_auth_req_p->failure = NAS_FAILURE_OK; nas_auth_req_p->failure = NAS_FAILURE_OK;
return itti_send_msg_to_task(TASK_NAS, INSTANCE_DEFAULT, message_p); return itti_send_msg_to_task(TASK_NAS_MME, INSTANCE_DEFAULT, message_p);
} }
} }
} }
...@@ -295,9 +295,15 @@ request_auth: { ...@@ -295,9 +295,15 @@ request_auth: {
void mme_app_handle_nas_auth_param_req(nas_auth_param_req_t void mme_app_handle_nas_auth_param_req(nas_auth_param_req_t
*nas_auth_param_req_p) *nas_auth_param_req_p)
{ {
struct ue_context_s *ue_context; static const plmn_t visited_plmn_eur = {
uint64_t imsi = 0; .MCCdigit3 = 2,
plmn_t visited_plmn_dongle = { .MCCdigit2 = 0,
.MCCdigit1 = 8,
.MNCdigit1 = 0,
.MNCdigit2 = 1,
.MNCdigit3 = 0,
};
static const plmn_t visited_plmn_dongle = {
.MCCdigit3 = 2, .MCCdigit3 = 2,
.MCCdigit2 = 0, .MCCdigit2 = 0,
.MCCdigit1 = 8, .MCCdigit1 = 8,
...@@ -306,8 +312,17 @@ void mme_app_handle_nas_auth_param_req(nas_auth_param_req_t ...@@ -306,8 +312,17 @@ void mme_app_handle_nas_auth_param_req(nas_auth_param_req_t
.MNCdigit1 = 0xF, .MNCdigit1 = 0xF,
}; };
plmn_t *visited_plmn;
struct ue_context_s *ue_context;
uint64_t imsi = 0;
DevAssert(nas_auth_param_req_p != NULL); DevAssert(nas_auth_param_req_p != NULL);
#if 1
visited_plmn = &visited_plmn_eur;
#else
visited_plmn = &visited_plmn_dongle;
#endif
MME_APP_STRING_TO_IMSI(nas_auth_param_req_p->imsi, &imsi); MME_APP_STRING_TO_IMSI(nas_auth_param_req_p->imsi, &imsi);
MME_APP_DEBUG("Handling imsi %"IMSI_FORMAT"\n", imsi); MME_APP_DEBUG("Handling imsi %"IMSI_FORMAT"\n", imsi);
...@@ -331,30 +346,21 @@ void mme_app_handle_nas_auth_param_req(nas_auth_param_req_t ...@@ -331,30 +346,21 @@ void mme_app_handle_nas_auth_param_req(nas_auth_param_req_t
ue_context->ue_id = nas_auth_param_req_p->ue_id; ue_context->ue_id = nas_auth_param_req_p->ue_id;
DevAssert(mme_insert_ue_context(&mme_app_desc.mme_ue_contexts, ue_context) == 0); DevAssert(mme_insert_ue_context(&mme_app_desc.mme_ue_contexts, ue_context) == 0);
/* We have no vector for this UE, send an authentication request /* We have no vector for this UE, send an authentication request
* to the HSS. * to the HSS.
*/ */
plmn_t visited_plmn_eur = {
.MCCdigit3 = 2,
.MCCdigit2 = 0,
.MCCdigit1 = 8,
.MNCdigit1 = 0,
.MNCdigit2 = 4,
.MNCdigit3 = 3,
};
/* Acquire the current time */ /* Acquire the current time */
time(&ue_context->cell_age); time(&ue_context->cell_age);
memcpy(&ue_context->guti.gummei.plmn, &visited_plmn_dongle, sizeof(plmn_t)); memcpy(&ue_context->guti.gummei.plmn, visited_plmn, sizeof(plmn_t));
MME_APP_DEBUG("and we have no auth. vector for it, request" MME_APP_DEBUG("and we have no auth. vector for it, request"
" authentication information\n"); " authentication information\n");
mme_app_request_authentication_info(imsi, 1, &visited_plmn_dongle, NULL); mme_app_request_authentication_info(imsi, 1, visited_plmn, NULL);
} else { } else {
memcpy(&ue_context->guti.gummei.plmn, &visited_plmn_dongle, sizeof(plmn_t)); memcpy(&ue_context->guti.gummei.plmn, visited_plmn, sizeof(plmn_t));
mme_app_request_authentication_info(imsi, 1, &visited_plmn_dongle, nas_auth_param_req_p->auts); mme_app_request_authentication_info(imsi, 1, visited_plmn, nas_auth_param_req_p->auts);
} }
} }
#endif #endif
...@@ -341,7 +341,7 @@ int mme_app_handle_create_sess_resp(SgwCreateSessionResponse *create_sess_resp_p ...@@ -341,7 +341,7 @@ int mme_app_handle_create_sess_resp(SgwCreateSessionResponse *create_sess_resp_p
memcpy(&NAS_BEARER_PARAM(message_p).ambr, &ue_context_p->subscribed_ambr, memcpy(&NAS_BEARER_PARAM(message_p).ambr, &ue_context_p->subscribed_ambr,
sizeof(ambr_t)); sizeof(ambr_t));
return itti_send_msg_to_task(TASK_NAS, INSTANCE_DEFAULT, message_p); return itti_send_msg_to_task(TASK_NAS_MME, INSTANCE_DEFAULT, message_p);
} }
return 0; return 0;
......
...@@ -40,7 +40,7 @@ static inline void mme_app_itti_auth_fail(uint32_t ue_id, nas_cause_t cause) ...@@ -40,7 +40,7 @@ static inline void mme_app_itti_auth_fail(uint32_t ue_id, nas_cause_t cause)
NAS_AUTHENTICATION_PARAM_FAIL(message_p).ue_id = ue_id; NAS_AUTHENTICATION_PARAM_FAIL(message_p).ue_id = ue_id;
NAS_AUTHENTICATION_PARAM_FAIL(message_p).cause = cause; NAS_AUTHENTICATION_PARAM_FAIL(message_p).cause = cause;
itti_send_msg_to_task(TASK_NAS, INSTANCE_DEFAULT, message_p); itti_send_msg_to_task(TASK_NAS_MME, INSTANCE_DEFAULT, message_p);
} }
static inline void mme_app_itti_auth_rsp(uint32_t ue_id, uint8_t nb_vectors, static inline void mme_app_itti_auth_rsp(uint32_t ue_id, uint8_t nb_vectors,
...@@ -54,7 +54,7 @@ static inline void mme_app_itti_auth_rsp(uint32_t ue_id, uint8_t nb_vectors, ...@@ -54,7 +54,7 @@ static inline void mme_app_itti_auth_rsp(uint32_t ue_id, uint8_t nb_vectors,
NAS_AUTHENTICATION_PARAM_RSP(message_p).nb_vectors = nb_vectors; NAS_AUTHENTICATION_PARAM_RSP(message_p).nb_vectors = nb_vectors;
memcpy(&NAS_AUTHENTICATION_PARAM_RSP(message_p).vector, vector, sizeof(*vector)); memcpy(&NAS_AUTHENTICATION_PARAM_RSP(message_p).vector, vector, sizeof(*vector));
itti_send_msg_to_task(TASK_NAS, INSTANCE_DEFAULT, message_p); itti_send_msg_to_task(TASK_NAS_MME, INSTANCE_DEFAULT, message_p);
} }
#endif /* MME_APP_ITTI_MESSAGING_H_ */ #endif /* MME_APP_ITTI_MESSAGING_H_ */
...@@ -28,7 +28,7 @@ Description Defines the layer 3 messages supported by the NAS sublayer ...@@ -28,7 +28,7 @@ Description Defines the layer 3 messages supported by the NAS sublayer
#include <stdlib.h> // malloc, free #include <stdlib.h> // malloc, free
#include <string.h> // memcpy #include <string.h> // memcpy
#if (defined(EPC_BUILD) && defined(NAS_MME)) #if ((defined(EPC_BUILD) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(UE_BUILD) && defined(NAS_UE)))
# include "nas_itti_messaging.h" # include "nas_itti_messaging.h"
#endif #endif
...@@ -246,7 +246,7 @@ int nas_message_decode(const char* const buffer, nas_message_t* msg, int length) ...@@ -246,7 +246,7 @@ int nas_message_decode(const char* const buffer, nas_message_t* msg, int length)
/* Decode security protected NAS message */ /* Decode security protected NAS message */
bytes = _nas_message_protected_decode(buffer + size, &msg->header, bytes = _nas_message_protected_decode(buffer + size, &msg->header,
&msg->plain, length - size); &msg->plain, length - size);
#if defined(EPC_BUILD) && defined(NAS_MME) #if ((defined(EPC_BUILD) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(UE_BUILD) && defined(NAS_UE)))
/* Message has been decoded and security header removed, handle it has a plain message */ /* Message has been decoded and security header removed, handle it has a plain message */
nas_itti_plain_msg(buffer, msg, length, 0); nas_itti_plain_msg(buffer, msg, length, 0);
#endif #endif
...@@ -255,7 +255,7 @@ int nas_message_decode(const char* const buffer, nas_message_t* msg, int length) ...@@ -255,7 +255,7 @@ int nas_message_decode(const char* const buffer, nas_message_t* msg, int length)
/* Decode plain NAS message */ /* Decode plain NAS message */
bytes = _nas_message_plain_decode(buffer, &msg->header, bytes = _nas_message_plain_decode(buffer, &msg->header,
&msg->plain, length); &msg->plain, length);
#if defined(EPC_BUILD) && defined(NAS_MME) #if ((defined(EPC_BUILD) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(UE_BUILD) && defined(NAS_UE)))
nas_itti_plain_msg(buffer, msg, length, 0); nas_itti_plain_msg(buffer, msg, length, 0);
#endif #endif
} }
...@@ -313,7 +313,7 @@ int nas_message_encode(char* buffer, const nas_message_t* const msg, int length) ...@@ -313,7 +313,7 @@ int nas_message_encode(char* buffer, const nas_message_t* const msg, int length)
/* Set the message authentication code of the NAS message */ /* Set the message authentication code of the NAS message */
*(UInt32_t*)(buffer + sizeof(UInt8_t)) = mac; *(UInt32_t*)(buffer + sizeof(UInt8_t)) = mac;
} }
#if defined(EPC_BUILD) && defined(NAS_MME) #if ((defined(EPC_BUILD) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(UE_BUILD) && defined(NAS_UE)))
nas_itti_protected_msg(buffer, msg, length, 1); nas_itti_protected_msg(buffer, msg, length, 1);
#endif #endif
} }
...@@ -321,7 +321,7 @@ int nas_message_encode(char* buffer, const nas_message_t* const msg, int length) ...@@ -321,7 +321,7 @@ int nas_message_encode(char* buffer, const nas_message_t* const msg, int length)
/* Encode plain NAS message */ /* Encode plain NAS message */
bytes = _nas_message_plain_encode(buffer, &msg->header, bytes = _nas_message_plain_encode(buffer, &msg->header,
&msg->plain, length); &msg->plain, length);
#if defined(EPC_BUILD) && defined(NAS_MME) #if ((defined(EPC_BUILD) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(UE_BUILD) && defined(NAS_UE)))
nas_itti_plain_msg(buffer, msg, length, 1); nas_itti_plain_msg(buffer, msg, length, 1);
#endif #endif
} }
......
...@@ -250,7 +250,7 @@ int nas_timer_start(long sec, nas_timer_callback_t cb, void *args) ...@@ -250,7 +250,7 @@ int nas_timer_start(long sec, nas_timer_callback_t cb, void *args)
_nas_timer_db_insert_entry(id, te); _nas_timer_db_insert_entry(id, te);
#if defined(ENABLE_ITTI) #if defined(ENABLE_ITTI)
# if defined(EPC_BUILD) # if defined(EPC_BUILD)
ret = timer_setup(sec, 0, TASK_NAS, INSTANCE_DEFAULT, TIMER_PERIODIC, args, &timer_id); ret = timer_setup(sec, 0, TASK_NAS_MME, INSTANCE_DEFAULT, TIMER_PERIODIC, args, &timer_id);
# else # else
ret = timer_setup(sec, 0, TASK_NAS_UE, INSTANCE_DEFAULT, TIMER_PERIODIC, args, &timer_id); ret = timer_setup(sec, 0, TASK_NAS_UE, INSTANCE_DEFAULT, TIMER_PERIODIC, args, &timer_id);
# endif # endif
......
...@@ -33,7 +33,15 @@ ...@@ -33,7 +33,15 @@
#include "intertask_interface.h" #include "intertask_interface.h"
#include "nas_itti_messaging.h" #include "nas_itti_messaging.h"
#if defined(EPC_BUILD) && defined(NAS_MME) #if ((defined(EPC_BUILD) && defined(NAS_MME)) || (defined(UE_BUILD) && defined(NAS_UE)))
# if (defined(EPC_BUILD) && defined(NAS_MME))
# define TASK_ORIGIN TASK_NAS_MME
# else
# define TASK_ORIGIN TASK_NAS_UE
# endif
#endif
#if ((defined(EPC_BUILD) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(UE_BUILD) && defined(NAS_UE)))
static const UInt8_t emm_message_ids[] = static const UInt8_t emm_message_ids[] =
{ {
ATTACH_REQUEST, ATTACH_REQUEST,
...@@ -108,103 +116,106 @@ static int _nas_find_message_index(const UInt8_t message_id, const UInt8_t *mess ...@@ -108,103 +116,106 @@ static int _nas_find_message_index(const UInt8_t message_id, const UInt8_t *mess
return (1); return (1);
} }
int nas_itti_dl_data_req(const uint32_t ue_id, void *const data, int nas_itti_plain_msg(const char* buffer, const nas_message_t* msg, const int length, const int down_link)
const uint32_t length)
{
MessageDef *message_p;
message_p = itti_alloc_new_message(TASK_NAS, NAS_DOWNLINK_DATA_REQ);
NAS_DL_DATA_REQ(message_p).UEid = ue_id;
NAS_DL_DATA_REQ(message_p).nasMsg.data = data;
NAS_DL_DATA_REQ(message_p).nasMsg.length = length;
return itti_send_msg_to_task(TASK_S1AP, INSTANCE_DEFAULT, message_p);
}
int nas_itti_plain_msg(const char* buffer, const nas_message_t* msg, const int length, const int instance)
{ {
MessageDef *message_p; MessageDef *message_p;
int data_length = length < NAS_DATA_LENGHT_MAX ? length : NAS_DATA_LENGHT_MAX; int data_length = length < NAS_DATA_LENGHT_MAX ? length : NAS_DATA_LENGHT_MAX;
{ {
message_p = itti_alloc_new_message(TASK_NAS, NAS_RAW_MSG); message_p = itti_alloc_new_message(TASK_ORIGIN, down_link ? NAS_DL_RAW_MSG : NAS_UL_RAW_MSG);
NAS_RAW_MSG(message_p).lenght = length; NAS_DL_RAW_MSG(message_p).lenght = length;
memset ((void *) &(NAS_RAW_MSG(message_p).data), 0, NAS_DATA_LENGHT_MAX); memset ((void *) &(NAS_DL_RAW_MSG(message_p).data), 0, NAS_DATA_LENGHT_MAX);
memcpy ((void *) &(NAS_RAW_MSG(message_p).data), buffer, data_length); memcpy ((void *) &(NAS_DL_RAW_MSG(message_p).data), buffer, data_length);
itti_send_msg_to_task(TASK_UNKNOWN, instance, message_p); itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
message_p = NULL; message_p = NULL;
} }
if (msg->header.protocol_discriminator == EPS_MOBILITY_MANAGEMENT_MESSAGE) if (msg->header.protocol_discriminator == EPS_MOBILITY_MANAGEMENT_MESSAGE)
{ {
message_p = itti_alloc_new_message(TASK_NAS, NAS_EMM_PLAIN_MSG); message_p = itti_alloc_new_message(TASK_ORIGIN, down_link ? NAS_DL_EMM_PLAIN_MSG : NAS_UL_EMM_PLAIN_MSG);
NAS_EMM_PLAIN_MSG(message_p).present = _nas_find_message_index(msg->plain.emm.header.message_type, emm_message_ids, sizeof(emm_message_ids) / sizeof(emm_message_ids[0])); NAS_DL_EMM_PLAIN_MSG(message_p).present = _nas_find_message_index(msg->plain.emm.header.message_type, emm_message_ids, sizeof(emm_message_ids) / sizeof(emm_message_ids[0]));
memcpy ((void *) &(NAS_EMM_PLAIN_MSG(message_p).choice), &msg->plain.emm, sizeof (EMM_msg)); memcpy ((void *) &(NAS_DL_EMM_PLAIN_MSG(message_p).choice), &msg->plain.emm, sizeof (EMM_msg));
} }
else { else {
if (msg->header.protocol_discriminator == EPS_SESSION_MANAGEMENT_MESSAGE) if (msg->header.protocol_discriminator == EPS_SESSION_MANAGEMENT_MESSAGE)
{ {
message_p = itti_alloc_new_message(TASK_NAS, NAS_ESM_PLAIN_MSG); message_p = itti_alloc_new_message(TASK_ORIGIN, down_link ? NAS_DL_ESM_PLAIN_MSG : NAS_UL_ESM_PLAIN_MSG);
NAS_ESM_PLAIN_MSG(message_p).present = _nas_find_message_index(msg->plain.esm.header.message_type, esm_message_ids, sizeof(esm_message_ids) / sizeof(esm_message_ids[0])); NAS_DL_ESM_PLAIN_MSG(message_p).present = _nas_find_message_index(msg->plain.esm.header.message_type, esm_message_ids, sizeof(esm_message_ids) / sizeof(esm_message_ids[0]));
memcpy ((void *) &(NAS_ESM_PLAIN_MSG(message_p).choice), &msg->plain.emm, sizeof (ESM_msg)); memcpy ((void *) &(NAS_DL_ESM_PLAIN_MSG(message_p).choice), &msg->plain.emm, sizeof (ESM_msg));
} }
} }
if (message_p != NULL) { if (message_p != NULL) {
return itti_send_msg_to_task(TASK_UNKNOWN, instance, message_p); return itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
} }
return EXIT_FAILURE; return EXIT_FAILURE;
} }
int nas_itti_protected_msg(const char* buffer, const nas_message_t* msg, const int length, const int instance) int nas_itti_protected_msg(const char* buffer, const nas_message_t* msg, const int length, const int down_link)
{ {
MessageDef *message_p; MessageDef *message_p;
int data_length = length < NAS_DATA_LENGHT_MAX ? length : NAS_DATA_LENGHT_MAX; int data_length = length < NAS_DATA_LENGHT_MAX ? length : NAS_DATA_LENGHT_MAX;
{ {
message_p = itti_alloc_new_message(TASK_NAS, NAS_RAW_MSG); message_p = itti_alloc_new_message(TASK_ORIGIN, down_link ? NAS_DL_RAW_MSG : NAS_UL_RAW_MSG);
NAS_RAW_MSG(message_p).lenght = length; NAS_DL_RAW_MSG(message_p).lenght = length;
memset ((void *) &(NAS_RAW_MSG(message_p).data), 0, NAS_DATA_LENGHT_MAX); memset ((void *) &(NAS_DL_RAW_MSG(message_p).data), 0, NAS_DATA_LENGHT_MAX);
memcpy ((void *) &(NAS_RAW_MSG(message_p).data), buffer, data_length); memcpy ((void *) &(NAS_DL_RAW_MSG(message_p).data), buffer, data_length);
itti_send_msg_to_task(TASK_UNKNOWN, instance, message_p); itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
message_p = NULL; message_p = NULL;
} }
if (msg->header.protocol_discriminator == EPS_MOBILITY_MANAGEMENT_MESSAGE) if (msg->header.protocol_discriminator == EPS_MOBILITY_MANAGEMENT_MESSAGE)
{ {
message_p = itti_alloc_new_message(TASK_NAS, NAS_EMM_PROTECTED_MSG); message_p = itti_alloc_new_message(TASK_ORIGIN, down_link ? NAS_DL_EMM_PROTECTED_MSG : NAS_UL_EMM_PROTECTED_MSG);
memcpy ((void *) &(NAS_EMM_PROTECTED_MSG(message_p).header), &msg->header, sizeof (nas_message_security_header_t)); memcpy ((void *) &(NAS_DL_EMM_PROTECTED_MSG(message_p).header), &msg->header, sizeof (nas_message_security_header_t));
NAS_EMM_PROTECTED_MSG(message_p).present = _nas_find_message_index(msg->security_protected.plain.emm.header.message_type, emm_message_ids, sizeof(emm_message_ids) / sizeof(emm_message_ids[0])); NAS_DL_EMM_PROTECTED_MSG(message_p).present = _nas_find_message_index(msg->security_protected.plain.emm.header.message_type, emm_message_ids, sizeof(emm_message_ids) / sizeof(emm_message_ids[0]));
memcpy ((void *) &(NAS_EMM_PROTECTED_MSG(message_p).choice), &msg->security_protected.plain.emm, sizeof (EMM_msg)); memcpy ((void *) &(NAS_DL_EMM_PROTECTED_MSG(message_p).choice), &msg->security_protected.plain.emm, sizeof (EMM_msg));
} }
else { else {
if (msg->header.protocol_discriminator == EPS_SESSION_MANAGEMENT_MESSAGE) if (msg->header.protocol_discriminator == EPS_SESSION_MANAGEMENT_MESSAGE)
{ {
message_p = itti_alloc_new_message(TASK_NAS, NAS_ESM_PROTECTED_MSG); message_p = itti_alloc_new_message(TASK_ORIGIN, down_link ? NAS_DL_ESM_PROTECTED_MSG : NAS_UL_ESM_PROTECTED_MSG);
memcpy ((void *) &(NAS_ESM_PROTECTED_MSG(message_p).header), &msg->header, sizeof (nas_message_security_header_t)); memcpy ((void *) &(NAS_DL_ESM_PROTECTED_MSG(message_p).header), &msg->header, sizeof (nas_message_security_header_t));
NAS_ESM_PROTECTED_MSG(message_p).present = _nas_find_message_index(msg->security_protected.plain.esm.header.message_type, esm_message_ids, sizeof(esm_message_ids) / sizeof(esm_message_ids[0])); NAS_DL_ESM_PROTECTED_MSG(message_p).present = _nas_find_message_index(msg->security_protected.plain.esm.header.message_type, esm_message_ids, sizeof(esm_message_ids) / sizeof(esm_message_ids[0]));
memcpy ((void *) &(NAS_ESM_PROTECTED_MSG(message_p).choice), &msg->security_protected.plain.esm, sizeof (ESM_msg)); memcpy ((void *) &(NAS_DL_ESM_PROTECTED_MSG(message_p).choice), &msg->security_protected.plain.esm, sizeof (ESM_msg));
} }
} }
if (message_p != NULL) { if (message_p != NULL) {
return itti_send_msg_to_task(TASK_UNKNOWN, instance, message_p); return itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
} }
return EXIT_FAILURE; return EXIT_FAILURE;
} }
#endif #endif
#if defined(EPC_BUILD) && defined(NAS_MME)
int nas_itti_dl_data_req(const uint32_t ue_id, void *const data,
const uint32_t length)
{
MessageDef *message_p;
message_p = itti_alloc_new_message(TASK_NAS_MME, NAS_DOWNLINK_DATA_REQ);
NAS_DL_DATA_REQ(message_p).UEid = ue_id;
NAS_DL_DATA_REQ(message_p).nasMsg.data = data;
NAS_DL_DATA_REQ(message_p).nasMsg.length = length;
return itti_send_msg_to_task(TASK_S1AP, INSTANCE_DEFAULT, message_p);
}
#endif
#if defined(UE_BUILD) && defined(NAS_UE) #if defined(UE_BUILD) && defined(NAS_UE)
extern unsigned char NB_eNB_INST; extern unsigned char NB_eNB_INST;
......
...@@ -37,23 +37,25 @@ ...@@ -37,23 +37,25 @@
#ifndef NAS_ITTI_MESSAGING_H_ #ifndef NAS_ITTI_MESSAGING_H_
#define NAS_ITTI_MESSAGING_H_ #define NAS_ITTI_MESSAGING_H_
# if ((defined(EPC_BUILD) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(UE_BUILD) && defined(NAS_UE)))
int nas_itti_plain_msg(const char* buffer, const nas_message_t* msg, const int length, const int instance);
int nas_itti_protected_msg(const char* buffer, const nas_message_t* msg, const int length, const int instance);
# endif
# if defined(EPC_BUILD) && defined(NAS_MME) # if defined(EPC_BUILD) && defined(NAS_MME)
#include "conversions.h" #include "conversions.h"
int nas_itti_dl_data_req(const uint32_t ue_id, void *const data, int nas_itti_dl_data_req(const uint32_t ue_id, void *const data,
const uint32_t length); const uint32_t length);
int nas_itti_plain_msg(const char* buffer, const nas_message_t* msg, const int length, const int instance);
int nas_itti_protected_msg(const char* buffer, const nas_message_t* msg, const int length, const int instance);
static inline void nas_itti_establish_cnf(const uint32_t ue_id, static inline void nas_itti_establish_cnf(const uint32_t ue_id,
const nas_error_code_t error_code, void *const data, const nas_error_code_t error_code, void *const data,
const uint32_t length) const uint32_t length)
{ {
MessageDef *message_p; MessageDef *message_p;
message_p = itti_alloc_new_message(TASK_NAS, NAS_CONNECTION_ESTABLISHMENT_CNF); message_p = itti_alloc_new_message(TASK_NAS_MME, NAS_CONNECTION_ESTABLISHMENT_CNF);
NAS_CONNECTION_ESTABLISHMENT_CNF(message_p).UEid = ue_id; NAS_CONNECTION_ESTABLISHMENT_CNF(message_p).UEid = ue_id;
NAS_CONNECTION_ESTABLISHMENT_CNF(message_p).errCode = error_code; NAS_CONNECTION_ESTABLISHMENT_CNF(message_p).errCode = error_code;
...@@ -68,7 +70,7 @@ static inline void nas_itti_auth_info_req(const uint32_t ue_id, ...@@ -68,7 +70,7 @@ static inline void nas_itti_auth_info_req(const uint32_t ue_id,
{ {
MessageDef *message_p; MessageDef *message_p;
message_p = itti_alloc_new_message(TASK_NAS, NAS_AUTHENTICATION_PARAM_REQ); message_p = itti_alloc_new_message(TASK_NAS_MME, NAS_AUTHENTICATION_PARAM_REQ);
hexa_to_ascii((uint8_t *)imsi->u.value, hexa_to_ascii((uint8_t *)imsi->u.value,
NAS_AUTHENTICATION_PARAM_REQ(message_p).imsi, 8); NAS_AUTHENTICATION_PARAM_REQ(message_p).imsi, 8);
...@@ -101,7 +103,7 @@ static inline void nas_itti_establish_rej(const uint32_t ue_id, ...@@ -101,7 +103,7 @@ static inline void nas_itti_establish_rej(const uint32_t ue_id,
{ {
MessageDef *message_p; MessageDef *message_p;
message_p = itti_alloc_new_message(TASK_NAS, NAS_AUTHENTICATION_PARAM_REQ); message_p = itti_alloc_new_message(TASK_NAS_MME, NAS_AUTHENTICATION_PARAM_REQ);
hexa_to_ascii((uint8_t *)imsi->u.value, hexa_to_ascii((uint8_t *)imsi->u.value,
NAS_AUTHENTICATION_PARAM_REQ(message_p).imsi, 8); NAS_AUTHENTICATION_PARAM_REQ(message_p).imsi, 8);
......
...@@ -53,13 +53,13 @@ ...@@ -53,13 +53,13 @@
static void *nas_intertask_interface(void *args_p) static void *nas_intertask_interface(void *args_p)
{ {
itti_mark_task_ready(TASK_NAS); itti_mark_task_ready(TASK_NAS_MME);
while(1) { while(1) {
MessageDef *received_message_p; MessageDef *received_message_p;
next_message: next_message:
itti_receive_msg(TASK_NAS, &received_message_p); itti_receive_msg(TASK_NAS_MME, &received_message_p);
switch (ITTI_MSG_ID(received_message_p)) switch (ITTI_MSG_ID(received_message_p))
{ {
...@@ -71,7 +71,7 @@ next_message: ...@@ -71,7 +71,7 @@ next_message:
NAS_DEBUG("NAS abstraction: Generating NAS ATTACH REQ\n"); NAS_DEBUG("NAS abstraction: Generating NAS ATTACH REQ\n");
message_p = itti_alloc_new_message(TASK_NAS, NAS_ATTACH_REQ); message_p = itti_alloc_new_message(TASK_NAS_MME, NAS_ATTACH_REQ);
nas_req_p = &message_p->ittiMsg.nas_attach_req; nas_req_p = &message_p->ittiMsg.nas_attach_req;
transparent = &message_p->ittiMsg.nas_attach_req.transparent; transparent = &message_p->ittiMsg.nas_attach_req.transparent;
...@@ -107,7 +107,7 @@ next_message: ...@@ -107,7 +107,7 @@ next_message:
NAS_DEBUG("NAS abstraction: Generating NAS AUTHENTICATION RESPONSE\n"); NAS_DEBUG("NAS abstraction: Generating NAS AUTHENTICATION RESPONSE\n");
message_p = itti_alloc_new_message(TASK_NAS, NAS_AUTHENTICATION_RESP); message_p = itti_alloc_new_message(TASK_NAS_MME, NAS_AUTHENTICATION_RESP);
nas_resp_p = &message_p->ittiMsg.nas_auth_resp; nas_resp_p = &message_p->ittiMsg.nas_auth_resp;
...@@ -180,11 +180,11 @@ int nas_init(mme_config_t *mme_config_p) ...@@ -180,11 +180,11 @@ int nas_init(mme_config_t *mme_config_p)
NAS_DEBUG("Initializing NAS task interface\n"); NAS_DEBUG("Initializing NAS task interface\n");
#if !defined(DISABLE_USE_NAS) #if !defined(DISABLE_USE_NAS)
nas_log_init(0x2F); nas_log_init(0xfF);
nas_network_initialize(mme_config_p); nas_network_initialize(mme_config_p);
#endif #endif
if (itti_create_task(TASK_NAS, &nas_intertask_interface, if (itti_create_task(TASK_NAS_MME, &nas_intertask_interface,
NULL) < 0) { NULL) < 0) {
NAS_ERROR("Create task failed"); NAS_ERROR("Create task failed");
NAS_DEBUG("Initializing NAS task interface: FAILED\n"); NAS_DEBUG("Initializing NAS task interface: FAILED\n");
......
...@@ -734,7 +734,7 @@ int s1ap_handle_sctp_deconnection(uint32_t assoc_id) ...@@ -734,7 +734,7 @@ int s1ap_handle_sctp_deconnection(uint32_t assoc_id)
if (current_ue_index == 0 && handled_ues > 0) { if (current_ue_index == 0 && handled_ues > 0) {
S1AP_ENB_DEREGISTERED_IND(message_p).nb_ue_to_deregister = S1AP_ITTI_UE_PER_DEREGISTER_MESSAGE; S1AP_ENB_DEREGISTERED_IND(message_p).nb_ue_to_deregister = S1AP_ITTI_UE_PER_DEREGISTER_MESSAGE;
itti_send_msg_to_task(TASK_NAS, INSTANCE_DEFAULT, message_p); itti_send_msg_to_task(TASK_NAS_MME, INSTANCE_DEFAULT, message_p);
} }
handled_ues++; handled_ues++;
...@@ -746,7 +746,7 @@ int s1ap_handle_sctp_deconnection(uint32_t assoc_id) ...@@ -746,7 +746,7 @@ int s1ap_handle_sctp_deconnection(uint32_t assoc_id)
for (i = current_ue_index; i < S1AP_ITTI_UE_PER_DEREGISTER_MESSAGE; i++) { for (i = current_ue_index; i < S1AP_ITTI_UE_PER_DEREGISTER_MESSAGE; i++) {
S1AP_ENB_DEREGISTERED_IND(message_p).mme_ue_s1ap_id[current_ue_index] = 0; S1AP_ENB_DEREGISTERED_IND(message_p).mme_ue_s1ap_id[current_ue_index] = 0;
} }
itti_send_msg_to_task(TASK_NAS, INSTANCE_DEFAULT, message_p); itti_send_msg_to_task(TASK_NAS_MME, INSTANCE_DEFAULT, message_p);
} }
s1ap_remove_eNB(eNB_association); s1ap_remove_eNB(eNB_association);
......
...@@ -56,7 +56,7 @@ int s1ap_mme_itti_nas_uplink_ind(const uint32_t ue_id, uint8_t * const buffer, ...@@ -56,7 +56,7 @@ int s1ap_mme_itti_nas_uplink_ind(const uint32_t ue_id, uint8_t * const buffer,
NAS_UL_DATA_IND(message_p).nasMsg.data = buffer; NAS_UL_DATA_IND(message_p).nasMsg.data = buffer;
NAS_UL_DATA_IND(message_p).nasMsg.length = length; NAS_UL_DATA_IND(message_p).nasMsg.length = length;
return itti_send_msg_to_task(TASK_NAS, INSTANCE_DEFAULT, message_p); return itti_send_msg_to_task(TASK_NAS_MME, INSTANCE_DEFAULT, message_p);
} }
int s1ap_mme_itti_nas_downlink_cnf(const uint32_t ue_id, int s1ap_mme_itti_nas_downlink_cnf(const uint32_t ue_id,
...@@ -69,5 +69,5 @@ int s1ap_mme_itti_nas_downlink_cnf(const uint32_t ue_id, ...@@ -69,5 +69,5 @@ int s1ap_mme_itti_nas_downlink_cnf(const uint32_t ue_id,
NAS_DL_DATA_CNF(message_p).UEid = ue_id; NAS_DL_DATA_CNF(message_p).UEid = ue_id;
NAS_DL_DATA_CNF(message_p).errCode = error_code; NAS_DL_DATA_CNF(message_p).errCode = error_code;
return itti_send_msg_to_task(TASK_NAS, INSTANCE_DEFAULT, message_p); return itti_send_msg_to_task(TASK_NAS_MME, INSTANCE_DEFAULT, message_p);
} }
...@@ -62,7 +62,7 @@ static inline void s1ap_mme_itti_nas_establish_ind( ...@@ -62,7 +62,7 @@ static inline void s1ap_mme_itti_nas_establish_ind(
NAS_CONN_EST_IND(message_p).nas.initialNasMsg.data = malloc(sizeof(uint8_t) * nas_msg_length); NAS_CONN_EST_IND(message_p).nas.initialNasMsg.data = malloc(sizeof(uint8_t) * nas_msg_length);
memcpy(NAS_CONN_EST_IND(message_p).nas.initialNasMsg.data, nas_msg, nas_msg_length); memcpy(NAS_CONN_EST_IND(message_p).nas.initialNasMsg.data, nas_msg, nas_msg_length);
itti_send_msg_to_task(TASK_NAS, INSTANCE_DEFAULT, message_p); itti_send_msg_to_task(TASK_NAS_MME, INSTANCE_DEFAULT, message_p);
} }
#endif /* S1AP_MME_ITTI_MESSAGING_H_ */ #endif /* S1AP_MME_ITTI_MESSAGING_H_ */
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