diff --git a/openair2/COMMON/s1ap_messages_types.h b/openair2/COMMON/s1ap_messages_types.h index bfceddb936..aa718dbcf8 100644 --- a/openair2/COMMON/s1ap_messages_types.h +++ b/openair2/COMMON/s1ap_messages_types.h @@ -273,6 +273,22 @@ typedef struct e_rab_setup_s { uint32_t gtp_teid; } e_rab_setup_t; +typedef struct e_rab_tobe_added_s { + /* Unique e_rab_id for the UE. */ + uint8_t e_rab_id; + + /* Unique drb_ID for the UE. */ + uint8_t drb_ID; + + /* The transport layer address for the IP packets */ + transport_layer_addr_t eNB_addr; + + /* S-GW Tunnel endpoint identifier */ + uint32_t gtp_teid; +} e_rab_tobe_added_t; + + + typedef struct e_rab_tobeswitched_s { /* Unique e_rab_id for the UE. */ uint8_t e_rab_id; diff --git a/openair2/COMMON/x2ap_messages_def.h b/openair2/COMMON/x2ap_messages_def.h index 6c2d56a942..ed33abfbfd 100644 --- a/openair2/COMMON/x2ap_messages_def.h +++ b/openair2/COMMON/x2ap_messages_def.h @@ -50,3 +50,6 @@ MESSAGE_DEF(X2AP_UE_CONTEXT_RELEASE , MESSAGE_PRIORITY_MED, x2ap_ue_ /*Senb bearer addition messages X2AP <-> RRC */ MESSAGE_DEF(X2AP_SENB_ADDITION_REQ , MESSAGE_PRIORITY_MED, x2ap_senb_addition_req_t , x2ap_senb_addition_req) + +/*SGnb bearer addition messages X2AP <-> RRC */ +MESSAGE_DEF(X2AP_ENDC_SGNB_ADDITION_REQ , MESSAGE_PRIORITY_MED, x2ap_ENDC_sgnb_addition_req_t , x2ap_ENDC_sgnb_addition_req) diff --git a/openair2/COMMON/x2ap_messages_types.h b/openair2/COMMON/x2ap_messages_types.h index 2ccab19071..3c429e930d 100644 --- a/openair2/COMMON/x2ap_messages_types.h +++ b/openair2/COMMON/x2ap_messages_types.h @@ -38,6 +38,7 @@ #define X2AP_UE_CONTEXT_RELEASE(mSGpTR) (mSGpTR)->ittiMsg.x2ap_ue_context_release #define X2AP_HANDOVER_CANCEL(mSGpTR) (mSGpTR)->ittiMsg.x2ap_handover_cancel #define X2AP_SENB_ADDITION_REQ(mSGpTR) (mSGpTR)->ittiMsg.x2ap_senb_addition_req +#define X2AP_ENDC_SGNB_ADDITION_REQ(mSGpTR) (mSGpTR)->ittiMsg.x2ap_ENDC_sgnb_addition_req #define X2AP_MAX_NB_ENB_IP_ADDRESS 2 @@ -286,7 +287,7 @@ typedef struct x2ap_senb_addition_req_ack_s { int MeNB_UE_X2_id; - int SeNB_UE_X2_id; + int SgNB_UE_X2_id; uint8_t nb_sCG_e_rabs_tobeadded; @@ -304,12 +305,15 @@ typedef struct x2ap_senb_addition_req_ack_s { } x2ap_senb_addition_req_ack_t; typedef struct x2ap_ENDC_sgnb_addition_req_s { + int ue_x2_id; + /* used for RRC->X2AP in source eNB */ int rnti; security_capabilities_t security_capabilities; - uint8_t kgnb[32]; // keNB or keNB* + /* SgNB Security Key */ + uint8_t kgnb[32]; /*next_hop_chaining_coun */ long int kgnb_ncc; @@ -317,10 +321,10 @@ typedef struct x2ap_ENDC_sgnb_addition_req_s { /* UE aggregate maximum bitrate */ ambr_t ue_ambr; - uint8_t nb_e_rabs_tobesetup; + uint8_t nb_e_rabs_tobeadded; - /* list of e_rab setup-ed by RRC layers */ - e_rab_setup_t e_rabs_tobesetup[S1AP_MAX_E_RAB]; + /* list of e_rab to be added by RRC layers */ + e_rab_tobe_added_t e_rabs_tobeadded[S1AP_MAX_E_RAB]; /* list of e_rab to be setup by RRC layers */ e_rab_t e_rab_param[S1AP_MAX_E_RAB]; @@ -331,7 +335,13 @@ typedef struct x2ap_ENDC_sgnb_addition_req_s { int rrc_buffer_size; int target_assoc_id; -} x2ap_ENDC_sgnb_addition_req__t; + + /*long int pDCPatSgNB = X2AP_EN_DC_ResourceConfiguration__pDCPatSgNB_present; + long int mCGresources = X2AP_EN_DC_ResourceConfiguration__mCGresources_not_present; + long int sCGresources = X2AP_EN_DC_ResourceConfiguration__sCGresources_not_present;*/ + + +} x2ap_ENDC_sgnb_addition_req_t; #endif /* X2AP_MESSAGES_TYPES_H_ */ diff --git a/openair2/X2AP/x2ap_eNB_generate_messages.c b/openair2/X2AP/x2ap_eNB_generate_messages.c index fa52c2a408..1d67b6e9be 100644 --- a/openair2/X2AP/x2ap_eNB_generate_messages.c +++ b/openair2/X2AP/x2ap_eNB_generate_messages.c @@ -1524,14 +1524,29 @@ int x2ap_eNB_generate_ENDC_x2_SgNB_addition_request( long qCI = 1; X2AP_Pre_emptionCapability_t pre_emptionCapability = X2AP_Pre_emptionCapability_shall_not_trigger_pre_emption; X2AP_Pre_emptionVulnerability_t pre_emptionVulnerability = X2AP_Pre_emptionVulnerability_not_pre_emptable; + priority_level_t priority_level = PRIORITY_LEVEL_NO_PRIORITY; e_rab_setup_t e_MCG_rabs_tobeadded; e_MCG_rabs_tobeadded.gtp_teid = 0; e_MCG_rabs_tobeadded.eNB_addr.length = 24; uint8_t buf[20] = { 0 }; memcpy(e_MCG_rabs_tobeadded.eNB_addr.buffer, buf, 20*sizeof(uint8_t)); - OCTET_STRING_t CG_Config_Info; + + FILE *fd; + fd = fopen("uecap.raw","r"); + if (fd != NULL) { + OCTET_STRING_t CG_Config_Info; + CG_Config_Info.size = 4096; + CG_Config_Info.buf = (uint8_t *)calloc(4096, sizeof(uint8_t)); + int msg_len=fread(CG_Config_Info.buf,1,CG_Config_Info.size,fd); + + /*char buffer[4096]; + int msg_len=fread(buffer,1,4096,fd);*/ + LOG_I(RRC,"Read in %d bytes for uecap\n",msg_len); + + + /*OCTET_STRING_t CG_Config_Info; CG_Config_Info.size = 4096; - CG_Config_Info.buf = (uint8_t *)calloc(4096, sizeof(uint8_t)); + CG_Config_Info.buf = (uint8_t *)calloc(4096, sizeof(uint8_t));*/ DevAssert(instance_p != NULL); @@ -1608,7 +1623,8 @@ int x2ap_eNB_generate_ENDC_x2_SgNB_addition_request( e_RABS_ToBeAdded_SgNBAddReq_Item->resource_configuration.choice.sgNBPDCPpresent.full_E_RAB_Level_QoS_Parameters.qCI = qCI; e_RABS_ToBeAdded_SgNBAddReq_Item->resource_configuration.choice.sgNBPDCPpresent.full_E_RAB_Level_QoS_Parameters.allocationAndRetentionPriority.pre_emptionCapability = pre_emptionCapability; - e_RABS_ToBeAdded_SgNBAddReq_Item->resource_configuration.choice.sgNBPDCPpresent.full_E_RAB_Level_QoS_Parameters.allocationAndRetentionPriority.pre_emptionVulnerability = pre_emptionVulnerability; + e_RABS_ToBeAdded_SgNBAddReq_Item->resource_configuration.choice.sgNBPDCPpresent.full_E_RAB_Level_QoS_Parameters.allocationAndRetentionPriority. pre_emptionVulnerability = pre_emptionVulnerability; + e_RABS_ToBeAdded_SgNBAddReq_Item->resource_configuration.choice.sgNBPDCPpresent.full_E_RAB_Level_QoS_Parameters.allocationAndRetentionPriority.priorityLevel = priority_level; //Continue from filling the UL_GTPtunnelEndpointInformation inspired from how it is done for the HO case INT32_TO_OCTET_STRING(e_MCG_rabs_tobeadded.gtp_teid, &e_RABS_ToBeAdded_SgNBAddReq_Item->resource_configuration.choice.sgNBPDCPpresent.s1_UL_GTPtunnelEndpoint.gTP_TEID); @@ -1644,6 +1660,12 @@ int x2ap_eNB_generate_ENDC_x2_SgNB_addition_request( MSC_LOG_TX_MESSAGE (MSC_X2AP_SRC_ENB, MSC_X2AP_TARGET_ENB, NULL, 0, "0 X2Setup/initiatingMessage assoc_id %u", x2ap_eNB_data_p->assoc_id); x2ap_eNB_itti_send_sctp_data_req(instance_p->instance, x2ap_eNB_data_p->assoc_id, buffer, len, 0); + fclose(fd); + } + else { + LOG_I(RRC, "uecap.raw file could not be opened... \n"); + return -1; + } return ret; diff --git a/openair2/X2AP/x2ap_eNB_handler.c b/openair2/X2AP/x2ap_eNB_handler.c index ae6dd6c5da..a39bb29737 100644 --- a/openair2/X2AP/x2ap_eNB_handler.c +++ b/openair2/X2AP/x2ap_eNB_handler.c @@ -1470,8 +1470,8 @@ x2ap_eNB_handle_ENDC_x2_setup_request(instance_t instance, instance_p = x2ap_eNB_get_instance(instance); DevAssert(instance_p != NULL); - return x2ap_eNB_generate_ENDC_x2_setup_response(instance_p, x2ap_eNB_data); - //return x2ap_eNB_generate_ENDC_x2_SgNB_addition_request(instance_p, x2ap_eNB_data,0); + //return x2ap_eNB_generate_ENDC_x2_setup_response(instance_p, x2ap_eNB_data); + return x2ap_eNB_generate_ENDC_x2_SgNB_addition_request(instance_p, x2ap_eNB_data,0); } @@ -1632,7 +1632,7 @@ int x2ap_gNB_handle_ENDC_sGNB_addition_request (instance_t instance, X2AP_X2AP_PDU_t *pdu) { - /* + X2AP_SgNBAdditionRequest_t *x2SgNBAdditionRequest; X2AP_SgNBAdditionRequest_IEs_t *ie; @@ -1662,8 +1662,9 @@ int x2ap_gNB_handle_ENDC_sGNB_addition_request (instance_t instance, DevAssert(instance_p != NULL); //Allocate an ITTI X2AP_SGNB_ADDITION_REQ message instead - //msg = itti_alloc_new_message(TASK_X2AP, X2AP_HANDOVER_REQ); + msg = itti_alloc_new_message(TASK_X2AP, X2AP_ENDC_SGNB_ADDITION_REQ); + /* X2AP_ProtocolIE_ID_id_MeNB_UE_X2AP_ID */ X2AP_FIND_PROTOCOLIE_BY_ID(X2AP_SgNBAdditionRequest_IEs_t, ie, x2SgNBAdditionRequest, X2AP_ProtocolIE_ID_id_MeNB_UE_X2AP_ID, true); if (ie == NULL ) { @@ -1671,6 +1672,7 @@ int x2ap_gNB_handle_ENDC_sGNB_addition_request (instance_t instance, return -1; } + // allocate a new X2AP UE ID ue_id = x2ap_allocate_new_id(&instance_p->id_manager); if (ue_id == -1) { @@ -1679,74 +1681,73 @@ int x2ap_gNB_handle_ENDC_sGNB_addition_request (instance_t instance, exit(1); } // rnti is unknown yet, must not be set to -1, 0 is fine - x2ap_set_ids(&instance_p->id_manager, ue_id, 0, ie->value.choice.SgNB_UE_X2AP_ID, ue_id); + x2ap_set_ids(&instance_p->id_manager, ue_id, 0, ie->value.choice.UE_X2AP_ID, ue_id); x2ap_id_set_state(&instance_p->id_manager, ue_id, X2ID_STATE_TARGET); - X2AP_HANDOVER_REQ(msg).x2_id = ue_id; + X2AP_ENDC_SGNB_ADDITION_REQ(msg).ue_x2_id = ue_id; - //X2AP_HANDOVER_REQ(msg).target_physCellId = measResults2->measResultNeighCells->choice. - //measResultListEUTRA.list.array[ncell_index]->physCellId; - X2AP_FIND_PROTOCOLIE_BY_ID(X2AP_HandoverRequest_IEs_t, ie, x2HandoverRequest, - X2AP_ProtocolIE_ID_id_GUMMEI_ID, true); - TBCD_TO_MCC_MNC(&ie->value.choice.ECGI.pLMN_Identity, X2AP_HANDOVER_REQ(msg).ue_gummei.mcc, - X2AP_HANDOVER_REQ(msg).ue_gummei.mnc, X2AP_HANDOVER_REQ(msg).ue_gummei.mnc_len); - OCTET_STRING_TO_INT8(&ie->value.choice.GUMMEI.mME_Code, X2AP_HANDOVER_REQ(msg).ue_gummei.mme_code); - OCTET_STRING_TO_INT16(&ie->value.choice.GUMMEI.gU_Group_ID.mME_Group_ID, X2AP_HANDOVER_REQ(msg).ue_gummei.mme_group_id); + /* X2AP_ProtocolIE_ID_id_NRUESecurityCapabilities */ + X2AP_FIND_PROTOCOLIE_BY_ID(X2AP_SgNBAdditionRequest_IEs_t, ie, x2SgNBAdditionRequest, + X2AP_ProtocolIE_ID_id_NRUESecurityCapabilities, true); - X2AP_FIND_PROTOCOLIE_BY_ID(X2AP_HandoverRequest_IEs_t, ie, x2HandoverRequest, - X2AP_ProtocolIE_ID_id_UE_ContextInformation, true); + X2AP_ENDC_SGNB_ADDITION_REQ(msg).security_capabilities.encryption_algorithms = + BIT_STRING_to_uint16(&ie->value.choice.NRUESecurityCapabilities.nRencryptionAlgorithms); - if (ie == NULL ) { - X2AP_ERROR("%s %d: ie is a NULL pointer \n",__FILE__,__LINE__); - return -1; - } + X2AP_ENDC_SGNB_ADDITION_REQ(msg).security_capabilities.integrity_algorithms = + BIT_STRING_to_uint16(&ie->value.choice.NRUESecurityCapabilities.nRintegrityProtectionAlgorithms); - X2AP_HANDOVER_REQ(msg).mme_ue_s1ap_id = ie->value.choice.UE_ContextInformation.mME_UE_S1AP_ID; + /* X2AP_ProtocolIE_ID_id_SgNBSecurityKey */ + X2AP_FIND_PROTOCOLIE_BY_ID(X2AP_SgNBAdditionRequest_IEs_t, ie, x2SgNBAdditionRequest, + X2AP_ProtocolIE_ID_id_SgNBSecurityKey, true); - // TODO: properly store Target Cell ID + if ((ie->value.choice.SgNBSecurityKey.buf) && + (ie->value.choice.SgNBSecurityKey.size == 32)) { + memcpy(X2AP_ENDC_SGNB_ADDITION_REQ(msg).kgnb, ie->value.choice.SgNBSecurityKey.buf, 32); + } else { + X2AP_WARN ("Size of eNB key star does not match the expected value\n"); + } - X2AP_HANDOVER_REQ(msg).target_assoc_id = assoc_id; - X2AP_HANDOVER_REQ(msg).security_capabilities.encryption_algorithms = - BIT_STRING_to_uint16(&ie->value.choice.UE_ContextInformation.uESecurityCapabilities.encryptionAlgorithms); - X2AP_HANDOVER_REQ(msg).security_capabilities.integrity_algorithms = - BIT_STRING_to_uint16(&ie->value.choice.UE_ContextInformation.uESecurityCapabilities.integrityProtectionAlgorithms); + /* X2AP_ProtocolIE_ID_id_SgNBUEAggregateMaximumBitRate */ + X2AP_FIND_PROTOCOLIE_BY_ID(X2AP_SgNBAdditionRequest_IEs_t, ie, x2SgNBAdditionRequest, + X2AP_ProtocolIE_ID_id_SgNBUEAggregateMaximumBitRate, true); - //X2AP_HANDOVER_REQ(msg).ue_ambr=ue_context_pP->ue_context.ue_ambr; + //X2AP_ENDC_SGNB_ADDITION_REQ(msg).ue_ambr.br_dl =ie->value.choice.UEAggregateMaximumBitRate.uEaggregateMaximumBitRateDownlink; + //X2AP_ENDC_SGNB_ADDITION_REQ(msg).ue_ambr.br_ul = ie->value.choice.UEAggregateMaximumBitRate.uEaggregateMaximumBitRateUplink; - if ((ie->value.choice.UE_ContextInformation.aS_SecurityInformation.key_eNodeB_star.buf) && - (ie->value.choice.UE_ContextInformation.aS_SecurityInformation.key_eNodeB_star.size == 32)) { - memcpy(X2AP_HANDOVER_REQ(msg).kenb, ie->value.choice.UE_ContextInformation.aS_SecurityInformation.key_eNodeB_star.buf, 32); - X2AP_HANDOVER_REQ(msg).kenb_ncc = ie->value.choice.UE_ContextInformation.aS_SecurityInformation.nextHopChainingCount; - } else { - X2AP_WARN ("Size of eNB key star does not match the expected value\n"); - } + /* X2AP_ProtocolIE_ID_id_E_RABs_ToBeAdded_SgNBAddReqList */ + X2AP_FIND_PROTOCOLIE_BY_ID(X2AP_SgNBAdditionRequest_IEs_t, ie, x2SgNBAdditionRequest, + X2AP_ProtocolIE_ID_id_E_RABs_ToBeAdded_SgNBAddReqList, true); - if (ie->value.choice.UE_ContextInformation.e_RABs_ToBeSetup_List.list.count > 0) { - X2AP_HANDOVER_REQ(msg).nb_e_rabs_tobesetup = ie->value.choice.UE_ContextInformation.e_RABs_ToBeSetup_List.list.count; + if (ie->value.choice.E_RABs_ToBeAdded_SgNBAddReqList.list.count > 0) { - for (int i=0;ivalue.choice.UE_ContextInformation.e_RABs_ToBeSetup_List.list.count;i++) { - e_RABS_ToBeSetup_ItemIEs = (X2AP_E_RABs_ToBeSetup_ItemIEs_t *) ie->value.choice.UE_ContextInformation.e_RABs_ToBeSetup_List.list.array[i]; - e_RABs_ToBeSetup_Item = &e_RABS_ToBeSetup_ItemIEs->value.choice.E_RABs_ToBeSetup_Item; + X2AP_ENDC_SGNB_ADDITION_REQ(msg).nb_e_rabs_tobeadded = ie->value.choice.E_RABs_ToBeAdded_SgNBAddReqList.list.count; - X2AP_HANDOVER_REQ(msg).e_rabs_tobesetup[i].e_rab_id = e_RABs_ToBeSetup_Item->e_RAB_ID ; + for (int i=0;ivalue.choice.E_RABs_ToBeAdded_SgNBAddReqList.list.count;i++) { + e_RABS_ToBeAdded_SgNBAddReq_ItemIEs = (X2AP_E_RABs_ToBeAdded_SgNBAddReq_ItemIEs_t *) ie->value.choice.E_RABs_ToBeAdded_SgNBAddReqList.list.array[i]; + e_RABS_ToBeAdded_SgNBAddReq_Item = &e_RABS_ToBeAdded_SgNBAddReq_ItemIEs->value.choice.E_RABs_ToBeAdded_SgNBAddReq_Item; - memcpy(X2AP_HANDOVER_REQ(msg).e_rabs_tobesetup[i].eNB_addr.buffer, - e_RABs_ToBeSetup_Item->uL_GTPtunnelEndpoint.transportLayerAddress.buf, - e_RABs_ToBeSetup_Item->uL_GTPtunnelEndpoint.transportLayerAddress.size); + X2AP_ENDC_SGNB_ADDITION_REQ(msg).e_rabs_tobeadded[i].e_rab_id = e_RABS_ToBeAdded_SgNBAddReq_Item->e_RAB_ID ; + X2AP_ENDC_SGNB_ADDITION_REQ(msg).e_rabs_tobeadded[i].drb_ID = e_RABS_ToBeAdded_SgNBAddReq_Item->drb_ID; + if(e_RABS_ToBeAdded_SgNBAddReq_Item->en_DC_ResourceConfiguration.pDCPatSgNB == X2AP_EN_DC_ResourceConfiguration__pDCPatSgNB_present){ + X2AP_ENDC_SGNB_ADDITION_REQ(msg).e_rab_param[i].qos.qci = e_RABS_ToBeAdded_SgNBAddReq_Item->resource_configuration.choice.sgNBPDCPpresent.full_E_RAB_Level_QoS_Parameters.qCI; + X2AP_ENDC_SGNB_ADDITION_REQ(msg).e_rab_param[i].qos.allocation_retention_priority.pre_emp_vulnerability = e_RABS_ToBeAdded_SgNBAddReq_Item->resource_configuration.choice.sgNBPDCPpresent.full_E_RAB_Level_QoS_Parameters.allocationAndRetentionPriority.pre_emptionVulnerability; + X2AP_ENDC_SGNB_ADDITION_REQ(msg).e_rab_param[i].qos.allocation_retention_priority.pre_emp_capability = e_RABS_ToBeAdded_SgNBAddReq_Item->resource_configuration.choice.sgNBPDCPpresent.full_E_RAB_Level_QoS_Parameters.allocationAndRetentionPriority.pre_emptionCapability; + X2AP_ENDC_SGNB_ADDITION_REQ(msg).e_rab_param[i].qos.allocation_retention_priority.priority_level = e_RABS_ToBeAdded_SgNBAddReq_Item->resource_configuration.choice.sgNBPDCPpresent.full_E_RAB_Level_QoS_Parameters.allocationAndRetentionPriority.priorityLevel; - X2AP_HANDOVER_REQ(msg).e_rabs_tobesetup[i].eNB_addr.length = - e_RABs_ToBeSetup_Item->uL_GTPtunnelEndpoint.transportLayerAddress.size * 8 - e_RABs_ToBeSetup_Item->uL_GTPtunnelEndpoint.transportLayerAddress.bits_unused; + memcpy(X2AP_ENDC_SGNB_ADDITION_REQ(msg).e_rabs_tobeadded[i].eNB_addr.buffer, + e_RABS_ToBeAdded_SgNBAddReq_Item->resource_configuration.choice.sgNBPDCPpresent.s1_UL_GTPtunnelEndpoint.transportLayerAddress.buf, + e_RABS_ToBeAdded_SgNBAddReq_Item->resource_configuration.choice.sgNBPDCPpresent.s1_UL_GTPtunnelEndpoint.transportLayerAddress.size); - OCTET_STRING_TO_INT32(&e_RABs_ToBeSetup_Item->uL_GTPtunnelEndpoint.gTP_TEID, - X2AP_HANDOVER_REQ(msg).e_rabs_tobesetup[i].gtp_teid); + X2AP_ENDC_SGNB_ADDITION_REQ(msg).e_rabs_tobeadded[i].eNB_addr.length = + e_RABS_ToBeAdded_SgNBAddReq_Item->resource_configuration.choice.sgNBPDCPpresent.s1_UL_GTPtunnelEndpoint.transportLayerAddress.size * 8 - e_RABS_ToBeAdded_SgNBAddReq_Item->resource_configuration.choice.sgNBPDCPpresent.s1_UL_GTPtunnelEndpoint.transportLayerAddress.bits_unused; + + OCTET_STRING_TO_INT32(&e_RABS_ToBeAdded_SgNBAddReq_Item->resource_configuration.choice.sgNBPDCPpresent.s1_UL_GTPtunnelEndpoint.gTP_TEID, + X2AP_ENDC_SGNB_ADDITION_REQ(msg).e_rabs_tobeadded[i].gtp_teid); + } - X2AP_HANDOVER_REQ(msg).e_rab_param[i].qos.qci = e_RABs_ToBeSetup_Item->e_RAB_Level_QoS_Parameters.qCI; - X2AP_HANDOVER_REQ(msg).e_rab_param[i].qos.allocation_retention_priority.priority_level = e_RABs_ToBeSetup_Item->e_RAB_Level_QoS_Parameters.allocationAndRetentionPriority.priorityLevel; - X2AP_HANDOVER_REQ(msg).e_rab_param[i].qos.allocation_retention_priority.pre_emp_capability = e_RABs_ToBeSetup_Item->e_RAB_Level_QoS_Parameters.allocationAndRetentionPriority.pre_emptionCapability; - X2AP_HANDOVER_REQ(msg).e_rab_param[i].qos.allocation_retention_priority.pre_emp_vulnerability = e_RABs_ToBeSetup_Item->e_RAB_Level_QoS_Parameters.allocationAndRetentionPriority.pre_emptionVulnerability; } } @@ -1754,15 +1755,20 @@ int x2ap_gNB_handle_ENDC_sGNB_addition_request (instance_t instance, X2AP_ERROR ("Can't decode the e_RABs_ToBeSetup_List \n"); } - X2AP_RRC_Context_t *c = &ie->value.choice.UE_ContextInformation.rRC_Context; + /* X2AP_ProtocolIE_ID_id_MeNBtoSgNBContainer */ + X2AP_FIND_PROTOCOLIE_BY_ID(X2AP_SgNBAdditionRequest_IEs_t, ie, x2SgNBAdditionRequest, + X2AP_ProtocolIE_ID_id_MeNBtoSgNBContainer, true); - if (c->size > 8192 ) // TODO: this is the size of rrc_buffer in struct x2ap_handover_req_s - { printf("%s:%d: fatal: buffer too big\n", __FILE__, __LINE__); abort(); } + X2AP_MeNBtoSgNBContainer_t *container = &ie->value.choice.MeNBtoSgNBContainer; - memcpy(X2AP_HANDOVER_REQ(msg).rrc_buffer, c->buf, c->size); - X2AP_HANDOVER_REQ(msg).rrc_buffer_size = c->size; + if (ie->value.choice.MeNBtoSgNBContainer.size > 8192 ) // TODO: this is the size of rrc_buffer in struct x2ap_handover_req_s + { printf("%s:%d: fatal: buffer too big\n", __FILE__, __LINE__); abort(); } - itti_send_msg_to_task(TASK_RRC_ENB, instance_p->instance, msg);*/ + memcpy(X2AP_ENDC_SGNB_ADDITION_REQ(msg).rrc_buffer, ie->value.choice.MeNBtoSgNBContainer.buf, ie->value.choice.MeNBtoSgNBContainer.size); + X2AP_ENDC_SGNB_ADDITION_REQ(msg).rrc_buffer_size = ie->value.choice.MeNBtoSgNBContainer.size; + + + //itti_send_msg_to_task(TASK_RRC_ENB, instance_p->instance, msg); return 0; }