#include "GTPTunnel.h"
#include "SupportedSULFreqBandItem.h"
#include "du_sys_info_hdl.h"
+#include "du_e2ap_msg_hdl.h"
#ifdef O1_ENABLE
#include "CmInterface.h"
/* Encode results */
if(encRetVal.encoded == ENCODE_FAIL)
{
- DU_LOG("\nERROR --> F1AP : Could not encode F1SetupRequest structure (at %s)\n",\
- encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
- break;
+ DU_LOG("\nERROR --> F1AP : Could not encode F1SetupRequest structure (at %s)\n",\
+ encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
+ break;
}
else
{
- DU_LOG("\nDEBUG --> F1AP : Created APER encoded buffer for F1SetupRequest\n");
- for(ieIdx=0; ieIdx< encBufSize; ieIdx++)
- {
- printf("%x",encBuf[ieIdx]);
- }
+ DU_LOG("\nDEBUG --> F1AP : Created APER encoded buffer for F1SetupRequest\n");
+ for(ieIdx=0; ieIdx< encBufSize; ieIdx++)
+ {
+ printf("%x",encBuf[ieIdx]);
+ }
+
+ duCb.f1SetupReqAndRspMsg.f1MsgReqBufSize = encBufSize;
+ DU_ALLOC(duCb.f1SetupReqAndRspMsg.f1MsgReqBuf, encBufSize);
+ if(duCb.f1SetupReqAndRspMsg.f1MsgReqBuf == NULLP)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed to store the encoding of f1setup req");
+ return RFAILED;
+ }
+ memcpy(duCb.f1SetupReqAndRspMsg.f1MsgReqBuf, &encBuf, duCb.f1SetupReqAndRspMsg.f1MsgReqBufSize);
}
/* Sending msg */
if(sendF1APMsg() != ROK)
{
- DU_LOG("\nERROR --> F1AP : Sending F1 Setup request failed");
- break;
+ DU_LOG("\nERROR --> F1AP : Sending F1 Setup request failed");
+ break;
}
ret=ROK;
if(ret == RFAILED)
{
/*TODO : Negative case*/
- // BuildAndSendUeContextSetupRsp(cellId,ueIdx);
+ // BuildAndSendUeContextSetupRsp(cellId,ueId);
DU_LOG("\nERROR --> F1AP: Failed to process UE CNTXT SETUP REQ at procF1UeContextSetupReq()");
}
else
* Functionality: Constructs the UE Setup Response and sends
* it to the DU through SCTP.
*
- * @params[in] uint8_t cellId,uint8_t ueIdx
+ * @params[in] uint8_t cellId,uint8_t ueId
*
* @return ROK - success
* RFAILED - failure
*
* ****************************************************************/
-uint8_t BuildAndSendUeContextSetupRsp(uint8_t cellId,uint8_t ueIdx)
+uint8_t BuildAndSendUeContextSetupRsp(uint8_t cellId,uint8_t ueId)
{
uint8_t idx, ret, cellIdx, elementCnt;
uint32_t gnbCuUeF1apId; /* gNB-CU UE F1AP Id */
CellGroupConfigRrc_t *cellGrpCfg = NULLP;
DuUeCb *ueCb = NULLP;
- DU_LOG("\n INFO --> F1AP : Building UE Context Setup Response for cellId %d, ueIdx %d\n", cellId, ueIdx);
+ DU_LOG("\n INFO --> F1AP : Building UE Context Setup Response for cellId %d, ueId %d\n", cellId, ueId);
while(true)
{
}
/* Fetching Ue Cb Info*/
GET_CELL_IDX(cellId, cellIdx);
- gnbDuUeF1apId = duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].gnbDuUeF1apId;
- gnbCuUeF1apId = duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].gnbCuUeF1apId;
- ueCb = &duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1];
+ gnbDuUeF1apId = duCb.actvCellLst[cellIdx]->ueCb[ueId-1].gnbDuUeF1apId;
+ gnbCuUeF1apId = duCb.actvCellLst[cellIdx]->ueCb[ueId-1].gnbCuUeF1apId;
+ ueCb = &duCb.actvCellLst[cellIdx]->ueCb[ueId-1];
idx = 0;
/*GNB CU UE F1AP ID*/
* failure = RFAILED
*
* ****************************************************************/
-uint8_t BuildAndSendUeCtxtRsp(uint8_t cellId, uint8_t ueIdx)
+uint8_t BuildAndSendUeCtxtRsp(uint8_t cellId, uint8_t ueId)
{
uint8_t cellIdx = 0, actionType = 0;
GET_CELL_IDX(cellId, cellIdx);
- actionType = duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].f1UeDb->actionType;
+ actionType = duCb.actvCellLst[cellIdx]->ueCb[ueId-1].f1UeDb->actionType;
switch(actionType)
{
case UE_CTXT_SETUP:
{
- BuildAndSendUeContextSetupRsp(cellId,ueIdx);
+ BuildAndSendUeContextSetupRsp(cellId,ueId);
break;
}
case UE_CTXT_MOD:
{
- BuildAndSendUeContextModRsp(cellId, ueIdx);
+ BuildAndSendUeContextModRsp(cellId, ueId);
break;
}
default:
* RFAILED - failure
*
* ****************************************************************/
-uint8_t procF1SetupRsp(F1AP_PDU_t *f1apMsg)
+uint8_t procF1SetupRsp(F1AP_PDU_t *f1apMsg, MsgLen recvBufLen, char *recvBuf)
{
uint8_t ret = ROK;
uint16_t idx =0;
}
freeAperDecodeF1SetupRsp(f1SetRspMsg);
+
+ duCb.f1SetupReqAndRspMsg.f1MsgRspBufSize = recvBufLen;
+ DU_ALLOC(duCb.f1SetupReqAndRspMsg.f1MsgRspBuf, duCb.f1SetupReqAndRspMsg.f1MsgRspBufSize);
+ if(duCb.f1SetupReqAndRspMsg.f1MsgReqBuf == NULLP)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed to store the buf of F1setup response");
+ return RFAILED;
+ }
+ memcpy(duCb.f1SetupReqAndRspMsg.f1MsgRspBuf, recvBuf, recvBufLen);
+
+ if(BuildAndSendE2SetupReq() != ROK)
+ {
+ DU_LOG("\nERROR --> F1AP : Failed to build and send E2 setup request ");
+ return RFAILED;
+ }
return ret;
}
/*******************************************************************
}
crnti = duCb.actvCellLst[cellIdx]->ueCb[ueIdx].crnti;
- GET_UE_IDX(crnti,ueId);
+ GET_UE_ID(crnti,ueId);
/* Sending Ue Context release request only for maximum supporting UEs */
ret = BuildAndSendUeContextReleaseReq(cellId, ueId);
if(ret == RFAILED)
* Functionality:
* - Creating the ue context modifcation response
*
-* @params[in] uint8_t cellId,uint8_t ueIdx
+* @params[in] uint8_t cellId,uint8_t ueId
* @return ROK - success
* RFAILED - failure
*
* ****************************************************************/
-uint8_t BuildAndSendUeContextModRsp(uint8_t cellId,uint8_t ueIdx)
+uint8_t BuildAndSendUeContextModRsp(uint8_t cellId,uint8_t ueId)
{
uint8_t ieIdx = 0;
uint8_t cellIdx =0;
/* Fetching Ue Cb Info*/
GET_CELL_IDX(cellId, cellIdx);
- gnbDuUeF1apId = duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].gnbDuUeF1apId;
- gnbCuUeF1apId = duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].gnbCuUeF1apId;
- ueCb = &duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1];
+ gnbDuUeF1apId = duCb.actvCellLst[cellIdx]->ueCb[ueId-1].gnbDuUeF1apId;
+ gnbCuUeF1apId = duCb.actvCellLst[cellIdx]->ueCb[ueId-1].gnbCuUeF1apId;
+ ueCb = &duCb.actvCellLst[cellIdx]->ueCb[ueId-1];
ieIdx=0;
ueContextModifyRes->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID;
* RFAILED - failure
*
* *************************************************************/
-uint8_t BuildAndSendUeContextReleaseReq(uint16_t cellId, uint8_t ueIdx)
+uint8_t BuildAndSendUeContextReleaseReq(uint16_t cellId, uint8_t ueId)
{
bool memAllocFail = false;
uint8_t ieIdx =0;
}
else
{
- GET_CRNTI(crnti, ueIdx);
- if(duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].crnti != crnti)
+ GET_CRNTI(crnti, ueId);
+ if(duCb.actvCellLst[cellIdx]->ueCb[ueId-1].crnti != crnti)
{
DU_LOG("\nERROR --> F1AP : BuildAndSendUeContextReleaseReq(): crnti[%d] does not exist", crnti);
break;
}
- gnbDuUeF1apId = duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].gnbDuUeF1apId;
- gnbCuUeF1apId = duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].gnbCuUeF1apId;
+ gnbDuUeF1apId = duCb.actvCellLst[cellIdx]->ueCb[ueId-1].gnbDuUeF1apId;
+ gnbCuUeF1apId = duCb.actvCellLst[cellIdx]->ueCb[ueId-1].gnbCuUeF1apId;
}
ieIdx=0;
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);
if(rval.code == RC_FAIL || rval.code == RC_WMORE)
{
case SuccessfulOutcome__value_PR_F1SetupResponse:
{
#ifndef ODU_TEST_STUB
- procF1SetupRsp(f1apMsg);
+ procF1SetupRsp(f1apMsg, recvBufLen, recvBuf);
#endif
break;
}
free(f1apMsg);
}/* End of switch(f1apMsg->present) */
-
+
+ DU_FREE(recvBuf, (Size)recvBufLen);
} /* End of F1APMsgHdlr */
/**********************************************************************