E2AP changes Part2
[o-du/l2.git] / src / ric_stub / ric_stub_sctp.c
index 8cd4973..a32a9b3 100644 (file)
 
 CuSctpDestCb ricParams;
 
-/**************************************************************************
- * @brief Task Initiation callback function. 
- *
- * @details
- *
- *     Function : sctpActvInit 
- *    
- *     Functionality:
- *             This function is supplied as one of parameters during SCTP's 
- *             task registration. SSI will invoke this function once, after
- *             it creates and attaches this TAPA Task to a system task.
- *     
- * @param[in]  Ent entity, the entity ID of this task.     
- * @param[in]  Inst inst, the instance ID of this task.
- * @param[in]  Region region, the region ID registered for memory 
- *              usage of this task.
- * @param[in]  Reason reason.
- * @return ROK     - success
- *         RFAILED - failure
- ***************************************************************************/
-S16 sctpActvInit()
-{
-   DU_LOG("\n\nSCTP : Initializing");
-   connUp = FALSE;
-   assocId = 0;
-   nonblocking = FALSE;
-   sctpCfg = cuCfgParams.sctpParams;
-   return ROK;
-
-}
 
-/**************************************************************************
- * @brief Task Activation callback function. 
- *
- * @details
- *
- *      Function : sctpActvTsk 
- * 
- *      Functionality:
- *           This function handles all SCTP messages received
- *           This API is registered with SSI during the 
- *           Task Registration of DU APP.
- *     
- * @param[in]  Pst     *pst, Post structure of the primitive.     
- * @param[in]  Buffer *mBuf, Packed primitive parameters in the
- *  buffer.
- * @return ROK     - success
- *         RFAILED - failure
- *
- ***************************************************************************/
-S16 sctpActvTsk(Pst *pst, Buffer *mBuf)
-{
-
-//TODO: TBD
-   return ROK;
-}
 /**************************************************************************
  * @brief Function to configure the Sctp Params during config Request
  *
  * @details
  *
- *      Function : duSctpCfgReq
+ *      Function : sctpCfgReq
  * 
  *      Functionality:
  *           This function configures SCTP Params during the config Request
@@ -97,16 +42,18 @@ S16 sctpActvTsk(Pst *pst, Buffer *mBuf)
 
 S16 sctpCfgReq()
 {
+   connUp = FALSE;
+   sctpCfg = ricCfgParams.sctpParams;
 
 /* Fill F1 Params */
    ricParams.destPort             = sctpCfg.duPort;
    ricParams.srcPort              = sctpCfg.ricPort;
    ricParams.bReadFdSet           = ROK;
-   cmMemset ((U8 *)&ricParams.sockFd, -1, sizeof(CmInetFd));
-   cmMemset ((U8 *)&ricParams.lstnSockFd, -1, sizeof(CmInetFd));
+   memset(&ricParams.sockFd, -1, sizeof(CmInetFd));
+   memset(&ricParams.lstnSockFd, -1, sizeof(CmInetFd));
    fillDestNetAddr(&ricParams.destIpNetAddr, &sctpCfg.duIpAddr);
 
-   RETVALUE(ROK);
+   return ROK;
 }
 
 /*******************************************************************
@@ -133,7 +80,7 @@ S16 fillAddrLst(CmInetNetAddrLst *addrLstPtr, SctpIpAddr *ipAddr)
    addrLstPtr->addrs[(addrLstPtr->count - 1)].type = CM_INET_IPV4ADDR_TYPE;
    addrLstPtr->addrs[(addrLstPtr->count - 1)].u.ipv4NetAddr = CM_INET_NTOH_U32(ipAddr->ipV4Addr);
 
-   RETVALUE(ROK);
+   return ROK;
 }
 
 /******************************************************************************
@@ -158,7 +105,7 @@ S16 fillDestNetAddr(CmInetNetAddr *destAddrPtr, SctpIpAddr *dstIpPtr)
    /* Filling destination address */
    destAddrPtr->type = CM_INET_IPV4ADDR_TYPE;
    destAddrPtr->u.ipv4NetAddr = CM_INET_NTOH_U32(dstIpPtr->ipV4Addr);
