X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2Fdu_app%2Fdu_f1ap_msg_hdl.c;h=af4782b24f00cee6a6163e8a04fab02a4b3189bc;hb=80a4fa9d0aede180472530cab6efa6acc925424b;hp=a91f0593ad727c1223e4ae4579d2989b86bd41d8;hpb=3a52fbb41a099e37ef072276055cf765828db299;p=o-du%2Fl2.git diff --git a/src/du_app/du_f1ap_msg_hdl.c b/src/du_app/du_f1ap_msg_hdl.c index a91f0593a..af4782b24 100644 --- a/src/du_app/du_f1ap_msg_hdl.c +++ b/src/du_app/du_f1ap_msg_hdl.c @@ -18,8 +18,8 @@ /* This file contains F1AP message handler functions */ +#include "du_mgr.h" #include "du_mgr_main.h" -#include "du_cfg.h" #include "du_cell_mgr.h" #include "du_f1ap_msg_hdl.h" #include "GNB-DU-System-Information.h" @@ -107,79 +107,7 @@ S16 BuildDLNRInfo(NRFreqInfo_t *dlnrfreq) dlnrfreq->freqBandListNr.list.array[idx]->supportedSULBandList.list.count = SUL_BAND_COUNT; RETVALUE(ROK); } -/******************************************************************* - * - * @brief Builds PLMN ID - * - * @details - * - * Function : BuildPlmn - * - * Functionality: Building the PLMN ID - * - * @params[in] PLMNID plmn - * @return ROK - success - * RFAILED - failure - * - * ****************************************************************/ - -S16 BuildPlmn(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 NRCell ID - * - * @details - * - * Function : BuildNrCellId - * - * Functionality: Building the NR Cell ID - * - * @params[in] BIT_STRING_t *nrcell - * @return ROK - success - * RFAILED - failure - * - * ****************************************************************/ - -S16 BuildNrCellId(BIT_STRING_t *nrcell) -{ - U8 tmp; - nrcell->size = 5; - DU_ALLOC(nrcell->buf, nrcell->size * sizeof(U8)); - if(nrcell->buf == NULLP) - { - RETVALUE(RFAILED); - } - for (tmp = 0 ; tmp < nrcell->size-1; tmp++) - { - nrcell->buf[tmp] = 0; - } - nrcell->buf[4] = 16;//change this - nrcell->bits_unused = 4; - RETVALUE(ROK); -} /******************************************************************* * * @brief Builds Nrcgi @@ -198,15 +126,26 @@ S16 BuildNrCellId(BIT_STRING_t *nrcell) S16 BuildNrcgi(NRCGI_t *nrcgi) { S16 ret; + U8 unused = 4; + U8 byteSize = 5; + U8 val = 16; + GNB_DU_Served_Cells_Item_t *srvCellItem; - ret = BuildPlmn(duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.nrCgi.plmn,\ + /* Allocate Buffer Memory */ + nrcgi->pLMN_Identity.size = PLMN_SIZE * sizeof(U8); + DU_ALLOC(nrcgi->pLMN_Identity.buf, nrcgi->pLMN_Identity.size); + ret = buildPlmnId(duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.nrCgi.plmn,\ &nrcgi->pLMN_Identity); // Building PLMN function if(ret != ROK) { RETVALUE(RFAILED); } /*nrCellIdentity*/ - ret = BuildNrCellId(&nrcgi->nRCellIdentity); + //ret = BuildNrCellId(&nrcgi->nRCellIdentity); + nrcgi->nRCellIdentity.size = byteSize * sizeof(U8); + DU_ALLOC(nrcgi->nRCellIdentity.buf, nrcgi->nRCellIdentity.size); + ret = fillBitString(&nrcgi->nRCellIdentity, unused, byteSize, val); + if(ret != ROK) { DU_FREE(srvCellItem->served_Cell_Information.nRCGI.pLMN_Identity.buf,\ @@ -552,7 +491,10 @@ S16 BuildServedPlmn(ServedPLMNs_List_t *srvplmn) RETVALUE(RFAILED); } } - ret = BuildPlmn(duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.nrCgi.plmn,\ + /* Allocate Memory to Buffer */ + srvplmn->list.array[0]->pLMN_Identity.size = PLMN_SIZE * sizeof(U8); + DU_ALLOC(srvplmn->list.array[0]->pLMN_Identity.buf, srvplmn->list.array[0]->pLMN_Identity.size); + ret = buildPlmnId(duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.nrCgi.plmn,\ &srvplmn->list.array[0]->pLMN_Identity); if(ret!= ROK) { @@ -850,7 +792,7 @@ S16 BuildServedCellList(GNB_DU_Served_Cells_List_t *duServedCell) } /* MIB */ srvCellItem->gNB_DU_System_Information->mIB_message.size =\ - strlen(duCfgParam.srvdCellLst[0].duSysInfo.mibMsg) + 1; + strlen(duCfgParam.srvdCellLst[0].duSysInfo.mibMsg); DU_ALLOC(srvCellItem->gNB_DU_System_Information->mIB_message.buf, srvCellItem->gNB_DU_System_Information->mIB_message.size); if(!srvCellItem->gNB_DU_System_Information->mIB_message.buf) @@ -994,7 +936,7 @@ S16 SendF1APMsg(Region region, Pool pool) { SPrntMsg(mBuf, 0,0); - if(sctpSend(mBuf) != ROK) + if(sctpSend(mBuf, F1_INTERFACE) != ROK) { DU_LOG("\nF1AP : SCTP Send failed"); SPutMsg(mBuf); @@ -1431,40 +1373,6 @@ S16 BuildAndSendF1SetupReq() RETVALUE(ROK); }/* End of BuildAndSendF1SetupReq */ -/******************************************************************* - * - * @brief Builds the PLMN Id - * - * @details - * - * Function : plmnBuild - * - * Functionality: Builds the PLMN Id - * - * @params[in] PlmnId plmn - * @params[in] OCTET_STRING_t *octe - * - * @return ROK - success - * RFAILED - failure - * - * ****************************************************************/ -void plmnBuild(PlmnId plmn, OCTET_STRING_t *octe) -{ - U8 mncCnt; - mncCnt = 2; - octe->buf[0] = ((plmn.mcc[1] << 4) | (plmn.mcc[0])); - if(mncCnt == 2) - { - octe->buf[1] = ((0xf0) | (plmn.mcc[2])); - octe->buf[2] = ((plmn.mnc[1] << 4) | (plmn.mnc[0])); - } - else - { - octe->buf[1] = ((plmn.mnc[0] << 4) | (plmn.mcc[2])); - octe->buf[2] = ((plmn.mnc[2] << 4) | (plmn.mnc[1])); - } -} - /******************************************************************* * * @brief Builds and sends the DUConfigUpdate @@ -1643,7 +1551,7 @@ S16 BuildAndSendDUConfigUpdate() RETVALUE(RFAILED); } } - plmnBuild(duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.nrCgi.plmn,\ + buildPlmnId(duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.nrCgi.plmn,\ &modifyItem->oldNRCGI.pLMN_Identity); /*nRCellIdentity*/ modifyItem->oldNRCGI.nRCellIdentity.size = 5; @@ -1700,7 +1608,7 @@ S16 BuildAndSendDUConfigUpdate() DU_FREE(f1apDuCfg, sizeof(F1AP_PDU_t)); RETVALUE(RFAILED); } - plmnBuild(duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.nrCgi.plmn,\ + buildPlmnId(duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.nrCgi.plmn,\ &modifyItem->served_Cell_Information.nRCGI.pLMN_Identity); modifyItem->served_Cell_Information.nRCGI.nRCellIdentity.size = 5; DU_ALLOC(modifyItem->served_Cell_Information.nRCGI.nRCellIdentity.buf,\ @@ -1841,7 +1749,7 @@ S16 BuildAndSendDUConfigUpdate() DU_FREE(f1apDuCfg, sizeof(F1AP_PDU_t)); RETVALUE(RFAILED); } - plmnBuild(duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.plmn[0],\ + buildPlmnId(duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.plmn[0],\ &modifyItem->served_Cell_Information.servedPLMNs.list.array[0]->pLMN_Identity); DU_ALLOC(modifyItem->served_Cell_Information.servedPLMNs.list.\ array[0]->iE_Extensions,sizeof(struct ProtocolExtensionContainer_4624P3));