[Epic-ID: ODUHIGH-406][Task-ID: ODUHIGH-428]Slot Indication at DUAPP
[o-du/l2.git] / src / du_app / du_sctp.c
index f448a57..0f86d64 100644 (file)
 #include "legtp.h"
 #include "lrg.x"
 #include "lkw.x"
+#include "cm_inet.h"
+#include "cm_inet.x"
+#include "du_app_mac_inf.h"
 #include "du_cfg.h"
 #include "du_sctp.h"
 #include "lsctp.h"
-
+#include "du_utils.h"
 
 /**************************************************************************
  * @brief Task Initiation callback function. 
  * @return ROK     - success
  *         RFAILED - failure
  ***************************************************************************/
-S16 sctpActvInit(Ent entity, Inst inst, Region region, Reason reason)
+uint8_t sctpActvInit(Ent entity, Inst inst, Region region, Reason reason)
 {
-   DU_LOG("\n\nSCTP : Initializing");
-   SSetProcId(DU_PROC);
+   DU_LOG("\n\nDEBUG  -->  SCTP : Initializing");
+   ODU_SET_PROC_ID(DU_PROC);
    connUp = FALSE;
+   
+   memset(&f1Params, 0, sizeof(DuSctpDestCb));
    f1Params.assocId = -1;
+   memset(&ricParams, 0, sizeof(DuSctpDestCb));
    ricParams.assocId = -1;
    nonblocking = FALSE;
    return ROK;
 
 }
 
+/**************************************************************************
+* @brief Function prints src, dest, msg infor about all the msgs that received.
+*
+* @details
+*
+*     Function : callFlowSctpActvTsk
+*
+*     Function prints src, dest, msg infor about all the msgs that received
+*
+*  @param[in]  Pst     *pst, Post structure of the primitive.
+*
+*  @return  void
+***************************************************************************/
+void callFlowSctpActvTsk(Pst *pst)
+{
+   char sourceTask[50];
+   char destTask[50]="ENTSCTP";
+   char message[100];
+
+   switch(pst->srcEnt)
+   {
+      case ENTDUAPP:
+         {
+            strcpy(sourceTask,"ENTDUAPP");
+            switch(pst->event)
+            {
+               case EVTSTARTPOLL:
+                  {
+                     strcpy(message,"EVTSTARTPOLL");
+                     break;
+                  }
+            }
+            break;
+         }
+   }
+   DU_LOG("\nCall Flow: %s -> %s : %s\n", sourceTask, destTask, message);
+}
+
 /**************************************************************************
  * @brief Task Activation callback function. 
  *
@@ -78,8 +122,14 @@ S16 sctpActvInit(Ent entity, Inst inst, Region region, Reason reason)
  *         RFAILED - failure
  *
  ***************************************************************************/
-S16 sctpActvTsk(Pst *pst, Buffer *mBuf)
+uint8_t sctpActvTsk(Pst *pst, Buffer *mBuf)
 {
+
+#ifdef CALL_FLOW_DEBUG_LOG
+   callFlowSctpActvTsk(pst);
+#endif
+
+
    switch(pst->srcEnt)
    {
       case ENTDUAPP:
@@ -95,7 +145,7 @@ S16 sctpActvTsk(Pst *pst, Buffer *mBuf)
             break;
          }
    }
-   SExitTsk();
+   ODU_EXIT_TASK();
    return ROK;
 }
 /*******************************************************************
@@ -114,15 +164,15 @@ S16 sctpActvTsk(Pst *pst, Buffer *mBuf)
  *         RFAILED - failure
  *
  ******************************************************************/
-S16 duCheckReqStatus(CmStatus *cfm)
+uint8_t duCheckReqStatus(CmStatus *cfm)
 {
-   S16 ret = ROK;
+   uint8_t ret = ROK;
    if(cfm->status != LCM_PRIM_OK)
    {
-      DU_LOG("\nDU_APP : Failed to process the request successfully");
+      DU_LOG("\nERROR  -->  DU_APP : Failed to process the request successfully");
       ret = RFAILED;
    }
-   RETVALUE(ret); 
+   return (ret); 
 }
 
 /**************************************************************************
@@ -144,11 +194,14 @@ S16 duCheckReqStatus(CmStatus *cfm)
  *
  ***************************************************************************/
 
