# macro for output file name and makefile name
#
-PLTFRM_FLAGS= -UMSPD -DODU #-DINTEL_FAPI -DINTEL_WLS -DEGTP_TEST
+PLTFRM_FLAGS= -UMSPD -DODU #-DINTEL_FAPI #-DINTEL_WLS -DEGTP_TEST
ifeq ($(MODE),TDD)
PLTFRM_FLAGS += -DMODE=TDD
2. l2/src/ : contains layer specific source code
a. 5gnrmac : MAC source code
- b. 5gnrrlc : RLC source code
+ b. 5gnrrlc : RLC source code
c. cm : common, environment and interface files
d. cu_stub : Stub code for CU
e. du_app : DU application and F1 code
-------------------------------
1. Linux 32-bit/64-bit machine
2. GCC version 4.6.3 and above
+3. Install LKSCTP
+ a. On Ubuntu : sudo apt-get install -y libsctp-dev
+ b. On CentOS : yum install lksctp-tools
How to Clean and Build:
uint8_t packLcSlotInd (Pst *pst, SlotIndInfo *slotInd)
{
Buffer *mBuf = NULLP;
- if (ODU_GET_MSG(pst->region, pst->pool, &mBuf) != ROK)
+ if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
{
return RFAILED;
}
RlcUlCb *ulCb; /*!< Ul Control Block */
RlcDlCb *dlCb; /*!< Dl Control Block */
} u;
+ uint8_t dlSduId; /*!< Downlink SDU ID */
}RlcCb;
EXTERN RlcCb *rlcCb[MAX_RLC_INSTANCES]; /*!< RLC global control block */
#include "kw.x"
#include "kw_udx.x"
#include "kw_dl.x"
+#include "du_app_rlc_inf.h"
#include "ctf.h"
S16 rlcUtlDlBatchProcPkts(Void);
break;
}
#endif /* LCKWU */
+
+ case EVENT_DL_RRC_MSG_TRANS_TO_RLC:
+ {
+ ret = unpackDlRrcMsgToRlc(RlcProcDlRrcMsgTransfer, pst, mBuf);
+ break;
+ }
default:
- ODU_PUT_MSG(mBuf);
+ ODU_PUT_MSG_BUF(mBuf);
if (pst->dstInst < MAX_RLC_INSTANCES)
{
RLOG1(L_ERROR,"Received Invalid Event[%d] from SM",
}
default:
- ODU_PUT_MSG(mBuf);
+ ODU_PUT_MSG_BUF(mBuf);
if (pst->dstInst < MAX_RLC_INSTANCES)
{
RLOG1(L_ERROR,"Received Invalid Event[%d] from RLC UL",
#endif /* LCKWU */
default:
- ODU_PUT_MSG(mBuf);
+ ODU_PUT_MSG_BUF(mBuf);
if (pst->dstInst < MAX_RLC_INSTANCES)
{
RLOG1(L_ERROR,"Received Invalid Event[%d] from RRC",
}
default:
- ODU_PUT_MSG(mBuf);
+ ODU_PUT_MSG_BUF(mBuf);
if (pst->dstInst < MAX_RLC_INSTANCES)
{
RLOG1(L_ERROR,"Received Invalid Event[%d] from PDCP",
#endif
default:
- ODU_PUT_MSG(mBuf);
+ ODU_PUT_MSG_BUF(mBuf);
if (pst->dstInst < MAX_RLC_INSTANCES)
{
RLOG1(L_ERROR,"Received Invalid Event[%d] from MAC",
break;
}
}
- ODU_PUT_MSG(mBuf);
+ ODU_PUT_MSG_BUF(mBuf);
break;
}
#endif
rlcUtlFreeDlMem();
#endif
- ODU_PUT_MSG(mBuf);
+ ODU_PUT_MSG_BUF(mBuf);
break;
}
}
RLOG1(L_ERROR, "Received Invalid Source Entity[%d]",
pst->event);
}
- ODU_PUT_MSG(mBuf);
+ ODU_PUT_MSG_BUF(mBuf);
ret = RFAILED;
break;
}
#include "kw_dl.x"
#include "kw_ul.x"
-#include "rlc.h"
+#include "rlc_utils.h"
#include "du_app_rlc_inf.h"
#include "rlc_mgr.h"
#endif
#endif /* LCLKW */
default:
- ODU_PUT_MSG(mBuf);
+ ODU_PUT_MSG_BUF(mBuf);
if (pst->dstInst < MAX_RLC_INSTANCES)
{
RLOG1(L_FATAL,"Received Invalid Event[%d] from SM",
#endif /* LCCKW */
default:
- ODU_PUT_MSG(mBuf);
+ ODU_PUT_MSG_BUF(mBuf);
if (pst->dstInst < MAX_RLC_INSTANCES)
{
RLOG1(L_ERROR,"Received Invalid Event[%d] from RLC UL",
}
#endif /* LCKWU */
default:
- ODU_PUT_MSG(mBuf);
+ ODU_PUT_MSG_BUF(mBuf);
if (pst->dstInst < MAX_RLC_INSTANCES)
{
RLOG1(L_ERROR,"Received Invalid Event[%d] from RRC",
}
default:
- ODU_PUT_MSG(mBuf);
+ ODU_PUT_MSG_BUF(mBuf);
if (pst->dstInst < MAX_RLC_INSTANCES)
{
RLOG1(L_ERROR,"Received Invalid Event[%d] from PDCP",
#endif /* LCRGU */
default:
- ODU_PUT_MSG(mBuf);
+ ODU_PUT_MSG_BUF(mBuf);
if (pst->dstInst < MAX_RLC_INSTANCES)
{
RLOG1(L_ERROR,"Received Invalid Event[%d] from MAC",
case KWU_EVT_TTI_IND:
{
rlcUlBatchProc();
- ODU_PUT_MSG(mBuf);
+ ODU_PUT_MSG_BUF(mBuf);
break;
}
}
tRlcCb = RLC_GET_RLCCB(pst->dstInst);
TSL2SendStatsToApp(&(tRlcCb->genCfg.lmPst), 0);
- ODU_PUT_MSG(mBuf);
+ ODU_PUT_MSG_BUF(mBuf);
break;
}
default:
{
printf("\n ERROR Invalid Event[%d] from CL to PDCPUL\n",
pst->event);
- ODU_PUT_MSG(mBuf);
+ ODU_PUT_MSG_BUF(mBuf);
break;
}
}
{
RLOG1(L_ERROR, "Received Invalid Source Entity[%d]",pst->event);
}
- ODU_PUT_MSG(mBuf);
+ ODU_PUT_MSG_BUF(mBuf);
ret = RFAILED;
break;
}
DU_LOG("\nMAC_STUB : Received DL data from RLC to be sent to PHY");
- ODU_PUT_MSG(dlData->pduInfo[0].pduBuf);
+ ODU_PUT_MSG_BUF(dlData->pduInfo[0].pduBuf);
dlData->pduInfo[0].pduBuf = NULL;
#if 0
#endif
ulData = dlData;
- ODU_GET_MSG(pst->region, pst->pool, &mBuf);
+ ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf);
macStubBuildUlData(mBuf);
ulData->pduInfo[0].pduBuf = mBuf;
+++ /dev/null
-/*******************************************************************************
-################################################################################
-# Copyright (c) [2017-2019] [Radisys] #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-################################################################################
-*******************************************************************************/
-/* This file contains defines for RLC layer */
-
-/* Memory */
-#define RLC_MEM_REGION_UL 1
-#define RLC_MEM_REGION_DL 4
-#define RLC_POOL 1
-
-/* Inst */
-#define RLC_UL_INST 0
-#define RLC_DL_INST 1
-
-/* Fill Pst structure for sending msg from RLC to DUAPP */
-#define FILL_PST_RLC_TO_DUAPP(_pst, _procId, _srcInst, _event) \
-{ \
- _pst.selector = ODU_SELECTOR_LWLC; \
- _pst.srcEnt = ENTRLC; \
- _pst.dstEnt = ENTDUAPP; \
- _pst.dstInst = 0; \
- _pst.srcInst = _srcInst; \
- _pst.dstProcId = _procId; \
- _pst.srcProcId = _procId; \
- if(_srcInst == RLC_UL_INST) \
- { \
- _pst.region = RLC_MEM_REGION_UL; \
- } \
- else if(_srcInst == RLC_DL_INST) \
- { \
- _pst.region = RLC_MEM_REGION_DL; \
- } \
- _pst.pool = RLC_POOL; \
- _pst.event = _event; \
- _pst.route = 0; \
- _pst.prior = 0; \
- _pst.intfVer = 0; \
-}
-
-/**********************************************************************
- End of file
-**********************************************************************/
#include "kw.x"
#include "du_app_rlc_inf.h"
-#include "rlc.h"
-
-extern U16 getTransId();
+#include "rlc_utils.h"
/*******************************************************************
*
RLC_FREE_SHRABL_BUF(pst->region, pst->pool, ueCfg, sizeof(RlcUeCfg));
return ret;
}
+
+/*******************************************************************
+ *
+ * @brief Process the DL RRC Message from DU APP
+ *
+ * @details
+ *
+ * Function : RlcProcDlRrcMsgTransfer
+ *
+ * Functionality: Process the DL RRC Message from DU APP
+ *
+ * @params[in] Post structure
+ * DL RRC Message info
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t RlcProcDlRrcMsgTransfer(Pst *pst, RlcDlRrcMsgInfo *dlRrcMsgInfo)
+{
+ uint16_t copyLen;
+ Buffer *mBuf;
+ KwuDatReqInfo *datReqInfo;
+
+ RLC_SHRABL_STATIC_BUF_ALLOC(RLC_MEM_REGION_DL, RLC_POOL, datReqInfo, sizeof(KwuDatReqInfo));
+ if(!datReqInfo)
+ {
+ DU_LOG("\nRLC : Memory allocation failed in RlcProcDlRrcMsgTransfer");
+ return RFAILED;
+ }
+
+ datReqInfo->rlcId.rbType = dlRrcMsgInfo->rbType;
+ datReqInfo->rlcId.rbId = dlRrcMsgInfo->rbId;
+ datReqInfo->rlcId.ueId = dlRrcMsgInfo->ueIdx;
+ datReqInfo->rlcId.cellId = dlRrcMsgInfo->cellId;
+ datReqInfo->lcType = dlRrcMsgInfo->lcType;
+ datReqInfo->sduId = ++(rlcCb[pst->dstInst]->dlSduId);
+
+ /* Copy fixed buffer to message */
+ if(ODU_GET_MSG_BUF(RLC_MEM_REGION_UL, RLC_POOL, &mBuf) != ROK)
+ {
+ DU_LOG("\nRLC : Memory allocation failed at RlcMacProcUlData");
+ RLC_SHRABL_STATIC_BUF_FREE(RLC_MEM_REGION_DL, RLC_POOL, datReqInfo, sizeof(KwuDatReqInfo));
+ return RFAILED;
+ }
+ /* ODU_COPY_FIX_BUF_TO_MSG copies fixed buffer in reverse order. Hence reversing the
+ * fixed buffer before copying in order to maintain the actual order*/
+ reverseFixBuf(dlRrcMsgInfo->rrcMsg, dlRrcMsgInfo->msgLen);
+ ODU_COPY_FIX_BUF_TO_MSG(dlRrcMsgInfo->rrcMsg, mBuf, 0, dlRrcMsgInfo->msgLen, \
+ (MsgLen *)©Len);
+
+ RlcUiKwuDatReq(pst, datReqInfo, mBuf);
+
+ /* Free memory allocated by du app */
+ RLC_SHRABL_STATIC_BUF_FREE(RLC_MEM_REGION_DL, RLC_POOL, datReqInfo, sizeof(KwuDatReqInfo));
+ RLC_SHRABL_STATIC_BUF_FREE(pst->region, pst->pool, dlRrcMsgInfo->rrcMsg, dlRrcMsgInfo->msgLen);
+ RLC_SHRABL_STATIC_BUF_FREE(pst->region, pst->pool, dlRrcMsgInfo, sizeof(RlcDlRrcMsgInfo));
+ return ROK;
+}
+
/**********************************************************************
End of file
**********************************************************************/
}
void reverseFixBuf(uint8_t *buf, uint16_t len);
+uint16_t getTransId();
/**********************************************************************
End of file
#define ODU_END_CRNTI 500
/* Defining macros for common utility functions */
-#define ODU_GET_MSG SGetMsg
-#define ODU_PUT_MSG SPutMsg
+#define ODU_GET_MSG_BUF SGetMsg
+#define ODU_PUT_MSG_BUF SPutMsg
#define ODU_ADD_PRE_MSG_MULT SAddPreMsgMult
#define ODU_ADD_POST_MSG_MULT SAddPstMsgMult
#define ODU_START_TASK SStartTask
#define ODU_ATTACH_TTSK SAttachTTsk
#define ODU_POST_TASK SPstTsk
#define ODU_COPY_MSG_TO_FIX_BUF SCpyMsgFix
+#define ODU_COPY_FIX_BUF_TO_MSG SCpyFixMsg
#define ODU_REG_TTSK SRegTTsk
#define ODU_SET_PROC_ID SSetProcId
#define ODU_FIND_MSG_LEN SFndLenMsg
{
Buffer *mBuf = NULLP;
- if (ODU_GET_MSG(pst->region, pst->pool, &mBuf) != ROK)
+ if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
{
return RFAILED;
}
if(pst->selector == ODU_SELECTOR_LC)
{
Buffer *mBuf = NULLP;
- if (ODU_GET_MSG(pst->region, pst->pool, &mBuf) != ROK)
+ if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
{
return RFAILED;
}
else if(pst->selector == ODU_SELECTOR_LWLC)
{
- if (ODU_GET_MSG(pst->region, pst->pool, &mBuf) != ROK)
+ if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
{
DU_LOG("\nDU APP : Memory allocation failed for cell start req pack");
return RFAILED;
{
/* unpack the address of the structure */
CMCHKUNPK(oduUnpackPointer, (PTR *)&cellStartInfo, mBuf);
- ODU_PUT_MSG(mBuf);
+ ODU_PUT_MSG_BUF(mBuf);
return (*func)(pst, cellStartInfo);
}
else
{
/* Nothing to do for loose coupling */
- ODU_PUT_MSG(mBuf);
+ ODU_PUT_MSG_BUF(mBuf);
return ROK;
}
}
{
Buffer *mBuf = NULLP;
- if (ODU_GET_MSG(pst->region, pst->pool, &mBuf) != ROK)
+ if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
{
DU_LOG("\nDU APP : Memory allocation failed for cell stop req pack");
return RFAILED;
{
/* unpack the address of the structure */
CMCHKUNPK(oduUnpackPointer, (PTR *)&cellStopInfo, mBuf);
- ODU_PUT_MSG(mBuf);
+ ODU_PUT_MSG_BUF(mBuf);
return (*func)(pst, cellStopInfo);
}
else
{
/* Nothing to do for loose coupling */
- ODU_PUT_MSG(mBuf);
+ ODU_PUT_MSG_BUF(mBuf);
return ROK;
}
}
{
Buffer *mBuf = NULLP;
- if (ODU_GET_MSG(pst->region, pst->pool, &mBuf) != ROK)
+ if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
{
DU_LOG("\nDU APP : Memory allocation failed for cell start req pack");
return RFAILED;
}
else
{
- ODU_PUT_MSG(mBuf);
+ ODU_PUT_MSG_BUF(mBuf);
}
return ODU_POST_TASK(pst,mBuf);
/* unpack the address of the structure */
CMCHKUNPK(oduUnpackPointer, (PTR *)&slotInfo, mBuf);
- ODU_PUT_MSG(mBuf);
+ ODU_PUT_MSG_BUF(mBuf);
return (*func)(pst, slotInfo);
}
else if(pst->selector == ODU_SELECTOR_LC)
CMCHKUNPK(oduPackUInt16, &(slotInfo.sfn), mBuf);
CMCHKUNPK(oduPackUInt16, &(slotInfo.cellId), mBuf);
- ODU_PUT_MSG(mBuf);
+ ODU_PUT_MSG_BUF(mBuf);
return (*func)(pst, &slotInfo);
}
else
{
/* Nothing to do for loose coupling */
- ODU_PUT_MSG(mBuf);
+ ODU_PUT_MSG_BUF(mBuf);
return ROK;
}
return ROK;
{
Buffer *mBuf = NULLP;
- if (ODU_GET_MSG(pst->region, pst->pool, &mBuf) != ROK)
+ if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
{
DU_LOG("\nDU APP : Memory allocation failed for stop Ind pack");
return RFAILED;
}
else
{
- ODU_PUT_MSG(mBuf);
+ ODU_PUT_MSG_BUF(mBuf);
}
return ODU_POST_TASK(pst,mBuf);
MacCellStopInfo *cellStopId;
/* unpack the address of the structure */
CMCHKUNPK(oduUnpackPointer, (PTR *)&cellStopId, mBuf);
- ODU_PUT_MSG(mBuf);
+ ODU_PUT_MSG_BUF(mBuf);
return (*func)(pst, cellStopId);
}
else if(pst->selector == ODU_SELECTOR_LC)
MacCellStopInfo cellStopId;
CMCHKUNPK(oduPackUInt16, &(cellStopId.cellId), mBuf);
- ODU_PUT_MSG(mBuf);
+ ODU_PUT_MSG_BUF(mBuf);
return (*func)(pst, &cellStopId);
}
else
{
/* Nothing to do for loose coupling */
- ODU_PUT_MSG(mBuf);
+ ODU_PUT_MSG_BUF(mBuf);
return ROK;
}
return ROK;
if(pst->selector == ODU_SELECTOR_LWLC)
{
- if (ODU_GET_MSG(pst->region, pst->pool, &mBuf) != ROK)
+ if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
{
DU_LOG("\nMAC : Memory allocation failed at packMacUlCcchInd");
return RFAILED;
/* unpack the address of the structure */
CMCHKUNPK(oduUnpackPointer, (PTR *)&ulCcchIndInfo, mBuf);
- ODU_PUT_MSG(mBuf);
+ ODU_PUT_MSG_BUF(mBuf);
return (*func)(pst, ulCcchIndInfo);
}
else
{
/* Nothing to do for other selectors */
DU_LOG("\n Only LWLC supported for UL CCCH Ind ");
- ODU_PUT_MSG(mBuf);
+ ODU_PUT_MSG_BUF(mBuf);
}
return RFAILED;
}
if(pst->selector == ODU_SELECTOR_LWLC)
{
- if (ODU_GET_MSG(pst->region, pst->pool, &mBuf) != ROK)
+ if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
{
DU_LOG("\nMAC : Memory allocation failed at packMacDlCcchInd");
return RFAILED;
/* unpack the address of the structure */
CMCHKUNPK(oduUnpackPointer, (PTR *)&dlCcchIndInfo, mBuf);
- ODU_PUT_MSG(mBuf);
+ ODU_PUT_MSG_BUF(mBuf);
return (*func)(pst, dlCcchIndInfo);
}
else
{
/* Nothing to do for other selectors */
DU_LOG("\n Only LWLC supported for DL CCCH Ind ");
- ODU_PUT_MSG(mBuf);
+ ODU_PUT_MSG_BUF(mBuf);
}
return RFAILED;
if(pst->selector == ODU_SELECTOR_LWLC)
{
- if (ODU_GET_MSG(pst->region, pst->pool, &mBuf) != ROK)
+ if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
{
DU_LOG("\nMAC : Memory allocation failed at packDuMacUeCreateReq");
return RFAILED;
/* unpack the address of the structure */
CMCHKUNPK(oduUnpackPointer, (PTR *)&ueCfg, mBuf);
- ODU_PUT_MSG(mBuf);
+ ODU_PUT_MSG_BUF(mBuf);
return (*func)(pst, ueCfg);
}
else
{
/* Nothing to do for other selectors */
DU_LOG("\n Only LWLC supported for UE Create Request ");
- ODU_PUT_MSG(mBuf);
+ ODU_PUT_MSG_BUF(mBuf);
}
return RFAILED;
if(pst->selector == ODU_SELECTOR_LWLC)
{
- if (ODU_GET_MSG(pst->region, pst->pool, &mBuf) != ROK)
+ if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
{
DU_LOG("\nMAC : Memory allocation failed at packDuMacUeCfgRsp");
return RFAILED;
/* unpack the address of the structure */
CMCHKUNPK(oduUnpackPointer, (PTR *)&cfgRsp, mBuf);
- ODU_PUT_MSG(mBuf);
+ ODU_PUT_MSG_BUF(mBuf);
return (*func)(pst, cfgRsp);
}
- ODU_PUT_MSG(mBuf);
+ ODU_PUT_MSG_BUF(mBuf);
return RFAILED;
}
if(pst->selector == ODU_SELECTOR_LWLC)
{
- if (ODU_GET_MSG(pst->region, pst->pool, &mBuf) != ROK)
+ if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
{
DU_LOG("\nRLC : Memory allocation failed at packDuRlcUeCreateReq");
return RFAILED;
RlcUeCfg *ueCfg;
/* unpack the address of the structure */
CMCHKUNPK(oduUnpackPointer, (PTR *)&ueCfg, mBuf);
- ODU_PUT_MSG(mBuf);
+ ODU_PUT_MSG_BUF(mBuf);
return (*func)(pst, ueCfg);
}
else
{
/* Nothing to do for other selectors */
DU_LOG("\nRLC: Only LWLC supported for UE Create Request ");
- ODU_PUT_MSG(mBuf);
+ ODU_PUT_MSG_BUF(mBuf);
}
return RFAILED;
if(pst->selector == ODU_SELECTOR_LWLC)
{
- if (ODU_GET_MSG(pst->region, pst->pool, &mBuf) != ROK)
+ if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
{
DU_LOG("\nRLC : Memory allocation failed at packRlcUlDuUeCreateRsp");
return RFAILED;
RlcUeCfgRsp *cfgRsp;
/* unpack the address of the structure */
CMCHKUNPK(oduUnpackPointer, (PTR *)&cfgRsp, mBuf);
- ODU_PUT_MSG(mBuf);
+ ODU_PUT_MSG_BUF(mBuf);
return (*func)(pst, cfgRsp);
}
else
{
/* Nothing to do for other selectors */
DU_LOG("\nRLC: Only LWLC supported for UE Create Response ");
- ODU_PUT_MSG(mBuf);
+ ODU_PUT_MSG_BUF(mBuf);
}
return RFAILED;
if(pst->selector == ODU_SELECTOR_LWLC)
{
- if (ODU_GET_MSG(pst->region, pst->pool, &mBuf) != ROK)
+ if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
{
DU_LOG("\nRLC : Memory allocation failed at packRlcUlRrcMsgToDu");
return RFAILED;
RlcUlRrcMsgInfo *ulRrcMsgInfo;
/* unpack the address of the structure */
CMCHKUNPK(oduUnpackPointer, (PTR *)&ulRrcMsgInfo, mBuf);
- ODU_PUT_MSG(mBuf);
+ ODU_PUT_MSG_BUF(mBuf);
return (*func)(pst, ulRrcMsgInfo);
}
else
{
/* Nothing to do for other selectors */
DU_LOG("\nRLC: Only LWLC supported for UL RRC Message transfer ");
- ODU_PUT_MSG(mBuf);
+ ODU_PUT_MSG_BUF(mBuf);
}
return RFAILED;
}
+/*******************************************************************
+ *
+ * @brief Pack and post DL RRC Message from DU APP to RLC
+ *
+ * @details
+ *
+ * Function : packDlRrcMsgToRlc
+ *
+ * Functionality: Pack and post DL RRC Message from DU APP to RLC
+ *
+ * @params[in] Post structure
+ * DL RRC Message info
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t packDlRrcMsgToRlc(Pst *pst, RlcDlRrcMsgInfo *dlRrcMsgInfo)
+{
+ Buffer *mBuf = NULLP;
+
+ if(pst->selector == ODU_SELECTOR_LWLC)
+ {
+ if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
+ {
+ DU_LOG("\nRLC : Memory allocation failed at packRlcUlRrcMsgToDu");
+ return RFAILED;
+ }
+ /* pack the address of the structure */
+ CMCHKPK(oduPackPointer,(PTR)dlRrcMsgInfo, mBuf);
+ return ODU_POST_TASK(pst,mBuf);
+ }
+ else
+ {
+ DU_LOG("\nRLC: Only LWLC supported for packDlRrcMsgToRlc");
+ }
+ return RFAILED;
+}
+
+/*******************************************************************
+ *
+ * @brief Unpacks DL RRC Message info received at RLC from DU APP
+ *
+ * @details
+ *
+ * Function : unpackDlRrcMsgToRlc
+ *
+ * Functionality:
+ * Unpacks the DL RRC Message info received at RLC from DU APP
+ *
+ * @params[in] Pointer to handler function
+ * Post structure
+ * Messae buffer to be unpacked
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t unpackDlRrcMsgToRlc(DuDlRrcMsgToRlcFunc func, Pst *pst, Buffer *mBuf)
+{
+ if(pst->selector == ODU_SELECTOR_LWLC)
+ {
+ RlcDlRrcMsgInfo *dlRrcMsgInfo;
+ /* unpack the address of the structure */
+ CMCHKUNPK(oduUnpackPointer, (PTR *)&dlRrcMsgInfo, mBuf);
+ ODU_PUT_MSG_BUF(mBuf);
+ return (*func)(pst, dlRrcMsgInfo);
+ }
+ else
+ {
+ /* Nothing to do for other selectors */
+ DU_LOG("\nRLC: Only LWLC supported for UL RRC Message transfer ");
+ ODU_PUT_MSG_BUF(mBuf);
+ }
+ return RFAILED;
+}
/**********************************************************************
End of file
#ifndef __RLC_INF_H__
#define __RLC_INF_H__
-/* Macro for Ue Context */
-#define MAX_NUM_LOGICAL_CHANNELS 11
+/* Events */
#define EVENT_RLC_UL_UE_CREATE_REQ 210
#define EVENT_RLC_UL_UE_CREATE_RSP 211 /*!< Config Confirm */
#define EVENT_UL_RRC_MSG_TRANS_TO_DU 212
+#define EVENT_DL_RRC_MSG_TRANS_TO_RLC 213
+
+/* Macro for Ue Context */
+#define MAX_NUM_LOGICAL_CHANNELS 11
#define RB_ID_SRB 0
#define RB_ID_DRB 1
uint8_t *rrcMsg; /* RRC Message (UL-DCCH Message) */
}RlcUlRrcMsgInfo;
+/* DL RRC Message from DU APP to RLC */
+typedef struct dlRrcMsgInfo
+{
+ uint16_t cellId; /* Cell Id */
+ uint16_t ueIdx; /* UE index */
+ uint8_t rbType; /* Radio Bearer Type */
+ uint8_t rbId; /* Radio Bearer Id */
+ uint8_t lcType; /* Logical channel type */
+ uint8_t lcId; /* Logical channel Id */
+ bool execDup; /* Execution duplication enabled */
+ bool deliveryStaRpt; /* Reporting of delivery status by RLC to DU-APP enabled */
+ uint16_t msgLen; /* RRC Message length */
+ uint8_t *rrcMsg; /* RRC Message (DL-DCCH Message) */
+}RlcDlRrcMsgInfo;
+
/* Function Pointers */
/* UE create Request from DU APP to RLC*/
typedef uint8_t (*DuRlcUlUeCreateReq) ARGS((
Pst *pst,
RlcUlRrcMsgInfo *ulRrcMsgInfo));
-/* Function Declarations */
+/* DL RRC Message from DU APP to RLC */
+typedef uint8_t (*DuDlRrcMsgToRlcFunc) ARGS((
+ Pst *pst,
+ RlcDlRrcMsgInfo *dlRrcMsgInfo));
+
+/* Pack/Unpack function declarations */
uint8_t packDuRlcUlUeCreateReq(Pst *pst, RlcUeCfg *ueCfg);
uint8_t unpackRlcUlUeCreateReq(DuRlcUlUeCreateReq func, Pst *pst, Buffer *mBuf);
-uint8_t RlcUlProcUeCreateReq(Pst *pst, RlcUeCfg *ueCfg);
uint8_t packRlcUlDuUeCreateRsp(Pst *pst, RlcUeCfgRsp *ueCfgRsp);
uint8_t unpackRlcUlUeCreateRsp(RlcUlDuUeCreateRsp func, Pst *pst, Buffer *mBuf);
-uint8_t DuProcRlcUlUeCreateRsp(Pst *pst, RlcUeCfgRsp *cfgRsp);
uint8_t packRlcUlRrcMsgToDu(Pst *pst, RlcUlRrcMsgInfo *ulRrcMsgInfo);
-uint8_t DuProcRlcUlRrcMsgTrans(Pst *pst, RlcUlRrcMsgInfo *ulRrcMsgInfo);
uint8_t unpackRlcUlRrcMsgToDu(RlcUlRrcMsgToDuFunc func, Pst *pst, Buffer *mBuf);
+uint8_t packDlRrcMsgToRlc(Pst *pst, RlcDlRrcMsgInfo *dlRrcMsgInfo);
+uint8_t unpackDlRrcMsgToRlc(DuDlRrcMsgToRlcFunc func, Pst *pst, Buffer *mBuf);
+
+/* Event Handler function declarations */
+uint8_t RlcUlProcUeCreateReq(Pst *pst, RlcUeCfg *ueCfg);
+uint8_t DuProcRlcUlUeCreateRsp(Pst *pst, RlcUeCfgRsp *cfgRsp);
+uint8_t DuProcRlcUlRrcMsgTrans(Pst *pst, RlcUlRrcMsgInfo *ulRrcMsgInfo);
+uint8_t RlcProcDlRrcMsgTransfer(Pst *pst, RlcDlRrcMsgInfo *dlRrcMsgInfo);
#endif /* RLC_INF_H */
{
Buffer *mBuf;
- if(ODU_GET_MSG(DFLT_REGION, pst->pool, &mBuf) != ROK)
+ if(ODU_GET_MSG_BUF(DFLT_REGION, pst->pool, &mBuf) != ROK)
{
printf("\nDU_APP : Failed to allocate memory");
return RFAILED;
oduPackUInt32(&(egtpCfg.localIp.ipV4Addr), mBuf);
}
- ODU_PUT_MSG(mBuf);
+ ODU_PUT_MSG_BUF(mBuf);
return ((*func)(pst, egtpCfg));
}
{
Buffer *mBuf;
- if(ODU_GET_MSG(DFLT_REGION, pst->pool, &mBuf) != ROK)
+ if(ODU_GET_MSG_BUF(DFLT_REGION, pst->pool, &mBuf) != ROK)
{
printf("\nEGTP : Failed to allocate memory");
return RFAILED;
{
Buffer *mBuf;
- if(ODU_GET_MSG(DFLT_REGION, pst->pool, &mBuf) != ROK)
+ if(ODU_GET_MSG_BUF(DFLT_REGION, pst->pool, &mBuf) != ROK)
{
printf("\nDU_APP : Failed to allocate memory");
return RFAILED;
{
Buffer *mBuf;
- if(ODU_GET_MSG(DFLT_REGION, pst->pool, &mBuf) != ROK)
+ if(ODU_GET_MSG_BUF(DFLT_REGION, pst->pool, &mBuf) != ROK)
{
printf("\nEGTP : Failed to allocate memory");
return RFAILED;
{
Buffer *mBuf;
- if(ODU_GET_MSG(DFLT_REGION, pst->pool, &mBuf) != ROK)
+ if(ODU_GET_MSG_BUF(DFLT_REGION, pst->pool, &mBuf) != ROK)
{
printf("\nDU_APP : Failed to allocate memory");
return RFAILED;
{
Buffer *mBuf;
- if(ODU_GET_MSG(DFLT_REGION, pst->pool, &mBuf) != ROK)
+ if(ODU_GET_MSG_BUF(DFLT_REGION, pst->pool, &mBuf) != ROK)
{
printf("\nEGTP : Failed to allocate memory");
return RFAILED;
{
Buffer *mBuf;
- if(ODU_GET_MSG(DFLT_REGION, pst->pool, &mBuf) != ROK)
+ if(ODU_GET_MSG_BUF(DFLT_REGION, pst->pool, &mBuf) != ROK)
{
printf("\nDU_APP : Failed to allocate memory");
return RFAILED;
{
Buffer *mBuf;
- if(ODU_GET_MSG(pst->region, pst->pool, &mBuf) != ROK)
+ if(ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
{
printf("\nSCTP : Failed to allocate memory");
return RFAILED;
uint8_t packMacSchSlotInd(Pst *pst, SlotIndInfo *slotInd)
{
Buffer *mBuf = NULLP;
- if (ODU_GET_MSG(pst->region, pst->pool, &mBuf) != ROK)
+ if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
{
return RFAILED;
}
CG_ConfigInfo_t *cG_ConfigInfo; /* OPTIONAL */
UE_CapabilityRAT_ContainerList_t *uE_CapabilityRAT_ContainerList; /* OPTIONAL */
MeasConfig_t *measConfig; /* OPTIONAL */
- struct ProtocolExtensionContainer *iE_Extensions; /* OPTIONAL */
+ struct ProtocolExtensionContainer_4624P16 *iE_Extensions; /* OPTIONAL */
/*
* This type is extensible,
* possible extensions are below.
{
Buffer *mBuf = NULLP;
- if(ODU_GET_MSG(region, pool, &mBuf) == ROK)
+ if(ODU_GET_MSG_BUF(region, pool, &mBuf) == ROK)
{
if(ODU_ADD_POST_MSG_MULT((Data *)encBuf, encBufSize, mBuf) == ROK)
{
if(sctpSend(mBuf) != ROK)
{
DU_LOG("\nF1AP : SCTP Send failed");
- ODU_PUT_MSG(mBuf);
+ ODU_PUT_MSG_BUF(mBuf);
return RFAILED;
}
}
else
{
DU_LOG("\nF1AP : ODU_ADD_POST_MSG_MULT failed");
- ODU_PUT_MSG(mBuf);
+ ODU_PUT_MSG_BUF(mBuf);
return RFAILED;
}
- ODU_PUT_MSG(mBuf);
+ ODU_PUT_MSG_BUF(mBuf);
}
else
{
* ****************************************************************/
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 */
return ROK;
}/* End of BuildAndSendDLRRCMessageTransfer */
-
/*******************************************************************
*
* @brief Builds and sends the UE Setup Response
return ROK;
}/* End of BuildAndSendUESetRsp */
-
uint8_t procInitULRRCMsg(F1AP_PDU_t *f1apMsg)
{
uint8_t idx;
ret = BuildAndSendDLRRCMessageTransfer();
return ret;
}
+
/*******************************************************************
-*
-* @brief Handles received F1AP message and sends back response
-*
-* @details
-*
-* Function : F1APMsgHdlr
-*
-* Functionality:
-* - Decodes received F1AP control message
-* - Prepares response message, encodes and sends to SCTP
-*
-* @params[in]
-* @return ROK - success
-* RFAILED - failure
-*
-* ****************************************************************/
+ *
+ * @brief Builds Nrcgi
+ *
+ * @details
+ *
+ * Function : BuildNrcgi
+ *
+ * Functionality: Building the PLMN ID and NR Cell id
+ *
+ * @params[in] NRCGI_t *nrcgi
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t BuildNrcgi(NRCGI_t *nrcgi)
+{
+ uint8_t ret;
+ uint8_t unused = 4;
+ uint8_t byteSize = 5;
+ uint8_t val = 16;
+ /* Allocate Buffer Memory */
+ nrcgi->pLMN_Identity.size = 3 * sizeof(uint8_t);
+ CU_ALLOC(nrcgi->pLMN_Identity.buf, nrcgi->pLMN_Identity.size);
+ if(nrcgi->pLMN_Identity.buf == NULLP)
+ {
+ return RFAILED;
+ }
+ ret = buildPlmnId(cuCfgParams.plmn , &nrcgi->pLMN_Identity);
+
+ if(ret != ROK)
+ {
+ return RFAILED;
+ }
+ nrcgi->nRCellIdentity.size = byteSize * sizeof(uint8_t);
+ CU_ALLOC(nrcgi->nRCellIdentity.buf, nrcgi->nRCellIdentity.size);
+ if(nrcgi->nRCellIdentity.buf == NULLP)
+ {
+ return RFAILED;
+ }
+ ret = fillBitString(&nrcgi->nRCellIdentity, unused, byteSize, val);
+ if(ret != ROK)
+ {
+ return RFAILED;
+ }
+ return ROK;
+}
+/*******************************************************************
+ *
+ * @brief Builds Special cell list for UE Setup Request
+ *
+ * @details
+ *
+ * Function : BuildSplCellList
+ *
+ * Functionality: Constructs the Special Cell list for UESetReq
+ *
+ * @params[in] SCell_ToBeSetup_List_t *spCellLst
+ *
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t BuildSplCellList(SCell_ToBeSetup_List_t *spCellLst)
+{
+ uint8_t cellCnt;
+ uint8_t idx;
+ uint8_t ret;
+ cellCnt = 1;
+ spCellLst->list.count = cellCnt;
+ spCellLst->list.size = cellCnt * sizeof(SCell_ToBeSetup_ItemIEs_t *);
+ CU_ALLOC(spCellLst->list.array,spCellLst->list.size);
+ if(spCellLst->list.array == NULLP)
+ {
+ return RFAILED;
+ }
+ for(idx=0; idx<cellCnt; idx++)
+ {
+ CU_ALLOC(spCellLst->list.array[idx],sizeof(SCell_ToBeSetup_ItemIEs_t));
+ if(spCellLst->list.array[idx] == NULLP)
+ {
+ return RFAILED;
+ }
+ }
+ idx = 0;
+ spCellLst->list.array[idx]->id = ProtocolIE_ID_id_SCell_ToBeSetup_Item;
+ spCellLst->list.array[idx]->criticality = Criticality_ignore;
+ spCellLst->list.array[idx]->value.present =\
+ SCell_ToBeSetup_ItemIEs__value_PR_SCell_ToBeSetup_Item;
+ /* Special Cell ID -NRCGI */
+ ret = BuildNrcgi(&spCellLst->list.array[idx]->value.choice.SCell_ToBeSetup_Item.sCell_ID);
+ if(ret != ROK)
+ {
+ return RFAILED;
+ }
+ /*Special Cell Index*/
+ spCellLst->list.array[idx]->value.choice.SCell_ToBeSetup_Item.sCellIndex = 1;
+ return ROK;
+}/* End of BuildSplCellList*/
+
+/*******************************************************************
+ *
+ * @brief Builds SRBS to be setup
+ *
+ * @details
+ *
+ * Function : BuildSRBSetup
+ *
+ * Functionality: Constructs the SRB's for UESetReq
+ *
+ * @params[in] SRBs_ToBeSetup_List_t *srbSet
+ *
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t BuildSRBSetup(SRBs_ToBeSetup_List_t *srbSet)
+{
+ uint8_t idx;
+ uint8_t srbCnt;
+ srbCnt = 1;
+ srbSet->list.count = srbCnt;
+ srbSet->list.size = srbCnt*sizeof(SRBs_ToBeSetup_ItemIEs_t *);
+ CU_ALLOC(srbSet->list.array,srbSet->list.size);
+ if(srbSet->list.array == NULLP)
+ {
+ return RFAILED;
+ }
+ for(idx=0; idx<srbCnt; idx++)
+ {
+ CU_ALLOC(srbSet->list.array[idx],sizeof(SRBs_ToBeSetup_ItemIEs_t));
+ if(srbSet->list.array[idx] == NULLP)
+ {
+ return RFAILED;
+ }
+ }
+ idx = 0;
+ srbSet->list.array[idx]->id = ProtocolIE_ID_id_SRBs_ToBeSetup_Item;
+ srbSet->list.array[idx]->criticality = Criticality_ignore;
+ srbSet->list.array[idx]->value.present = \
+ SRBs_ToBeSetup_ItemIEs__value_PR_SRBs_ToBeSetup_Item;
+ srbSet->list.array[idx]->value.choice.SRBs_ToBeSetup_Item.sRBID = 2;
+ return ROK;
+}/* End of BuildSRBSetup*/
+
+/*******************************************************************
+ *
+ * @brief Builds QOS Info for DRB Setum Item
+ *
+ * @details
+ *
+ * Function : BuildQOSInfo
+ *
+ * Functionality: Constructs the QOS Info for DRB Setup Item
+ *
+ * @params[in] QoSInformation_t *qosinfo
+ *
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t BuildQOSInfo(QoSFlowLevelQoSParameters_t *drbQos)
+{
+ /* NonDynamic5QIDescriptor */
+ drbQos->qoS_Characteristics.present = QoS_Characteristics_PR_non_Dynamic_5QI;
+ CU_ALLOC(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI,sizeof(NonDynamic5QIDescriptor_t));
+ if(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI == NULLP)
+ {
+ return RFAILED;
+ }
+ /*FiveQI*/
+ drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->fiveQI = 0;
+ /*AveragingWindow*/
+ CU_ALLOC(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow,\
+ sizeof(AveragingWindow_t));
+ if(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow == \
+ NULLP)
+ {
+ return RFAILED;
+ }
+ *(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow) = 0;
+ /*MaxDataBurstVolume*/
+ CU_ALLOC(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume,\
+ sizeof(MaxDataBurstVolume_t));
+ if(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume == \
+ NULLP)
+ {
+ return RFAILED;
+ }
+ *(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume) = 0;
+
+ /*nRGRAN Allocation Retention Priority*/
+ drbQos->nGRANallocationRetentionPriority.priorityLevel = PriorityLevel_highest;
+ drbQos->nGRANallocationRetentionPriority.pre_emptionCapability = Pre_emptionCapability_may_trigger_pre_emption;
+ drbQos->nGRANallocationRetentionPriority.pre_emptionVulnerability = Pre_emptionVulnerability_not_pre_emptable;
+
+ /* TO DO: GBR_QoSFlowInformation */
+ return ROK;
+}/*End of BuildQOSInfo*/
+
+/*******************************************************************
+ *
+ * @brief Builds SNSSAI
+ *
+ * @details
+ *
+ * Function : BuildSNSSAI
+ *
+ * Functionality: Constructs the SNSSAI For DRB list
+ *
+ * @params[in] SNSSAI_t *snssai
+ *
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t BuildSNSSAI(SNSSAI_t *snssai)
+{
+ /*SNSSAI*/
+ /*ssT*/
+ snssai->sST.size = sizeof(uint8_t);
+ CU_ALLOC(snssai->sST.buf,snssai->sST.size);
+ if(snssai->sST.buf == NULLP)
+ {
+ return RFAILED;
+ }
+ snssai->sST.buf[0] = 3;
+ /*sD*/
+ CU_ALLOC(snssai->sD,sizeof(OCTET_STRING_t));
+ if(snssai->sD == NULLP)
+ {
+ return RFAILED;
+ }
+ snssai->sD->size = 3*sizeof(uint8_t);
+ CU_ALLOC(snssai->sD->buf,snssai->sD->size);
+ if(snssai->sD->buf == NULLP)
+ {
+ return RFAILED;
+ }
+ snssai->sD->buf[0] = 3;
+ snssai->sD->buf[1] = 6;
+ snssai->sD->buf[2] = 9;
+ return ROK;
+}/*End of BuildSNSSAI*/
+
+/*******************************************************************
+ *
+ * @brief Builds the flow map.
+ *
+ * @details
+ *
+ * Function : BuildFlowsMap
+ *
+ * Functionality: Constructs the flowmap For DRB list
+ *
+ * @params[in] Flows_Mapped_To_DRB_List_t *flowMap
+ *
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t BuildFlowsMap(Flows_Mapped_To_DRB_List_t *flowMap)
+{
+ uint8_t ret;
+ uint8_t idx;
+ uint8_t flowCnt;
+ flowCnt = 1;
+ flowMap->list.count = flowCnt;
+ flowMap->list.size = flowCnt * sizeof(Flows_Mapped_To_DRB_Item_t *);
+ CU_ALLOC(flowMap->list.array,flowMap->list.size);
+ if(flowMap->list.array == NULLP)
+ {
+ return RFAILED;
+ }
+ for(idx=0; idx<flowCnt; idx++)
+ {
+ CU_ALLOC(flowMap->list.array[idx],sizeof(Flows_Mapped_To_DRB_Item_t));
+ if(flowMap->list.array[idx] == NULLP)
+ {
+ return RFAILED;
+ }
+ }
+ idx = 0;
+ flowMap->list.array[idx]->qoSFlowIdentifier = 0;
+ ret = BuildQOSInfo(&flowMap->list.array[idx]->qoSFlowLevelQoSParameters);
+ if(ret != ROK)
+ {
+ return RFAILED;
+ }
+ return ROK;
+}/*End of BuildFlowsMap*/
+
+/*******************************************************************
+ *
+ * @brief Builds the Uplink Tunnel Info
+ *
+ * @details
+ *
+ * Function : BuildULTnlInfo
+ *
+ * Functionality: Constructs the UL TnlInfo For DRB list
+ *
+ * @params[in] ULUPTNLInformation_ToBeSetup_List_t *ulInfo
+ *
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t BuildULTnlInfo(ULUPTNLInformation_ToBeSetup_List_t *ulInfo)
+{
+ uint8_t idx;
+ uint8_t ulCnt;
+ ulCnt = 1;
+ ulInfo->list.count = ulCnt;
+ ulInfo->list.size = ulCnt * sizeof(ULUPTNLInformation_ToBeSetup_Item_t *);
+ CU_ALLOC(ulInfo->list.array,ulInfo->list.size);
+ if(ulInfo->list.array == NULLP)
+ {
+ return RFAILED;
+ }
+ for(idx=0; idx<ulCnt; idx++)
+ {
+ CU_ALLOC(ulInfo->list.array[idx],sizeof(ULUPTNLInformation_ToBeSetup_Item_t));
+ if(ulInfo->list.array[idx] == NULLP)
+ {
+ return RFAILED;
+ }
+ }
+ idx = 0;
+ ulInfo->list.array[idx]->uLUPTNLInformation.present = \
+ UPTransportLayerInformation_PR_gTPTunnel;
+ /*GTP TUNNEL*/
+ CU_ALLOC(ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel,\
+ sizeof(GTPTunnel_t));
+ if(ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel == NULLP)
+ {
+ return RFAILED;
+ }
+ ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->\
+ transportLayerAddress.size = 4*sizeof(uint8_t);
+ CU_ALLOC(ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->\
+ transportLayerAddress.buf,ulInfo->list.array[idx]->\
+ uLUPTNLInformation.choice.gTPTunnel->transportLayerAddress.size);
+ if(ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->\
+ transportLayerAddress.buf == NULLP)
+ {
+ return RFAILED;
+ }
+ ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->\
+ transportLayerAddress.buf[0] = 4;
+ ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->\
+ transportLayerAddress.buf[1] = 4;
+ ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->\
+ transportLayerAddress.buf[2] = 4;
+ ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->\
+ transportLayerAddress.buf[3] = 5;
+ ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->\
+ transportLayerAddress.bits_unused = 0;
+ /*GTP TEID*/
+ ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->gTP_TEID.size\
+ = 4 * sizeof(uint8_t);
+ CU_ALLOC(ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->\
+ gTP_TEID.buf,ulInfo->list.array[idx]->uLUPTNLInformation.choice.\
+ gTPTunnel->gTP_TEID.size);
+ if(ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->gTP_TEID.buf\
+ == NULLP)
+ {
+ return RFAILED;
+ }
+ ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->\
+ gTP_TEID.buf[0] = 11;
+ ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->\
+ gTP_TEID.buf[1] = 0;
+ ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->\
+ gTP_TEID.buf[2] = 0;
+ ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->\
+ gTP_TEID.buf[3] = 1;
+
+ return ROK;
+}/*End of BuildULTnlInfo*/
+
+/*******************************************************************
+ *
+ * @brief Builds DRBS to be setup
+ *
+ * @details
+ *
+ * Function : BuildDRBSetup
+ *
+ * Functionality: Constructs the DRB's for UESetReq
+ *
+ * @params[in] DRBs_ToBeSetup_List_t *drbSet
+ *
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t BuildDRBSetup(DRBs_ToBeSetup_List_t *drbSet)
+{
+ uint8_t BuildQOSInforet;
+ uint8_t BuildSNSSAIret;
+ uint8_t BuildFlowsMapret;
+ uint8_t BuildULTnlInforet;
+ uint8_t idx;
+ uint8_t drbCnt;
+ DRBs_ToBeSetup_Item_t *drbSetItem;
+ drbCnt = 1;
+ drbSet->list.count = drbCnt;
+ drbSet->list.size = drbCnt*sizeof(DRBs_ToBeSetup_ItemIEs_t *);
+ CU_ALLOC(drbSet->list.array,drbSet->list.size);
+ if(drbSet->list.array == NULLP)
+ {
+ return RFAILED;
+ }
+ for(idx=0; idx<drbCnt; idx++)
+ {
+ CU_ALLOC(drbSet->list.array[idx],sizeof(DRBs_ToBeSetup_ItemIEs_t));
+ if(drbSet->list.array[idx] == NULLP)
+ {
+ return RFAILED;
+ }
+ }
+ idx = 0;
+ drbSet->list.array[idx]->id = ProtocolIE_ID_id_DRBs_ToBeSetup_Item;
+ drbSet->list.array[idx]->criticality = Criticality_ignore;
+ drbSet->list.array[idx]->value.present = \
+ DRBs_ToBeSetup_ItemIEs__value_PR_DRBs_ToBeSetup_Item;
+ drbSetItem = &drbSet->list.array[idx]->value.choice.DRBs_ToBeSetup_Item;
+ /*dRBID*/
+ drbSetItem->dRBID = 1;
+ /*qoSInformation*/
+ drbSetItem->qoSInformation.present = QoSInformation_PR_choice_extension;
+ CU_ALLOC(drbSetItem->qoSInformation.choice.choice_extension,sizeof(QoSInformation_ExtIEs_t));
+ if(drbSetItem->qoSInformation.choice.choice_extension == NULLP)
+ {
+ return RFAILED;
+ }
+ drbSetItem->qoSInformation.choice.choice_extension->id = \
+ ProtocolIE_ID_id_DRB_Information;
+ drbSetItem->qoSInformation.choice.choice_extension->criticality = \
+ Criticality_ignore;
+ drbSetItem->qoSInformation.choice.choice_extension->value.present = \
+ QoSInformation_ExtIEs__value_PR_DRB_Information;
+ BuildQOSInforet = BuildQOSInfo(&drbSetItem->qoSInformation.choice.\
+ choice_extension->value.choice.DRB_Information.dRB_QoS);
+ if(BuildQOSInforet != ROK)
+ {
+ return RFAILED;
+ }
+ /*SNSSAI*/
+ BuildSNSSAIret = BuildSNSSAI(&drbSetItem->qoSInformation.choice.\
+ choice_extension->value.choice.DRB_Information.sNSSAI);
+ if(BuildSNSSAIret != ROK)
+ {
+ return RFAILED;
+ }
+ /*Flows mapped to DRB List*/
+ BuildFlowsMapret = BuildFlowsMap(&drbSetItem->qoSInformation.choice.\
+ choice_extension->value.choice.DRB_Information.flows_Mapped_To_DRB_List);
+ if(BuildFlowsMapret != ROK)
+ {
+ return RFAILED;
+ }
+ /*ULUPTNLInformation To Be Setup List*/
+ BuildULTnlInforet = BuildULTnlInfo(&drbSetItem->uLUPTNLInformation_ToBeSetup_List);
+ if(BuildULTnlInforet != ROK)
+ {
+ return RFAILED;
+ }
+ /*RLCMode*/
+ drbSetItem->rLCMode = RLCMode_rlc_um_bidirectional;
+
+ /*UL Configuration*/
+ CU_ALLOC(drbSetItem->uLConfiguration,sizeof(ULConfiguration_t));
+ if(drbSetItem->uLConfiguration == NULLP)
+ {
+ return RFAILED;
+ }
+ drbSetItem->uLConfiguration->uLUEConfiguration = ULUEConfiguration_no_data;
+ return ROK;
+}/* End of BuildDRBSetup*/
+
+/*******************************************************************
+ *
+ * @brief Deallocating memory of function BuildAndSendUESetReq
+ *
+ * @details
+ *
+ * Function : FreeNrcgi
+ *
+ * Functionality: Deallocating memory for function BuildNrcgi
+ *
+ * @params[in] NRCGI_t *nrcgi
+ *
+ * @return void
+ *
+ *******************************************************************/
+void FreeNrcgi(NRCGI_t *nrcgi)
+{
+ if(nrcgi->pLMN_Identity.buf != NULLP)
+ {
+ if(nrcgi->nRCellIdentity.buf != NULLP)
+ {
+ CU_FREE(nrcgi->nRCellIdentity.buf, nrcgi->nRCellIdentity.size);
+ }
+ CU_FREE(nrcgi->pLMN_Identity.buf, nrcgi->pLMN_Identity.size);
+ }
+}
+/*******************************************************************
+ *
+ * @brief Deallocating memory of function BuildAndSendUESetReq
+ *
+ * @details
+ *
+ * Function : FreeSplCellList
+ *
+ * Functionality: Deallocating memory for function BuildSplCellList
+ *
+ * @params[in] SCell_ToBeSetup_List_t *spCellLst
+ *
+ * @return void
+ *
+ *
+ * *****************************************************************/
+void FreeSplCellList(SCell_ToBeSetup_List_t *spCellLst)
+{
+ uint8_t cellidx;
+ if(spCellLst->list.array != NULLP)
+ {
+ for(cellidx=0; cellidx<spCellLst->list.count; cellidx++)
+ {
+ if(cellidx==0&&spCellLst->list.array[cellidx]!=NULLP)
+ {
+ FreeNrcgi(&spCellLst->list.array[cellidx]->value.choice.SCell_ToBeSetup_Item.sCell_ID);
+ }
+ if(spCellLst->list.array[cellidx]!=NULLP)
+ {
+ CU_FREE(spCellLst->list.array[cellidx],sizeof(SCell_ToBeSetup_ItemIEs_t));
+ }
+ }
+ CU_FREE(spCellLst->list.array,spCellLst->list.size);
+ }
+}
+/*******************************************************************
+ *
+ * @brief Deallocating memory of function BuildAndSendUESetReq
+ *
+ * @details
+ *
+ * Function : FreeSRBSetup
+ *
+ * Functionality: Deallocating memory for function BuildSRBSetup
+ *
+ * @params[in] SRBs_ToBeSetup_List_t *srbSet
+ *
+ * @return void
+ *
+ *
+ * ******************************************************************/
+void FreeSRBSetup(SRBs_ToBeSetup_List_t *srbSet)
+{
+ uint8_t srbidx;
+ if(srbSet->list.array != NULLP)
+ {
+ for(srbidx=0; srbidx<srbSet->list.count; srbidx++)
+ {
+ if(srbSet->list.array[srbidx]!=NULLP)
+ {
+ CU_FREE(srbSet->list.array[srbidx],sizeof(SRBs_ToBeSetup_ItemIEs_t));
+ }
+ }
+ CU_FREE(srbSet->list.array,srbSet->list.size);
+ }
+}
+/*******************************************************************
+ *
+ * @brief Deallocating memory of function BuildAndSendUESetReq
+ *
+ * @details
+ *
+ * Function : FreeQOSInfo
+ *
+ * Functionality: Deallocating memory for function BuildQOSInfo
+ *
+ * @params[in] QoSFlowLevelQoSParameters_t *drbQos
+ *
+ * @return void
+ *
+ * ****************************************************************/
+void FreeQOSInfo(QoSFlowLevelQoSParameters_t *drbQos)
+{
+ if(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI != NULLP)
+ {
+ if(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow!=NULLP)
+ {
+ if(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume!=NULLP)
+ {
+ CU_FREE(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume,\
+ sizeof(MaxDataBurstVolume_t));
+ }
+ CU_FREE(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow,\
+ sizeof(AveragingWindow_t));
+ }
+ CU_FREE(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI,\
+ sizeof(NonDynamic5QIDescriptor_t));
+ }
+}
+/*******************************************************************
+ *
+ * @brief Deallocating memory of function BuildAndSendUESetReq
+ *
+ * @details
+ *
+ * Function : FreeULTnlInfo
+ *
+ * Functionality: Deallocating memory for function BuildULTnlInfo
+ *
+ * @params[in] ULUPTNLInformation_ToBeSetup_List_t *ulInfo
+ *
+ * @return void
+ *
+
+ * ****************************************************************/
+void FreeULTnlInfo(ULUPTNLInformation_ToBeSetup_List_t *ulInfo)
+{
+ uint8_t ulidx=0;
+ if(ulInfo->list.array != NULLP)
+ {
+ for(ulidx=0; ulidx<ulInfo->list.count; ulidx++)
+ {
+ if(ulidx==0&&ulInfo->list.array[ulidx]!=NULLP)
+ {
+ if(ulInfo->list.array[ulidx]->uLUPTNLInformation.choice.gTPTunnel!=NULLP)
+ {
+ if(ulInfo->list.array[ulidx]->uLUPTNLInformation.choice.gTPTunnel->\
+ transportLayerAddress.buf != NULLP)
+ {
+ if(ulInfo->list.array[ulidx]->uLUPTNLInformation.choice.gTPTunnel->gTP_TEID.buf\
+ !=NULLP)
+ {
+ CU_ALLOC(ulInfo->list.array[ulidx]->uLUPTNLInformation.choice.gTPTunnel->\
+ gTP_TEID.buf,ulInfo->list.array[ulidx]->uLUPTNLInformation.choice.\
+ gTPTunnel->gTP_TEID.size);
+ }
+ CU_FREE(ulInfo->list.array[ulidx]->uLUPTNLInformation.choice.gTPTunnel->\
+ transportLayerAddress.buf,ulInfo->list.array[ulidx]->\
+ uLUPTNLInformation.choice.gTPTunnel->transportLayerAddress.size);
+ }
+ CU_FREE(ulInfo->list.array[ulidx]->uLUPTNLInformation.choice.gTPTunnel,\
+ sizeof(GTPTunnel_t));
+ }
+ }
+ if(ulInfo->list.array[ulidx]!=NULLP)
+ {
+ CU_FREE(ulInfo->list.array[ulidx],sizeof(ULUPTNLInformation_ToBeSetup_Item_t));
+ }
+ }
+ CU_FREE(ulInfo->list.array,ulInfo->list.size);
+ }
+}
+/*******************************************************************
+ *
+ * @brief Deallocating memory for BuildAndSendUESetReq
+ *
+ * @details
+ *
+ * Function : FreeDRBSetup
+ *
+ * Functionality: Deallocating memory for BuildDRBSetup
+ *
+ * @params[in] DRBs_ToBeSetup_List_t *drbSet
+ *
+ * @return void
+ *
+ * ****************************************************************/
+void FreeDRBSetup(DRBs_ToBeSetup_List_t *drbSet)
+{
+ DRBs_ToBeSetup_Item_t *drbSetItem;
+ uint8_t flowidx;
+ uint8_t drbidx;
+ if(drbSet->list.array == NULLP)
+ {
+ for(drbidx=0; drbidx<drbSet->list.count; drbidx++)
+ {
+ if(drbidx==0&&drbSet->list.array[drbidx] != NULLP)
+ {
+ drbSetItem =&drbSet->list.array[drbidx]->value.choice.DRBs_ToBeSetup_Item;
+ if(drbSetItem->qoSInformation.choice.choice_extension != NULLP)
+ {
+ if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\
+ qoS_Characteristics.choice.non_Dynamic_5QI !=NULLP)
+ {
+ if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\
+ qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow!=NULLP)
+ {
+ if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\
+ qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume!=NULLP)
+ {
+ if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sST.buf!=NULLP)
+ {
+ if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sD!=NULLP)
+ {
+ if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sD->buf!=NULLP)
+ {
+ if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.\
+ flows_Mapped_To_DRB_List.list.array != NULLP)
+ {
+ for(flowidx=0;flowidx<drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.\
+ flows_Mapped_To_DRB_List.list.count; flowidx++)
+ {
+ if(flowidx==0&&drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
+ DRB_Information.flows_Mapped_To_DRB_List.list.array[flowidx]!=NULLP)
+ {
+ if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
+ DRB_Information.flows_Mapped_To_DRB_List.list.array[flowidx]->qoSFlowLevelQoSParameters.\
+ qoS_Characteristics.choice.non_Dynamic_5QI!=NULLP)
+ {
+ if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
+ DRB_Information.flows_Mapped_To_DRB_List.list.array[flowidx]->qoSFlowLevelQoSParameters.\
+ qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow!=NULLP)
+ {
+ if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
+ DRB_Information.flows_Mapped_To_DRB_List.list.array[flowidx]->qoSFlowLevelQoSParameters.\
+ qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume!=NULLP)
+ {
+ FreeULTnlInfo(&drbSetItem->uLUPTNLInformation_ToBeSetup_List);
+ CU_FREE(drbSetItem->uLConfiguration,sizeof(ULConfiguration_t));
+
+ CU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
+ DRB_Information.flows_Mapped_To_DRB_List.list.array[flowidx]->qoSFlowLevelQoSParameters.\
+ qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume,\
+ sizeof(MaxDataBurstVolume_t));
+ }
+ CU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
+ DRB_Information.flows_Mapped_To_DRB_List.list.array[flowidx]->qoSFlowLevelQoSParameters.\
+ qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow,sizeof(AveragingWindow_t));
+ }
+ CU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
+ DRB_Information.flows_Mapped_To_DRB_List.list.array[flowidx]->qoSFlowLevelQoSParameters.\
+ qoS_Characteristics.choice.non_Dynamic_5QI,sizeof(NonDynamic5QIDescriptor_t));
+ }
+ }
+ if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
+ DRB_Information.flows_Mapped_To_DRB_List.list.array[flowidx]!=NULLP)
+ {
+ CU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
+ DRB_Information.flows_Mapped_To_DRB_List.list.array[flowidx],sizeof(Flows_Mapped_To_DRB_Item_t));
+ }
+ }
+ CU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.\
+ flows_Mapped_To_DRB_List.list.array,drbSetItem->qoSInformation.choice.choice_extension->value.\
+ choice.DRB_Information.flows_Mapped_To_DRB_List.list.size);
+ }
+ CU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sD->buf,\
+ drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sD->size);
+ }
+ CU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sD,\
+ sizeof(OCTET_STRING_t));
+ }
+ CU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sST.buf,\
+ drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sST.size);
+ }
+ CU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\
+ qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume,sizeof(MaxDataBurstVolume_t));
+ }
+ CU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\
+ qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow,sizeof(AveragingWindow_t));
+ }
+ CU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\
+ qoS_Characteristics.choice.non_Dynamic_5QI, sizeof(NonDynamic5QIDescriptor_t));
+ }
+ CU_FREE(drbSetItem->qoSInformation.choice.choice_extension,sizeof(QoSInformation_ExtIEs_t));
+ }
+ }
+ if(drbSet->list.array[drbidx]!=NULLP)
+ {
+ CU_FREE(drbSet->list.array[drbidx],sizeof(DRBs_ToBeSetup_ItemIEs_t));
+ }
+ }
+ CU_FREE(drbSet->list.array,drbSet->list.size);
+ }
+}
+
+
+/*******************************************************************
+ *
+ * @brief Free the UE Setup Request
+ *
+ * @details
+ *
+ * Function : FreeUESetReq
+ *
+ * Functionality: Deallocate the memory of BuildUESetReq
+ *
+ * @params[in] F1AP_PDU_t *f1apMsg
+ *
+ * @return void
+ *
+ *
+ * ****************************************************************/
+void FreeUESetReq(F1AP_PDU_t *f1apMsg)
+{
+ uint8_t idx=2;
+ uint8_t ieId;
+ UEContextSetupRequest_t *ueSetReq;
+
+ if(f1apMsg != NULLP)
+ {
+ if(f1apMsg->choice.initiatingMessage != NULLP)
+ {
+ ueSetReq = &f1apMsg->choice.initiatingMessage->value.choice.UEContextSetupRequest;
+ if(ueSetReq->protocolIEs.list.array != NULLP)
+ {
+ if(ueSetReq->protocolIEs.list.array[idx])
+ {
+ FreeNrcgi(&ueSetReq->protocolIEs.list.array[idx]->value.choice.NRCGI);
+ idx=6;
+ if(ueSetReq->protocolIEs.list.array[idx])
+ {
+ FreeSplCellList(&ueSetReq->protocolIEs.list.array[idx]->value.choice.SCell_ToBeSetup_List);
+ idx++;
+ if(ueSetReq->protocolIEs.list.array[idx])
+ {
+ FreeSRBSetup(&ueSetReq->protocolIEs.list.array[idx]->value.choice.SRBs_ToBeSetup_List);
+ idx++;
+ if(ueSetReq->protocolIEs.list.array[idx])
+ {
+ FreeDRBSetup(&ueSetReq->protocolIEs.list.array[idx]->value.choice.DRBs_ToBeSetup_List);
+ }
+ }
+ }
+ }
+ for(ieId=0; ieId<ueSetReq->protocolIEs.list.count; ieId++)
+ {
+ if(ueSetReq->protocolIEs.list.array[ieId] != NULLP)
+ {
+ CU_FREE(ueSetReq->protocolIEs.list.array[ieId],sizeof(UEContextSetupRequestIEs_t));
+ }
+ }
+ CU_FREE(ueSetReq->protocolIEs.list.array,ueSetReq->protocolIEs.list.size);
+ }
+ CU_FREE(f1apMsg->choice.initiatingMessage,sizeof(InitiatingMessage_t));
+ }
+ CU_FREE(f1apMsg, sizeof(F1AP_PDU_t));
+ }
+}
+
+/*******************************************************************
+ *
+ * @brief Builds and sends the UE Setup Request
+ *
+ * @details
+ *
+ * Function : BuildAndSendUESetReq
+ *
+ * Functionality: Constructs the UE Setup Request and sends
+ * it to the CU through SCTP.
+ *
+ * @params[in]
+ *
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t BuildAndSendUESetReq(uint8_t cuUeF1apId, uint8_t duUeF1apId, \
+ uint16_t rrcContLen, uint8_t *rrcContainer)
+{
+ uint8_t Nrcgiret;
+ uint8_t SplCellListret;
+ uint8_t SrbSetupret;
+ uint8_t elementCnt;
+ uint8_t idx;
+ uint8_t idx1;
+ F1AP_PDU_t *f1apMsg = NULLP;
+ UEContextSetupRequest_t *ueSetReq = NULLP;
+ asn_enc_rval_t encRetVal; /* Encoder return value */
+ memset(&encRetVal, 0, sizeof(asn_enc_rval_t));
+ uint8_t ret= RFAILED;
+ uint8_t ret1;
+ while(1)
+ {
+ DU_LOG("\n F1AP : Building UE Context Setup Request\n");
+
+ CU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t));
+ if(f1apMsg == NULLP)
+ {
+ DU_LOG(" F1AP : Memory allocation for F1AP-PDU failed");
+ break;
+ }
+
+ 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");
+ break;
+ }
+
+ f1apMsg->choice.initiatingMessage->procedureCode = \
+ ProcedureCode_id_UEContextSetup;
+ f1apMsg->choice.initiatingMessage->criticality = Criticality_reject;
+ f1apMsg->choice.initiatingMessage->value.present = \
+ InitiatingMessage__value_PR_UEContextSetupRequest;
+ ueSetReq =
+ &f1apMsg->choice.initiatingMessage->value.choice.UEContextSetupRequest;
+
+ elementCnt = 11;
+ ueSetReq->protocolIEs.list.count = elementCnt;
+ ueSetReq->protocolIEs.list.size = \
+ elementCnt * sizeof(UEContextSetupRequestIEs_t *);
+
+ /* Initialize the UESetup members */
+ CU_ALLOC(ueSetReq->protocolIEs.list.array,ueSetReq->protocolIEs.list.size);
+
+ if(ueSetReq->protocolIEs.list.array == NULLP)
+ {
+ DU_LOG(" F1AP : Memory allocation for UE Context SetupRequest failed");
+ break;
+ }
+
+ for(idx1=0; idx1<elementCnt; idx1++)
+ {
+ CU_ALLOC(ueSetReq->protocolIEs.list.array[idx1],sizeof(UEContextSetupRequestIEs_t));
+ if(ueSetReq->protocolIEs.list.array[idx1] == NULLP)
+ {
+ break;
+ }
+ }
+
+ idx = 0;
+
+ /*GNB CU UE F1AP ID*/
+ ueSetReq->protocolIEs.list.array[idx]->id = \
+ ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID;
+ ueSetReq->protocolIEs.list.array[idx]->criticality = Criticality_reject;
+ ueSetReq->protocolIEs.list.array[idx]->value.present = \
+ UEContextSetupRequestIEs__value_PR_GNB_CU_UE_F1AP_ID;
+ ueSetReq->protocolIEs.list.array[idx]->value.choice.GNB_CU_UE_F1AP_ID = cuUeF1apId;
+
+ /*GNB DU UE F1AP ID*/
+ idx++;
+ ueSetReq->protocolIEs.list.array[idx]->id = \
+ ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID;
+ ueSetReq->protocolIEs.list.array[idx]->criticality = Criticality_ignore;
+ ueSetReq->protocolIEs.list.array[idx]->value.present = \
+ UEContextSetupRequestIEs__value_PR_GNB_DU_UE_F1AP_ID;
+ ueSetReq->protocolIEs.list.array[idx]->value.choice.GNB_DU_UE_F1AP_ID = duUeF1apId;
+
+ /*Special Cell ID*/
+ idx++;
+ ueSetReq->protocolIEs.list.array[idx]->id = \
+ ProtocolIE_ID_id_SpCell_ID;
+ ueSetReq->protocolIEs.list.array[idx]->criticality = Criticality_reject;
+ ueSetReq->protocolIEs.list.array[idx]->value.present = \
+ UEContextSetupRequestIEs__value_PR_NRCGI;
+ Nrcgiret = BuildNrcgi(&ueSetReq->protocolIEs.list.array[idx]->value.choice.NRCGI);
+ if(Nrcgiret != ROK)
+ {
+ break;
+ }
+
+ /*Served Cell Index*/
+ idx++;
+ ueSetReq->protocolIEs.list.array[idx]->id = \
+ ProtocolIE_ID_id_ServCellIndex;
+ ueSetReq->protocolIEs.list.array[idx]->criticality = Criticality_reject;
+ ueSetReq->protocolIEs.list.array[idx]->value.present = \
+ UEContextSetupRequestIEs__value_PR_ServCellIndex;
+ ueSetReq->protocolIEs.list.array[idx]->value.choice.ServCellIndex = \
+ CELL_INDEX;
+
+ /*CellULConfigured*/
+ idx++;
+ ueSetReq->protocolIEs.list.array[idx]->id = \
+ ProtocolIE_ID_id_SpCellULConfigured;
+ ueSetReq->protocolIEs.list.array[idx]->criticality = Criticality_ignore;
+ ueSetReq->protocolIEs.list.array[idx]->value.present = \
+ UEContextSetupRequestIEs__value_PR_CellULConfigured;
+ ueSetReq->protocolIEs.list.array[idx]->value.choice.CellULConfigured = \
+ CellULConfigured_none;
+
+
+ /*CUtoDURRCContainer*/
+ idx++;
+ ueSetReq->protocolIEs.list.array[idx]->id = \
+ ProtocolIE_ID_id_CUtoDURRCInformation;
+ ueSetReq->protocolIEs.list.array[idx]->criticality = Criticality_reject;
+ ueSetReq->protocolIEs.list.array[idx]->value.present = \
+ UEContextSetupRequestIEs__value_PR_CUtoDURRCInformation;
+
+ /*Special Cells to be SetupList*/
+ idx++;
+ ueSetReq->protocolIEs.list.array[idx]->id = \
+ ProtocolIE_ID_id_SCell_ToBeSetup_List;
+ ueSetReq->protocolIEs.list.array[idx]->criticality = Criticality_ignore;
+ ueSetReq->protocolIEs.list.array[idx]->value.present = \
+ UEContextSetupRequestIEs__value_PR_SCell_ToBeSetup_List;
+ SplCellListret = BuildSplCellList(&ueSetReq->protocolIEs.list.array[idx]->value.choice.SCell_ToBeSetup_List);
+ if(SplCellListret != ROK)
+ {
+ break;
+ }
+ /*SRBs To Be Setup List*/
+ idx++;
+ ueSetReq->protocolIEs.list.array[idx]->id = \
+ ProtocolIE_ID_id_SRBs_ToBeSetup_List;
+ ueSetReq->protocolIEs.list.array[idx]->criticality = Criticality_reject;
+ ueSetReq->protocolIEs.list.array[idx]->value.present = \
+ UEContextSetupRequestIEs__value_PR_SRBs_ToBeSetup_List;
+ SrbSetupret = BuildSRBSetup(&ueSetReq->protocolIEs.list.array[idx]->value.choice.SRBs_ToBeSetup_List);
+ if(SrbSetupret != ROK)
+ {
+ break;
+ }
+ /*DRBs to Be Setup List*/
+ idx++;
+ ueSetReq->protocolIEs.list.array[idx]->id = \
+ ProtocolIE_ID_id_DRBs_ToBeSetup_List;
+ ueSetReq->protocolIEs.list.array[idx]->criticality = Criticality_reject;
+ ueSetReq->protocolIEs.list.array[idx]->value.present = \
+ UEContextSetupRequestIEs__value_PR_DRBs_ToBeSetup_List;
+ ret1 = BuildDRBSetup(&ueSetReq->protocolIEs.list.array[idx]->value.choice.DRBs_ToBeSetup_List);
+ if(ret1 != ROK)
+ {
+ break;
+ }
+
+ /* RRC Container */
+ idx++;
+ ueSetReq->protocolIEs.list.array[idx]->id = ProtocolIE_ID_id_RRCContainer;
+ ueSetReq->protocolIEs.list.array[idx]->criticality = Criticality_reject;
+ ueSetReq->protocolIEs.list.array[idx]->value.present = \
+ UEContextSetupRequestIEs__value_PR_RRCContainer;
+ ueSetReq->protocolIEs.list.array[idx]->value.choice.RRCContainer.size = rrcContLen;
+ CU_ALLOC(ueSetReq->protocolIEs.list.array[idx]->value.choice.RRCContainer.buf,
+ ueSetReq->protocolIEs.list.array[idx]->value.choice.RRCContainer.size);
+ if(!ueSetReq->protocolIEs.list.array[idx]->value.choice.RRCContainer.buf)
+ {
+ DU_LOG(" F1AP : Memory allocation for BuildAndSendUESetReq failed");
+ break;
+ }
+ memcpy(ueSetReq->protocolIEs.list.array[idx]->value.choice.RRCContainer.buf, \
+ rrcContainer, ueSetReq->protocolIEs.list.array[idx]->value.choice.RRCContainer.size);
+
+ /* RRC delivery status request */
+ idx++;
+ ueSetReq->protocolIEs.list.array[idx]->id = \
+ ProtocolIE_ID_id_RRCDeliveryStatusRequest;
+ ueSetReq->protocolIEs.list.array[idx]->criticality = Criticality_ignore;
+ ueSetReq->protocolIEs.list.array[idx]->value.present = \
+ UEContextSetupRequestIEs__value_PR_RRCDeliveryStatusRequest;
+ ueSetReq->protocolIEs.list.array[idx]->value.choice.RRCDeliveryStatusRequest = \
+ RRCDeliveryStatusRequest_true;
+
+ xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg);
+
+ /* Encode the F1SetupRequest type as APER */
+ cmMemset((uint8_t *)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 UE Context Setup Request structure (at %s)\n",\
+ encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
+ break;
+ }
+ else
+ {
+ DU_LOG("\n F1AP : Created APER encoded buffer for UE Context Setup Request\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 UE Context Setup Request Failed");
+ break;
+ }
+ ret = ROK;
+ break;
+ }
+ FreeUESetReq(f1apMsg);
+
+ return ret;
+}/* End of BuildAndSendUESetReq*/
+
+uint8_t procUlRrcMsg(F1AP_PDU_t *f1apMsg)
+{
+ uint8_t idx;
+ uint8_t ret =ROK;
+ uint8_t cuUeF1apId, duUeF1apId;
+ uint8_t *rrcContainer;
+ uint16_t rrcContLen;
+ ULRRCMessageTransfer_t *ulRrcMsg = NULLP;
+
+ ulRrcMsg = &f1apMsg->choice.initiatingMessage->value.choice.ULRRCMessageTransfer;
+
+ for(idx=0; idx < ulRrcMsg->protocolIEs.list.count; idx++)
+ {
+ switch(ulRrcMsg->protocolIEs.list.array[idx]->id)
+ {
+ case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID:
+ {
+ cuUeF1apId = ulRrcMsg->protocolIEs.list.array[idx]->value.choice.GNB_CU_UE_F1AP_ID;
+ break;
+ }
+ case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID:
+ {
+ duUeF1apId = ulRrcMsg->protocolIEs.list.array[idx]->value.choice.GNB_DU_UE_F1AP_ID;
+ break;
+ }
+ case ProtocolIE_ID_id_SRBID:
+ break;
+ case ProtocolIE_ID_id_RRCContainer:
+ {
+ rrcContLen = ulRrcMsg->protocolIEs.list.array[idx]->value.choice.RRCContainer.size;
+ CU_ALLOC(rrcContainer, rrcContLen)
+ if(!rrcContainer)
+ {
+ DU_LOG("\nCU_STUB: Failed to allocated memory in procUlRrcMsg");
+ return RFAILED;
+ }
+ memcpy(rrcContainer, ulRrcMsg->protocolIEs.list.array[idx]->value.choice.RRCContainer.buf,\
+ rrcContLen);
+ break;
+ }
+
+ default:
+ DU_LOG("\n Invalid Event %ld", ulRrcMsg->protocolIEs.list.array[idx]->id);
+ break;
+ }
+ }
+ if(!ret)
+ ret = BuildAndSendUESetReq(cuUeF1apId, duUeF1apId, rrcContLen, rrcContainer);
+ return ret;
+}
+/*******************************************************************
+ *
+ * @brief Handles received F1AP message and sends back response
+ *
+ * @details
+ *
+ * Function : F1APMsgHdlr
+ *
+ * Functionality:
+ * - Decodes received F1AP control message
+ * - Prepares response message, encodes and sends to SCTP
+ *
+ * @params[in]
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
void F1APMsgHdlr(Buffer *mBuf)
{
int i;
printf("\nF1AP : Received flat buffer to be decoded : ");
for(i=0; i< recvBufLen; i++)
{
- printf("%x",recvBuf[i]);
+ printf("%x",recvBuf[i]);
}
/* Decoding flat buffer into F1AP messsage */
procInitULRRCMsg(f1apMsg);
break;
}
+ case InitiatingMessage__value_PR_ULRRCMessageTransfer:
+ {
+ DU_LOG("\nF1AP : Received ULRRCMessageTransfer");
+ procUlRrcMsg(f1apMsg);
+ }
default:
{
DU_LOG("\nF1AP : Invalid type of intiating message [%d]",f1apMsg->choice.initiatingMessage->value.present);
#define ENCODE_FAIL -1
#define TRANS_ID 1
#define RRC_SIZE 1
-#define ENC_BUF_MAX_LEN 100
#define SUL_BAND_COUNT 0
#define UL_SRBID 1
#define DL_SRBID 0
#define CELL_INDEX 0
#define SRB1 1
-/* allocate and zero out a static buffer */
-#define CU_ALLOC(_datPtr, _size) \
-{ \
- S16 _ret; \
- _ret = SGetSBuf(CU_APP_MEM_REG, CU_POOL, \
- (Data **)&_datPtr, _size); \
- if(_ret == ROK) \
- cmMemset((U8*)_datPtr, 0, _size); \
- else \
- _datPtr = NULLP; \
-}
-
-/* free a static buffer */
-#define CU_FREE(_datPtr, _size) \
- if(_datPtr) \
- SPutSBuf(CU_APP_MEM_REG, CU_POOL, \
- (Data *)_datPtr, _size);
-
+#define CU_UE_F1AP_ID 0
+#define DU_UE_F1AP_ID 1
+#define SP_CELL_ID 2
+#define SERV_CELL_IDX 3
+#define CU_TO_DU_RRC_INF 4
typedef struct f1apDb
{
#define DU_PORT 38472
/* allocate and zero out a static buffer */
-#define CU_ALLOC(_datPtr, _size) \
-{ \
- S16 _ret; \
+#define CU_ALLOC(_datPtr, _size) \
+{ \
+ S16 _ret; \
_ret = SGetSBuf(CU_APP_MEM_REG, CU_POOL, \
- (Data **)&_datPtr, _size); \
- if(_ret == ROK) \
- cmMemset((U8*)_datPtr, 0, _size); \
- else \
- _datPtr = NULLP; \
+ (Data **)&_datPtr, _size); \
+ if(_ret == ROK) \
+ cmMemset((U8*)_datPtr, 0, _size); \
+ else \
+ _datPtr = NULLP; \
}
/* free a static buffer */
-#define CU_FREE(_datPtr, _size) \
+#define CU_FREE(_datPtr, _size) \
+ if(_datPtr) \
SPutSBuf(CU_APP_MEM_REG, CU_POOL, \
(Data *)_datPtr, _size);
void readCuCfg();
void cuAppInmsgHdlr(Buffer *mBuf);
void sctpNtfyInd(CmInetSctpNotification *ntfy);
+uint8_t egtpInitReq();
#endif
* RFAILED - failure
*
***************************************************************************/
-S16 egtpInitReq()
+uint8_t egtpInitReq()
{
- S16 ret = ROK;
+ uint8_t ret = ROK;
EgtpTnlEvt tnlEvt;
ret = cuEgtpCfgReq();
return RFAILED;
}
- return (ret);
-
+ return ret;
} /* egtpInitReq */
/**************************************************************************
DU_LOG("\nEGTP : Received open server request");
sockType = CM_INET_DGRAM;
- if(ret = (cmInetSocket(sockType, &(egtpCb.recvTptSrvr.sockFd), protType)) != ROK)
+ if((ret = (cmInetSocket(sockType, &(egtpCb.recvTptSrvr.sockFd), protType))) != ROK)
{
DU_LOG("\nEGTP : Failed to open UDP socket");
return RFAILED;
S16 cuEgtpDecodeHdr(Buffer *mBuf)
{
EgtpMsg egtpMsg;
- S16 retVal = ROK; /* Holds the return value */
U8 tmpByte[5]; /* Holds one byte of data after Dec */
U8 version = 0; /* Holds the version type, decoded */
MsgLen msgLen = 0; /* Holds the msgLen from the Hdr */
cnt++;
}
- ODU_PUT_MSG(egtpMsg.msg);
+ ODU_PUT_MSG_BUF(egtpMsg.msg);
return ROK;
}
Buffer *mBuf;
- if(ODU_GET_MSG(CU_APP_MEM_REG, CU_POOL, &mBuf) == ROK)
+ if(ODU_GET_MSG_BUF(CU_APP_MEM_REG, CU_POOL, &mBuf) == ROK)
{
if(ODU_ADD_POST_MSG_MULT((Data *)data, datSize, mBuf) != ROK)
{
DU_LOG("\nEGTP : ODU_ADD_POST_MSG_MULT failed");
- ODU_PUT_MSG(mBuf);
+ ODU_PUT_MSG_BUF(mBuf);
return RFAILED;
}
}
egtpMsg->msgHdr.teId = 10;
egtpMsg->msg = mBuf;
- return ROK;
+ return ret;
}
else if(connUp & (pollParams->port == f1Params.destPort))
{
F1APMsgHdlr(pollParams->mBuf);
- ODU_PUT_MSG(pollParams->mBuf);
+ ODU_PUT_MSG_BUF(pollParams->mBuf);
}
else
{
- ODU_PUT_MSG(pollParams->mBuf);
+ ODU_PUT_MSG_BUF(pollParams->mBuf);
}
}
}
pst.pool= DU_POOL;
- if(ODU_GET_MSG(DFLT_REGION, DU_POOL, &mBuf) != ROK)
+ if(ODU_GET_MSG_BUF(DFLT_REGION, DU_POOL, &mBuf) != ROK)
{
DU_LOG("\nDU_APP : Memory allocation failed in duReadCfg");
return RFAILED;
{
Buffer *mBuf=NULLP;
- if(ODU_GET_MSG(region, pool, &mBuf) == ROK)
+ if(ODU_GET_MSG_BUF(region, pool, &mBuf) == ROK)
{
if(ODU_ADD_POST_MSG_MULT((Data *)encBuf, encBufSize, mBuf) == ROK)
{
if(sctpSend(mBuf, E2_INTERFACE) != ROK)
{
DU_LOG("\nE2AP : SCTP Send for E2 failed");
- ODU_PUT_MSG(mBuf);
+ ODU_PUT_MSG_BUF(mBuf);
return RFAILED;
}
}
else
{
DU_LOG("\nE2AP : ODU_ADD_POST_MSG_MULT failed");
- ODU_PUT_MSG(mBuf);
+ ODU_PUT_MSG_BUF(mBuf);
return RFAILED;
}
- ODU_PUT_MSG(mBuf);
+ ODU_PUT_MSG_BUF(mBuf);
}
else
{
case EVTSLOTIND:
{
ret = unpackEgtpSlotInd(egtpSlotInd, pst, mBuf);
- ODU_PUT_MSG(mBuf);
+ ODU_PUT_MSG_BUF(mBuf);
break;
}
default:
{
DU_LOG("\nEGTP : Invalid event %d", pst->event);
- ODU_PUT_MSG(mBuf);
+ ODU_PUT_MSG_BUF(mBuf);
ret = RFAILED;
}
}
/* Send over UDP */
egtpSendMsg(egtpMsg.msg);
- ODU_PUT_MSG(egtpMsg.msg);
+ ODU_PUT_MSG_BUF(egtpMsg.msg);
return ROK;
}/* EgtpHdlDatInd */
#include "du_mgr.h"
#include "du_f1ap_msg_hdl.h"
+extern DuCfgParams duCfgParam;
+uint8_t ServedCellListreturn=RFAILED;
+
uint8_t procGNBDUCfgUpdAck(F1AP_PDU_t *f1apMsg);
uint8_t procDlRrcMsgTrans(F1AP_PDU_t *f1apMsg);
void FreeDUConfigUpdate(F1AP_PDU_t *f1apDuCfg);
-extern char encBuf[ENC_BUF_MAX_LEN];
-extern DuCfgParams duCfgParam;
-uint8_t BuildULTnlInforet=RFAILED;
-uint8_t ServedCellListreturn=RFAILED;
-uint8_t sctpSend(Buffer *mBuf, U8 itfType);
-uint8_t Nrcgiret=RFAILED;
-uint8_t SplCellListret=RFAILED;
-uint8_t SRBSetupret=RFAILED;
+uint8_t sctpSend(Buffer *mBuf, uint8_t itfType);
uint8_t BuildInitialUlBWP(BWP_UplinkDedicated_t *ulBwp);
+uint8_t procUeContextSetupReq(F1AP_PDU_t *f1apMsg);
/*******************************************************************
*
{
Buffer *mBuf;
- if(ODU_GET_MSG(region, pool, &mBuf) == ROK)
+ if(ODU_GET_MSG_BUF(region, pool, &mBuf) == ROK)
{
if(ODU_ADD_POST_MSG_MULT((Data *)encBuf, encBufSize, mBuf) == ROK)
{
if(sctpSend(mBuf, F1_INTERFACE) != ROK)
{
DU_LOG("\nF1AP : SCTP Send failed");
- ODU_PUT_MSG(mBuf);
+ ODU_PUT_MSG_BUF(mBuf);
return RFAILED;
}
}
else
{
DU_LOG("\nF1AP : ODU_ADD_POST_MSG_MULT failed");
- ODU_PUT_MSG(mBuf);
+ ODU_PUT_MSG_BUF(mBuf);
return RFAILED;
}
- ODU_PUT_MSG(mBuf);
+ ODU_PUT_MSG_BUF(mBuf);
}
else
{
/*******************************************************************
*
- * @brief Builds Special cell list for UE Setup Request
- *
- * @details
- *
- * Function : BuildSplCellList
- *
- * Functionality: Constructs the Special Cell list for UESetReq
- *
- * @params[in] SCell_ToBeSetup_List_t *spCellLst
- *
- * @return ROK - success
- * RFAILED - failure
- *
- * ****************************************************************/
-uint8_t BuildSplCellList(SCell_ToBeSetup_List_t *spCellLst)
-{
- uint8_t cellCnt;
- uint8_t idx;
- uint8_t ret;
- cellCnt = 1;
- spCellLst->list.count = cellCnt;
- spCellLst->list.size = cellCnt * sizeof(SCell_ToBeSetup_ItemIEs_t *);
- DU_ALLOC(spCellLst->list.array,spCellLst->list.size);
- if(spCellLst->list.array == NULLP)
- {
- return RFAILED;
- }
- for(idx=0; idx<cellCnt; idx++)
- {
- DU_ALLOC(spCellLst->list.array[idx],sizeof(SCell_ToBeSetup_ItemIEs_t));
- if(spCellLst->list.array[idx] == NULLP)
- {
- return RFAILED;
- }
- }
- idx = 0;
- spCellLst->list.array[idx]->id = ProtocolIE_ID_id_SCell_ToBeSetup_Item;
- spCellLst->list.array[idx]->criticality = Criticality_ignore;
- spCellLst->list.array[idx]->value.present =\
- SCell_ToBeSetup_ItemIEs__value_PR_SCell_ToBeSetup_Item;
- /* Special Cell ID -NRCGI */
- ret = BuildNrcgi(&spCellLst->list.array[idx]->value.choice.SCell_ToBeSetup_Item.sCell_ID);
- if(ret != ROK)
- {
- return RFAILED;
- }
- /*Special Cell Index*/
- spCellLst->list.array[idx]->value.choice.SCell_ToBeSetup_Item.sCellIndex = 1;
- return ROK;
-}/* End of BuildSplCellList*/
-
-/*******************************************************************
- *
- * @brief Builds SRBS to be setup
- *
- * @details
- *
- * Function : BuildSRBSetup
- *
- * Functionality: Constructs the SRB's for UESetReq
- *
- * @params[in] SRBs_ToBeSetup_List_t *srbSet
- *
- * @return ROK - success
- * RFAILED - failure
- *
- * ****************************************************************/
-uint8_t BuildSRBSetup(SRBs_ToBeSetup_List_t *srbSet)
-{
- uint8_t idx;
- uint8_t srbCnt;
- srbCnt = 1;
- srbSet->list.count = srbCnt;
- srbSet->list.size = srbCnt*sizeof(SRBs_ToBeSetup_ItemIEs_t *);
- DU_ALLOC(srbSet->list.array,srbSet->list.size);
- if(srbSet->list.array == NULLP)
- {
- return RFAILED;
- }
- for(idx=0; idx<srbCnt; idx++)
- {
- DU_ALLOC(srbSet->list.array[idx],sizeof(SRBs_ToBeSetup_ItemIEs_t));
- if(srbSet->list.array[idx] == NULLP)
- {
- return RFAILED;
- }
- }
- idx = 0;
- srbSet->list.array[idx]->id = ProtocolIE_ID_id_SRBs_ToBeSetup_Item;
- srbSet->list.array[idx]->criticality = Criticality_ignore;
- srbSet->list.array[idx]->value.present = \
- SRBs_ToBeSetup_ItemIEs__value_PR_SRBs_ToBeSetup_Item;
- srbSet->list.array[idx]->value.choice.SRBs_ToBeSetup_Item.sRBID = 2;
- return ROK;
-}/* End of BuildSRBSetup*/
-
-/*******************************************************************
- *
- * @brief Builds QOS Info for DRB Setum Item
+ * @brief Free the memory allocated for UE Setup response
*
* @details
*
- * Function : BuildQOSInfo
+ * Function : FreeUeSetupRsp
*
- * Functionality: Constructs the QOS Info for DRB Setup Item
- *
- * @params[in] QoSInformation_t *qosinfo
+ * Functionality:
+ * Free the memory allocated for UE Setup response
*
+ * @params[in] F1AP PDU for UE setup response
* @return ROK - success
* RFAILED - failure
*
* ****************************************************************/
-uint8_t BuildQOSInfo(QoSFlowLevelQoSParameters_t *drbQos)
+void FreeUeSetupRsp(F1AP_PDU_t *f1apMsg)
{
- /* NonDynamic5QIDescriptor */
- drbQos->qoS_Characteristics.present = QoS_Characteristics_PR_non_Dynamic_5QI;
- DU_ALLOC(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI,sizeof(NonDynamic5QIDescriptor_t));
- if(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI == NULLP)
- {
- return RFAILED;
- }
- /*FiveQI*/
- drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->fiveQI = 0;
- /*AveragingWindow*/
- DU_ALLOC(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow,\
- sizeof(AveragingWindow_t));
- if(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow == \
- NULLP)
- {
- return RFAILED;
- }
- *(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow) = 0;
- /*MaxDataBurstVolume*/
- DU_ALLOC(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume,\
- sizeof(MaxDataBurstVolume_t));
- if(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume == \
- NULLP)
- {
- return RFAILED;
- }
- *(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume) = 0;
-
- /*nRGRAN Allocation Retention Priority*/
- drbQos->nGRANallocationRetentionPriority.priorityLevel = \
- PriorityLevel_highest;
- drbQos->nGRANallocationRetentionPriority.pre_emptionCapability = \
- Pre_emptionCapability_may_trigger_pre_emption;
- drbQos->nGRANallocationRetentionPriority.pre_emptionVulnerability = \
- Pre_emptionVulnerability_not_pre_emptable;
+ uint8_t idx;
+ UEContextSetupResponse_t *ueSetRsp;
- /* TO DO: GBR_QoSFlowInformation */
- return ROK;
-}/*End of BuildQOSInfo*/
+ if(f1apMsg)
+ {
+ if(f1apMsg->choice.successfulOutcome)
+ {
+ ueSetRsp = &f1apMsg->choice.successfulOutcome->value.choice.\
+ UEContextSetupResponse;
+ if(ueSetRsp->protocolIEs.list.array)
+ {
+ for(idx = 0; idx < ueSetRsp->protocolIEs.list.size; idx++)
+ {
+ DU_FREE(ueSetRsp->protocolIEs.list.array[idx],\
+ sizeof(UEContextSetupResponseIEs_t));
+ }
+ DU_FREE(ueSetRsp->protocolIEs.list.array, \
+ ueSetRsp->protocolIEs.list.size);
+ }
+ DU_FREE(f1apMsg->choice.successfulOutcome, sizeof(SuccessfulOutcome_t));
+ }
+ DU_FREE(f1apMsg, sizeof(F1AP_PDU_t));
+ }
+}
/*******************************************************************
*
- * @brief Builds SNSSAI
+ * @brief Builds and sends the UE Setup Response
*
* @details
*
- * Function : BuildSNSSAI
+ * Function : BuildAndSendUESetRsp
*
- * Functionality: Constructs the SNSSAI For DRB list
+ * Functionality: Constructs the UE Setup Response and sends
+ * it to the DU through SCTP.
*
- * @params[in] SNSSAI_t *snssai
+ * @params[in]
*
* @return ROK - success
* RFAILED - failure
*
* ****************************************************************/
-uint8_t BuildSNSSAI(SNSSAI_t *snssai)
+uint8_t BuildAndSendUESetRsp()
{
- /*SNSSAI*/
- /*ssT*/
- snssai->sST.size = sizeof(uint8_t);
- DU_ALLOC(snssai->sST.buf,snssai->sST.size);
- if(snssai->sST.buf == NULLP)
- {
- return RFAILED;
- }
- snssai->sST.buf[0] = 3;
- /*sD*/
- DU_ALLOC(snssai->sD,sizeof(OCTET_STRING_t));
- if(snssai->sD == NULLP)
- {
- return RFAILED;
- }
- snssai->sD->size = 3*sizeof(uint8_t);
- DU_ALLOC(snssai->sD->buf,snssai->sD->size);
- if(snssai->sD->buf == NULLP)
- {
- return RFAILED;
- }
- snssai->sD->buf[0] = 3;
- snssai->sD->buf[1] = 6;
- snssai->sD->buf[2] = 9;
- return ROK;
-}/*End of BuildSNSSAI*/
+ uint8_t ret = RFAILED;
+ uint8_t elementCnt;
+ uint8_t idx;
+ F1AP_PDU_t *f1apMsg = NULL;
+ UEContextSetupResponse_t *ueSetRsp;
+ asn_enc_rval_t encRetVal; /* Encoder return value */
-/*******************************************************************
- *
- * @brief Builds the flow map.
- *
- * @details
- *
- * Function : BuildFlowsMap
- *
- * Functionality: Constructs the flowmap For DRB list
- *
- * @params[in] Flows_Mapped_To_DRB_List_t *flowMap
- *
- * @return ROK - success
- * RFAILED - failure
- *
- * ****************************************************************/
-uint8_t BuildFlowsMap(Flows_Mapped_To_DRB_List_t *flowMap)
-{
- uint8_t ret;
- uint8_t idx;
- uint8_t flowCnt;
- flowCnt = 1;
- flowMap->list.count = flowCnt;
- flowMap->list.size = flowCnt * sizeof(Flows_Mapped_To_DRB_Item_t *);
- DU_ALLOC(flowMap->list.array,flowMap->list.size);
- if(flowMap->list.array == NULLP)
- {
- return RFAILED;
- }
- for(idx=0; idx<flowCnt; idx++)
- {
- DU_ALLOC(flowMap->list.array[idx],sizeof(Flows_Mapped_To_DRB_Item_t));
- if(flowMap->list.array[idx] == NULLP)
- {
- return RFAILED;
- }
- }
- idx = 0;
- flowMap->list.array[idx]->qoSFlowIdentifier = 0;
- ret = BuildQOSInfo(&flowMap->list.array[idx]->qoSFlowLevelQoSParameters);
- if(ret != ROK)
- {
- return RFAILED;
- }
- return ROK;
-}/*End of BuildFlowsMap*/
+ DU_LOG("\n F1AP : Building UE Context Setup Response\n");
-/*******************************************************************
- *
- * @brief Builds the Uplink Tunnel Info
- *
- * @details
- *
- * Function : BuildULTnlInfo
- *
- * Functionality: Constructs the UL TnlInfo For DRB list
- *
- * @params[in] ULUPTNLInformation_ToBeSetup_List_t *ulInfo
- *
- * @return ROK - success
- * RFAILED - failure
- *
- * ****************************************************************/
-uint8_t BuildULTnlInfo(ULUPTNLInformation_ToBeSetup_List_t *ulInfo)
-{
- uint8_t idx;
- uint8_t ulCnt;
- ulCnt = 1;
- ulInfo->list.count = ulCnt;
- ulInfo->list.size = ulCnt * sizeof(ULUPTNLInformation_ToBeSetup_Item_t *);
- DU_ALLOC(ulInfo->list.array,ulInfo->list.size);
- if(ulInfo->list.array == NULLP)
- {
- return RFAILED;
- }
- for(idx=0; idx<ulCnt; idx++)
- {
- DU_ALLOC(ulInfo->list.array[idx],sizeof(ULUPTNLInformation_ToBeSetup_Item_t));
- if(ulInfo->list.array[idx] == NULLP)
- {
- return RFAILED;
- }
- }
- idx = 0;
- ulInfo->list.array[idx]->uLUPTNLInformation.present = \
- UPTransportLayerInformation_PR_gTPTunnel;
- /*GTP TUNNEL*/
- DU_ALLOC(ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel,\
- sizeof(GTPTunnel_t));
- if(ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel == NULLP)
- {
- return RFAILED;
- }
- ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->\
- transportLayerAddress.size = 4*sizeof(uint8_t);
- DU_ALLOC(ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->\
- transportLayerAddress.buf,ulInfo->list.array[idx]->\
- uLUPTNLInformation.choice.gTPTunnel->transportLayerAddress.size);
- if(ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->\
- transportLayerAddress.buf == NULLP)
- {
- return RFAILED;
- }
- ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->\
- transportLayerAddress.buf[0] = 4;
- ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->\
- transportLayerAddress.buf[1] = 4;
- ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->\
- transportLayerAddress.buf[2] = 4;
- ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->\
- transportLayerAddress.buf[3] = 5;
- ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->\
- transportLayerAddress.bits_unused = 0;
- /*GTP TEID*/
- ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->gTP_TEID.size\
- = 4 * sizeof(uint8_t);
- DU_ALLOC(ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->\
- gTP_TEID.buf,ulInfo->list.array[idx]->uLUPTNLInformation.choice.\
- gTPTunnel->gTP_TEID.size);
- if(ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->gTP_TEID.buf\
- == NULLP)
- {
- return RFAILED;
- }
- ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->\
- gTP_TEID.buf[0] = 11;
- ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->\
- gTP_TEID.buf[1] = 0;
- ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->\
- gTP_TEID.buf[2] = 0;
- ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->\
- gTP_TEID.buf[3] = 1;
+ while(true)
+ {
+ DU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t));
+ if(f1apMsg == NULLP)
+ {
+ DU_LOG(" F1AP : Memory allocation for F1AP-PDU failed");
+ break;
+ }
- return ROK;
-}/*End of BuildULTnlInfo*/
+ f1apMsg->present = F1AP_PDU_PR_successfulOutcome;
+ DU_ALLOC(f1apMsg->choice.successfulOutcome,
+ sizeof(SuccessfulOutcome_t));
+ if(f1apMsg->choice.successfulOutcome == NULLP)
+ {
+ DU_LOG(" F1AP : Memory allocation for F1AP-PDU failed");
+ break;
+ }
-/*******************************************************************
- *
- * @brief Builds DRBS to be setup
- *
- * @details
- *
- * Function : BuildDRBSetup
- *
- * Functionality: Constructs the DRB's for UESetReq
- *
- * @params[in] DRBs_ToBeSetup_List_t *drbSet
- *
- * @return ROK - success
- * RFAILED - failure
- *
- * ****************************************************************/
-uint8_t BuildDRBSetup(DRBs_ToBeSetup_List_t *drbSet)
-{
- uint8_t BuildQOSInforet;
- uint8_t BuildSNSSAIret;
- uint8_t BuildFlowsMapret;
- uint8_t idx;
- uint8_t drbCnt;
- DRBs_ToBeSetup_Item_t *drbSetItem;
- drbCnt = 1;
- drbSet->list.count = drbCnt;
- drbSet->list.size = drbCnt*sizeof(DRBs_ToBeSetup_ItemIEs_t *);
- DU_ALLOC(drbSet->list.array,drbSet->list.size);
- if(drbSet->list.array == NULLP)
- {
- return RFAILED;
- }
- for(idx=0; idx<drbCnt; idx++)
- {
- DU_ALLOC(drbSet->list.array[idx],sizeof(DRBs_ToBeSetup_ItemIEs_t));
- if(drbSet->list.array[idx] == NULLP)
- {
- return RFAILED;
- }
- }
- idx = 0;
- drbSet->list.array[idx]->id = ProtocolIE_ID_id_DRBs_ToBeSetup_Item;
- drbSet->list.array[idx]->criticality = Criticality_ignore;
- drbSet->list.array[idx]->value.present = \
- DRBs_ToBeSetup_ItemIEs__value_PR_DRBs_ToBeSetup_Item;
- drbSetItem = &drbSet->list.array[idx]->value.choice.DRBs_ToBeSetup_Item;
- /*dRBID*/
- drbSetItem->dRBID = 1;
- /*qoSInformation*/
- drbSetItem->qoSInformation.present = QoSInformation_PR_choice_extension;
- DU_ALLOC(drbSetItem->qoSInformation.choice.choice_extension,sizeof(QoSInformation_ExtIEs_t));
- if(drbSetItem->qoSInformation.choice.choice_extension == NULLP)
- {
- return RFAILED;
- }
- drbSetItem->qoSInformation.choice.choice_extension->id = \
- ProtocolIE_ID_id_DRB_Information;
- drbSetItem->qoSInformation.choice.choice_extension->criticality = \
- Criticality_ignore;
- drbSetItem->qoSInformation.choice.choice_extension->value.present = \
- QoSInformation_ExtIEs__value_PR_DRB_Information;
- BuildQOSInforet = BuildQOSInfo(&drbSetItem->qoSInformation.choice.\
- choice_extension->value.choice.DRB_Information.dRB_QoS);
- if(BuildQOSInforet != ROK)
- {
- return RFAILED;
- }
- /*SNSSAI*/
- BuildSNSSAIret = BuildSNSSAI(&drbSetItem->qoSInformation.choice.\
- choice_extension->value.choice.DRB_Information.sNSSAI);
- if(BuildSNSSAIret != ROK)
- {
- return RFAILED;
- }
- /*Flows mapped to DRB List*/
- BuildFlowsMapret = BuildFlowsMap(&drbSetItem->qoSInformation.choice.\
- choice_extension->value.choice.DRB_Information.flows_Mapped_To_DRB_List);
- if(BuildFlowsMapret != ROK)
- {
- return RFAILED;
- }
- /*ULUPTNLInformation To Be Setup List*/
- BuildULTnlInforet = BuildULTnlInfo(&drbSetItem->uLUPTNLInformation_ToBeSetup_List);
- if(BuildULTnlInforet != ROK)
- {
- return RFAILED;
- }
- /*RLCMode*/
- drbSetItem->rLCMode = RLCMode_rlc_um_bidirectional;
+ f1apMsg->choice.successfulOutcome->procedureCode = \
+ ProcedureCode_id_UEContextSetup;
+ f1apMsg->choice.successfulOutcome->criticality = Criticality_reject;
+ f1apMsg->choice.successfulOutcome->value.present = \
+ SuccessfulOutcome__value_PR_UEContextSetupResponse;
+
+ ueSetRsp =
+ &f1apMsg->choice.successfulOutcome->value.choice.UEContextSetupResponse;
+ elementCnt = 2;
+ ueSetRsp->protocolIEs.list.count = elementCnt;
+ ueSetRsp->protocolIEs.list.size = \
+ elementCnt * sizeof(UEContextSetupResponse_t *);
+
+ /* Initialize the UESetup members */
+ DU_ALLOC(ueSetRsp->protocolIEs.list.array, \
+ ueSetRsp->protocolIEs.list.size);
+ if(ueSetRsp->protocolIEs.list.array == NULLP)
+ {
+ DU_LOG(" F1AP : Memory allocation for UE Setup Response failed");
+ break;
+ }
- /*UL Configuration*/
- DU_ALLOC(drbSetItem->uLConfiguration,sizeof(ULConfiguration_t));
- if(drbSetItem->uLConfiguration == NULLP)
- {
- return RFAILED;
- }
- drbSetItem->uLConfiguration->uLUEConfiguration = ULUEConfiguration_no_data;
- return ROK;
-}/* End of BuildDRBSetup*/
-/*******************************************************************
-*
-* @brief Deallocating memory of function BuildAndSendUESetReq
-*
-* @details
-*
-* Function : FreeNrcgi
-*
-* Functionality: Deallocating memory for function BuildNrcgi
-*
-* @params[in] NRCGI_t *nrcgi
-*
-* @return void
-*
-*******************************************************************/
-void FreeNrcgi(NRCGI_t *nrcgi)
-{
- if(nrcgi->pLMN_Identity.buf != NULLP)
- {
- if(nrcgi->nRCellIdentity.buf != NULLP)
- {
- DU_FREE(nrcgi->nRCellIdentity.buf, nrcgi->nRCellIdentity.size);
- }
- DU_FREE(nrcgi->pLMN_Identity.buf, nrcgi->pLMN_Identity.size);
- }
-}
-/*******************************************************************
-*
-* @brief Deallocating memory of function BuildAndSendUESetReq
-*
-* @details
-*
-* Function : FreeSplCellList
-*
-* Functionality: Deallocating memory for function BuildSplCellList
-*
-* @params[in] SCell_ToBeSetup_List_t *spCellLst
-*
-* @return void
-*
-*
-* *****************************************************************/
-void FreeSplCellList(SCell_ToBeSetup_List_t *spCellLst)
-{
- uint8_t cellidx;
- if(spCellLst->list.array != NULLP)
- {
- for(cellidx=0; cellidx<spCellLst->list.count; cellidx++)
- {
- if(cellidx==0&&spCellLst->list.array[cellidx]!=NULLP)
- {
- FreeNrcgi(&spCellLst->list.array[cellidx]->value.choice.SCell_ToBeSetup_Item.sCell_ID);
- }
- if(spCellLst->list.array[cellidx]!=NULLP)
- {
- DU_FREE(spCellLst->list.array[cellidx],sizeof(SCell_ToBeSetup_ItemIEs_t));
- }
- }
- DU_FREE(spCellLst->list.array,spCellLst->list.size);
- }
-}
- /*******************************************************************
- *
- * @brief Deallocating memory of function BuildAndSendUESetReq
- *
- * @details
- *
- * Function : FreeSRBSetup
- *
- * Functionality: Deallocating memory for function BuildSRBSetup
- *
- * @params[in] SRBs_ToBeSetup_List_t *srbSet
- *
- * @return void
- *
- *
- * ******************************************************************/
-void FreeSRBSetup(SRBs_ToBeSetup_List_t *srbSet)
-{
- uint8_t srbidx;
- if(srbSet->list.array != NULLP)
- {
- for(srbidx=0; srbidx<srbSet->list.count; srbidx++)
- {
- if(srbSet->list.array[srbidx]!=NULLP)
- {
- DU_FREE(srbSet->list.array[srbidx],sizeof(SRBs_ToBeSetup_ItemIEs_t));
- }
- }
- DU_FREE(srbSet->list.array,srbSet->list.size);
- }
-}
- /*******************************************************************
- *
- * @brief Deallocating memory of function BuildAndSendUESetReq
- *
- * @details
- *
- * Function : FreeQOSInfo
- *
- * Functionality: Deallocating memory for function BuildQOSInfo
- *
- * @params[in] QoSFlowLevelQoSParameters_t *drbQos
- *
- * @return void
- *
- * ****************************************************************/
-void FreeQOSInfo(QoSFlowLevelQoSParameters_t *drbQos)
-{
- if(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI != NULLP)
- {
- if(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow!=NULLP)
- {
- if(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume!=NULLP)
- {
- DU_FREE(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume,\
- sizeof(MaxDataBurstVolume_t));
- }
- DU_FREE(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow,\
- sizeof(AveragingWindow_t));
- }
- DU_FREE(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI,\
- sizeof(NonDynamic5QIDescriptor_t));
- }
-}
- /*******************************************************************
- *
- * @brief Deallocating memory of function BuildAndSendUESetReq
- *
- * @details
- *
- * Function : FreeULTnlInfo
- *
- * Functionality: Deallocating memory for function BuildULTnlInfo
- *
- * @params[in] ULUPTNLInformation_ToBeSetup_List_t *ulInfo
- *
- * @return void
- *
-
- * ****************************************************************/
-void FreeULTnlInfo(ULUPTNLInformation_ToBeSetup_List_t *ulInfo)
-{
- uint8_t ulidx=0;
- if(ulInfo->list.array != NULLP)
- {
- for(ulidx=0; ulidx<ulInfo->list.count; ulidx++)
- {
- if(ulidx==0&&ulInfo->list.array[ulidx]!=NULLP)
- {
- if(ulInfo->list.array[ulidx]->uLUPTNLInformation.choice.gTPTunnel!=NULLP)
- {
- if(ulInfo->list.array[ulidx]->uLUPTNLInformation.choice.gTPTunnel->\
- transportLayerAddress.buf != NULLP)
- {
- if(ulInfo->list.array[ulidx]->uLUPTNLInformation.choice.gTPTunnel->gTP_TEID.buf\
- !=NULLP)
- {
- DU_ALLOC(ulInfo->list.array[ulidx]->uLUPTNLInformation.choice.gTPTunnel->\
- gTP_TEID.buf,ulInfo->list.array[ulidx]->uLUPTNLInformation.choice.\
- gTPTunnel->gTP_TEID.size);
- }
- DU_FREE(ulInfo->list.array[ulidx]->uLUPTNLInformation.choice.gTPTunnel->\
- transportLayerAddress.buf,ulInfo->list.array[ulidx]->\
- uLUPTNLInformation.choice.gTPTunnel->transportLayerAddress.size);
- }
- DU_FREE(ulInfo->list.array[ulidx]->uLUPTNLInformation.choice.gTPTunnel,\
- sizeof(GTPTunnel_t));
- }
- }
- if(ulInfo->list.array[ulidx]!=NULLP)
- {
- DU_FREE(ulInfo->list.array[ulidx],sizeof(ULUPTNLInformation_ToBeSetup_Item_t));
- }
- }
- DU_FREE(ulInfo->list.array,ulInfo->list.size);
- }
-}
-/*******************************************************************
- *
- * @brief Deallocating memory for BuildAndSendUESetReq
- *
- * @details
- *
- * Function : FreeDRBSetup
- *
- * Functionality: Deallocating memory for BuildDRBSetup
- *
- * @params[in] DRBs_ToBeSetup_List_t *drbSet
- *
- * @return void
- *
- * ****************************************************************/
-void FreeDRBSetup(DRBs_ToBeSetup_List_t *drbSet)
-{
- DRBs_ToBeSetup_Item_t *drbSetItem;
- uint8_t flowidx;
- uint8_t drbidx;
- if(drbSet->list.array == NULLP)
+ for(idx=0; idx<elementCnt; idx++)
+ {
+ DU_ALLOC(ueSetRsp->protocolIEs.list.array[idx],\
+ sizeof(UEContextSetupResponseIEs_t));
+ if(ueSetRsp->protocolIEs.list.array[idx] == NULLP)
{
- for(drbidx=0; drbidx<drbSet->list.count; drbidx++)
- {
- if(drbidx==0&&drbSet->list.array[drbidx] != NULLP)
- {
- drbSetItem =&drbSet->list.array[drbidx]->value.choice.DRBs_ToBeSetup_Item;
- if(drbSetItem->qoSInformation.choice.choice_extension != NULLP)
- {
- if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\
- qoS_Characteristics.choice.non_Dynamic_5QI !=NULLP)
- {
- if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\
- qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow!=NULLP)
- {
- if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\
- qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume!=NULLP)
- {
- if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sST.buf!=NULLP)
- {
- if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sD!=NULLP)
- {
- if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sD->buf!=NULLP)
- {
- if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.\
- flows_Mapped_To_DRB_List.list.array != NULLP)
- {
- for(flowidx=0;flowidx<drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.\
- flows_Mapped_To_DRB_List.list.count; flowidx++)
- {
- if(flowidx==0&&drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
- DRB_Information.flows_Mapped_To_DRB_List.list.array[flowidx]!=NULLP)
- {
- if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
- DRB_Information.flows_Mapped_To_DRB_List.list.array[flowidx]->qoSFlowLevelQoSParameters.\
- qoS_Characteristics.choice.non_Dynamic_5QI!=NULLP)
- {
- if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
- DRB_Information.flows_Mapped_To_DRB_List.list.array[flowidx]->qoSFlowLevelQoSParameters.\
- qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow!=NULLP)
- {
- if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
- DRB_Information.flows_Mapped_To_DRB_List.list.array[flowidx]->qoSFlowLevelQoSParameters.\
- qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume!=NULLP)
- {
- if((BuildULTnlInforet==ROK)&&(drbSetItem->uLConfiguration!=NULLP))
- {
- DU_FREE(drbSetItem->uLConfiguration,sizeof(ULConfiguration_t));
- }
- FreeULTnlInfo(&drbSetItem->uLUPTNLInformation_ToBeSetup_List);
- DU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
- DRB_Information.flows_Mapped_To_DRB_List.list.array[flowidx]->qoSFlowLevelQoSParameters.\
- qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume,\
- sizeof(MaxDataBurstVolume_t));
- }
- DU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
- DRB_Information.flows_Mapped_To_DRB_List.list.array[flowidx]->qoSFlowLevelQoSParameters.\
- qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow,sizeof(AveragingWindow_t));
- }
- DU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
- DRB_Information.flows_Mapped_To_DRB_List.list.array[flowidx]->qoSFlowLevelQoSParameters.\
- qoS_Characteristics.choice.non_Dynamic_5QI,sizeof(NonDynamic5QIDescriptor_t));
- }
- }
- if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
- DRB_Information.flows_Mapped_To_DRB_List.list.array[flowidx]!=NULLP)
- {
- DU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
- DRB_Information.flows_Mapped_To_DRB_List.list.array[flowidx],sizeof(Flows_Mapped_To_DRB_Item_t));
- }
- }
- DU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.\
- flows_Mapped_To_DRB_List.list.array,drbSetItem->qoSInformation.choice.choice_extension->value.\
- choice.DRB_Information.flows_Mapped_To_DRB_List.list.size);
- }
- DU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sD->buf,\
- drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sD->size);
- }
- DU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sD,\
- sizeof(OCTET_STRING_t));
- }
- DU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sST.buf,\
- drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sST.size);
- }
- DU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\
- qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume,sizeof(MaxDataBurstVolume_t));
- }
- DU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\
- qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow,sizeof(AveragingWindow_t));
- }
- DU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\
- qoS_Characteristics.choice.non_Dynamic_5QI, sizeof(NonDynamic5QIDescriptor_t));
- }
- DU_FREE(drbSetItem->qoSInformation.choice.choice_extension,sizeof(QoSInformation_ExtIEs_t));
- }
- }
- if(drbSet->list.array[drbidx]!=NULLP)
- {
- DU_FREE(drbSet->list.array[drbidx],sizeof(DRBs_ToBeSetup_ItemIEs_t));
- }
- }
- DU_FREE(drbSet->list.array,drbSet->list.size);
+ DU_LOG(" F1AP : Memory allocation for UE Setup Response failed");
+ break;
}
-}
-/*******************************************************************
- *
- * @brief Free the UE Setup Request
- *
- * @details
- *
- * Function : FreeUESetReq
- *
- * Functionality: Deallocate the memory of BuildUESetReq
- *
- * @params[in] F1AP_PDU_t *f1apMsg
- *
- * @return void
- *
- *
- * ****************************************************************/
- void FreeUESetReq(F1AP_PDU_t *f1apMsg)
-{
- uint8_t idx=2;
- uint8_t ieId;
- UEContextSetupRequest_t *ueSetReq;
-
- if(f1apMsg != NULLP)
- {
- if(f1apMsg->choice.initiatingMessage != NULLP)
- {
- ueSetReq = &f1apMsg->choice.initiatingMessage->value.choice.UEContextSetupRequest;
- if(ueSetReq->protocolIEs.list.array != NULLP)
- {
- if(ueSetReq->protocolIEs.list.array[idx])
- {
- if(Nrcgiret==ROK )
- {
- idx=6;
- if(ueSetReq->protocolIEs.list.array[idx])
- {
- if(SplCellListret==ROK)
- {
- idx++;
- if(ueSetReq->protocolIEs.list.array[idx])
- {
- if(SRBSetupret == ROK)
- {
- idx=8;
- FreeDRBSetup(&ueSetReq->protocolIEs.list.array[idx]->value.choice.DRBs_ToBeSetup_List);
- }
- idx--;
- FreeSRBSetup(&ueSetReq->protocolIEs.list.array[idx]->value.choice.SRBs_ToBeSetup_List);
- }
- }
- idx--;
- FreeSplCellList(&ueSetReq->protocolIEs.list.array[idx]->value.choice.SCell_ToBeSetup_List);
- }
- }
- idx=2;
- FreeNrcgi(&ueSetReq->protocolIEs.list.array[idx]->value.choice.NRCGI);
- }
- for(ieId=0; ieId<ueSetReq->protocolIEs.list.count; ieId++)
- {
- if(ueSetReq->protocolIEs.list.array[ieId] != NULLP)
- {
- DU_FREE(ueSetReq->protocolIEs.list.array[ieId],sizeof(UEContextSetupRequestIEs_t));
- }
- }
- DU_FREE(ueSetReq->protocolIEs.list.array,ueSetReq->protocolIEs.list.size);
- }
- DU_FREE(f1apMsg->choice.initiatingMessage,sizeof(InitiatingMessage_t));
- }
- DU_FREE(f1apMsg, sizeof(F1AP_PDU_t));
- }
- }
-
-/*******************************************************************
- *
- * @brief Builds and sends the UE Setup Request
- *
- * @details
- *
- * Function : BuildAndSendUESetReq
- *
- * Functionality: Constructs the UE Setup Request and sends
- * it to the CU through SCTP.
- *
- * @params[in]
- *
- * @return ROK - success
- * RFAILED - failure
- *
- * ****************************************************************/
-uint8_t BuildAndSendUESetReq()
-{
-
- uint8_t elementCnt;
- uint8_t idx;
- uint8_t idx1;
- F1AP_PDU_t *f1apMsg = NULL;
- UEContextSetupRequest_t *ueSetReq;
- asn_enc_rval_t encRetVal; /* Encoder return value */
- uint8_t ret= RFAILED;
- uint8_t ret1;
- while(true)
- {
- DU_LOG("\n F1AP : Building UE Context Setup Request\n");
-
- DU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t));
- if(f1apMsg == NULLP)
- {
- DU_LOG(" F1AP : Memory allocation for F1AP-PDU failed");
- break;
- }
-
- f1apMsg->present = F1AP_PDU_PR_initiatingMessage;
- DU_ALLOC(f1apMsg->choice.initiatingMessage,sizeof(InitiatingMessage_t));
- if(f1apMsg->choice.initiatingMessage == NULLP)
- {
- DU_LOG(" F1AP : Memory allocation for F1AP-PDU failed");
- break;
- }
+ }
- f1apMsg->choice.initiatingMessage->procedureCode = \
- ProcedureCode_id_UEContextSetup;
- f1apMsg->choice.initiatingMessage->criticality = Criticality_reject;
- f1apMsg->choice.initiatingMessage->value.present = \
- InitiatingMessage__value_PR_UEContextSetupRequest;
- ueSetReq =
- &f1apMsg->choice.initiatingMessage->value.choice.UEContextSetupRequest;
- elementCnt = 9;
- ueSetReq->protocolIEs.list.count = elementCnt;
- ueSetReq->protocolIEs.list.size = \
- elementCnt * sizeof(UEContextSetupRequestIEs_t *);
-
- /* Initialize the UESetup members */
- DU_ALLOC(ueSetReq->protocolIEs.list.array,ueSetReq->protocolIEs.list.size);
-
- if(ueSetReq->protocolIEs.list.array == NULLP)
- {
- DU_LOG(" F1AP : Memory allocation for UE Context SetupRequest failed");
- break;
- }
+ idx = 0;
- for(idx1=0; idx1<elementCnt; idx1++)
- {
- DU_ALLOC(ueSetReq->protocolIEs.list.array[idx1],sizeof(UEContextSetupRequestIEs_t));
- if(ueSetReq->protocolIEs.list.array[idx1] == NULLP)
- {
- break;
- }
- }
+ /*GNB CU UE F1AP ID*/
+ ueSetRsp->protocolIEs.list.array[idx]->id = \
+ ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID;
+ ueSetRsp->protocolIEs.list.array[idx]->criticality = Criticality_reject;
+ ueSetRsp->protocolIEs.list.array[idx]->value.present = \
+ UEContextSetupResponseIEs__value_PR_GNB_CU_UE_F1AP_ID;
+ ueSetRsp->protocolIEs.list.array[idx]->value.choice.GNB_CU_UE_F1AP_ID = CU_ID;
- idx = 0;
-
- /*GNB CU UE F1AP ID*/
- ueSetReq->protocolIEs.list.array[idx]->id = \
- ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID;
- ueSetReq->protocolIEs.list.array[idx]->criticality = Criticality_reject;
- ueSetReq->protocolIEs.list.array[idx]->value.present = \
- UEContextSetupRequestIEs__value_PR_GNB_CU_UE_F1AP_ID;
- ueSetReq->protocolIEs.list.array[idx]->value.choice.GNB_CU_UE_F1AP_ID = CU_ID;
-
- /*GNB DU UE F1AP ID*/
- idx++;
- ueSetReq->protocolIEs.list.array[idx]->id = \
- ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID;
- ueSetReq->protocolIEs.list.array[idx]->criticality = Criticality_ignore;
- ueSetReq->protocolIEs.list.array[idx]->value.present = \
- UEContextSetupRequestIEs__value_PR_GNB_DU_UE_F1AP_ID;
- ueSetReq->protocolIEs.list.array[idx]->value.choice.GNB_DU_UE_F1AP_ID = DU_ID;
-
- /*Special Cell ID*/
- idx++;
- ueSetReq->protocolIEs.list.array[idx]->id = \
- ProtocolIE_ID_id_SpCell_ID;
- ueSetReq->protocolIEs.list.array[idx]->criticality = Criticality_reject;
- ueSetReq->protocolIEs.list.array[idx]->value.present = \
- UEContextSetupRequestIEs__value_PR_NRCGI;
- Nrcgiret = BuildNrcgi(&ueSetReq->protocolIEs.list.array[idx]->value.choice.NRCGI);
- if(Nrcgiret != ROK)
- {
- break;
- }
+ /*GNB DU UE F1AP ID*/
+ idx++;
+ ueSetRsp->protocolIEs.list.array[idx]->id = \
+ ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID;
+ ueSetRsp->protocolIEs.list.array[idx]->criticality = Criticality_reject;
+ ueSetRsp->protocolIEs.list.array[idx]->value.present = \
+ UEContextSetupResponseIEs__value_PR_GNB_DU_UE_F1AP_ID;
+ ueSetRsp->protocolIEs.list.array[idx]->value.choice.GNB_DU_UE_F1AP_ID = DU_ID;
- /*Served Cell Index*/
- idx++;
- ueSetReq->protocolIEs.list.array[idx]->id = \
- ProtocolIE_ID_id_ServCellIndex;
- ueSetReq->protocolIEs.list.array[idx]->criticality = Criticality_reject;
- ueSetReq->protocolIEs.list.array[idx]->value.present = \
- UEContextSetupRequestIEs__value_PR_ServCellIndex;
- ueSetReq->protocolIEs.list.array[idx]->value.choice.ServCellIndex = \
- CELL_INDEX;
-
- /*CellULConfigured*/
- idx++;
- ueSetReq->protocolIEs.list.array[idx]->id = \
- ProtocolIE_ID_id_SpCellULConfigured;
- ueSetReq->protocolIEs.list.array[idx]->criticality = Criticality_ignore;
- ueSetReq->protocolIEs.list.array[idx]->value.present = \
- UEContextSetupRequestIEs__value_PR_CellULConfigured;
- ueSetReq->protocolIEs.list.array[idx]->value.choice.CellULConfigured = \
- CellULConfigured_none;
-
-
- /*CUtoDURRCContainer*/
- idx++;
- ueSetReq->protocolIEs.list.array[idx]->id = \
- ProtocolIE_ID_id_CUtoDURRCInformation;
- ueSetReq->protocolIEs.list.array[idx]->criticality = Criticality_reject;
- ueSetReq->protocolIEs.list.array[idx]->value.present = \
- UEContextSetupRequestIEs__value_PR_CUtoDURRCInformation;
-
- /*Special Cells to be SetupList*/
- idx++;
- ueSetReq->protocolIEs.list.array[idx]->id = \
- ProtocolIE_ID_id_SCell_ToBeSetup_List;
- ueSetReq->protocolIEs.list.array[idx]->criticality = Criticality_ignore;
- ueSetReq->protocolIEs.list.array[idx]->value.present = \
- UEContextSetupRequestIEs__value_PR_SCell_ToBeSetup_List;
- SplCellListret = BuildSplCellList(&ueSetReq->protocolIEs.list.array[idx]->value.choice.SCell_ToBeSetup_List);
- if(SplCellListret != ROK)
- {
- break;
- }
- /*SRBs To Be Setup List*/
- idx++;
- ueSetReq->protocolIEs.list.array[idx]->id = \
- ProtocolIE_ID_id_SRBs_ToBeSetup_List;
- ueSetReq->protocolIEs.list.array[idx]->criticality = Criticality_reject;
- ueSetReq->protocolIEs.list.array[idx]->value.present = \
- UEContextSetupRequestIEs__value_PR_SRBs_ToBeSetup_List;
- SRBSetupret = BuildSRBSetup(&ueSetReq->protocolIEs.list.array[idx]->value.choice.SRBs_ToBeSetup_List);
- if(SRBSetupret != ROK)
- {
- break;
- }
- /*DRBs to Be Setup List*/
- idx++;
- ueSetReq->protocolIEs.list.array[idx]->id = \
- ProtocolIE_ID_id_DRBs_ToBeSetup_List;
- ueSetReq->protocolIEs.list.array[idx]->criticality = Criticality_reject;
- ueSetReq->protocolIEs.list.array[idx]->value.present = \
- UEContextSetupRequestIEs__value_PR_DRBs_ToBeSetup_List;
- ret1 = BuildDRBSetup(&ueSetReq->protocolIEs.list.array[idx]->value.choice.DRBs_ToBeSetup_List);
- if(ret1 != ROK)
- {
- break;
- }
- xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg);
+ xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg);
- /* Encode the F1SetupRequest type as APER */
- memset((uint8_t *)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 UE Context Setup Request structure (at %s)\n",\
- encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
- break;
- }
- else
- {
- DU_LOG("\n F1AP : Created APER encoded buffer for UE Context Setup Request\n");
- for(int i=0; i< encBufSize; i++)
- {
- printf("%x",encBuf[i]);
- }
- }
+ /* Encode the UE context setup response type as APER */
+ memset((uint8_t *)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 UE Context Setup Request structure (at %s)\n",\
+ encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
+ break;
+ }
+ else
+ {
+ DU_LOG("\n F1AP : Created APER encoded buffer for UE Context Setup Request\n");
+ for(int i=0; i< encBufSize; i++)
+ {
+ printf("%x",encBuf[i]);
+ }
+ }
- /* Sending msg */
- if(SendF1APMsg(DU_APP_MEM_REGION,DU_POOL) != ROK)
- {
- DU_LOG("\n F1AP : Sending UE Context Setup Request Failed");
- break;
- }
- ret = ROK;
- break;
+ /* Sending msg */
+ if(SendF1APMsg(DU_APP_MEM_REGION,DU_POOL) != ROK)
+ {
+ DU_LOG("\n F1AP : Sending UE Context Setup Request Failed");
+ break;
+ }
+ ret = ROK;
+ break;
}
- FreeUESetReq(f1apMsg);
- return ret;
-}/* End of BuildAndSendUESetReq*/
+ FreeUeSetupRsp(f1apMsg);
+ return ret;;
+}/* End of BuildAndSendUESetRsp */
+
/*******************************************************************
*
F1AP_PDU_t *f1apMsg;
asn_dec_rval_t rval; /* Decoder return value */
F1AP_PDU_t f1apasnmsg ;
-
+
DU_LOG("\nF1AP : Received F1AP message buffer");
ODU_PRINT_MSG(mBuf, 0,0);
printf("\nF1AP : Received flat buffer to be decoded : ");
for(i=0; i< recvBufLen; i++)
{
- printf("%x",recvBuf[i]);
+ printf("%x",recvBuf[i]);
}
/* Decoding flat buffer into F1AP messsage */
f1apMsg = &f1apasnmsg;
memset(f1apMsg, 0, sizeof(F1AP_PDU_t));
-
+
rval = aper_decode(0, &asn_DEF_F1AP_PDU, (void **)&f1apMsg, recvBuf, recvBufLen, 0, 0);
DU_FREE(recvBuf, (Size)recvBufLen);
switch(f1apMsg->present)
{
case F1AP_PDU_PR_successfulOutcome:
- {
- switch(f1apMsg->choice.successfulOutcome->value.present)
- {
- case SuccessfulOutcome__value_PR_F1SetupResponse:
- {
+ {
+ switch(f1apMsg->choice.successfulOutcome->value.present)
+ {
+ case SuccessfulOutcome__value_PR_F1SetupResponse:
+ {
#ifndef ODU_TEST_STUB
- procF1SetupRsp(f1apMsg);
+ procF1SetupRsp(f1apMsg);
#endif
- break;
- }
-
- case SuccessfulOutcome__value_PR_GNBDUConfigurationUpdateAcknowledge:
- {
- procGNBDUCfgUpdAck(f1apMsg);
- break;
- }
+ break;
+ }
- default:
- {
- DU_LOG("\nF1AP : Invalid type of successful outcome [%d]", f1apMsg->choice.successfulOutcome->value.present);
- return;
- }
- }/* End of switch(successfulOutcome) */
- break;
- }
- case F1AP_PDU_PR_initiatingMessage:
- {
- switch(f1apMsg->choice.initiatingMessage->value.present)
- {
- case InitiatingMessage__value_PR_DLRRCMessageTransfer:
- {
- procDlRrcMsgTrans(f1apMsg);
- break;
- }
+ case SuccessfulOutcome__value_PR_GNBDUConfigurationUpdateAcknowledge:
+ {
+ procGNBDUCfgUpdAck(f1apMsg);
+ break;
+ }
- default:
- {
- DU_LOG("\nF1AP : Invalid type of initiating message[%d]",
- f1apMsg->choice.initiatingMessage->value.present);
- return;
- }
- }/* End of switch(initiatingMessage) */
- break;
- }
+ default:
+ {
+ DU_LOG("\nF1AP : Invalid type of successful outcome [%d]", f1apMsg->choice.successfulOutcome->value.present);
+ return;
+ }
+ }/* End of switch(successfulOutcome) */
+ break;
+ }
+ case F1AP_PDU_PR_initiatingMessage:
+ {
+ switch(f1apMsg->choice.initiatingMessage->value.present)
+ {
+ case InitiatingMessage__value_PR_DLRRCMessageTransfer:
+ {
+ procDlRrcMsgTrans(f1apMsg);
+ break;
+ }
+ case InitiatingMessage__value_PR_UEContextSetupRequest:
+ {
+ procUeContextSetupReq(f1apMsg);
+ break;
+ }
+
+ default:
+ {
+ DU_LOG("\nF1AP : Invalid type of initiating message[%d]",
+ f1apMsg->choice.initiatingMessage->value.present);
+ return;
+ }
+ }/* End of switch(initiatingMessage) */
+ break;
+ }
default:
- {
- DU_LOG("\nF1AP : Invalid type of f1apMsg->present [%d]",f1apMsg->present);
- return;
- }
+ {
+ DU_LOG("\nF1AP : Invalid type of f1apMsg->present [%d]",f1apMsg->present);
+ return;
+ }
}/* End of switch(f1apMsg->present) */
-
+
} /* End of F1APMsgHdlr */
/**********************************************************************
{
DU_LOG("\n****** Received initial configs at DU APP ******\n");
duProcCfgComplete();
- ODU_PUT_MSG(mBuf);
+ ODU_PUT_MSG_BUF(mBuf);
break;
}
default:
{
DU_LOG("\nDU_APP : Invalid event received at duActvTsk from ENTDUAPP");
- ODU_PUT_MSG(mBuf);
+ ODU_PUT_MSG_BUF(mBuf);
ret = RFAILED;
}
}
{
DU_LOG("\nDU_APP : Invalid event %d received at duActvTsk from ENTRLC", \
pst->event);
- ODU_PUT_MSG(mBuf);
+ ODU_PUT_MSG_BUF(mBuf);
ret = RFAILED;
}
}
//Config complete
case EVTCFG:
{
- ODU_PUT_MSG(mBuf);
+ ODU_PUT_MSG_BUF(mBuf);
break;
}
case EVTLRGCFGCFM:
default:
{
DU_LOG("\nDU_APP : Invalid event received at duActvTsk from ENTMAC");
- ODU_PUT_MSG(mBuf);
+ ODU_PUT_MSG_BUF(mBuf);
ret = RFAILED;
}
}
}
}
- ODU_PUT_MSG(mBuf);
+ ODU_PUT_MSG_BUF(mBuf);
break;
}
case ENTEGTP:
ret = RFAILED;
}
}
- ODU_PUT_MSG(mBuf);
+ ODU_PUT_MSG_BUF(mBuf);
break;
}
default:
{
DU_LOG("\nDU_APP : DU APP can not process message from Entity %d", pst->srcEnt);
- ODU_PUT_MSG(mBuf);
+ ODU_PUT_MSG_BUF(mBuf);
ret = RFAILED;
}
Buffer *mBuf;
- if(ODU_GET_MSG(DU_APP_MEM_REGION, DU_POOL, &mBuf) == ROK)
+ if(ODU_GET_MSG_BUF(DU_APP_MEM_REGION, DU_POOL, &mBuf) == ROK)
{
if(ODU_ADD_POST_MSG_MULT((Data *)data, datSize, mBuf) != ROK)
{
DU_LOG("\nDU_APP : ODU_ADD_POST_MSG_MULT failed");
- ODU_PUT_MSG(mBuf);
+ ODU_PUT_MSG_BUF(mBuf);
return RFAILED;
}
}
uint8_t duFillSctpPst(Pst *pst, Event event)
{
Buffer *mBuf;
- if(ODU_GET_MSG(DFLT_REGION, DU_POOL, &mBuf) != ROK)
+ if(ODU_GET_MSG_BUF(DFLT_REGION, DU_POOL, &mBuf) != ROK)
{
printf("\nDU_APP : Failed to allocate memory");
return RFAILED;
else
{
- ODU_PUT_MSG(pollParams->mBuf);
+ ODU_PUT_MSG_BUF(pollParams->mBuf);
}
}
}
packDuRlcUlUeCreateReq, /* Light weight-loose coupling */
};
+DuDlRrcMsgToRlcFunc duSendDlRrcMsgToRlcOpts[] =
+{
+ packDlRrcMsgToRlc, /* Loose coupling */
+ RlcProcDlRrcMsgTransfer, /* Tight coupling */
+ packDlRrcMsgToRlc /* Light weight-loose coupling */
+};
+
/*******************************************************************
*
* @brief Handles EGTP data from CU
* ****************************************************************/
uint8_t duHdlEgtpDlData(EgtpMsg *egtpMsg)
{
+
/* TODO : Extract RbId/UeID/CellID/SduId from database
using tunnel id in egtp header */
DU_LOG("\nDU_APP : Processing DL data");
-
+#ifdef EGTP_TEST
Pst pst;
KwuDatReqInfo datReqInfo;
-#ifdef EGTP_TEST
datReqInfo.rlcId.rbId = RB_ID;
datReqInfo.rlcId.rbType = CM_LTE_DRB;
datReqInfo.rlcId.ueId = UE_ID;
datReqInfo.sduId = ++sduId;
datReqInfo.lcType = CM_LTE_LCH_DTCH;
-#endif
+
/* Filling pst and Sending to RLC DL */
pst.selector = ODU_SELECTOR_LWLC;
pst.srcEnt = ENTDUAPP;
pst.region = duCb.init.region;
cmPkKwuDatReq(&pst, &datReqInfo, egtpMsg->msg);
+#else
+ //duBuildAndSendDlRrcMsgToRlc();
+#endif
return ROK;
}
/* Send UL data to CU via EGTP */
duSendEgtpDatInd(mBuf);
- ODU_PUT_MSG(mBuf);
+ ODU_PUT_MSG_BUF(mBuf);
return ROK;
}
}
+/*******************************************************************
+ *
+ * @brief Build and Send DL RRC Message transfer to RLC
+ *
+ * @details
+ *
+ * Function : duBuildAndSendDlRrcMsgToRlc
+ *
+ * Functionality:
+ * Build and Send DL RRC Message transfer to RLC
+ *
+ * @params[in] Cell ID
+ * UE Index
+ * Logical Channgel ID
+ * RRC Message
+ * RRC Message Length
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t duBuildAndSendDlRrcMsgToRlc(uint16_t cellId, RlcUeCfg ueCfg, \
+ uint8_t lcId, bool deliveryStaReq, uint16_t rrcMsgLen, uint8_t *rrcMsg)
+{
+ Pst pst;
+ uint8_t ret;
+ uint8_t lcIdx;
+ RlcDlRrcMsgInfo *dlRrcMsgInfo;
+
+ DU_ALLOC_SHRABL_BUF(dlRrcMsgInfo, sizeof(RlcDlRrcMsgInfo));
+ if(!dlRrcMsgInfo)
+ {
+ DU_LOG("\nDU APP : Memory allocation failed for dlRrcMsgInfo in \
+ duBuildAndSendDlRrcMsgToRlc");
+ DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, rrcMsg, rrcMsgLen);
+ return RFAILED;
+ }
+
+ /* Filling up the RRC msg info */
+ dlRrcMsgInfo->cellId = cellId;
+ dlRrcMsgInfo->ueIdx = ueCfg.ueIdx;
+ for(lcIdx = 0; lcIdx <= MAX_NUM_LOGICAL_CHANNELS; lcIdx++)
+ {
+ if(ueCfg.rlcBearerCfg[lcIdx].lcId == lcId)
+ {
+ dlRrcMsgInfo->rbType = ueCfg.rlcBearerCfg[lcIdx].rbType;
+ dlRrcMsgInfo->rbId = ueCfg.rlcBearerCfg[lcIdx].rbId;
+ dlRrcMsgInfo->lcType = ueCfg.rlcBearerCfg[lcIdx].lcType;
+ dlRrcMsgInfo->lcId = ueCfg.rlcBearerCfg[lcIdx].lcId;
+ break;
+ }
+ }
+ dlRrcMsgInfo->execDup = false;
+ dlRrcMsgInfo->deliveryStaRpt = deliveryStaReq;
+ dlRrcMsgInfo->rrcMsg = rrcMsg;
+ dlRrcMsgInfo->msgLen = rrcMsgLen;
+
+ /* Filling post structure and sending msg */
+ memset(&pst, 0, sizeof(Pst));
+ FILL_PST_DUAPP_TO_RLC(pst, RLC_DL_INST, EVENT_DL_RRC_MSG_TRANS_TO_RLC);
+ ret = (*duSendDlRrcMsgToRlcOpts[pst.selector])(&pst, dlRrcMsgInfo);
+ if(ret != ROK)
+ {
+ DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, rrcMsg, rrcMsgLen);
+ DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, dlRrcMsgInfo, sizeof(RlcDlRrcMsgInfo));
+ return RFAILED;
+ }
+
+ return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Process UE context setup request from CU
+ *
+ * @details
+ *
+ * Function : procUeCintextSetupReq
+ *
+ * Functionality: Process UE context setup request from CU
+ *
+ * @params[in] F1AP message
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t procUeContextSetupReq(F1AP_PDU_t *f1apMsg)
+{
+ uint8_t ret = ROK;
+ uint8_t ieIdx, byteIdx, ueIdx;
+ uint8_t *rrcMsg = NULLP;
+ uint16_t rrcMsgLen;
+ uint16_t cellId, cellIdx;
+ uint32_t gnbDuUeF1apId; /* GNB DU UE F1AP ID */
+ uint32_t gnbCuUeF1apId; /* GNB CU UE F1AP ID */
+ bool deliveryStaReq = false; /* RRC msg delivery status request */
+ DuUeCb *ueCb = NULLP;
+ UEContextSetupRequest_t *ueSetReq = NULLP;
+
+ ueSetReq = &f1apMsg->choice.initiatingMessage->value.choice.UEContextSetupRequest;
+
+ /* TODO : fetch remaining values from f1ap msg */
+ for(ieIdx=0; ieIdx < ueSetReq->protocolIEs.list.count; ieIdx++)
+ {
+ switch(ueSetReq->protocolIEs.list.array[ieIdx]->id)
+ {
+ case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID:
+ {
+ gnbCuUeF1apId = ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_CU_UE_F1AP_ID;
+ break;
+ }
+ case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID:
+ {
+ gnbDuUeF1apId = ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_UE_F1AP_ID;
+ break;
+ }
+ case ProtocolIE_ID_id_ServCellIndex:
+ {
+ cellIdx = ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.ServCellIndex;
+ break;
+ }
+ case ProtocolIE_ID_id_RRCContainer:
+ {
+ rrcMsgLen = ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.size;
+ DU_ALLOC_SHRABL_BUF(rrcMsg, rrcMsgLen);
+ if(!rrcMsg)
+ {
+ DU_LOG("\nDU APP : Memory allocation failed for RRC Msg in procUeCtxtSetupReq");
+ return RFAILED;
+ }
+ memcpy(rrcMsg, ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf,\
+ rrcMsgLen);
+ break;
+ }
+ case ProtocolIE_ID_id_RRCDeliveryStatusRequest:
+ {
+ deliveryStaReq = true;
+ break;
+ }
+ default:
+ {
+ break;
+ }
+ }
+ }
+
+ cellId = duCb.actvCellLst[cellIdx]->cellId;
+ for(ueIdx = 0; ueIdx < MAX_NUM_UE; ueIdx++)
+ {
+ if((duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbCuUeF1apId == gnbCuUeF1apId) &&
+ (duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbDuUeF1apId == gnbDuUeF1apId &&
+ duCb.actvCellLst[cellIdx]->ueCb[ueIdx].ueState == UE_ACTIVE))
+ {
+ ueCb = &duCb.actvCellLst[cellIdx]->ueCb[ueIdx];
+ break;
+ }
+ }
+
+ /* TODO : send RB config to MAC/RLC */
+
+ /* Sending DL RRC Message to RLC */
+ if(ueIdx != MAX_NUM_UE)
+ {
+ ret = duBuildAndSendDlRrcMsgToRlc(cellId, ueCb->rlcUeCfg, SRB_ID_1, \
+ deliveryStaReq, rrcMsgLen, rrcMsg);
+ }
+ else
+ {
+ DU_LOG("\nDU APP : No UE found for CuUeF1apId[%d] and DuUeF1apId[%d]", \
+ gnbCuUeF1apId, gnbDuUeF1apId);
+ DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, rrcMsg, rrcMsgLen);
+ ret = RFAILED;
+ }
+
+ return ret;
+}
+
/******************************************************************
*
* @brief Processes DL RRC Message Transfer sent by CU
{
Buffer *mBuf;
- if(ODU_GET_MSG(region, pool, &mBuf) == ROK)
+ if(ODU_GET_MSG_BUF(region, pool, &mBuf) == ROK)
{
if(ODU_ADD_POST_MSG_MULT((Data *)encBuf, encBufSize, mBuf) == ROK)
{
if(sctpSend(mBuf) != ROK)
{
DU_LOG("\nE2AP : SCTP Send for E2 failed");
- ODU_PUT_MSG(mBuf);
+ ODU_PUT_MSG_BUF(mBuf);
return RFAILED;
}
}
else
{
DU_LOG("\nE2AP : ODU_ADD_POST_MSG_MULT failed");
- ODU_PUT_MSG(mBuf);
+ ODU_PUT_MSG_BUF(mBuf);
return RFAILED;
}
- ODU_PUT_MSG(mBuf);
+ ODU_PUT_MSG_BUF(mBuf);
}
else
{
else if(connUp & (pollParams->port == ricParams.destPort))
{
E2APMsgHdlr(pollParams->mBuf);
- ODU_PUT_MSG(pollParams->mBuf);
+ ODU_PUT_MSG_BUF(pollParams->mBuf);
}
else
{
- ODU_PUT_MSG(pollParams->mBuf);
+ ODU_PUT_MSG_BUF(pollParams->mBuf);
}
}
}