/* This file contains ASN codec for MIB and SIB1 msgs */
#include "common_def.h"
+#include "du_tmr.h"
#include "lrg.h"
#include "lkw.x"
#include "lrg.x"
#include "du_app_mac_inf.h"
#include "du_cfg.h"
#include "du_app_rlc_inf.h"
+#include "du_e2ap_mgr.h"
#include "du_mgr.h"
#include "du_utils.h"
#include "BCCH-BCH-Message.h"
#include "MCC.h"
#include "SIB1.h"
#include "odu_common_codec.h"
-#include "du_sys_info_hdl.h"
+#include "BCCH-DL-SCH-Message.h"
#include "du_f1ap_conversions.h"
+#include "du_sys_info_hdl.h"
void FreeSib1Msg(SIB1_t *sib1Msg);
uint8_t FreqInfoUlret = RFAILED;
xer_fprint(stdout, &asn_DEF_BCCH_BCH_Message, bcchMsg);
memset(encBuf, 0, ENC_BUF_MAX_LEN);
encBufSize = 0;
- encRetVal = aper_encode(&asn_DEF_BCCH_BCH_Message, 0,
+ encRetVal = uper_encode(&asn_DEF_BCCH_BCH_Message, 0,
bcchMsg, PrepFinalEncBuf, encBuf);
printf("\nencbufSize:%d\n", encBufSize);
if(encRetVal.encoded == -1)
break;
}
+#ifdef DEBUG_ASN_PRINT
/* Print encoded buffer */
for(int i=0; i< encBufSize; i++)
{
printf("%x\t",encBuf[i]);
}
printf("\n");
+#endif
ret = ROK;
break;
xer_fprint(stdout, &asn_DEF_MIB, mibMsg);
memset(encBuf, 0, ENC_BUF_MAX_LEN);
encBufSize = 0;
- encRetVal = aper_encode(&asn_DEF_MIB, 0,
+ encRetVal = uper_encode(&asn_DEF_MIB, 0,
mibMsg, PrepFinalEncBuf, encBuf);
printf("\nencbufSize:%d\n", encBufSize);
if(encRetVal.encoded == -1)
break;
}
+#ifdef DEBUG_ASN_PRINT
/* Print encoded buffer */
for(int i=0; i< encBufSize; i++)
{
printf("%x\t",encBuf[i]);
}
printf("\n");
+#endif
/* Free allocated memory */
ret = ROK;
DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
return RFAILED;
}
+
elementCnt = cellAccessInfo->plmn_IdentityList.list.count;
for(idx=0; idx<elementCnt; idx++)
{
/* PLMN list */
elementCnt = ODU_VALUE_ONE;
- plmnIdInfo = &cellAccessInfo->plmn_IdentityList.list.array[idx]->\
- plmn_IdentityList;
+ plmnIdInfo = &cellAccessInfo->plmn_IdentityList.list.array[idx]->plmn_IdentityList;
plmnIdInfo->list.count = elementCnt;
plmnIdInfo->list.size = elementCnt * sizeof(PLMN_IdentitY_t *);
DU_ALLOC(plmnIdInfo->list.array, plmnIdInfo->list.size);
for(idx1=0; idx1<elementCnt; idx1++)
{
- DU_ALLOC(plmnIdInfo->list.array[idx1],
- sizeof(PLMN_IdentitY_t));
+ DU_ALLOC(plmnIdInfo->list.array[idx1], sizeof(PLMN_IdentitY_t));
if(!(plmnIdInfo->list.array[idx1]))
{
DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
}
}
idx1 = 0;
- DU_ALLOC(plmnIdInfo->list.array[idx1]->mcc,
- sizeof(MCC_t));
+ DU_ALLOC(plmnIdInfo->list.array[idx1]->mcc, sizeof(MCC_t));
if(!plmnIdInfo->list.array[idx1]->mcc)
{
DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
elementCnt = ODU_VALUE_THREE;
plmnIdInfo->list.array[idx1]->mcc->list.count = elementCnt;
- plmnIdInfo->list.array[idx1]->mcc->list.size =\
- elementCnt * sizeof(MCC_MNC_Digit_t *);
- DU_ALLOC(plmnIdInfo->list.array[idx1]->mcc->list.array,
- plmnIdInfo->list.array[idx1]->mcc->list.size)
- if(!(plmnIdInfo->list.array[idx1]->mcc->list.array))
- {
- DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
- return RFAILED;
- }
+ plmnIdInfo->list.array[idx1]->mcc->list.size = elementCnt * sizeof(MCC_MNC_Digit_t *);
+ DU_ALLOC(plmnIdInfo->list.array[idx1]->mcc->list.array, plmnIdInfo->list.array[idx1]->mcc->list.size);
+ if(!(plmnIdInfo->list.array[idx1]->mcc->list.array))
+ {
+ DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
+ return RFAILED;
+ }
for(idx2=0; idx2<elementCnt; idx2++)
{
DU_ALLOC(plmnIdInfo->list.array[idx1]->mcc->list.array[idx2],
searchSpace->nrofCandidates->aggregationLevel8 = duPdcchCfg.numCandAggLvl8;
searchSpace->nrofCandidates->aggregationLevel16 = duPdcchCfg.numCandAggLvl16;
+/* Commented due to ASN decode failure in wireshark.
+ * Parameters like dci_Format0_0_AndFormat1_0 which are pointer to a structure that
+ * does not have any member parameter lead to decode failure in wireshark.
+ * The issue has been reported to Nokia.
+ * The following code will be uncommented once the issue is resolved */
+#if 0
/* Search Space type and DCI Format */
DU_ALLOC(searchSpace->searchSpaceType, sizeof( struct SearchSpace__searchSpaceType));
if(!searchSpace->searchSpaceType)
DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
return RFAILED;
}
-
+
+ searchSpace->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0 = NULLP;
DU_ALLOC(searchSpace->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0, \
sizeof(struct SearchSpace__searchSpaceType__common__dci_Format0_0_AndFormat1_0));
if(!searchSpace->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0)
DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
return RFAILED;
}
+
+ searchSpace->searchSpaceType->choice.common->dci_Format2_0 = NULLP;
+ searchSpace->searchSpaceType->choice.common->dci_Format2_1 = NULLP;
+ searchSpace->searchSpaceType->choice.common->dci_Format2_2 = NULLP;
+ searchSpace->searchSpaceType->choice.common->dci_Format2_3 = NULLP;
break;
}
case SearchSpace__searchSpaceType_PR_ue_Specific:
return RFAILED;
}
}
+#endif
return ROK;
}/* BuildCommonSerachSpaceList */
return RFAILED;
}
*pdcchSetup->ra_SearchSpace = duPdcchCfg.raSearchSpc;
-
break;
}
default :
* ****************************************************************/
uint8_t BuildSib1Msg()
{
+ BCCH_DL_SCH_Message_t bcchMsg;
SIB1_t *sib1Msg;
CellAccessRelatedInfo_t *cellAccessInfo;
uint8_t elementCnt;
do
{
- DU_ALLOC(sib1Msg, sizeof(SIB1_t));
- if(!sib1Msg)
+ bcchMsg.message.present = BCCH_DL_SCH_MessageType_PR_c1;
+
+ DU_ALLOC(bcchMsg.message.choice.c1, sizeof(struct BCCH_DL_SCH_MessageType__c1));
+ if(!bcchMsg.message.choice.c1)
+ {
+ DU_LOG("\nERROR --> DU APP: BCCH-DL-SCH msg memory allocation failure");
+ break;
+ }
+ bcchMsg.message.choice.c1->present = BCCH_DL_SCH_MessageType__c1_PR_systemInformationBlockType1;
+ DU_ALLOC(bcchMsg.message.choice.c1->choice.systemInformationBlockType1, sizeof(SIB1_t));
+ if(!bcchMsg.message.choice.c1->choice.systemInformationBlockType1)
{
DU_LOG("\nERROR --> DU APP: SIB1 msg memory allocation failure");
break;
}
-
+ sib1Msg = bcchMsg.message.choice.c1->choice.systemInformationBlockType1;
elementCnt = ODU_VALUE_ONE;
+ /* Cell Selection Info */
+ DU_ALLOC(sib1Msg->cellSelectionInfo, sizeof(struct SIB1__cellSelectionInfo));
+ if(!sib1Msg->cellSelectionInfo)
+ {
+ DU_LOG("\nERROR --> DU APP: SIB1 Cell Selection Info memory allocation failed");
+ break;
+ }
+
+ sib1Msg->cellSelectionInfo->q_RxLevMin = -50;
+
+ DU_ALLOC(sib1Msg->cellSelectionInfo->q_RxLevMinSUL, sizeof(Q_RxLevMin_t));
+ if(!sib1Msg->cellSelectionInfo->q_RxLevMinSUL)
+ {
+ DU_LOG("\nERROR --> DU APP: BuildSib1Msg(): Memory allocation failed for q_RxLevMinSUL");
+ break;
+ }
+ *(sib1Msg->cellSelectionInfo->q_RxLevMinSUL) = -50;
+
+ DU_ALLOC(sib1Msg->cellSelectionInfo->q_QualMin, sizeof(Q_QualMin_t));
+ if(!sib1Msg->cellSelectionInfo->q_QualMin)
+ {
+ DU_LOG("\nERROR --> DU APP: BuildSib1Msg(): Memory allocation failed for q_QualMin");
+ break;
+ }
+ *(sib1Msg->cellSelectionInfo->q_QualMin) = -30;
+
/* PLMN list */
cellAccessInfo = &sib1Msg->cellAccessRelatedInfo;
cellAccessInfo->plmn_IdentityList.list.count = elementCnt;
DU_LOG("\nERROR --> DU APP: sib1Msg->connEstFailureControl memory allocation failure");
break;
}
- sib1Msg->connEstFailureControl->connEstFailCount =\
- duCfgParam.sib1Params.connEstFailCnt;
- sib1Msg->connEstFailureControl->connEstFailOffsetValidity =\
- duCfgParam.sib1Params.connEstFailOffValidity;
+ sib1Msg->connEstFailureControl->connEstFailCount = duCfgParam.sib1Params.connEstFailCnt;
+ sib1Msg->connEstFailureControl->connEstFailOffsetValidity = duCfgParam.sib1Params.connEstFailOffValidity;
+
+ DU_ALLOC(sib1Msg->connEstFailureControl->connEstFailOffset, sizeof(long));
+ if(!sib1Msg->connEstFailureControl->connEstFailOffset)
+ {
+ DU_LOG("\nERROR --> DU APP: BuildSib1Msg(): Memory allocation failed for connEstFailOffset");
+ break;
+ }
+ *(sib1Msg->connEstFailureControl->connEstFailOffset) = duCfgParam.sib1Params.connEstFailOffset;
/* SI Scheduling Info */
DU_ALLOC(sib1Msg->si_SchedulingInfo, sizeof(SI_SchedulingInfo_t));
break;
}
- xer_fprint(stdout, &asn_DEF_SIB1, sib1Msg);
+ xer_fprint(stdout, &asn_DEF_BCCH_DL_SCH_Message, &bcchMsg);
/* Encode the F1SetupRequest type as APER */
memset(encBuf, 0, ENC_BUF_MAX_LEN);
encBufSize = 0;
- encRetVal = aper_encode(&asn_DEF_SIB1, 0, sib1Msg, PrepFinalEncBuf,\
+ encRetVal = uper_encode(&asn_DEF_BCCH_DL_SCH_Message, 0, &bcchMsg, PrepFinalEncBuf,\
encBuf);
printf("\nencbufSize: %d\n", encBufSize);
if(encRetVal.encoded == -1)
{
- DU_LOG("\nERROR --> DU APP : Could not encode SIB1 structure (at %s)\n",\
+ DU_LOG("\nERROR --> DU APP : Could not encode BCCH-DL-SCH structure (at %s)\n",\
encRetVal.failed_type ?
encRetVal.failed_type->name :
"unknown");
break;
}
+#ifdef DEBUG_ASN_PRINT
for(int i=0; i< encBufSize; i++)
{
printf("%x\t",encBuf[i]);
}
printf("\n");
+#endif
ret = ROK;
break;
}while(true);
- FreeSib1Msg(sib1Msg);
+ FreeBcchDlSchMsg(bcchMsg);
return ret;
-
-
}
+
/*******************************************************************
*
* @brief : deallocating the memory of BuildSib1Msg
/* P0 Nominal with grant */
DU_FREE(setup->p0_NominalWithGrant, sizeof(long));
- DU_ALLOC(puschCfg->choice.setup, sizeof(PUSCH_ConfigCommon_t));
+ DU_FREE(puschCfg->choice.setup, sizeof(PUSCH_ConfigCommon_t));
}
}/* BuildPuschCfgCommon */
}
+/*******************************************************************
+ *
+ * @brief : Deallocation of BCCH_DL_SCH_Message_t
+ *
+ * @details
+ *
+ * Function : FreeBcchDlSchMsg
+ *
+ * Functionality: Freeing memory of BCCH DL SCH Message
+ *
+ * @params[in] : BCCH_DL_SCH_Message_t bcchMsg
+ * @return : void
+ *
+ *******************************************************************/
+void FreeBcchDlSchMsg(BCCH_DL_SCH_Message_t bcchMsg)
+{
+ switch(bcchMsg.message.present)
+ {
+ case BCCH_DL_SCH_MessageType_PR_c1:
+ {
+ switch(bcchMsg.message.choice.c1->present)
+ {
+ case BCCH_DL_SCH_MessageType__c1_PR_systemInformationBlockType1:
+ {
+ FreeSib1Msg(bcchMsg.message.choice.c1->choice.systemInformationBlockType1);
+ break;
+ }
+ case BCCH_DL_SCH_MessageType__c1_PR_systemInformation:
+ break;
+ case BCCH_DL_SCH_MessageType__c1_PR_NOTHING:
+ break;
+ }
+ DU_FREE(bcchMsg.message.choice.c1, sizeof(struct BCCH_DL_SCH_MessageType__c1));
+ break;
+ }
+ case BCCH_DL_SCH_MessageType_PR_messageClassExtension:
+ break;
+ case BCCH_DL_SCH_MessageType_PR_NOTHING:
+ break;
+ }
+}
+
/**********************************************************************
End of file
**********************************************************************/