/* Global variable */
DuCfgParams duCfgParam;
-char encBuf[ENC_BUF_MAX_LEN];
-int encBufSize;
-
-/*******************************************************************
- *
- * @brief Writes the encoded chunks into a buffer
- *
- * @details
- *
- * Function : PrepFinalEncBuf
- *
- * Functionality:Fills the encoded buffer
- *
- * @params[in] void *buffer,initial encoded data
- * @params[in] size_t size,size of buffer
- * @params[in] void *encodedBuf,final buffer
- * @return ROK - success
- * RFAILED - failure
- *
- * ****************************************************************/
-static int PrepFinalEncBuf(const void *buffer, size_t size, void *encodedBuf)
-{
- memcpy(encodedBuf + encBufSize, buffer, size);
- encBufSize += size;
- return 0;
-} /* PrepFinalEncBuf */
-
-/*******************************************************************
- *
- * @brief Builds PLMN ID
- *
- * @details
- *
- * Function : BuildPlmnId
- *
- * Functionality: Building the PLMN ID
- *
- * @params[in] PLMNID plmn
- * OCTET_STRING_t *plmnid
- * @return ROK - success
- * RFAILED - failure
- *
- * ****************************************************************/
-
-S16 BuildPlmnId(PlmnId plmn, OCTET_STRING_t *plmnid)
-{
- U8 mncCnt;
- plmnid->size = 3;
- DU_ALLOC(plmnid->buf, plmnid->size * sizeof(U8));
- if(plmnid->buf == NULLP)
- {
- RETVALUE(RFAILED);
- }
- mncCnt = 2;
- plmnid->buf[0] = ((plmn.mcc[1] << 4) | (plmn.mcc[0]));
- if(mncCnt == 2)
- {
- plmnid->buf[1] = ((0xf0) | (plmn.mcc[2]));
- plmnid->buf[2] = ((plmn.mnc[1] << 4) | (plmn.mnc[0]));
- }
- else
- {
- plmnid->buf[1] = ((plmn.mnc[0] << 4) | (plmn.mcc[2]));
- plmnid->buf[2] = ((plmn.mnc[2] << 4) | (plmn.mnc[1]));
- }
- RETVALUE(ROK);
-}
-
-/*******************************************************************
- *
- * @brief Builds NodeB Id
- *
- * @details
- *
- * Function : BuildNodeBId
- *
- * Functionality: Building the NodeBId
- *
- * @params[in] BIT_STRING_t *nbid,
- * U8 unusedBits
- * U8 byteSize
- * U8 val
- *
- * @return ROK - success
- * RFAILED - failure
- *
- * ****************************************************************/
-
-S16 BuildNodeBId(BIT_STRING_t *nbid, U8 unusedBits, U8 byteSize, U8 val)
-{
- U8 tmp;
- nbid->size = byteSize;
- DU_ALLOC(nbid->buf, nbid->size * sizeof(U8));
- if(nbid->buf == NULLP)
- {
- RETVALUE(RFAILED);
- }
-
- for (tmp = 0 ; tmp < ((nbid->size)-1); tmp++)
- {
- nbid->buf[tmp] = 0;
- }
- nbid->buf[byteSize-1] = val;
- nbid->bits_unused = unusedBits;
- RETVALUE(ROK);
-}
/*******************************************************************
*
U8 val = 1;
if(gNbId != NULLP)
{
- BuildPlmnId(duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.nrCgi.plmn, \
+ /* Allocate Buffer size */
+ gNbId->global_gNB_ID.plmn_id.size = 3 * sizeof(U8);
+ DU_ALLOC(gNbId->global_gNB_ID.plmn_id.buf , gNbId->global_gNB_ID.plmn_id.size);
+ buildPlmnId(duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.nrCgi.plmn, \
&gNbId->global_gNB_ID.plmn_id);
+
/* fill gND Id */
- gNbId->global_gNB_ID.gnb_id.present = GNB_ID_Choice_PR_gnb_ID;
- BuildNodeBId(&gNbId->global_gNB_ID.gnb_id.choice.gnb_ID, unused, byteSize, val);
+ gNbId->global_gNB_ID.gnb_id.present = GNB_ID_Choice_PR_gnb_ID;
+ /* Allocate Buffer size */
+ gNbId->global_gNB_ID.gnb_id.choice.gnb_ID.size = byteSize * sizeof(U8);
+ DU_ALLOC(gNbId->global_gNB_ID.gnb_id.choice.gnb_ID.buf, gNbId->global_gNB_ID.gnb_id.choice.gnb_ID.size);
+ fillBitString(&gNbId->global_gNB_ID.gnb_id.choice.gnb_ID, unused, byteSize, val);
}
- RETVALUE(ROK);
+ return ROK;
}
/*******************************************************************
if(e2apMsg == NULLP)
{
DU_LOG("\nE2AP : Memory allocation for E2AP-PDU failed");
- RETVALUE(RFAILED);
+ return RFAILED;
}
e2apMsg->present = E2AP_PDU_PR_initiatingMessage;
{
DU_LOG("\nE2AP : Memory allocation for E2AP-PDU failed");
DU_FREE(e2apMsg, sizeof(E2AP_PDU_t));
- RETVALUE(RFAILED);
+ return RFAILED;
}
e2apMsg->choice.initiatingMessage->criticality = CriticalityE2_reject;
e2apMsg->choice.initiatingMessage->procedureCode = ProcedureCodeE2_id_E2setup;
DU_LOG("\nE2AP : Memory allocation for E2RequestIEs failed");
DU_FREE(e2apMsg->choice.initiatingMessage, sizeof(InitiatingMessageE2_t));
DU_FREE(e2apMsg, (Size)sizeof(E2AP_PDU_t));
- RETVALUE(RFAILED);
+ return RFAILED;
}
for(idx=0; idx<elementCnt; idx++)
DU_FREE(e2apMsg->choice.initiatingMessage, \
sizeof(InitiatingMessageE2_t));
DU_FREE(e2apMsg, sizeof(E2AP_PDU_t));
- RETVALUE(RFAILED);
+ return RFAILED;
}
}
{
DU_LOG("\nE2AP : Could not encode E2SetupRequest structure (at %s)\n",\
encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
- RETVALUE(RFAILED);
+ return RFAILED;
}
else
{
if(SendE2APMsg(DU_APP_MEM_REGION, DU_POOL) != ROK)
{
DU_LOG("\nE2AP : Sending E2 Setup request failed");
- RETVALUE(RFAILED);
+ return RFAILED;
}
- RETVALUE(ROK);
+ return ROK;
}/* End of BuildAndSendE2SetupReq */
/*******************************************************************
ricReqId->ricRequestorID = 1;
ricReqId->ricInstanceID = 1;
}
- RETVALUE(ROK);
+ return ROK;
}
/*******************************************************************
ricAdmitItems->value.present = RICaction_Admitted_ItemIEs__value_PR_RICaction_Admitted_Item;
ricAdmitItems->value.choice.RICaction_Admitted_Item.ricActionID = 1;
}
- RETVALUE(ROK);
+ return ROK;
}
/*******************************************************************
*
if(admitListPtr->list.array == NULLP)
{
DU_LOG("\nE2AP : Memory allocation for RIC Admit List failed");
- RETVALUE(RFAILED);
+ return RFAILED;
}
DU_ALLOC(admitListPtr->list.array[0], sizeof(RICaction_Admitted_ItemIEs_t));
fillRicAdmitList(admitListPtr->list.array[0]);
- RETVALUE(ROK);
+ return ROK;
}
/*******************************************************************
if(e2apRicMsg == NULLP)
{
DU_LOG("\nE2AP : Memory allocation for E2AP-PDU failed");
- RETVALUE(RFAILED);
+ return RFAILED;
}
e2apRicMsg->present = E2AP_PDU_PR_successfulOutcome;
DU_ALLOC(e2apRicMsg->choice.successfulOutcome, sizeof(SuccessfulOutcomeE2_t));
{
DU_LOG("\nE2AP : Memory allocation for Ric subscription Response failed");
DU_FREE(e2apRicMsg, sizeof(RICsubscriptionResponse_t));
- RETVALUE(RFAILED);
+ return RFAILED;
}
e2apRicMsg->choice.successfulOutcome->procedureCode = ProcedureCodeE2_id_RICsubscription;
DU_LOG("\nE2AP : Memory allocation for RICsubscriptionResponseIE failed");
DU_FREE(e2apRicMsg->choice.successfulOutcome, sizeof(SuccessfulOutcomeE2_t));
DU_FREE(e2apRicMsg, sizeof(E2AP_PDU_t));
- RETVALUE(RFAILED);
+ return RFAILED;
}
for(idx=0; idx<elementCnt; idx++)
DU_FREE(e2apRicMsg->choice.successfulOutcome, \
sizeof(SuccessfulOutcomeE2_t));
DU_FREE(e2apRicMsg, sizeof(E2AP_PDU_t));
- RETVALUE(RFAILED);
+ return RFAILED;
}
}
idx = 0;
{
DU_LOG("\nE2AP : Could not encode RIC Subscription Response structure (at %s)\n",\
encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
- RETVALUE(RFAILED);
+ return RFAILED;
}
else
{
if(SendE2APMsg(DU_APP_MEM_REGION, DU_POOL) != ROK)
{
DU_LOG("\nE2AP : Sending RIC Subscription Response failed");
- RETVALUE(RFAILED);
+ return RFAILED;
}
- RETVALUE(ROK);
+ return ROK;
}
/******************************************************************
*
recvBufLen = sizeof(e2SetRspMsg->protocolIEs.list.array[idx]->value.choice.GlobalRIC_ID.pLMN_Identity);
bitStringToInt(&e2SetRspMsg->protocolIEs.list.array[idx]->value.choice.GlobalRIC_ID.ric_ID, &e2SetupRspDb.ricId);
-
- aper_decode(0, &asn_DEF_PLMN_IdentityE2, (void **)&e2SetupRspDb.plmn, &e2SetRspMsg->protocolIEs.list.array[idx]->value.choice.GlobalRIC_ID.pLMN_Identity, recvBufLen, 0, 0);
- //xer_fprint(stdout, &asn_DEF_PLMN_IdentityE2, &e2SetupRspDb.plmn);
+ aper_decode(0, &asn_DEF_PLMN_IdentityE2, (void **)&e2SetupRspDb.plmn, \
+ &e2SetRspMsg->protocolIEs.list.array[idx]->value.choice.GlobalRIC_ID.pLMN_Identity, recvBufLen, 0, 0);
+ xer_fprint(stdout, &asn_DEF_PLMN_IdentityE2, &e2SetupRspDb.plmn);
break;
}
default:
break;
}
}
- RETVALUE(ROK);
+ return ROK;
}
/******************************************************************
{
case ProtocolIE_IDE2_id_RICrequestID:
{
- ricReqDb.ricReqId = ricSubsReq->protocolIEs.list.array[idx]->value.choice.RICrequestID.ricRequestorID;
- ricReqDb.ricInstanceId = ricSubsReq->protocolIEs.list.array[idx]->value.choice.RICrequestID.ricInstanceID;
+ ricReqDb.ricReqId = ricSubsReq->protocolIEs.list.array[idx]->\
+ value.choice.RICrequestID.ricRequestorID;
+ ricReqDb.ricInstanceId = ricSubsReq->protocolIEs.list.array[idx]-> \
+ value.choice.RICrequestID.ricInstanceID;
break;
}
case ProtocolIE_IDE2_id_RANfunctionID:
{
- ricReqDb.ranFuncId = ricSubsReq->protocolIEs.list.array[idx]->value.choice.RANfunctionID;
+ ricReqDb.ranFuncId = ricSubsReq->protocolIEs.list.array[idx]-> \
+ value.choice.RANfunctionID;
break;
}
case ProtocolIE_IDE2_id_RICsubscriptionDetails:
recvBufLen = sizeof(ricSubsReq->protocolIEs.list.array[idx]->value.choice.RICsubscriptionDetails.ricEventTriggerDefinition);
aper_decode(0, &asn_DEF_RICeventTriggerDefinition, (void **)&ricReqDb.ricEventTrigger, &(ricSubsReq->protocolIEs.list.array[idx]->value.choice.RICsubscriptionDetails.ricEventTriggerDefinition), recvBufLen, 0, 0);
- //xer_fprint(stdout, &asn_DEF_RICeventTriggerDefinition, &ricReqDb.ricEventTrigger);
+ xer_fprint(stdout, &asn_DEF_RICeventTriggerDefinition, &ricReqDb.ricEventTrigger);
actionItem = *ricSubsReq->protocolIEs.list.array[idx]->value.choice.RICsubscriptionDetails.ricAction_ToBeSetup_List.list.array;
if(e2apMsg == NULLP)
{
DU_LOG("\nE2AP : Memory allocation for E2AP-PDU failed");
- RETVALUE(RFAILED);
+ return RFAILED;
}
e2apMsg->present = E2AP_PDU_PR_initiatingMessage;
{
DU_LOG("\nE2AP : Memory allocation for E2AP-PDU failed");
DU_FREE(e2apMsg, sizeof(E2AP_PDU_t));
- RETVALUE(RFAILED);
+ return RFAILED;
}
e2apMsg->choice.initiatingMessage->procedureCode = ProcedureCodeE2_id_RICindication;
e2apMsg->choice.initiatingMessage->criticality = CriticalityE2_reject;
DU_LOG("\nE2AP : Memory allocation for RICindicationIEs failed");
DU_FREE(e2apMsg->choice.initiatingMessage, sizeof(InitiatingMessageE2_t));
DU_FREE(e2apMsg, (Size)sizeof(E2AP_PDU_t));
- RETVALUE(RFAILED);
+ return RFAILED;
}
for(idx=0; idx<elementCnt; idx++)
DU_FREE(e2apMsg->choice.initiatingMessage, \
sizeof(InitiatingMessageE2_t));
DU_FREE(e2apMsg, sizeof(E2AP_PDU_t));
- RETVALUE(RFAILED);
+ return RFAILED;
}
}
idx = 0;
ricIndicationMsg->protocolIEs.list.array[idx]->criticality = CriticalityE2_reject;
ricIndicationMsg->protocolIEs.list.array[idx]->value.present = \
RICindication_IEs__value_PR_RICindicationHeader;
- BuildPlmnId(duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.nrCgi.plmn, \
+ ricIndicationMsg->protocolIEs.list.array[idx]->value.choice.RICindicationHeader.size = 3 * sizeof(U8);
+ DU_ALLOC(ricIndicationMsg->protocolIEs.list.array[idx]->value.choice.RICindicationHeader.buf ,\
+ ricIndicationMsg->protocolIEs.list.array[idx]->value.choice.RICindicationHeader.size);
+ buildPlmnId(duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.nrCgi.plmn, \
&ricIndicationMsg->protocolIEs.list.array[idx]->value.choice.RICindicationHeader);
/* TO BE CHANGED: RIC INDICATION DATA */
- /* Foe now filling a dummy octect data, need to tested with PRBs*/
+ /* For now filling a dummy octect data, need to tested with PRBs*/
idx++;
ricIndicationMsg->protocolIEs.list.array[idx]->id = ProtocolIE_IDE2_id_RICindicationMessage;
ricIndicationMsg->protocolIEs.list.array[idx]->criticality = CriticalityE2_reject;
ricIndicationMsg->protocolIEs.list.array[idx]->value.present = \
RICindication_IEs__value_PR_RICindicationMessage;
- BuildPlmnId(duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.nrCgi.plmn, \
+ ricIndicationMsg->protocolIEs.list.array[idx]->value.choice.RICindicationMessage.size = 3 * sizeof(U8);
+ DU_ALLOC(ricIndicationMsg->protocolIEs.list.array[idx]->value.choice.RICindicationMessage.buf ,\
+ ricIndicationMsg->protocolIEs.list.array[idx]->value.choice.RICindicationMessage.size);
+ buildPlmnId(duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.nrCgi.plmn, \
&ricIndicationMsg->protocolIEs.list.array[idx]->value.choice.RICindicationMessage);
/* Prints the Msg formed */
{
DU_LOG("\nE2AP : Could not encode RIC Indication Message (at %s)\n",\
encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
- RETVALUE(RFAILED);
+ return RFAILED;
}
else
{
if(SendE2APMsg(DU_APP_MEM_REGION, DU_POOL) != ROK)
{
DU_LOG("\nE2AP : Sending RIC Indication Message");
- RETVALUE(RFAILED);
+ return RFAILED;
}
- RETVALUE(ROK);
+ return ROK;
}
/*******************************************************************
{
DU_LOG("\nE2AP : SCTP Send for E2 failed");
SPutMsg(mBuf);
- RETVALUE(RFAILED);
+ return RFAILED;
}
}
else
{
DU_LOG("\nE2AP : SAddPstMsgMult failed");
SPutMsg(mBuf);
- RETVALUE(RFAILED);
+ return RFAILED;
}
SPutMsg(mBuf);
}
else
{
DU_LOG("\nE2AP : Failed to allocate memory");
- RETVALUE(RFAILED);
+ return RFAILED;
}
- RETVALUE(ROK);
+ return ROK;
} /* SendE2APMsg */
/*******************************************************************