[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 548c29a..d812814 100644 (file)
 #define MAX_RETRY 5
 #define MAX_IPV6_LEN 16
 #define MAX_DU_SUPPORTED 2
-#define MAX_ASSOC_SUPPORTED MAX_DU_SUPPORTED
+#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 */
 
+typedef enum
+{
+   F1_INTERFACE,
+   XN_INTERFACE
+}InterfaceType;
+
+typedef enum
+{
+   SERVER,
+   CLIENT
+}NodeType;
+
 typedef struct
 {
    S16              numFd;
@@ -44,13 +57,14 @@ typedef struct
 
 typedef struct
 {
-   uint32_t         duId;
+   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 */
    Bool             bReadFdSet;
    CmInetFd         sockFd;           /* Socket file descriptor */
    CmInetAddr       peerAddr;
-   CmInetNetAddrLst destAddrLst;      /* DU Ip address */
-   CmInetNetAddr    destIpNetAddr;    /* DU Ip address */ 
+   CmInetNetAddrLst destAddrLst;      /* Remote IP address list */
+   CmInetNetAddr    destIpNetAddr;    /* Remote IP network address */ 
    Bool             connUp;           /* Is connection up */
 }CuSctpAssocCb;
 
@@ -68,12 +82,19 @@ typedef struct sctpDestInfo
    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;
-   uint16_t       f1SctpPort;
-   uint8_t        numDestNode;
-   SctpDestInfo   destCb[MAX_DU_SUPPORTED];
+   SctpCfgPerIntf f1SctpInfo;
+   SctpCfgPerIntf xnSctpInfo;
 }CuSctpParams;
 
 typedef struct
@@ -81,6 +102,8 @@ typedef struct
    CuSctpParams     sctpCfg;
    CmInetNetAddrLst localAddrLst;
    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;
@@ -89,14 +112,14 @@ SctpGlobalCb sctpCb;
 
 uint8_t sctpActvInit();
 uint8_t sctpStartReq();
-uint8_t sctpSend(uint32_t duId, Buffer *mBuf);
+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(CuSctpAssocCb *assocCb);
+uint8_t sctpAccept(CmInetFd *lstnSockFd, CuSctpAssocCb *assocCb);
 uint8_t processPolling(sctpSockPollParams *pollParams, CuSctpAssocCb *assocCb, uint32_t *timeoutPtr, CmInetMemInfo *memInfo);
 #endif