X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2Fric_stub%2Fric_stub_sctp.c;h=2bf9ef15d40d784939668a78d8974bc37400dc37;hb=45d134510deb6902b870b4a0fb574b6075fba601;hp=8cd497379bbf798acb50065b00119be99d079236;hpb=8660dd47a5ef27b62300fabf6b027852f1d5d026;p=o-du%2Fl2.git diff --git a/src/ric_stub/ric_stub_sctp.c b/src/ric_stub/ric_stub_sctp.c index 8cd497379..2bf9ef15d 100644 --- a/src/ric_stub/ric_stub_sctp.c +++ b/src/ric_stub/ric_stub_sctp.c @@ -18,74 +18,23 @@ /* This file contains all SCTP related functionality */ -#include +#include "common_def.h" #include "ric_e2ap_msg_hdl.h" #include "ric_stub_sctp.h" +#include "ric_stub.h" +#include "E2AP-PDU.h" +#include "du_log.h" 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; -} +RicSctpParams sctpCfg; +S16 fillAddrLst(CmInetNetAddrLst *addrLstPtr, SctpIpAddr *ipAddr); +S16 fillDestNetAddr(CmInetNetAddr *destAddrPtr, SctpIpAddr *dstIpPtr); /************************************************************************** * @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 +46,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 +84,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 +109,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 +141,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 +211,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 +232,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 +243,7 @@ S16 sctpAccept(CmInetFd *lstnSock_Fd, CmInetAddr *peerAddr, CmInetFd *sock_Fd) } DU_LOG("\nSCTP : Connection established"); - RETVALUE(ROK); + return ROK; } /******************************************************************* @@ -372,7 +323,7 @@ S16 sctpNtfyHdlr(CmInetSctpNotification *ntfy) } sctpNtfyInd(ntfy); - RETVALUE(ROK); + return ROK; }/* End of sctpNtfyHdlr */ /******************************************************************* @@ -423,7 +374,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 +408,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 +438,7 @@ S16 processPolling(sctpSockPollParams *pollParams, CmInetFd *sockFd, U32 *timeou } } } - RETVALUE(ROK); + return ROK; }/* End of sctpSockPoll() */ /******************************************************************* @@ -520,10 +471,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