From e9e6e77f13c67c4a34166fb639182dfb88d67b87 Mon Sep 17 00:00:00 2001 From: Lionel Gauthier <lionel.gauthier@eurecom.fr> Date: Fri, 10 Jan 2014 17:29:55 +0000 Subject: [PATCH] Updates, less bugs git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4850 818b1a75-f10b-46b9-bf7c-635c3b92a50f --- .../LTE_RAL_UE/INCLUDE/lteRALue_constants.h | 4 +- .../LTE_RAL_UE/INCLUDE/lteRALue_mih_msg.h | 33 ++- .../LTE_RAL_UE/INCLUDE/lteRALue_rrc_msg.h | 1 + .../RAL-LTE/LTE_RAL_UE/SRC/lteRALue_action.c | 59 +++-- .../RAL-LTE/LTE_RAL_UE/SRC/lteRALue_main.c | 86 ++++--- .../RAL-LTE/LTE_RAL_UE/SRC/lteRALue_mih_msg.c | 236 +++++++++--------- .../RAL-LTE/LTE_RAL_UE/SRC/lteRALue_process.c | 1 + .../RAL-LTE/LTE_RAL_UE/SRC/lteRALue_rrc_msg.c | 195 ++++++++------- .../LTE_RAL_UE/SRC/lteRALue_subscribe.c | 18 +- .../LTE_RAL_UE/SRC/lteRALue_thresholds.c | 60 ++++- 10 files changed, 393 insertions(+), 300 deletions(-) diff --git a/openair3/RAL-LTE/LTE_RAL_UE/INCLUDE/lteRALue_constants.h b/openair3/RAL-LTE/LTE_RAL_UE/INCLUDE/lteRALue_constants.h index e913ce6a85b..afdb6083b08 100755 --- a/openair3/RAL-LTE/LTE_RAL_UE/INCLUDE/lteRALue_constants.h +++ b/openair3/RAL-LTE/LTE_RAL_UE/INCLUDE/lteRALue_constants.h @@ -47,10 +47,12 @@ #define DEFAULT_ADDRESS_3GPP "0335060080149150" #define DEFAULT_ADDRESS_eNB "0000000000000001" +#define USE_3GPP_ADDR_AS_LINK_ADDR 1 //----------------------------------------------------------------------------- // Constants for scenario +#define PREDEFINED_MIH_PLMN_ID 503 #define PREDEFINED_MIH_NETWORK_ID "eurecom" -#define PREDEFINED_MIH_NETAUX_ID "netaux" +#define PREDEFINED_MIH_NETAUX_ID "netaux" #define PREDEFINED_CHANNEL_ID 2 #define PREDEFINED_CLASSES_SERVICE_SUPPORTED 2 diff --git a/openair3/RAL-LTE/LTE_RAL_UE/INCLUDE/lteRALue_mih_msg.h b/openair3/RAL-LTE/LTE_RAL_UE/INCLUDE/lteRALue_mih_msg.h index 5f46ded969e..66397c07187 100755 --- a/openair3/RAL-LTE/LTE_RAL_UE/INCLUDE/lteRALue_mih_msg.h +++ b/openair3/RAL-LTE/LTE_RAL_UE/INCLUDE/lteRALue_mih_msg.h @@ -62,16 +62,22 @@ public_mRAL_mih_msg( int mRAL_send_to_mih(ral_ue_instance_t instanceP, u_int8_t *bufferP, size_t lenP);) protected_mRAL_mih_msg( int mRAL_mihf_connect (ral_ue_instance_t instanceP);) + +protected_mRAL_mih_msg( void MIH_C_3GPP_ADDR_load_3gpp_str_address(ral_ue_instance_t instanceP, \ + MIH_C_3GPP_ADDR_T* _3gpp_addrP, \ + u_int8_t* strP);) + protected_mRAL_mih_msg( void mRAL_send_link_register_indication (\ - ral_ue_instance_t instanceP,\ + ral_ue_instance_t instanceP,\ MIH_C_TRANSACTION_ID_T *transaction_idP);) + protected_mRAL_mih_msg( void mRAL_send_link_detected_indication (\ - ral_ue_instance_t instanceP,\ + ral_ue_instance_t instanceP,\ MIH_C_TRANSACTION_ID_T *transaction_idP,\ MIH_C_LINK_DET_INFO_T *link_detected_infoP);) protected_mRAL_mih_msg( void mRAL_send_link_up_indication(\ - ral_ue_instance_t instanceP,\ + ral_ue_instance_t instanceP,\ MIH_C_TRANSACTION_ID_T *transaction_idP,\ MIH_C_LINK_TUPLE_ID_T *link_identifierP,\ MIH_C_LINK_ADDR_T *old_access_routerP,\ @@ -80,59 +86,59 @@ protected_mRAL_mih_msg( void mRAL_send_link_up_indication(\ MIH_C_IP_MOB_MGMT_T *mobility_management_supportP);) protected_mRAL_mih_msg( void mRAL_send_link_parameters_report_indication(\ - ral_ue_instance_t instanceP,\ + ral_ue_instance_t instanceP,\ MIH_C_TRANSACTION_ID_T *transaction_idP,\ MIH_C_LINK_TUPLE_ID_T *link_identifierP,\ MIH_C_LINK_PARAM_RPT_LIST_T *link_parameters_report_listP);) protected_mRAL_mih_msg( void mRAL_send_link_going_down_indication(\ - ral_ue_instance_t instanceP,\ + ral_ue_instance_t instanceP,\ MIH_C_TRANSACTION_ID_T *transaction_idP,\ MIH_C_LINK_TUPLE_ID_T *link_identifierP,\ MIH_C_UNSIGNED_INT2_T *time_intervalP,\ MIH_C_LINK_GD_REASON_T *link_going_down_reasonP);) protected_mRAL_mih_msg( void mRAL_send_link_down_indication(\ - ral_ue_instance_t instanceP,\ + ral_ue_instance_t instanceP,\ MIH_C_TRANSACTION_ID_T *transaction_idP,\ MIH_C_LINK_TUPLE_ID_T *link_identifierP,\ MIH_C_LINK_ADDR_T *old_access_routerP,\ MIH_C_LINK_DN_REASON_T *reason_codeP);) protected_mRAL_mih_msg( void mRAL_send_link_action_confirm(\ - ral_ue_instance_t instanceP,\ + ral_ue_instance_t instanceP,\ MIH_C_TRANSACTION_ID_T *transaction_idP,\ MIH_C_STATUS_T *statusP,\ MIH_C_LINK_SCAN_RSP_LIST_T *scan_response_setP,\ MIH_C_LINK_AC_RESULT_T *link_action_resultP);) protected_mRAL_mih_msg( void mRAL_send_capability_discover_confirm(\ - ral_ue_instance_t instanceP,\ + ral_ue_instance_t instanceP,\ MIH_C_TRANSACTION_ID_T *transaction_idP,\ MIH_C_STATUS_T *statusP,\ MIH_C_LINK_EVENT_LIST_T *supported_link_event_listP,\ MIH_C_LINK_CMD_LIST_T *supported_link_command_listP);) protected_mRAL_mih_msg( void mRAL_send_event_subscribe_confirm (\ - ral_ue_instance_t instanceP,\ + ral_ue_instance_t instanceP,\ MIH_C_TRANSACTION_ID_T *transaction_idP,\ MIH_C_STATUS_T *statusP,\ MIH_C_LINK_EVENT_LIST_T *response_link_event_listP);) protected_mRAL_mih_msg( void mRAL_send_event_unsubscribe_confirm (\ - ral_ue_instance_t instanceP,\ + ral_ue_instance_t instanceP,\ MIH_C_TRANSACTION_ID_T *transaction_idP,\ MIH_C_STATUS_T *statusP,\ MIH_C_LINK_EVENT_LIST_T *response_link_event_listP);) protected_mRAL_mih_msg( void mRAL_send_configure_thresholds_confirm(\ - ral_ue_instance_t instanceP,\ - MIH_C_TRANSACTION_ID_T *transaction_idP,\ + ral_ue_instance_t instanceP,\ + MIH_C_TRANSACTION_ID_T *transaction_idP,\ MIH_C_STATUS_T *statusP,\ MIH_C_LINK_CFG_STATUS_LIST_T *link_configure_status_listP);) protected_mRAL_mih_msg( void mRAL_send_get_parameters_confirm (\ - ral_ue_instance_t instanceP,\ + ral_ue_instance_t instanceP,\ MIH_C_TRANSACTION_ID_T *transaction_idP,\ MIH_C_STATUS_T *statusP,\ MIH_C_LINK_PARAM_LIST_T *link_parameters_status_listP,\ @@ -142,5 +148,6 @@ protected_mRAL_mih_msg( void mRAL_send_get_parameters_confirm (\ private_mRAL_mih_msg( int mRAL_mih_link_msg_decode (\ ral_ue_instance_t instanceP,\ Bit_Buffer_t* bbP, MIH_C_Message_Wrapper_t *message_wrapperP);) + protected_mRAL_mih_msg( int mRAL_mih_link_process_message (ral_ue_instance_t instanceP);) #endif diff --git a/openair3/RAL-LTE/LTE_RAL_UE/INCLUDE/lteRALue_rrc_msg.h b/openair3/RAL-LTE/LTE_RAL_UE/INCLUDE/lteRALue_rrc_msg.h index cfb69245704..63014776a34 100755 --- a/openair3/RAL-LTE/LTE_RAL_UE/INCLUDE/lteRALue_rrc_msg.h +++ b/openair3/RAL-LTE/LTE_RAL_UE/INCLUDE/lteRALue_rrc_msg.h @@ -58,6 +58,7 @@ #include "lteRALue.h" #include "intertask_interface.h" +protected_lteralue_rrc_msg(void mRAL_rx_rrc_ral_scan_confirm (instance_t instance, MessageDef *msg_p);) protected_lteralue_rrc_msg(void mRAL_rx_rrc_ral_system_information_indication (instance_t instance, MessageDef *msg_p);) protected_lteralue_rrc_msg(void mRAL_rx_rrc_ral_connection_establishment_indication (instance_t instance, MessageDef *msg_p);) protected_lteralue_rrc_msg(void mRAL_rx_rrc_ral_connection_reestablishment_indication (instance_t instance, MessageDef *msg_p);) diff --git a/openair3/RAL-LTE/LTE_RAL_UE/SRC/lteRALue_action.c b/openair3/RAL-LTE/LTE_RAL_UE/SRC/lteRALue_action.c index 8f043a62d08..3de006face5 100755 --- a/openair3/RAL-LTE/LTE_RAL_UE/SRC/lteRALue_action.c +++ b/openair3/RAL-LTE/LTE_RAL_UE/SRC/lteRALue_action.c @@ -38,6 +38,7 @@ #define LTERALUE_ACTION_C //----------------------------------------------------------------------------- #include "lteRALue.h" +#include "LAYER2/MAC/extern.h" //----------------------------------------------------------------------------- void mRAL_action_request(ral_ue_instance_t instanceP, MIH_C_Message_Link_Action_request_t* messageP) { @@ -47,20 +48,26 @@ void mRAL_action_request(ral_ue_instance_t instanceP, MIH_C_Message_Link_Action_ MIH_C_LINK_AC_RESULT_T link_action_result; //unsigned int scan_index, meas_to_send; MessageDef *message_p = NULL; - rrc_ral_scan_req_t scan_req; rrc_ral_connection_release_req_t release_req; rrc_ral_connection_establishment_req_t connection_establishment_req; + unsigned int mod_id = instanceP - NB_eNB_INST; status = MIH_C_STATUS_SUCCESS; link_action_result = MIH_C_LINK_AC_RESULT_SUCCESS; scan_response_set_list.length = 0; if ( messageP->primitive.LinkAction.link_ac_attr & MIH_C_BIT_LINK_AC_ATTR_LINK_SCAN) { + //---------------------------------------------------- + // send a response to MIH-F or it will report an error. + //---------------------------------------------------- + //link_action_result = MIH_C_LINK_AC_RESULT_SUCCESS; + //mRAL_send_link_action_confirm(instanceP, &messageP->header.transaction_id, &status, &scan_response_set_list, &link_action_result); + + //---------------------------------------------------- + // Transmit request to RRC. + //---------------------------------------------------- message_p = itti_alloc_new_message (TASK_RAL_UE, RRC_RAL_SCAN_REQ); - memset(&scan_req, 0, sizeof(rrc_ral_scan_req_t)); - // copy transaction id - scan_req.transaction_id = messageP->header.transaction_id; - memcpy (&message_p->ittiMsg, (void *) &scan_req, sizeof(rrc_ral_scan_req_t)); + RRC_RAL_SCAN_REQ(message_p).transaction_id = messageP->header.transaction_id; itti_send_msg_to_task (TASK_RRC_UE, instanceP, message_p); } if ( messageP->primitive.LinkAction.link_ac_attr & MIH_C_BIT_LINK_AC_ATTR_LINK_RES_RETAIN) { @@ -88,7 +95,7 @@ void mRAL_action_request(ral_ue_instance_t instanceP, MIH_C_Message_Link_Action_ case MIH_C_LINK_AC_TYPE_LINK_DISCONNECT: LOG_D(RAL_UE, "%s ACTION REQUESTED: MIH_C_LINK_AC_TYPE_LINK_DISCONNECT: NO ACTION\n", __FUNCTION__); - if (g_ue_ral_obj[instanceP].mih_supported_action_list & MIH_C_LINK_AC_TYPE_LINK_DISCONNECT) { + if (g_ue_ral_obj[mod_id].mih_supported_action_list & MIH_C_LINK_AC_TYPE_LINK_DISCONNECT) { message_p = itti_alloc_new_message (TASK_RAL_UE, RRC_RAL_CONNECTION_RELEASE_REQ); memset(&release_req, 0, sizeof(rrc_ral_connection_release_req_t)); // copy transaction id @@ -103,7 +110,7 @@ void mRAL_action_request(ral_ue_instance_t instanceP, MIH_C_Message_Link_Action_ case MIH_C_LINK_AC_TYPE_LINK_LOW_POWER: LOG_D(RAL_UE, "%s ACTION REQUESTED: MIH_C_LINK_AC_TYPE_LINK_LOW_POWER\n", __FUNCTION__); - if (g_ue_ral_obj[instanceP].mih_supported_action_list & MIH_C_LINK_AC_TYPE_LINK_LOW_POWER) { + if (g_ue_ral_obj[mod_id].mih_supported_action_list & MIH_C_LINK_AC_TYPE_LINK_LOW_POWER) { // TO DO } else { link_action_result = MIH_C_LINK_AC_RESULT_INCAPABLE; @@ -113,13 +120,13 @@ void mRAL_action_request(ral_ue_instance_t instanceP, MIH_C_Message_Link_Action_ case MIH_C_LINK_AC_TYPE_LINK_POWER_DOWN: LOG_D(RAL_UE, "%s ACTION REQUESTED: MIH_C_LINK_AC_TYPE_LINK_POWER_DOWN\n", __FUNCTION__); - if (g_ue_ral_obj[instanceP].mih_supported_action_list & MIH_C_LINK_AC_TYPE_LINK_POWER_DOWN) { - if ( g_ue_ral_obj[instanceP].pending_req_action & MIH_C_LINK_AC_TYPE_LINK_POWER_DOWN ) { - if (g_ue_ral_obj[instanceP].state == DISCONNECTED) { + if (g_ue_ral_obj[mod_id].mih_supported_action_list & MIH_C_LINK_AC_TYPE_LINK_POWER_DOWN) { + if ( g_ue_ral_obj[mod_id].pending_req_action & MIH_C_LINK_AC_TYPE_LINK_POWER_DOWN ) { + if (g_ue_ral_obj[mod_id].state == DISCONNECTED) { LOG_D(RAL_UE, "Deactivation requested, but interface already inactive ==> NO OP\n"); mRAL_send_link_action_confirm(instanceP, &messageP->header.transaction_id, &status, &scan_response_set_list, &link_action_result); } else { - g_ue_ral_obj[instanceP].pending_req_action = g_ue_ral_obj[instanceP].pending_req_action | MIH_C_LINK_AC_TYPE_LINK_POWER_DOWN; + g_ue_ral_obj[mod_id].pending_req_action = g_ue_ral_obj[mod_id].pending_req_action | MIH_C_LINK_AC_TYPE_LINK_POWER_DOWN; //Send immediatly a confirm, otherwise it will arrive to late and MIH-F will report a failure to the MIH-USER mRAL_send_link_action_confirm(instanceP, &messageP->header.transaction_id, &status, NULL, &link_action_result); @@ -130,11 +137,11 @@ void mRAL_action_request(ral_ue_instance_t instanceP, MIH_C_Message_Link_Action_ memcpy (&message_p->ittiMsg, (void *) &release_req, sizeof(rrc_ral_connection_release_req_t)); itti_send_msg_to_task (TASK_RRC_UE, instanceP, message_p); LOG_D(RAL_UE, "Deactivation requested to NAS interface\n"); -//RAL_process_NAS_message(IO_OBJ_CNX, IO_CMD_DEL, g_ue_ral_obj[instanceP].cell_id); +//RAL_process_NAS_message(IO_OBJ_CNX, IO_CMD_DEL, g_ue_ral_obj[mod_id].cell_id); } } else { - g_ue_ral_obj[instanceP].pending_req_action |= MIH_C_LINK_AC_TYPE_LINK_POWER_DOWN; + g_ue_ral_obj[mod_id].pending_req_action |= MIH_C_LINK_AC_TYPE_LINK_POWER_DOWN; //Send immediatly a confirm, otherwise it will arrive to late and MIH-F will report a failure to the MIH-USER mRAL_send_link_action_confirm(instanceP, &messageP->header.transaction_id, &status, NULL, &link_action_result); @@ -145,7 +152,7 @@ void mRAL_action_request(ral_ue_instance_t instanceP, MIH_C_Message_Link_Action_ memcpy (&message_p->ittiMsg, (void *) &release_req, sizeof(rrc_ral_connection_release_req_t)); itti_send_msg_to_task (TASK_RRC_UE, instanceP, message_p); LOG_D(RAL_UE, "Deactivation requested to NAS interface\n"); -//RAL_process_NAS_message(IO_OBJ_CNX, IO_CMD_DEL, g_ue_ral_obj[instanceP].cell_id); +//RAL_process_NAS_message(IO_OBJ_CNX, IO_CMD_DEL, g_ue_ral_obj[mod_id].cell_id); } } else { LOG_D(RAL_UE, " command POWER DOWN not available \n\n"); @@ -156,21 +163,21 @@ void mRAL_action_request(ral_ue_instance_t instanceP, MIH_C_Message_Link_Action_ case MIH_C_LINK_AC_TYPE_LINK_POWER_UP: LOG_D(RAL_UE, "%s ACTION REQUESTED: MIH_C_LINK_AC_TYPE_LINK_POWER_UP\n", __FUNCTION__); - if (g_ue_ral_obj[instanceP].mih_supported_action_list & MIH_C_LINK_AC_TYPE_LINK_POWER_UP) { + if (g_ue_ral_obj[mod_id].mih_supported_action_list & MIH_C_LINK_AC_TYPE_LINK_POWER_UP) { // Activation requested - check it is not already active - if(g_ue_ral_obj[instanceP].pending_req_action & MIH_C_LINK_AC_TYPE_LINK_POWER_UP) { - if (g_ue_ral_obj[instanceP].state == CONNECTED) { + if(g_ue_ral_obj[mod_id].pending_req_action & MIH_C_LINK_AC_TYPE_LINK_POWER_UP) { + if (g_ue_ral_obj[mod_id].state == CONNECTED) { LOG_D(RAL_UE, "Activation requested, but interface already active ==> NO OP\n"); mRAL_send_link_action_confirm(instanceP, &messageP->header.transaction_id, &status, &scan_response_set_list, &link_action_result); } else { - g_ue_ral_obj[instanceP].pending_req_action = g_ue_ral_obj[instanceP].pending_req_action | MIH_C_LINK_AC_TYPE_LINK_POWER_UP; - g_ue_ral_obj[instanceP].cell_id = g_ue_ral_obj[instanceP].meas_cell_id[0]; // Default cell #0 - Next, choose cell with best conditions - LOG_D(RAL_UE, "Activation requested to NAS interface on cell %d\n", g_ue_ral_obj[instanceP].cell_id); -//RAL_process_NAS_message(IO_OBJ_CNX, IO_CMD_ADD, g_ue_ral_obj[instanceP].cell_id); + g_ue_ral_obj[mod_id].pending_req_action = g_ue_ral_obj[mod_id].pending_req_action | MIH_C_LINK_AC_TYPE_LINK_POWER_UP; + g_ue_ral_obj[mod_id].cell_id = g_ue_ral_obj[mod_id].meas_cell_id[0]; // Default cell #0 - Next, choose cell with best conditions + LOG_D(RAL_UE, "Activation requested to NAS interface on cell %d\n", g_ue_ral_obj[mod_id].cell_id); +//RAL_process_NAS_message(IO_OBJ_CNX, IO_CMD_ADD, g_ue_ral_obj[mod_id].cell_id); } } else { - g_ue_ral_obj[instanceP].pending_req_action |= MIH_C_LINK_AC_TYPE_LINK_POWER_UP; - g_ue_ral_obj[instanceP].cell_id = g_ue_ral_obj[instanceP].meas_cell_id[0]; // Default cell #0 - Next, choose cell with best conditions + g_ue_ral_obj[mod_id].pending_req_action |= MIH_C_LINK_AC_TYPE_LINK_POWER_UP; + g_ue_ral_obj[mod_id].cell_id = g_ue_ral_obj[mod_id].meas_cell_id[0]; // Default cell #0 - Next, choose cell with best conditions message_p = itti_alloc_new_message (TASK_RAL_UE, RRC_RAL_CONNECTION_ESTABLISHMENT_REQ); memset(&connection_establishment_req, 0, sizeof(rrc_ral_connection_establishment_req_t)); // copy transaction id @@ -187,7 +194,7 @@ void mRAL_action_request(ral_ue_instance_t instanceP, MIH_C_Message_Link_Action_ /* LG KEEP case MIH_C_LINK_AC_TYPE_LINK_FLOW_ATTR: LOG_D(RAL_UE, "%s ACTION REQUESTED: MIH_C_LINK_AC_TYPE_LINK_FLOW_ATTR: NO ACTION\n", __FUNCTION__); - if (g_ue_ral_obj[instanceP].mih_supported_action_list & MIH_C_LINK_AC_TYPE_LINK_FLOW_ATTR) { + if (g_ue_ral_obj[mod_id].mih_supported_action_list & MIH_C_LINK_AC_TYPE_LINK_FLOW_ATTR) { } else { link_action_result = MIH_C_LINK_AC_RESULT_INCAPABLE; mRAL_send_link_action_confirm(instanceP, &messageP->header.transaction_id, &status, &scan_response_set_list, &link_action_result); @@ -196,7 +203,7 @@ void mRAL_action_request(ral_ue_instance_t instanceP, MIH_C_Message_Link_Action_ case MIH_C_LINK_AC_TYPE_LINK_ACTIVATE_RESOURCES: LOG_D(RAL_UE, "%s ACTION REQUESTED: MIH_C_LINK_AC_TYPE_LINK_ACTIVATE_RESOURCES: NO ACTION\n", __FUNCTION__); - if (g_ue_ral_obj[instanceP].mih_supported_action_list & MIH_C_LINK_AC_TYPE_LINK_ACTIVATE_RESOURCES) { + if (g_ue_ral_obj[mod_id].mih_supported_action_list & MIH_C_LINK_AC_TYPE_LINK_ACTIVATE_RESOURCES) { } else { link_action_result = MIH_C_LINK_AC_RESULT_INCAPABLE; mRAL_send_link_action_confirm(instanceP, &messageP->header.transaction_id, &status, &scan_response_set_list, &link_action_result); @@ -205,7 +212,7 @@ void mRAL_action_request(ral_ue_instance_t instanceP, MIH_C_Message_Link_Action_ case MIH_C_LINK_AC_TYPE_LINK_DEACTIVATE_RESOURCES: LOG_D(RAL_UE, "%s ACTION REQUESTED: MIH_C_LINK_AC_TYPE_LINK_DEACTIVATE_RESOURCES: NO ACTION\n", __FUNCTION__); - if (g_ue_ral_obj[instanceP].mih_supported_action_list & MIH_C_LINK_AC_TYPE_LINK_DEACTIVATE_RESOURCES) { + if (g_ue_ral_obj[mod_id].mih_supported_action_list & MIH_C_LINK_AC_TYPE_LINK_DEACTIVATE_RESOURCES) { } else { link_action_result = MIH_C_LINK_AC_RESULT_INCAPABLE; mRAL_send_link_action_confirm(instanceP, &messageP->header.transaction_id, &status, &scan_response_set_list, &link_action_result); diff --git a/openair3/RAL-LTE/LTE_RAL_UE/SRC/lteRALue_main.c b/openair3/RAL-LTE/LTE_RAL_UE/SRC/lteRALue_main.c index b5dc629349e..ddb7eeca2cf 100755 --- a/openair3/RAL-LTE/LTE_RAL_UE/SRC/lteRALue_main.c +++ b/openair3/RAL-LTE/LTE_RAL_UE/SRC/lteRALue_main.c @@ -46,10 +46,13 @@ #include <time.h> //----------------------------------------------------------------------------- #include "lteRALue.h" +#include "LAYER2/MAC/extern.h" #include "intertask_interface.h" #include "OCG.h" //----------------------------------------------------------------------------- +extern unsigned char NB_eNB_INST; +extern unsigned char NB_UE_INST; extern OAI_Emulation oai_emulation; @@ -156,7 +159,11 @@ void mRAL_get_IPv6_addr(void) { } } -void mRAL_init_default_values(void) { + +//--------------------------------------------------------------------------- +void mRAL_init_default_values(void) +//--------------------------------------------------------------------------- +{ g_conf_ue_ral_listening_port = UE_DEFAULT_LOCAL_PORT_RAL; g_conf_ue_ral_ip_address = UE_DEFAULT_IP_ADDRESS_RAL; g_conf_ue_ral_link_id = UE_DEFAULT_LINK_ID_RAL; @@ -170,6 +177,7 @@ void mRAL_init_default_values(void) { int mRAL_initialize(void) { //--------------------------------------------------------------------------- ral_ue_instance_t instance = 0; + unsigned int mod_id = 0; char *char_tmp = NULL; MIH_C_init(); @@ -180,34 +188,36 @@ int mRAL_initialize(void) { g_ue_ral_fd2instance = hashtable_create (32, NULL, hash_free_int_func); - for (instance = 0; instance < oai_emulation.info.nb_ue_local; instance++) { - char_tmp = calloc(1, strlen(g_conf_ue_ral_listening_port) + 3); // 2 digits + \0 ->99 instances - sprintf(char_tmp,"%d", atoi(g_conf_ue_ral_listening_port) + instance); - g_ue_ral_obj[instance].ral_listening_port = char_tmp; + for (mod_id = 0; mod_id < oai_emulation.info.nb_ue_local; mod_id++) { + + instance = mod_id + NB_eNB_INST; + char_tmp = calloc(1, strlen(g_conf_ue_ral_listening_port) + 3); // 2 digits + \0 ->99 mod_ids + sprintf(char_tmp,"%d", atoi(g_conf_ue_ral_listening_port) + mod_id); + g_ue_ral_obj[mod_id].ral_listening_port = char_tmp; - g_ue_ral_obj[instance].ral_ip_address = strdup(g_conf_ue_ral_ip_address); - g_ue_ral_obj[instance].ral_link_address = strdup(g_conf_ue_ral_link_address); + g_ue_ral_obj[mod_id].ral_ip_address = strdup(g_conf_ue_ral_ip_address); + g_ue_ral_obj[mod_id].ral_link_address = strdup(g_conf_ue_ral_link_address); - char_tmp = calloc(1, strlen(g_conf_ue_mihf_remote_port) + 3); // 2 digits + \0 ->99 instances - sprintf(char_tmp, "%d", atoi(g_conf_ue_mihf_remote_port) + instance); - g_ue_ral_obj[instance].mihf_remote_port = char_tmp; + char_tmp = calloc(1, strlen(g_conf_ue_mihf_remote_port) + 3); // 2 digits + \0 ->99 mod_ids + sprintf(char_tmp, "%d", atoi(g_conf_ue_mihf_remote_port) + mod_id); + g_ue_ral_obj[mod_id].mihf_remote_port = char_tmp; - g_ue_ral_obj[instance].mihf_ip_address = strdup(g_conf_ue_mihf_ip_address); + g_ue_ral_obj[mod_id].mihf_ip_address = strdup(g_conf_ue_mihf_ip_address); - char_tmp = calloc(1, strlen(g_conf_ue_mihf_id) + 3); // 2 digits + \0 ->99 instances - sprintf(char_tmp, "%s%02d",g_conf_ue_mihf_id, instance); - g_ue_ral_obj[instance].mihf_id = char_tmp; + char_tmp = calloc(1, strlen(g_conf_ue_mihf_id) + 3); // 2 digits + \0 ->99 mod_ids + sprintf(char_tmp, "%s%02d",g_conf_ue_mihf_id, mod_id); + g_ue_ral_obj[mod_id].mihf_id = char_tmp; - char_tmp = calloc(1, strlen(g_conf_ue_ral_link_id) + 3); // 2 digits + \0 ->99 instances - sprintf(char_tmp, "%s%02d",g_conf_ue_ral_link_id, instance); - g_ue_ral_obj[instance].link_id = char_tmp; + char_tmp = calloc(1, strlen(g_conf_ue_ral_link_id) + 3); // 2 digits + \0 ->99 mod_ids + sprintf(char_tmp, "%s%02d",g_conf_ue_ral_link_id, mod_id); + g_ue_ral_obj[mod_id].link_id = char_tmp; char_tmp = NULL; - printf("g_ue_ral_obj[%d].link_id=%s\n", instance, g_ue_ral_obj[instance].link_id); + printf("g_ue_ral_obj[%d].link_id=%s\n", mod_id, g_ue_ral_obj[mod_id].link_id); // excluded MIH_C_LINK_AC_TYPE_NONE // excluded MIH_C_LINK_AC_TYPE_LINK_LOW_POWER - g_ue_ral_obj[instance].mih_supported_action_list = MIH_C_LINK_AC_TYPE_LINK_DISCONNECT | + g_ue_ral_obj[mod_id].mih_supported_action_list = MIH_C_LINK_AC_TYPE_LINK_DISCONNECT | MIH_C_LINK_AC_TYPE_LINK_POWER_DOWN | MIH_C_LINK_AC_TYPE_LINK_POWER_UP | MIH_C_LINK_AC_TYPE_LINK_FLOW_ATTR | @@ -216,7 +226,7 @@ int mRAL_initialize(void) { - g_ue_ral_obj[instance].mih_supported_link_event_list = MIH_C_BIT_LINK_DETECTED | + g_ue_ral_obj[mod_id].mih_supported_link_event_list = MIH_C_BIT_LINK_DETECTED | MIH_C_BIT_LINK_UP | MIH_C_BIT_LINK_DOWN | MIH_C_BIT_LINK_PARAMETERS_REPORT | @@ -225,33 +235,33 @@ int mRAL_initialize(void) { MIH_C_BIT_LINK_HANDOVER_COMPLETE | MIH_C_BIT_LINK_PDU_TRANSMIT_STATUS; - g_ue_ral_obj[instance].mih_supported_link_command_list = MIH_C_BIT_LINK_EVENT_SUBSCRIBE | MIH_C_BIT_LINK_EVENT_UNSUBSCRIBE | + g_ue_ral_obj[mod_id].mih_supported_link_command_list = MIH_C_BIT_LINK_EVENT_SUBSCRIBE | MIH_C_BIT_LINK_EVENT_UNSUBSCRIBE | MIH_C_BIT_LINK_GET_PARAMETERS | MIH_C_BIT_LINK_CONFIGURE_THRESHOLDS | MIH_C_BIT_LINK_ACTION; - g_ue_ral_obj[instance].link_to_be_detected = MIH_C_BOOLEAN_TRUE; + g_ue_ral_obj[mod_id].link_to_be_detected = MIH_C_BOOLEAN_TRUE; - g_ue_ral_obj[instance].link_mihcap_flag = MIH_C_BIT_EVENT_SERVICE_SUPPORTED | MIH_C_BIT_COMMAND_SERVICE_SUPPORTED | MIH_C_BIT_INFORMATION_SERVICE_SUPPORTED; + g_ue_ral_obj[mod_id].link_mihcap_flag = MIH_C_BIT_EVENT_SERVICE_SUPPORTED | MIH_C_BIT_COMMAND_SERVICE_SUPPORTED | MIH_C_BIT_INFORMATION_SERVICE_SUPPORTED; - g_ue_ral_obj[instance].net_caps = MIH_C_BIT_NET_CAPS_QOS_CLASS5 | MIH_C_BIT_NET_CAPS_INTERNET_ACCESS | MIH_C_BIT_NET_CAPS_MIH_CAPABILITY; + g_ue_ral_obj[mod_id].net_caps = MIH_C_BIT_NET_CAPS_QOS_CLASS5 | MIH_C_BIT_NET_CAPS_INTERNET_ACCESS | MIH_C_BIT_NET_CAPS_MIH_CAPABILITY; - g_ue_ral_obj[instance].transaction_id = (MIH_C_TRANSACTION_ID_T)rand(); + g_ue_ral_obj[mod_id].transaction_id = (MIH_C_TRANSACTION_ID_T)rand(); - LOG_D(RAL_UE, " Connect to the MIH-F for instance %d...\n", instance); - g_ue_ral_obj[instance].mih_sock_desc = -1; + LOG_D(RAL_UE, " Connect to the MIH-F for module id instance %d...\n", mod_id, instance); + g_ue_ral_obj[mod_id].mih_sock_desc = -1; if (mRAL_mihf_connect(instance) < 0 ) { LOG_E(RAL_UE, " %s : Could not connect to MIH-F...\n", __FUNCTION__); // TO DO RETRY LATER //exit(-1); } else { - itti_subscribe_event_fd(TASK_RAL_UE, g_ue_ral_obj[instance].mih_sock_desc); - hashtable_insert(g_ue_ral_fd2instance, g_ue_ral_obj[instance].mih_sock_desc, (void*)instance); + itti_subscribe_event_fd(TASK_RAL_UE, g_ue_ral_obj[mod_id].mih_sock_desc); + hashtable_insert(g_ue_ral_fd2instance, g_ue_ral_obj[mod_id].mih_sock_desc, (void*)instance); } - mRAL_send_link_register_indication(instance, &g_ue_ral_obj[instance].transaction_id); + mRAL_send_link_register_indication(instance, &g_ue_ral_obj[mod_id].transaction_id); } return 0; } @@ -259,7 +269,7 @@ int mRAL_initialize(void) { void mRAL_process_file_descriptors(struct epoll_event *events, int nb_events) { int i; - ral_ue_instance_t instance; + ral_ue_instance_t instance; hashtable_rc_t rc; if (events == NULL) { @@ -286,6 +296,15 @@ void* mRAL_task(void *args_p) { itti_mark_task_ready (TASK_RAL_UE); + // Set UE activation state + for (instance = NB_eNB_INST; instance < (NB_eNB_INST + NB_UE_INST); instance++) + { + MessageDef *message_p; + + message_p = itti_alloc_new_message(TASK_RAL_UE, DEACTIVATE_MESSAGE); + itti_send_msg_to_task(TASK_L2L1, instance, message_p); + } + while(1) { // Wait for a message itti_receive_msg (TASK_RAL_UE, &msg_p); @@ -305,6 +324,11 @@ void* mRAL_task(void *args_p) { LOG_D(RAL_UE, "Received %s\n", msg_name); break; + case RRC_RAL_SCAN_CONF: + LOG_D(RAL_UE, "Received %s\n", msg_name); + mRAL_rx_rrc_ral_scan_confirm(instance, msg_p); + break; + case RRC_RAL_SYSTEM_INFORMATION_IND: LOG_D(RAL_UE, "Received %s\n", msg_name); mRAL_rx_rrc_ral_system_information_indication(instance, msg_p); diff --git a/openair3/RAL-LTE/LTE_RAL_UE/SRC/lteRALue_mih_msg.c b/openair3/RAL-LTE/LTE_RAL_UE/SRC/lteRALue_mih_msg.c index 5e7a50003e2..46e1e6dc63d 100755 --- a/openair3/RAL-LTE/LTE_RAL_UE/SRC/lteRALue_mih_msg.c +++ b/openair3/RAL-LTE/LTE_RAL_UE/SRC/lteRALue_mih_msg.c @@ -38,6 +38,7 @@ #define LTERALUE_MIH_MSG_C //----------------------------------------------------------------------------- #include "lteRALue.h" +#include "LAYER2/MAC/extern.h" //----------------------------------------------------------------------------- #define MSG_CODEC_RECV_BUFFER_SIZE 16400 #define MSG_CODEC_SEND_BUFFER_SIZE 16400 @@ -57,7 +58,8 @@ static char g_msg_codec_print_buffer[8192] = {}; int mRAL_send_to_mih(ral_ue_instance_t instanceP, u_int8_t *bufferP, size_t lenP) { //----------------------------------------------------------------------------- int result; - result = send(g_ue_ral_obj[instanceP].mih_sock_desc, (const void *)bufferP, lenP, 0); + unsigned int mod_id = instanceP - NB_eNB_INST; + result = send(g_ue_ral_obj[mod_id].mih_sock_desc, (const void *)bufferP, lenP, 0); if (result != lenP) { LOG_E(RAL_UE, "send_to_mih %d bytes failed, returned %d: %s\n", lenP, result, strerror(errno)); } @@ -67,10 +69,11 @@ int mRAL_send_to_mih(ral_ue_instance_t instanceP, u_int8_t *bufferP, size_t len //--------------------------------------------------------------------------- int mRAL_mihf_connect(ral_ue_instance_t instanceP){ //--------------------------------------------------------------------------- - struct addrinfo info; /* endpoint information */ + struct addrinfo info; /* endpoint information */ struct addrinfo *addr, *rp; /* endpoint address */ - int rc; /* returned error code */ - int optval; /* socket option value */ + int rc; /* returned error code */ + int optval; /* socket option value */ + unsigned int mod_id = instanceP - NB_eNB_INST; unsigned char buf[sizeof(struct sockaddr_in6)]; @@ -83,7 +86,7 @@ int mRAL_mihf_connect(ral_ue_instance_t instanceP){ info.ai_flags = 0; info.ai_protocol = 0; /* Any protocol */ - rc = getaddrinfo(g_ue_ral_obj[instanceP].mihf_ip_address, g_ue_ral_obj[instanceP].mihf_remote_port, &info, &addr); + rc = getaddrinfo(g_ue_ral_obj[mod_id].mihf_ip_address, g_ue_ral_obj[mod_id].mihf_remote_port, &info, &addr); if (rc != 0) { LOG_E(RAL_UE, " getaddrinfo: %s\n", gai_strerror(rc)); return -1; @@ -96,13 +99,13 @@ int mRAL_mihf_connect(ral_ue_instance_t instanceP){ */ for (rp = addr; rp != NULL; rp = rp->ai_next) { - g_ue_ral_obj[instanceP].mih_sock_desc = socket(rp->ai_family, rp->ai_socktype, rp->ai_protocol); - if (g_ue_ral_obj[instanceP].mih_sock_desc < 0) { + g_ue_ral_obj[mod_id].mih_sock_desc = socket(rp->ai_family, rp->ai_socktype, rp->ai_protocol); + if (g_ue_ral_obj[mod_id].mih_sock_desc < 0) { continue; } optval = 1; - setsockopt(g_ue_ral_obj[instanceP].mih_sock_desc, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof(optval)); + setsockopt(g_ue_ral_obj[mod_id].mih_sock_desc, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof(optval)); /* * Convert the RAL local network address @@ -111,55 +114,55 @@ int mRAL_mihf_connect(ral_ue_instance_t instanceP){ /* IPv4 network address family */ struct sockaddr_in *addr4 = NULL; - LOG_D(RAL_UE, " %s is an ipv4 address\n", g_ue_ral_obj[instanceP].mihf_ip_address); + LOG_D(RAL_UE, " %s is an ipv4 address\n", g_ue_ral_obj[mod_id].mihf_ip_address); addr4 = (struct sockaddr_in *)(&buf[0]); - addr4->sin_port = htons(atoi(g_ue_ral_obj[instanceP].ral_listening_port)); + addr4->sin_port = htons(atoi(g_ue_ral_obj[mod_id].ral_listening_port)); addr4->sin_family = AF_INET; - rc = inet_pton(AF_INET, g_ue_ral_obj[instanceP].ral_ip_address, &addr4->sin_addr); + rc = inet_pton(AF_INET, g_ue_ral_obj[mod_id].ral_ip_address, &addr4->sin_addr); } else if (rp->ai_family == AF_INET6) { /* IPv6 network address family */ struct sockaddr_in6 *addr6 = NULL; - LOG_D(RAL_UE, " %s is an ipv6 address\n", g_ue_ral_obj[instanceP].mihf_ip_address); + LOG_D(RAL_UE, " %s is an ipv6 address\n", g_ue_ral_obj[mod_id].mihf_ip_address); addr6 = (struct sockaddr_in6 *)(&buf[0]); - addr6->sin6_port = htons(atoi(g_ue_ral_obj[instanceP].ral_listening_port)); + addr6->sin6_port = htons(atoi(g_ue_ral_obj[mod_id].ral_listening_port)); addr6->sin6_family = AF_INET6; - rc = inet_pton(AF_INET, g_ue_ral_obj[instanceP].ral_ip_address, &addr6->sin6_addr); + rc = inet_pton(AF_INET, g_ue_ral_obj[mod_id].ral_ip_address, &addr6->sin6_addr); } else { LOG_E(RAL_UE, " %s is an unknown address format %d\n", - g_ue_ral_obj[instanceP].mihf_ip_address, rp->ai_family); + g_ue_ral_obj[mod_id].mihf_ip_address, rp->ai_family); return -1; } if (rc < 0) { /* The network address convertion failed */ LOG_E(RAL_UE, " inet_pton(RAL IP address %s): %s\n", - g_ue_ral_obj[instanceP].ral_ip_address, strerror(rc)); + g_ue_ral_obj[mod_id].ral_ip_address, strerror(rc)); return -1; } else if (rc == 0) { /* The network address is not valid */ - LOG_E(RAL_UE, " RAL IP address %s is not valid\n", g_ue_ral_obj[instanceP].ral_ip_address); + LOG_E(RAL_UE, " RAL IP address %s is not valid\n", g_ue_ral_obj[mod_id].ral_ip_address); return -1; } /* Bind the socket to the local RAL network address */ - rc = bind(g_ue_ral_obj[instanceP].mih_sock_desc, (const struct sockaddr *)buf, + rc = bind(g_ue_ral_obj[mod_id].mih_sock_desc, (const struct sockaddr *)buf, sizeof(struct sockaddr_in)); if (rc < 0) { LOG_E(RAL_UE, " bind(RAL IP address %s): %s\n", - g_ue_ral_obj[instanceP].ral_ip_address, strerror(errno)); + g_ue_ral_obj[mod_id].ral_ip_address, strerror(errno)); return -1; } /* Connect the socket to the remote MIH-F network address */ - if (connect(g_ue_ral_obj[instanceP].mih_sock_desc, rp->ai_addr, rp->ai_addrlen) == 0) { + if (connect(g_ue_ral_obj[mod_id].mih_sock_desc, rp->ai_addr, rp->ai_addrlen) == 0) { LOG_N(RAL_UE, " RAL [%s:%s] is now UDP-CONNECTED to MIH-F [%s:%s]\n", - g_ue_ral_obj[instanceP].ral_ip_address, g_ue_ral_obj[instanceP].ral_listening_port, - g_ue_ral_obj[instanceP].mihf_ip_address, g_ue_ral_obj[instanceP].mihf_remote_port); + g_ue_ral_obj[mod_id].ral_ip_address, g_ue_ral_obj[mod_id].ral_listening_port, + g_ue_ral_obj[mod_id].mihf_ip_address, g_ue_ral_obj[mod_id].mihf_remote_port); break; } /* @@ -167,7 +170,7 @@ int mRAL_mihf_connect(ral_ue_instance_t instanceP){ * Close the socket file descriptor and try to connect to an other * address. */ - close(g_ue_ral_obj[instanceP].mih_sock_desc); + close(g_ue_ral_obj[mod_id].mih_sock_desc); } /* @@ -183,6 +186,33 @@ int mRAL_mihf_connect(ral_ue_instance_t instanceP){ return 0; } + +//----------------------------------------------------------------------------- +void MIH_C_3GPP_ADDR_load_3gpp_str_address(ral_ue_instance_t instanceP, MIH_C_3GPP_ADDR_T* _3gpp_addrP, u_int8_t* strP) +//----------------------------------------------------------------------------- +{ + int i, l; + u_int8_t val_temp; + unsigned char address_3gpp[32]; + unsigned char buf[3]; + u_int8_t _3gpp_byte_address[8]; + + strcpy((char *)address_3gpp, (char *)strP); + for(l=0; l<8; l++) + { + i=l*2; + buf[0]= address_3gpp[i]; + buf[1]= address_3gpp[i+1]; + buf[2]= '\0'; + //sscanf((const char *)buf,"%02x", &val_temp); + sscanf((const char *)buf,"%hhx", &val_temp); + _3gpp_byte_address[l] = val_temp; + } + _3gpp_byte_address[7] += instanceP; + MIH_C_3GPP_ADDR_set(_3gpp_addrP, _3gpp_byte_address, 8); +} + + /*************************************************************************** Transmission side ***************************************************************************/ @@ -194,6 +224,7 @@ void mRAL_send_link_register_indication(ral_ue_instance_t instanceP, MIH_C_Message_Link_Register_indication_t message; Bit_Buffer_t *bb; int message_total_length; + unsigned int mod_id = instanceP - NB_eNB_INST; bb = new_BitBuffer_0(); BitBuffer_wrap(bb, g_msg_codec_send_buffer, (unsigned int)MSG_CODEC_SEND_BUFFER_SIZE); @@ -207,17 +238,21 @@ void mRAL_send_link_register_indication(ral_ue_instance_t instanceP, message.header.transaction_id = *transaction_idP; - MIH_C_MIHF_ID_set(&message.source, (u_int8_t*)g_ue_ral_obj[instanceP].link_id, strlen(g_ue_ral_obj[instanceP].link_id)); + MIH_C_MIHF_ID_set(&message.source, (u_int8_t*)g_ue_ral_obj[mod_id].link_id, strlen(g_ue_ral_obj[mod_id].link_id)); - MIH_C_MIHF_ID_set(&message.destination, (u_int8_t*)g_ue_ral_obj[instanceP].mihf_id, strlen(g_ue_ral_obj[instanceP].mihf_id)); + MIH_C_MIHF_ID_set(&message.destination, (u_int8_t*)g_ue_ral_obj[mod_id].mihf_id, strlen(g_ue_ral_obj[mod_id].mihf_id)); message.primitive.Link_Id.link_type = MIH_C_WIRELESS_LTE; //MIH_C_WIRELESS_UMTS; + #ifdef USE_3GPP_ADDR_AS_LINK_ADDR message.primitive.Link_Id.link_addr.choice = (MIH_C_CHOICE_T)MIH_C_CHOICE_3GPP_ADDR; - - MIH_C_3GPP_ADDR_set(&message.primitive.Link_Id.link_addr._union._3gpp_addr, (u_int8_t*)&(g_ue_ral_obj[instanceP].ipv6_l2id[0]), strlen(DEFAULT_ADDRESS_3GPP)); - //MIH_C_3GPP_ADDR_set(&message.primitive.Link_Id.link_addr._union._3gpp_addr, (u_int8_t*)DEFAULT_ADDRESS_3GPP, strlen(DEFAULT_ADDRESS_3GPP)); - //MIH_C_3GPP_ADDR_load_3gpp_str_address(&message.primitive.Link_Id.link_addr._union._3gpp_addr, (u_int8_t*)DEFAULT_ADDRESS_3GPP); + MIH_C_3GPP_ADDR_load_3gpp_str_address(instanceP, &message.primitive.Link_Id.link_addr._union._3gpp_addr, (u_int8_t*)DEFAULT_ADDRESS_3GPP); + #else + message.primitive.Link_Id.link_addr.choice = (MIH_C_CHOICE_T)MIH_C_LINK_TUPLE_ID_CHOICE_NULL;//MIH_C_CHOICE_3GPP_ADDR; + #endif + //MIH_C_3GPP_ADDR_set(&message.primitive.Link_Id.link_addr._union._3gpp_addr, (u_int8_t*)&(g_ue_ral_obj[instanceP].ipv6_l2id[0]), strlen(DEFAULT_ADDRESS_3GPP)); + ////MIH_C_3GPP_ADDR_set(&message.primitive.Link_Id.link_addr._union._3gpp_addr, (u_int8_t*)DEFAULT_ADDRESS_3GPP, strlen(DEFAULT_ADDRESS_3GPP)); + ////MIH_C_3GPP_ADDR_load_3gpp_str_address(&message.primitive.Link_Id.link_addr._union._3gpp_addr, (u_int8_t*)DEFAULT_ADDRESS_3GPP); message_total_length = MIH_C_Link_Message_Encode_Link_Register_indication(bb, &message); @@ -244,6 +279,7 @@ void mRAL_send_link_detected_indication(ral_ue_instance_t instanceP, MIH_C_Message_Link_Detected_indication_t message; Bit_Buffer_t *bb; int message_total_length; + unsigned int mod_id = instanceP - NB_eNB_INST; bb = new_BitBuffer_0(); BitBuffer_wrap(bb, g_msg_codec_send_buffer, (unsigned int)MSG_CODEC_SEND_BUFFER_SIZE); @@ -257,9 +293,9 @@ void mRAL_send_link_detected_indication(ral_ue_instance_t instanceP, message.header.transaction_id = *transaction_idP; - MIH_C_MIHF_ID_set(&message.source, (u_int8_t*)g_ue_ral_obj[instanceP].link_id, strlen(g_ue_ral_obj[instanceP].link_id)); + MIH_C_MIHF_ID_set(&message.source, (u_int8_t*)g_ue_ral_obj[mod_id].link_id, strlen(g_ue_ral_obj[mod_id].link_id)); - MIH_C_MIHF_ID_set(&message.destination, (u_int8_t*)g_ue_ral_obj[instanceP].mihf_id, strlen(g_ue_ral_obj[instanceP].mihf_id)); + MIH_C_MIHF_ID_set(&message.destination, (u_int8_t*)g_ue_ral_obj[mod_id].mihf_id, strlen(g_ue_ral_obj[mod_id].mihf_id)); memcpy(&message.primitive.LinkDetectedInfo, link_detected_infoP, sizeof(MIH_C_LINK_DET_INFO_T)); @@ -285,6 +321,7 @@ void mRAL_send_link_up_indication(ral_ue_instance_t instanceP, MIH_C_Message_Link_Up_indication_t message; Bit_Buffer_t *bb; int message_total_length; + unsigned int mod_id = instanceP - NB_eNB_INST; bb = new_BitBuffer_0(); BitBuffer_wrap(bb, g_msg_codec_send_buffer, (unsigned int)MSG_CODEC_SEND_BUFFER_SIZE); @@ -298,9 +335,9 @@ void mRAL_send_link_up_indication(ral_ue_instance_t instanceP, message.header.transaction_id = *transaction_idP; - MIH_C_MIHF_ID_set(&message.source, (u_int8_t*)g_ue_ral_obj[instanceP].link_id, strlen(g_ue_ral_obj[instanceP].link_id)); + MIH_C_MIHF_ID_set(&message.source, (u_int8_t*)g_ue_ral_obj[mod_id].link_id, strlen(g_ue_ral_obj[mod_id].link_id)); - MIH_C_MIHF_ID_set(&message.destination, (u_int8_t*)g_ue_ral_obj[instanceP].mihf_id, strlen(g_ue_ral_obj[instanceP].mihf_id)); + MIH_C_MIHF_ID_set(&message.destination, (u_int8_t*)g_ue_ral_obj[mod_id].mihf_id, strlen(g_ue_ral_obj[mod_id].mihf_id)); memcpy(&message.primitive.LinkIdentifier, link_identifierP, sizeof(MIH_C_LINK_TUPLE_ID_T)); @@ -328,6 +365,7 @@ void mRAL_send_link_parameters_report_indication(ral_ue_instance_t in MIH_C_Message_Link_Parameters_Report_indication_t message; Bit_Buffer_t *bb; int message_total_length; + unsigned int mod_id = instanceP - NB_eNB_INST; #ifdef MSCGEN_PYTOOL unsigned int index; #endif @@ -344,9 +382,9 @@ void mRAL_send_link_parameters_report_indication(ral_ue_instance_t in message.header.transaction_id = *transaction_idP; - MIH_C_MIHF_ID_set(&message.source, (u_int8_t*)g_ue_ral_obj[instanceP].link_id, strlen(g_ue_ral_obj[instanceP].link_id)); + MIH_C_MIHF_ID_set(&message.source, (u_int8_t*)g_ue_ral_obj[mod_id].link_id, strlen(g_ue_ral_obj[mod_id].link_id)); - MIH_C_MIHF_ID_set(&message.destination, (u_int8_t*)g_ue_ral_obj[instanceP].mihf_id, strlen(g_ue_ral_obj[instanceP].mihf_id)); + MIH_C_MIHF_ID_set(&message.destination, (u_int8_t*)g_ue_ral_obj[mod_id].mihf_id, strlen(g_ue_ral_obj[mod_id].mihf_id)); memcpy(&message.primitive.LinkIdentifier, link_identifierP, sizeof(MIH_C_LINK_TUPLE_ID_T)); @@ -372,6 +410,7 @@ void mRAL_send_link_going_down_indication(ral_ue_instance_t instanceP MIH_C_Message_Link_Going_Down_indication_t message; Bit_Buffer_t *bb; int message_total_length; + unsigned int mod_id = instanceP - NB_eNB_INST; bb = new_BitBuffer_0(); BitBuffer_wrap(bb, g_msg_codec_send_buffer, (unsigned int)MSG_CODEC_SEND_BUFFER_SIZE); @@ -385,9 +424,9 @@ void mRAL_send_link_going_down_indication(ral_ue_instance_t instanceP message.header.transaction_id = *transaction_idP; - MIH_C_MIHF_ID_set(&message.source, (u_int8_t*)g_ue_ral_obj[instanceP].link_id, strlen(g_ue_ral_obj[instanceP].link_id)); + MIH_C_MIHF_ID_set(&message.source, (u_int8_t*)g_ue_ral_obj[mod_id].link_id, strlen(g_ue_ral_obj[mod_id].link_id)); - MIH_C_MIHF_ID_set(&message.destination, (u_int8_t*)g_ue_ral_obj[instanceP].mihf_id, strlen(g_ue_ral_obj[instanceP].mihf_id)); + MIH_C_MIHF_ID_set(&message.destination, (u_int8_t*)g_ue_ral_obj[mod_id].mihf_id, strlen(g_ue_ral_obj[mod_id].mihf_id)); memcpy(&message.primitive.LinkIdentifier, link_identifierP, sizeof(MIH_C_LINK_TUPLE_ID_T)); @@ -415,6 +454,7 @@ void mRAL_send_link_down_indication(ral_ue_instance_t instanceP, MIH_C_Message_Link_Down_indication_t message; Bit_Buffer_t *bb; int message_total_length; + unsigned int mod_id = instanceP - NB_eNB_INST; bb = new_BitBuffer_0(); BitBuffer_wrap(bb, g_msg_codec_send_buffer, (unsigned int)MSG_CODEC_SEND_BUFFER_SIZE); @@ -428,9 +468,9 @@ void mRAL_send_link_down_indication(ral_ue_instance_t instanceP, message.header.transaction_id = *transaction_idP; - MIH_C_MIHF_ID_set(&message.source, (u_int8_t*)g_ue_ral_obj[instanceP].link_id, strlen(g_ue_ral_obj[instanceP].link_id)); + MIH_C_MIHF_ID_set(&message.source, (u_int8_t*)g_ue_ral_obj[mod_id].link_id, strlen(g_ue_ral_obj[mod_id].link_id)); - MIH_C_MIHF_ID_set(&message.destination, (u_int8_t*)g_ue_ral_obj[instanceP].mihf_id, strlen(g_ue_ral_obj[instanceP].mihf_id)); + MIH_C_MIHF_ID_set(&message.destination, (u_int8_t*)g_ue_ral_obj[mod_id].mihf_id, strlen(g_ue_ral_obj[mod_id].mihf_id)); memcpy(&message.primitive.LinkIdentifier, link_identifierP, sizeof(MIH_C_LINK_TUPLE_ID_T)); @@ -458,9 +498,8 @@ void mRAL_send_link_action_confirm(ral_ue_instance_t instanceP, MIH_C_Message_Link_Action_confirm_t message; Bit_Buffer_t *bb; int message_total_length; -#ifdef MSCGEN_PYTOOL - unsigned int index; -#endif + unsigned int mod_id = instanceP - NB_eNB_INST; + bb = new_BitBuffer_0(); BitBuffer_wrap(bb, g_msg_codec_send_buffer, (unsigned int)MSG_CODEC_SEND_BUFFER_SIZE); @@ -474,9 +513,9 @@ void mRAL_send_link_action_confirm(ral_ue_instance_t instanceP, message.header.transaction_id = *transaction_idP; - MIH_C_MIHF_ID_set(&message.source, (u_int8_t*)g_ue_ral_obj[instanceP].link_id, strlen(g_ue_ral_obj[instanceP].link_id)); + MIH_C_MIHF_ID_set(&message.source, (u_int8_t*)g_ue_ral_obj[mod_id].link_id, strlen(g_ue_ral_obj[mod_id].link_id)); - MIH_C_MIHF_ID_set(&message.destination, (u_int8_t*)g_ue_ral_obj[instanceP].mihf_id, strlen(g_ue_ral_obj[instanceP].mihf_id)); + MIH_C_MIHF_ID_set(&message.destination, (u_int8_t*)g_ue_ral_obj[mod_id].mihf_id, strlen(g_ue_ral_obj[mod_id].mihf_id)); message.primitive.Status = *statusP; @@ -486,21 +525,6 @@ void mRAL_send_link_action_confirm(ral_ue_instance_t instanceP, message_total_length = MIH_C_Link_Message_Encode_Link_Action_confirm(bb, &message); - #ifdef MSCGEN_PYTOOL - memset(g_msc_gen_buf, 0, MSC_GEN_BUF_SIZE); - g_msc_gen_buffer_index = 0; - g_msc_gen_buffer_index += MIH_C_STATUS2String(&message.primitive.Status, &g_msc_gen_buf[g_msc_gen_buffer_index]); - if (scan_response_setP) { - for (index = 0; index < scan_response_setP->length; index++) { - g_msc_gen_buffer_index += sprintf(&g_msc_gen_buf[g_msc_gen_buffer_index], "\\nScan resp:"); - g_msc_gen_buffer_index += MIH_C_LINK_SCAN_RSP2String(&scan_response_setP->val[index], &g_msc_gen_buf[g_msc_gen_buffer_index]); - } - } - if (link_action_resultP) { - g_msc_gen_buffer_index += sprintf(&g_msc_gen_buf[g_msc_gen_buffer_index], "\\nAction result:"); - g_msc_gen_buffer_index += MIH_C_LINK_AC_RESULT2String2(link_action_resultP, &g_msc_gen_buf[g_msc_gen_buffer_index]); - } - #endif if (mRAL_send_to_mih(instanceP, bb->m_buffer,message_total_length)<0){ LOG_E(RAL_UE, ": Send Link_Action.confirm\n"); } else { @@ -519,6 +543,7 @@ void mRAL_send_capability_discover_confirm(ral_ue_instance_t instanceP, MIH_C_Message_Link_Capability_Discover_confirm_t message; Bit_Buffer_t *bb; int message_total_length; + unsigned int mod_id = instanceP - NB_eNB_INST; bb = new_BitBuffer_0(); BitBuffer_wrap(bb, g_msg_codec_send_buffer, (unsigned int)MSG_CODEC_SEND_BUFFER_SIZE); @@ -532,8 +557,8 @@ void mRAL_send_capability_discover_confirm(ral_ue_instance_t instanceP, message.header.transaction_id = *transaction_idP; - MIH_C_MIHF_ID_set(&message.source, (u_int8_t*)g_ue_ral_obj[instanceP].link_id, strlen(g_ue_ral_obj[instanceP].link_id)); - MIH_C_MIHF_ID_set(&message.destination, (u_int8_t*)g_ue_ral_obj[instanceP].mihf_id, strlen(g_ue_ral_obj[instanceP].mihf_id)); + MIH_C_MIHF_ID_set(&message.source, (u_int8_t*)g_ue_ral_obj[mod_id].link_id, strlen(g_ue_ral_obj[mod_id].link_id)); + MIH_C_MIHF_ID_set(&message.destination, (u_int8_t*)g_ue_ral_obj[mod_id].mihf_id, strlen(g_ue_ral_obj[mod_id].mihf_id)); message.primitive.Status = *statusP; message.primitive.SupportedLinkEventList = supported_link_event_listP; @@ -541,15 +566,6 @@ void mRAL_send_capability_discover_confirm(ral_ue_instance_t instanceP, message_total_length = MIH_C_Link_Message_Encode_Capability_Discover_confirm(bb, &message); - #ifdef MSCGEN_PYTOOL - memset(g_msc_gen_buf, 0, MSC_GEN_BUF_SIZE); - g_msc_gen_buffer_index = 0; - g_msc_gen_buffer_index += MIH_C_STATUS2String(&message.primitive.Status, &g_msc_gen_buf[g_msc_gen_buffer_index]); - g_msc_gen_buffer_index += sprintf(&g_msc_gen_buf[g_msc_gen_buffer_index], "\\n\\nsupported link events="); - g_msc_gen_buffer_index += MIH_C_LINK_EVENT_LIST2String2(message.primitive.SupportedLinkEventList, &g_msc_gen_buf[g_msc_gen_buffer_index]); - g_msc_gen_buffer_index += sprintf(&g_msc_gen_buf[g_msc_gen_buffer_index], "\\nsupported commands="); - g_msc_gen_buffer_index += MIH_C_LINK_CMD_LIST2String2(message.primitive.SupportedLinkCommandList, &g_msc_gen_buf[g_msc_gen_buffer_index]); - #endif if (mRAL_send_to_mih(instanceP, bb->m_buffer,message_total_length)<0){ LOG_E(RAL_UE, ": Send Link_Capability_Discover.confirm\n"); } else { @@ -567,6 +583,7 @@ void mRAL_send_event_subscribe_confirm(ral_ue_instance_t instanceP, MIH_C_Message_Link_Event_Subscribe_confirm_t message; Bit_Buffer_t *bb; int message_total_length; + unsigned int mod_id = instanceP - NB_eNB_INST; bb = new_BitBuffer_0(); BitBuffer_wrap(bb, g_msg_codec_send_buffer, (unsigned int)MSG_CODEC_SEND_BUFFER_SIZE); @@ -580,21 +597,14 @@ void mRAL_send_event_subscribe_confirm(ral_ue_instance_t instanceP, message.header.transaction_id = *transaction_idP; - MIH_C_MIHF_ID_set(&message.source, (u_int8_t*)g_ue_ral_obj[instanceP].link_id, strlen(g_ue_ral_obj[instanceP].link_id)); - MIH_C_MIHF_ID_set(&message.destination, (u_int8_t*)g_ue_ral_obj[instanceP].mihf_id, strlen(g_ue_ral_obj[instanceP].mihf_id)); + MIH_C_MIHF_ID_set(&message.source, (u_int8_t*)g_ue_ral_obj[mod_id].link_id, strlen(g_ue_ral_obj[mod_id].link_id)); + MIH_C_MIHF_ID_set(&message.destination, (u_int8_t*)g_ue_ral_obj[mod_id].mihf_id, strlen(g_ue_ral_obj[mod_id].mihf_id)); message.primitive.Status = *statusP; message.primitive.ResponseLinkEventList = response_link_event_listP; message_total_length = MIH_C_Link_Message_Encode_Event_Subscribe_confirm(bb, &message); - #ifdef MSCGEN_PYTOOL - memset(g_msc_gen_buf, 0, MSC_GEN_BUF_SIZE); - g_msc_gen_buffer_index = 0; - g_msc_gen_buffer_index += MIH_C_STATUS2String(&message.primitive.Status, &g_msc_gen_buf[g_msc_gen_buffer_index]); - g_msc_gen_buffer_index += sprintf(&g_msc_gen_buf[g_msc_gen_buffer_index], "\\nlink event list="); - g_msc_gen_buffer_index += MIH_C_LINK_EVENT_LIST2String2(message.primitive.ResponseLinkEventList, &g_msc_gen_buf[g_msc_gen_buffer_index]); - #endif if (mRAL_send_to_mih(instanceP, bb->m_buffer,message_total_length)<0){ LOG_E(RAL_UE, ": Send Link_Event_Subscribe.confirm\n"); } else { @@ -612,6 +622,7 @@ void mRAL_send_event_unsubscribe_confirm(ral_ue_instance_t instanceP, MIH_C_Message_Link_Event_Unsubscribe_confirm_t message; Bit_Buffer_t *bb; int message_total_length; + unsigned int mod_id = instanceP - NB_eNB_INST; bb = new_BitBuffer_0(); BitBuffer_wrap(bb, g_msg_codec_send_buffer, (unsigned int)MSG_CODEC_SEND_BUFFER_SIZE); @@ -625,21 +636,14 @@ void mRAL_send_event_unsubscribe_confirm(ral_ue_instance_t instanceP, message.header.transaction_id = *transaction_idP; - MIH_C_MIHF_ID_set(&message.source, (u_int8_t*)g_ue_ral_obj[instanceP].link_id, strlen(g_ue_ral_obj[instanceP].link_id)); - MIH_C_MIHF_ID_set(&message.destination, (u_int8_t*)g_ue_ral_obj[instanceP].mihf_id, strlen(g_ue_ral_obj[instanceP].mihf_id)); + MIH_C_MIHF_ID_set(&message.source, (u_int8_t*)g_ue_ral_obj[mod_id].link_id, strlen(g_ue_ral_obj[mod_id].link_id)); + MIH_C_MIHF_ID_set(&message.destination, (u_int8_t*)g_ue_ral_obj[mod_id].mihf_id, strlen(g_ue_ral_obj[mod_id].mihf_id)); message.primitive.Status = *statusP; message.primitive.ResponseLinkEventList = response_link_event_listP; message_total_length = MIH_C_Link_Message_Encode_Event_Unsubscribe_confirm(bb, &message); - #ifdef MSCGEN_PYTOOL - memset(g_msc_gen_buf, 0, MSC_GEN_BUF_SIZE); - g_msc_gen_buffer_index = 0; - g_msc_gen_buffer_index += MIH_C_STATUS2String(&message.primitive.Status, &g_msc_gen_buf[g_msc_gen_buffer_index]); - g_msc_gen_buffer_index += sprintf(&g_msc_gen_buf[g_msc_gen_buffer_index], "\\nlink event list="); - g_msc_gen_buffer_index += MIH_C_LINK_EVENT_LIST2String2(message.primitive.ResponseLinkEventList, &g_msc_gen_buf[g_msc_gen_buffer_index]); - #endif if (mRAL_send_to_mih(instanceP, bb->m_buffer,message_total_length)<0){ LOG_E(RAL_UE, ": Send Link_Event_Unsubscribe.confirm\n"); } else { @@ -657,9 +661,7 @@ void mRAL_send_configure_thresholds_confirm(ral_ue_instance_t instan MIH_C_Message_Link_Configure_Thresholds_confirm_t message; Bit_Buffer_t *bb; int message_total_length; - #ifdef MSCGEN_PYTOOL - int i; - #endif + unsigned int mod_id = instanceP - NB_eNB_INST; bb = new_BitBuffer_0(); BitBuffer_wrap(bb, g_msg_codec_send_buffer, (unsigned int)MSG_CODEC_SEND_BUFFER_SIZE); @@ -673,23 +675,14 @@ void mRAL_send_configure_thresholds_confirm(ral_ue_instance_t instan message.header.transaction_id = *transaction_idP; - MIH_C_MIHF_ID_set(&message.source, (u_int8_t*)g_ue_ral_obj[instanceP].link_id, strlen(g_ue_ral_obj[instanceP].link_id)); - MIH_C_MIHF_ID_set(&message.destination, (u_int8_t*)g_ue_ral_obj[instanceP].mihf_id, strlen(g_ue_ral_obj[instanceP].mihf_id)); + MIH_C_MIHF_ID_set(&message.source, (u_int8_t*)g_ue_ral_obj[mod_id].link_id, strlen(g_ue_ral_obj[mod_id].link_id)); + MIH_C_MIHF_ID_set(&message.destination, (u_int8_t*)g_ue_ral_obj[mod_id].mihf_id, strlen(g_ue_ral_obj[mod_id].mihf_id)); message.primitive.Status = *statusP; message.primitive.LinkConfigureStatusList_list = link_configure_status_listP; message_total_length = MIH_C_Link_Message_Encode_Configure_Thresholds_confirm(bb, &message); - #ifdef MSCGEN_PYTOOL - memset(g_msc_gen_buf, 0, MSC_GEN_BUF_SIZE); - g_msc_gen_buffer_index = 0; - g_msc_gen_buffer_index += MIH_C_STATUS2String(&message.primitive.Status, &g_msc_gen_buf[g_msc_gen_buffer_index]); - g_msc_gen_buffer_index += sprintf(&g_msc_gen_buf[g_msc_gen_buffer_index], "\\n"); - for (i = 0; i < link_configure_status_listP->length; i++) { - g_msc_gen_buffer_index += MIH_C_LINK_CFG_STATUS2String(&link_configure_status_listP->val[i], &g_msc_gen_buf[g_msc_gen_buffer_index]); - } - #endif if (mRAL_send_to_mih(instanceP, bb->m_buffer,message_total_length)<0){ LOG_E(RAL_UE, ": Send Link_Configure_Threshold.confirm\n"); } else { @@ -709,11 +702,8 @@ void mRAL_send_get_parameters_confirm (ral_ue_instance_t instanc MIH_C_Message_Link_Get_Parameters_confirm_t message; Bit_Buffer_t *bb; int message_total_length; -#ifdef MSCGEN_PYTOOL - char msg_src[32]; - char msg_dst[32]; - int i; -#endif + unsigned int mod_id = instanceP - NB_eNB_INST; + bb = new_BitBuffer_0(); BitBuffer_wrap(bb, g_msg_codec_send_buffer, (unsigned int)MSG_CODEC_SEND_BUFFER_SIZE); @@ -727,8 +717,8 @@ void mRAL_send_get_parameters_confirm (ral_ue_instance_t instanc message.header.transaction_id = *transaction_idP; - MIH_C_MIHF_ID_set(&message.source, (u_int8_t*)g_ue_ral_obj[instanceP].link_id, strlen(g_ue_ral_obj[instanceP].link_id)); - MIH_C_MIHF_ID_set(&message.destination, (u_int8_t*)g_ue_ral_obj[instanceP].mihf_id, strlen(g_ue_ral_obj[instanceP].mihf_id)); + MIH_C_MIHF_ID_set(&message.source, (u_int8_t*)g_ue_ral_obj[mod_id].link_id, strlen(g_ue_ral_obj[mod_id].link_id)); + MIH_C_MIHF_ID_set(&message.destination, (u_int8_t*)g_ue_ral_obj[mod_id].mihf_id, strlen(g_ue_ral_obj[mod_id].mihf_id)); message.primitive.Status = *statusP; message.primitive.LinkParametersStatusList_list = link_parameters_status_listP; @@ -755,11 +745,8 @@ int mRAL_mih_link_msg_decode(ral_ue_instance_t instanceP, Bit_Buffer_t* bbP, MIH int status = MIH_MESSAGE_DECODE_FAILURE; MIH_C_HEADER_T header; MIH_C_STATUS_T mih_status; -#ifdef MSCGEN_PYTOOL - char msg_src[32]; - char msg_dst[32]; - int i; -#endif + unsigned int mod_id = instanceP - NB_eNB_INST; + if ((bbP != NULL) && (message_wrapperP != NULL)) { status = MIH_C_Link_Header_Decode(bbP, &header); @@ -770,11 +757,11 @@ int mRAL_mih_link_msg_decode(ral_ue_instance_t instanceP, Bit_Buffer_t* bbP, MIH } else if (status == MIH_HEADER_DECODE_BAD_PARAMETER) { return MIH_MESSAGE_DECODE_BAD_PARAMETER; } - message_wrapperP->message_id = MIH_C_MESSAGE_ID(header.service_identifier, header.operation_code, header.action_identifier); + message_wrapperP->message_id = MIH_C_MESSAGE_ID(header.service_identifier, header.operation_code, header.action_identifier); switch (message_wrapperP->message_id) { case MIH_C_MESSAGE_LINK_CAPABILITY_DISCOVER_REQUEST_ID: - LOG_D(RAL_UE, " %s Received MIH_C_MESSAGE_LINK_CAPABILITY_DISCOVER_REQUEST\n", __FUNCTION__); + LOG_D(RAL_UE, " %s Received MIH_C_MESSAGE_LINK_CAPABILITY_DISCOVER_REQUEST TID %u\n", __FUNCTION__, header.transaction_id); memcpy(&message_wrapperP->_union_message.link_capability_discover_request.header, (const void *)&header, sizeof(MIH_C_HEADER_T)); status = MIH_C_Link_Message_Decode_Link_Capability_Discover_request(bbP, &message_wrapperP->_union_message.link_capability_discover_request); if (status == MIH_MESSAGE_DECODE_OK) { @@ -788,14 +775,14 @@ int mRAL_mih_link_msg_decode(ral_ue_instance_t instanceP, Bit_Buffer_t* bbP, MIH mRAL_send_capability_discover_confirm(instanceP, &message_wrapperP->_union_message.link_capability_discover_request.header.transaction_id, &mih_status, - &g_ue_ral_obj[instanceP].mih_supported_link_event_list, - &g_ue_ral_obj[instanceP].mih_supported_link_command_list); + &g_ue_ral_obj[mod_id].mih_supported_link_event_list, + &g_ue_ral_obj[mod_id].mih_supported_link_command_list); } else { } break; case MIH_C_MESSAGE_LINK_EVENT_SUBSCRIBE_REQUEST_ID: - LOG_D(RAL_UE, " %s Received MIH_C_MESSAGE_LINK_EVENT_SUBSCRIBE_REQUEST\n", __FUNCTION__); + LOG_D(RAL_UE, " %s Received MIH_C_MESSAGE_LINK_EVENT_SUBSCRIBE_REQUEST TID %u\n", __FUNCTION__, header.transaction_id); memcpy(&message_wrapperP->_union_message.link_event_subscribe_request.header, (const void *)&header, sizeof(MIH_C_HEADER_T)); status = MIH_C_Link_Message_Decode_Link_Event_Subscribe_request(bbP, &message_wrapperP->_union_message.link_event_subscribe_request); if (status == MIH_MESSAGE_DECODE_OK) { @@ -807,7 +794,7 @@ int mRAL_mih_link_msg_decode(ral_ue_instance_t instanceP, Bit_Buffer_t* bbP, MIH break; case MIH_C_MESSAGE_LINK_EVENT_UNSUBSCRIBE_REQUEST_ID: - LOG_D(RAL_UE, " %s Received MIH_C_MESSAGE_LINK_EVENT_UNSUBSCRIBE_REQUEST\n", __FUNCTION__); + LOG_D(RAL_UE, " %s Received MIH_C_MESSAGE_LINK_EVENT_UNSUBSCRIBE_REQUEST TID %u\n", __FUNCTION__, header.transaction_id); memcpy(&message_wrapperP->_union_message.link_event_unsubscribe_request.header, (const void *)&header, sizeof(MIH_C_HEADER_T)); status = MIH_C_Link_Message_Decode_Link_Event_Unsubscribe_request(bbP, &message_wrapperP->_union_message.link_event_unsubscribe_request); if (status == MIH_MESSAGE_DECODE_OK) { @@ -818,7 +805,7 @@ int mRAL_mih_link_msg_decode(ral_ue_instance_t instanceP, Bit_Buffer_t* bbP, MIH break; case MIH_C_MESSAGE_LINK_GET_PARAMETERS_REQUEST_ID: - LOG_D(RAL_UE, " %s Received MIH_C_MESSAGE_LINK_GET_PARAMETERS_REQUEST\n", __FUNCTION__); + LOG_D(RAL_UE, " %s Received MIH_C_MESSAGE_LINK_GET_PARAMETERS_REQUEST TID %u\n", __FUNCTION__, header.transaction_id); memcpy(&message_wrapperP->_union_message.link_get_parameters_request.header, (const void *)&header, sizeof(MIH_C_HEADER_T)); status = MIH_C_Link_Message_Decode_Link_Get_Parameters_request(bbP, &message_wrapperP->_union_message.link_get_parameters_request); if (status == MIH_MESSAGE_DECODE_OK) { @@ -829,7 +816,7 @@ int mRAL_mih_link_msg_decode(ral_ue_instance_t instanceP, Bit_Buffer_t* bbP, MIH break; case MIH_C_MESSAGE_LINK_CONFIGURE_THRESHOLDS_REQUEST_ID: - LOG_D(RAL_UE, " %s Received MIH_C_MESSAGE_LINK_CONFIGURE_THRESHOLDS_REQUEST\n", __FUNCTION__); + LOG_D(RAL_UE, " %s Received MIH_C_MESSAGE_LINK_CONFIGURE_THRESHOLDS_REQUEST TID %u\n", __FUNCTION__, header.transaction_id); memcpy(&message_wrapperP->_union_message.link_configure_thresholds_request.header, (const void *)&header, sizeof(MIH_C_HEADER_T)); status = MIH_C_Link_Message_Decode_Link_Configure_Thresholds_request(bbP, &message_wrapperP->_union_message.link_configure_thresholds_request); if (status == MIH_MESSAGE_DECODE_OK) { @@ -840,7 +827,7 @@ int mRAL_mih_link_msg_decode(ral_ue_instance_t instanceP, Bit_Buffer_t* bbP, MIH break; case MIH_C_MESSAGE_LINK_ACTION_REQUEST_ID: - LOG_D(RAL_UE, " %s Received MIH_C_MESSAGE_LINK_ACTION_REQUEST\n", __FUNCTION__); + LOG_D(RAL_UE, " %s Received MIH_C_MESSAGE_LINK_ACTION_REQUEST TID %u\n", __FUNCTION__, header.transaction_id); memcpy(&message_wrapperP->_union_message.link_action_request.header, (const void *)&header, sizeof(MIH_C_HEADER_T)); status = MIH_C_Link_Message_Decode_Link_Action_request(bbP, &message_wrapperP->_union_message.link_action_request); if (status == MIH_MESSAGE_DECODE_OK) { @@ -873,13 +860,14 @@ int mRAL_mih_link_process_message(ral_ue_instance_t instanceP){ Bit_Buffer_t *bb; struct sockaddr_in udp_socket; socklen_t sockaddr_len; + unsigned int mod_id = instanceP - NB_eNB_INST; total_bytes_to_decode = 0; nb_bytes_received = 0; bb = new_BitBuffer_0(); - nb_bytes_received = recvfrom(g_ue_ral_obj[instanceP].mih_sock_desc, + nb_bytes_received = recvfrom(g_ue_ral_obj[mod_id].mih_sock_desc, (void *)g_msg_codec_recv_buffer, MSG_CODEC_RECV_BUFFER_SIZE, 0, diff --git a/openair3/RAL-LTE/LTE_RAL_UE/SRC/lteRALue_process.c b/openair3/RAL-LTE/LTE_RAL_UE/SRC/lteRALue_process.c index 9d3fa09df8d..820738f84ce 100755 --- a/openair3/RAL-LTE/LTE_RAL_UE/SRC/lteRALue_process.c +++ b/openair3/RAL-LTE/LTE_RAL_UE/SRC/lteRALue_process.c @@ -43,6 +43,7 @@ //----------------------------------------------------------------------------- #include "lteRALue.h" +#include "PHY/extern.h" /* //--------------------------------------------------------------------------- // Temp - Enter hard-coded measures in IAL diff --git a/openair3/RAL-LTE/LTE_RAL_UE/SRC/lteRALue_rrc_msg.c b/openair3/RAL-LTE/LTE_RAL_UE/SRC/lteRALue_rrc_msg.c index f998509b3b8..762431f4acb 100755 --- a/openair3/RAL-LTE/LTE_RAL_UE/SRC/lteRALue_rrc_msg.c +++ b/openair3/RAL-LTE/LTE_RAL_UE/SRC/lteRALue_rrc_msg.c @@ -20,8 +20,11 @@ #define LTE_RAL_UE #define LTE_RAL_UE_RRC_MSG_C #include "lteRALue.h" +#include "LAYER2/MAC/extern.h" +//--------------------------------------------------------------------------------------------------------------------- static int ueid2eui48(u8 *euiP, u8* ue_idP) +//--------------------------------------------------------------------------------------------------------------------- { // inspired by linux-source-3.2.0/net/ipv6/addrconf.c memcpy(euiP, ue_idP, 3); @@ -32,24 +35,70 @@ static int ueid2eui48(u8 *euiP, u8* ue_idP) return 0; } + +//--------------------------------------------------------------------------------------------------------------------- +void mRAL_rx_rrc_ral_scan_confirm(instance_t instanceP, MessageDef *msg_p) +//--------------------------------------------------------------------------------------------------------------------- +{ + MIH_C_STATUS_T status; + MIH_C_LINK_SCAN_RSP_LIST_T scan_rsp_list; + MIH_C_LINK_AC_RESULT_T ac_result; + int i; + + status = MIH_C_STATUS_SUCCESS; + ac_result = MIH_C_LINK_AC_RESULT_SUCCESS; + memset(&scan_rsp_list, 0, sizeof(MIH_C_LINK_SCAN_RSP_LIST_T)); + + for (i = 0 ; i < RRC_RAL_SCAN_CONF (msg_p).num_scan_resp; i++) { + // TO DO + memcpy(&scan_rsp_list.val[i].link_addr, &RRC_RAL_SCAN_CONF (msg_p).link_scan_resp[i].link_addr, sizeof(MIH_C_LINK_ADDR_T)); + // TO DO + memcpy(&scan_rsp_list.val[i].network_id, &RRC_RAL_SCAN_CONF (msg_p).link_scan_resp[i].network_id, sizeof(MIH_C_NETWORK_ID_T)); + + scan_rsp_list.val[i].sig_strength.choice = RRC_RAL_SCAN_CONF (msg_p).link_scan_resp[i].sig_strength.choice; + switch (scan_rsp_list.val[i].sig_strength.choice) { + case RAL_SIG_STRENGTH_CHOICE_DBM: + scan_rsp_list.val[i].sig_strength._union.dbm = RRC_RAL_SCAN_CONF (msg_p).link_scan_resp[i].sig_strength._union.dbm; + break; + case RAL_SIG_STRENGTH_CHOICE_PERCENTAGE: + scan_rsp_list.val[i].sig_strength._union.percentage = RRC_RAL_SCAN_CONF (msg_p).link_scan_resp[i].sig_strength._union.percentage; + break; + default: + LOG_E(RAL_UE, "INVALID RRC_RAL_SCAN_CONF field sig_strength.choice %d\n", scan_rsp_list.val[i].sig_strength.choice); + status = MIH_C_STATUS_UNSPECIFIED_FAILURE; + } + scan_rsp_list.length += 1; + } + mRAL_send_link_action_confirm(instanceP, + &RRC_RAL_SCAN_CONF (msg_p).transaction_id, + &status, + &scan_rsp_list, + &ac_result); +} + + //--------------------------------------------------------------------------------------------------------------------- void mRAL_rx_rrc_ral_system_information_indication(instance_t instanceP, MessageDef *msg_p) //--------------------------------------------------------------------------------------------------------------------- { - MIH_C_LINK_DET_INFO_T link_det_info; - int i; + MIH_C_LINK_DET_INFO_T link_det_info; + int i; + unsigned int mod_id = instanceP - NB_eNB_INST; memset(&link_det_info, 0, sizeof(MIH_C_LINK_DET_INFO_T)); + + // save cell parameters + g_ue_ral_obj[mod_id].cell_id = RRC_RAL_SYSTEM_INFORMATION_IND(msg_p).cell_id; + memcpy(&g_ue_ral_obj[mod_id].plmn_id, &RRC_RAL_SYSTEM_INFORMATION_IND(msg_p).plmn_id, sizeof(g_ue_ral_obj[mod_id].plmn_id)); + // link id link_det_info.link_tuple_id.link_id.link_type = MIH_C_WIRELESS_LTE; + #ifdef USE_3GPP_ADDR_AS_LINK_ADDR + link_det_info.link_tuple_id.link_id.link_addr.choice = (MIH_C_CHOICE_T)MIH_C_CHOICE_3GPP_ADDR; + MIH_C_3GPP_ADDR_load_3gpp_str_address(instanceP, &link_det_info.link_tuple_id.link_id.link_addr._union._3gpp_addr, (u_int8_t*)DEFAULT_ADDRESS_3GPP); + #else link_det_info.link_tuple_id.link_id.link_addr.choice = MIH_C_CHOICE_3GPP_3G_CELL_ID; - link_det_info.link_tuple_id.choice = MIH_C_LINK_TUPLE_ID_CHOICE_LINK_ADDR; - - // save cell parameters - g_ue_ral_obj[instanceP].cell_id = RRC_RAL_SYSTEM_INFORMATION_IND(msg_p).cell_id; - memcpy(&g_ue_ral_obj[instanceP].plmn_id, &RRC_RAL_SYSTEM_INFORMATION_IND(msg_p).plmn_id, sizeof(g_ue_ral_obj[instanceP].plmn_id)); - // preserve byte order of plmn id memcpy(link_det_info.link_tuple_id.link_id.link_addr._union._3gpp_3g_cell_id.plmn_id.val, &RRC_RAL_SYSTEM_INFORMATION_IND(msg_p).plmn_id, 3); link_det_info.link_tuple_id.link_id.link_addr._union._3gpp_3g_cell_id.cell_id = RRC_RAL_SYSTEM_INFORMATION_IND(msg_p).cell_id; @@ -58,6 +107,9 @@ void mRAL_rx_rrc_ral_system_information_indication(instance_t instanceP, Message link_det_info.link_tuple_id.link_id.link_addr._union._3gpp_3g_cell_id.plmn_id.val[1], link_det_info.link_tuple_id.link_id.link_addr._union._3gpp_3g_cell_id.plmn_id.val[2]); LOG_D(RAL_UE, "CELL ID %d\n", link_det_info.link_tuple_id.link_id.link_addr._union._3gpp_3g_cell_id.cell_id); + #endif + //The optional LINK_ADDR may contains a link address of PoA. + link_det_info.link_tuple_id.choice = MIH_C_LINK_TUPLE_ID_CHOICE_NULL; MIH_C_NETWORK_ID_set(&link_det_info.network_id, (u_int8_t *)PREDEFINED_MIH_NETWORK_ID, strlen(PREDEFINED_MIH_NETWORK_ID)); @@ -70,13 +122,13 @@ void mRAL_rx_rrc_ral_system_information_indication(instance_t instanceP, Message link_det_info.link_data_rate = RRC_RAL_SYSTEM_INFORMATION_IND(msg_p).link_data_rate; - link_det_info.link_mihcap_flag = g_ue_ral_obj[instanceP].link_mihcap_flag; + link_det_info.link_mihcap_flag = g_ue_ral_obj[mod_id].link_mihcap_flag; - link_det_info.net_caps = g_ue_ral_obj[instanceP].net_caps; + link_det_info.net_caps = g_ue_ral_obj[mod_id].net_caps; - mRAL_send_link_detected_indication(instanceP, &g_ue_ral_obj[instanceP].transaction_id, &link_det_info); + mRAL_send_link_detected_indication(instanceP, &g_ue_ral_obj[mod_id].transaction_id, &link_det_info); - g_ue_ral_obj[instanceP].transaction_id ++; + g_ue_ral_obj[mod_id].transaction_id ++; } //--------------------------------------------------------------------------------------------------------------------- @@ -84,52 +136,34 @@ void mRAL_rx_rrc_ral_connection_establishment_indication(instance_t instanceP, M //--------------------------------------------------------------------------------------------------------------------- { MIH_C_LINK_TUPLE_ID_T link_tuple_id; - uint8_t ue_id_array[MIH_C_3GPP_ADDR_LENGTH]; - uint8_t mn_link_addr[MIH_C_3GPP_ADDR_LENGTH]; - uint64_t ue_id; //EUI-64 - int i; + unsigned int mod_id = instanceP - NB_eNB_INST; memset(&link_tuple_id, 0, sizeof(MIH_C_LINK_TUPLE_ID_T)); // The LINK_ID contains the MN LINK_ADDR link_tuple_id.link_id.link_type = MIH_C_WIRELESS_LTE; - - - // TEST - link_tuple_id.link_id.link_type = MIH_C_WIRELESS_LTE; + #ifdef USE_3GPP_ADDR_AS_LINK_ADDR + link_tuple_id.link_id.link_addr.choice = (MIH_C_CHOICE_T)MIH_C_CHOICE_3GPP_ADDR; + MIH_C_3GPP_ADDR_load_3gpp_str_address(instanceP, &link_tuple_id.link_id.link_addr._union._3gpp_addr, (u_int8_t*)DEFAULT_ADDRESS_3GPP); + #else link_tuple_id.link_id.link_addr.choice = MIH_C_CHOICE_3GPP_3G_CELL_ID; - link_tuple_id.choice = MIH_C_LINK_TUPLE_ID_CHOICE_LINK_ADDR; - // preserve byte order of plmn id - memcpy(link_tuple_id.link_id.link_addr._union._3gpp_3g_cell_id.plmn_id.val, &g_ue_ral_obj[instanceP].plmn_id, 3); - link_tuple_id.link_id.link_addr._union._3gpp_3g_cell_id.cell_id = g_ue_ral_obj[instanceP].cell_id; - // TEST END - + memcpy(link_tuple_id.link_id.link_addr._union._3gpp_3g_cell_id.plmn_id.val, &g_ue_ral_obj[mod_id].plmn_id, 3); + link_tuple_id.link_id.link_addr._union._3gpp_3g_cell_id.cell_id = g_ue_ral_obj[mod_id].cell_id; LOG_D(RAL_UE, "PLMN ID %d.%d.%d\n", link_tuple_id.link_id.link_addr._union._3gpp_3g_cell_id.plmn_id.val[0], link_tuple_id.link_id.link_addr._union._3gpp_3g_cell_id.plmn_id.val[1], link_tuple_id.link_id.link_addr._union._3gpp_3g_cell_id.plmn_id.val[2]); LOG_D(RAL_UE, "CELL ID %d\n", link_tuple_id.link_id.link_addr._union._3gpp_3g_cell_id.cell_id); - /*link_tuple_id.link_id.link_addr.choice = MIH_C_CHOICE_3GPP_ADDR; - memset(ue_id_array, 0, MIH_C_3GPP_ADDR_LENGTH); -#warning "TO DO FIX UE_ID TYPE in rrc_ral_connection_establishment_ind_t" - ue_id = (uint64_t)RRC_RAL_CONNECTION_ESTABLISHMENT_IND(msg_p).ue_id; - for (i = 0; i < MIH_C_3GPP_ADDR_LENGTH; i++) { - ue_id_array[MIH_C_3GPP_ADDR_LENGTH-1-i] = (ue_id & 0x00000000000000FF); - ue_id = ue_id >> 8; - } - ueid2eui48(mn_link_addr, ue_id_array); - MIH_C_3GPP_ADDR_set(&(link_tuple_id.link_id.link_addr._union._3gpp_addr), NULL, 8); - + #endif //The optional LINK_ADDR may contains a link address of PoA. - link_tuple_id.choice = MIH_C_LINK_TUPLE_ID_CHOICE_NULL; -*/ + link_tuple_id.choice = MIH_C_LINK_TUPLE_ID_CHOICE_NULL; - mRAL_send_link_up_indication(instanceP, &g_ue_ral_obj[instanceP].transaction_id, + mRAL_send_link_up_indication(instanceP, &g_ue_ral_obj[mod_id].transaction_id, &link_tuple_id, NULL, //MIH_C_LINK_ADDR_T *old_arP,(Optional) Old Access Router link address. NULL, //MIH_C_LINK_ADDR_T *new_arP,(Optional) New Access Router link address. NULL, //MIH_C_IP_RENEWAL_FLAG_T *flagP, (Optional) Indicates whether the MN needs to change IP Address in the new PoA. NULL); //MIH_C_IP_MOB_MGMT_T *mobil_mngtP, (Optional) Indicates the type of Mobility Management Protocol supported by the new PoA. - g_ue_ral_obj[instanceP].transaction_id ++; + g_ue_ral_obj[mod_id].transaction_id ++; } //--------------------------------------------------------------------------------------------------------------------- @@ -137,44 +171,31 @@ void mRAL_rx_rrc_ral_connection_reestablishment_indication(instance_t instanceP, //--------------------------------------------------------------------------------------------------------------------- { MIH_C_LINK_TUPLE_ID_T link_tuple_id; - uint8_t ue_id_array[MIH_C_3GPP_ADDR_LENGTH]; - uint8_t mn_link_addr[MIH_C_3GPP_ADDR_LENGTH]; - uint64_t ue_id; //EUI-64 - int i; + unsigned int mod_id = instanceP - NB_eNB_INST; memset(&link_tuple_id, 0, sizeof(MIH_C_LINK_TUPLE_ID_T)); + //The optional LINK_ADDR may contains a link address of PoA. + link_tuple_id.choice = MIH_C_LINK_TUPLE_ID_CHOICE_NULL; link_tuple_id.link_id.link_type = MIH_C_WIRELESS_LTE; + #ifdef USE_3GPP_ADDR_AS_LINK_ADDR + link_tuple_id.link_id.link_addr.choice = (MIH_C_CHOICE_T)MIH_C_CHOICE_3GPP_ADDR; + MIH_C_3GPP_ADDR_load_3gpp_str_address(instanceP, &link_tuple_id.link_id.link_addr._union._3gpp_addr, (u_int8_t*)DEFAULT_ADDRESS_3GPP); + #else link_tuple_id.link_id.link_addr.choice = MIH_C_CHOICE_3GPP_3G_CELL_ID; - link_tuple_id.choice = MIH_C_LINK_TUPLE_ID_CHOICE_LINK_ADDR; // preserve byte order of plmn id - memcpy(link_tuple_id.link_id.link_addr._union._3gpp_3g_cell_id.plmn_id.val, &g_ue_ral_obj[instanceP].plmn_id, 3); - link_tuple_id.link_id.link_addr._union._3gpp_3g_cell_id.cell_id = g_ue_ral_obj[instanceP].cell_id; + memcpy(link_tuple_id.link_id.link_addr._union._3gpp_3g_cell_id.plmn_id.val, &g_ue_ral_obj[mod_id].plmn_id, 3); + link_tuple_id.link_id.link_addr._union._3gpp_3g_cell_id.cell_id = g_ue_ral_obj[mod_id].cell_id; // TEST END LOG_D(RAL_UE, "PLMN ID %d.%d.%d\n", link_tuple_id.link_id.link_addr._union._3gpp_3g_cell_id.plmn_id.val[0], link_tuple_id.link_id.link_addr._union._3gpp_3g_cell_id.plmn_id.val[1], link_tuple_id.link_id.link_addr._union._3gpp_3g_cell_id.plmn_id.val[2]); LOG_D(RAL_UE, "CELL ID %d\n", link_tuple_id.link_id.link_addr._union._3gpp_3g_cell_id.cell_id); + #endif -/* // The LINK_ID contains the MN LINK_ADDR - link_tuple_id.link_id.link_type = MIH_C_WIRELESS_LTE; - link_tuple_id.link_id.link_addr.choice = MIH_C_CHOICE_3GPP_ADDR; - memset(ue_id_array, 0, MIH_C_3GPP_ADDR_LENGTH); -#warning "TO DO FIX UE_ID TYPE in rrc_ral_connection_establishment_ind_t" - ue_id = (uint64_t)RRC_RAL_CONNECTION_ESTABLISHMENT_IND(msg_p).ue_id; - for (i = 0; i < MIH_C_3GPP_ADDR_LENGTH; i++) { - ue_id_array[MIH_C_3GPP_ADDR_LENGTH-1-i] = (ue_id & 0x00000000000000FF); - ue_id = ue_id >> 8; - } - ueid2eui48(mn_link_addr, ue_id_array); - MIH_C_3GPP_ADDR_set(&(link_tuple_id.link_id.link_addr._union._3gpp_addr), NULL, 8); - - //The optional LINK_ADDR may contains a link address of PoA. - link_tuple_id.choice = MIH_C_LINK_TUPLE_ID_CHOICE_NULL; -*/ LOG_D(RAL_UE, "RRC_RAL_CONNECTION_ESTABLISHMENT_IND num srb %d num drb %d\n", RRC_RAL_CONNECTION_REESTABLISHMENT_IND(msg_p).num_srb,RRC_RAL_CONNECTION_REESTABLISHMENT_IND(msg_p).num_drb); if ((RRC_RAL_CONNECTION_REESTABLISHMENT_IND(msg_p).num_drb > 0) && (RRC_RAL_CONNECTION_REESTABLISHMENT_IND(msg_p).num_srb > 0)) { - mRAL_send_link_up_indication(instanceP, &g_ue_ral_obj[instanceP].transaction_id, + mRAL_send_link_up_indication(instanceP, &g_ue_ral_obj[mod_id].transaction_id, &link_tuple_id, NULL, //MIH_C_LINK_ADDR_T *old_arP,(Optional) Old Access Router link address. NULL, //MIH_C_LINK_ADDR_T *new_arP,(Optional) New Access Router link address. @@ -183,59 +204,45 @@ void mRAL_rx_rrc_ral_connection_reestablishment_indication(instance_t instanceP, } else { MIH_C_LINK_DN_REASON_T reason_code = MIH_C_LINK_DOWN_REASON_EXPLICIT_DISCONNECT; - mRAL_send_link_down_indication(instanceP, &g_ue_ral_obj[instanceP].transaction_id, + mRAL_send_link_down_indication(instanceP, &g_ue_ral_obj[mod_id].transaction_id, &link_tuple_id, NULL, &reason_code); } - g_ue_ral_obj[instanceP].transaction_id ++;} + g_ue_ral_obj[mod_id].transaction_id ++;} //--------------------------------------------------------------------------------------------------------------------- void mRAL_rx_rrc_ral_connection_reconfiguration_indication(instance_t instanceP, MessageDef *msg_p) //--------------------------------------------------------------------------------------------------------------------- { MIH_C_LINK_TUPLE_ID_T link_tuple_id; - uint8_t ue_id_array[MIH_C_3GPP_ADDR_LENGTH]; - uint8_t mn_link_addr[MIH_C_3GPP_ADDR_LENGTH]; - uint64_t ue_id; //EUI-64 - int i; + unsigned int mod_id = instanceP - NB_eNB_INST; memset(&link_tuple_id, 0, sizeof(MIH_C_LINK_TUPLE_ID_T)); + //The optional LINK_ADDR may contains a link address of PoA. + link_tuple_id.choice = MIH_C_LINK_TUPLE_ID_CHOICE_NULL; link_tuple_id.link_id.link_type = MIH_C_WIRELESS_LTE; - link_tuple_id.link_id.link_addr.choice = MIH_C_CHOICE_3GPP_3G_CELL_ID; - link_tuple_id.choice = MIH_C_LINK_TUPLE_ID_CHOICE_LINK_ADDR; + #ifdef USE_3GPP_ADDR_AS_LINK_ADDR + link_tuple_id.link_id.link_addr.choice = (MIH_C_CHOICE_T)MIH_C_CHOICE_3GPP_ADDR; + MIH_C_3GPP_ADDR_load_3gpp_str_address(instanceP, &link_tuple_id.link_id.link_addr._union._3gpp_addr, (u_int8_t*)DEFAULT_ADDRESS_3GPP); + #else // preserve byte order of plmn id - memcpy(link_tuple_id.link_id.link_addr._union._3gpp_3g_cell_id.plmn_id.val, &g_ue_ral_obj[instanceP].plmn_id, 3); - link_tuple_id.link_id.link_addr._union._3gpp_3g_cell_id.cell_id = g_ue_ral_obj[instanceP].cell_id; + memcpy(link_tuple_id.link_id.link_addr._union._3gpp_3g_cell_id.plmn_id.val, &g_ue_ral_obj[mod_id].plmn_id, 3); + link_tuple_id.link_id.link_addr._union._3gpp_3g_cell_id.cell_id = g_ue_ral_obj[mod_id].cell_id; // TEST END LOG_D(RAL_UE, "PLMN ID %d.%d.%d\n", link_tuple_id.link_id.link_addr._union._3gpp_3g_cell_id.plmn_id.val[0], link_tuple_id.link_id.link_addr._union._3gpp_3g_cell_id.plmn_id.val[1], link_tuple_id.link_id.link_addr._union._3gpp_3g_cell_id.plmn_id.val[2]); LOG_D(RAL_UE, "CELL ID %d\n", link_tuple_id.link_id.link_addr._union._3gpp_3g_cell_id.cell_id); - /* - // The LINK_ID contains the MN LINK_ADDR - link_tuple_id.link_id.link_type = MIH_C_WIRELESS_LTE; - link_tuple_id.link_id.link_addr.choice = MIH_C_CHOICE_3GPP_ADDR; - memset(ue_id_array, 0, MIH_C_3GPP_ADDR_LENGTH); -#warning "TO DO FIX UE_ID TYPE in rrc_ral_connection_establishment_ind_t" - ue_id = (uint64_t)RRC_RAL_CONNECTION_ESTABLISHMENT_IND(msg_p).ue_id; - for (i = 0; i < MIH_C_3GPP_ADDR_LENGTH; i++) { - ue_id_array[MIH_C_3GPP_ADDR_LENGTH-1-i] = (ue_id & 0x00000000000000FF); - ue_id = ue_id >> 8; - } - ueid2eui48(mn_link_addr, ue_id_array); - MIH_C_3GPP_ADDR_set(&(link_tuple_id.link_id.link_addr._union._3gpp_addr), NULL, 8); + #endif - //The optional LINK_ADDR may contains a link address of PoA. - link_tuple_id.choice = MIH_C_LINK_TUPLE_ID_CHOICE_NULL; -*/ LOG_D(RAL_UE, "RRC_RAL_CONNECTION_RECONFIGURATION_IND num srb %d num drb %d\n", RRC_RAL_CONNECTION_RECONFIGURATION_IND(msg_p).num_srb, RRC_RAL_CONNECTION_RECONFIGURATION_IND(msg_p).num_drb); if ((RRC_RAL_CONNECTION_RECONFIGURATION_IND(msg_p).num_drb > 0) && (RRC_RAL_CONNECTION_RECONFIGURATION_IND(msg_p).num_srb > 0)) { - mRAL_send_link_up_indication(instanceP, &g_ue_ral_obj[instanceP].transaction_id, + mRAL_send_link_up_indication(instanceP, &g_ue_ral_obj[mod_id].transaction_id, &link_tuple_id, NULL, //MIH_C_LINK_ADDR_T *old_arP,(Optional) Old Access Router link address. NULL, //MIH_C_LINK_ADDR_T *new_arP,(Optional) New Access Router link address. @@ -244,12 +251,12 @@ void mRAL_rx_rrc_ral_connection_reconfiguration_indication(instance_t instanceP, } else { MIH_C_LINK_DN_REASON_T reason_code = MIH_C_LINK_DOWN_REASON_EXPLICIT_DISCONNECT; - mRAL_send_link_down_indication(instanceP, &g_ue_ral_obj[instanceP].transaction_id, + mRAL_send_link_down_indication(instanceP, &g_ue_ral_obj[mod_id].transaction_id, &link_tuple_id, NULL, &reason_code); } - g_ue_ral_obj[instanceP].transaction_id ++; + g_ue_ral_obj[mod_id].transaction_id ++; } //--------------------------------------------------------------------------------------------------------------------- void mRAL_rx_rrc_ral_connection_release_indication(instance_t instanceP, MessageDef *msg_p) diff --git a/openair3/RAL-LTE/LTE_RAL_UE/SRC/lteRALue_subscribe.c b/openair3/RAL-LTE/LTE_RAL_UE/SRC/lteRALue_subscribe.c index 52b98f474c6..5963556554c 100755 --- a/openair3/RAL-LTE/LTE_RAL_UE/SRC/lteRALue_subscribe.c +++ b/openair3/RAL-LTE/LTE_RAL_UE/SRC/lteRALue_subscribe.c @@ -38,6 +38,7 @@ #define LTERALUE_SUBSCRIBE_C //----------------------------------------------------------------------------- #include "lteRALue.h" +#include "LAYER2/MAC/extern.h" /****************************************************************************/ /****************** E X P O R T E D F U N C T I O N S ******************/ /****************************************************************************/ @@ -60,15 +61,16 @@ ***************************************************************************/ void mRAL_subscribe_request(ral_ue_instance_t instanceP, MIH_C_Message_Link_Event_Subscribe_request_t* msgP) { + unsigned int mod_id = instanceP - NB_eNB_INST; MIH_C_STATUS_T status = MIH_C_STATUS_REJECTED; /* Check whether the action request is supported */ - if (g_ue_ral_obj[instanceP].mih_supported_link_command_list & MIH_C_BIT_LINK_EVENT_SUBSCRIBE) + if (g_ue_ral_obj[mod_id].mih_supported_link_command_list & MIH_C_BIT_LINK_EVENT_SUBSCRIBE) { MIH_C_LINK_EVENT_LIST_T mih_subscribed_req_event_list; - g_ue_ral_obj[instanceP].mih_subscribe_req_event_list |= (msgP->primitive.RequestedLinkEventList & g_ue_ral_obj[instanceP].mih_supported_link_event_list); + g_ue_ral_obj[mod_id].mih_subscribe_req_event_list |= (msgP->primitive.RequestedLinkEventList & g_ue_ral_obj[mod_id].mih_supported_link_event_list); - mih_subscribed_req_event_list = g_ue_ral_obj[instanceP].mih_subscribe_req_event_list & msgP->primitive.RequestedLinkEventList; + mih_subscribed_req_event_list = g_ue_ral_obj[mod_id].mih_subscribe_req_event_list & msgP->primitive.RequestedLinkEventList; status = MIH_C_STATUS_SUCCESS; @@ -103,16 +105,18 @@ void mRAL_subscribe_request(ral_ue_instance_t instanceP, MIH_C_Message_Link_Even void mRAL_unsubscribe_request(ral_ue_instance_t instanceP, MIH_C_Message_Link_Event_Unsubscribe_request_t* msgP) { MIH_C_STATUS_T status = MIH_C_STATUS_REJECTED; + unsigned int mod_id = instanceP - NB_eNB_INST; + /* Check whether the action request is supported */ - if (g_ue_ral_obj[instanceP].mih_supported_link_command_list & MIH_C_BIT_LINK_EVENT_UNSUBSCRIBE) + if (g_ue_ral_obj[mod_id].mih_supported_link_command_list & MIH_C_BIT_LINK_EVENT_UNSUBSCRIBE) { MIH_C_LINK_EVENT_LIST_T mih_unsubscribed_req_event_list; MIH_C_LINK_EVENT_LIST_T saved_req_event_list; - saved_req_event_list = g_ue_ral_obj[instanceP].mih_subscribe_req_event_list; + saved_req_event_list = g_ue_ral_obj[mod_id].mih_subscribe_req_event_list; - g_ue_ral_obj[instanceP].mih_subscribe_req_event_list &= ~(msgP->primitive.RequestedLinkEventList & g_ue_ral_obj[instanceP].mih_supported_link_event_list); - mih_unsubscribed_req_event_list = g_ue_ral_obj[instanceP].mih_subscribe_req_event_list ^ saved_req_event_list; + g_ue_ral_obj[mod_id].mih_subscribe_req_event_list &= ~(msgP->primitive.RequestedLinkEventList & g_ue_ral_obj[mod_id].mih_supported_link_event_list); + mih_unsubscribed_req_event_list = g_ue_ral_obj[mod_id].mih_subscribe_req_event_list ^ saved_req_event_list; status = MIH_C_STATUS_SUCCESS; diff --git a/openair3/RAL-LTE/LTE_RAL_UE/SRC/lteRALue_thresholds.c b/openair3/RAL-LTE/LTE_RAL_UE/SRC/lteRALue_thresholds.c index 88252c523ce..d873d371f6f 100755 --- a/openair3/RAL-LTE/LTE_RAL_UE/SRC/lteRALue_thresholds.c +++ b/openair3/RAL-LTE/LTE_RAL_UE/SRC/lteRALue_thresholds.c @@ -37,6 +37,7 @@ #define LTE_RAL_UE #define LTERALUE_THRESHOLDS_C //----------------------------------------------------------------------------- +#include "assertions.h" #include "lteRALue.h" @@ -62,6 +63,12 @@ void mRAL_configure_thresholds_request(ral_ue_instance_t instanceP, MIH_C_Messag unsigned int th_index; rrc_ral_configure_threshold_req_t configure_threshold_req; MessageDef *message_p; + MIH_C_STATUS_T status; + MIH_C_STATUS_T global_status; + int result; + MIH_C_LINK_CFG_STATUS_LIST_T link_configure_status_list; + + MIH_C_LINK_CFG_STATUS_LIST_init(&link_configure_status_list); message_p = itti_alloc_new_message (TASK_RAL_UE, RRC_RAL_CONFIGURE_THRESHOLD_REQ); @@ -70,8 +77,13 @@ void mRAL_configure_thresholds_request(ral_ue_instance_t instanceP, MIH_C_Messag // copy transaction id configure_threshold_req.transaction_id = msgP->header.transaction_id; + global_status = MIH_C_STATUS_SUCCESS; + // configure_threshold_req.num_link_cfg_params = 0; // done for (index = 0; index < msgP->primitive.LinkConfigureParameterList_list.length; index++) { + + status = MIH_C_STATUS_SUCCESS; + // copy link_param_type configure_threshold_req.link_cfg_params[index].link_param_type.choice = msgP->primitive.LinkConfigureParameterList_list.val[index].link_param_type.choice; switch (configure_threshold_req.link_cfg_params[index].link_param_type.choice) { @@ -91,8 +103,12 @@ void mRAL_configure_thresholds_request(ral_ue_instance_t instanceP, MIH_C_Messag sizeof(ral_link_param_lte_t)); break; default: - assert(1==0); + status = MIH_C_STATUS_UNSPECIFIED_FAILURE; + break; } + // at first error, exit + + configure_threshold_req.num_link_cfg_params += 1; // copy choice @@ -105,8 +121,12 @@ void mRAL_configure_thresholds_request(ral_ue_instance_t instanceP, MIH_C_Messag break; case RAL_LINK_CFG_PARAM_CHOICE_TIMER: configure_threshold_req.link_cfg_params[index]._union.timer_interval = msgP->primitive.LinkConfigureParameterList_list.val[index]._union.timer_interval; + break; default: - assert(1==0); + printf("ERROR RAL_UE, : mRAL_configure_thresholds_request unknown configure_threshold_req.link_cfg_params[index].union_choice %d\n", + configure_threshold_req.link_cfg_params[index].union_choice); + status = MIH_C_STATUS_UNSPECIFIED_FAILURE; + break; } // copy th_action @@ -117,12 +137,44 @@ void mRAL_configure_thresholds_request(ral_ue_instance_t instanceP, MIH_C_Messag configure_threshold_req.link_cfg_params[index].thresholds[th_index].threshold_val = msgP->primitive.LinkConfigureParameterList_list.val[index].threshold_list.val[th_index].threshold_val; configure_threshold_req.link_cfg_params[index].thresholds[th_index].threshold_xdir = msgP->primitive.LinkConfigureParameterList_list.val[index].threshold_list.val[th_index].threshold_xdir; configure_threshold_req.link_cfg_params[index].num_thresholds += 1; + + // Fill ConfigureThreshold_confirm + if (link_configure_status_list.length < MIH_C_LINK_CFG_STATUS_LIST_LENGTH) { + memcpy(&link_configure_status_list.val[link_configure_status_list.length].link_param_type, + &configure_threshold_req.link_cfg_params[index].link_param_type, + sizeof(ral_link_param_type_t)); + + memcpy(&link_configure_status_list.val[link_configure_status_list.length].threshold, + &msgP->primitive.LinkConfigureParameterList_list.val[index].threshold_list.val[th_index], + sizeof(ral_link_param_type_t)); + + link_configure_status_list.val[link_configure_status_list.length].config_status = status; + + link_configure_status_list.length += 1; + } else { + LOG_E(RAL_UE, "MIH_C_LINK_CFG_STATUS_LIST overflow for send_configure_thresholds_confirm\n"); + global_status = MIH_C_STATUS_UNSPECIFIED_FAILURE; + } } } + if (link_configure_status_list.length > 0) { + memcpy (&message_p->ittiMsg, (void *) &configure_threshold_req, sizeof(rrc_ral_configure_threshold_req_t)); + itti_send_msg_to_task (TASK_RRC_UE, instanceP, message_p); + + mRAL_send_configure_thresholds_confirm(instanceP, + &msgP->header.transaction_id, + &global_status, + &link_configure_status_list); + } else { + mRAL_send_configure_thresholds_confirm(instanceP, + &msgP->header.transaction_id, + &global_status, + NULL); - memcpy (&message_p->ittiMsg, (void *) &configure_threshold_req, sizeof(rrc_ral_configure_threshold_req_t)); - itti_send_msg_to_task (TASK_RRC_UE, instanceP, message_p); + result = itti_free (ITTI_MSG_ORIGIN_ID(message_p), message_p); + AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result); + } } //--------------------------------------------------------------------------------------------------------------------- -- GitLab