From bce6aaa34e31d5b17ac895c22136a50ce9a23cfa Mon Sep 17 00:00:00 2001 From: winckel <winckel@eurecom.fr> Date: Wed, 11 Dec 2013 15:57:41 +0000 Subject: [PATCH] Added transmission of NAS UE message to RRC for AS_CELL_INFO_REQ and AS_NAS_ESTABLISH_REQ. git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4670 818b1a75-f10b-46b9-bf7c-635c3b92a50f --- .../NAS/EURECOM-NAS/src/emm/sap/emm_as.c | 41 ++++++++++++++++++- openair-cn/NAS/Makefile.UE | 2 + openair-cn/NAS/nas_itti_messaging.c | 32 +++++++++++++++ openair-cn/NAS/nas_itti_messaging.h | 14 +++++-- openair-cn/NAS/nas_ue_task.c | 2 +- 5 files changed, 86 insertions(+), 5 deletions(-) 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 0f9f0129e89..393fec2714f 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 2405efe6eeb..795669f1430 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 ddf3bbe04b5..f9eef51b16e 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 7f6dba899de..0a1061d7c76 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 7444fb45ad3..44c544c4326 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)) { -- GitLab