-S16 duSctpCfgReq(SctpParams sctpCfg)
+uint8_t duSctpCfgReq(SctpParams sctpCfg)
 {
-   S16 ret = ROK;
-       CmStatus cfm;
+   uint8_t  ret = ROK;
+   CmStatus cfm;
 
+#ifdef CALL_FLOW_DEBUG_LOG
+    DU_LOG("\nCall Flow: ENTDUAPP -> ENTSCTP : EVENT_CFG_REQ_TO_SCTP\n");
+#endif
 /* Fill F1 Params */
    f1Params.destIpAddr.ipV4Pres  = sctpCfg.cuIpAddr.ipV4Pres;
    f1Params.destIpAddr.ipV4Addr  = sctpCfg.cuIpAddr.ipV4Addr;
@@ -156,7 +209,7 @@ S16 duSctpCfgReq(SctpParams sctpCfg)
    f1Params.itfState             = DU_SCTP_DOWN;
    f1Params.srcPort              = sctpCfg.duPort[F1_INTERFACE];
    f1Params.recvMsgSet           = ROK;
-   cmMemset ((U8 *)&f1Params.sockFd, -1, sizeof(CmInetFd));
+   memset (&f1Params.sockFd, -1, sizeof(CmInetFd));
    fillDestNetAddr(&f1Params.destIpNetAddr, &f1Params.destIpAddr);
    fillAddrLst(&f1Params.destAddrLst, &f1Params.destIpAddr);
 
@@ -167,7 +220,7 @@ S16 duSctpCfgReq(SctpParams sctpCfg)
    ricParams.itfState            = DU_SCTP_DOWN;
    ricParams.srcPort             = sctpCfg.duPort[E2_INTERFACE];
    ricParams.recvMsgSet          = ROK;
-   cmMemset ((U8 *)&ricParams.sockFd, -1, sizeof(CmInetFd));
+   memset (&ricParams.sockFd, -1, sizeof(CmInetFd));
    fillDestNetAddr(&ricParams.destIpNetAddr, &ricParams.destIpAddr);
    fillAddrLst(&ricParams.destAddrLst, &ricParams.destIpAddr);
 
@@ -183,7 +236,7 @@ S16 duSctpCfgReq(SctpParams sctpCfg)
 
    ret = duCheckReqStatus(&cfm);
 
-   RETVALUE(ret);
+   return (ret);
 }
 
 /*******************************************************************
@@ -205,13 +258,13 @@ S16 duSctpCfgReq(SctpParams sctpCfg)
  *
  ******************************************************************/
 
-S16 fillAddrLst(CmInetNetAddrLst *addrLstPtr, F1IpAddr *ipAddr)
+uint8_t fillAddrLst(CmInetNetAddrLst *addrLstPtr, F1IpAddr *ipAddr)
 { 
    addrLstPtr->count++;
    addrLstPtr->addrs[(addrLstPtr->count - 1)].type = CM_INET_IPV4ADDR_TYPE;
-   addrLstPtr->addrs[(addrLstPtr->count - 1)].u.ipv4NetAddr = CM_INET_NTOH_U32(ipAddr->ipV4Addr);
+   addrLstPtr->addrs[(addrLstPtr->count - 1)].u.ipv4NetAddr = CM_INET_NTOH_UINT32(ipAddr->ipV4Addr);
 
-   RETVALUE(ROK);
+   return ROK;
 }
 
 /******************************************************************************
@@ -232,12 +285,12 @@ S16 fillAddrLst(CmInetNetAddrLst *addrLstPtr, F1IpAddr *ipAddr)
  *         RFAILED - failure
  *
  *******************************************************************************/
-S16 fillDestNetAddr(CmInetNetAddr *destAddrPtr, F1IpAddr *dstIpPtr)
+uint8_t fillDestNetAddr(CmInetNetAddr *destAddrPtr, F1IpAddr *dstIpPtr)
 {
    /* Filling destination address */
    destAddrPtr->type = CM_INET_IPV4ADDR_TYPE;
-   destAddrPtr->u.ipv4NetAddr = CM_INET_NTOH_U32(dstIpPtr->ipV4Addr);
-   RETVALUE(ROK);
+   destAddrPtr->u.ipv4NetAddr = CM_INET_NTOH_UINT32(dstIpPtr->ipV4Addr);
+   return ROK;
 }
 
 /******************************************************************************
@@ -258,29 +311,29 @@ S16 fillDestNetAddr(CmInetNetAddr *destAddrPtr, F1IpAddr *dstIpPtr)
  *
  *******************************************************************************/
 
