void fillMsg4DlData(MacDlData *dlData)
{
uint8_t idx = 0;
+ uint16_t idx2;
dlData->numPdu = 1;
dlData->pduInfo[idx].lcId = MAC_LCID_CCCH;
- dlData->pduInfo[idx].pduLen = macCb.macCell->macRaCb[0].msg4PduLen;
- memcpy(dlData->pduInfo[idx].dlPdu, macCb.macCell->macRaCb[0].msg4Pdu,\
- macCb.macCell->macRaCb[0].msg4PduLen);
+ dlData->pduInfo[idx].pduLen = macCb.macCell->macRaCb[idx].msg4PduLen;
+ for(idx2 = 0; idx2 < dlData->pduInfo[idx].pduLen; idx2++)
+ {
+ dlData->pduInfo[idx].dlPdu[idx2] = \
+ macCb.macCell->macRaCb[idx].msg4Pdu[idx2];
+ }
}
/*************************************************
for(idx = 0; idx < macCeInfo->numCes; idx++)
{
macCeInfo->macCe[idx].macCeLcid = MAC_LCID_CRI;
- memcpy(&macCeInfo->macCe[idx].macCeValue, \
- &macCb.macCell->macRaCb[idx].msg3Pdu, MAX_CRI_SIZE);
+ memcpy(macCeInfo->macCe[idx].macCeValue, \
+ macCb.macCell->macRaCb[idx].msg3Pdu, MAX_CRI_SIZE);
}
}
*
* @details
*
- * Function : buildMacPdu
+ * Function : macMuxPdu
*
* Functionality:
* The MAC PDU will be MUXed and formed
uint8_t RBit = 0; /* Reserved bit */
uint8_t FBit; /* Format Indicator */
uint8_t lcid; /* LCID */
- uint8_t lenField = 0; /* Length field */
+ uint16_t lenField = 0; /* Length field */
/* subheader field size (in bits) */
uint8_t RBitSize = 1;
uint8_t FBitSize = 1;
uint8_t lcidSize = 6;
- uint8_t lenFieldSize = 0; /* 8-bit or 16-bit L field */
+ uint8_t lenFieldSize = 0; /* 8-bit or 16-bit L field */
/* PACK ALL MAC CE */
for(idx = 0; idx < macCeData->numCes; idx++)
case MAC_LCID_CRI:
{
/* Packing fields into MAC PDU R/R/LCID */
- packBytes(macPdu, &bytePos, &bitPos, RBit, RBitSize);
- packBytes(macPdu, &bytePos, &bitPos, RBit, RBitSize);
+ packBytes(macPdu, &bytePos, &bitPos, RBit, (RBitSize * 2));
packBytes(macPdu, &bytePos, &bitPos, lcid, lcidSize);
memcpy(&macPdu[bytePos], macCeData->macCe[idx].macCeValue,\
MAX_CRI_SIZE);
+ bytePos += MAX_CRI_SIZE;
break;
}
default:
for(idx = 0; idx < dlData->numPdu; idx++)
{
lcid = dlData->pduInfo[idx].lcId;
- lenField = dlData->pduInfo[idx].pduLen;
switch(lcid)
{
case MAC_LCID_CCCH:
{
+ lenField = dlData->pduInfo[idx].pduLen;
if(dlData->pduInfo[idx].pduLen > 255)
{
FBit = 1;
packBytes(macPdu, &bytePos, &bitPos, FBit, FBitSize);
packBytes(macPdu, &bytePos, &bitPos, lcid, lcidSize);
packBytes(macPdu, &bytePos, &bitPos, lenField, lenFieldSize);
- memcpy(&macPdu[bytePos], dlData->pduInfo[idx].dlPdu, lenField);
+ memcpy(&macPdu[bytePos], dlData->pduInfo[idx].dlPdu, lenField);
+ bytePos += lenField;
break;
}
packBytes(macPdu, &bytePos, &bitPos, lcid, lcidSize);
}
+ /*Storing the muxed pdu in macRaCb */
+ macCb.macCell->macRaCb[0].msg4TxPdu = NULLP;
MAC_ALLOC(macCb.macCell->macRaCb[0].msg4TxPdu, macCb.macCell->macRaCb[0].msg4TbSize);
if(macCb.macCell->macRaCb[0].msg4TxPdu != NULLP)
{
- memcpy(macCb.macCell->macRaCb[0].msg4TxPdu, macPdu,\
- macCb.macCell->macRaCb[0].msg4TbSize);
+ memcpy(macCb.macCell->macRaCb[0].msg4TxPdu, macPdu,\
+ macCb.macCell->macRaCb[0].msg4TbSize);
}
}
* ****************************************************************/
S16 SendF1APMsg(Region region, Pool pool)
{
- Buffer *mBuf;
+ Buffer *mBuf = NULLP;
if(SGetMsg(region, pool, &mBuf) == ROK)
{
/*******************************************************************
*
- * @brief Builds and sends the DLRRCMessageTransfer
+ * @brief Fills Radio Bearer Config
*
* @details
*
- * Function : BuildAndSendDLRRCMessageTransfer
+ * Function : fillRadioBearerConfig
*
- * Functionality: Constructs the DL RRC Message Transfer and sends
- * it to the CU through SCTP.
+ * Functionality: Fills Radio Bearer Config
*
- * @params[in]
+ * @params[in] SRB_ToAddModList *
*
* @return ROK - success
* RFAILED - failure
*
* ****************************************************************/
-S16 BuildAndSendDLRRCMessageTransfer()
+uint8_t fillRadioBearerConfig(SRB_ToAddModList_t *bearerCfg)
{
- S16 ret;
- U8 elementCnt;
- U8 ieId;
- U8 idx;
- F1AP_PDU_t *f1apMsg = NULL;
- DLRRCMessageTransfer_t *dlRRCMsg;
- asn_enc_rval_t encRetVal; /* Encoder return value */
+ uint8_t elementCnt;
+ uint8_t idx;
+ uint8_t ied;
+ if(bearerCfg != NULLP)
+ {
+ elementCnt = 1;
+ bearerCfg->list.count = elementCnt;
+ bearerCfg->list.size =\
+ elementCnt * sizeof(SRB_ToAddMod_t *);
+ CU_ALLOC(bearerCfg->list.array, bearerCfg->list.size);
+ if(bearerCfg->list.array != NULLP)
+ {
+ for(idx = 0; idx < elementCnt; idx++)
+ {
+ CU_ALLOC(bearerCfg->list.array[idx], sizeof(SRB_ToAddMod_t));
+ if(bearerCfg->list.array[idx] == NULLP)
+ {
+ for(ied = 0; ied < idx; ied++)
+ {
+ CU_FREE(bearerCfg->list.array[idx], sizeof(SRB_ToAddMod_t));
+ }
+ CU_FREE(bearerCfg->list.array, bearerCfg->list.size);
+ return RFAILED;
+ }
+ }
+ }
+ else
+ {
+ return RFAILED;
+ }
+ idx = 0;
+ bearerCfg->list.array[idx]->srb_Identity = SRB1;
+ }
+ return ROK;
+}
- DU_LOG("\n F1AP : Building DL RRC Message Transfer Message\n");
+/*******************************************************************
+ *
+ * @brief Fills Master CellGroup Info
+ *
+ * @details
+ *
+ * Function : fillMasterCellGroup
+ *
+ * Functionality: Fills Master Cell Group IE
+ *
+ * @params[in] RRCSetup_IEs_t *
+ *
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
- CU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t));
- if(f1apMsg == NULLP)
+uint8_t fillMasterCellGroup(OCTET_STRING_t *masterCellGroup)
+{
+ uint8_t ret = ROK;
+ masterCellGroup->buf = NULLP;
+ if(f1apMsgDb.duToCuContainer.buf)
{
- DU_LOG(" F1AP : Memory allocation for F1AP-PDU failed");
- RETVALUE(RFAILED);
+ masterCellGroup->size = f1apMsgDb.duToCuContainer.size;
+ CU_ALLOC(masterCellGroup->buf, masterCellGroup->size);
+ if(masterCellGroup->buf != NULLP)
+ {
+ memcpy(masterCellGroup->buf, f1apMsgDb.duToCuContainer.buf,\
+ masterCellGroup->size);
+ }
+ else
+ {
+ ret = RFAILED;
+ }
}
-
- f1apMsg->present = F1AP_PDU_PR_initiatingMessage;
- CU_ALLOC(f1apMsg->choice.initiatingMessage,
- sizeof(InitiatingMessage_t));
- if(f1apMsg->choice.initiatingMessage == NULLP)
+ else
{
- DU_LOG(" F1AP : Memory allocation for F1AP-PDU failed");
- CU_FREE(f1apMsg,sizeof(F1AP_PDU_t));
- RETVALUE(RFAILED);
- }
+ ret = RFAILED;
+ }
+ return ret;
+}
- f1apMsg->choice.initiatingMessage->procedureCode = \
- ProcedureCode_id_DLRRCMessageTransfer;
- f1apMsg->choice.initiatingMessage->criticality = Criticality_ignore;
- f1apMsg->choice.initiatingMessage->value.present = \
- InitiatingMessage__value_PR_DLRRCMessageTransfer;
- dlRRCMsg =
- &f1apMsg->choice.initiatingMessage->value.choice.DLRRCMessageTransfer;
- elementCnt = 3;
- dlRRCMsg->protocolIEs.list.count = elementCnt;
- dlRRCMsg->protocolIEs.list.size = \
- elementCnt * sizeof(DLRRCMessageTransferIEs_t *);
-
- /* Initialize the F1Setup members */
- CU_ALLOC(dlRRCMsg->protocolIEs.list.array, \
- elementCnt * sizeof(DLRRCMessageTransferIEs_t *));
- if(dlRRCMsg->protocolIEs.list.array == NULLP)
- {
- DU_LOG(" F1AP : Memory allocation for DL RRC MessageTransferIEs failed");
- CU_FREE(f1apMsg->choice.initiatingMessage,
- sizeof(InitiatingMessage_t));
- CU_FREE(f1apMsg,(Size)sizeof(F1AP_PDU_t));
- RETVALUE(RFAILED);
- }
+/*******************************************************************
+ *
+ * @brief Fills RRC setup IE
+ *
+ * @details
+ *
+ * Function : fillRRCSetupIE
+ *
+ * Functionality: Fills RRC Setup IE
+ *
+ * @params[in] RRCSetup_IEs_t *
+ *
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
- for(idx=0; idx<elementCnt; idx++)
- {
- CU_ALLOC(dlRRCMsg->protocolIEs.list.array[idx],\
- sizeof(DLRRCMessageTransferIEs_t));
- if(dlRRCMsg->protocolIEs.list.array[idx] == NULLP)
+uint8_t fillRRCSetupIE(RRCSetup_IEs_t *rrcSetupIE)
+{
+ uint8_t ret = ROK;
+ if(rrcSetupIE)
+ {
+ CU_ALLOC(rrcSetupIE->radioBearerConfig.srb_ToAddModList, sizeof(SRB_ToAddModList_t));
+ if(rrcSetupIE->radioBearerConfig.srb_ToAddModList != NULLP)
{
- for(ieId=0; ieId<idx; ieId++)
+ ret = fillRadioBearerConfig(rrcSetupIE->radioBearerConfig.srb_ToAddModList);
+ }
+ if(!ret)
+ {
+ ret = fillMasterCellGroup(&rrcSetupIE->masterCellGroup);
+ }
+ else
+ {
+ CU_FREE(rrcSetupIE->radioBearerConfig.srb_ToAddModList, sizeof(SRB_ToAddModList_t));
+ ret = RFAILED;
+ }
+ }
+ return ret;
+}
+/*******************************************************************
+ *
+ * @brief Builds RRC Container IE required for DLRRCMessageTransfer
+ *
+ * @details
+ *
+ * Function : BuildDLRRCContainer
+ *
+ * Functionality: Builds RRC Container IE required for
+ * DLRRCMessageTransfer
+ *
+ * @params[in]
+ *
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+
+uint8_t BuildDLRRCContainer(RRCContainer_t *rrcContainer)
+{
+ uint8_t ret = ROK;
+ uint16_t idx2;
+ DL_CCCH_Message_t dl_CCCH_Msg;
+ asn_enc_rval_t encRetVal;
+
+ if(rrcContainer != NULLP)
+ {
+ dl_CCCH_Msg.message.present = DL_CCCH_MessageType_PR_c1;
+
+ CU_ALLOC(dl_CCCH_Msg.message.choice.c1 , sizeof(DL_CCCH_MessageType_t));
+ if(dl_CCCH_Msg.message.choice.c1 != NULLP)
+ {
+ dl_CCCH_Msg.message.choice.c1->present = DL_CCCH_MessageType__c1_PR_rrcSetup;
+ CU_ALLOC(dl_CCCH_Msg.message.choice.c1->choice.rrcSetup, sizeof(RRCSetup_t));
+ if(dl_CCCH_Msg.message.choice.c1->choice.rrcSetup != NULLP)
+ {
+ dl_CCCH_Msg.message.choice.c1->choice.rrcSetup->rrc_TransactionIdentifier = 0;
+ dl_CCCH_Msg.message.choice.c1->choice.rrcSetup->criticalExtensions.\
+ present = RRCSetup__criticalExtensions_PR_rrcSetup;
+ /* Fill RRC Setup IE */
+ CU_ALLOC(dl_CCCH_Msg.message.choice.c1->choice.rrcSetup->\
+ criticalExtensions.choice.rrcSetup, sizeof(RRCSetup_IEs_t));
+ if(dl_CCCH_Msg.message.choice.c1->choice.rrcSetup->\
+ criticalExtensions.choice.rrcSetup != NULLP)
+ {
+ ret = fillRRCSetupIE(dl_CCCH_Msg.message.choice.c1->choice.rrcSetup->\
+ criticalExtensions.choice.rrcSetup);
+
+ if(!ret)
+ {
+ /* encode DL-CCCH message into RRC Container */
+ xer_fprint(stdout, &asn_DEF_DL_CCCH_MessageType, &dl_CCCH_Msg);
+ cmMemset((U8 *)encBuf, 0, ENC_BUF_MAX_LEN);
+ encBufSize = 0;
+ encRetVal = aper_encode(&asn_DEF_DL_CCCH_MessageType, 0, &dl_CCCH_Msg, PrepFinalEncBuf, encBuf);
+ /* Encode results */
+ if(encRetVal.encoded == ENCODE_FAIL)
+ {
+ DU_LOG( "\n F1AP : Could not encode RRCContainer (at %s)\n",\
+ encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
+ return RFAILED;
+ }
+ else
+ {
+ DU_LOG("\n F1AP : Created APER encoded buffer for RRCContainer\n");
+ for(int i = 0; i< encBufSize; i++)
+ {
+ printf("%x",encBuf[i]);
+ }
+ rrcContainer->size = encBufSize;
+ CU_ALLOC(rrcContainer->buf, rrcContainer->size);
+ if(rrcContainer->buf != NULLP)
+ {
+ memset(rrcContainer->buf, 0, encBufSize);
+ for(idx2 = 0; idx2 < encBufSize; idx2++)
+ {
+ rrcContainer->buf[idx2] = encBuf[idx2];
+ }
+ }
+ }
+ }
+ else
+ {
+ ret = RFAILED;
+ }
+ }
+ else
+ {
+ DU_LOG("\nF1AP: Memory Alloc failed for RRC Setup Msg");
+ ret = RFAILED;
+ }
+ }
+ else
{
- CU_FREE(dlRRCMsg->protocolIEs.list.array[ieId],\
- sizeof(DLRRCMessageTransferIEs_t));
+ DU_LOG("\nF1AP: Memory Alloc failed for RRC Msg");
+ ret = RFAILED;
}
- CU_FREE(dlRRCMsg->protocolIEs.list.array,\
- elementCnt * sizeof(DLRRCMessageTransferIEs_t *));
- CU_FREE(f1apMsg->choice.initiatingMessage,\
- sizeof(InitiatingMessage_t));
- CU_FREE(f1apMsg,sizeof(F1AP_PDU_t));
- RETVALUE(RFAILED);
+ }
+ else
+ {
+ DU_LOG("\nF1AP: Memory Alloc failed for DL Ccch Msg choice");
+ ret = RFAILED;
}
+ }
+ else
+ {
+ DU_LOG("\nF1AP: Memory Alloc failed for DlCcch Msg");
+ ret = RFAILED;
}
+ return ret;
+}
- idx = 0;
-
- /*GNB CU UE F1AP ID*/
- dlRRCMsg->protocolIEs.list.array[idx]->id = \
- ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID;
- dlRRCMsg->protocolIEs.list.array[idx]->criticality = Criticality_reject;
- dlRRCMsg->protocolIEs.list.array[idx]->value.present = \
- DLRRCMessageTransferIEs__value_PR_GNB_CU_UE_F1AP_ID;
- dlRRCMsg->protocolIEs.list.array[idx]->value.choice.GNB_CU_UE_F1AP_ID = CU_ID;
-
- /*GNB DU UE F1AP ID*/
- idx++;
- dlRRCMsg->protocolIEs.list.array[idx]->id = \
- ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID;
- dlRRCMsg->protocolIEs.list.array[idx]->criticality = Criticality_reject;
- dlRRCMsg->protocolIEs.list.array[idx]->value.present = \
- DLRRCMessageTransferIEs__value_PR_GNB_DU_UE_F1AP_ID;
- dlRRCMsg->protocolIEs.list.array[idx]->value.choice.GNB_DU_UE_F1AP_ID = DU_ID;
+/*******************************************************************
+ *
+ * @brief Builds and sends the DLRRCMessageTransfer
+ *
+ * @details
+ *
+ * Function : BuildAndSendDLRRCMessageTransfer
+ *
+ * Functionality: Constructs the DL RRC Message Transfer and sends
+ * it to the CU through SCTP.
+ *
+ * @params[in]
+ *
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+S16 BuildAndSendDLRRCMessageTransfer()
+{
+ uint8_t ret = ROK ;
+ uint8_t elementCnt = 0;
+ uint8_t ieId;
+ uint8_t idx;
+ uint16_t idx2;
+ F1AP_PDU_t *f1apMsg = NULLP;
+ DLRRCMessageTransfer_t *dlRRCMsg = NULLP;
+ asn_enc_rval_t encRetVal; /* Encoder return value */
+
+ DU_LOG("\n F1AP : Building DL RRC Message Transfer Message\n");
+
+ CU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t));
+ if(f1apMsg == NULLP)
+ {
+ DU_LOG(" F1AP : Memory allocation for F1AP-PDU failed");
+ return RFAILED;
+ }
- /*SRBID*/
- idx++;
- dlRRCMsg->protocolIEs.list.array[idx]->id = \
- ProtocolIE_ID_id_SRBID;
- dlRRCMsg->protocolIEs.list.array[idx]->criticality = Criticality_reject;
- dlRRCMsg->protocolIEs.list.array[idx]->value.present = \
- DLRRCMessageTransferIEs__value_PR_SRBID;
- dlRRCMsg->protocolIEs.list.array[idx]->value.choice.SRBID = DL_SRBID;
+ f1apMsg->present = F1AP_PDU_PR_initiatingMessage;
+ CU_ALLOC(f1apMsg->choice.initiatingMessage,
+ sizeof(InitiatingMessage_t));
+ if(f1apMsg->choice.initiatingMessage == NULLP)
+ {
+ DU_LOG(" F1AP : Memory allocation for F1AP-PDU failed");
+ CU_FREE(f1apMsg, sizeof(F1AP_PDU_t));
+ return RFAILED;
+ }
- /*RRCContainer*/
- //YET TO FILL
+ f1apMsg->choice.initiatingMessage->procedureCode = ProcedureCode_id_DLRRCMessageTransfer;
+ f1apMsg->choice.initiatingMessage->criticality = Criticality_ignore;
+ f1apMsg->choice.initiatingMessage->value.present = InitiatingMessage__value_PR_DLRRCMessageTransfer;
+ dlRRCMsg = &f1apMsg->choice.initiatingMessage->value.choice.DLRRCMessageTransfer;
- xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg);
+ elementCnt = 4;
+ dlRRCMsg->protocolIEs.list.count = elementCnt;
+ dlRRCMsg->protocolIEs.list.size = elementCnt * sizeof(DLRRCMessageTransferIEs_t *);
- /* Encode the F1SetupRequest type as APER */
- cmMemset((U8 *)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( "\n F1AP : Could not encode DL RRC Message Transfer structure (at %s)\n",\
- encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
- RETVALUE(RFAILED);
- }
- else
- {
- DU_LOG("\n F1AP : Created APER encoded buffer for DL RRC Message transfer\n");
- for(int i=0; i< encBufSize; i++)
- {
- printf("%x",encBuf[i]);
- }
- }
+ /* Initialize the F1Setup members */
+ CU_ALLOC(dlRRCMsg->protocolIEs.list.array, dlRRCMsg->protocolIEs.list.size);
+ if(dlRRCMsg->protocolIEs.list.array == NULLP)
+ {
+ DU_LOG(" F1AP : Memory allocation for DL RRC MessageTransferIEs failed");
+ CU_FREE(f1apMsg->choice.initiatingMessage, sizeof(InitiatingMessage_t));
+ CU_FREE(f1apMsg, sizeof(F1AP_PDU_t));
+ return RFAILED;
+ }
- /* Sending msg */
- if(SendF1APMsg(CU_APP_MEM_REG,CU_POOL) != ROK)
- {
- DU_LOG("\n F1AP : Sending DL RRC Message Transfer Failed");
- RETVALUE(RFAILED);
- }
+ for(idx=0; idx<elementCnt; idx++)
+ {
+ CU_ALLOC(dlRRCMsg->protocolIEs.list.array[idx], sizeof(DLRRCMessageTransferIEs_t));
+ if(dlRRCMsg->protocolIEs.list.array[idx] == NULLP)
+ {
+ for(ieId=0; ieId<idx; ieId++)
+ {
+ CU_FREE(dlRRCMsg->protocolIEs.list.array[ieId],\
+ sizeof(DLRRCMessageTransferIEs_t));
+ }
+ CU_FREE(dlRRCMsg->protocolIEs.list.array,\
+ dlRRCMsg->protocolIEs.list.size);
+ CU_FREE(f1apMsg->choice.initiatingMessage,\
+ sizeof(InitiatingMessage_t));
+ CU_FREE(f1apMsg,sizeof(F1AP_PDU_t));
+ return RFAILED;
+ }
+ }
- RETVALUE(ROK);
+ /* GNB CU UE F1AP ID */
+ idx = 0;
+ dlRRCMsg->protocolIEs.list.array[idx]->id = ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID;
+ dlRRCMsg->protocolIEs.list.array[idx]->criticality = Criticality_reject;
+ dlRRCMsg->protocolIEs.list.array[idx]->value.present = \
+ DLRRCMessageTransferIEs__value_PR_GNB_CU_UE_F1AP_ID;
+ dlRRCMsg->protocolIEs.list.array[idx]->value.choice.GNB_CU_UE_F1AP_ID = CU_ID;
+
+ /* GNB DU UE F1AP ID */
+ idx++;
+ dlRRCMsg->protocolIEs.list.array[idx]->id = \
+ ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID;
+ dlRRCMsg->protocolIEs.list.array[idx]->criticality = Criticality_reject;
+ dlRRCMsg->protocolIEs.list.array[idx]->value.present = \
+ DLRRCMessageTransferIEs__value_PR_GNB_DU_UE_F1AP_ID;
+ dlRRCMsg->protocolIEs.list.array[idx]->value.choice.GNB_DU_UE_F1AP_ID = DU_ID;
+
+ /* SRBID */
+ idx++;
+ dlRRCMsg->protocolIEs.list.array[idx]->id = ProtocolIE_ID_id_SRBID;
+ dlRRCMsg->protocolIEs.list.array[idx]->criticality = Criticality_reject;
+ dlRRCMsg->protocolIEs.list.array[idx]->value.present = \
+ DLRRCMessageTransferIEs__value_PR_SRBID;
+ dlRRCMsg->protocolIEs.list.array[idx]->value.choice.SRBID = SRB1;
+
+ /* RRCContainer */
+ idx++;
+ dlRRCMsg->protocolIEs.list.array[idx]->id = ProtocolIE_ID_id_RRCContainer;
+ dlRRCMsg->protocolIEs.list.array[idx]->criticality = Criticality_reject;
+ dlRRCMsg->protocolIEs.list.array[idx]->value.present = \
+ DLRRCMessageTransferIEs__value_PR_RRCContainer;
+ BuildDLRRCContainer(&dlRRCMsg->protocolIEs.list.array[idx]->value.choice.RRCContainer);
+
+ xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg);
+
+ /* Encode the F1SetupRequest type as APER */
+ cmMemset((U8 *)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( "\n F1AP : Could not encode DL RRC Message Transfer structure (at %s)\n",\
+ encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
+ RETVALUE(RFAILED);
+ }
+ else
+ {
+ DU_LOG("\n F1AP : Created APER encoded buffer for DL RRC Message transfer\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("\n F1AP : Sending DL RRC Message Transfer Failed");
+ return RFAILED;
+ }
+
+ return ROK;
}/* End of BuildAndSendDLRRCMessageTransfer */
RETVALUE(ROK);
}/* End of BuildAndSendUESetRsp */
+
+
+uint8_t procInitULRRCMsg(F1AP_PDU_t *f1apMsg)
+{
+ uint8_t idx;
+ uint8_t ret =ROK;
+ InitialULRRCMessageTransfer_t *initULRRCMsg = NULLP;
+ DU_LOG("\n filling the required values in DB in procInitULRRCMsg");
+
+ initULRRCMsg = &f1apMsg->choice.initiatingMessage->value.choice.InitialULRRCMessageTransfer;
+
+ for(idx=0; idx < initULRRCMsg->protocolIEs.list.count; idx++)
+ {
+ switch(initULRRCMsg->protocolIEs.list.array[idx]->id)
+ {
+ case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID:
+ break;
+ case ProtocolIE_ID_id_NRCGI:
+ break;
+ case ProtocolIE_ID_id_C_RNTI:
+ break;
+ case ProtocolIE_ID_id_RRCContainer:
+ break;
+ case ProtocolIE_ID_id_DUtoCURRCContainer:
+ {
+ if((initULRRCMsg->protocolIEs.list.array[idx]->value.choice\
+ .DUtoCURRCContainer.size > 0) && (initULRRCMsg->protocolIEs\
+ .list.array[idx]->value.choice.DUtoCURRCContainer.buf != NULLP))
+ {
+ DU_LOG("\n Received Du to Cu RRC Container ");
+ f1apMsgDb.duToCuContainer.size = initULRRCMsg->protocolIEs\
+ .list.array[idx]->value.choice.DUtoCURRCContainer.size;
+ CU_ALLOC(f1apMsgDb.duToCuContainer.buf, \
+ f1apMsgDb.duToCuContainer.size);
+ if(f1apMsgDb.duToCuContainer.buf != NULLP)
+ {
+ memcpy(f1apMsgDb.duToCuContainer.buf, initULRRCMsg->protocolIEs\
+ .list.array[idx]->value.choice.DUtoCURRCContainer.buf, f1apMsgDb\
+ .duToCuContainer.size);
+ }
+ }
+ else
+ {
+ DU_LOG("\n Failed to receive Du to Cu RRC Container ");
+ ret = RFAILED;
+ }
+ break;
+ }
+ default:
+ DU_LOG("\n Invalid Event %ld", initULRRCMsg->protocolIEs.list.array[idx]->id);
+ break;
+ }
+ }
+ if(!ret)
+ ret = BuildAndSendDLRRCMessageTransfer();
+ return ret;
+}
/*******************************************************************
*
* @brief Handles received F1AP message and sends back response
char *recvBuf;
MsgLen copyCnt;
MsgLen recvBufLen;
- F1AP_PDU_t *f1apMsg;
+ F1AP_PDU_t *f1apMsg = NULLP;
asn_dec_rval_t rval; /* Decoder return value */
F1AP_PDU_t f1apasnmsg ;
BuildAndSendDUUpdateAck();
break;
}
-
+ case InitiatingMessage__value_PR_InitialULRRCMessageTransfer:
+ {
+ DU_LOG("\nF1AP : Received InitialULRRCMessageTransfer");
+ procInitULRRCMsg(f1apMsg);
+ break;
+ }
default:
{
DU_LOG("\nF1AP : Invalid type of intiating message [%d]",f1apMsg->choice.initiatingMessage->value.present);
* RFAILED - failure
*
* ****************************************************************/
-uint8_t duBuildAndSendDlCcchInd(uint8_t *dlCcchMsg, uint16_t crnti, uint16_t cellId, DlCcchMsgType msgType)
+uint8_t duBuildAndSendDlCcchInd(uint16_t cellId, uint16_t crnti, \
+ DlCcchMsgType msgType, uint8_t *dlCcchMsg, uint16_t dlCcchMsgSize)
{
- Pst pst;
uint8_t ret = ROK;
+ uint16_t idx2;
DlCcchIndInfo *dlCcchIndInfo = NULLP;
-
+ Pst pst;
+
+ memset(&pst, 0, sizeof(Pst));
DU_LOG("\nDU APP : Building and Sending DL CCCH Ind to MAC");
DU_ALLOC_SHRABL_BUF(dlCcchIndInfo, sizeof(DlCcchIndInfo));
dlCcchIndInfo->cellId = cellId;
dlCcchIndInfo->crnti = crnti;
dlCcchIndInfo->msgType = msgType;
- DU_ALLOC_SHRABL_BUF(dlCcchIndInfo->dlCcchMsg, strlen((const char*)dlCcchMsg));
+ dlCcchIndInfo->dlCcchMsgLen = dlCcchMsgSize;
+
+ DU_ALLOC_SHRABL_BUF(dlCcchIndInfo->dlCcchMsg, dlCcchIndInfo->dlCcchMsgLen);
if(!dlCcchIndInfo->dlCcchMsg)
{
DU_LOG("\nDU APP : Memory alloc failed while building DL CCCH Ind");
DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, dlCcchIndInfo, sizeof(DlCcchIndInfo));
return RFAILED;
}
- memcpy(dlCcchIndInfo->dlCcchMsg, dlCcchMsg, strlen((const char*)dlCcchMsg));
- DU_FREE(dlCcchMsg, strlen((const char*)dlCcchMsg));
+ for(idx2 = 0; idx2 < dlCcchIndInfo->dlCcchMsgLen; idx2++)
+ {
+ dlCcchIndInfo->dlCcchMsg[idx2] = dlCcchMsg[idx2];
+ }
+ DU_FREE(dlCcchMsg, dlCcchMsgSize);
/* Fill Pst */
pst.selector = DU_MAC_LWLC;
if(ret != ROK)
{
DU_LOG("\nDU_APP : Failure in sending DL CCCH to MAC");
- DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, dlCcchIndInfo->dlCcchMsg, strlen((const char*)dlCcchMsg));
- DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, dlCcchIndInfo, sizeof(DlCcchIndInfo));
+ DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, dlCcchIndInfo->dlCcchMsg,\
+ dlCcchIndInfo->dlCcchMsgLen);
+ DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, dlCcchIndInfo, \
+ sizeof(DlCcchIndInfo));
ret = RFAILED;
}
{
DLRRCMessageTransfer_t *dlRrcMsg = NULLP;
uint8_t *dlCcchMsg = NULLP;
- uint8_t srbId, idx, ret;
- uint16_t crnti, cellId;
+ uint8_t idx, ret, srbId;
+ uint16_t idx2, crnti, cellId, dlCcchMsgSize;
uint32_t gnbCuUeF1apId, gnbDuUeF1apId;
srbId = dlRrcMsg->protocolIEs.list.array[idx]->value.choice.SRBID;
break;
}
+ case ProtocolIE_ID_id_ExecuteDuplication:
+ break;
+
case ProtocolIE_ID_id_RRCContainer:
{
- DU_ALLOC(dlCcchMsg, dlRrcMsg->protocolIEs.list.array[idx]->value.choice.RRCContainer.size);
- memcpy(dlCcchMsg,
- dlRrcMsg->protocolIEs.list.array[idx]->value.choice.RRCContainer.buf,
- dlRrcMsg->protocolIEs.list.array[idx]->value.choice.RRCContainer.size);
+ if(dlRrcMsg->protocolIEs.list.array[idx]->value.choice.RRCContainer.size > 0)
+ {
+ dlCcchMsgSize = dlRrcMsg->protocolIEs.list.array[idx]->value.choice.RRCContainer.size;
+ DU_ALLOC(dlCcchMsg, dlCcchMsgSize);
+ for(idx2 = 0; idx2 < dlCcchMsgSize; idx2++)
+ {
+ dlCcchMsg[idx2] = \
+ dlRrcMsg->protocolIEs.list.array[idx]->value.choice.RRCContainer.buf[idx2];
+ }
+ }
+ else
+ {
+ DU_LOG("\nDU_APP : RRC Container Size is invalid:%d",\
+ dlRrcMsg->protocolIEs.list.array[idx]->value.choice.RRCContainer.size);
+ }
break;
}
cellId = duCb.ueCcchCtxt[idx].cellId;
}
}
- if(srbId == 0) //RRC connection setup
+ if(srbId == SRB_ID_1) //RRC connection setup
{
- ret = duBuildAndSendDlCcchInd(dlCcchMsg, crnti, cellId, RRC_SETUP);
+ ret = duBuildAndSendDlCcchInd(cellId, crnti, RRC_SETUP, dlCcchMsg, dlCcchMsgSize);
}
return ret;
}