844587ed033318270a8d8b218cdd9cf78e61da26
[o-du/l2.git] / src / cm / legtp.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 /* Defines API exchanged between DU_APP and EGTP */
20 #ifndef __LEGTP_H___
21 #define __LEGTP_H___
22
23 #include "gen.h"
24
25 #include "gen.x"
26
27 #define EGTP_TNL_MGMT_ADD 1
28 #define EGTP_TNL_MGMT_MOD 2
29 #define EGTP_TNL_MGMT_DEL 3
30
31 typedef enum egtpMsgType
32 {
33    EGTP_MSG_INVALID,         
34    EGTPU_MSG_ECHO_REQ,          
35    EGTPU_MSG_ECHO_RSP, 
36    EGTPU_MSG_ERROR_IND          = 26,
37    EGTPU_MSG_SUPP_EXT_HDR_NTF   = 31,
38    EGTPU_MSG_END_MARKER         = 254,
39    EGTPU_MSG_GPDU,
40    EGTP_MSG_MAX
41 }EgtpMsgType;
42
43 typedef struct egtpIpAddr
44 {
45    Bool      ipV4Pres;
46    uint32_t  ipV4Addr;
47 }EgtpIpAddr;
48
49 typedef struct egtpConfig
50 {
51    EgtpIpAddr  localIp;
52    uint16_t         localPort;
53    EgtpIpAddr  destIp;
54    uint16_t         destPort;
55    uint32_t       minTunnelId;
56    uint32_t       maxTunnelId;
57 }EgtpConfig;
58
59 typedef struct egtpTnlEvt
60 {
61    uint8_t        action;
62    uint32_t       lclTeid;
63    uint32_t       remTeid;
64    CmStatus  cfmStatus;
65 }EgtpTnlEvt;
66
67 /*Extension Header */
68 typedef struct egtpExtHdr
69 {
70    TknUInt16   udpPort;                       /**< UDP Port */
71    TknUInt16   pdcpNmb;                       /**< PDCP Number */
72 }EgtpExtHdr;
73
74 /*Structure for MsgHdr */
75 typedef struct egtpMsgHdr
76 {
77    TknUInt8      nPdu;                      /**< N-PDU Number */
78    TknUInt32     seqNum;                    /**< Sequence Number */
79    EgtpExtHdr extHdr;                       /**< Extension headers present flag */
80    uint32_t        teId;                         /**< Tunnel Endpoint Id */
81    uint8_t         msgType;                      /**< eGTP-U Message Type */
82 }EgtpMsgHdr;
83
84 typedef struct egtpMsg
85 {
86    EgtpMsgHdr msgHdr;
87    Buffer     *msg;
88 }EgtpMsg;
89
90 typedef uint8_t (*EgtpCfgReq) ARGS((Pst *pst, EgtpConfig egtpCfg));
91 typedef uint8_t (*EgtpCfgCfm) ARGS((CmStatus cfm));
92 typedef uint8_t (*EgtpInitReq) ARGS((Buffer *mBuf));
93 typedef uint8_t (*EgtpSrvOpenReq) ARGS(());
94 typedef uint8_t (*EgtpSrvOpenCfm) ARGS((CmStatus cfm));
95 typedef uint8_t (*EgtpTnlMgmtReq) ARGS((Pst *pst, EgtpTnlEvt tnlEvt));
96 typedef uint8_t (*EgtpTnlMgmtCfm) ARGS((EgtpTnlEvt tnlEvt));
97 typedef uint8_t (*EgtpSlotInd) ARGS(());
98   
99 uint8_t packEgtpCfgReq(Pst *pst, EgtpConfig  egtpCfg);
100 uint8_t unpackEgtpCfgReq(EgtpCfgReq func , Pst *pst, Buffer *mBuf);
101 uint8_t packEgtpCfgCfm(Pst *pst, CmStatus cfm);
102 uint8_t unpackEgtpCfgCfm(EgtpCfgCfm func, Buffer *mBuf);
103 uint8_t packEgtpSrvOpenReq(Pst *pst);
104 uint8_t unpackkEgtpSrvOpenReq(EgtpSrvOpenReq func, Pst *pst, Buffer *mBuf);
105 uint8_t packEgtpSrvOpenCfm(Pst *pst, CmStatus cfm);
106 uint8_t unpackEgtpSrvOpenCfm(EgtpSrvOpenCfm func, Buffer *mBuf);
107 uint8_t packEgtpTnlMgmtReq(Pst *pst, EgtpTnlEvt tnlEvt);
108 uint8_t unpackEgtpTnlMgmtReq(EgtpTnlMgmtReq func, Pst *pst, Buffer *mBuf);
109 uint8_t egtpTnlMgmtReq(Pst *pst, EgtpTnlEvt tnlEvt);
110 uint8_t packEgtpTnlMgmtCfm(Pst *pst, EgtpTnlEvt tnlEvt);
111 uint8_t duHdlEgtpTnlMgmtCfm(EgtpTnlEvt tnlEvtCfm);
112 uint8_t unpackEgtpTnlMgmtCfm(EgtpTnlMgmtCfm func, Buffer *mBuf);
113 uint8_t packEgtpStartPollingReq(Pst *pst);
114 #endif