-S16 establishReq(DuSctpDestCb *paramPtr)
+uint8_t establishReq(DuSctpDestCb *paramPtr)
 {
    Pst pst;
-   S16 ret = ROK;
+   uint8_t ret = ROK;
    socket_type = CM_INET_STREAM;
 
    if((ret = cmInetSocket(socket_type, &paramPtr->sockFd, IPPROTO_SCTP)) != ROK)
    {
-      DU_LOG("\nSCTP : Failed while opening a socket in ODU");
+      DU_LOG("\nERROR  -->  SCTP : Failed while opening a socket in ODU");
    } 
    else if((ret = cmInetSctpBindx(&paramPtr->sockFd, &localAddrLst, paramPtr->srcPort)) != ROK)
    {
-      DU_LOG("\nSCTP:  Failed during Binding in ODU");
+      DU_LOG("\nERROR  -->  SCTP:  Failed during Binding in ODU");
    }
    else if((ret = sctpSetSockOpts(&paramPtr->sockFd)) != ROK)
    {
-      DU_LOG("\nSCTP : Failed to set Socket Opt in ODU");
+      DU_LOG("\nERROR  -->  SCTP : Failed to set Socket Opt in ODU");
    }     
    else
    { 
       if(ret != ROK)
       {
-         DU_LOG("\nSCTP : Failed while establishing Req at DU");
+         DU_LOG("\nERROR  -->  SCTP : Failed while establishing Req at DU");
          ret = RFAILED;
       }
       else 
@@ -305,7 +358,7 @@ S16 establishReq(DuSctpDestCb *paramPtr)
       duFillSctpPst(&pst, EVTSTARTPOLL);
    }
    
-   RETVALUE(ret);
+   return (ret);
 }
 
 /******************************************************************************
@@ -327,16 +380,21 @@ S16 establishReq(DuSctpDestCb *paramPtr)
  *
  *******************************************************************************/
 
-S16 duSctpAssocReq(U8 itfType)
+uint8_t duSctpAssocReq(uint8_t itfType)
 {
-   S16 ret = ROK;
-       CmStatus cfm;
+   uint8_t      ret = ROK;
+   CmStatus     cfm;
    DuSctpDestCb *paramPtr = NULLP;
 
-   if(SGetSBuf(DU_APP_MEM_REGION, DU_POOL, (Data **)&paramPtr, (Size)sizeof(DuSctpDestCb)) != ROK)
+#ifdef CALL_FLOW_DEBUG_LOG
+   DU_LOG("\nCall Flow: ENTDUAPP -> ENTSCTP : EVENT_ASSOC_REQ_TO_SCTP\n");
+#endif
+   DU_ALLOC(paramPtr, sizeof(DuSctpDestCb));
+   if(paramPtr == NULLP)
    {
-      printf("\nDU_APP : Failed to allocate memory");
-      RETVALUE(RFAILED);
+      DU_LOG("\nERROR  -->  DU_APP : Failed to allocate memory");
+      return RFAILED;
    }
    switch(itfType)
    {
@@ -354,13 +412,13 @@ S16 duSctpAssocReq(U8 itfType)
       }
       default:
       {
-         DU_LOG("\nSCTP : Invalid Interface Type");
+         DU_LOG("\nERROR  -->  SCTP : Invalid Interface Type %d", itfType);
          break;
       }
    }  
    if(ret != ROK)
    { 
-      DU_LOG("\nSCTP : ASSOC Req Failed.");
+      DU_LOG("\nERROR  -->  SCTP : ASSOC Req Failed.");
       cfm.status = LCM_PRIM_NOK;
       cfm.reason = LCM_REASON_NOT_APPL;
    }
@@ -371,7 +429,7 @@ S16 duSctpAssocReq(U8 itfType)
    }
    ret = duCheckReqStatus(&cfm);
 
-   RETVALUE(ret);
+   return (ret);
 }
 /*******************************************************************
  *
@@ -389,15 +447,15 @@ S16 duSctpAssocReq(U8 itfType)
  *         RFAILED - failure
  *
  * ****************************************************************/
