[Epic-ID: ODUHIGH-463][Task-ID: ODUHIGH-496] Create setup with 2 GNB with SCTP associ...
[o-du/l2.git] / src / cu_stub / cu_stub_sctp.h
index 50a455c..d812814 100644 (file)
 #ifndef __CU_SCTP_H__
 #define __CU_SCTP_H__
 
-#include "cu_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_REMOTE_CU_SUPPORTED 1
+#define MAX_ASSOC_SUPPORTED (MAX_DU_SUPPORTED + MAX_REMOTE_CU_SUPPORTED)
 
 /* Global variable declaration */
 uint8_t   socket_type;      /* Socket type */
-Bool nonblocking;      /* Blocking/Non-blocking socket */
-Bool connUp;           /* Is connection up */
-int  assocId;          /* Assoc Id of connected assoc */
-  
-CuSctpParams sctpCfg;            /* SCTP configurations at DU */
+
+typedef enum
+{
+   F1_INTERFACE,
+   XN_INTERFACE
+}InterfaceType;
+
+typedef enum
+{
+   SERVER,
+   CLIENT
+}NodeType;
 
 typedef struct
 {
@@ -53,28 +57,70 @@ typedef struct
 
 typedef struct
 {
+   InterfaceType    intf;             /* F1 or Xn Interface */
+   uint32_t         destId;           /* For F1 interface, this is DU ID. For Xn, this is remote CU ID */
    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 destAddrLst;      /* Remote IP address list */
+   CmInetNetAddr    destIpNetAddr;    /* Remote IP network address */ 
+   Bool             connUp;           /* Is connection up */
+}CuSctpAssocCb;
+
+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 sctpCfgPerIntf
+{
+   uint16_t       port;
+   NodeType       localNodeType; /* Local node acts as Server or client while establishing SCTP assoc */
+   uint8_t        numDestNode; 
+   SctpDestInfo   destCb[MAX_ASSOC_SUPPORTED];
+}SctpCfgPerIntf;
+
+typedef struct cuSctpParams
+{
+   SctpIpAddr     localIpAddr;
+   SctpCfgPerIntf f1SctpInfo;
+   SctpCfgPerIntf xnSctpInfo;
+}CuSctpParams;
+
+typedef struct
+{
+   CuSctpParams     sctpCfg;
    CmInetNetAddrLst localAddrLst;
-   CmInetNetAddr    destIpNetAddr;    /* DU Ip address */ 
-}CuSctpDestCb;
-
-EXTERN S16 sctpActvInit();
-EXTERN S16 sctpStartReq();
-EXTERN S16 sctpSend(Buffer *mBuf);
-EXTERN S16 sctpCfgReq();
-
-S16 fillAddrLst(CmInetNetAddrLst *addrLstPtr, SctpIpAddr *ipAddr);
-S16 fillDestNetAddr(CmInetNetAddr *destAddrPtr, SctpIpAddr *dstIpPtr);
-S16 sctpSetSockOpts(CmInetFd *sock_Fd);
-S16 sctpSockPoll();
-S16 sctpAccept(CmInetFd *lstnSock_Fd, CmInetAddr *peerAddr, CmInetFd *sock_Fd);
-S16 processPolling(sctpSockPollParams *pollParams, CmInetFd *sockFd, uint32_t *timeoutPtr, CmInetMemInfo *memInfo);
+   CmInetFd         f1LstnSockFd;       /* Listening Socket file descriptor for F1 association */
+   CmInetFd         xnLstnSockFd;       /* Listening Socket file descriptor for Xn association */
+   NodeType         localXnNodeType;    /* Local node acts as Server or client while establishing SCTP assoc at Xn interface */
+   uint8_t          numAssoc;
+   CuSctpAssocCb    assocCb[MAX_ASSOC_SUPPORTED];
+}SctpGlobalCb;
+
+SctpGlobalCb sctpCb;
+
+uint8_t sctpActvInit();
+uint8_t sctpStartReq();
+uint8_t sctpSend(InterfaceType intf, uint32_t destId, Buffer *mBuf);
+uint8_t sctpCfgReq();
+
+uint8_t fillAddrLst(CmInetNetAddrLst *addrLstPtr, SctpIpAddr *ipAddr);
+uint8_t fillDestNetAddr(CmInetNetAddr *destAddrPtr, SctpIpAddr *dstIpPtr);
+uint8_t sctpSetSockOpts(CmInetFd *sock_Fd);
+uint8_t sctpSockPoll();
+uint8_t sctpAccept(CmInetFd *lstnSockFd, CuSctpAssocCb *assocCb);
+uint8_t processPolling(sctpSockPollParams *pollParams, CuSctpAssocCb *assocCb, uint32_t *timeoutPtr, CmInetMemInfo *memInfo);
 #endif
 
 /**********************************************************************