flow: The type of vni in VxLAN flow should be u32
[vpp.git] / src / vnet / flow / flow_types.api
1 /* Hey Emacs use -*- mode: C -*- */
2 /*
3  * Copyright (c) 2020 Intel and/or its affiliates.
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at:
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 option version = "0.0.3";
18 import "vnet/ethernet/ethernet_types.api";
19 import "vnet/ip/ip_types.api";
20
21 enum flow_type
22 {
23   FLOW_TYPE_ETHERNET = 1,
24   FLOW_TYPE_IP4,
25   FLOW_TYPE_IP6,
26   FLOW_TYPE_IP4_L2TPV3OIP,
27   FLOW_TYPE_IP4_IPSEC_ESP,
28   FLOW_TYPE_IP4_IPSEC_AH,
29   FLOW_TYPE_IP4_N_TUPLE,
30   FLOW_TYPE_IP6_N_TUPLE,
31   FLOW_TYPE_IP4_N_TUPLE_TAGGED,
32   FLOW_TYPE_IP6_N_TUPLE_TAGGED,
33   FLOW_TYPE_IP4_VXLAN,
34   FLOW_TYPE_IP6_VXLAN,
35   FLOW_TYPE_IP4_GTPC,
36   FLOW_TYPE_IP4_GTPU,
37 };
38
39 enum flow_action
40 {
41   FLOW_ACTION_COUNT = 1,
42   FLOW_ACTION_MARK = 2,
43   FLOW_ACTION_BUFFER_ADVANCE = 4,
44   FLOW_ACTION_REDIRECT_TO_NODE = 8,
45   FLOW_ACTION_REDIRECT_TO_QUEUE = 16,
46   FLOW_ACTION_DROP = 64,
47 };
48
49 typedef ip_port_and_mask
50 {
51   u16 port;
52   u16 mask;
53 };
54
55 typedef ip_prot_and_mask
56 {
57   vl_api_ip_proto_t prot;
58   u8 mask;
59 };
60
61 typedef flow_ethernet
62 {
63   i32 foo;
64   vl_api_mac_address_t src_addr;
65   vl_api_mac_address_t dst_addr;
66   u16 type;
67 };
68
69 typedef flow_ip4
70 {
71   i32 foo;
72   vl_api_ip4_address_and_mask_t src_addr;
73   vl_api_ip4_address_and_mask_t dst_addr;
74   vl_api_ip_prot_and_mask_t protocol;
75 };
76
77 typedef flow_ip6
78 {
79   i32 foo;
80   vl_api_ip6_address_and_mask_t src_addr;
81   vl_api_ip6_address_and_mask_t dst_addr;
82   vl_api_ip_prot_and_mask_t protocol;
83 };
84
85 typedef flow_ip4_n_tuple
86 {
87   i32 foo;
88   vl_api_ip4_address_and_mask_t src_addr;
89   vl_api_ip4_address_and_mask_t dst_addr;
90   vl_api_ip_prot_and_mask_t protocol;
91   vl_api_ip_port_and_mask_t src_port;
92   vl_api_ip_port_and_mask_t dst_port;
93 };
94
95 typedef flow_ip6_n_tuple
96 {
97   i32 foo;
98   vl_api_ip6_address_and_mask_t src_addr;
99   vl_api_ip6_address_and_mask_t dst_addr;
100   vl_api_ip_prot_and_mask_t protocol;
101   vl_api_ip_port_and_mask_t src_port;
102   vl_api_ip_port_and_mask_t dst_port;
103 };
104
105 typedef flow_ip4_n_tuple_tagged
106 {
107   i32 foo;
108   vl_api_ip4_address_and_mask_t src_addr;
109   vl_api_ip4_address_and_mask_t dst_addr;
110   vl_api_ip_prot_and_mask_t protocol;
111   vl_api_ip_port_and_mask_t src_port;
112   vl_api_ip_port_and_mask_t dst_port;
113 };
114
115 typedef flow_ip6_n_tuple_tagged
116 {
117   i32 foo;
118   vl_api_ip6_address_and_mask_t src_addr;
119   vl_api_ip6_address_and_mask_t dst_addr;
120   vl_api_ip_prot_and_mask_t protocol;
121   vl_api_ip_port_and_mask_t src_port;
122   vl_api_ip_port_and_mask_t dst_port;
123 };
124
125 typedef flow_ip4_l2tpv3oip
126 {
127   i32 foo;
128   vl_api_ip4_address_and_mask_t src_addr;
129   vl_api_ip4_address_and_mask_t dst_addr;
130   vl_api_ip_prot_and_mask_t protocol;
131   u32 session_id;
132 };
133
134 typedef flow_ip4_ipsec_esp
135 {
136   i32 foo;
137   vl_api_ip4_address_and_mask_t src_addr;
138   vl_api_ip4_address_and_mask_t dst_addr;
139   vl_api_ip_prot_and_mask_t protocol;
140   u32 spi;
141 };
142
143 typedef flow_ip4_ipsec_ah
144 {
145   i32 foo;
146   vl_api_ip4_address_and_mask_t src_addr;
147   vl_api_ip4_address_and_mask_t dst_addr;
148   vl_api_ip_prot_and_mask_t protocol;
149   u32 spi;
150 };
151
152 typedef flow_ip4_vxlan
153 {
154   i32 foo;
155   vl_api_ip4_address_and_mask_t src_addr;
156   vl_api_ip4_address_and_mask_t dst_addr;
157   vl_api_ip_prot_and_mask_t protocol;
158   vl_api_ip_port_and_mask_t src_port;
159   vl_api_ip_port_and_mask_t dst_port;
160   u32 vni;
161 };
162
163 typedef flow_ip6_vxlan
164 {
165   i32 foo;
166   vl_api_ip6_address_and_mask_t src_addr;
167   vl_api_ip6_address_and_mask_t dst_addr;
168   vl_api_ip_prot_and_mask_t protocol;
169   vl_api_ip_port_and_mask_t src_port;
170   vl_api_ip_port_and_mask_t dst_port;
171   u32 vni;
172 };
173
174 typedef flow_ip4_gtpc
175 {
176   i32 foo;
177   vl_api_ip4_address_and_mask_t src_addr;
178   vl_api_ip4_address_and_mask_t dst_addr;
179   vl_api_ip_prot_and_mask_t protocol;
180   vl_api_ip_port_and_mask_t src_port;
181   vl_api_ip_port_and_mask_t dst_port;
182   u32 teid;
183 };
184
185 typedef flow_ip4_gtpu
186 {
187   i32 foo;
188   vl_api_ip4_address_and_mask_t src_addr;
189   vl_api_ip4_address_and_mask_t dst_addr;
190   vl_api_ip_prot_and_mask_t protocol;
191   vl_api_ip_port_and_mask_t src_port;
192   vl_api_ip_port_and_mask_t dst_port;
193   u32 teid;
194 };
195
196 union flow
197 {
198   vl_api_flow_ethernet_t ethernet;
199   vl_api_flow_ip4_t ip4;
200   vl_api_flow_ip6_t ip6;
201   vl_api_flow_ip4_l2tpv3oip_t ip4_l2tpv3oip;
202   vl_api_flow_ip4_ipsec_esp_t ip4_ipsec_esp;
203   vl_api_flow_ip4_ipsec_ah_t ip4_ipsec_ah;
204   vl_api_flow_ip4_n_tuple_t ip4_n_tuple;
205   vl_api_flow_ip6_n_tuple_t ip6_n_tuple;
206   vl_api_flow_ip4_n_tuple_tagged_t ip4_n_tuple_tagged;
207   vl_api_flow_ip6_n_tuple_tagged_t ip6_n_tuple_tagged;
208   vl_api_flow_ip4_vxlan_t ip4_vxlan;
209   vl_api_flow_ip6_vxlan_t ip6_vxlan;
210   vl_api_flow_ip4_gtpc_t ip4_gtpc;
211   vl_api_flow_ip4_gtpu_t ip4_gtpu;
212 };
213
214 /* main flow struct */
215 typedef flow_rule
216 {
217   /* flow type */
218   vl_api_flow_type_t type;
219   
220   /* flow index */
221   u32 index;
222   
223   /* bitmap of flow actions (FLOW_ACTION_*) */
224   vl_api_flow_action_t actions;
225
226   /* flow id for VNET_FLOW_ACTION_MARK */
227   u32 mark_flow_id;
228
229   /* node index and next index for FLOW_ACTION_REDIRECT_TO_NODE */
230   u32 redirect_node_index;
231   u32 redirect_device_input_next_index;
232
233   /* queue for FLOW_ACTION_REDIRECT_TO_QUEUE */
234   u32 redirect_queue;
235
236   /* buffer offset for FLOW_ACTION_BUFFER_ADVANCE */
237   i32 buffer_advance;
238   
239   /* flow enum */
240   vl_api_flow_t flow;
241 };
242