-S16 duFillSctpPst(Pst *pst, Event event)
+uint8_t duFillSctpPst(Pst *pst, Event event)
 {
    Buffer *mBuf;
-   if(SGetMsg(DFLT_REGION, DU_POOL, &mBuf) != ROK)
+   if(ODU_GET_MSG_BUF(DFLT_REGION, DU_POOL, &mBuf) != ROK)
    {
-      printf("\nDU_APP : Failed to allocate memory");
-      RETVALUE(RFAILED);
+      DU_LOG("\nERROR  -->  DU_APP : Failed to allocate memory");
+      return RFAILED;
    }
-   cmMemset((U8 *)pst, 0, sizeof(Pst));
+   memset(pst, 0, sizeof(Pst));
    pst->srcEnt = (Ent)ENTDUAPP;
    pst->srcInst = (Inst)DU_INST;
    pst->srcProcId = DU_PROC;
@@ -407,9 +465,9 @@ S16 duFillSctpPst(Pst *pst, Event event)
    pst->event = event;
    pst->selector = ODU_SELECTOR_LC;
    pst->pool= DU_POOL;
-   SPstTsk(pst, mBuf); 
+   ODU_POST_TASK(pst, mBuf); 
 
-   RETVALUE(ROK);
+   return ROK;
 }
 
 /*******************************************************************
@@ -428,9 +486,9 @@ S16 duFillSctpPst(Pst *pst, Event event)
  *         RFAILED - failure
  *
  * ****************************************************************/
-S16 sctpSetSockOpts(CmInetFd *sock_Fd)
+uint8_t sctpSetSockOpts(CmInetFd *sock_Fd)
 {
-    S16 ret = ROK;
+    uint8_t ret = ROK;
     CmSctpEvent sctpEvent;
 
    sctpEvent.dataIoEvent          = TRUE;
@@ -447,7 +505,7 @@ S16 sctpSetSockOpts(CmInetFd *sock_Fd)
      ret = RFAILED;
    }
 
-   RETVALUE(ret);
+   return (ret);
 }
 
 /*******************************************************************
@@ -471,11 +529,11 @@ S16 sctpSetSockOpts(CmInetFd *sock_Fd)
 void sendToDuApp(Buffer *mBuf, Event event)
 {
    Pst pst;
-   DU_LOG("\nSCTP : Forwarding received message to duApp");
-   SPrntMsg(mBuf, 0, 0);
+   DU_LOG("\nDEBUG   -->  SCTP : Forwarding received message to duApp");
+   ODU_PRINT_MSG(mBuf, 0, 0);
 
 
-   cmMemset((U8 *)&(pst), 0, sizeof(Pst));
+   memset(&(pst), 0, sizeof(Pst));
    pst.srcEnt = (Ent)ENTSCTP;
    pst.srcInst = (Inst)SCTP_INST;
    pst.srcProcId = DU_PROC;
@@ -487,9 +545,9 @@ void sendToDuApp(Buffer *mBuf, Event event)
    pst.pool= DU_POOL;
    pst.region = DFLT_REGION;
 
-   if (SPstTsk(&pst, mBuf) != ROK)
+   if (ODU_POST_TASK(&pst, mBuf) != ROK)
    {
-      DU_LOG("\nSCTP : SPstTsk failed in duReadCfg");
+      DU_LOG("\nERROR  -->  SCTP : ODU_POST_TASK failed in duReadCfg");
    }
 }
 
@@ -509,71 +567,71 @@ void sendToDuApp(Buffer *mBuf, Event event)
  *         RFAILED - failure
  *
  * ****************************************************************/
