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 6b64beb9c0821925796fa558a93dcbb2a34eddc3..e913ce6a85b93aa1ffb8d7e3073882d6103c6357 100755 --- a/openair3/RAL-LTE/LTE_RAL_UE/INCLUDE/lteRALue_constants.h +++ b/openair3/RAL-LTE/LTE_RAL_UE/INCLUDE/lteRALue_constants.h @@ -37,13 +37,13 @@ #ifndef __LTERALUE_CONSTANTS_H__ #define __LTERALUE_CONSTANTS_H__ //----------------------------------------------------------------------------- -#define UE_DEFAULT_LOCAL_PORT_RAL "1335" -#define UE_DEFAULT_REMOTE_PORT_MIHF "1125" +#define UE_DEFAULT_LOCAL_PORT_RAL "1234" +#define UE_DEFAULT_REMOTE_PORT_MIHF "1025" #define UE_DEFAULT_IP_ADDRESS_MIHF "127.0.0.1" #define UE_DEFAULT_IP_ADDRESS_RAL "127.0.0.1" #define UE_DEFAULT_LINK_ID_RAL "ue_lte_link" #define UE_DEFAULT_LINK_ADDRESS_RAL "060080149150" -#define UE_DEFAULT_MIHF_ID "mihf_ue" +#define UE_DEFAULT_MIHF_ID "mihf2_ue" #define DEFAULT_ADDRESS_3GPP "0335060080149150" #define DEFAULT_ADDRESS_eNB "0000000000000001" diff --git a/openair3/RAL-LTE/LTE_RAL_UE/INCLUDE/lteRALue_main.h b/openair3/RAL-LTE/LTE_RAL_UE/INCLUDE/lteRALue_main.h index b2e49b93c2fb66c12148adffb67a34ecb137be8f..ca1267d403bd99edc4cdf3a3011e519f11ad49aa 100755 --- a/openair3/RAL-LTE/LTE_RAL_UE/INCLUDE/lteRALue_main.h +++ b/openair3/RAL-LTE/LTE_RAL_UE/INCLUDE/lteRALue_main.h @@ -103,10 +103,11 @@ typedef struct lte_ral_ue_object_s { // network parameters - u16 cell_id; - u16 nas_state; + u16 cell_id; + plmn_t plmn_id; + //u16 nas_state; int state; - u32 curr_signal_level; + //u32 curr_signal_level; u32 ipv6_l2id[2]; //measures u8 req_num_bs; 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 ae86554e310cddbc6025e11f5163c01fcd10e9e4..b5dc629349e609e652d88f18fb8fe32a23ad7285 100755 --- a/openair3/RAL-LTE/LTE_RAL_UE/SRC/lteRALue_main.c +++ b/openair3/RAL-LTE/LTE_RAL_UE/SRC/lteRALue_main.c @@ -225,8 +225,8 @@ 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 | \ - MIH_C_BIT_LINK_GET_PARAMETERS | MIH_C_BIT_LINK_CONFIGURE_THRESHOLDS | \ + g_ue_ral_obj[instance].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; @@ -325,6 +325,11 @@ void* mRAL_task(void *args_p) { mRAL_rx_rrc_ral_connection_reconfiguration_indication(instance, msg_p); break; + case RRC_RAL_CONNECTION_RECONFIGURATION_HO_IND: + LOG_D(RAL_UE, "Received %s\n", msg_name); + //mRAL_rx_rrc_ral_connection_reconfiguration_ho_indication(instance, msg_p); + break; + case RRC_RAL_MEASUREMENT_REPORT_IND: LOG_D(RAL_UE, "Received %s\n", msg_name); mRAL_rx_rrc_ral_measurement_report_indication(instance, msg_p); @@ -343,7 +348,7 @@ void* mRAL_task(void *args_p) { LOG_E(RAL_UE, "Received unexpected message %s\n", msg_name); break; } - free(msg_p); + itti_free (ITTI_MSG_ORIGIN_ID(msg_p), msg_p); msg_p = NULL; } nb_events = itti_get_events(TASK_RAL_UE, &events); 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 83c4d51f3cdbc1db94f8cbc4cd58a8ca6606d145..5e7a50003e2d62eda15fb1802e92cab3194a703c 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 @@ -212,7 +212,7 @@ void mRAL_send_link_register_indication(ral_ue_instance_t instanceP, 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)); - message.primitive.Link_Id.link_type = MIH_C_WIRELESS_UMTS; + message.primitive.Link_Id.link_type = MIH_C_WIRELESS_LTE; //MIH_C_WIRELESS_UMTS; 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)); @@ -228,8 +228,10 @@ void mRAL_send_link_register_indication(ral_ue_instance_t instanceP, #endif if (mRAL_send_to_mih(instanceP, bb->m_buffer,message_total_length)<0){ + printf("ERROR RAL_UE, : Send Link_Register.indication\n"); LOG_E(RAL_UE, ": Send Link_Register.indication\n"); } else { + printf("OK RAL_UE, : Send Link_Register.indication\n"); LOG_D(RAL_UE, ": Sent Link_Register.indication\n"); } free_BitBuffer(bb); 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 d9b8051ee3cdfce3e8a019a1988928ac1ccd829f..f998509b3b812c78cabdb5407c9c1373eb8acd88 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 @@ -37,20 +37,27 @@ void mRAL_rx_rrc_ral_system_information_indication(instance_t instanceP, Message //--------------------------------------------------------------------------------------------------------------------- { MIH_C_LINK_DET_INFO_T link_det_info; + int i; - + memset(&link_det_info, 0, sizeof(MIH_C_LINK_DET_INFO_T)); // link id link_det_info.link_tuple_id.link_id.link_type = MIH_C_WIRELESS_LTE; 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.choice = MIH_C_CHOICE_3GPP_3G_CELL_ID; 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; + LOG_D(RAL_UE, "PLMN ID %d.%d.%d\n", link_det_info.link_tuple_id.link_id.link_addr._union._3gpp_3g_cell_id.plmn_id.val[0], + 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); MIH_C_NETWORK_ID_set(&link_det_info.network_id, (u_int8_t *)PREDEFINED_MIH_NETWORK_ID, strlen(PREDEFINED_MIH_NETWORK_ID)); @@ -82,9 +89,25 @@ void mRAL_rx_rrc_ral_connection_establishment_indication(instance_t instanceP, M uint64_t ue_id; //EUI-64 int i; + 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; - link_tuple_id.link_id.link_addr.choice = MIH_C_CHOICE_3GPP_ADDR; + + + // TEST + 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; + // 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 + + 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; @@ -97,6 +120,7 @@ void mRAL_rx_rrc_ral_connection_establishment_indication(instance_t instanceP, M //The optional LINK_ADDR may contains a link address of PoA. link_tuple_id.choice = MIH_C_LINK_TUPLE_ID_CHOICE_NULL; +*/ mRAL_send_link_up_indication(instanceP, &g_ue_ral_obj[instanceP].transaction_id, &link_tuple_id, @@ -118,7 +142,21 @@ void mRAL_rx_rrc_ral_connection_reestablishment_indication(instance_t instanceP, uint64_t ue_id; //EUI-64 int i; - // The LINK_ID contains the MN LINK_ADDR + memset(&link_tuple_id, 0, sizeof(MIH_C_LINK_TUPLE_ID_T)); + 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; + // 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 + + 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); @@ -133,7 +171,7 @@ void mRAL_rx_rrc_ral_connection_reestablishment_indication(instance_t instanceP, //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, @@ -155,7 +193,63 @@ void mRAL_rx_rrc_ral_connection_reestablishment_indication(instance_t instanceP, 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; + memset(&link_tuple_id, 0, sizeof(MIH_C_LINK_TUPLE_ID_T)); + 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; + // 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 + + 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); + + //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, + &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. + } 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, + &link_tuple_id, + NULL, + &reason_code); + } + g_ue_ral_obj[instanceP].transaction_id ++; } //--------------------------------------------------------------------------------------------------------------------- void mRAL_rx_rrc_ral_connection_release_indication(instance_t instanceP, MessageDef *msg_p)