-   RETVALUE(ROK);
+   return ROK;
 }
 
 /******************************************************************************
@@ -190,11 +137,11 @@ S16 sctpStartReq()
    } 
    else if((ret = cmInetSctpBindx(&ricParams.lstnSockFd, &ricParams.localAddrLst, ricParams.srcPort)) != ROK)
    {
-      DU_LOG("\nSCTP: Binding failed at CU");
+      DU_LOG("\nSCTP: Binding failed at RIC");
    }
    else if((ret = sctpAccept(&ricParams.lstnSockFd, &ricParams.peerAddr, &ricParams.sockFd)) != ROK)
    {
-      DU_LOG("\nSCTP: Unable to accept the connection at CU");
+      DU_LOG("\nSCTP: Unable to accept the connection at RIC");
    }
    else if(sctpSockPoll() != ROK)
    {
@@ -260,13 +207,13 @@ S16 sctpSetSockOpts(CmInetFd *sock_Fd)
 S16 sctpAccept(CmInetFd *lstnSock_Fd, CmInetAddr *peerAddr, CmInetFd *sock_Fd)
 {
    U8  ret;
-   
-   ret = cmInetListen(lstnSock_Fd, 1);;
+
+   ret = cmInetListen(lstnSock_Fd, 1);
    if (ret != ROK)
    {
       DU_LOG("\nSCTP : Listening on socket failed");
       cmInetClose(lstnSock_Fd);
-      RETVALUE(RFAILED);
+      return RFAILED;
    }
    
    DU_LOG("\nSCTP : Connecting");
@@ -281,7 +228,7 @@ S16 sctpAccept(CmInetFd *lstnSock_Fd, CmInetAddr *peerAddr, CmInetFd *sock_Fd)
       else if(ret != ROK)
       {
          DU_LOG("\nSCTP : Failed to accept connection");
-         RETVALUE(RFAILED);
+         return RFAILED;
       }
       else
       {
@@ -292,7 +239,7 @@ S16 sctpAccept(CmInetFd *lstnSock_Fd, CmInetAddr *peerAddr, CmInetFd *sock_Fd)
    }
    DU_LOG("\nSCTP : Connection established");
 
-   RETVALUE(ROK);
+   return ROK;
 }
 
 /*******************************************************************
@@ -372,7 +319,7 @@ S16 sctpNtfyHdlr(CmInetSctpNotification *ntfy)
    }
 
    sctpNtfyInd(ntfy);
-   RETVALUE(ROK);
+   return ROK;
 }/* End of sctpNtfyHdlr */
 
 /*******************************************************************
@@ -423,7 +370,7 @@ S16 sctpSockPoll()
    {
       if((ret = processPolling(&e2PollParams, &ricParams.sockFd, timeoutPtr, &memInfo)) != ROK)
       {
-         DU_LOG("\nSCTP : Failed to RecvMsg for E2 at CU \n");
+         DU_LOG("\nSCTP : Failed to RecvMsg for E2 at RIC \n");
       }
    };
    RETVALUE(ret);
@@ -457,7 +404,7 @@ S16 processPolling(sctpSockPollParams *pollParams, CmInetFd *sockFd, U32 *timeou
 {
    U16 ret = ROK;
    CM_INET_FD_SET(sockFd, &pollParams->readFd);
-   ret = cmInetSelect(&pollParams->readFd, NULLP, timeoutPtr, &pollParams->numFds);
+   ret = cmInetSelect(&pollParams->readFd, NULLP, timeoutPtr, &pollParams->numFd);
    if(CM_INET_FD_ISSET(sockFd, &pollParams->readFd))
    {
       CM_INET_FD_CLR(sockFd, &pollParams->readFd);
@@ -487,7 +434,7 @@ S16 processPolling(sctpSockPollParams *pollParams, CmInetFd *sockFd, U32 *timeou
          }
       } 
   }
-  RETVALUE(ROK);
+  return ROK;
 }/* End of sctpSockPoll() */
 
 /*******************************************************************
@@ -520,10 +467,10 @@ S16 sctpSend(Buffer *mBuf)
    if(ret != ROK && ret != RWOULDBLOCK)
    {
       DU_LOG("\nSCTP : Send message failed");
-      RETVALUE(RFAILED);
+      return RFAILED;
    }
 
-   RETVALUE(ROK);
+   return ROK;
 } /* End of sctpSend */
 /**********************************************************************
          End of file