-S16 sctpNtfyHdlr(CmInetSctpNotification *ntfy, U8 *itfState)
+uint8_t sctpNtfyHdlr(CmInetSctpNotification *ntfy, uint8_t *itfState)
 {
    Pst pst;
 
    switch(ntfy->header.nType)
    {
       case CM_INET_SCTP_ASSOC_CHANGE :
-         DU_LOG("\nSCTP : Assoc change notification received");
+         DU_LOG("\nDEBUG   -->  SCTP : Assoc change notification received");
          switch(ntfy->u.assocChange.state)
          {
             case CM_INET_SCTP_COMM_UP:
-               DU_LOG("Event : COMMUNICATION UP");
+               DU_LOG("INFO   -->  Event : COMMUNICATION UP");
                *itfState = DU_SCTP_UP;
                break;
             case CM_INET_SCTP_COMM_LOST:
-               DU_LOG("Event : COMMUNICATION LOST");
+               DU_LOG("INFO   -->  Event : COMMUNICATION LOST");
                *itfState = DU_SCTP_DOWN;
                break;
             case CM_INET_SCTP_RESTART:
-               DU_LOG("Event : SCTP RESTART");
+               DU_LOG("INFO   -->  Event : SCTP RESTART");
                *itfState = DU_SCTP_DOWN;
                break;
             case CM_INET_SCTP_SHUTDOWN_COMP: /* association gracefully shutdown */
-               DU_LOG("Event : SHUTDOWN COMPLETE");
+               DU_LOG("INFO   -->  Event : SHUTDOWN COMPLETE");
                *itfState = DU_SCTP_DOWN;
                break;
             case CM_INET_SCTP_CANT_STR_ASSOC:
-               DU_LOG("Event : CANT START ASSOC");
+               DU_LOG("INFO   -->  Event : CANT START ASSOC");
                *itfState = DU_SCTP_DOWN;
                break;
             default:
-               DU_LOG("\nInvalid event");
+               DU_LOG("\nERROR  -->  Invalid event %d", ntfy->u.assocChange.state);
                break;
          }
          break;
       case CM_INET_SCTP_PEER_ADDR_CHANGE :
-         DU_LOG("\nSCTP : Peer Address Change notificarion received");
+         DU_LOG("\nINFO   -->  SCTP : Peer Address Change notificarion received");
          /* Need to add handler */
          break;
       case CM_INET_SCTP_REMOTE_ERROR :
-         DU_LOG("\nSCTP : Remote Error notification received");
+         DU_LOG("\nINFO   -->  SCTP : Remote Error notification received");
          break;
       case CM_INET_SCTP_SEND_FAILED :
-         DU_LOG("\nSCTP : Send Failed notification received\n");
+         DU_LOG("\nINFO   -->  SCTP : Send Failed notification received\n");
          break;
       case CM_INET_SCTP_SHUTDOWN_EVENT : /* peer socket gracefully closed */
-         DU_LOG("\nSCTP : Shutdown Event notification received\n");
+         DU_LOG("\nINFO   -->  SCTP : Shutdown Event notification received\n");
          *itfState = DU_SCTP_DOWN;
          exit(0);
          break;
       case CM_INET_SCTP_ADAPTATION_INDICATION :
-         DU_LOG("\nSCTP : Adaptation Indication received\n");
+         DU_LOG("\nINFO   -->  SCTP : Adaptation Indication received\n");
          break;
       case CM_INET_SCTP_PARTIAL_DELIVERY_EVENT:
-         DU_LOG("\nSCTP : Partial Delivery Event received\n");
+         DU_LOG("\nINFO   -->  SCTP : Partial Delivery Event received\n");
          break;
       default:
-         DU_LOG("\nSCTP : Invalid sctp notification type\n");
+         DU_LOG("\nERROR  -->  SCTP : Invalid sctp notification type %d", ntfy->header.nType);
          break;
    }
 
    /* Pack notification and send to APP */
-   DU_LOG("\nSCTP : Forwarding received message to duApp");
+   DU_LOG("\nDEBUG   -->  SCTP : Forwarding received message to duApp");
     
-   cmMemset((U8 *)&(pst), 0, sizeof(Pst));
+   memset(&(pst), 0, sizeof(Pst));
    pst.srcEnt = (Ent)ENTSCTP;
    pst.srcInst = (Inst)SCTP_INST;
    pst.srcProcId = DU_PROC;
@@ -583,14 +641,14 @@ S16 sctpNtfyHdlr(CmInetSctpNotification *ntfy, U8 *itfState)
    pst.event = EVENT_SCTP_NTFY;
    pst.selector = ODU_SELECTOR_LC;
    pst.pool= DU_POOL;
-   pst.region = DFLT_REGION;
+   pst.region = DU_APP_MEM_REGION;
    
    if(cmPkSctpNtfy(&pst, ntfy) != ROK)
    {
-      DU_LOG("\nSCTP : Failed to pack SCTP notification");
-      RETVALUE(RFAILED);
+      DU_LOG("\nERROR  -->  SCTP : Failed to pack SCTP notification");
+      return RFAILED;
    }
-   RETVALUE(ROK);
+   return ROK;
 }
 
 /*******************************************************************
@@ -616,11 +674,11 @@ S16 sctpNtfyHdlr(CmInetSctpNotification *ntfy, U8 *itfState)
  *
  * ****************************************************************/
 
