- 0x00, 0x04, 0x00, 0xaa, 0x80, 0x40, 0x9a, 0x05, 0x20, 0x00, 0x05, 0xeb, 0xc0, 0x51, 0x50, 0x00,
- 0x03, 0x00, 0x03, 0xf7, 0x56, 0xec, 0x7f, 0x08, 0x42, 0x10, 0x80, 0x00, 0x10, 0x21, 0x47, 0x84,
- 0xd1, 0x00, 0x00, 0x00, 0x02, 0x81, 0x5d, 0x10, 0x0a, 0xc2, 0x44, 0x40, 0x2b, 0xb2, 0x07, 0x41,
- 0x87, 0xa8, 0x02, 0xc7, 0x00, 0x88, 0x05, 0x76, 0x40, 0xe8, 0x30, 0xf5, 0x40, 0x4c, 0x00, 0x10,
- 0x02, 0x00, 0xa5, 0x83, 0xe0, 0x60, 0x02, 0x10, 0x72, 0x01, 0x0c, 0xa0, 0xa0, 0xd8, 0x00, 0x00,
- 0x00, 0x01, 0x0f, 0x02, 0x3c, 0x01, 0x80, 0x10, 0x82, 0xb0, 0x40, 0x00, 0x00, 0x02, 0x1e, 0x04,
- 0x78, 0x07, 0x00, 0x21, 0x05, 0x61, 0x00, 0x00, 0x00, 0x04, 0x3c, 0x08, 0xf0, 0x16, 0x00, 0x42,
- 0x0a, 0xc3, 0x00, 0x00, 0x00, 0x08, 0x78, 0x11, 0xe0, 0x3c, 0x00, 0x84, 0x14, 0x00, 0x07, 0xe5,
- 0xc0, 0xa0, 0xd8, 0x42, 0x20, 0x02, 0x80, 0xa0, 0x02, 0x24, 0x47, 0xa0, 0x20, 0x27, 0xa1, 0x22,
- 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x24, 0x41, 0x20, 0xc0, 0x80, 0x00, 0x20, 0x80,
- 0x00, 0x25, 0x20, 0xa0, 0x38, 0x00, 0x00, 0x00, 0x44, 0xa2, 0x82, 0x69, 0xee, 0x0c, 0xad, 0xca,
- 0x4c, 0x2c, 0x8d, 0x2e, 0x6f, 0x2e, 0x69, 0x2d, 0xce, 0x8c, 0xae, 0x4d, 0xcc, 0xae, 0x80, 0x00,
- 0x00, 0x00, 0x00, 0x00};
+ 0x00, 0x04, 0x00, 0xaa, 0x80, 0x40, 0x9a, 0x05, 0x20, 0x00, 0x05, 0xeb, 0xc0, 0x51, 0x50, 0x00,
+ 0x03, 0x00, 0x03, 0xf7, 0x56, 0xec, 0x7f, 0x08, 0x42, 0x10, 0x80, 0x00, 0x10, 0x21, 0x47, 0x84,
+ 0xd1, 0x00, 0x00, 0x00, 0x02, 0x81, 0x5d, 0x10, 0x0a, 0xc2, 0x44, 0x40, 0x2b, 0xb2, 0x07, 0x41,
+ 0x87, 0xa8, 0x02, 0xc7, 0x00, 0x88, 0x05, 0x76, 0x40, 0xe8, 0x30, 0xf5, 0x40, 0x4c, 0x00, 0x10,
+ 0x02, 0x00, 0xa5, 0x83, 0xe0, 0x60, 0x02, 0x10, 0x72, 0x01, 0x0c, 0xa0, 0xa0, 0xd8, 0x00, 0x00,
+ 0x00, 0x01, 0x0f, 0x02, 0x3c, 0x01, 0x80, 0x10, 0x82, 0xb0, 0x40, 0x00, 0x00, 0x02, 0x1e, 0x04,
+ 0x78, 0x07, 0x00, 0x21, 0x05, 0x61, 0x00, 0x00, 0x00, 0x04, 0x3c, 0x08, 0xf0, 0x16, 0x00, 0x42,
+ 0x0a, 0xc3, 0x00, 0x00, 0x00, 0x08, 0x78, 0x11, 0xe0, 0x3c, 0x00, 0x84, 0x14, 0x00, 0x07, 0xe5,
+ 0xc0, 0xa0, 0xd8, 0x42, 0x20, 0x02, 0x80, 0xa0, 0x02, 0x24, 0x47, 0xa0, 0x20, 0x27, 0xa1, 0x22,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x24, 0x41, 0x20, 0xc0, 0x80, 0x00, 0x20, 0x80,
+ 0x00, 0x25, 0x20, 0xa0, 0x38, 0x00, 0x00, 0x00, 0x44, 0xa2, 0x82, 0x69, 0xee, 0x0c, 0xad, 0xca,
+ 0x4c, 0x2c, 0x8d, 0x2e, 0x6f, 0x2e, 0x69, 0x2d, 0xce, 0x8c, 0xae, 0x4d, 0xcc, 0xae, 0x80, 0x00,
+ 0x00, 0x00, 0x00, 0x00};
- {
- DU_LOG("\nF1AP : Memory allocation failed in BuildPdschTimeDomAllocList");
- return RFAILED;
- }
-
- elementCnt = 1;
- timeDomAllocList->choice.setup->list.count = elementCnt;
- timeDomAllocList->choice.setup->list.size = \
- elementCnt * sizeof(struct PDSCH_TimeDomainResourceAllocation *);
-
- timeDomAllocList->choice.setup->list.array = NULLP;
- CU_ALLOC(timeDomAllocList->choice.setup->list.array, \
- timeDomAllocList->choice.setup->list.size);
- if(!timeDomAllocList->choice.setup->list.array)
- {
- DU_LOG("\nF1AP : Memory allocation failed in BuildPdschTimeDomAllocList");
- return RFAILED;
- }
-
- for(idx = 0; idx < elementCnt; idx++)
- {
- timeDomAllocList->choice.setup->list.array[idx] = NULLP;
- CU_ALLOC(timeDomAllocList->choice.setup->list.array[idx], \
- sizeof(struct PDSCH_TimeDomainResourceAllocation));
- if(!timeDomAllocList->choice.setup->list.array[idx])
- {
- DU_LOG("\nF1AP : Memory allocation failed in BuildPdschTimeDomAllocList");
- return RFAILED;
- }
- }
-
- idx = 0;
- timeDomAlloc = timeDomAllocList->choice.setup->list.array[idx];
-
- timeDomAlloc->k0 = NULLP;
- timeDomAlloc->mappingType = PDSCH_MAPPING_TYPE_A;
- timeDomAlloc->startSymbolAndLength = 53;
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPdschTimeDomAllocList");
+ return RFAILED;
+ }
+
+ elementCnt = 1;
+ timeDomAllocList->choice.setup->list.count = elementCnt;
+ timeDomAllocList->choice.setup->list.size = \
+ elementCnt * sizeof(struct PDSCH_TimeDomainResourceAllocation *);
+
+ timeDomAllocList->choice.setup->list.array = NULLP;
+ CU_ALLOC(timeDomAllocList->choice.setup->list.array, \
+ timeDomAllocList->choice.setup->list.size);
+ if(!timeDomAllocList->choice.setup->list.array)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPdschTimeDomAllocList");
+ return RFAILED;
+ }
+
+ for(idx = 0; idx < elementCnt; idx++)
+ {
+ timeDomAllocList->choice.setup->list.array[idx] = NULLP;
+ CU_ALLOC(timeDomAllocList->choice.setup->list.array[idx], \
+ sizeof(struct PDSCH_TimeDomainResourceAllocation));
+ if(!timeDomAllocList->choice.setup->list.array[idx])
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPdschTimeDomAllocList");
+ return RFAILED;
+ }
+ }
+
+ idx = 0;
+ timeDomAlloc = timeDomAllocList->choice.setup->list.array[idx];
+
+ timeDomAlloc->k0 = NULLP;
+ timeDomAlloc->mappingType = PDSCH_MAPPING_TYPE_A;
+ timeDomAlloc->startSymbolAndLength = 53;
- pdschCfg->rateMatchPatternToAddModList = NULLP;
- pdschCfg->rateMatchPatternToReleaseList = NULLP;
- pdschCfg->rateMatchPatternGroup1 = NULLP;
- pdschCfg->rateMatchPatternGroup2 = NULLP;
- pdschCfg->rbg_Size = PDSCH_RBG_SIZE;
- pdschCfg->mcs_Table = NULLP;
-
- pdschCfg->maxNrofCodeWordsScheduledByDCI = NULLP;
- CU_ALLOC(pdschCfg->maxNrofCodeWordsScheduledByDCI, sizeof(long));
- if(!pdschCfg->maxNrofCodeWordsScheduledByDCI)
- {
- DU_LOG("\nF1AP : Memory allocation failed in BuildBWPDlDedPdschCfg");
- return RFAILED;
- }
- *(pdschCfg->maxNrofCodeWordsScheduledByDCI) = PDSCH_MAX_CODEWORD_SCH_BY_DCI;
-
- if(BuildPdschPrbBundlingType(&pdschCfg->prb_BundlingType) != ROK)
- {
- return RFAILED;
- }
-
- pdschCfg->zp_CSI_RS_ResourceToAddModList = NULLP;
- pdschCfg->zp_CSI_RS_ResourceToReleaseList = NULLP;
- pdschCfg->aperiodic_ZP_CSI_RS_ResourceSetsToAddModList = NULLP;
- pdschCfg->aperiodic_ZP_CSI_RS_ResourceSetsToReleaseList = NULLP;
- pdschCfg->sp_ZP_CSI_RS_ResourceSetsToAddModList = NULLP;
- pdschCfg->sp_ZP_CSI_RS_ResourceSetsToReleaseList = NULLP;
+ pdschCfg->rateMatchPatternToAddModList = NULLP;
+ pdschCfg->rateMatchPatternToReleaseList = NULLP;
+ pdschCfg->rateMatchPatternGroup1 = NULLP;
+ pdschCfg->rateMatchPatternGroup2 = NULLP;
+ pdschCfg->rbg_Size = PDSCH_RBG_SIZE;
+ pdschCfg->mcs_Table = NULLP;
+
+ pdschCfg->maxNrofCodeWordsScheduledByDCI = NULLP;
+ CU_ALLOC(pdschCfg->maxNrofCodeWordsScheduledByDCI, sizeof(long));
+ if(!pdschCfg->maxNrofCodeWordsScheduledByDCI)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPDlDedPdschCfg");
+ return RFAILED;
+ }
+ *(pdschCfg->maxNrofCodeWordsScheduledByDCI) = PDSCH_MAX_CODEWORD_SCH_BY_DCI;
+
+ if(BuildPdschPrbBundlingType(&pdschCfg->prb_BundlingType) != ROK)
+ {
+ return RFAILED;
+ }
+
+ pdschCfg->zp_CSI_RS_ResourceToAddModList = NULLP;
+ pdschCfg->zp_CSI_RS_ResourceToReleaseList = NULLP;
+ pdschCfg->aperiodic_ZP_CSI_RS_ResourceSetsToAddModList = NULLP;
+ pdschCfg->aperiodic_ZP_CSI_RS_ResourceSetsToReleaseList = NULLP;
+ pdschCfg->sp_ZP_CSI_RS_ResourceSetsToAddModList = NULLP;
+ pdschCfg->sp_ZP_CSI_RS_ResourceSetsToReleaseList = NULLP;
- /* Fill Resource Id list in resource set */
- rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList = NULLP;
- CU_ALLOC(rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList,\
- sizeof(struct SRS_ResourceSet__srs_ResourceIdList));
- if(!rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList)
- {
- DU_LOG("\nF1AP: Memory allocation failed in BuildSrsRsrcSetAddModList");
- return RFAILED;
- }
-
- elementCnt = 1;
- rsrcIdList = rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList;
- rsrcIdList->list.count = elementCnt;
- rsrcIdList->list.size = elementCnt * sizeof(SRS_ResourceId_t *);
- rsrcIdList->list.array = NULLP;
- CU_ALLOC(rsrcIdList->list.array, rsrcIdList->list.size);
- if(!rsrcIdList->list.array)
- {
- DU_LOG("\nF1AP: Memory allocation failed in BuildSrsRsrcSetAddModList");
- return RFAILED;
- }
-
- for(rsrcIdx = 0; rsrcIdx < rsrcIdList->list.count; rsrcIdx++)
- {
- CU_ALLOC(rsrcIdList->list.array[rsrcIdx], sizeof(SRS_ResourceId_t));
- if(!rsrcIdList->list.array[rsrcIdx])
- {
- DU_LOG("\nF1AP: Memory allocation failed in BuildSrsRsrcSetAddModList");
- return RFAILED;
- }
- }
-
- rsrcIdx = 0;
- *rsrcIdList->list.array[rsrcIdx] = SRS_RSRC_ID;
-
- /* Fill resource type */
+ /* Fill Resource Id list in resource set */
+ rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList = NULLP;
+ CU_ALLOC(rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList,\
+ sizeof(struct SRS_ResourceSet__srs_ResourceIdList));
+ if(!rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSrsRsrcSetAddModList");
+ return RFAILED;
+ }
+
+ elementCnt = 1;
+ rsrcIdList = rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList;
+ rsrcIdList->list.count = elementCnt;
+ rsrcIdList->list.size = elementCnt * sizeof(SRS_ResourceId_t *);
+ rsrcIdList->list.array = NULLP;
+ CU_ALLOC(rsrcIdList->list.array, rsrcIdList->list.size);
+ if(!rsrcIdList->list.array)
+ {
+ DU_LOG("\nERROR --> F1AP: Memory allocation failed in BuildSrsRsrcSetAddModList");
+ return RFAILED;
+ }
+
+ for(rsrcIdx = 0; rsrcIdx < rsrcIdList->list.count; rsrcIdx++)
+ {
+ CU_ALLOC(rsrcIdList->list.array[rsrcIdx], sizeof(SRS_ResourceId_t));
+ if(!rsrcIdList->list.array[rsrcIdx])
+ {
+ DU_LOG("\nERROR --> F1AP: Memory allocation failed in BuildSrsRsrcSetAddModList");
+ return RFAILED;
+ }
+ }
+
+ rsrcIdx = 0;
+ *rsrcIdList->list.array[rsrcIdx] = SRS_RSRC_ID;
+
+ /* Fill resource type */
- uint8_t rSetIdx, rsrcIdx;
- SRS_Config_t *srsCfg = NULLP;
- PUSCH_Config_t *puschCfg = NULLP;
- struct PUSCH_Config__dmrs_UplinkForPUSCH_MappingTypeA *dmrsUlCfg = NULLP;
- struct SRS_Config__srs_ResourceSetToAddModList *rsrcSetList = NULLP;
- struct SRS_ResourceSet__srs_ResourceIdList *rsrcIdList = NULLP;
- struct SRS_Config__srs_ResourceToAddModList *resourceList = NULLP;
-
- if(ulBwp->pusch_Config)
- {
- if(ulBwp->pusch_Config->choice.setup)
- {
- puschCfg=ulBwp->pusch_Config->choice.setup;
- if(puschCfg->dataScramblingIdentityPUSCH)
- {
- if(puschCfg->dmrs_UplinkForPUSCH_MappingTypeA)
- {
- FreePuschTimeDomAllocList(puschCfg);
- dmrsUlCfg=puschCfg->dmrs_UplinkForPUSCH_MappingTypeA;
- if(dmrsUlCfg->choice.setup)
- {
- if(dmrsUlCfg->choice.setup->dmrs_AdditionalPosition)
- {
- if(dmrsUlCfg->choice.setup->transformPrecodingDisabled)
- {
- CU_FREE(dmrsUlCfg->choice.setup->transformPrecodingDisabled->scramblingID0,\
- sizeof(long));
- CU_FREE(dmrsUlCfg->choice.setup->transformPrecodingDisabled,
- sizeof(struct DMRS_UplinkConfig__transformPrecodingDisabled));
- }
- CU_FREE(dmrsUlCfg->choice.setup->dmrs_AdditionalPosition,
- sizeof(long));
- }
- CU_FREE(dmrsUlCfg->choice.setup,sizeof(DMRS_UplinkConfig_t));
- }
- CU_FREE(puschCfg->dmrs_UplinkForPUSCH_MappingTypeA, \
- sizeof(struct PUSCH_Config__dmrs_UplinkForPUSCH_MappingTypeA));
- }
- CU_FREE(puschCfg->dataScramblingIdentityPUSCH, sizeof(long));
- }
- CU_FREE(ulBwp->pusch_Config->choice.setup, sizeof(PUSCH_Config_t));
+ uint8_t rSetIdx, rsrcIdx;
+ SRS_Config_t *srsCfg = NULLP;
+ PUSCH_Config_t *puschCfg = NULLP;
+ struct PUSCH_Config__dmrs_UplinkForPUSCH_MappingTypeA *dmrsUlCfg = NULLP;
+ struct SRS_Config__srs_ResourceSetToAddModList *rsrcSetList = NULLP;
+ struct SRS_ResourceSet__srs_ResourceIdList *rsrcIdList = NULLP;
+ struct SRS_Config__srs_ResourceToAddModList *resourceList = NULLP;
+
+ if(ulBwp->pusch_Config)
+ {
+ if(ulBwp->pusch_Config->choice.setup)
+ {
+ puschCfg=ulBwp->pusch_Config->choice.setup;
+ if(puschCfg->dataScramblingIdentityPUSCH)
+ {
+ if(puschCfg->dmrs_UplinkForPUSCH_MappingTypeA)
+ {
+ FreePuschTimeDomAllocList(puschCfg);
+ dmrsUlCfg=puschCfg->dmrs_UplinkForPUSCH_MappingTypeA;
+ if(dmrsUlCfg->choice.setup)
+ {
+ if(dmrsUlCfg->choice.setup->dmrs_AdditionalPosition)
+ {
+ if(dmrsUlCfg->choice.setup->transformPrecodingDisabled)
+ {
+ CU_FREE(dmrsUlCfg->choice.setup->transformPrecodingDisabled->scramblingID0,\
+ sizeof(long));
+ CU_FREE(dmrsUlCfg->choice.setup->transformPrecodingDisabled,
+ sizeof(struct DMRS_UplinkConfig__transformPrecodingDisabled));
+ }
+ CU_FREE(dmrsUlCfg->choice.setup->dmrs_AdditionalPosition,
+ sizeof(long));
+ }
+ CU_FREE(dmrsUlCfg->choice.setup,sizeof(DMRS_UplinkConfig_t));
+ }
+ CU_FREE(puschCfg->dmrs_UplinkForPUSCH_MappingTypeA, \
+ sizeof(struct PUSCH_Config__dmrs_UplinkForPUSCH_MappingTypeA));
- CU_FREE(ulBwp->srs_Config->choice.setup, sizeof(SRS_Config_t));
- }
- CU_FREE(ulBwp->srs_Config, sizeof(struct BWP_UplinkDedicated__srs_Config));
- }
+ if(rsrcIdList->list.array)
+ {
+ for(rsrcIdx = 0; rsrcIdx < rsrcIdList->list.count; rsrcIdx++)
+ {
+ CU_FREE(rsrcIdList->list.array[rsrcIdx], sizeof(SRS_ResourceId_t));
+ }
+ CU_FREE(rsrcIdList->list.array, rsrcIdList->list.size);
+ }
+ CU_FREE(rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList,\
+ sizeof(struct SRS_ResourceSet__srs_ResourceIdList));
+ }
+
+ /* Free resource type info for this SRS resource set */
+ CU_FREE(rsrcSetList->list.array[rSetIdx]->resourceType.choice.aperiodic, \
+ sizeof(struct SRS_ResourceSet__resourceType__aperiodic));
+
+ /* Free memory for each resource set */
+ for(rSetIdx = 0; rSetIdx < rsrcSetList->list.count; rSetIdx++)
+ {
+ CU_FREE(rsrcSetList->list.array[rSetIdx], sizeof(SRS_ResourceSet_t));
+ }
+ CU_FREE(rsrcSetList->list.array, rsrcSetList->list.size);
+ }
+ CU_FREE(srsCfg->srs_ResourceSetToAddModList, \
+ sizeof(struct SRS_Config__srs_ResourceSetToAddModList));
+ }
+
+ /* Free resource to add/modd list */
+ if(srsCfg->srs_ResourceToAddModList)
+ {
+ resourceList = srsCfg->srs_ResourceToAddModList;
+ if(resourceList->list.array)
+ {
+ rsrcIdx = 0;
+ CU_FREE(resourceList->list.array[rsrcIdx]->transmissionComb.choice.n2,\
+ sizeof(struct SRS_Resource__transmissionComb__n2));
+ CU_FREE(resourceList->list.array[rsrcIdx]->resourceType.choice.aperiodic,\
+ sizeof(struct SRS_Resource__resourceType__aperiodic));
+
+ for(rsrcIdx = 0; rsrcIdx < resourceList->list.count; rsrcIdx++)
+ {
+ CU_FREE(resourceList->list.array[rsrcIdx], sizeof(SRS_Resource_t));
+ }
+ CU_FREE(resourceList->list.array, resourceList->list.size);
+ }
+ CU_FREE(srsCfg->srs_ResourceToAddModList, \
+ sizeof(struct SRS_Config__srs_ResourceToAddModList));
+ }
+
+ CU_FREE(ulBwp->srs_Config->choice.setup, sizeof(SRS_Config_t));
-
- if(ulCfg->initialUplinkBWP)
- {
- ulBwp=ulCfg->initialUplinkBWP;
- if(ulCfg->firstActiveUplinkBWP_Id)
- {
- if(ulCfg->pusch_ServingCellConfig)
- {
- puschCfg=ulCfg->pusch_ServingCellConfig;
- if(puschCfg->choice.setup)
- {
- if(puschCfg->choice.setup->ext1)
- {
- CU_FREE(puschCfg->choice.setup->ext1->\
- processingType2Enabled,sizeof(BOOLEAN_t));
- CU_FREE(puschCfg->choice.setup->ext1->\
- maxMIMO_Layers,sizeof(long));
- CU_FREE(puschCfg->choice.setup->ext1, \
- sizeof(struct PUSCH_ServingCellConfig__ext1));
- }
- CU_FREE(puschCfg->choice.setup, sizeof(struct PUSCH_ServingCellConfig));
- }
- CU_FREE(ulCfg->pusch_ServingCellConfig, sizeof(struct UplinkConfig__pusch_ServingCellConfig));
- }
- CU_FREE(ulCfg->firstActiveUplinkBWP_Id, sizeof(BWP_Id_t));
- }
- FreeInitialUlBWP(ulBwp);
- CU_FREE(ulCfg->initialUplinkBWP, sizeof(BWP_UplinkDedicated_t));
- }
+
+ if(ulCfg->initialUplinkBWP)
+ {
+ ulBwp=ulCfg->initialUplinkBWP;
+ if(ulCfg->firstActiveUplinkBWP_Id)
+ {
+ if(ulCfg->pusch_ServingCellConfig)
+ {
+ puschCfg=ulCfg->pusch_ServingCellConfig;
+ if(puschCfg->choice.setup)
+ {
+ if(puschCfg->choice.setup->ext1)
+ {
+ CU_FREE(puschCfg->choice.setup->ext1->\
+ processingType2Enabled,sizeof(BOOLEAN_t));
+ CU_FREE(puschCfg->choice.setup->ext1->\
+ maxMIMO_Layers,sizeof(long));
+ CU_FREE(puschCfg->choice.setup->ext1, \
+ sizeof(struct PUSCH_ServingCellConfig__ext1));
+ }
+ CU_FREE(puschCfg->choice.setup, sizeof(struct PUSCH_ServingCellConfig));
+ }
+ CU_FREE(ulCfg->pusch_ServingCellConfig, sizeof(struct UplinkConfig__pusch_ServingCellConfig));
+ }
+ CU_FREE(ulCfg->firstActiveUplinkBWP_Id, sizeof(BWP_Id_t));
+ }
+ FreeInitialUlBWP(ulBwp);
+ CU_FREE(ulCfg->initialUplinkBWP, sizeof(BWP_UplinkDedicated_t));
+ }
- if(pdschCfg->pdsch_TimeDomainAllocationList)
- {
- timeDomAllocList=pdschCfg->pdsch_TimeDomainAllocationList;
- if(pdschCfg->maxNrofCodeWordsScheduledByDCI)
- {
- prbBndlType=&pdschCfg->prb_BundlingType;
- CU_FREE(prbBndlType->choice.staticBundling,\
- sizeof(struct PDSCH_Config__prb_BundlingType__staticBundling));
- CU_FREE(pdschCfg->maxNrofCodeWordsScheduledByDCI, sizeof(long));
- }
- FreePdschTimeDomAllocList(timeDomAllocList);
- CU_FREE(pdschCfg->pdsch_TimeDomainAllocationList, \
- sizeof(struct PDSCH_Config__pdsch_TimeDomainAllocationList));
- }
- dmrsDlCfg=pdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA;
- if(dmrsDlCfg->choice.setup)
- {
- CU_FREE(dmrsDlCfg->choice.setup->dmrs_AdditionalPosition,
- sizeof(long));
- CU_FREE(dmrsDlCfg->choice.setup, sizeof(struct DMRS_DownlinkConfig));
- }
- CU_FREE(pdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA, \
- sizeof(struct PDSCH_Config__dmrs_DownlinkForPDSCH_MappingTypeA));
- }
- CU_FREE(dlBwp->pdsch_Config->choice.setup, sizeof(struct PDSCH_Config));
- }
+ if(pdschCfg->pdsch_TimeDomainAllocationList)
+ {
+ timeDomAllocList=pdschCfg->pdsch_TimeDomainAllocationList;
+ if(pdschCfg->maxNrofCodeWordsScheduledByDCI)
+ {
+ prbBndlType=&pdschCfg->prb_BundlingType;
+ CU_FREE(prbBndlType->choice.staticBundling,\
+ sizeof(struct PDSCH_Config__prb_BundlingType__staticBundling));
+ CU_FREE(pdschCfg->maxNrofCodeWordsScheduledByDCI, sizeof(long));
+ }
+ FreePdschTimeDomAllocList(timeDomAllocList);
+ CU_FREE(pdschCfg->pdsch_TimeDomainAllocationList, \
+ sizeof(struct PDSCH_Config__pdsch_TimeDomainAllocationList));
+ }
+ dmrsDlCfg=pdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA;
+ if(dmrsDlCfg->choice.setup)
+ {
+ CU_FREE(dmrsDlCfg->choice.setup->dmrs_AdditionalPosition,
+ sizeof(long));
+ CU_FREE(dmrsDlCfg->choice.setup, sizeof(struct DMRS_DownlinkConfig));
+ }
+ CU_FREE(pdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA, \
+ sizeof(struct PDSCH_Config__dmrs_DownlinkForPDSCH_MappingTypeA));
+ }
+ CU_FREE(dlBwp->pdsch_Config->choice.setup, sizeof(struct PDSCH_Config));
+ }
- controlRSetList = pdcchCfg->controlResourceSetToAddModList;
- if(controlRSetList->list.array)
- {
- controlRSet = controlRSetList->list.array[idx2];
- if(controlRSet)
- {
- if(controlRSet->frequencyDomainResources.buf)
- {
- if(controlRSet->pdcch_DMRS_ScramblingID)
- {
- if(pdcchCfg->searchSpacesToAddModList)
- {
- FreeSearchSpcToAddModList(pdcchCfg->searchSpacesToAddModList);
- CU_FREE(pdcchCfg->searchSpacesToAddModList, \
- sizeof(struct PDCCH_Config__searchSpacesToAddModList));
- }
- CU_FREE(controlRSet->pdcch_DMRS_ScramblingID, sizeof(long));
- }
- CU_FREE(controlRSet->frequencyDomainResources.buf, \
- controlRSet->frequencyDomainResources.size);
- }
- }
- for(idx1 = 0; idx1 <controlRSetList->list.count; idx1++)
- {
- CU_FREE(controlRSetList->list.array[idx1], sizeof(struct ControlResourceSet));
- }
- CU_FREE(controlRSetList->list.array, controlRSetList->list.size);
- }
- CU_FREE(pdcchCfg->controlResourceSetToAddModList, \
- sizeof(struct PDCCH_Config__controlResourceSetToAddModList));
- }
- CU_FREE(dlBwp->pdcch_Config->choice.setup, sizeof(struct PDCCH_Config));
- }
+ controlRSetList = pdcchCfg->controlResourceSetToAddModList;
+ if(controlRSetList->list.array)
+ {
+ controlRSet = controlRSetList->list.array[idx2];
+ if(controlRSet)
+ {
+ if(controlRSet->frequencyDomainResources.buf)
+ {
+ if(controlRSet->pdcch_DMRS_ScramblingID)
+ {
+ if(pdcchCfg->searchSpacesToAddModList)
+ {
+ FreeSearchSpcToAddModList(pdcchCfg->searchSpacesToAddModList);
+ CU_FREE(pdcchCfg->searchSpacesToAddModList, \
+ sizeof(struct PDCCH_Config__searchSpacesToAddModList));
+ }
+ CU_FREE(controlRSet->pdcch_DMRS_ScramblingID, sizeof(long));
+ }
+ CU_FREE(controlRSet->frequencyDomainResources.buf, \
+ controlRSet->frequencyDomainResources.size);
+ }
+ }
+ for(idx1 = 0; idx1 <controlRSetList->list.count; idx1++)
+ {
+ CU_FREE(controlRSetList->list.array[idx1], sizeof(struct ControlResourceSet));
+ }
+ CU_FREE(controlRSetList->list.array, controlRSetList->list.size);
+ }
+ CU_FREE(pdcchCfg->controlResourceSetToAddModList, \
+ sizeof(struct PDCCH_Config__controlResourceSetToAddModList));
+ }
+ CU_FREE(dlBwp->pdcch_Config->choice.setup, sizeof(struct PDCCH_Config));
+ }
-* @brief Build And Send F1ResetAck
-*
-* @details
-*
-* Function : BuildAndSendF1ResetAck
-*
-* Functionality:
-* - Build And Send F1ResetRSP
-*
-* @params[in]
-* @return ROK - success
-* RFAILED - failure
-*
-* ****************************************************************/
-
-uint8_t BuildAndSendF1ResetAck()
-{
- uint8_t idx = 0;
- uint8_t elementCnt = 0;
- uint8_t ret = RFAILED;
- F1AP_PDU_t *f1apMsg = NULL;
- ResetAcknowledge_t *f1ResetAck = NULLP;
- asn_enc_rval_t encRetVal;
- DU_LOG("\nF1AP : Building F1 Reset Acknowledgment \n");
-
- do{
- /* Allocate the memory for F1ResetRequest_t */
- CU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t));
- if(f1apMsg == NULLP)
- {
- DU_LOG("\nF1AP : Memory allocation for F1AP-PDU failed");
- break;
- }
-
- f1apMsg->present = F1AP_PDU_PR_successfulOutcome;
-
- CU_ALLOC(f1apMsg->choice.successfulOutcome, sizeof(SuccessfulOutcome_t));
- if(f1apMsg->choice.successfulOutcome == NULLP)
- {
- DU_LOG("\nF1AP : Memory allocation for F1AP-PDU failed");
- break;
- }
-
- f1apMsg->choice.successfulOutcome->procedureCode = ProcedureCode_id_Reset;
- f1apMsg->choice.successfulOutcome->criticality = Criticality_reject;
- f1apMsg->choice.successfulOutcome->value.present = SuccessfulOutcome__value_PR_ResetAcknowledge;
- f1ResetAck = &f1apMsg->choice.successfulOutcome->value.choice.ResetAcknowledge;
-
- elementCnt = 1;
-
- f1ResetAck->protocolIEs.list.count = elementCnt;
- f1ResetAck->protocolIEs.list.size = elementCnt*sizeof(ResetAcknowledgeIEs_t *);
-
- CU_ALLOC(f1ResetAck->protocolIEs.list.array, f1ResetAck->protocolIEs.list.size );
- if(f1ResetAck->protocolIEs.list.array == NULLP)
- {
- DU_LOG("\nF1AP : Memory allocation for F1ResetAckIEs failed");
- break;
- }
-
- for(idx=0; idx<elementCnt; idx++)
- {
- CU_ALLOC(f1ResetAck->protocolIEs.list.array[idx], sizeof(ResetAcknowledgeIEs_t));
- if(f1ResetAck->protocolIEs.list.array[idx] == NULLP)
- {
- break;
- }
- }
- /*TransactionID*/
- idx = 0;
- f1ResetAck->protocolIEs.list.array[idx]->id = ProtocolIE_ID_id_TransactionID;
- f1ResetAck->protocolIEs.list.array[idx]->criticality = Criticality_reject;
- f1ResetAck->protocolIEs.list.array[idx]->value.present = ResetAcknowledgeIEs__value_PR_TransactionID;
- f1ResetAck->protocolIEs.list.array[idx]->value.choice.TransactionID = TRANS_ID;
-
- xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg);
-
- /* Encode the F1SetupRequest type as UPER */
- memset(encBuf, 0, ENC_BUF_MAX_LEN);
- encBufSize = 0;
- encRetVal = aper_encode(&asn_DEF_F1AP_PDU, 0, f1apMsg, PrepFinalEncBuf, encBuf);
-
- /* Check encode results */
- if(encRetVal.encoded == ENCODE_FAIL)
- {
- DU_LOG("\nF1AP : Could not encode F1ResetAck structure (at %s)\n",\
- encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
- break;
- }
- else
- {
- DU_LOG("\nF1AP : Created APER encoded buffer for F1ResetAck \n");
- for(int i=0; i< encBufSize; i++)
- {
- printf("%x",encBuf[i]);
- }
- }
- /* Sending msg */
- if(SendF1APMsg(CU_APP_MEM_REG, CU_POOL) != ROK)
- {
- DU_LOG("\nF1AP : Sending F1 Reset Response failed");
- break;
- }
-
- ret = ROK;
- break;
- }while(true);
-
- FreeF1ResetAck(f1apMsg);
- return ret;
-}
-
-/*******************************************************************
- *
- * @brief Handles received F1AP message and sends back response
+ * @brief Build And Send F1ResetAck
-
- case InitiatingMessage__value_PR_RRCDeliveryReport:
+ CU_FREE(ulInfo->list.array[arrIdx],sizeof(ULUPTNLInformation_ToBeSetup_Item_t));
+ }
+ }
+ CU_FREE(ulInfo->list.array,ulInfo->list.size);
+ }
+}
+/*******************************************************************
+*
+* @brief Builds the Uplink Tunnel Info
+*
+* @details
+*
+* Function : BuildUlTnlInfoforDrb2
+*
+* Functionality: Constructs the UL TnlInfo For DRB list
+*
+* @params[in] ULUPTNLInformation_ToBeSetup_List_t *ulInfo
+*
+* @return ROK - success
+* RFAILED - failure
+*
+* ****************************************************************/
+uint8_t BuildUlTnlInfoforDrb2(ULUPTNLInformation_ToBeSetup_List_t *ulInfo)
+{
+ uint8_t arrIdx;
+ uint8_t ulCnt;
+
+ ulCnt = 1;
+ ulInfo->list.count = ulCnt;
+ ulInfo->list.size = ulCnt * sizeof(ULUPTNLInformation_ToBeSetup_Item_t *);
+ CU_ALLOC(ulInfo->list.array,ulInfo->list.size);
+ if(ulInfo->list.array == NULLP)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildUlTnlInfoforDrb2");
+ return RFAILED;
+ }
+ for(arrIdx=0; arrIdx<ulCnt; arrIdx++)
+ {
+ CU_ALLOC(ulInfo->list.array[arrIdx],sizeof(ULUPTNLInformation_ToBeSetup_Item_t));
+ if(ulInfo->list.array[arrIdx] == NULLP)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildUlTnlInfoforDrb2");
+ return RFAILED;
+ }
+ }
+
+ arrIdx = 0;
+ ulInfo->list.array[arrIdx]->uLUPTNLInformation.present = \
+ UPTransportLayerInformation_PR_gTPTunnel;
+
+ /*GTP TUNNEL*/
+ CU_ALLOC(ulInfo->list.array[arrIdx]->uLUPTNLInformation.choice.gTPTunnel,\
+ sizeof(GTPTunnel_t));
+ if(ulInfo->list.array[arrIdx]->uLUPTNLInformation.choice.gTPTunnel == NULLP)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildUlTnlInfoforDrb2");
+ return RFAILED;
+ }
+ ulInfo->list.array[arrIdx]->uLUPTNLInformation.choice.gTPTunnel->\
+ transportLayerAddress.size = 4*sizeof(uint8_t);
+ CU_ALLOC(ulInfo->list.array[arrIdx]->uLUPTNLInformation.choice.gTPTunnel->\
+ transportLayerAddress.buf,ulInfo->list.array[arrIdx]->\
+ uLUPTNLInformation.choice.gTPTunnel->transportLayerAddress.size);
+ if(ulInfo->list.array[arrIdx]->uLUPTNLInformation.choice.gTPTunnel->\
+ transportLayerAddress.buf == NULLP)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildUlTnlInfoforDrb2");
+ return RFAILED;
+ }
+
+ ulInfo->list.array[arrIdx]->uLUPTNLInformation.choice.gTPTunnel->\
+ transportLayerAddress.buf[0] = 192;
+ ulInfo->list.array[arrIdx]->uLUPTNLInformation.choice.gTPTunnel->\
+ transportLayerAddress.buf[1] = 168;
+ ulInfo->list.array[arrIdx]->uLUPTNLInformation.choice.gTPTunnel->\
+ transportLayerAddress.buf[2] = 130;
+ ulInfo->list.array[arrIdx]->uLUPTNLInformation.choice.gTPTunnel->\
+ transportLayerAddress.buf[3] = 82;
+ ulInfo->list.array[arrIdx]->uLUPTNLInformation.choice.gTPTunnel->\
+ transportLayerAddress.bits_unused = 0;
+
+ /*GTP TEID*/
+ ulInfo->list.array[arrIdx]->uLUPTNLInformation.choice.gTPTunnel->gTP_TEID.size\
+ = 4 * sizeof(uint8_t);
+ CU_ALLOC(ulInfo->list.array[arrIdx]->uLUPTNLInformation.choice.gTPTunnel->\
+ gTP_TEID.buf,ulInfo->list.array[arrIdx]->uLUPTNLInformation.choice.\
+ gTPTunnel->gTP_TEID.size);
+ if(ulInfo->list.array[arrIdx]->uLUPTNLInformation.choice.gTPTunnel->gTP_TEID.buf\
+ == NULLP)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildUlTnlInfoforDrb2");
+ return RFAILED;
+ }
+ ulInfo->list.array[arrIdx]->uLUPTNLInformation.choice.gTPTunnel->\
+ gTP_TEID.buf[0] = 0;
+ ulInfo->list.array[arrIdx]->uLUPTNLInformation.choice.gTPTunnel->\
+ gTP_TEID.buf[1] = 0;
+ ulInfo->list.array[arrIdx]->uLUPTNLInformation.choice.gTPTunnel->\
+ gTP_TEID.buf[2] = 0;
+ ulInfo->list.array[arrIdx]->uLUPTNLInformation.choice.gTPTunnel->\
+ gTP_TEID.buf[3] = 2;
+
+ return ROK;
+}/*End of BuildULTnlInfo*/
+/*******************************************************************
+*
+* @brief freeing the DRB 2 item
+*
+* @details
+*
+* Function : FreeDrb2Item
+*
+* Functionality: freeing the DRB 2 item
+*
+* @params[in] DRBs_ToBeSetupMod_Item_t *drbItem
+*
+* @return ROK - success
+* RFAILED - failure
+*
+* ****************************************************************/
+
+void FreeDrb2Item(DRBs_ToBeSetupMod_Item_t *drbItem)
+{
+ uint8_t arrIdx =0;
+ SNSSAI_t *snssai =NULLP;
+ Flows_Mapped_To_DRB_List_t *flowMap = NULLP;
+
+ drbItem->qoSInformation.present = QoSInformation_PR_choice_extension;
+ switch(drbItem->qoSInformation.present)
+ {
+ case QoSInformation_PR_NOTHING:
+ break;
+ case QoSInformation_PR_eUTRANQoS:
+ {
+ if(drbItem->qoSInformation.choice.eUTRANQoS)
- default:
- {
- DU_LOG("\nF1AP : Invalid type of intiating message [%d]",f1apMsg->choice.initiatingMessage->value.present);
- return;
- }
- }/* End of switch(initiatingMessage) */
+ break;
+ }
+ case QoSInformation_PR_choice_extension:
+ {
+ if(drbItem->qoSInformation.choice.choice_extension)
+ {
+ FreeQOSInfo(&drbItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS);
+
+ snssai = &drbItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI;
+ if(snssai->sST.buf)
+ {
+ CU_FREE(snssai->sST.buf,snssai->sST.size);
+ }
+ if(snssai->sD)
+ {
+ if(snssai->sD->buf)
+ {
+ CU_FREE(snssai->sD->buf,snssai->sD->size);
+ }
+ CU_FREE(snssai->sD,sizeof(OCTET_STRING_t));
+ }
+
+ flowMap = &drbItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.flows_Mapped_To_DRB_List;
+ if(flowMap->list.array)
+ {
+ for(arrIdx=0; arrIdx<flowMap->list.count; arrIdx++)
+ {
+ if(flowMap->list.array[arrIdx] )
+ {
+ FreeQOSInfo(&flowMap->list.array[arrIdx]->qoSFlowLevelQoSParameters);
+ CU_FREE(flowMap->list.array[arrIdx],sizeof(Flows_Mapped_To_DRB_Item_t));
+ }
+ }
+ CU_FREE(flowMap->list.array,flowMap->list.size);
+ }
+
+ CU_FREE(drbItem->qoSInformation.choice.choice_extension,sizeof(QoSInformation_ExtIEs_t));
+ }
+ break;
+ }
+
+ }
+ FreeUlTnlInfoforDrb2(&drbItem->uLUPTNLInformation_ToBeSetup_List);
+ if(drbItem->uLConfiguration)
+ {
+ CU_FREE(drbItem->uLConfiguration,sizeof(ULConfiguration_t));
+ }
+}
+/*******************************************************************
+*
+* @brief filling the DRB 2 item
+*
+* @details
+*
+* Function : FillDrb2Item
+*
+* Functionality: filling the DRB 2 item
+*
+* @params[in] DRBs_ToBeSetupMod_Item_t *drbItem
+*
+* @return ROK - success
+* RFAILED - failure
+*
+* ****************************************************************/
+
+uint8_t FillDrb2Item(DRBs_ToBeSetupMod_Item_t *drbItem)
+{
+ uint8_t ret = ROK;
+
+ /*Drb Id */
+ drbItem->dRBID = DRB2;
+
+ /*qoSInformation*/
+ drbItem->qoSInformation.present = QoSInformation_PR_choice_extension;
+
+ switch(drbItem->qoSInformation.present)
+ {
+ case QoSInformation_PR_NOTHING:
+ {
- case SuccessfulOutcome__value_PR_ResetAcknowledge:
- {
- DU_LOG("\nF1Reset Acknowledgement is received successfully ");
- break;
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed in FillDrb2Item");
+ return RFAILED;
+ }
+
+ drbItem->qoSInformation.choice.choice_extension->id = ProtocolIE_ID_id_DRB_Information;
+ drbItem->qoSInformation.choice.choice_extension->criticality = Criticality_ignore;
+ drbItem->qoSInformation.choice.choice_extension->value.present = QoSInformation_ExtIEs__value_PR_DRB_Information;
+ ret = BuildQOSInfo(&drbItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS);
+ if(ret != ROK)
+ {
+ DU_LOG("\nERROR --> F1AP : BuildQOSInfo failed");
+ return RFAILED;
+ }
+
+ /*SNSSAI*/
+ ret = BuildSNSSAI(&drbItem->qoSInformation.choice.\
+ choice_extension->value.choice.DRB_Information.sNSSAI);
+ if(ret != ROK)
+ {
+ DU_LOG("\nERROR --> F1AP : BuildSNSSAI failed");
+ return RFAILED;
+ }
+
+ /*Flows mapped to DRB List*/
+ ret = BuildFlowsMap(&drbItem->qoSInformation.choice.\
+ choice_extension->value.choice.DRB_Information.flows_Mapped_To_DRB_List);
+ if(ret != ROK)
+ {
+ DU_LOG("\nERROR --> F1AP : BuildFlowsMap failed");
+ return RFAILED;
+ }
+ }
+ }
+
+ /*ULUPTNLInformation To Be Setup List*/
+ ret = BuildUlTnlInfoforDrb2(&drbItem->uLUPTNLInformation_ToBeSetup_List);
+ if(ret != ROK)
+ {
+ DU_LOG("\nERROR --> F1AP : BuildUlTnlInfoforDrb2 failed");
+ return RFAILED;
+ }
+
+ /*RLCMode*/
+ drbItem->rLCMode = RLCMode_rlc_um_bidirectional;
+
+ /*UL Configuration*/
+ CU_ALLOC(drbItem->uLConfiguration,sizeof(ULConfiguration_t));
+ if(drbItem->uLConfiguration == NULLP)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed in FillDrb2Item");
+ return RFAILED;
+ }
+ drbItem->uLConfiguration->uLUEConfiguration = ULUEConfiguration_no_data;
+ return ROK;
+}
+/*******************************************************************
+*
+* @brief Builds the DRB to be Setup Mod ItemIes
+*
+* @details
+*
+* Function : FillDrbItemList
+*
+* Functionality: Constructs the DRB to be Setup Mod Item Ies
+*
+* @params[in] struct DRBs_ToBeSetupMod_ItemIEs *drbItemIe
+*
+* @return ROK - success
+* RFAILED - failure
+*
+* ****************************************************************/
+
+uint8_t FillDrbItemList(struct DRBs_ToBeSetupMod_ItemIEs *drbItemIe)
+{
+ drbItemIe->id = ProtocolIE_ID_id_DRBs_ToBeSetupMod_Item;
+ drbItemIe->criticality = Criticality_reject;
+ drbItemIe->value.present = DRBs_ToBeSetupMod_ItemIEs__value_PR_DRBs_ToBeSetupMod_Item;
+
+ if(FillDrb2Item(&(drbItemIe->value.choice.DRBs_ToBeSetupMod_Item)) != ROK)
+ {
+ DU_LOG("\nERROR --> F1AP : FillDrb2Item failed");
+ return RFAILED;
+ }
+ return ROK;
+}
+/*******************************************************************
+*
+* @brief free the DRB to be Setup Mod list
+*
+* @details
+*
+* Function : FreeDrbToBeSetupModList
+*
+* Functionality: free the DRB to be Setup Mod list
+*
+* @params[in] DRBs_ToBeSetupMod_List_t *drbSet
+*
+* @return ROK - success
+* RFAILED - failure
+*
+* ****************************************************************/
+void FreeDrbToBeSetupModList(DRBs_ToBeSetupMod_List_t *drbSet)
+{
+ uint8_t arrIdx =0;
+ struct DRBs_ToBeSetupMod_ItemIEs *drbItemIe;
+
+ if(drbSet->list.array)
+ {
+ for(arrIdx=0; arrIdx<drbSet->list.count ; arrIdx++)
+ {
+ if(drbSet->list.array[arrIdx] != NULLP)
+ {
+ if(arrIdx == 0)
+ {
+ drbItemIe = (DRBs_ToBeSetupMod_ItemIEs_t *)drbSet->list.array[arrIdx];
+ FreeDrb2Item(&(drbItemIe->value.choice.DRBs_ToBeSetupMod_Item));
- case SuccessfulOutcome__value_PR_UEContextSetupResponse:
+ CU_FREE(drbSet->list.array[arrIdx], sizeof(DRBs_ToBeSetupMod_ItemIEs_t));
+ }
+ }
+ CU_FREE(drbSet->list.array, drbSet->list.size);
+ }
+
+}
+
+
+/*******************************************************************
+*
+* @brief Builds the DRB to be Setup Mod list
+*
+* @details
+*
+* Function : BuildDrbToBeSetupModList
+*
+* Functionality: Constructs the DRB to be Setup Mod list
+*
+* @params[in] DRBs_ToBeSetupMod_List_t *drbSet
+*
+* @return ROK - success
+* RFAILED - failure
+*
+* ****************************************************************/
+
+uint8_t BuildDrbToBeSetupModList(DRBs_ToBeSetupMod_List_t *drbSet)
+{
+ uint8_t ret = ROK;
+ uint8_t arrIdx =0;
+ uint8_t drbCnt =0;
+
+ drbCnt = 1;
+ drbSet->list.count = drbCnt;
+ drbSet->list.size = drbCnt * sizeof(DRBs_ToBeSetupMod_ItemIEs_t *);
+ CU_ALLOC(drbSet->list.array, drbSet->list.size);
+ if(drbSet->list.array == NULLP)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildDrbToBeSetupModList");
+ return RFAILED;
+ }
+ for(arrIdx=0; arrIdx<drbCnt; arrIdx++)
+ {
+ CU_ALLOC(drbSet->list.array[arrIdx], sizeof(DRBs_ToBeSetupMod_ItemIEs_t));
+ if(drbSet->list.array[arrIdx] == NULLP)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildDrbToBeSetupModList");
+ return RFAILED;
+ }
+ }
+
+ arrIdx=0;
+ ret = FillDrbItemList((DRBs_ToBeSetupMod_ItemIEs_t *)drbSet->list.array[arrIdx]);
+ if(ret != ROK)
+ {
+ DU_LOG("\nERROR --> F1AP : FillDrbItemList failed");
+ }
+
+ return ret;
+}
+/*******************************************************************
+ *
+ * @brief free the UeContextModification Request
+ *
+ * @details
+ *
+ * Function : FreeUeContextModicationRequest
+ *
+ * Functionality : deallocation of memory allocated in UeContextModiification
+ request
+ *
+ * @params[in] F1AP_PDU_t *f1apMsg
+ *
+ * @return void
+*
+* ****************************************************************/
+void FreeUeContextModicationRequest(F1AP_PDU_t *f1apMsg)
+{
+ uint8_t arrIdx =0 , ieId=0;
+ UEContextModificationRequest_t *UeContextModifyReq = NULLP;
+
+ if(f1apMsg)
+ {
+ if(f1apMsg->choice.initiatingMessage)
+ {
+ UeContextModifyReq =&f1apMsg->choice.initiatingMessage->value.choice.UEContextModificationRequest;
+ if(UeContextModifyReq->protocolIEs.list.array)
+ {
+ for( arrIdx = 0 ; arrIdx<UeContextModifyReq->protocolIEs.list.count ; arrIdx++)
+ }
+
+ f1apMsg->present = F1AP_PDU_PR_initiatingMessage;
+
+ CU_ALLOC(f1apMsg->choice.initiatingMessage, sizeof(InitiatingMessage_t));
+ if(f1apMsg->choice.initiatingMessage == NULLP)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation for F1AP-PDU failed Ue context modification");
+ break;
+ }
+ f1apMsg->choice.initiatingMessage->procedureCode = ProcedureCode_id_UEContextModification;
+ f1apMsg->choice.initiatingMessage->criticality = Criticality_reject;
+ f1apMsg->choice.initiatingMessage->value.present = InitiatingMessage__value_PR_UEContextModificationRequest;
+
+ ueContextModifyReq =&f1apMsg->choice.initiatingMessage->value.choice.UEContextModificationRequest;
+
+ elementCnt = 3;
+ ueContextModifyReq->protocolIEs.list.count = elementCnt;
+ ueContextModifyReq->protocolIEs.list.size = elementCnt*sizeof(UEContextModificationRequest_t *);
+
+ /* Initialize the UE context modification members */
+ CU_ALLOC(ueContextModifyReq->protocolIEs.list.array, ueContextModifyReq->protocolIEs.list.size);
+ if(ueContextModifyReq->protocolIEs.list.array == NULLP)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation for UE context modifcation Request failed");
+ break;
+ }
+
+ for(ieIdx=0 ; ieIdx<elementCnt; ieIdx++)
+ {
+ CU_ALLOC(ueContextModifyReq->protocolIEs.list.array[ieIdx], sizeof(UEContextModificationRequest_t));
+ if(ueContextModifyReq->protocolIEs.list.array[ieIdx] == NULLP)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation for UE context modifcation Request failed");
+ break;
+ }
+ }
+
+
+ ieIdx=0;
+ ueContextModifyReq->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID;
+ ueContextModifyReq->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
+ ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.present = \
+ UEContextModificationRequestIEs__value_PR_GNB_CU_UE_F1AP_ID;
+ ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_CU_UE_F1AP_ID =CU_ID;
+
+ ieIdx++;
+ ueContextModifyReq->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID;
+ ueContextModifyReq->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
+ ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.present=\
+ UEContextModificationRequestIEs__value_PR_GNB_DU_UE_F1AP_ID;
+ ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_UE_F1AP_ID =DU_ID;
+
+ ieIdx++;
+ ueContextModifyReq->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_DRBs_ToBeSetupMod_List;
+ ueContextModifyReq->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
+ ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.present =\
+ UEContextModificationRequestIEs__value_PR_DRBs_ToBeSetupMod_List;
+ ret = BuildDrbToBeSetupModList(&(ueContextModifyReq->protocolIEs.list.array[ieIdx]->\
+ value.choice.DRBs_ToBeSetupMod_List));
+ if(ret != ROK)
+ {
+ break;
+ }
+ xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg);
+
+ /* Encode the F1SetupRequest type as APER */
+ memset(encBuf, 0, ENC_BUF_MAX_LEN);
+ encBufSize = 0;
+ encRetVal = aper_encode(&asn_DEF_F1AP_PDU, 0, f1apMsg, PrepFinalEncBuf,\
+ encBuf);
+
+ /* Encode results */
+ if(encRetVal.encoded == ENCODE_FAIL)
+ {
+ DU_LOG("\nERROR --> F1AP : Could not encode ueContextModifyReq structure (at %s)\n",\
+ encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
+ break;
+ }
+ else
+ {
+ DU_LOG("\nDEBUG --> F1AP : Created APER encodedbuffer for ueContextModifyReq\n");
+ for(ieIdx=0; ieIdx< encBufSize; ieIdx++)
+ }
+
+ if(SendF1APMsg(CU_APP_MEM_REG, CU_POOL) != ROK)
+ {
+ DU_LOG("\nERROR --> F1AP : Sending Ue context modification request failed");
+ break;
+ }
+
+ ret = ROK;
+ break;
+
+ }
+ FreeUeContextModicationRequest(f1apMsg);
+ return ROK;
+}
+/*******************************************************************
+ *
+ * @brief Handles received F1AP message and sends back response
+ *
+ * @details
+ *
+ * Function : F1APMsgHdlr
+ *
+ * Functionality:
+ * - Decodes received F1AP control message
+ * - Prepares response message, encodes and sends to SCTP
+ *
+ * @params[in]
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+void F1APMsgHdlr(Buffer *mBuf)
+{
+ int i;
+ char *recvBuf;
+ MsgLen copyCnt;
+ MsgLen recvBufLen;
+ F1AP_PDU_t *f1apMsg = NULLP;
+ asn_dec_rval_t rval; /* Decoder return value */
+ F1AP_PDU_t f1apasnmsg ;
+
+ DU_LOG("\nINFO --> F1AP : Received F1AP message buffer");
+ ODU_PRINT_MSG(mBuf, 0,0);
+
+ /* Copy mBuf into char array to decode it */
+ ODU_GET_MSG_LEN(mBuf, &recvBufLen);
+ CU_ALLOC(recvBuf, (Size)recvBufLen);
+
+ if(recvBuf == NULLP)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed");
+ return;
+ }
+ if(ODU_COPY_MSG_TO_FIX_BUF(mBuf, 0, recvBufLen, (Data *)recvBuf, ©Cnt) != ROK)
+ {
+ DU_LOG("\nERROR --> F1AP : Failed while copying %d", copyCnt);
+ return;
+ }
+
+ DU_LOG("\nDEBUG --> F1AP : Received flat buffer to be decoded : ");
+ for(i=0; i< recvBufLen; i++)
+ {
+ DU_LOG("%x",recvBuf[i]);
+ }
+
+ /* Decoding flat buffer into F1AP messsage */
+ f1apMsg = &f1apasnmsg;
+ memset(f1apMsg, 0, sizeof(F1AP_PDU_t));
+
+ rval = aper_decode(0, &asn_DEF_F1AP_PDU, (void **)&f1apMsg, recvBuf, recvBufLen, 0, 0);
+ CU_FREE(recvBuf, (Size)recvBufLen);
+
+ if(rval.code == RC_FAIL || rval.code == RC_WMORE)
+ {
+ DU_LOG("\nERROR --> F1AP : ASN decode failed");
+ return;
+ }
+ DU_LOG("\n");
+ xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg);
+
+ switch(f1apMsg->present)
+ {
+ case F1AP_PDU_PR_initiatingMessage:
+ {
+ switch(f1apMsg->choice.initiatingMessage->value.present)
+ {
+ case InitiatingMessage__value_PR_Reset:
+ {
+ DU_LOG("\nINFO --> F1AP : F1 reset request received ");
+ BuildAndSendF1ResetAck();
+ break;
+ }
+
+ case InitiatingMessage__value_PR_F1SetupRequest:
+ {
+ DU_LOG("\nINFO --> F1AP : F1 setup request received");
+ BuildAndSendF1SetupRsp();
+ break;
+ }
+
+ case InitiatingMessage__value_PR_GNBDUConfigurationUpdate:
+ {
+ DU_LOG("\nINFO --> F1AP : GNB-DU config update received");
+ BuildAndSendDUUpdateAck();
+ DU_LOG("\nINFO --> F1AP : Sending F1 reset request");
+ BuildAndSendF1ResetReq();
+ break;
+ }
+ case InitiatingMessage__value_PR_InitialULRRCMessageTransfer:
+ {
+ DU_LOG("\nINFO --> F1AP : Received InitialULRRCMessageTransfer");
+ procInitULRRCMsg(f1apMsg);
+ break;
+ }
+ case InitiatingMessage__value_PR_ULRRCMessageTransfer:
+ {
+ DU_LOG("\nINFO --> F1AP : Received ULRRCMessageTransfer");
+ procUlRrcMsg(f1apMsg);
+ break;
+ }
+
+ case InitiatingMessage__value_PR_RRCDeliveryReport:
+ {
+ DU_LOG("\nINFO --> F1AP : Received RRC delivery report");
+ break;
+ }
+ case InitiatingMessage__value_PR_UEContextReleaseRequest:
+ {
+ DU_LOG("\nINFO --> F1AP : Received UE Context Release Request");
+ break;
+ }
+ default:
+ {
+ DU_LOG("\nERROR --> F1AP : Invalid type of intiating message [%d]",\
+ f1apMsg->choice.initiatingMessage->value.present);
+ return;
+ }
+ }/* End of switch(initiatingMessage) */
+ break;
+ }
+
+ case F1AP_PDU_PR_successfulOutcome:
+ {
+ switch(f1apMsg->choice.successfulOutcome->value.present)
+ {
+ case SuccessfulOutcome__value_PR_ResetAcknowledge:
+ {
+ DU_LOG("\nINFO --> F1Reset Acknowledgement is received successfully ");
+ break;
+ }
+ case SuccessfulOutcome__value_PR_UEContextSetupResponse:
+ {
+ DU_LOG("\nINFO --> F1AP : UE ContextSetupResponse received");
+ f1apMsgDb.dlRrcMsgCount++; /* keeping DL RRC Msg Count */
+ break;
+ }
+ case SuccessfulOutcome__value_PR_UEContextModificationResponse:
+ {
+ DU_LOG("\nINFO --> F1AP : UE Context Modification Response received");
+ break;
+ }
+ case SuccessfulOutcome__value_PR_UEContextReleaseComplete:
+ {
+ DU_LOG("\nINFO --> F1AP : UE Context release complete received");
+ break;
+ }
+ default:
+ {
+ DU_LOG("\nERROR --> F1AP : Invalid type of successful outcome message [%d]",\
+ f1apMsg->choice.successfulOutcome->value.present);
+ return;
+ }
+ }/* End of switch(successfulOutcome) */
+ break;
+ }
+ default:
+ {
+ DU_LOG("\nERROR --> F1AP : Invalid type of f1apMsg->present [%d]",f1apMsg->present);
+ return;
+ }