################################################################################
*******************************************************************************/
#include "common_def.h"
+#include "du_tmr.h"
#include "lrg.h"
#include "lkw.x"
#include "lrg.x"
#include "legtp.h"
#include "du_app_mac_inf.h"
#include "du_app_rlc_inf.h"
+#include "du_e2ap_mgr.h"
+#include "du_e2ap_msg_hdl.h"
#include "du_cfg.h"
#include "du_mgr.h"
#include "du_mgr_main.h"
#include "du_utils.h"
#include "GlobalE2node-gNB-ID.h"
-#include<ProtocolIE-FieldE2.h>
+#include "ProtocolIE-FieldE2.h"
+#include "E2setupRequest.h"
+#include "InitiatingMessageE2.h"
+#include "SuccessfulOutcomeE2.h"
+#include "UnsuccessfulOutcomeE2.h"
#include "E2AP-PDU.h"
-#include "du_e2ap_msg_hdl.h"
#include "odu_common_codec.h"
+#include "E2nodeComponentInterfaceF1.h"
+#include "E2setupRequest.h"
+#include "du_e2_conversions.h"
-/* Global variable */
-DuCfgParams duCfgParam;
/*******************************************************************
*
* @brief Builds Global gNodeB Params
{
uint8_t unused = 0;
uint8_t byteSize = 4;
- uint8_t val = 1;
+ uint8_t gnbId = 1;
uint8_t ret = ROK;
/* Allocate Buffer size */
else
{
buildPlmnId(duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.nrCgi.plmn, \
- gNbId->global_gNB_ID.plmn_id.buf);
+ gNbId->global_gNB_ID.plmn_id.buf);
/* fill gND Id */
gNbId->global_gNB_ID.gnb_id.present = GNB_ID_Choice_PR_gnb_ID;
/* Allocate Buffer size */
gNbId->global_gNB_ID.gnb_id.choice.gnb_ID.size = byteSize * sizeof(uint8_t);
gNbId->global_gNB_ID.gnb_id.choice.gnb_ID.buf = NULLP;
DU_ALLOC(gNbId->global_gNB_ID.gnb_id.choice.gnb_ID.buf, \
- gNbId->global_gNB_ID.gnb_id.choice.gnb_ID.size);
+ gNbId->global_gNB_ID.gnb_id.choice.gnb_ID.size);
if(gNbId->global_gNB_ID.gnb_id.choice.gnb_ID.buf == NULLP)
{
- DU_LOG("\nERROR --> E2AP: Memory allocation failed for gnb buffer");
- ret = RFAILED;
+ DU_LOG("\nERROR --> E2AP: Memory allocation failed for gnb buffer");
+ ret = RFAILED;
}
else
{
- fillBitString(&gNbId->global_gNB_ID.gnb_id.choice.gnb_ID, unused, byteSize, val);
+ fillBitString(&gNbId->global_gNB_ID.gnb_id.choice.gnb_ID, unused, byteSize, gnbId);
}
}
return ret;
}
+/******************************************************************
+ *
+ * @brief Search E2 node component with the help of action type
+ *
+ * @details
+ *
+ * Function : searchE2NodeComponentInfo
+ *
+ * Functionality: Search E2 node component with the help of action type
+ *
+ * @params[in] uint8_t componentActionType
+ * @return CmLList
+ *
+ * ****************************************************************/
+
+CmLList *searchE2NodeComponentInfo(InterfaceType interfaceType, uint8_t componentActionType)
+{
+ E2NodeComponent *e2NodeComponentInfo;
+ CmLList *node;
+
+ if(duCb.e2apDb.e2NodeComponentList.count)
+ {
+ CM_LLIST_FIRST_NODE(&duCb.e2apDb.e2NodeComponentList, node);
+ while(node)
+ {
+ e2NodeComponentInfo = (E2NodeComponent*)node->node;
+ if((e2NodeComponentInfo->interfaceType == interfaceType) && (e2NodeComponentInfo->componentActionType == componentActionType))
+ break;
+ else
+ node = node->next;
+ }
+ }
+ return node;
+}
/*******************************************************************
*
- * @brief Fills the initiating IE for E2 Setup Request
+ * @brief Builds E2 node config addition list
*
* @details
*
- * Function : fillE2SetupReq
+ * Function : BuildE2NodeConfigAddList
*
- * Functionality:Fills the Initiating message for
- * E2SetupRequest
+ * Functionality: Building E2 node config addition list
*
- * @params[in] E2setupRequest_t *e2SetupReq,
- * uint8_t *idx
+ * @params[in] E2nodeComponentConfigAddition_List_t *e2NodeAddList
* @return ROK - success
* RFAILED - failure
*
******************************************************************/
-uint8_t fillE2SetupReq(E2setupRequest_t **e2SetupReq, uint8_t *idx)
+uint8_t BuildE2NodeConfigAddList(E2nodeComponentConfigAddition_List_t *e2NodeAddList)
{
- uint8_t elementCnt = 0;
- uint8_t idx2 = 0;
- uint8_t ret = ROK;
-
- if(*e2SetupReq != NULLP)
+ uint8_t arrIdx = 0;
+ CmLList *node;
+ E2NodeComponent *e2NodeComponentInfo;
+ E2nodeComponentConfigAddition_ItemIEs_t *e2NodeAddItemIe;
+ E2nodeComponentConfigAddition_Item_t *e2NodeAddItem;
+
+ e2NodeAddList->list.count = 1;
+ e2NodeAddList->list.size = e2NodeAddList->list.count * sizeof(E2nodeComponentConfigAddition_ItemIEs_t *);
+ DU_ALLOC(e2NodeAddList->list.array, e2NodeAddList->list.size);
+ if(e2NodeAddList->list.array == NULLP)
{
- elementCnt = 1;
- (*e2SetupReq)->protocolIEs.list.count = elementCnt;
- (*e2SetupReq)->protocolIEs.list.size = \
- elementCnt * sizeof(E2setupRequestIEs_t);
+ DU_LOG("\nERROR --> E2AP: Memory allocation failed for BuildE2NodeConfigAddList %d",__LINE__);
+ return RFAILED;
+ }
- /* Initialize the E2Setup members */
- DU_ALLOC((*e2SetupReq)->protocolIEs.list.array, \
- (*e2SetupReq)->protocolIEs.list.size);
- if((*e2SetupReq)->protocolIEs.list.array == NULLP)
+ for(arrIdx = 0; arrIdx< e2NodeAddList->list.count; arrIdx++)
+ {
+ DU_ALLOC(e2NodeAddList->list.array[arrIdx], sizeof(E2nodeComponentConfigAddition_ItemIEs_t));
+ if(e2NodeAddList->list.array[arrIdx] == NULLP)
{
- DU_LOG("\nERROR --> E2AP : Memory allocation failed for array elements");
- ret = RFAILED;
+ DU_LOG("\nERROR --> E2AP: Memory allocation failed for BuildE2NodeConfigAddList %d",__LINE__);
+ return RFAILED;
}
- else
+ }
+
+ node = searchE2NodeComponentInfo(F1, E2_NODE_COMPONENT_ADD);
+ if(!node)
+ {
+ DU_LOG("\nERROR --> E2AP : Received e2NodeComponentInfo is null");
+ return RFAILED;
+ }
+ e2NodeComponentInfo = (E2NodeComponent*)node->node;
+
+ arrIdx = 0;
+ e2NodeAddItemIe = (E2nodeComponentConfigAddition_ItemIEs_t *) e2NodeAddList->list.array[arrIdx];
+ e2NodeAddItemIe->id = ProtocolIE_IDE2_id_E2nodeComponentConfigAddition_Item;
+ e2NodeAddItemIe->criticality = CriticalityE2_reject;
+ e2NodeAddItemIe->value.present = E2nodeComponentConfigAddition_ItemIEs__value_PR_E2nodeComponentConfigAddition_Item;
+ e2NodeAddItem = &e2NodeAddItemIe->value.choice.E2nodeComponentConfigAddition_Item;
+
+ /* E2nodeComponentInterfaceType */
+ e2NodeAddItem->e2nodeComponentInterfaceType = E2nodeComponentInterfaceType_f1;
+
+ /* E2 Node Component Request Part */
+ if(e2NodeComponentInfo->componentRequestPart)
+ {
+ e2NodeAddItem->e2nodeComponentConfiguration.e2nodeComponentRequestPart.size = e2NodeComponentInfo->reqBufSize ;
+ DU_ALLOC(e2NodeAddItem->e2nodeComponentConfiguration.e2nodeComponentRequestPart.buf,\
+ e2NodeAddItem->e2nodeComponentConfiguration.e2nodeComponentRequestPart.size);
+ if(e2NodeAddItem->e2nodeComponentConfiguration.e2nodeComponentRequestPart.buf == NULLP)
{
- for(*idx = 0; *idx < elementCnt; (*idx)++)
- {
- DU_ALLOC((*e2SetupReq)->protocolIEs.list.array[*idx],\
- sizeof(E2setupRequestIEs_t));
- if((*e2SetupReq)->protocolIEs.list.array[*idx] == NULLP)
- {
- DU_LOG("\nERROR --> E2AP : Memory allocation failed for arrayidx [%d]", *idx);
- ret = RFAILED;
- }
- else
- {
- /* GlobalE2node_gNB_ID */
- (*e2SetupReq)->protocolIEs.list.array[idx2]->id = \
- ProtocolIE_IDE2_id_GlobalE2node_ID;
- (*e2SetupReq)->protocolIEs.list.array[idx2]->criticality = \
- CriticalityE2_reject;
- (*e2SetupReq)->protocolIEs.list.array[idx2]->value.present =\
- E2setupRequestIEs__value_PR_GlobalE2node_ID;
- (*e2SetupReq)->protocolIEs.list.array[idx2]->value.choice.\
- GlobalE2node_ID.present = GlobalE2node_ID_PR_gNB;
-
- DU_ALLOC((*e2SetupReq)->protocolIEs.list.array[idx2]->value.choice.\
- GlobalE2node_ID.choice.gNB, sizeof(GlobalE2node_gNB_ID_t));
- if((*e2SetupReq)->protocolIEs.list.array[idx2]->value.choice.\
- GlobalE2node_ID.choice.gNB == NULLP)
- {
- DU_LOG("\nERROR --> E2AP : Memory allocation failed for gNbId");
- ret = RFAILED;
- }
- else
- {
- ret = BuildGlobalgNBId((*e2SetupReq)->protocolIEs.list.array[idx2]->value.\
- choice.GlobalE2node_ID.choice.gNB);
- if(ret != ROK)
- {
- ret = RFAILED;
- }
- }
+ DU_LOG("\nERROR --> E2AP: Memory allocation failed for BuildE2NodeConfigAddList %d",__LINE__);
+ return RFAILED;
+ }
- }
- }
+ memcpy(e2NodeAddItem->e2nodeComponentConfiguration.e2nodeComponentRequestPart.buf,\
+ e2NodeComponentInfo->componentRequestPart, e2NodeAddItem->e2nodeComponentConfiguration.\
+ e2nodeComponentRequestPart.size);
+ }
+ else
+ {
+ DU_LOG("\nERROR --> E2AP: componentRequestPart is null ");
+ return RFAILED;
+ }
+
+
+ /* E2 Node Component Response Part */
+ if(e2NodeComponentInfo->componentResponsePart)
+ {
+ e2NodeAddItem->e2nodeComponentConfiguration.e2nodeComponentResponsePart.size = e2NodeComponentInfo->rspBufSize;
+ DU_ALLOC(e2NodeAddItem->e2nodeComponentConfiguration.e2nodeComponentResponsePart.buf, \
+ e2NodeAddItem->e2nodeComponentConfiguration.e2nodeComponentResponsePart.size);
+ if(e2NodeAddItem->e2nodeComponentConfiguration.e2nodeComponentResponsePart.buf == NULLP)
+ {
+ DU_LOG("\nERROR --> E2AP: Memory allocation failed for BuildE2NodeConfigAddList %d",__LINE__);
+ return RFAILED;
}
+ memcpy(e2NodeAddItem->e2nodeComponentConfiguration.e2nodeComponentResponsePart.buf, \
+ e2NodeComponentInfo->componentResponsePart, e2NodeAddItem->e2nodeComponentConfiguration.\
+ e2nodeComponentResponsePart.size);
}
else
{
- ret = RFAILED;
- DU_LOG("\nERROR --> E2AP : received e2SetupReq is NULL");
+ DU_LOG("\nERROR --> E2AP: componentResponsePart is null");
+ return RFAILED;
+ }
+
+ /* E2 Node Component ID */
+ e2NodeAddItem->e2nodeComponentID.present = E2nodeComponentID_PR_e2nodeComponentInterfaceTypeF1;
+ DU_ALLOC(e2NodeAddItem->e2nodeComponentID.choice.e2nodeComponentInterfaceTypeF1,\
+ sizeof(E2nodeComponentInterfaceF1_t));
+ if(e2NodeAddItem->e2nodeComponentID.choice.e2nodeComponentInterfaceTypeF1 == NULLP)
+ {
+ DU_LOG("\nERROR --> E2AP: Memory allocation failed for BuildE2NodeConfigAddList %d",__LINE__);
+ return RFAILED;
+ }
+ e2NodeAddItem->e2nodeComponentID.choice.e2nodeComponentInterfaceTypeF1->gNB_DU_ID.size = sizeof(uint8_t);
+ DU_ALLOC(e2NodeAddItem->e2nodeComponentID.choice.e2nodeComponentInterfaceTypeF1->gNB_DU_ID.buf,\
+ e2NodeAddItem->e2nodeComponentID.choice.e2nodeComponentInterfaceTypeF1->gNB_DU_ID.size);
+
+ if(e2NodeAddItem->e2nodeComponentID.choice.e2nodeComponentInterfaceTypeF1->gNB_DU_ID.buf == NULLP)
+ {
+ DU_LOG("\nERROR -->list. E2AP: Memory allocation failed for BuildE2NodeConfigAddList %d",__LINE__);
+ return RFAILED;
+ }
+ e2NodeAddItem->e2nodeComponentID.choice.e2nodeComponentInterfaceTypeF1->gNB_DU_ID.buf[arrIdx] = e2NodeComponentInfo->componentId;
+ return ROK;
+
+}
+
+/*******************************************************************
+ *
+ * @brief De Allocate E2 Setup Request Message
+ *
+ * @details
+ *
+ * Function : FreeE2SetupReq
+ *
+ * Functionality: De-Allocating E2 Setup request Message
+ *
+ * @params[in] E2AP_PDU_t *e2apMsg
+
+ * @return void
+ *
+ * ****************************************************************/
+
+void FreeE2SetupReq(E2AP_PDU_t *e2apMsg)
+{
+ uint8_t arrIdx = 0;
+ uint8_t e2NodeAddListIdx =0;
+ E2setupRequest_t *e2SetupReq;
+ E2nodeComponentConfigAddition_List_t *e2NodeAddList;
+ E2nodeComponentConfigAddition_ItemIEs_t *e2NodeAddItem;
+
+ /* De-allocating Memory */
+ if(e2apMsg != NULLP)
+ {
+ if(e2apMsg->choice.initiatingMessage != NULLP)
+ {
+ e2SetupReq = &e2apMsg->choice.initiatingMessage->value.choice.E2setupRequest;
+ if(e2SetupReq->protocolIEs.list.array != NULLP)
+ {
+ for(arrIdx = 0; arrIdx < e2SetupReq->protocolIEs.list.count; arrIdx++)
+ {
+ if(e2SetupReq->protocolIEs.list.array[arrIdx] != NULLP)
+ {
+ switch(e2SetupReq->protocolIEs.list.array[arrIdx]->id)
+ {
+ case ProtocolIE_IDE2_id_TransactionID:
+ break;
+ case ProtocolIE_IDE2_id_GlobalE2node_ID:
+ {
+ if(e2SetupReq->protocolIEs.list.array[arrIdx]->\
+ value.choice.GlobalE2node_ID.choice.gNB != NULLP)
+ {
+ GlobalE2node_gNB_ID_t *gNbId = NULLP;
+ gNbId = e2SetupReq->protocolIEs.list.array[arrIdx]->\
+ value.choice.GlobalE2node_ID.choice.gNB;
+ if(gNbId->global_gNB_ID.plmn_id.buf != NULLP)
+ {
+ DU_FREE(gNbId->global_gNB_ID.gnb_id.choice.gnb_ID.buf,\
+ gNbId->global_gNB_ID.gnb_id.choice.gnb_ID.size);
+ DU_FREE(gNbId->global_gNB_ID.plmn_id.buf,\
+ gNbId->global_gNB_ID.plmn_id.size);
+ }
+ DU_FREE(e2SetupReq->protocolIEs.list.array[arrIdx]->value.\
+ choice.GlobalE2node_ID.choice.gNB, sizeof(GlobalE2node_gNB_ID_t));
+ }
+ break;
+ }
+ case ProtocolIE_IDE2_id_E2nodeComponentConfigAddition:
+ {
+ e2NodeAddList = &e2SetupReq->protocolIEs.list.array[arrIdx]->value.choice.E2nodeComponentConfigAddition_List;
+ if(e2NodeAddList->list.array)
+ {
+ for(e2NodeAddListIdx = 0; e2NodeAddListIdx< e2NodeAddList->list.count; e2NodeAddListIdx++)
+ {
+ e2NodeAddItem = (E2nodeComponentConfigAddition_ItemIEs_t *) e2NodeAddList->list.array[e2NodeAddListIdx];
+
+ /* Free E2 Node Component Request Part */
+ DU_FREE(e2NodeAddItem->value.choice.E2nodeComponentConfigAddition_Item.e2nodeComponentConfiguration.e2nodeComponentRequestPart.buf,\
+ e2NodeAddItem->value.choice.E2nodeComponentConfigAddition_Item.e2nodeComponentConfiguration.e2nodeComponentRequestPart.size);
+
+ /* Free E2 Node Component Response Part */
+ DU_FREE(e2NodeAddItem->value.choice.E2nodeComponentConfigAddition_Item.e2nodeComponentConfiguration.\
+ e2nodeComponentResponsePart.buf, \
+ e2NodeAddItem->value.choice.E2nodeComponentConfigAddition_Item.e2nodeComponentConfiguration.e2nodeComponentResponsePart.size);
+
+ /* Free E2 Node Component ID */
+ if(e2NodeAddItem->value.choice.E2nodeComponentConfigAddition_Item.e2nodeComponentID.choice.e2nodeComponentInterfaceTypeF1)
+ {
+ DU_FREE(e2NodeAddItem->value.choice.E2nodeComponentConfigAddition_Item.e2nodeComponentID.choice.\
+ e2nodeComponentInterfaceTypeF1->gNB_DU_ID.buf,\
+ e2NodeAddItem->value.choice.E2nodeComponentConfigAddition_Item.e2nodeComponentID.choice.\
+ e2nodeComponentInterfaceTypeF1->gNB_DU_ID.size);
+ DU_FREE(e2NodeAddItem->value.choice.E2nodeComponentConfigAddition_Item.e2nodeComponentID.choice.e2nodeComponentInterfaceTypeF1,\
+ sizeof(E2nodeComponentInterfaceF1_t));
+ }
+ DU_FREE(e2NodeAddList->list.array[e2NodeAddListIdx], sizeof(E2nodeComponentConfigAddition_ItemIEs_t));
+ }
+ DU_FREE(e2NodeAddList->list.array, e2NodeAddList->list.size);
+ }
+ break;
+ }
+ default:
+ DU_LOG("\nERROR --> E2AP: Invalid event at e2SetupRequet %ld ",\
+ (e2SetupReq->protocolIEs.list.array[arrIdx]->id));
+ break;
+ }
+ DU_FREE(e2SetupReq->protocolIEs.list.array[arrIdx], sizeof(E2setupRequestIEs_t));
+ }
+ }
+ DU_FREE(e2SetupReq->protocolIEs.list.array, e2SetupReq->protocolIEs.list.size);
+ }
+ DU_FREE(e2apMsg->choice.initiatingMessage, sizeof(InitiatingMessageE2_t));
+ }
+ DU_FREE(e2apMsg, sizeof(E2AP_PDU_t));
}
- return ret;
}
/*******************************************************************
uint8_t BuildAndSendE2SetupReq()
{
- uint8_t idx = 0;
- uint8_t ret = ROK;
+ uint8_t arrIdx = 0, elementCnt=0;
+ uint8_t transId = 0, ret = ROK;
+ bool memAllocFailed;
E2AP_PDU_t *e2apMsg = NULLP;
E2setupRequest_t *e2SetupReq = NULLP;
asn_enc_rval_t encRetVal; /* Encoder return value */
DU_ALLOC(e2apMsg, sizeof(E2AP_PDU_t));
if(e2apMsg == NULLP)
{
- DU_LOG("\nERROR --> E2AP : Memory allocation for E2AP-PDU failed");
- break;
+ DU_LOG("\nERROR --> E2AP : Memory allocation for E2AP-PDU failed");
+ break;
}
e2apMsg->present = E2AP_PDU_PR_initiatingMessage;
DU_ALLOC(e2apMsg->choice.initiatingMessage, sizeof(InitiatingMessageE2_t));
if(e2apMsg->choice.initiatingMessage == NULLP)
{
- DU_LOG("\nERROR --> E2AP : Memory allocation for E2AP-PDU failed");
- DU_FREE(e2apMsg, sizeof(E2AP_PDU_t));
- return RFAILED;
+ DU_LOG("\nERROR --> E2AP : Memory allocation for E2AP-PDU failed");
+ break;
}
e2apMsg->choice.initiatingMessage->criticality = CriticalityE2_reject;
e2apMsg->choice.initiatingMessage->procedureCode = ProcedureCodeE2_id_E2setup;
e2apMsg->choice.initiatingMessage->value.present = InitiatingMessageE2__value_PR_E2setupRequest;
e2SetupReq = &e2apMsg->choice.initiatingMessage->value.choice.E2setupRequest;
- ret = fillE2SetupReq(&e2SetupReq, &idx);
- if(ret != ROK)
+ elementCnt = 3;
+ e2SetupReq->protocolIEs.list.count = elementCnt;
+ e2SetupReq->protocolIEs.list.size = elementCnt * sizeof(E2setupRequestIEs_t*);
+
+ /* Initialize the E2Setup members */
+ DU_ALLOC(e2SetupReq->protocolIEs.list.array, \
+ e2SetupReq->protocolIEs.list.size);
+ if(e2SetupReq->protocolIEs.list.array == NULLP)
{
- DU_LOG("\nERROR --> E2AP : fillE2SetupReq() failed");
- break;
+ DU_LOG("\nERROR --> E2AP : Memory allocation failed for array elements");
+ break;
}
+ for(arrIdx = 0; arrIdx < elementCnt; (arrIdx)++)
+ {
+ DU_ALLOC(e2SetupReq->protocolIEs.list.array[arrIdx],\
+ sizeof(E2setupRequestIEs_t));
+ if(e2SetupReq->protocolIEs.list.array[arrIdx] == NULLP)
+ {
+ memAllocFailed = true;
+ DU_LOG("\nERROR --> E2AP : Memory allocation failed for arrayarrIdx [%d]", arrIdx);
+ break;
+ }
+ }
+ if(memAllocFailed == true)
+ break;
+
+ arrIdx = 0;
+
+ /* TransactionID */
+ e2SetupReq->protocolIEs.list.array[arrIdx]->id = ProtocolIE_IDE2_id_TransactionID;
+ e2SetupReq->protocolIEs.list.array[arrIdx]->criticality = CriticalityE2_reject;
+ e2SetupReq->protocolIEs.list.array[arrIdx]->value.present = E2setupRequestIEs__value_PR_TransactionID;
+ transId = assignTransactionId();
+ e2SetupReq->protocolIEs.list.array[arrIdx]->value.choice.TransactionID = transId;
+
+ arrIdx++;
+ /* GlobalE2node_gNB_ID */
+ e2SetupReq->protocolIEs.list.array[arrIdx]->id = ProtocolIE_IDE2_id_GlobalE2node_ID;
+ e2SetupReq->protocolIEs.list.array[arrIdx]->criticality = CriticalityE2_reject;
+ e2SetupReq->protocolIEs.list.array[arrIdx]->value.present = E2setupRequestIEs__value_PR_GlobalE2node_ID;
+ e2SetupReq->protocolIEs.list.array[arrIdx]->value.choice.GlobalE2node_ID.present = GlobalE2node_ID_PR_gNB;
+
+ DU_ALLOC(e2SetupReq->protocolIEs.list.array[arrIdx]->value.choice.\
+ GlobalE2node_ID.choice.gNB, sizeof(GlobalE2node_gNB_ID_t));
+ if(e2SetupReq->protocolIEs.list.array[arrIdx]->value.choice.\
+ GlobalE2node_ID.choice.gNB == NULLP)
+ {
+ DU_LOG("\nERROR --> E2AP : Memory allocation failed for gNbId");
+ break;
+ }
+ else
+ {
+ ret = BuildGlobalgNBId(e2SetupReq->protocolIEs.list.array[arrIdx]->value.\
+ choice.GlobalE2node_ID.choice.gNB);
+ if(ret != ROK)
+ {
+ DU_LOG("\nERROR --> E2AP : Failed to build Global Gnb Id");
+ break;
+ }
+ }
+
+ arrIdx++;
+ /* E2 Node Component Configuration Addition List */
+ e2SetupReq->protocolIEs.list.array[arrIdx]->id = ProtocolIE_IDE2_id_E2nodeComponentConfigAddition;
+ e2SetupReq->protocolIEs.list.array[arrIdx]->criticality = CriticalityE2_reject;
+ e2SetupReq->protocolIEs.list.array[arrIdx]->value.present = E2setupRequestIEs__value_PR_E2nodeComponentConfigAddition_List;
+ if(BuildE2NodeConfigAddList(&(e2SetupReq->protocolIEs.list.array[arrIdx]->value.choice.E2nodeComponentConfigAddition_List))!=ROK)
+ {
+ DU_LOG("\nERROR --> E2AP : Failed to E2 Node config addition list");
+ break;
+ }
+
+
+
/* Prints the Msg formed */
xer_fprint(stdout, &asn_DEF_E2AP_PDU, e2apMsg);
memset(encBuf, 0, ENC_BUF_MAX_LEN);
encBufSize = 0;
encRetVal = aper_encode(&asn_DEF_E2AP_PDU, 0, e2apMsg, PrepFinalEncBuf,\
- encBuf);
+ encBuf);
if(encRetVal.encoded == ENCODE_FAIL)
{
- DU_LOG("\nERROR --> E2AP : Could not encode E2SetupRequest structure (at %s)\n",\
- encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
- break;
+ DU_LOG("\nERROR --> E2AP : Could not encode E2SetupRequest structure (at %s)\n",\
+ encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
+ break;
}
else
{
- DU_LOG("\nDEBUG --> E2AP : Created APER encoded buffer for E2SetupRequest\n");
- for(int i=0; i< encBufSize; i++)
- {
- printf("%x",encBuf[i]);
- }
+ DU_LOG("\nDEBUG --> E2AP : Created APER encoded buffer for E2SetupRequest\n");
+#ifdef DEBUG_ASN_PRINT
+ for(int i=0; i< encBufSize; i++)
+ {
+ printf("%x",encBuf[i]);
+ }
+#endif
}
- if(SendE2APMsg(DU_APP_MEM_REGION, DU_POOL) != ROK)
+ if(SendE2APMsg(DU_APP_MEM_REGION, DU_POOL, encBuf, encBufSize) != ROK)
{
- DU_LOG("\nERROR --> E2AP : Sending E2 Setup request failed");
+ DU_LOG("\nERROR --> E2AP : Sending E2 Setup request failed");
}
-
break;
}while(true);
- deAllocateE2SetupReqMsg(e2apMsg, e2SetupReq, idx);
+ duCb.e2apDb.e2TransInfo.onGoingTransaction[transId].transactionId = transId;
+ duCb.e2apDb.e2TransInfo.onGoingTransaction[transId].procedureCode = e2apMsg->choice.initiatingMessage->procedureCode;
+
+ FreeE2SetupReq(e2apMsg);
return ret;
}/* End of BuildAndSendE2SetupReq */
-/*******************************************************************
- *
- * @brief De Allocate E2 Setup Request Message
- *
- * @details
- *
- * Function : deAllocateE2SetupReqMsg
- *
- * Functionality: De-Allocating E2 Setup request Message
- *
- * @params[in] E2AP_PDU_t *e2apMsg
- * E2setupRequest_t *e2SetupReq
- * @return ROK - success
- * RFAILED - failure
- *
- * ****************************************************************/
-
-uint8_t deAllocateE2SetupReqMsg(E2AP_PDU_t *e2apMsg, \
- E2setupRequest_t *e2SetupReq, uint8_t idx)
-{
- uint8_t idx2;
- uint8_t ret = ROK;
- /* De-allocating Memory */
- if(e2apMsg != NULLP)
- {
- if(e2apMsg->choice.initiatingMessage != NULLP)
- {
- if(e2SetupReq->protocolIEs.list.array != NULLP)
- {
- for(idx2 = 0; idx2 < idx; idx2++)
- {
- if(e2SetupReq->protocolIEs.list.array[idx2] != NULLP)
- {
- switch(e2SetupReq->protocolIEs.list.array[idx2]->id)
- {
- case ProtocolIE_IDE2_id_GlobalE2node_ID:
- {
- if(e2SetupReq->protocolIEs.list.array[idx2]->\
- value.choice.GlobalE2node_ID.choice.gNB != NULLP)
- {
- GlobalE2node_gNB_ID_t *gNbId = NULLP;
- gNbId = e2SetupReq->protocolIEs.list.array[idx2]->\
- value.choice.GlobalE2node_ID.choice.gNB;
- if(gNbId->global_gNB_ID.plmn_id.buf != NULLP)
- {
- if(gNbId->global_gNB_ID.gnb_id.choice.gnb_ID.buf != NULLP)
- {
- DU_FREE(gNbId->global_gNB_ID.gnb_id.choice.gnb_ID.buf,\
- gNbId->global_gNB_ID.gnb_id.choice.gnb_ID.size);
- }
- DU_FREE(gNbId->global_gNB_ID.plmn_id.buf,\
- gNbId->global_gNB_ID.plmn_id.size);
- }
- DU_FREE(e2SetupReq->protocolIEs.list.array[idx2]->value.\
- choice.GlobalE2node_ID.choice.gNB, sizeof(GlobalE2node_gNB_ID_t));
- }
- DU_FREE(e2SetupReq->protocolIEs.list.array[idx2],\
- sizeof(E2setupRequestIEs_t));
- break;
- }
- default:
- DU_LOG("\nERROR --> E2AP: Invalid event at e2SetupRequet %ld ",\
- (e2SetupReq->protocolIEs.list.array[idx2]->id));
- break;
- }
- }
- }
- DU_FREE(e2SetupReq->protocolIEs.list.array, e2SetupReq->protocolIEs.list.size);
- }
- DU_FREE(e2apMsg->choice.initiatingMessage, sizeof(InitiatingMessageE2_t));
- }
- DU_FREE(e2apMsg, sizeof(E2AP_PDU_t));
- }
- return ret;
-}
/*******************************************************************
*
* @brief Builds Ric Request Id
else
{
DU_LOG("\nDEBUG --> E2AP : Created APER encoded buffer for RIC subscription response \n");
+#ifdef DEBUG_ASN_PRINT
for(int i=0; i< encBufSize; i++)
{
printf("%x",encBuf[i]);
}
+#endif
}
- if(SendE2APMsg(DU_APP_MEM_REGION, DU_POOL) != ROK)
+ if(SendE2APMsg(DU_APP_MEM_REGION, DU_POOL, encBuf, encBufSize) != ROK)
{
DU_LOG("\nERROR --> E2AP : Sending RIC Subscription Response failed");
break;
return ret;
}
+
+/******************************************************************
+ *
+ * @brief Deallocation of memory allocated bu aper decoder for e2 setup response
+ *
+ * @details
+ *
+ * Function : freeAperDecodingOfE2SetupRsp
+ *
+ * Functionality: Deallocation of memory allocated bu aper decoder for e2
+ * setup response
+ *
+ * @params[in] E2setupResponse_t *e2SetRspMsg;
+ * @return void
+ *
+ * ****************************************************************/
+void freeAperDecodingOfE2SetupRsp(E2setupResponse_t *e2SetRspMsg)
+{
+ uint8_t arrIdx, e2NodeConfigAddAckListIdx;
+ E2nodeComponentConfigAdditionAck_ItemIEs_t *e2NodeAddAckItem;
+ E2nodeComponentConfigAdditionAck_List_t *e2NodeConfigAddAckList;
+
+ if(e2SetRspMsg)
+ {
+ if(e2SetRspMsg->protocolIEs.list.array)
+ {
+ for(arrIdx=0; arrIdx<e2SetRspMsg->protocolIEs.list.count; arrIdx++)
+ {
+ if(e2SetRspMsg->protocolIEs.list.array[arrIdx])
+ {
+ switch(e2SetRspMsg->protocolIEs.list.array[arrIdx]->id)
+ {
+ case ProtocolIE_IDE2_id_TransactionID:
+ break;
+
+ case ProtocolIE_IDE2_id_GlobalRIC_ID:
+ {
+ free(e2SetRspMsg->protocolIEs.list.array[arrIdx]->value.choice.GlobalRIC_ID.pLMN_Identity.buf);
+ free(e2SetRspMsg->protocolIEs.list.array[arrIdx]->value.choice.GlobalRIC_ID.ric_ID.buf);
+ break;
+ }
+
+ case ProtocolIE_IDE2_id_E2nodeComponentConfigAdditionAck:
+ {
+ e2NodeConfigAddAckList = &e2SetRspMsg->protocolIEs.list.array[arrIdx]->value.choice.E2nodeComponentConfigAdditionAck_List;
+ if(e2NodeConfigAddAckList->list.array )
+ {
+ for(e2NodeConfigAddAckListIdx = 0; e2NodeConfigAddAckListIdx< e2NodeConfigAddAckList->list.count; e2NodeConfigAddAckListIdx++)
+ {
+ if(e2NodeConfigAddAckList->list.array[e2NodeConfigAddAckListIdx])
+ {
+ e2NodeAddAckItem = (E2nodeComponentConfigAdditionAck_ItemIEs_t*) e2NodeConfigAddAckList->list.array[e2NodeConfigAddAckListIdx];
+ free(e2NodeAddAckItem->value.choice.E2nodeComponentConfigAdditionAck_Item.e2nodeComponentID.choice.\
+ e2nodeComponentInterfaceTypeF1->gNB_DU_ID.buf);
+ free(e2NodeAddAckItem->value.choice.E2nodeComponentConfigAdditionAck_Item.e2nodeComponentID.choice.\
+ e2nodeComponentInterfaceTypeF1);
+ free(e2NodeConfigAddAckList->list.array[e2NodeConfigAddAckListIdx]);
+ }
+ }
+ free(e2NodeConfigAddAckList->list.array);
+ }
+ break;
+ }
+ }
+ free(e2SetRspMsg->protocolIEs.list.array[arrIdx]);
+ }
+ }
+ free(e2SetRspMsg->protocolIEs.list.array);
+ }
+ }
+}
/******************************************************************
*
* @brief Processes E2 Setup Response sent by RIC
* ****************************************************************/
uint8_t procE2SetupRsp(E2AP_PDU_t *e2apMsg)
{
- uint8_t idx;
+ uint8_t arrIdx =0, transId=0;
uint32_t recvBufLen;
E2setupResponse_t *e2SetRspMsg;
+ CmLList *node;
+ E2NodeComponent *e2NodeComponentInfo;
DU_LOG("\nINFO --> E2AP : E2 Setup Response received");
duCb.e2Status = TRUE; //Set E2 status as true
e2SetRspMsg = &e2apMsg->choice.successfulOutcome->value.choice.E2setupResponse;
- for(idx=0; idx<e2SetRspMsg->protocolIEs.list.count; idx++)
+ for(arrIdx=0; arrIdx<e2SetRspMsg->protocolIEs.list.count; arrIdx++)
{
- switch(e2SetRspMsg->protocolIEs.list.array[idx]->id)
+ switch(e2SetRspMsg->protocolIEs.list.array[arrIdx]->id)
{
- case ProtocolIE_IDE2_id_GlobalRIC_ID:
- {
- /* To store the Ric Id Params */
- recvBufLen = sizeof(e2SetRspMsg->protocolIEs.list.array[idx]->value\
- .choice.GlobalRIC_ID.pLMN_Identity.size);
- e2apMsgDb.plmn = NULLP;
- DU_ALLOC(e2apMsgDb.plmn, recvBufLen);
- if(e2apMsgDb.plmn)
- {
- memcpy(e2apMsgDb.plmn, e2SetRspMsg->protocolIEs.list.array[idx]\
- ->value.choice.GlobalRIC_ID.pLMN_Identity.buf, recvBufLen);
- free(e2SetRspMsg->protocolIEs.list.array[idx]->value.choice.\
- GlobalRIC_ID.pLMN_Identity.buf);
- }
- bitStringToInt(&e2SetRspMsg->protocolIEs.list.array[idx]->value.choice.GlobalRIC_ID.ric_ID, &e2apMsgDb.ricId);
- free(e2SetRspMsg->protocolIEs.list.array[idx]->value.choice.\
- GlobalRIC_ID.ric_ID.buf);
- /*TODO : e2apMsgDb.plmn memory to be deallocated after the usage */
- break;
- }
- default:
- DU_LOG("\nERROR --> E2AP : Invalid IE received in E2SetupRsp:%ld",
- e2SetRspMsg->protocolIEs.list.array[idx]->id);
- break;
+ case ProtocolIE_IDE2_id_TransactionID:
+ {
+ transId = e2SetRspMsg->protocolIEs.list.array[arrIdx]->value.choice.TransactionID;
+ if((duCb.e2apDb.e2TransInfo.onGoingTransaction[transId].transactionId == transId) &&\
+ (duCb.e2apDb.e2TransInfo.onGoingTransaction[transId].procedureCode == e2apMsg->choice.successfulOutcome->procedureCode))
+ memset(&duCb.e2apDb.e2TransInfo.onGoingTransaction[transId], 0, sizeof(E2TransInfo));
+ else
+ {
+ DU_LOG("\nERROR --> E2AP : Invalid transaction id [%d]", transId);
+ return RFAILED;
+ }
+ break;
+ }
+
+ case ProtocolIE_IDE2_id_GlobalRIC_ID:
+ {
+ /* To store the Ric Id Params */
+ recvBufLen = sizeof(e2SetRspMsg->protocolIEs.list.array[arrIdx]->value\
+ .choice.GlobalRIC_ID.pLMN_Identity.size);
+ memcpy(&duCb.e2apDb.ricId.plmnId, e2SetRspMsg->protocolIEs.list.array[arrIdx]\
+ ->value.choice.GlobalRIC_ID.pLMN_Identity.buf, recvBufLen);
+ bitStringToInt(&e2SetRspMsg->protocolIEs.list.array[arrIdx]->value.choice.GlobalRIC_ID.ric_ID, &duCb.e2apDb.ricId);
+ /*TODO : duCb.e2apDb.ricId.plmnId memory to be deallocated after the usage */
+ break;
+ }
+
+ case ProtocolIE_IDE2_id_E2nodeComponentConfigAdditionAck:
+ break;
+
+ default:
+ DU_LOG("\nERROR --> E2AP : Invalid IE received in E2SetupRsp:%ld",
+ e2SetRspMsg->protocolIEs.list.array[arrIdx]->id);
+ break;
}
- free(e2SetRspMsg->protocolIEs.list.array[idx]);
}
- free(e2SetRspMsg->protocolIEs.list.array);
+ freeAperDecodingOfE2SetupRsp(e2SetRspMsg);
+
+ node = searchE2NodeComponentInfo(F1, E2_NODE_COMPONENT_ADD);
+ if(!node)
+ {
+ DU_LOG("\nERROR --> E2AP : Received e2NodeComponentInfo is null");
+ return RFAILED;
+ }
+ else
+ {
+ e2NodeComponentInfo = (E2NodeComponent*)node->node;
+ cmLListDelFrm(&duCb.e2apDb.e2NodeComponentList, node);
+ DU_FREE(e2NodeComponentInfo->componentRequestPart, e2NodeComponentInfo->reqBufSize);
+ DU_FREE(e2NodeComponentInfo->componentResponsePart, e2NodeComponentInfo->rspBufSize);
+ DU_FREE(e2NodeComponentInfo, sizeof(E2NodeComponent));
+ DU_FREE(node, sizeof(CmLList));
+ }
+
+ BuildAndSendE2NodeConfigUpdate();
return ROK;
}
uint8_t idx;
uint8_t ied;
uint8_t ret = ROK;
- uint32_t recvBufLen;
+ CmLList *ricSubscriptionNode = NULLP;
RICsubscriptionRequest_t *ricSubsReq;
+ RicSubscription *ricSubscriptionInfo;
RICaction_ToBeSetup_ItemIEs_t *actionItem;
DU_LOG("\nINFO --> E2AP : RIC Subscription request received");
{
if(ricSubsReq->protocolIEs.list.array[idx])
{
- switch(ricSubsReq->protocolIEs.list.array[idx]->id)
- {
- case ProtocolIE_IDE2_id_RICrequestID:
- {
- e2apMsgDb.ricReqId = ricSubsReq->protocolIEs.list.array[idx]->\
- value.choice.RICrequestID.ricRequestorID;
- e2apMsgDb.ricInstanceId = ricSubsReq->protocolIEs.list.array[idx]-> \
- value.choice.RICrequestID.ricInstanceID;
- break;
- }
- case ProtocolIE_IDE2_id_RANfunctionID:
- {
- e2apMsgDb.ranFuncId = ricSubsReq->protocolIEs.list.array[idx]-> \
- value.choice.RANfunctionID;
- break;
- }
- case ProtocolIE_IDE2_id_RICsubscriptionDetails:
- {
- recvBufLen = sizeof(ricSubsReq->protocolIEs.list.array[idx]->value\
- .choice.RICsubscriptionDetails.ricEventTriggerDefinition.size);
- e2apMsgDb.ricEventTrigger = NULLP;
- DU_ALLOC(e2apMsgDb.ricEventTrigger, recvBufLen);
- /*TODO : e2apMsgDb.ricEventTrigger memory to be deallocated after the usage */
- if(e2apMsgDb.ricEventTrigger)
- {
- memcpy(e2apMsgDb.ricEventTrigger, ricSubsReq->protocolIEs.list.array[idx]\
- ->value.choice.RICsubscriptionDetails.ricEventTriggerDefinition.buf, \
- recvBufLen);
- free(ricSubsReq->protocolIEs.list.array[idx]->value.choice.\
- RICsubscriptionDetails.ricEventTriggerDefinition.buf);
- }
- if(ricSubsReq->protocolIEs.list.array[idx]->value.choice.RICsubscriptionDetails.ricAction_ToBeSetup_List.\
- list.array)
- {
- actionItem =(RICaction_ToBeSetup_ItemIEs_t *)ricSubsReq->protocolIEs.list\
- .array[idx]->value.choice.RICsubscriptionDetails.ricAction_ToBeSetup_List\
- .list.array[0];
-
- for(ied = 0; ied < ricSubsReq->protocolIEs.list.array[idx]->value.choice.\
- RICsubscriptionDetails.ricAction_ToBeSetup_List.list.count; ied++)
- {
- switch(actionItem->id)
- {
- case ProtocolIE_IDE2_id_RICaction_ToBeSetup_Item:
- {
- e2apMsgDb.ricActionId = actionItem->value.choice.RICaction_ToBeSetup_Item.ricActionID;
- e2apMsgDb.ricActionType = actionItem->value.choice.RICaction_ToBeSetup_Item.ricActionType;
- break;
- }
- default:
- DU_LOG("\nERROR --> E2AP : Invalid IE received in RicSetupLst:%ld",actionItem->id);
- break;
- }
- free(actionItem);
- }
- free(ricSubsReq->protocolIEs.list.array[idx]->value.choice.RICsubscriptionDetails.ricAction_ToBeSetup_List.\
- list.array);
- }
- break;
- }
-
- default:
- DU_LOG("\nERROR --> E2AP : Invalid IE received in RIC SubsReq:%ld",
- ricSubsReq->protocolIEs.list.array[idx]->id);
- break;
- }
- free(ricSubsReq->protocolIEs.list.array[idx]);
+ switch(ricSubsReq->protocolIEs.list.array[idx]->id)
+ {
+ case ProtocolIE_IDE2_id_RICrequestID:
+ {
+ /* TODO :- ricSubscriptionInfo details will be stored based on
+ * RAN function id, so first we need to search RAN function and then add
+ * subscription details to that ran function */
+ DU_ALLOC(ricSubscriptionInfo, sizeof(RicSubscription));
+ if(!ricSubscriptionInfo)
+ {
+ DU_LOG("\nERROR --> E2AP : Memory allocation failed for ricSubscriptionInfo");
+ return RFAILED;
+ }
+ ricSubscriptionInfo->requestId.requestorId = ricSubsReq->protocolIEs.list.array[idx]->value.choice.RICrequestID.ricRequestorID;
+ ricSubscriptionInfo->requestId.instanceId = ricSubsReq->protocolIEs.list.array[idx]->value.choice.RICrequestID.ricInstanceID;
+ DU_ALLOC(ricSubscriptionNode, sizeof(CmLList));
+ if(ricSubscriptionNode)
+ {
+ ricSubscriptionNode->node = (PTR) ricSubscriptionInfo;
+ cmLListAdd2Tail(&duCb.e2apDb.ranFunction[0].subscriptionList,ricSubscriptionNode);
+ }
+ break;
+ }
+ case ProtocolIE_IDE2_id_RANfunctionID:
+ {
+ duCb.e2apDb.ranFunction[0].id = ricSubsReq->protocolIEs.list.array[idx]-> \
+ value.choice.RANfunctionID;
+ break;
+ }
+ case ProtocolIE_IDE2_id_RICsubscriptionDetails:
+ {
+ if(ricSubsReq->protocolIEs.list.array[idx]->value.choice.RICsubscriptionDetails.ricAction_ToBeSetup_List.\
+ list.array)
+ {
+ actionItem =(RICaction_ToBeSetup_ItemIEs_t *)ricSubsReq->protocolIEs.list\
+ .array[idx]->value.choice.RICsubscriptionDetails.ricAction_ToBeSetup_List\
+ .list.array[0];
+
+ for(ied = 0; ied < ricSubsReq->protocolIEs.list.array[idx]->value.choice.\
+ RICsubscriptionDetails.ricAction_ToBeSetup_List.list.count; ied++)
+ {
+ switch(actionItem->id)
+ {
+ case ProtocolIE_IDE2_id_RICaction_ToBeSetup_Item:
+ {
+ ricSubscriptionInfo->actionSequence[0].id = actionItem->value.choice.RICaction_ToBeSetup_Item.ricActionID;
+ ricSubscriptionInfo->actionSequence[0].type = actionItem->value.choice.RICaction_ToBeSetup_Item.ricActionType;
+ break;
+ }
+ default:
+ DU_LOG("\nERROR --> E2AP : Invalid IE received in RicSetupLst:%ld",actionItem->id);
+ break;
+ }
+ free(actionItem);
+ }
+ free(ricSubsReq->protocolIEs.list.array[idx]->value.choice.RICsubscriptionDetails.ricAction_ToBeSetup_List.\
+ list.array);
+ }
+ break;
+ }
+
+ default:
+ DU_LOG("\nERROR --> E2AP : Invalid IE received in RIC SubsReq:%ld",
+ ricSubsReq->protocolIEs.list.array[idx]->id);
+ break;
+ }
+ free(ricSubsReq->protocolIEs.list.array[idx]);
}
}
free(ricSubsReq->protocolIEs.list.array);
ret = BuildAndSendRicSubscriptionRsp();
+ {
+ BuildAndSendRicIndication(ricSubscriptionInfo);
+ }
return ret;
}
* RFAILED - failure
*
******************************************************************/
-uint8_t FillRicIndication(RICindication_t *ricIndicationMsg)
+uint8_t FillRicIndication(RICindication_t *ricIndicationMsg, RicSubscription *ricSubscriptionInfo)
{
uint8_t elementCnt=0;
uint8_t idx=0;
ricIndicationMsg->protocolIEs.list.array[idx]->criticality = CriticalityE2_reject;
ricIndicationMsg->protocolIEs.list.array[idx]->value.present = \
RICindication_IEs__value_PR_RICrequestID;
- ricIndicationMsg->protocolIEs.list.array[idx]->value.choice.RICrequestID.ricRequestorID =\
- e2apMsgDb.ricReqId;
- ricIndicationMsg->protocolIEs.list.array[idx]->value.choice.RICrequestID.ricInstanceID =\
- e2apMsgDb.ricInstanceId;
+ ricIndicationMsg->protocolIEs.list.array[idx]->value.choice.RICrequestID.ricRequestorID =ricSubscriptionInfo->requestId.requestorId;
+ ricIndicationMsg->protocolIEs.list.array[idx]->value.choice.RICrequestID.ricInstanceID = ricSubscriptionInfo->requestId.instanceId;
idx++;
ricIndicationMsg->protocolIEs.list.array[idx]->id = ProtocolIE_IDE2_id_RANfunctionID;
ricIndicationMsg->protocolIEs.list.array[idx]->criticality = CriticalityE2_reject;
ricIndicationMsg->protocolIEs.list.array[idx]->value.present = \
RICindication_IEs__value_PR_RANfunctionID;
- ricIndicationMsg->protocolIEs.list.array[idx]->value.choice.RANfunctionID =
- e2apMsgDb.ranFuncId;
+ ricIndicationMsg->protocolIEs.list.array[idx]->value.choice.RANfunctionID = duCb.e2apDb.ranFunction[0].id;
idx++;
ricIndicationMsg->protocolIEs.list.array[idx]->id = ProtocolIE_IDE2_id_RICactionID;
ricIndicationMsg->protocolIEs.list.array[idx]->criticality = CriticalityE2_reject;
ricIndicationMsg->protocolIEs.list.array[idx]->value.present = \
RICindication_IEs__value_PR_RICactionID;
- ricIndicationMsg->protocolIEs.list.array[idx]->value.choice.RICactionID =
- e2apMsgDb.ricActionId;
+ ricIndicationMsg->protocolIEs.list.array[idx]->value.choice.RICactionID = ricSubscriptionInfo->actionSequence[0].id;
idx++;
ricIndicationMsg->protocolIEs.list.array[idx]->id = ProtocolIE_IDE2_id_RICindicationType;
ricIndicationMsg->protocolIEs.list.array[idx]->criticality = CriticalityE2_reject;
ricIndicationMsg->protocolIEs.list.array[idx]->value.present = \
RICindication_IEs__value_PR_RICindicationType;
- ricIndicationMsg->protocolIEs.list.array[idx]->value.choice.RICindicationType =
- e2apMsgDb.ricActionType;
+ ricIndicationMsg->protocolIEs.list.array[idx]->value.choice.RICindicationType = ricSubscriptionInfo->actionSequence[0].type;
idx++;
ricIndicationMsg->protocolIEs.list.array[idx]->id = ProtocolIE_IDE2_id_RICindicationHeader;
*
******************************************************************/
-uint8_t BuildAndSendRicIndication()
+uint8_t BuildAndSendRicIndication(RicSubscription *ricSubscriptionInfo)
{
E2AP_PDU_t *e2apMsg = NULLP;
RICindication_t *ricIndicationMsg=NULLP;
ricIndicationMsg = &e2apMsg->choice.initiatingMessage->value.choice.RICindication;
- FillRicIndicationret = FillRicIndication(ricIndicationMsg);
+ FillRicIndicationret = FillRicIndication(ricIndicationMsg, ricSubscriptionInfo);
if(FillRicIndicationret != ROK)
{
break;
else
{
DU_LOG("\nDEBUG --> E2AP : Created APER encoded buffer for RIC Indication Message \n");
+#ifdef DEBUG_ASN_PRINT
for(int i=0; i< encBufSize; i++)
{
printf("%x",encBuf[i]);
}
+#endif
}
- if(SendE2APMsg(DU_APP_MEM_REGION, DU_POOL) != ROK)
+ if(SendE2APMsg(DU_APP_MEM_REGION, DU_POOL, encBuf, encBufSize) != ROK)
{
DU_LOG("\nINFO --> E2AP : Sending RIC Indication Message");
/*******************************************************************
*
- * @brief Sends E2 msg over SCTP
+ * @brief Deallocate the memory allocated for E2nodeConfigurationUpdate msg
+ *
+ * @details
+ *
+ * Function : FreeE2NodeConfigUpdate
+ *
+ * Functionality:
+ * - freeing the memory allocated for E2nodeConfigurationUpdate
+ *
+ * @params[in] E2AP_PDU_t *e2apMsg
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+void FreeE2NodeConfigUpdate(E2AP_PDU_t *e2apMsg)
+{
+ uint8_t arrIdx =0;
+ E2nodeConfigurationUpdate_t *e2NodeConfigUpdate;
+
+ if(e2apMsg != NULLP)
+ {
+ if(e2apMsg->choice.initiatingMessage != NULLP)
+ {
+ e2NodeConfigUpdate = &e2apMsg->choice.initiatingMessage->value.choice.E2nodeConfigurationUpdate;
+ if(e2NodeConfigUpdate->protocolIEs.list.array != NULLP)
+ {
+ for(arrIdx = 0; arrIdx < e2NodeConfigUpdate->protocolIEs.list.count; arrIdx++)
+ {
+ DU_FREE(e2NodeConfigUpdate->protocolIEs.list.array[arrIdx], sizeof(E2nodeConfigurationUpdate_IEs_t));
+ }
+ DU_FREE(e2NodeConfigUpdate->protocolIEs.list.array, e2NodeConfigUpdate->protocolIEs.list.size);
+ }
+ DU_FREE(e2apMsg->choice.initiatingMessage, sizeof(InitiatingMessageE2_t));
+ }
+ DU_FREE(e2apMsg, sizeof(E2AP_PDU_t));
+ }
+}
+
+/*******************************************************************
+ *
+ * @brief Buld and send the E2 node config update msg
+ *
+ * @details
+ *
+ * Function : BuildAndSendE2NodeConfigUpdate
+ *
+ * Functionality:
+ * - Buld and send the E2 node config update msg
+ *
+ * @params[in]
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+
+uint8_t BuildAndSendE2NodeConfigUpdate()
+{
+ uint8_t arrIdx = 0,elementCnt = 1;
+ uint8_t ret = ROK;
+ E2AP_PDU_t *e2apMsg = NULLP;
+ E2nodeConfigurationUpdate_t *e2NodeConfigUpdate = NULLP;
+ asn_enc_rval_t encRetVal; /* Encoder return value */
+
+ DU_LOG("\nINFO --> E2AP : Building E2 Node config update\n");
+ do
+ {
+ DU_ALLOC(e2apMsg, sizeof(E2AP_PDU_t));
+ if(e2apMsg == NULLP)
+ {
+ DU_LOG("\nERROR --> E2AP : Memory allocation for E2AP-PDU failed");
+ break;
+ }
+ e2apMsg->present = E2AP_PDU_PR_initiatingMessage;
+ DU_ALLOC(e2apMsg->choice.initiatingMessage, sizeof(InitiatingMessageE2_t));
+ if(e2apMsg->choice.initiatingMessage == NULLP)
+ {
+ DU_LOG("\nERROR --> E2AP : Memory allocation for E2AP-PDU failed");
+ DU_FREE(e2apMsg, sizeof(E2AP_PDU_t));
+ return RFAILED;
+ }
+ e2apMsg->choice.initiatingMessage->criticality = CriticalityE2_reject;
+ e2apMsg->choice.initiatingMessage->procedureCode = ProcedureCodeE2_id_E2nodeConfigurationUpdate;
+ e2apMsg->choice.initiatingMessage->value.present = \
+ InitiatingMessageE2__value_PR_E2nodeConfigurationUpdate;
+ e2NodeConfigUpdate = &e2apMsg->choice.initiatingMessage->value.choice.E2nodeConfigurationUpdate;
+
+ e2NodeConfigUpdate->protocolIEs.list.count = elementCnt;
+ e2NodeConfigUpdate->protocolIEs.list.size = elementCnt * sizeof(E2nodeConfigurationUpdate_IEs_t*);
+ /* Initialize the Ric Indication members */
+ DU_ALLOC(e2NodeConfigUpdate->protocolIEs.list.array, \
+ e2NodeConfigUpdate->protocolIEs.list.size);
+ if(e2NodeConfigUpdate->protocolIEs.list.array == NULLP)
+ {
+ DU_LOG("\nERROR --> E2AP : Memory allocation for e2NodeConfigUpdate failed");
+ break;
+ }
+
+ for(arrIdx =0; arrIdx<elementCnt; arrIdx++)
+ {
+ DU_ALLOC(e2NodeConfigUpdate->protocolIEs.list.array[arrIdx], sizeof(E2nodeConfigurationUpdate_IEs_t));
+ if(e2NodeConfigUpdate->protocolIEs.list.array[arrIdx] == NULLP)
+ {
+
+ DU_LOG("\nERROR --> E2AP : Memory allocation for e2NodeConfigUpdate failed");
+ break;
+ }
+ }
+
+ arrIdx = 0;
+ /* TransactionID */
+ e2NodeConfigUpdate->protocolIEs.list.array[arrIdx]->id = ProtocolIE_IDE2_id_TransactionID;
+ e2NodeConfigUpdate->protocolIEs.list.array[arrIdx]->criticality = CriticalityE2_reject;
+ e2NodeConfigUpdate->protocolIEs.list.array[arrIdx]->value.present = E2nodeConfigurationUpdate_IEs__value_PR_TransactionID;
+ e2NodeConfigUpdate->protocolIEs.list.array[arrIdx]->value.choice.TransactionID = TRANS_ID;
+
+
+ /* Prints the Msg formed */
+ xer_fprint(stdout, &asn_DEF_E2AP_PDU, e2apMsg);
+
+ memset(encBuf, 0, ENC_BUF_MAX_LEN);
+ encBufSize = 0;
+ encRetVal = aper_encode(&asn_DEF_E2AP_PDU, 0, e2apMsg, PrepFinalEncBuf,\
+ encBuf);
+ if(encRetVal.encoded == ENCODE_FAIL)
+ {
+ DU_LOG("\nERROR --> E2AP : Could not encode E2nodeConfigurationUpdate structure (at %s)\n",\
+ encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
+ break;
+ }
+ else
+ {
+ DU_LOG("\nDEBUG --> E2AP : Created APER encoded buffer for E2nodeConfigurationUpdate\n");
+#ifdef DEBUG_ASN_PRINT
+ for(int i=0; i< encBufSize; i++)
+ {
+ printf("%x",encBuf[i]);
+ }
+#endif
+ }
+ if(SendE2APMsg(DU_APP_MEM_REGION, DU_POOL, encBuf, encBufSize))
+ {
+ DU_LOG("\nERROR --> E2AP : Sending E2 node config update failed");
+ return RFAILED;
+ }
+
+ break;
+ }while(true);
+
+ FreeE2NodeConfigUpdate(e2apMsg);
+ return ret;
+}
+
+/*******************************************************************
+ *
+ * @brief Deallocate the memory allocated for E2ResetRequest msg
*
* @details
*
- * Function : SendE2APMsg
+ * Function : FreeE2ResetRequest
*
- * Functionality: Sends E2 msg over SCTP
+ * Functionality:
+ * - freeing the memory allocated for E2ResetRequest
*
- * @params[in] Region region
- * Pool pool
+ * @params[in] E2AP_PDU_t *e2apMsg
* @return ROK - success
* RFAILED - failure
*
* ****************************************************************/
+void FreeE2ResetRequest(E2AP_PDU_t *e2apMsg)
+{
+ uint8_t ieIdx =0;
+ ResetRequestE2_t *resetReq = NULLP;
-uint8_t SendE2APMsg(Region region, Pool pool)
+ if(e2apMsg != NULLP)
+ {
+ if(e2apMsg->choice.initiatingMessage != NULLP)
+ {
+ resetReq = &e2apMsg->choice.initiatingMessage->value.choice.ResetRequestE2;
+ if(resetReq->protocolIEs.list.array)
+ {
+ for(ieIdx = 0; ieIdx < resetReq->protocolIEs.list.count; ieIdx++)
+ {
+ DU_FREE(resetReq->protocolIEs.list.array[ieIdx], sizeof(ResetRequestIEs_t));
+ }
+ DU_FREE(resetReq->protocolIEs.list.array, resetReq->protocolIEs.list.size);
+ }
+ DU_FREE(e2apMsg->choice.initiatingMessage, sizeof(InitiatingMessageE2_t));
+ }
+ DU_FREE(e2apMsg, sizeof(E2AP_PDU_t));
+ }
+}
+
+/*******************************************************************
+ *
+ * @brief Build and send the E2 reset request msg
+ *
+ * @details
+ *
+ * Function : BuildAndSendE2ResetRequest
+ *
+ * Functionality:
+ * - Buld and send the E2 reset request msg to RIC
+ *
+ * @params[in]
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t BuildAndSendE2ResetRequest(E2CauseType failureType, E2Cause failureCause)
{
- Buffer *mBuf=NULLP;
+ uint8_t ieIdx = 0, elementCnt = 0, transId = 0;
+ uint8_t ret = RFAILED;
+ E2AP_PDU_t *e2apMsg = NULLP;
+ ResetRequestE2_t *resetReq = NULLP;
+ asn_enc_rval_t encRetVal; /* Encoder return value */
+
+ DU_LOG("\nINFO --> E2AP : Building E2 Reset Request\n");
- if(ODU_GET_MSG_BUF(region, pool, &mBuf) == ROK)
+ do
{
- if(ODU_ADD_POST_MSG_MULT((Data *)encBuf, encBufSize, mBuf) == ROK)
+ DU_ALLOC(e2apMsg, sizeof(E2AP_PDU_t));
+ if(e2apMsg == NULLP)
{
- ODU_PRINT_MSG(mBuf, 0,0);
+ DU_LOG("\nERROR --> E2AP : BuildAndSendE2ResetRequest(): Memory allocation for E2AP-PDU failed");
+ break;
+ }
- if(sctpSend(mBuf, E2_INTERFACE) != ROK)
- {
- DU_LOG("\nERROR --> E2AP : SCTP Send for E2 failed");
- ODU_PUT_MSG_BUF(mBuf);
- return RFAILED;
- }
+ e2apMsg->present = E2AP_PDU_PR_initiatingMessage;
+ DU_ALLOC(e2apMsg->choice.initiatingMessage, sizeof(InitiatingMessageE2_t));
+ if(e2apMsg->choice.initiatingMessage == NULLP)
+ {
+ DU_LOG("\nERROR --> E2AP : BuildAndSendE2ResetRequest(): Memory allocation for initiatingMessage");
+ break;
+ }
+
+ e2apMsg->choice.initiatingMessage->procedureCode = ProcedureCodeE2_id_Reset;
+ e2apMsg->choice.initiatingMessage->criticality = CriticalityE2_reject;
+ e2apMsg->choice.initiatingMessage->value.present = InitiatingMessageE2__value_PR_ResetRequestE2;
+ resetReq = &e2apMsg->choice.initiatingMessage->value.choice.ResetRequestE2;
+
+ elementCnt = 2;
+ resetReq->protocolIEs.list.count = elementCnt;
+ resetReq->protocolIEs.list.size = elementCnt * sizeof(ResetRequestIEs_t *);
+
+ DU_ALLOC(resetReq->protocolIEs.list.array, resetReq->protocolIEs.list.size);
+ if(!resetReq->protocolIEs.list.array)
+ {
+ DU_LOG("\nERROR --> E2AP : BuildAndSendE2ResetRequest(): Memory allocation failed for \
+ Reset Request IE array");
+ break;
+ }
+
+ for(ieIdx = 0; ieIdx < elementCnt; ieIdx++)
+ {
+ DU_ALLOC(resetReq->protocolIEs.list.array[ieIdx], sizeof(ResetRequestIEs_t));
+ if(!resetReq->protocolIEs.list.array[ieIdx])
+ {
+ DU_LOG("\nERROR --> E2AP : BuildAndSendE2ResetRequest(): Memory allocation failed for \
+ Reset Request IE array element");
+ break;
+ }
+ }
+
+ /* In case of failure */
+ if(ieIdx < elementCnt)
+ break;
+
+ ieIdx = 0;
+ resetReq->protocolIEs.list.array[ieIdx]->id = ProtocolIE_IDE2_id_TransactionID;
+ resetReq->protocolIEs.list.array[ieIdx]->criticality = CriticalityE2_reject;
+ resetReq->protocolIEs.list.array[ieIdx]->value.present = ResetRequestIEs__value_PR_TransactionID;
+ transId = assignTransactionId();
+ resetReq->protocolIEs.list.array[ieIdx]->value.choice.TransactionID = transId;
+
+ ieIdx++;
+ resetReq->protocolIEs.list.array[ieIdx]->id = ProtocolIE_IDE2_id_CauseE2;
+ resetReq->protocolIEs.list.array[ieIdx]->criticality = CriticalityE2_ignore;
+ resetReq->protocolIEs.list.array[ieIdx]->value.present = ResetRequestIEs__value_PR_CauseE2;
+ resetReq->protocolIEs.list.array[ieIdx]->value.choice.CauseE2.present = failureType;
+ switch(resetReq->protocolIEs.list.array[ieIdx]->value.choice.CauseE2.present)
+ {
+ case CauseE2_PR_NOTHING:
+ break;
+ case CauseE2_PR_ricRequest:
+ resetReq->protocolIEs.list.array[ieIdx]->value.choice.CauseE2.choice.ricRequest = failureCause;
+ break;
+ case CauseE2_PR_ricService:
+ resetReq->protocolIEs.list.array[ieIdx]->value.choice.CauseE2.choice.ricService = failureCause;
+ break;
+ case CauseE2_PR_e2Node:
+ resetReq->protocolIEs.list.array[ieIdx]->value.choice.CauseE2.choice.e2Node = failureCause;
+ break;
+ case CauseE2_PR_transport:
+ resetReq->protocolIEs.list.array[ieIdx]->value.choice.CauseE2.choice.transport = failureCause;
+ break;
+ case CauseE2_PR_protocol:
+ resetReq->protocolIEs.list.array[ieIdx]->value.choice.CauseE2.choice.protocol = failureCause;
+ break;
+ case CauseE2_PR_misc:
+ resetReq->protocolIEs.list.array[ieIdx]->value.choice.CauseE2.choice.misc = failureCause;
+ break;
+ }
+
+ /* Prints the Msg formed */
+ xer_fprint(stdout, &asn_DEF_E2AP_PDU, e2apMsg);
+
+ memset(encBuf, 0, ENC_BUF_MAX_LEN);
+ encBufSize = 0;
+ encRetVal = aper_encode(&asn_DEF_E2AP_PDU, 0, e2apMsg, PrepFinalEncBuf,\
+ encBuf);
+ if(encRetVal.encoded == ENCODE_FAIL)
+ {
+ DU_LOG("\nERROR --> E2AP : Could not encode E2SetupRequest structure (at %s)\n",\
+ encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
+ break;
}
else
{
- DU_LOG("\nERROR --> E2AP : ODU_ADD_POST_MSG_MULT failed");
- ODU_PUT_MSG_BUF(mBuf);
- return RFAILED;
+ DU_LOG("\nDEBUG --> E2AP : Created APER encoded buffer for E2SetupRequest\n");
+#ifdef DEBUG_ASN_PRINT
+ for(int i=0; i< encBufSize; i++)
+ {
+ printf("%x",encBuf[i]);
+ }
+#endif
+ }
+ if(SendE2APMsg(DU_APP_MEM_REGION, DU_POOL, encBuf, encBufSize) != ROK)
+ {
+ DU_LOG("\nERROR --> E2AP : Sending E2 Setup request failed");
+ break;
+ }
+
+ /* In case the message is sent successfully, store the transaction info to
+ * be used when response is received */
+ duCb.e2apDb.e2TransInfo.onGoingTransaction[transId].transactionId = transId;
+ duCb.e2apDb.e2TransInfo.onGoingTransaction[transId].procedureCode = e2apMsg->choice.initiatingMessage->procedureCode;
+
+ ret = ROK;
+ break;
+ }while(true);
+
+ /* Free all memory */
+ FreeE2ResetRequest(e2apMsg);
+ return ret;
+}
+
+/*******************************************************************
+ *
+ * @brief Deallocate the memory allocated for Reset Response msg
+ *
+ * @details
+ *
+ * Function : freeAperDecodingOfE2ResetRsp
+ *
+ * Functionality:
+ * - freeing the memory allocated for Reset response
+ *
+ * @params[in] ResetResponseE2_t *resetResponse
+ * @return void
+ *
+ * ****************************************************************/
+void freeAperDecodingOfE2ResetRsp(ResetResponseE2_t *resetResponse)
+{
+ uint8_t ieIdx;
+
+ if(resetResponse)
+ {
+ if(resetResponse->protocolIEs.list.array)
+ {
+ for(ieIdx=0; ieIdx < resetResponse->protocolIEs.list.count; ieIdx++)
+ {
+ if(resetResponse->protocolIEs.list.array[ieIdx])
+ {
+ switch(resetResponse->protocolIEs.list.array[ieIdx]->id)
+ {
+ case ProtocolIE_IDE2_id_TransactionID:
+ break;
+
+ case ProtocolIE_IDE2_id_CriticalityDiagnosticsE2:
+ break;
+ }
+ free(resetResponse->protocolIEs.list.array[ieIdx]);
+ }
+ }
+ free(resetResponse->protocolIEs.list.array);
}
- ODU_PUT_MSG_BUF(mBuf);
}
- else
+}
+
+/******************************************************************
+ *
+ * @brief Processes E2 Reset Response sent by RIC
+ *
+ * @details
+ *
+ * Function : procResetResponse
+ *
+ * Functionality: Processes E2 Reset Response sent by RIC
+ *
+ * @params[in] E2AP_PDU_t ASN decoded E2AP message
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t procResetResponse(E2AP_PDU_t *e2apMsg)
+{
+ uint8_t ieIdx =0, transId;
+ ResetResponseE2_t *resetResponse;
+
+ DU_LOG("\nINFO --> E2AP : E2 Reset Response received");
+ resetResponse = &e2apMsg->choice.successfulOutcome->value.choice.ResetResponseE2;;
+
+ for(ieIdx=0; ieIdx < resetResponse->protocolIEs.list.count; ieIdx++)
{
- DU_LOG("\nERROR --> E2AP : Failed to allocate memory");
- return RFAILED;
+ switch(resetResponse->protocolIEs.list.array[ieIdx]->id)
+ {
+ case ProtocolIE_IDE2_id_TransactionID:
+ transId = resetResponse->protocolIEs.list.array[ieIdx]->value.choice.TransactionID;
+ if((duCb.e2apDb.e2TransInfo.onGoingTransaction[transId].transactionId == transId) && \
+ (duCb.e2apDb.e2TransInfo.onGoingTransaction[transId].procedureCode == e2apMsg->choice.successfulOutcome->procedureCode))
+ memset(&duCb.e2apDb.e2TransInfo.onGoingTransaction[transId], 0, sizeof(E2TransInfo));
+ else
+ {
+ DU_LOG("\nERROR --> E2AP : Invalid transaction id [%d]", transId);
+ return RFAILED;
+ }
+ break;
+ case ProtocolIE_IDE2_id_CriticalityDiagnosticsE2:
+ /* As per ORAN WG3 E2AP spec v3.0, section 9.2.2
+ Criticality Diagnostics IE is sent by Near-RT RIC when parts of a received message i.e.
+ Reset Request in this case, have not been comprehended or were missing, or if the message
+ contained logical errors.
+
+ Processing of this ID should be implemented when negative call flows are to be supported.
+ */
+ break;
+ default:
+ DU_LOG("\nERROR --> E2AP : Invalid IE received in E2 Reset Response : %ld",
+ resetResponse->protocolIEs.list.array[ieIdx]->id);
+ break;
+ }
}
+ freeAperDecodingOfE2ResetRsp(resetResponse);
return ROK;
-} /* SendE2APMsg */
+}
+/******************************************************************
+ *
+ * @brief Deallocation of memory allocated bu aper decoder for e2 setup Failure
+ *
+ * @details
+ *
+ * Function : freeAperDecodingOfE2SetupFailure
+ *
+ * Functionality: Deallocation of memory allocated bu aper decoder for e2
+ * setup Failure
+ *
+ * @params[in] E2setupFailure_t *e2SetupFailure;
+ * @return void
+ *
+ * ****************************************************************/
+void freeAperDecodingOfE2SetupFailure(E2setupFailure_t *e2SetupFailure)
+{
+ uint8_t arrIdx;
+
+ if(e2SetupFailure)
+ {
+ if(e2SetupFailure->protocolIEs.list.array)
+ {
+ for(arrIdx=0; arrIdx<e2SetupFailure->protocolIEs.list.count; arrIdx++)
+ {
+ if(e2SetupFailure->protocolIEs.list.array[arrIdx])
+ {
+ free(e2SetupFailure->protocolIEs.list.array[arrIdx]);
+ }
+ }
+ free(e2SetupFailure->protocolIEs.list.array);
+ }
+ }
+}
+/******************************************************************
+ *
+ * @brief Processes E2 Setup Failure sent by RIC
+ *
+ * @details
+ *
+ * Function : procE2SetupFailure
+ *
+ * Functionality: Processes E2 Setup failure sent by RIC
+ *
+ * @params[in] E2AP_PDU_t ASN decoded E2AP message
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+void procE2SetupFailure(E2AP_PDU_t *e2apMsg)
+{
+ uint8_t arrIdx =0, transId =0, timerValue=0;
+ E2setupFailure_t *e2SetupFailure;
+
+ DU_LOG("\nINFO --> E2AP : E2 Setup failure received");
+ e2SetupFailure = &e2apMsg->choice.unsuccessfulOutcome->value.choice.E2setupFailure;
+
+ for(arrIdx=0; arrIdx<e2SetupFailure->protocolIEs.list.count; arrIdx++)
+ {
+ switch(e2SetupFailure->protocolIEs.list.array[arrIdx]->id)
+ {
+ case ProtocolIE_IDE2_id_TransactionID:
+ {
+ transId = e2SetupFailure->protocolIEs.list.array[arrIdx]->value.choice.TransactionID;
+ if((duCb.e2apDb.e2TransInfo.onGoingTransaction[transId].transactionId == transId) &&\
+ (duCb.e2apDb.e2TransInfo.onGoingTransaction[transId].procedureCode == e2apMsg->choice.unsuccessfulOutcome->procedureCode))
+ memset(&duCb.e2apDb.e2TransInfo.onGoingTransaction[transId], 0, sizeof(E2TransInfo));
+ else
+ {
+ DU_LOG("\nERROR --> E2AP : Invalid transaction id [%d]", transId);
+ return ;
+ }
+ break;
+ }
+ case ProtocolIE_IDE2_id_TimeToWaitE2:
+ {
+ timerValue = covertE2WaitTimerEnumToValue(e2SetupFailure->protocolIEs.list.array[arrIdx]->value.choice.TimeToWaitE2);
+ if((duChkTmr((PTR)&(duCb.e2apDb), EVENT_E2_SETUP_TMR)) == FALSE)
+ {
+ duStartTmr((PTR)&(duCb.e2apDb), EVENT_E2_SETUP_TMR, timerValue);
+ }
+ else
+ {
+ DU_LOG("\nERROR --> E2AP : EVENT_E2_SETUP_TMR timer is already running");
+ return;
+ }
+ break;
+ }
+ }
+ }
+
+ freeAperDecodingOfE2SetupFailure(e2SetupFailure);
+}
/*******************************************************************
*
* @brief Handles received E2AP message and sends back response
return;
}
+#ifdef DEBUG_ASN_PRINT
printf("\nDEBUG --> E2AP : Received flat buffer to be decoded : ");
for(i=0; i< recvBufLen; i++)
{
printf("%x",recvBuf[i]);
}
+#endif
/* Decoding flat buffer into E2AP messsage */
e2apMsg = &e2apasnmsg;
switch(e2apMsg->present)
{
+ case E2AP_PDU_PR_unsuccessfulOutcome:
+ {
+ switch(e2apMsg->choice.unsuccessfulOutcome->value.present)
+ {
+ case UnsuccessfulOutcomeE2__value_PR_E2setupFailure:
+ {
+ procE2SetupFailure(e2apMsg);
+ break;
+ }
+ default:
+ {
+ DU_LOG("\nERROR --> E2AP : Invalid type of E2AP_PDU_PR_unsuccessfulOutcome [%d]",\
+ e2apMsg->choice.unsuccessfulOutcome->value.present);
+ return;
+ }
+ }
+ break;
+ }
case E2AP_PDU_PR_successfulOutcome:
- {
- switch(e2apMsg->choice.successfulOutcome->value.present)
- {
- case SuccessfulOutcomeE2__value_PR_E2setupResponse:
- {
- if(!duCb.e2Status)
- {
- DU_LOG("\nDEBUG --> E2AP : Store E2 setup response Params");
- procE2SetupRsp(e2apMsg);
- }
- break;
- }
- default:
- {
- DU_LOG("\nERROR --> E2AP : Invalid type of E2AP_PDU_PR_successfulOutcome [%d]",\
- e2apMsg->choice.successfulOutcome->value.present);
- return;
- }
- }/* End of switch(successfulOutcome) */
- free(e2apMsg->choice.successfulOutcome);
- break;
- }
+ {
+ switch(e2apMsg->choice.successfulOutcome->value.present)
+ {
+ case SuccessfulOutcomeE2__value_PR_E2setupResponse:
+ {
+ if(!duCb.e2Status)
+ {
+ procE2SetupRsp(e2apMsg);
+ }
+ break;
+ }
+ case SuccessfulOutcomeE2__value_PR_E2nodeConfigurationUpdateAcknowledge:
+ {
+ DU_LOG("\nDEBUG --> E2AP : E2 node Config update ack message recevied");
+ break;
+ }
+ case SuccessfulOutcomeE2__value_PR_ResetResponseE2:
+ {
+ procResetResponse(e2apMsg);
+ break;
+ }
+ default:
+ {
+ DU_LOG("\nERROR --> E2AP : Invalid type of E2AP_PDU_PR_successfulOutcome [%d]",\
+ e2apMsg->choice.successfulOutcome->value.present);
+ return;
+ }
+ }/* End of switch(successfulOutcome) */
+ free(e2apMsg->choice.successfulOutcome);
+ break;
+ }
+
case E2AP_PDU_PR_initiatingMessage:
- {
- switch(e2apMsg->choice.initiatingMessage->value.present)
- {
- case InitiatingMessageE2__value_PR_RICsubscriptionRequest:
- {
- if(procRicSubsReq(e2apMsg) == ROK)
- {
- BuildAndSendRicIndication();
- }
- break;
- }
- default:
- {
- DU_LOG("\nERROR --> E2AP : Invalid type of E2AP_PDU_PR_initiatingMessage [%d]",\
- e2apMsg->choice.initiatingMessage->value.present);
- return;
- }
- }/* End of switch(initiatingMessage) */
- free(e2apMsg->choice.initiatingMessage);
- break;
- }
+ {
+ switch(e2apMsg->choice.initiatingMessage->value.present)
+ {
+ case InitiatingMessageE2__value_PR_RICsubscriptionRequest:
+ {
+ procRicSubsReq(e2apMsg);
+ break;
+ }
+ default:
+ {
+ DU_LOG("\nERROR --> E2AP : Invalid type of E2AP_PDU_PR_initiatingMessage [%d]",\
+ e2apMsg->choice.initiatingMessage->value.present);
+ return;
+ }
+ }/* End of switch(initiatingMessage) */
+ free(e2apMsg->choice.initiatingMessage);
+ break;
+ }
default:
{
DU_LOG("\nERROR --> E2AP : Invalid type of e2apMsg->present [%d]",e2apMsg->present);