Revert "[Epic-ID: ODUHIGH-576][Task-ID: ODUHIGH-579] | Databse Creation"
[o-du/l2.git] / src / du_app / du_sctp.h
1 /*******************************************************************************
2 ################################################################################
3 #   Copyright (c) [2017-2019] [Radisys]                                        #
4 #                                                                              #
5 #   Licensed under the Apache License, Version 2.0 (the "License");            #
6 #   you may not use this file except in compliance with the License.           #
7 #   You may obtain a copy of the License at                                    #
8 #                                                                              #
9 #       http://www.apache.org/licenses/LICENSE-2.0                             #
10 #                                                                              #
11 #   Unless required by applicable law or agreed to in writing, software        #
12 #   distributed under the License is distributed on an "AS IS" BASIS,          #
13 #   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #
14 #   See the License for the specific language governing permissions and        #
15 #   limitations under the License.                                             #
16 ################################################################################
17 *******************************************************************************/
18
19 /* This file contains all SCTP related functionality */
20
21 #ifndef __DU_SCTP_H__
22 #define __DU_SCTP_H__
23
24 #define DU_SCTP_DOWN 0
25 #define DU_SCTP_UP 1
26 #define DU_SCTP_CONNECTING 2
27 #define MAX_RETRY 5
28
29 /* Global variable declaration */
30 extern uint8_t   socket_type;      /* Socket type */
31 extern bool nonblocking;      /* Blocking/Non-blocking socket */
32 extern bool connUp;           /* Is connection up */
33 extern bool pollingState; 
34 extern CmInetNetAddrLst localAddrLst;
35 extern CmInetNetAddrLst remoteAddrLst;
36
37 typedef struct
38 {
39    uint8_t     numFd;            /* Total count number of receivers socket Fd */
40    uint16_t    port;              /* Filled by the InetSctpRecvMsg during polling */              
41    uint32_t    flag;              /* Refers to the notifyHandler Flag during successful InetSctpRecvMsg*/
42    Buffer      *mBuf;             /* Buffer filled during Socket polling*/
43    MsgLen      bufLen;            /* Determines the length of the Buffer filled during socket polling */
44    CmInetNetAddr addr;              /* Determines the destination port filled during socket polling */
45    CmInetFdSet      readFd;         /* Refers to the Read Fd socket */
46    CmInetSctpSndRcvInfo   info;     /* Refers to Send Receivers Info*/
47    CmInetSctpNotification ntfy;     /* Refers to the sctp Notification Message */
48 }sctpSockPollParams;
49
50 typedef struct
51 {
52    uint8_t               itfState;         /* determines the interface State*/
53    uint16_t              destPort;         /* Refers to the destination port of F1/E2 */
54    uint16_t              srcPort;          /* Refers to respective src port of DU */
55    uint32_t              assocId;          
56    bool             recvMsgSet;
57    F1IpAddr         destIpAddr;       /* Refers to te destination Ip Address */
58    CmInetFd         sockFd;           /* Socket file descriptor */
59    CmInetNetAddrLst destAddrLst;      /* Refers to the destinaiton Addr Lst in CmInetNetAddrLst format */
60    CmInetNetAddr    destIpNetAddr;    /* Refers to the destination Addr in CmInetNet Addr format */
61 }DuSctpDestCb;
62
63 /* Global variable declaration */
64 extern DuSctpDestCb f1Params;     /* SCTP configurations at DU */ 
65 extern DuSctpDestCb ricParams;    /* SCTP configurations at DU */ 
66
67
68 uint8_t sctpActvInit(Ent entity, Inst inst, Region region, Reason reason);
69 uint8_t sctpActvTsk(Pst *pst, Buffer *mBuf);
70 void sctpAssocReq();
71 void sendToDuApp(Buffer *mBuf, Event event);
72 uint8_t sctpSend(Buffer *mBuf, uint8_t itfType);
73 uint8_t duSctpCfgReq(SctpParams sctpCfg);
74 uint8_t fillAddrLst(CmInetNetAddrLst *addrLstPtr, F1IpAddr *ipAddr);
75 uint8_t fillDestNetAddr(CmInetNetAddr *destAddrPtr, F1IpAddr *dstIpPtr);
76 uint8_t establishReq(DuSctpDestCb *paramPtr);
77 uint8_t duSctpAssocReq(uint8_t itfType);
78 uint8_t duFillSctpPst(Pst *pst, Event event);
79 uint8_t sctpSetSockOpts(CmInetFd *sock_Fd);
80 uint8_t processPolling(sctpSockPollParams *pollParams, CmInetFd *sockFd, uint32_t *timeoutPtr, CmInetMemInfo *memInfo, bool recvMsgSet);
81 uint8_t sctpSockPoll();
82
83 #endif
84
85 /**********************************************************************
86          End of file
87 **********************************************************************/