X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2Fcu_stub%2Fcu_f1ap_msg_hdl.c;h=1b256b43a37d7cfd6a009be0a537ea26daeb1765;hb=ed6746a6081339633c3baa314251fcc11b98ce10;hp=6c23d0f055759376ffea6c0fa12a24470c03fb23;hpb=66916eaaf8212d36b38e4dba88bdf159d7637779;p=o-du%2Fl2.git diff --git a/src/cu_stub/cu_f1ap_msg_hdl.c b/src/cu_stub/cu_f1ap_msg_hdl.c index 6c23d0f05..1b256b43a 100644 --- a/src/cu_stub/cu_f1ap_msg_hdl.c +++ b/src/cu_stub/cu_f1ap_msg_hdl.c @@ -27,6 +27,17 @@ #include #include "ProtocolExtensionField.h" #include "F1AP-PDU.h" +#include "ModulationOrder.h" +#include "BandNR.h" +#include "UE-CapabilityRAT-Container.h" +#include "UE-CapabilityRAT-ContainerList.h" +#include "UE-CapabilityRAT-ContainerListRRC.h" +#include "SupportedBandwidth.h" +#include "FeatureSetUplinkPerCC.h" +#include "FeatureSetDownlinkPerCC.h" +#include "FeatureSets.h" +#include "RF-Parameters.h" +#include "UE-NR-Capability.h" #include "ProtocolExtensionContainer.h" #include "CellGroupConfigRrc.h" #include "MAC-CellGroupConfig.h" @@ -1512,7 +1523,7 @@ uint8_t fillDlDcchRrcMsg(RRCContainer_t *rrcContainer) uint8_t BuildDLRRCContainer(uint8_t rrcMsgType, RRCContainer_t *rrcContainer) { - uint8_t ret, idx2, bufLen; + uint8_t ret, bufLen; ret =ROK; if(rrcMsgType == RRC_SETUP) @@ -1530,11 +1541,8 @@ uint8_t BuildDLRRCContainer(uint8_t rrcMsgType, RRCContainer_t *rrcContainer) CU_ALLOC(rrcContainer->buf, rrcContainer->size); if(rrcContainer->buf != NULLP) { - memset(rrcContainer->buf, 0, encBufSize); - for(idx2 = 0; idx2 < encBufSize; idx2++) - { - rrcContainer->buf[idx2] = buf[idx2]; - } + memset(rrcContainer->buf, 0, bufLen); + memcpy(rrcContainer->buf, buf, bufLen); } } else if(rrcMsgType == RRC_RECONFIG) @@ -1559,11 +1567,8 @@ uint8_t BuildDLRRCContainer(uint8_t rrcMsgType, RRCContainer_t *rrcContainer) CU_ALLOC(rrcContainer->buf, rrcContainer->size); if(rrcContainer->buf != NULLP) { - memset(rrcContainer->buf, 0, encBufSize); - for(idx2 = 0; idx2 < encBufSize; idx2++) - { - rrcContainer->buf[idx2] = buf[idx2]; - } + memset(rrcContainer->buf, 0, bufLen); + memcpy(rrcContainer->buf, buf, bufLen); } } @@ -1751,6 +1756,9 @@ uint8_t setDlRRCMsgType() case UE_CONTEXT_SETUP_REQ: rrcMsgType = UE_CONTEXT_SETUP_REQ; break; + case SECURITY_MODE_COMPLETE: + rrcMsgType = SECURITY_MODE_COMPLETE; + break; case RRC_RECONFIG: rrcMsgType = RRC_RECONFIG; break; @@ -5604,6 +5612,452 @@ uint8_t fillCellGrpCfg(CellGroupConfig_t *cellGrp) return ROK; } +/******************************************************************* + * + * @brief Free UE Capability RAT container + * + * @details + * + * Function : freeUeCapRatCont + * + * Functionality: + * Free UE Capability RAT conatiner + * + * @params[in] + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +void freeUeCapRatCont(UE_NR_Capability_t *ueNrCap) +{ + uint8_t idx; + FeatureSets_t *featureSets; + + if(ueNrCap->rf_Parameters.supportedBandListNR.list.array) + { + for(idx = 0; idx < ueNrCap->rf_Parameters.supportedBandListNR.list.count; idx++) + { + if(ueNrCap->rf_Parameters.supportedBandListNR.list.array[idx]) + CU_FREE(ueNrCap->rf_Parameters.supportedBandListNR.list.array[idx], sizeof(struct BandNR)); + } + CU_FREE(ueNrCap->rf_Parameters.supportedBandListNR.list.array, ueNrCap->rf_Parameters.supportedBandListNR.list.size); + } + + if(ueNrCap->featureSets) + { + featureSets = ueNrCap->featureSets; + if(featureSets->featureSetsDownlinkPerCC) + { + if(featureSets->featureSetsDownlinkPerCC->list.array) + { + for(idx = 0; idx < featureSets->featureSetsDownlinkPerCC->list.count; idx++) + { + if(featureSets->featureSetsDownlinkPerCC->list.array[idx]->supportedModulationOrderDL) + CU_FREE(featureSets->featureSetsDownlinkPerCC->list.array[idx]->supportedModulationOrderDL, \ + sizeof(ModulationOrder_t)); + CU_FREE(featureSets->featureSetsDownlinkPerCC->list.array[idx], sizeof(struct FeatureSetDownlinkPerCC)); + } + CU_FREE(featureSets->featureSetsDownlinkPerCC->list.array, featureSets->featureSetsDownlinkPerCC->list.size); + } + CU_FREE(featureSets->featureSetsDownlinkPerCC, sizeof(struct FeatureSets__featureSetsDownlinkPerCC)); + } + + if(featureSets->featureSetsUplinkPerCC) + { + if(featureSets->featureSetsUplinkPerCC->list.array) + { + for(idx = 0; idx < featureSets->featureSetsUplinkPerCC->list.count; idx++) + { + if(featureSets->featureSetsUplinkPerCC->list.array[idx]) + { + if(featureSets->featureSetsUplinkPerCC->list.array[idx]->supportedModulationOrderUL) + CU_FREE(featureSets->featureSetsUplinkPerCC->list.array[idx]->supportedModulationOrderUL,\ + sizeof(ModulationOrder_t)); + CU_FREE(featureSets->featureSetsUplinkPerCC->list.array[idx], sizeof(struct FeatureSetUplinkPerCC)); + } + } + CU_FREE(featureSets->featureSetsUplinkPerCC->list.array, featureSets->featureSetsUplinkPerCC->list.size); + } + CU_FREE(featureSets->featureSetsUplinkPerCC, sizeof(struct FeatureSets__featureSetsUplinkPerCC)); + } + CU_FREE(ueNrCap->featureSets, sizeof(struct FeatureSets)); + } +} + +/******************************************************************* + * + * @brief Free UE capability RAT container list + * + * @details + * + * Function : freeUeCapRatContList + * + * Functionality: Free UE capability RAT container list + * + * @params[in] + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +void freeUeCapRatContList(UE_CapabilityRAT_ContainerListRRC_t *ueCapablityList) +{ + uint8_t idx; + if(ueCapablityList->list.array) + { + for(idx = 0; idx < ueCapablityList->list.count; idx++) + { + if(ueCapablityList->list.array[idx]) + CU_FREE(ueCapablityList->list.array[idx], sizeof(UE_CapabilityRAT_Container_t)); + } + CU_FREE(ueCapablityList->list.array, ueCapablityList->list.size); + } +} + +/******************************************************************* + * + * @brief Fill feature sets + * + * @details + * + * Function : fillFeatureSets + * + * Functionality: Fill feature sets + * + * @params[in] + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t fillFeatureSets(FeatureSets_t *featureSets) +{ + uint8_t idx, elementCnt; + + featureSets->featureSetsDownlink = NULLP; + CU_ALLOC(featureSets->featureSetsDownlinkPerCC, sizeof(struct FeatureSets__featureSetsDownlinkPerCC)); + if(!featureSets->featureSetsDownlinkPerCC) + { + DU_LOG("\nMemory allocation failed in fillFeatureSets"); + return RFAILED; + } + + elementCnt = 1; + featureSets->featureSetsDownlinkPerCC->list.count = elementCnt; + featureSets->featureSetsDownlinkPerCC->list.size = elementCnt * sizeof(struct FeatureSetDownlinkPerCC *); + CU_ALLOC(featureSets->featureSetsDownlinkPerCC->list.array, featureSets->featureSetsDownlinkPerCC->list.size); + if(!featureSets->featureSetsDownlinkPerCC->list.array) + { + DU_LOG("\nMemory allocation failed in fillFeatureSets"); + return RFAILED; + } + + for(idx = 0; idx < elementCnt; idx++) + { + CU_ALLOC(featureSets->featureSetsDownlinkPerCC->list.array[idx], sizeof(struct FeatureSetDownlinkPerCC)); + if(!featureSets->featureSetsDownlinkPerCC->list.array[idx]) + { + DU_LOG("\nMemory allocation failed in fillFeatureSets"); + return RFAILED; + } + } + + idx = 0; + featureSets->featureSetsDownlinkPerCC->list.array[idx]->supportedSubcarrierSpacingDL = SubcarrierSpacing_kHz15; + featureSets->featureSetsDownlinkPerCC->list.array[idx]->supportedBandwidthDL.present = SupportedBandwidth_PR_fr1; + featureSets->featureSetsDownlinkPerCC->list.array[idx]->supportedBandwidthDL.choice.fr1 = SupportedBandwidth__fr1_mhz20; + featureSets->featureSetsDownlinkPerCC->list.array[idx]->channelBW_90mhz = NULLP; + featureSets->featureSetsDownlinkPerCC->list.array[idx]->maxNumberMIMO_LayersPDSCH = NULLP; + + CU_ALLOC(featureSets->featureSetsDownlinkPerCC->list.array[idx]->supportedModulationOrderDL, sizeof(ModulationOrder_t)); + if(!featureSets->featureSetsDownlinkPerCC->list.array[idx]->supportedModulationOrderDL) + { + DU_LOG("\nMemory allocation failed in fillFeatureSets"); + return RFAILED; + } + *(featureSets->featureSetsDownlinkPerCC->list.array[idx]->supportedModulationOrderDL) = ModulationOrder_qam64; + + featureSets->featureSetsUplink = NULLP; + CU_ALLOC(featureSets->featureSetsUplinkPerCC, sizeof(struct FeatureSets__featureSetsUplinkPerCC)); + if(!featureSets->featureSetsUplinkPerCC) + { + DU_LOG("\nMemory allocation failed in fillFeatureSets"); + return RFAILED; + } + + elementCnt = 1; + featureSets->featureSetsUplinkPerCC->list.count = elementCnt; + featureSets->featureSetsUplinkPerCC->list.size = elementCnt * sizeof(struct FeatureSetUplinkPerCC *); + CU_ALLOC(featureSets->featureSetsUplinkPerCC->list.array, featureSets->featureSetsUplinkPerCC->list.size); + if(!featureSets->featureSetsUplinkPerCC->list.array) + { + DU_LOG("\nMemory allocation failed in fillFeatureSets"); + return RFAILED; + } + + for(idx = 0; idx < elementCnt; idx++) + { + CU_ALLOC(featureSets->featureSetsUplinkPerCC->list.array[idx], sizeof(struct FeatureSetUplinkPerCC)); + if(!featureSets->featureSetsUplinkPerCC->list.array[idx]) + { + DU_LOG("\nMemory allocation failed in fillFeatureSets"); + return RFAILED; + } + } + + idx = 0; + featureSets->featureSetsUplinkPerCC->list.array[idx]->supportedSubcarrierSpacingUL = SubcarrierSpacing_kHz15; + featureSets->featureSetsUplinkPerCC->list.array[idx]->supportedBandwidthUL.present = SupportedBandwidth_PR_fr1; + featureSets->featureSetsUplinkPerCC->list.array[idx]->supportedBandwidthUL.choice.fr1 = SupportedBandwidth__fr1_mhz20; + featureSets->featureSetsUplinkPerCC->list.array[idx]->channelBW_90mhz = NULLP; + featureSets->featureSetsUplinkPerCC->list.array[idx]->mimo_CB_PUSCH = NULLP; + featureSets->featureSetsUplinkPerCC->list.array[idx]->maxNumberMIMO_LayersNonCB_PUSCH = NULLP; + + CU_ALLOC(featureSets->featureSetsUplinkPerCC->list.array[idx]->supportedModulationOrderUL, sizeof(ModulationOrder_t)); + if(!featureSets->featureSetsUplinkPerCC->list.array[idx]->supportedModulationOrderUL) + { + DU_LOG("\nMemory allocation failed in fillFeatureSets"); + return RFAILED; + } + *(featureSets->featureSetsUplinkPerCC->list.array[idx]->supportedModulationOrderUL) = ModulationOrder_qam16; + + return ROK; +} + +/******************************************************************* + * + * @brief Fill UE capability RAT container + * + * @details + * + * Function : fillUeCapRatCont + * + * Functionality: Fill UE capability RAT container + * + * @params[in] UE Capability RAT container buffer + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t fillUeCapRatCont(OCTET_STRING_t *ueCapRatContBuf) +{ + uint8_t ret = ROK; + uint8_t idx, elementCnt; + asn_enc_rval_t encRetVal; + UE_NR_Capability_t ueNrCap; + + while(true) + { + ueNrCap.accessStratumRelease = AccessStratumRelease_rel15; + + /* Filling PDCP parameters */ + ueNrCap.pdcp_Parameters.supportedROHC_Profiles.profile0x0000 = false; + ueNrCap.pdcp_Parameters.supportedROHC_Profiles.profile0x0001 = false; + ueNrCap.pdcp_Parameters.supportedROHC_Profiles.profile0x0002 = false; + ueNrCap.pdcp_Parameters.supportedROHC_Profiles.profile0x0003 = false; + ueNrCap.pdcp_Parameters.supportedROHC_Profiles.profile0x0004 = false; + ueNrCap.pdcp_Parameters.supportedROHC_Profiles.profile0x0006 = false; + ueNrCap.pdcp_Parameters.supportedROHC_Profiles.profile0x0101 = false; + ueNrCap.pdcp_Parameters.supportedROHC_Profiles.profile0x0102 = false; + ueNrCap.pdcp_Parameters.supportedROHC_Profiles.profile0x0103 = false; + ueNrCap.pdcp_Parameters.supportedROHC_Profiles.profile0x0104 = false; + ueNrCap.pdcp_Parameters.maxNumberROHC_ContextSessions = PDCP_Parameters__maxNumberROHC_ContextSessions_cs2; + ueNrCap.pdcp_Parameters.uplinkOnlyROHC_Profiles = NULLP; + ueNrCap.pdcp_Parameters.continueROHC_Context = NULLP; + ueNrCap.pdcp_Parameters.outOfOrderDelivery = NULLP; + ueNrCap.pdcp_Parameters.shortSN = NULLP; + ueNrCap.pdcp_Parameters.pdcp_DuplicationSRB = NULLP; + ueNrCap.pdcp_Parameters.pdcp_DuplicationMCG_OrSCG_DRB = NULLP; + + ueNrCap.rlc_Parameters = NULLP; + ueNrCap.mac_Parameters = NULLP; + + /* Filling PHY parameters */ + ueNrCap.phy_Parameters.phy_ParametersCommon = NULLP; + ueNrCap.phy_Parameters.phy_ParametersXDD_Diff = NULLP; + ueNrCap.phy_Parameters.phy_ParametersFRX_Diff = NULLP; + ueNrCap.phy_Parameters.phy_ParametersFR1 = NULLP; + ueNrCap.phy_Parameters.phy_ParametersFR2 = NULLP; + + /* Filling RF parameters */ + elementCnt = 1; + ueNrCap.rf_Parameters.supportedBandListNR.list.count = elementCnt; + ueNrCap.rf_Parameters.supportedBandListNR.list.size = elementCnt * sizeof(struct BandNR *); + CU_ALLOC(ueNrCap.rf_Parameters.supportedBandListNR.list.array, ueNrCap.rf_Parameters.supportedBandListNR.list.size); + if(!ueNrCap.rf_Parameters.supportedBandListNR.list.array) + { + DU_LOG("\nMemory allocation failed in fillUeCapRatCont"); + ret = RFAILED; + break; + } + + for(idx = 0; idx < elementCnt; idx++) + { + CU_ALLOC(ueNrCap.rf_Parameters.supportedBandListNR.list.array[idx], sizeof(struct BandNR)); + if(!ueNrCap.rf_Parameters.supportedBandListNR.list.array[idx]) + { + ret = RFAILED; + break; + } + } + if(ret == RFAILED) + break; + + idx = 0; + ueNrCap.rf_Parameters.supportedBandListNR.list.array[idx]->bandNR = 1; + ueNrCap.rf_Parameters.supportedBandCombinationList = NULLP; + ueNrCap.rf_Parameters.appliedFreqBandListFilter = NULLP; + + ueNrCap.measAndMobParameters = NULLP; + ueNrCap.fdd_Add_UE_NR_Capabilities = NULLP; + ueNrCap.tdd_Add_UE_NR_Capabilities = NULLP; + ueNrCap.fr1_Add_UE_NR_Capabilities = NULLP; + ueNrCap.fr2_Add_UE_NR_Capabilities = NULLP; + ueNrCap.featureSets = NULLP; + + CU_ALLOC(ueNrCap.featureSets, sizeof(struct FeatureSets)); + if(!ueNrCap.featureSets) + { + DU_LOG("\nMemory allocation failed in fillUeCapRatCont"); + ret = RFAILED; + break; + } + + if(fillFeatureSets(ueNrCap.featureSets) != ROK) + { + DU_LOG("\nfillDLFeatureSets() failed "); + ret = RFAILED; + break; + } + + ueNrCap.featureSetCombinations = NULLP; + ueNrCap.lateNonCriticalExtension = NULLP; + ueNrCap.nonCriticalExtension = NULLP; + + /* encode UE Capability RAT Container List into duToCuRrcContainer */ + xer_fprint(stdout, &asn_DEF_UE_NR_Capability, &ueNrCap); + cmMemset((uint8_t *)encBuf, 0, ENC_BUF_MAX_LEN); + encBufSize = 0; + encRetVal = aper_encode(&asn_DEF_UE_NR_Capability, 0, &ueNrCap, PrepFinalEncBuf, encBuf); + + /* Encode results */ + if(encRetVal.encoded == ENCODE_FAIL) + { + DU_LOG( "\n F1AP : Could not encode UE Capability RAT Container (at %s)\n",\ + encRetVal.failed_type ? encRetVal.failed_type->name : "unknown"); + break; + } + else + { + DU_LOG("\n F1AP : Created APER encoded buffer for UE Capability RAT Container\n"); + for(int i=0; i< encBufSize; i++) + { + printf("%x",encBuf[i]); + } + } + + ueCapRatContBuf->size = encBufSize; + CU_ALLOC(ueCapRatContBuf->buf, ueCapRatContBuf->size); + if(!ueCapRatContBuf->buf) + { + DU_LOG("\nF1AP : Memory allocation failed in fillUeCapabilityContainer"); + break; + } + memcpy(ueCapRatContBuf->buf, encBuf, ueCapRatContBuf->size); + ret = ROK; + break; + } + freeUeCapRatCont(&ueNrCap); + return ROK; +} + +/******************************************************************* + * + * @brief Fill UE Capability RAT container list + * + * @details + * + * Function : fillUeCapRatContList + * + * Functionality: Fill UE Capability RAT container list + + * + * @params[in] UE capability RAT container list buffer + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t fillUeCapRatContList(UE_CapabilityRAT_ContainerList_t *ueCapablityListBuf) +{ + uint8_t ret = RFAILED; + uint8_t idx, elementCnt; + asn_enc_rval_t encRetVal; + UE_CapabilityRAT_ContainerListRRC_t ueCapablityList; + + while(true) + { + elementCnt = 1; + ueCapablityList.list.count = elementCnt; + ueCapablityList.list.size = elementCnt * sizeof(UE_CapabilityRAT_Container_t *); + + CU_ALLOC(ueCapablityList.list.array, ueCapablityList.list.size); + if(!ueCapablityList.list.array) + { + DU_LOG("\nMemory allocation failed in fillUeCapRatContList"); + ret = RFAILED; + break; + } + + for(idx=0; idxrat_Type = RAT_Type_nr; + ret = fillUeCapRatCont(&ueCapablityList.list.array[idx]->ue_CapabilityRAT_Container); + + /* encode UE Capability RAT Container List into duToCuRrcContainer */ + xer_fprint(stdout, &asn_DEF_UE_CapabilityRAT_ContainerListRRC, &ueCapablityList); + cmMemset((uint8_t *)encBuf, 0, ENC_BUF_MAX_LEN); + encBufSize = 0; + encRetVal = aper_encode(&asn_DEF_UE_CapabilityRAT_ContainerListRRC, 0, \ + &ueCapablityList, PrepFinalEncBuf, encBuf); + + /* Encode results */ + if(encRetVal.encoded == ENCODE_FAIL) + { + DU_LOG( "\n F1AP : Could not encode UE Capability RAT Container (at %s)\n",\ + encRetVal.failed_type ? encRetVal.failed_type->name : "unknown"); + break; + } + else + { + DU_LOG("\n F1AP : Created APER encoded buffer for UE Capability RAT Container\n"); + for(int i=0; i< encBufSize; i++) + { + printf("%x",encBuf[i]); + } + } + + ueCapablityListBuf->size = encBufSize; + CU_ALLOC(ueCapablityListBuf->buf, ueCapablityListBuf->size); + if(!ueCapablityListBuf->buf) + { + DU_LOG("\nF1AP : Memory allocation failed in fillUeCapabilityContainer"); + break; + } + memcpy(ueCapablityListBuf->buf, encBuf, ueCapablityListBuf->size); + ret = ROK; + break; + } + freeUeCapRatContList(&ueCapablityList); + return ROK; +} + /******************************************************************* * * @brief Fills CuToDuContainer @@ -5627,10 +6081,18 @@ uint8_t fillCuToDuContainer(CUtoDURRCInformation_t *rrcMsg) uint8_t ret = ROK; uint8_t idx, idx2, rrcBufLen; - elementCnt = 1; + CU_ALLOC(rrcMsg->uE_CapabilityRAT_ContainerList, sizeof(UE_CapabilityRAT_ContainerList_t)); + if(!rrcMsg->uE_CapabilityRAT_ContainerList) + { + DU_LOG(" F1AP : Memory allocation for CUtoDURRCInformation_ExtIEs failed"); + return RFAILED; + } + ret = fillUeCapRatContList(rrcMsg->uE_CapabilityRAT_ContainerList); + CU_ALLOC(rrcMsg->iE_Extensions, sizeof(ProtocolExtensionContainer_4624P16_t)); if(rrcMsg->iE_Extensions) { + elementCnt = 1; rrcMsg->iE_Extensions->list.count = elementCnt; rrcMsg->iE_Extensions->list.size = elementCnt * sizeof(CUtoDURRCInformation_ExtIEs_t); @@ -5683,6 +6145,12 @@ void FreeCuToDuInfo(CUtoDURRCInformation_t *rrcMsg) { uint8_t idx, idx2; + if(rrcMsg->uE_CapabilityRAT_ContainerList) + { + if(rrcMsg->uE_CapabilityRAT_ContainerList->buf) + CU_FREE(rrcMsg->uE_CapabilityRAT_ContainerList->buf, rrcMsg->uE_CapabilityRAT_ContainerList->size); + CU_FREE(rrcMsg->uE_CapabilityRAT_ContainerList, sizeof(UE_CapabilityRAT_ContainerList_t)); + } if(rrcMsg->iE_Extensions) { if(rrcMsg->iE_Extensions->list.array) @@ -5779,7 +6247,7 @@ uint8_t BuildAndSendUeContextSetupReq(uint8_t cuUeF1apId, uint8_t duUeF1apId, \ ueSetReq = &f1apMsg->choice.initiatingMessage->value.choice.UEContextSetupRequest; - elementCnt = 11; + elementCnt = 12; ueSetReq->protocolIEs.list.count = elementCnt; ueSetReq->protocolIEs.list.size = \ elementCnt * sizeof(UEContextSetupRequestIEs_t *); @@ -5908,7 +6376,7 @@ uint8_t BuildAndSendUeContextSetupReq(uint8_t cuUeF1apId, uint8_t duUeF1apId, \ ueSetReq->protocolIEs.list.array[idx]->criticality = Criticality_reject; ueSetReq->protocolIEs.list.array[idx]->value.present = \ UEContextSetupRequestIEs__value_PR_RRCContainer; - char buf[9]={0x00, 0x02, 0x22, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00}; + char secModeBuf[9]={0x00, 0x02, 0x22, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00}; bufLen =9; ueSetReq->protocolIEs.list.array[idx]->value.choice.RRCContainer.size = bufLen; CU_ALLOC(ueSetReq->protocolIEs.list.array[idx]->value.choice.RRCContainer.buf, @@ -5918,11 +6386,8 @@ uint8_t BuildAndSendUeContextSetupReq(uint8_t cuUeF1apId, uint8_t duUeF1apId, \ DU_LOG(" F1AP : Memory allocation for BuildAndSendUeContextSetupReq failed"); break; } - memset(ueSetReq->protocolIEs.list.array[idx]->value.choice.RRCContainer.buf, 0, encBufSize); - for(idx1 = 0; idx1 < encBufSize; idx1++) - { - ueSetReq->protocolIEs.list.array[idx]->value.choice.RRCContainer.buf[idx1] = buf[idx1]; - } + memset(ueSetReq->protocolIEs.list.array[idx]->value.choice.RRCContainer.buf, 0, bufLen); + memcpy(ueSetReq->protocolIEs.list.array[idx]->value.choice.RRCContainer.buf, secModeBuf, bufLen); /* RRC delivery status request */ idx++; @@ -5933,7 +6398,27 @@ uint8_t BuildAndSendUeContextSetupReq(uint8_t cuUeF1apId, uint8_t duUeF1apId, \ UEContextSetupRequestIEs__value_PR_RRCDeliveryStatusRequest; ueSetReq->protocolIEs.list.array[idx]->value.choice.RRCDeliveryStatusRequest = \ RRCDeliveryStatusRequest_true; - + + /* Bit Rate hardcoded as in reference logs */ + idx++; + ueSetReq->protocolIEs.list.array[idx]->id = \ + ProtocolIE_ID_id_GNB_DU_UE_AMBR_UL; + ueSetReq->protocolIEs.list.array[idx]->criticality = Criticality_ignore; + ueSetReq->protocolIEs.list.array[idx]->value.present = \ + UEContextSetupRequestIEs__value_PR_BitRate; + char bitRateBuf[4]= {0x3B, 0x37, 0xF4, 0xCD}; + bufLen = 4; + ueSetReq->protocolIEs.list.array[idx]->value.choice.BitRate.size = bufLen; + CU_ALLOC(ueSetReq->protocolIEs.list.array[idx]->value.choice.BitRate.buf,\ + ueSetReq->protocolIEs.list.array[idx]->value.choice.BitRate.size); + if(!ueSetReq->protocolIEs.list.array[idx]->value.choice.BitRate.buf) + { + DU_LOG(" F1AP : Failed to allocate memory for Bit Rate in BuildAndSendUeContextSetupReq()"); + break; + } + memset(ueSetReq->protocolIEs.list.array[idx]->value.choice.BitRate.buf, 0, bufLen); + memcpy(ueSetReq->protocolIEs.list.array[idx]->value.choice.BitRate.buf, bitRateBuf, bufLen); + xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg); /* Encode the F1SetupRequest type as APER */ @@ -6040,15 +6525,26 @@ uint8_t procUlRrcMsg(F1AP_PDU_t *f1apMsg) rrcMsgType = setDlRRCMsgType(); if(rrcMsgType == REGISTRATION_ACCEPT) { - DU_LOG("\nSending DL RRC MSG for RRC Registration Complete"); + DU_LOG("\nF1AP: Sending DL RRC MSG for RRC Registration Accept"); ret = BuildAndSendDLRRCMessageTransfer(srbId, rrcMsgType); } if(rrcMsgType == UE_CONTEXT_SETUP_REQ) { - DU_LOG("\nSending Ue Context Setup Req"); + DU_LOG("\nF1AP: Sending Ue Context Setup Req"); ret = BuildAndSendUeContextSetupReq(cuUeF1apId, duUeF1apId,\ rrcContLen, rrcContainer); } + if(rrcMsgType == SECURITY_MODE_COMPLETE) + { + /* To trigger the DL RRC Msg for RRC Reconfig */ + f1apMsgDb.dlRrcMsgCount++; + rrcMsgType = setDlRRCMsgType(); + if(rrcMsgType == RRC_RECONFIG) + { + DU_LOG("\nF1AP: Sending DL RRC MSG for RRC Reconfig"); + BuildAndSendDLRRCMessageTransfer(srbId, rrcMsgType); + } + } } return ret; } @@ -6341,16 +6837,8 @@ void F1APMsgHdlr(Buffer *mBuf) } case SuccessfulOutcome__value_PR_UEContextSetupResponse: { - uint8_t rrcMsgType; - DU_LOG("\nF1AP : UE ContextSetupResponse received"); - f1apMsgDb.dlRrcMsgCount++; - rrcMsgType = setDlRRCMsgType(); - if(rrcMsgType == RRC_RECONFIG) - { - DU_LOG("\nImplementing DL RRC MSG for RRC Reconfig Complete"); - BuildAndSendDLRRCMessageTransfer(SRB1, rrcMsgType); - } + f1apMsgDb.dlRrcMsgCount++; /* keeping DL RRC Msg Count */ break; } default: