diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_as.c b/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_as.c index 0f9f0129e8982c30c0f6194426701e542379438c..393fec2714f7a9694ee0bb34ef752d43fbf410fe 100644 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_as.c +++ b/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_as.c @@ -36,7 +36,7 @@ Description Defines the EMMAS Service Access Point that provides #include <string.h> // memset #include <stdlib.h> // malloc, free -#if defined(EPC_BUILD) && defined(NAS_MME) +#if (defined(EPC_BUILD) && defined(NAS_MME)) || (defined(UE_BUILD) && defined(NAS_UE)) # include "nas_itti_messaging.h" #endif @@ -1107,10 +1107,49 @@ static int _emm_as_send(const emm_as_t *msg) break; } #else +# if defined(UE_BUILD) && defined(NAS_UE) + LOG_TRACE(DEBUG, "EMMAS-SAP - " + "Sending msg with id 0x%x, primitive %s (%d) to RRC layer for transmission", + as_msg.msgID, + _emm_as_primitive_str[msg->primitive - _EMMAS_START - 1], + msg->primitive); + + switch (as_msg.msgID) { + case AS_CELL_INFO_REQ: { + nas_itti_cell_info_req(as_msg.msg.cell_info_req.plmnID, + as_msg.msg.cell_info_req.rat); + LOG_FUNC_RETURN (RETURNok); + } break; + + case AS_NAS_ESTABLISH_REQ: { + nas_itti_nas_establish_req(as_msg.msg.nas_establish_req.cause, + as_msg.msg.nas_establish_req.type, + as_msg.msg.nas_establish_req.s_tmsi, + as_msg.msg.nas_establish_req.plmnID, + as_msg.msg.nas_establish_req.initialNasMsg.data, + as_msg.msg.nas_establish_req.initialNasMsg.length); + LOG_FUNC_RETURN (RETURNok); + } break; + + case AS_UL_INFO_TRANSFER_REQ: { + + LOG_FUNC_RETURN (RETURNok); + } break; + + case AS_RAB_ESTABLISH_RSP: { + + LOG_FUNC_RETURN (RETURNok); + } break; + + default: + break; + } +# else int bytes = as_message_send(&as_msg); if (bytes > 0) { LOG_FUNC_RETURN (RETURNok); } +# endif #endif } LOG_FUNC_RETURN (RETURNerror); diff --git a/openair-cn/NAS/Makefile.UE b/openair-cn/NAS/Makefile.UE index 2405efe6eeb6bfd936fcc61066d07a229cf1f0f4..795669f143083416deb904087712043f9435bc07 100644 --- a/openair-cn/NAS/Makefile.UE +++ b/openair-cn/NAS/Makefile.UE @@ -4,6 +4,7 @@ include $(UE_NAS_DIR)/EURECOM-NAS/Makefile.inc libnas_INCLUDES = \ -I$(OPENAIR2_DIR) \ + -I$(UE_NAS_DIR) \ -I$(SRCDIR) \ -I$(INCDIR) \ -I$(UTILDIR) \ @@ -249,6 +250,7 @@ libnas_usim_OBJS = \ libnas_OBJS = \ nas_ue_task.o \ + nas_itti_messaging.o \ EURECOM-NAS/src/nas_parser.o \ EURECOM-NAS/src/nas_proc.o \ EURECOM-NAS/src/nas_user.o \ diff --git a/openair-cn/NAS/nas_itti_messaging.c b/openair-cn/NAS/nas_itti_messaging.c index ddf3bbe04b5c5612a3c1c99b395a0e4182c2ea34..f9eef51b16ed13122b820744a5a6898090fde690 100644 --- a/openair-cn/NAS/nas_itti_messaging.c +++ b/openair-cn/NAS/nas_itti_messaging.c @@ -33,6 +33,7 @@ #include "intertask_interface.h" #include "nas_itti_messaging.h" +#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) { @@ -60,3 +61,34 @@ void nas_itti_establish_cnf(const nas_error_code_t error_code, void *const data, itti_send_msg_to_task(TASK_S1AP, INSTANCE_DEFAULT, message_p); } +#endif + +#if defined(UE_BUILD) && defined(NAS_UE) +int nas_itti_cell_info_req(const plmn_t plmnID, const Byte_t rat) +{ + MessageDef *message_p; + + message_p = itti_alloc_new_message(TASK_NAS_UE, NAS_CELL_SELECTION_REQ); + + NAS_CELL_SELECTION_REQ(message_p).plmnID = plmnID; + NAS_CELL_SELECTION_REQ(message_p).rat = rat; + + return itti_send_msg_to_task(TASK_RRC_UE, INSTANCE_DEFAULT, message_p); +} + +int nas_itti_nas_establish_req(as_cause_t cause, as_call_type_t type, as_stmsi_t s_tmsi, plmn_t plmnID, Byte_t *data, UInt32_t length) +{ + MessageDef *message_p; + + message_p = itti_alloc_new_message(TASK_NAS_UE, NAS_CONN_ESTABLI_REQ); + + NAS_CONN_ESTABLI_REQ(message_p).cause = cause; + NAS_CONN_ESTABLI_REQ(message_p).type = type; + NAS_CONN_ESTABLI_REQ(message_p).s_tmsi = s_tmsi; + NAS_CONN_ESTABLI_REQ(message_p).plmnID = plmnID; + NAS_CONN_ESTABLI_REQ(message_p).initialNasMsg.data = data; + NAS_CONN_ESTABLI_REQ(message_p).initialNasMsg.length = length; + + itti_send_msg_to_task(TASK_RRC_UE, INSTANCE_DEFAULT, message_p); +} +#endif diff --git a/openair-cn/NAS/nas_itti_messaging.h b/openair-cn/NAS/nas_itti_messaging.h index 7f6dba899de0d96672be1ccba5ef1e741ea0d19d..0a1061d7c76ebfd2c08859a9a44c8b3856c3f847 100644 --- a/openair-cn/NAS/nas_itti_messaging.h +++ b/openair-cn/NAS/nas_itti_messaging.h @@ -27,14 +27,16 @@ 06410 Biot FRANCE *******************************************************************************/ +#ifndef NAS_ITTI_MESSAGING_H_ +#define NAS_ITTI_MESSAGING_H_ + #include <stdint.h> #include <ctype.h> #include "intertask_interface.h" -#include "conversions.h" -#ifndef NAS_ITTI_MESSAGING_H_ -#define NAS_ITTI_MESSAGING_H_ +# if defined(EPC_BUILD) && defined(NAS_MME) +#include "conversions.h" int nas_itti_dl_data_req(const uint32_t ue_id, void *const data, const uint32_t length); @@ -89,5 +91,11 @@ static inline void nas_itti_establish_rej(const uint32_t ue_id, itti_send_msg_to_task(TASK_MME_APP, INSTANCE_DEFAULT, message_p); } +# endif + +# if defined(UE_BUILD) && defined(NAS_UE) +int nas_itti_cell_info_req(const plmn_t plmnID, const Byte_t rat); +int nas_itti_nas_establish_req(as_cause_t cause, as_call_type_t type, as_stmsi_t s_tmsi, plmn_t plmnID, Byte_t *data, UInt32_t length); +# endif #endif /* NAS_ITTI_MESSAGING_H_ */ diff --git a/openair-cn/NAS/nas_ue_task.c b/openair-cn/NAS/nas_ue_task.c index 7444fb45ad31df0dd27664152a112a235d7a8c3c..44c544c432688ef962af625ae1cf8709e26de4b4 100644 --- a/openair-cn/NAS/nas_ue_task.c +++ b/openair-cn/NAS/nas_ue_task.c @@ -128,7 +128,7 @@ void *nas_ue_task(void *args_p) { itti_free (ITTI_MSG_ORIGIN_ID(msg_p), msg_p); msg_p = NULL; - } + } nb_events = itti_get_events(TASK_NAS_UE, &events); if ((nb_events > 0) && (events != NULL)) {