Merge "[Epic-ID: ODUHIGH-556][Task-ID: ODUHIGH-570] UL Candidate Sel and Res Alloc...
[o-du/l2.git] / src / du_app / du_sctp.c
index 96f7ada..efee291 100644 (file)
@@ -18,6 +18,7 @@
 
 /* This file contains all SCTP related functionality */
 #include "common_def.h"
+#include "du_tmr.h"
 #include "lrg.h"
 #include "legtp.h"
 #include "lrg.x"
 #include "cm_inet.h"
 #include "cm_inet.x"
 #include "du_app_mac_inf.h"
+#include "du_e2ap_mgr.h"
 #include "du_cfg.h"
 #include "du_sctp.h"
 #include "lsctp.h"
+#include "du_app_rlc_inf.h"
+#include "du_mgr.h"
 #include "du_utils.h"
 
 /**************************************************************************
@@ -78,7 +82,7 @@ uint8_t sctpActvInit(Ent entity, Inst inst, Region region, Reason reason)
 *
 *  @return  void
 ***************************************************************************/
-uint8_t callFlowSctpActvTsk(Pst *pst)
+void callFlowSctpActvTsk(Pst *pst)
 {
    char sourceTask[50];
    char destTask[50]="ENTSCTP";
@@ -567,7 +571,7 @@ void sendToDuApp(Buffer *mBuf, Event event)
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint8_t sctpNtfyHdlr(CmInetSctpNotification *ntfy, uint8_t *itfState)
+uint8_t sctpNtfyHdlr(CmInetSctpNotification *ntfy, uint8_t *itfState, uint8_t interface)
 {
    Pst pst;
 
@@ -613,10 +617,21 @@ uint8_t sctpNtfyHdlr(CmInetSctpNotification *ntfy, uint8_t *itfState)
          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;
@@ -703,13 +718,13 @@ uint8_t  processPolling(sctpSockPollParams *pollParams, CmInetFd *sockFd, uint32
             {
                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
             {
@@ -841,7 +856,7 @@ uint8_t sctpSend(Buffer *mBuf, uint8_t itfType)
 
    if(itfType == F1_INTERFACE)
    {
-      DU_LOG("\nDEBUG   -->  SCTP : sending the message to CU");
+      DU_LOG("\nDEBUG  --> SCTP : sending the message to CU");
 #ifdef CALL_FLOW_DEBUG_LOG
       DU_LOG("\nCall Flow: ENTSCTP -> CU : EVENT_F1AP_MSG_TO_CU\n");
 #endif
@@ -850,7 +865,7 @@ uint8_t sctpSend(Buffer *mBuf, uint8_t itfType)
 
    if(itfType == E2_INTERFACE)
    {
-      DU_LOG("\nDEBUG   -->  SCTP : sending the message to ric");
+      DU_LOG("\nDEBUG  -->  SCTP : sending the message to ric");
 #ifdef CALL_FLOW_DEBUG_LOG
       DU_LOG("\nCall Flow: ENTSCTP -> RIC : EVENT_E2AP_MSG_TO_RIC\n");
 #endif