FD.io VPP  v20.01-48-g3e0dafb74
Vector Packet Processing
mobile.h
Go to the documentation of this file.
1 /*
2  * srv6_end.h
3  *
4  * Copyright (c) 2019 Arrcus Inc and/or its affiliates.
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 #ifndef __included_srv6_end_h__
19 #define __included_srv6_end_h__
20 
21 #include <vnet/vnet.h>
22 #include <vnet/ip/ip.h>
23 #include <vnet/srv6/sr.h>
24 #include <vnet/srv6/sr_packet.h>
25 
26 #include <vppinfra/error.h>
27 #include <vppinfra/elog.h>
28 
29 #define SRV6_GTP_UDP_DST_PORT 2152
30 
31 #define SRV6_NHTYPE_NONE 0
32 #define SRV6_NHTYPE_IPV4 1
33 #define SRV6_NHTYPE_IPV6 2
34 #define SRV6_NHTYPE_NON_IP 3
35 
36 #ifndef IP_PROTOCOL_NONE
37 #define IP_PROTOCOL_NONE 59
38 #endif
39 
40 #define SRV6_GTP6_UNKNOW 0
41 #define SRV6_GTP6_DT4 1
42 #define SRV6_GTP6_DT6 2
43 #define SRV6_GTP6_DT46 3
44 
45 #if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
46 #define BITALIGN2(A,B) A; B
47 #define BITALIGN3(A,B,C) A; B; C
48 #else
49 #define BITALIGN2(A,B) B; A
50 #define BITALIGN3(A,B,C) C; B; A
51 #endif
52 
53 #define GTPU_EXTHDR_FLAG 0x04
54 #define GTPU_SEQ_FLAG 0x02
55 #define GTPU_EXTHDR_PDU_SESSION 0x85
56 
57 #define SRH_TAG_ECHO_REPLY 0x0008
58 #define SRH_TAG_ECHO_REQUEST 0x0004
59 #define SRH_TAG_ERROR_INDICATION 0x0002
60 #define SRH_TAG_END_MARKER 0x0001
61 
62 /* *INDENT-OFF* */
63 typedef struct
64 {
68 } __attribute__ ((packed)) gtpu_exthdr_t;
69 /* *INDENT-ON* */
70 
71 /* *INDENT-OFF* */
72 typedef struct
73 {
76  u16 length; /* length in octets of the payload */
78  gtpu_exthdr_t ext[0];
79 } __attribute__ ((packed)) gtpu_header_t;
80 /* *INDENT-ON* */
81 
82 #define GTPU_TYPE_ECHO_REQUEST 1
83 #define GTPU_TYPE_ECHO_REPLY 2
84 #define GTPU_TYPE_ERROR_INDICATION 26
85 #define GTPU_TYPE_END_MARKER 254
86 #define GTPU_TYPE_GTPU 255
87 
88 /* *INDENT-OFF* */
89 typedef struct
90 {
91  BITALIGN2 (u8 ppi:3,
92  u8 spare:5);
93 
94  u8 padding[3];
95 } __attribute__ ((packed)) gtpu_paging_policy_t;
96 /* *INDENT-ON* */
97 
98 /* *INDENT-OFF* */
99 typedef struct
100 {
102  BITALIGN2(u8 type:4,
103  u8 spare:4);
104  union {
105  struct gtpu_qfi_bits {BITALIGN3(u8 p:1,
106  u8 r:1,
107  u8 qfi:6);
108  } bits;
109 
111  } u;
112 
115 } __attribute__ ((packed)) gtpu_pdu_session_t;
116 /* *INDENT-ON* */
117 
118 #define GTPU_PDU_SESSION_P_BIT_MASK 0x80
119 #define GTPU_PDU_SESSION_R_BIT_MASK 0x40
120 #define GTPU_PDU_SESSION_QFI_MASK 0x3f
121 
122 #define SRV6_PDU_SESSION_U_BIT_MASK 0x01
123 #define SRV6_PDU_SESSION_R_BIT_MASK 0x02
124 #define SRV6_PDU_SESSION_QFI_MASK 0xfC
125 
126 /* *INDENT-OFF* */
127 typedef struct
128 {
129  ip4_header_t ip4; /* 20 bytes */
130  udp_header_t udp; /* 8 bytes */
131  gtpu_header_t gtpu; /* 8 bytes */
132 } __attribute__ ((packed)) ip4_gtpu_header_t;
133 /* *INDENT-ON* */
134 
135 /* *INDENT-OFF* */
136 typedef struct
137 {
138  ip6_header_t ip6; /* 40 bytes */
139  udp_header_t udp; /* 8 bytes */
140  gtpu_header_t gtpu; /* 8 bytes */
141 } __attribute__ ((packed)) ip6_gtpu_header_t;
142 /* *INDENT-ON* */
143 
144 #define GTPU_V1_VER (1<<5)
145 
146 #define GTPU_PT_GTP (1<<4)
147 
148 typedef struct srv6_end_gtp6_param_s
149 {
151 
155 
156 typedef struct srv6_end_gtp4_param_s
157 {
159 
162 
165 
168 
169 typedef struct srv6_end_main_v4_s
170 {
173 
176 
177  u32 dst_p_len; // dst prefix len
178  u32 src_p_len; // src prefix len
179 
181 
183 
185 {
188 
191 
194 
198 
199 typedef struct srv6_end_main_v6_s
200 {
203 
206 
209 
212 
214 {
217 
220 
223 
226 
228 {
231 
234 
237 
240 
241 #endif /* __included_srv6_end_h__ */
242 
243 /*
244  * fd.io coding-style-patch-verification: ON
245  *
246  * Local Variables:
247  * eval: (c-set-style "gnu")
248  * End:
249  */
srv6_end_main_v4_t srv6_end_main_v4
Definition: gtp4_e.c:24
ip6_header_t cache_hdr
Definition: mobile.h:221
u32 teid
Definition: mobile.h:77
vlib_node_registration_t srv6_end_m_gtp4_e
(constructor) VLIB_REGISTER_NODE (srv6_end_m_gtp4_e)
Definition: node.c:1051
u16 length
Definition: mobile.h:76
unsigned char u8
Definition: types.h:56
vnet_main_t * vnet_main
Definition: mobile.h:230
vlib_main_t * vlib_main
Definition: mobile.h:171
ip6_header_t ip6
Definition: mobile.h:138
unsigned int u32
Definition: types.h:88
vlib_main_t * vlib_main
Definition: mobile.h:186
u32 padding
Definition: vhost_user.h:141
struct srv6_end_main_v6_s srv6_end_main_v6_t
u8 npdu_num
Definition: mobile.h:66
vl_api_fib_path_type_t type
Definition: fib_types.api:123
gtpu_header_t gtpu
Definition: mobile.h:131
vnet_main_t * vnet_main
Definition: mobile.h:202
struct srv6_end_main_v6_decap_di_s srv6_end_main_v6_decap_di_t
unsigned short u16
Definition: types.h:57
struct srv6_end_gtp6_param_s srv6_end_gtp6_param_t
#define BITALIGN3(A, B, C)
Definition: mobile.h:50
vlib_main_t * vlib_main
Definition: mobile.h:229
struct srv6_end_gtp4_param_s srv6_end_gtp4_param_t
srv6_t_main_v4_decap_t srv6_t_main_v4_decap
Definition: gtp4_d.c:24
The fine-grained event logger allows lightweight, thread-safe event logging at minimum cost...
u32 end_m_gtp4_e_node_index
Definition: mobile.h:174
ip6_address_t v6src_prefix
Definition: mobile.h:163
struct srv6_end_main_v4_s srv6_end_main_v4_t
struct srv6_t_main_v4_decap_s srv6_t_main_v4_decap_t
struct srv6_end_main_v6_decap_s srv6_end_main_v6_decap_t
ip4_gtpu_header_t cache_hdr
Definition: mobile.h:180
ip6_gtpu_header_t cache_hdr
Definition: mobile.h:207
udp_header_t udp
Definition: mobile.h:139
u32 end_m_gtp6_e_node_index
Definition: mobile.h:204
vnet_main_t * vnet_main
Definition: mobile.h:216
srv6_end_main_v6_t srv6_end_main_v6
Definition: gtp6_e.c:24
vlib_node_registration_t srv6_end_m_gtp6_d_di
(constructor) VLIB_REGISTER_NODE (srv6_end_m_gtp6_d_di)
Definition: node.c:2234
u8 nextexthdr
Definition: mobile.h:67
vlib_main_t * vlib_main
Definition: mobile.h:201
u32 error_node_index
Definition: mobile.h:175
udp_header_t udp
Definition: mobile.h:130
struct _vlib_node_registration vlib_node_registration_t
ip4_header_t ip4
Definition: mobile.h:129
vlib_main_t * vlib_main
Definition: mobile.h:215
u32 error_node_index
Definition: mobile.h:205
vlib_node_registration_t srv6_end_m_gtp6_e
(constructor) VLIB_REGISTER_NODE (srv6_end_m_gtp6_e)
Definition: node.c:2210
vlib_node_registration_t srv6_end_m_gtp6_d
(constructor) VLIB_REGISTER_NODE (srv6_end_m_gtp6_d)
Definition: node.c:2222
ip6_address_t sr_prefix
Definition: mobile.h:152
vnet_main_t * vnet_main
Definition: mobile.h:187
vnet_main_t * vnet_main
Definition: mobile.h:172
Bits Octets 8 7 6 5 4 3 2 1 1 Version PT (*) E S PN 2 Message Type 3 Length (1st Octet) 4 Length...
Definition: mobile.h:72
ip6_address_t sr_prefix
Definition: mobile.h:160
Segment Routing data structures definitions.
u8 ver_flags
Definition: mobile.h:74
gtpu_header_t gtpu
Definition: mobile.h:140
srv6_end_main_v6_decap_t srv6_end_main_v6_decap
Definition: gtp6_d.c:24
ip6_header_t cache_hdr
Definition: mobile.h:192
ip6srv_combo_header_t cache_hdr
Definition: mobile.h:235
#define BITALIGN2(A, B)
Definition: mobile.h:49
srv6_end_main_v6_decap_di_t srv6_end_main_v6_decap_di
Definition: gtp6_d_di.c:24