memset(&duCb.e2apDb.ricId, 0, sizeof(GlobalRicId));
duCb.e2apDb.numOfTNLAssoc = 0;
memset(&duCb.e2apDb.tnlAssoc, 0, MAX_TNL_ASSOCIATION*sizeof(TNLAssociation));
- cmInetClose(&ricParams.sockFd);
memset(&ricParams, 0, sizeof(DuSctpDestCb));
}
/**********************************************************************
#include "du_e2ap_mgr.h"
#include "du_e2ap_msg_hdl.h"
#include "du_cfg.h"
+#include "du_sctp.h"
#include "du_mgr.h"
#include "du_mgr_main.h"
#include "du_utils.h"
}while(true);
FreeE2RemovalResponse(e2apMsg);
- removeE2NodeInformation();
return ret;
}
if((duCb.e2apDb.e2TransInfo.e2InitTransaction[transId].transactionId == transId) &&\
(duCb.e2apDb.e2TransInfo.e2InitTransaction[transId].procedureCode == e2apMsg->choice.unsuccessfulOutcome->procedureCode))
{
- removeE2NodeInformation();
+ DU_LOG("\nINFO --> E2AP : Sending request to close the sctp connection");
+ cmInetClose(&ricParams.sockFd);
memset(&duCb.e2apDb.e2TransInfo.e2InitTransaction[transId], 0, sizeof(E2TransInfo));
+ removeE2NodeInformation();
}
else
{
*
* @details
*
- * Function : handle2ConnectionModification
+ * Function : handleE2ConnectionModification
*
* Functionality: Handling of E2 connection modification Ie
*
- * @param E2AP_PDU_t *e2apMsg
+ * @param
+ * E2 Connection update list
+ * E2 connection list which needs to be filled
* @return void
*
******************************************************************/
-void handle2ConnectionModification(E2connectionUpdate_List_t *connectionUpdateList, E2ConnectionList *connectionInfoList)
+void handleE2ConnectionModification(E2connectionUpdate_List_t *connectionUpdateList, E2ConnectionList *connectionInfoList)
{
uint32_t ipAddress=0;
bool infoFound = false;
}
}
+/*******************************************************************
+ *
+ * @brief Handling of E2 connection removal Ie
+ *
+ * @details
+ *
+ * Function : handleE2ConnectionRemoval
+ *
+ * Functionality: Handling of E2 connection removal Ie
+ *
+ * @param
+ * E2 Connection removal List
+ * @return void
+ *
+ ******************************************************************/
+
+void handleE2ConnectionRemoval(E2connectionUpdateRemove_List_t *connectionRemovalList)
+{
+ uint32_t ipAddress=0;
+ uint8_t arrIdx=0,idx=0;
+ E2connectionUpdateRemove_ItemIEs_t *connectionRemovalItem=NULLP;
+
+ if(connectionRemovalList->list.array)
+ {
+ for(arrIdx = 0; arrIdx < connectionRemovalList->list.count; arrIdx++)
+ {
+ connectionRemovalItem= (E2connectionUpdateRemove_ItemIEs_t*)connectionRemovalList->list.array[arrIdx];
+ bitStringToInt(&connectionRemovalItem->value.choice.E2connectionUpdateRemove_Item.tnlInformation.tnlAddress, &ipAddress);
+ for(idx=0; idx<duCb.e2apDb.numOfTNLAssoc; idx++)
+ {
+ if(duCb.e2apDb.tnlAssoc[idx].destIpAddress.ipV4Addr == ipAddress)
+ {
+ cmInetClose(&ricParams.sockFd);
+ removeE2NodeInformation();
+ break;
+ }
+ }
+
+ }
+ }
+}
+
/*******************************************************************
*
* @brief Process e2 connection update received from RIC
void procE2ConnectionUpdate(E2AP_PDU_t *e2apMsg)
{
- bool invalidTransId = false, connectionFailedToUpdate=false;
uint8_t arrIdx =0, transId =0;
+ bool invalidTransId = false, connectionFailedToUpdate=false;
E2FailureCause failureCause;
- E2connectionUpdate_t *connectionUpdate=NULLP;
E2ConnectionList connectionInfoList;
+ E2connectionUpdate_t *connectionUpdate=NULLP;
DU_LOG("\nINFO --> E2AP : E2 connection update received");
connectionUpdate = &e2apMsg->choice.initiatingMessage->value.choice.E2connectionUpdate;
case ProtocolIE_IDE2_id_E2connectionUpdateModify:
{
- handle2ConnectionModification(&connectionUpdate->protocolIEs.list.array[arrIdx]->value.choice.E2connectionUpdate_List, &connectionInfoList);
+ handleE2ConnectionModification(&connectionUpdate->protocolIEs.list.array[arrIdx]->value.choice.E2connectionUpdate_List,\
+ &connectionInfoList);
if((connectionInfoList.numOfE2ConnectionSetup == 0) && (connectionInfoList.numOfE2ConnectionFailedToSetup > 0))
{
failureCause.causeType = E2_TRANSPORT;
case ProtocolIE_IDE2_id_E2connectionUpdateRemove:
{
- /*TODO*/
+ handleE2ConnectionRemoval(&connectionUpdate->protocolIEs.list.array[arrIdx]->value.choice.E2connectionUpdateRemove_List);
+ break;
+ }
+
+ default:
+ {
+ DU_LOG("\nERROR --> E2AP : Invalid IE received[%ld]",connectionUpdate->protocolIEs.list.array[arrIdx]->id);
break;
}
}
* RFAILED - failure
*
* ****************************************************************/
-uint8_t sctpNtfyHdlr(CmInetSctpNotification *ntfy, uint8_t *itfState)
+uint8_t sctpNtfyHdlr(CmInetSctpNotification *ntfy, uint8_t *itfState, uint8_t interface)
{
Pst pst;
DU_LOG("\nINFO --> SCTP : Send Failed notification received\n");
break;
case CM_INET_SCTP_SHUTDOWN_EVENT : /* peer socket gracefully closed */
- DU_LOG("\nINFO --> SCTP : Shutdown Event notification received\n");
- *itfState = DU_SCTP_DOWN;
- exit(0);
- break;
+ {
+ DU_LOG("\nINFO --> SCTP : Shutdown Event notification received\n");
+ *itfState = DU_SCTP_DOWN;
+ switch(interface)
+ {
+ case F1_INTERFACE:
+ break;
+ case E2_INTERFACE:
+ removeE2NodeInformation();
+ break;
+ default:
+ exit(0);
+ }
+ break;
+ }
case CM_INET_SCTP_ADAPTATION_INDICATION :
DU_LOG("\nINFO --> SCTP : Adaptation Indication received\n");
break;
{
f1Params.assocId = pollParams->ntfy.u.assocChange.assocId;
DU_LOG("\nDEBUG --> SCTP : AssocId assigned to F1Params from PollParams [%d]\n", f1Params.assocId);
- ret = sctpNtfyHdlr(&pollParams->ntfy, &f1Params.itfState);
+ ret = sctpNtfyHdlr(&pollParams->ntfy, &f1Params.itfState, F1_INTERFACE);
}
else if(pollParams->port == ricParams.destPort)
{
ricParams.assocId = pollParams->ntfy.u.assocChange.assocId;
DU_LOG("\nDEBUG --> SCTP : AssocId assigned to ricParams from PollParams [%d]\n", ricParams.assocId);
- ret = sctpNtfyHdlr(&pollParams->ntfy, &ricParams.itfState);
+ ret = sctpNtfyHdlr(&pollParams->ntfy, &ricParams.itfState, E2_INTERFACE);
}
else
{
}
}
}
+/*******************************************************************
+ *
+ * @brief Delete E2 component node list
+ *
+ * @details
+ *
+ * Function : deleteE2ComponentNodeList
+ *
+ * Functionality: Delete E2 component node list
+ *
+ * @params[in] E2 component node list
+ * @return void
+
+ *
+ ******************************************************************/
+
+void deleteE2ComponentNodeList(CmLListCp *componentList)
+{
+ E2NodeComponent *cfgInfo = NULLP;
+ CmLList *e2ComponentNode = NULLP;
+
+ CM_LLIST_FIRST_NODE(componentList, e2ComponentNode);
+ while(e2ComponentNode)
+ {
+ cfgInfo = (E2NodeComponent*)e2ComponentNode->node;
+ cmLListDelFrm(componentList, e2ComponentNode);
+ memset(cfgInfo, 0, sizeof(E2NodeComponent));
+ CM_LLIST_FIRST_NODE(componentList, e2ComponentNode);
+ }
+}
/*******************************************************************
*
deleteRicSubscriptionList(&ranFuncDb->subscriptionList);
}
}
-
- cmInetClose(&sctpCb.e2LstnSockFd);
+ deleteE2ComponentNodeList(&duDb->e2NodeComponent);
}
/*******************************************************************
{
case ProtocolIE_IDE2_id_TransactionID:
{
+ DU_LOG("\nINFO --> E2AP : Sending request to close the sctp connection");
+ cmInetClose(&sctpCb.e2LstnSockFd);
deleteE2NodeInfo(duDb);
- break;
+ exit(0);
}
default:
{
}while(true);
FreeE2RemovalResponse(e2apMsg);
- deleteE2NodeInfo(duDb);
return ret;
}
}
}
+/*******************************************************************
+ *
+ * @brief process the E2 Connection update ack
+ *
+ * @details
+ *
+ * Function : ProcE2ConnectionUpdateAck
+ *
+ * Functionality: Process E2 Connection update ack
+ *
+ * @params[in]
+ * du Id
+ * Pointer to Connection update ack
+ * @return void
+ *
+ ******************************************************************/
+
+void ProcE2ConnectionUpdateAck(uint32_t duId, E2connectionUpdateAcknowledge_t *connectionUpdateAck)
+{
+ uint16_t transId =0;
+ uint32_t ipAddress=0;
+ DuDb *duDb = NULLP;
+ uint8_t ieIdx = 0, duIdx =0, arrIdx=0;
+ E2connectionUpdate_Item_t *connectionSetupItem=NULLP;
+ E2connectionUpdate_ItemIEs_t *connectionSetupItemIe=NULLP;
+ E2connectionUpdate_List_t *connectionSetupList=NULLP;
+ E2connectionSetupFailed_Item_t *setupFailedItem =NULLP;
+ E2connectionSetupFailed_List_t *setupFailedList=NULLP;
+ E2connectionSetupFailed_ItemIEs_t *setupFailedItemIe =NULLP;
+
+ SEARCH_DU_DB(duIdx, duId, duDb);
+ if(duDb == NULLP)
+ {
+ DU_LOG("\nERROR --> E2AP : duDb is not present for duId %d",duId);
+ return;
+ }
+
+ if(!connectionUpdateAck)
+ {
+ DU_LOG("\nERROR --> E2AP : connectionUpdateAck pointer is null");
+ return;
+ }
+
+ if(!connectionUpdateAck->protocolIEs.list.array)
+ {
+ DU_LOG("\nERROR --> E2AP : connectionUpdateAck array pointer is null");
+ return;
+ }
+
+ for(ieIdx=0; ieIdx < connectionUpdateAck->protocolIEs.list.count; ieIdx++)
+ {
+ if(connectionUpdateAck->protocolIEs.list.array[ieIdx])
+ {
+ switch(connectionUpdateAck->protocolIEs.list.array[ieIdx]->id)
+ {
+ case ProtocolIE_IDE2_id_TransactionID:
+ {
+ transId = connectionUpdateAck->protocolIEs.list.array[arrIdx]->value.choice.TransactionID;
+ if(transId>255)
+ {
+ DU_LOG("\nERROR --> E2AP : Received invalid trans id %d ",transId);
+ return;
+ }
+ break;
+ }
+ case ProtocolIE_IDE2_id_E2connectionSetup:
+ {
+ connectionSetupList=&connectionUpdateAck->protocolIEs.list.array[ieIdx]->value.choice.E2connectionUpdate_List;
+ if(connectionSetupList->list.array)
+ {
+ for(arrIdx = 0; arrIdx< connectionSetupList->list.count; arrIdx++)
+ {
+ connectionSetupItemIe = (E2connectionUpdate_ItemIEs_t*)connectionSetupList->list.array[arrIdx];
+ connectionSetupItem = &connectionSetupItemIe->value.choice.E2connectionUpdate_Item;
+ bitStringToInt(&connectionSetupItem->tnlInformation.tnlAddress, &ipAddress);
+ if(ricCb.ricCfgParams.sctpParams.localIpAddr.ipV4Addr == ipAddress)
+ {
+ ricCb.ricCfgParams.sctpParams.usage = connectionSetupItem->tnlUsage;
+ }
+ }
+ }
+ break;
+ }
+
+ case ProtocolIE_IDE2_id_E2connectionSetupFailed:
+ {
+ setupFailedList=&connectionUpdateAck->protocolIEs.list.array[ieIdx]->value.choice.E2connectionSetupFailed_List;
+ if(setupFailedList->list.array)
+ {
+ for(arrIdx = 0; arrIdx< setupFailedList->list.count; arrIdx++)
+ {
+ setupFailedItemIe = (E2connectionSetupFailed_ItemIEs_t*)setupFailedList->list.array[arrIdx];
+ setupFailedItem = &setupFailedItemIe->value.choice.E2connectionSetupFailed_Item;
+ printE2ErrorCause(&setupFailedItem->cause);
+ }
+ }
+ break;
+ }
+ default:
+ {
+ DU_LOG("\nERROR --> E2AP : Received Invalid Ie [%ld]", connectionUpdateAck->protocolIEs.list.array[ieIdx]->id);
+ break;
+ }
+ }
+ }
+ }
+}
+
/*******************************************************************
*
* @brief Handles received E2AP message and sends back response
ProcE2RemovalResponse(*duId, &e2apMsg->choice.successfulOutcome->value.choice.E2RemovalResponse);
break;
}
+ case SuccessfulOutcomeE2__value_PR_E2connectionUpdateAcknowledge:
+ {
+ ProcE2ConnectionUpdateAck(*duId, &e2apMsg->choice.successfulOutcome->value.choice.E2connectionUpdateAcknowledge);
+ break;
+ }
default:
{
DU_LOG("\nERROR --> E2AP : Invalid type of successfulOutcome message [%d]", \
case CM_INET_SCTP_SHUTDOWN_EVENT : /* peer socket gracefully closed */
DU_LOG("\nINFO --> SCTP : Shutdown Event notification received\n");
assocCb->connUp = FALSE;
+ deleteE2NodeInfo(&ricCb.duInfo[0]);
exit(0);
break;
case CM_INET_SCTP_ADAPTATION_INDICATION :