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=2dd414b8a1becc4b9db849b3f8da118c27863f05;hpb=958e8b2edbd1e0681419ad86aa0775c88981282c;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 2dd414b8a..af4782b24 100644 --- a/src/du_app/du_f1ap_msg_hdl.c +++ b/src/du_app/du_f1ap_msg_hdl.c @@ -18,39 +18,16 @@ /* 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" -char encBuf[ENC_BUF_MAX_LEN]; +extern char encBuf[ENC_BUF_MAX_LEN]; extern DuCfgParams duCfgParam; -/******************************************************************* - * - * @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 Uplink Info for NR @@ -130,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 @@ -221,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,\ @@ -575,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) { @@ -861,7 +780,48 @@ S16 BuildServedCellList(GNB_DU_Served_Cells_List_t *duServedCell) RETVALUE(RFAILED); } srvCellItem->served_Cell_Information.measurementTimingConfiguration.buf[0] = \ - duCfgParam.srvdCellLst[0].duCellInfo.measTimeCfg; + duCfgParam.srvdCellLst[0].duCellInfo.measTimeCfg; + + /* GNB DU System Information */ + DU_ALLOC(srvCellItem->gNB_DU_System_Information, + sizeof(GNB_DU_System_Information_t)); + if(!srvCellItem->gNB_DU_System_Information) + { + DU_LOG("\nF1AP: Memory allocation failure for GNB_DU_System_Information"); + return RFAILED; + } + /* MIB */ + srvCellItem->gNB_DU_System_Information->mIB_message.size =\ + 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) + { + DU_LOG("\nF1AP: Memory allocation failure for mIB message"); + return RFAILED; + } + strcpy(srvCellItem->gNB_DU_System_Information->mIB_message.buf, + duCfgParam.srvdCellLst[0].duSysInfo.mibMsg); + + /* SIB1 */ + srvCellItem->gNB_DU_System_Information->sIB1_message.size =\ + encBufSize; + DU_ALLOC(srvCellItem->gNB_DU_System_Information->sIB1_message.buf, + srvCellItem->gNB_DU_System_Information->sIB1_message.size); + if(!srvCellItem->gNB_DU_System_Information->sIB1_message.buf) + { + DU_LOG("\nF1AP: Memory allocation failure for SIB1 message"); + return RFAILED; + } + for(int x=0; xgNB_DU_System_Information->sIB1_message.size; x++) + { + srvCellItem->gNB_DU_System_Information->sIB1_message.buf[x]=\ + duCfgParam.srvdCellLst[0].duSysInfo.sib1Msg[x]; + } + /* Free memory */ + DU_FREE(duCfgParam.srvdCellLst[0].duSysInfo.sib1Msg, encBufSize); + DU_FREE(duCfgParam.srvdCellLst[0].duSysInfo.mibMsg, + strlen(duCfgParam.srvdCellLst[0].duSysInfo.mibMsg)); RETVALUE(ROK); } /******************************************************************* @@ -976,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); @@ -1413,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 @@ -1625,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; @@ -1682,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,\ @@ -1823,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));