-S16 processPolling(sctpSockPollParams *pollParams, CmInetFd *sockFd, U32 *timeoutPtr, CmInetMemInfo *memInfo, Bool recvMsgSet)
+uint8_t  processPolling(sctpSockPollParams *pollParams, CmInetFd *sockFd, uint32_t *timeoutPtr, CmInetMemInfo *memInfo, bool recvMsgSet)
 {
-   U16 ret = ROK;
+   uint8_t ret = ROK;
    CM_INET_FD_SET(sockFd, &pollParams->readFd);
-   ret = cmInetSelect(&pollParams->readFd, NULLP, timeoutPtr, &pollParams->numFd);
+   ret = cmInetSelect(&pollParams->readFd, NULLP, timeoutPtr, (int16_t *)&pollParams->numFd);
    if(CM_INET_FD_ISSET(sockFd, &pollParams->readFd))
    {
       CM_INET_FD_CLR(sockFd, &pollParams->readFd);
@@ -628,33 +686,39 @@ S16 processPolling(sctpSockPollParams *pollParams, CmInetFd *sockFd, U32 *timeou
         
       if(ret != ROK)
       {
-         DU_LOG("\n SCTP: Failed to receive sctp msg for sockFd[%d]\n", sockFd->fd);
+         DU_LOG("\nERROR   -->  SCTP: Failed to receive sctp msg for sockFd[%d]\n", sockFd->fd);
          recvMsgSet = RFAILED;
       }
       else
       {
+#ifdef CALL_FLOW_DEBUG_LOG
+         if(pollParams->port == f1Params.destPort)
+            DU_LOG("\nCall Flow: CU -> ENTSCTP : EVENT_SCTP_MSG\n");
+         else
+            DU_LOG("\nCall Flow: RIC -> ENTSCTP : EVENT_SCTP_MSG\n");
+#endif
          if((((pollParams->flag & CM_INET_SCTP_MSG_NOTIFICATION) != 0)) && ret == ROK)
          {
             if(pollParams->port == f1Params.destPort)
             {
                f1Params.assocId = pollParams->ntfy.u.assocChange.assocId;
-               DU_LOG("\nSCTP : AssocId assigned to F1Params from PollParams [%d]\n", f1Params.assocId);
+               DU_LOG("\nDEBUG   -->  SCTP : AssocId assigned to F1Params from PollParams [%d]\n", f1Params.assocId);
                ret = sctpNtfyHdlr(&pollParams->ntfy, &f1Params.itfState);
             }
             else if(pollParams->port == ricParams.destPort)
             {
                ricParams.assocId = pollParams->ntfy.u.assocChange.assocId;
-               DU_LOG("\nSCTP : AssocId assigned to ricParams from PollParams [%d]\n", ricParams.assocId);
+               DU_LOG("\nDEBUG   -->  SCTP : AssocId assigned to ricParams from PollParams [%d]\n", ricParams.assocId);
                ret = sctpNtfyHdlr(&pollParams->ntfy, &ricParams.itfState);
             }
             else
             {
-               DU_LOG("\nSCTP : Failed to fill AssocId\n");
-               RETVALUE(RFAILED);
+               DU_LOG("\nERROR  -->  SCTP : Failed to fill AssocId\n");
+               return RFAILED;
             }
             if(ret != ROK)
             {
-               DU_LOG("\nSCTP : Failed to process sctp notify msg\n");
+               DU_LOG("\nERROR  -->  SCTP : Failed to process sctp notify msg\n");
             }
          }
          else if(f1Params.itfState & (pollParams->port == f1Params.destPort))
@@ -668,11 +732,11 @@ S16 processPolling(sctpSockPollParams *pollParams, CmInetFd *sockFd, U32 *timeou
 
          else
          {
-            SPutMsg(pollParams->mBuf);
+            ODU_PUT_MSG_BUF(pollParams->mBuf);
          }
       }
   }
-  RETVALUE(ROK);
+  return ROK;
 }
 /*******************************************************************
  *
@@ -690,11 +754,11 @@ S16 processPolling(sctpSockPollParams *pollParams, CmInetFd *sockFd, U32 *timeou
  *         RFAILED - failure
  *
  * ****************************************************************/
-S16 sctpSockPoll()
+uint8_t sctpSockPoll()
 {
-   U16 ret       = ROK;
-   U32           timeout;
-   U32           *timeout_Ptr;
+   uint8_t  ret       = ROK;
+   uint32_t timeout;
+   uint32_t *timeout_Ptr;
    CmInetMemInfo memInfo;
    sctpSockPollParams f1PollParams, e2PollParams;
 
@@ -718,25 +782,25 @@ S16 sctpSockPoll()
    CM_INET_FD_ZERO(&f1PollParams.readFd);
    CM_INET_FD_ZERO(&e2PollParams.readFd);
 
-   DU_LOG("\nSCTP : Polling started at DU\n");
-   while(1)
+   DU_LOG("\nINFO   -->  SCTP : Polling started at DU\n");
+   while(true)
    {
       if(f1Params.itfState)
       {
          if((ret = processPolling(&f1PollParams, &f1Params.sockFd, timeout_Ptr, &memInfo, f1Params.recvMsgSet)) != ROK)
          {
-            DU_LOG("\nSCTP : Failed to RecvMsg for F1\n");
+            DU_LOG("\nERROR  -->  SCTP : Failed to RecvMsg for F1\n");
          }
       }
       if(ricParams.itfState)
       {
          if((ret = processPolling(&e2PollParams, &ricParams.sockFd, timeout_Ptr, &memInfo, ricParams.recvMsgSet)) != ROK)
          {
-            DU_LOG("\nSCTP : Failed to RecvMsg for E2\n");
+            DU_LOG("\nERROR  -->  SCTP : Failed to RecvMsg for E2\n");
          }
       }
    };
-   RETVALUE(ret);
+   return (ret);
 }/* End of sctpSockPoll() */
 
 /*******************************************************************
@@ -755,34 +819,51 @@ S16 sctpSockPoll()
  *         RFAILED - failure
  *
  * ****************************************************************/
-S16 sctpSend(Buffer *mBuf, U8 itfType)
+uint8_t sctpSend(Buffer *mBuf, uint8_t itfType)
 {
-   U8               ret;
-   MsgLen           len;          /* number of actually sent octets */
+   uint8_t          ret =0;
+   MsgLen           len =0;          /* number of actually sent octets */
    CmInetMemInfo    memInfo;                        
    
    memInfo.region = DU_APP_MEM_REGION;               
    memInfo.pool   = DU_POOL;
+   
+#ifdef CALL_FLOW_DEBUG_LOG
+   if(itfType == F1_INTERFACE)
+   {
+      DU_LOG("\nCall Flow: ENTDUAPP -> ENTSCTP : EVENT_F1AP_MSG_TO_SCTP\n");
+   }
+   else
+   {
+      DU_LOG("\nCall Flow: ENTDUAPP -> ENTSCTP : EVENT_E2AP_MSG_TO_SCTP\n");
+   }
+#endif
 
    if(itfType == F1_INTERFACE)
    {
-      DU_LOG("\nSCTP : sending the message to DuApp");
+      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
       ret = cmInetSctpSendMsg(&f1Params.sockFd, &f1Params.destIpNetAddr, f1Params.destPort, &memInfo, mBuf, &len, 0, FALSE, 0, 0/*SCT_PROTID_NONE*/, RWOULDBLOCK);
    }
 
    if(itfType == E2_INTERFACE)
    {
-      DU_LOG("\nSCTP : 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
       ret = cmInetSctpSendMsg(&ricParams.sockFd, &ricParams.destIpNetAddr, ricParams.destPort, &memInfo, mBuf, &len, 0, FALSE, 0, 0/*SCT_PROTID_NONE*/, RWOULDBLOCK);
    }
 
    if(ret != ROK && ret != RWOULDBLOCK)
    {
-      DU_LOG("\nSCTP : Failed sending the message");
-      RETVALUE(RFAILED);
+      DU_LOG("\nERROR  -->  SCTP : Failed sending the message");
+      return RFAILED;
    }
 
-   RETVALUE(ROK);
+   return ROK;
 } /* End of sctpSend */
 
 /**********************************************************************