Merge "SIB1 optional parameters, Cell start request, stop request and slot indication"
[o-du/l2.git] / src / du_app / du_egtp.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_EGTP_H__
22 #define __DU_EGTP_H__
23
24 #include "du_mgr.h"
25 #include "du_log.h"
26 #include "cm_inet.h"
27 #include "cm_tpt.h"
28 #include "legtp.h"
29  
30 #include "cm_inet.x"
31 #include "cm_tpt.x"
32
33 #define EGTP_DFLT_PORT 2152
34 #define EGTP_MAX_HDR_LEN 40
35 #define EGTP_MAX_MSG_RECV 10
36
37 #define EGTP_EXT_HDR_UDP_TYPE 64
38 #define EGTP_EXT_HDR_PDCP_TYPE 192
39
40 #define EGTP_MASK_BIT1                   0x01
41 #define EGTP_MASK_BIT2                   0x02
42 #define EGTP_MASK_BIT3                   0x04
43 #define EGTP_MASK_BIT4                   0x08
44 #define EGTP_MASK_BIT5                   0x10
45 #define EGTP_MASK_BIT6                   0x20
46 #define EGTP_MASK_BIT7                   0x40
47 #define EGTP_MASK_BIT8                   0x80
48
49
50 U8         protType;
51
52 typedef struct egtpTptSrvr
53 {
54    CmInetAddr  addr; 
55    CmInetFd    sockFd;     /* Socket file descriptor */
56 }EgtpTptSrvr;
57
58 typedef struct EgtpTeIdCb
59 {
60    U32 teId;              /* Local tunnel id */
61    U32 remTeId;           /* Remote tunnel id */
62    struct
63    {
64       U8 hdr[EGTP_MAX_HDR_LEN];
65       U8 cnt;
66    }preEncodedHdr;        /* Pre-encoded header for PDUs on this tunnel */
67 }EgtpTeIdCb;
68
69 typedef struct egtpDstCb
70 {
71    CmInetIpAddr  dstIp;          /* destination IP */
72    U16           dstPort;        /* destination port that sends data */
73    EgtpTptSrvr   sendTptSrvr;    /* Transport server for sending UDP msg to */
74    U32           numTunn;        /* Number of tunnels */
75    CmHashListCp  teIdLst;        /* Tunnel Id list for this destination */
76 }EgtpDstCb;
77
78 typedef struct egtpGlobalCb
79 {
80    EgtpConfig   egtpCfg;         /* EGTP configuration */
81    EgtpTptSrvr  recvTptSrvr;     /* Transport server for receiving UDP msg */
82    EgtpDstCb    dstCb;           /* Destination endpoint */
83 }EgtpGlobalCb;
84 extern EgtpGlobalCb egtpCb;   /* EGTP global control block */
85
86 S16 egtpActvInit(Ent entity, Inst inst, Region region, Reason reason);
87 S16 egtpActvTsk(Pst *pst, Buffer *mBuf);
88 S16 egtpFillRspPst(Pst *pst, Pst *rspPst);
89 S16 egtpCfgReq(Pst *pst, EgtpConfig egtpCfg);
90 S16 egtpSrvOpenReq(Pst *pst);
91 S16 egtpSrvOpenPrc(U8 sockType, EgtpTptSrvr *server);
92 S16 egtpTnlMgmtReq(Pst *pst, EgtpTnlEvt tnlEvt);
93 S16 egtpTnlAdd(EgtpTnlEvt tnlEvt);
94 S16 egtpTnlMod(EgtpTnlEvt tnlEvt);
95 S16 egtpTnlDel(EgtpTnlEvt tnlEvt);
96 S16 egtpHdlDatInd(EgtpMsg msg);
97 S16 egtpEncodeHdr(U8 *preEncodedHdr, EgtpMsgHdr *preDefHdr, U8 *hdrIdx);
98 S16 egtpSendMsg(Buffer *mBuf);
99 S16 egtpSlotInd();
100 S16 egtpRecvMsg();
101 S16 egtpHdlRecvData(Buffer *mBuf);
102 S16 egtpDecodeHdr(Buffer *mBuf, EgtpMsg  *egtpMsg);
103
104 #endif