[ JIRA Id - ODUHIGH-573 ] Code changes upgraded to Gcc version 11.4.0
[o-du/l2.git] / src / ric_stub / ric_stub_sctp.h
index 33355d8..c0ba6d8 100644 (file)
 #ifndef __RIC_SCTP_H__
 #define __RIC_SCTP_H__
 
-#include "stdbool.h"
-#include "ric_stub.h"
-#include "cm_inet.h"
-#include "cm_tpt.h"
-
-#include "cm_inet.x"
-#include "cm_tpt.x"
-
 #define MAX_RETRY 5
+#define MAX_IPV6_LEN 16
+#define MAX_DU_SUPPORTED 2
+#define MAX_ASSOC_SUPPORTED MAX_DU_SUPPORTED
 
 /* Global variable declaration */
-U8   socket_type;      /* Socket type */
-bool nonblocking;      /* Blocking/Non-blocking socket */
-bool connUp;           /* Is connection up */
-int  assocId;          /* Assoc Id of connected assoc */
-  
-RicSctpParams sctpCfg;            /* SCTP configurations at DU */
+extern uint8_t   socket_type;      /* Socket type */
+
+/* O-RAN.WG3.E2AP-R003-v03.00 : Section 9.2.30 */
+typedef enum
+{
+   RIC_SERVICE,
+   SUPPORT_FUNCTIONS,
+   BOTH_FUNCTIONALITY
+}AssocUsage;
+
 typedef struct
 {
    uint16_t           numFd;
@@ -53,27 +52,60 @@ typedef struct
 
 typedef struct
 {
+   uint32_t              duId;
    uint16_t              destPort;         /* DU PORTS */
-   uint16_t              srcPort;
    bool                  bReadFdSet;
    CmInetFd              sockFd;           /* Socket file descriptor */
    CmInetAddr            peerAddr;
-   CmInetFd              lstnSockFd;       /* Listening Socket file descriptor */
    CmInetNetAddrLst      destAddrLst;      /* DU Ip address */
-   CmInetNetAddrLst      localAddrLst;
    CmInetNetAddr         destIpNetAddr;    /* DU Ip address */ 
-}CuSctpDestCb;
+   Bool                  connUp;
+}RicSctpAssocCb;
+
+typedef struct ipAddr
+{
+ bool ipV4Pres;
+ uint32_t  ipV4Addr;
+ bool ipV6Pres;
+ uint8_t   ipV6Addr[MAX_IPV6_LEN];
+}SctpIpAddr;
+
+typedef struct sctpDestInfo
+{
+   SctpIpAddr  destIpAddr;
+   uint16_t    destPort;
+}SctpDestInfo;
+
+typedef struct ricSctpParams
+{
+   SctpIpAddr     localIpAddr;
+   uint16_t       e2SctpPort;
+   uint8_t        numDestNode;
+   SctpDestInfo   destCb[MAX_DU_SUPPORTED];
+   AssocUsage     usage;
+}RicSctpParams;
+
+typedef struct sctpGlobalCb
+{
+   RicSctpParams    sctpCfg;
+   CmInetNetAddrLst localAddrLst;
+   CmInetFd         e2LstnSockFd;       /* Listening Socket file descriptor for E2 association */
+   uint8_t          numAssoc;
+   RicSctpAssocCb   assocCb[MAX_ASSOC_SUPPORTED]; 
+}SctpGlobalCb;
+
+extern SctpGlobalCb sctpCb;
 
-EXTERN S16 sctpActvInit();
-EXTERN S16 sctpSend(Buffer *mBuf);
-S16 sctpCfgReq();
-S16 sctpStartReq();
-S16 fillAddrLst(CmInetNetAddrLst *addrLstPtr, SctpIpAddr *ipAddr);
-S16 fillDestNetAddr(CmInetNetAddr *destAddrPtr, SctpIpAddr *dstIpPtr);
-S16 sctpSetSockOpts(CmInetFd *sock_Fd);
-S16 sctpAccept(CmInetFd *lstnSock_Fd, CmInetAddr *peerAddr, CmInetFd *sock_Fd);
-S16 sctpSockPoll();
-S16 processPolling(sctpSockPollParams *pollParams, CmInetFd *sockFd, U32 *timeoutPtr, CmInetMemInfo *memInfo);
+uint8_t sctpActvInit();
+uint8_t sctpSend(uint32_t duId, Buffer *mBuf);
+uint8_t sctpCfgReq();
+uint8_t sctpStartReq();
+uint8_t sctpSetSockOpts(CmInetFd *sock_Fd);
+uint8_t sctpAccept(RicSctpAssocCb *assocCb);
+uint8_t sctpSockPoll();
+uint8_t processPolling(sctpSockPollParams *pollParams, RicSctpAssocCb *destCb, uint32_t *timeoutPtr, CmInetMemInfo *memInfo);
+uint8_t fillAddrLst(CmInetNetAddrLst *addrLstPtr, SctpIpAddr *ipAddr);
+uint8_t fillDestNetAddr(CmInetNetAddr *destAddrPtr, SctpIpAddr *dstIpPtr);
 
 #endif