MAP: Convert from DPO to input feature.
[vpp.git] / src / plugins / map / map.api
1 /*
2  * Copyright (c) 2016 Cisco and/or its affiliates.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at:
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15
16 option version = "3.0.0";
17
18 import "vnet/ip/ip_types.api";
19
20 /** \brief Add MAP domains
21     @param client_index - opaque cookie to identify the sender
22     @param context - sender context, to match reply w/ request
23     @param ip6_prefix - Rule IPv6 prefix
24     @param ip4_prefix - Rule IPv4 prefix
25     @param ip6_src - MAP domain IPv6 BR address / Tunnel source
26     @param ea_bits_len - Embedded Address bits length
27     @param psid_offset - Port Set Identifider (PSID) offset
28     @param psid_length - PSID length
29     @param mtu - MTU
30 */
31 define map_add_domain
32 {
33   u32 client_index;
34   u32 context;
35   vl_api_ip6_prefix_t ip6_prefix;
36   vl_api_ip4_prefix_t ip4_prefix;
37   vl_api_ip6_prefix_t ip6_src;
38   u8 ea_bits_len;
39   u8 psid_offset;
40   u8 psid_length;
41   u16 mtu;
42 };
43
44 /** \brief Reply for MAP domain add
45     @param context - returned sender context, to match reply w/ request
46     @param index - MAP domain index
47     @param retval - return code
48 */
49 define map_add_domain_reply
50 {
51   u32 context;
52   u32 index;
53   i32 retval;
54 };
55
56 /** \brief Delete MAP domain
57     @param client_index - opaque cookie to identify the sender
58     @param context - sender context, to match reply w/ request
59     @param index - MAP Domain index
60 */
61 autoreply define map_del_domain
62 {
63   u32 client_index;
64   u32 context;
65   u32 index;
66 };
67
68
69 /** \brief Add or Delete MAP rule from a domain (Only used for shared IPv4 per subscriber)
70     @param client_index - opaque cookie to identify the sender
71     @param context - sender context, to match reply w/ request
72     @param index - MAP Domain index
73     @param is_add - If 1 add rule, if 0 delete rule
74     @param ip6_dst - MAP CE IPv6 address
75     @param psid - Rule PSID
76 */
77 autoreply define map_add_del_rule
78 {
79   u32 client_index;
80   u32 context;
81   u32 index;
82   bool is_add;
83   vl_api_ip6_address_t ip6_dst;
84   u16 psid;
85 };
86
87
88 /** \brief Get list of map domains
89     @param client_index - opaque cookie to identify the sender
90 */
91 define map_domain_dump
92 {
93   u32 client_index;
94   u32 context;
95 };
96
97 define map_domain_details
98 {
99   u32 context;
100   u32 domain_index;
101   vl_api_ip6_prefix_t ip6_prefix;
102   vl_api_ip4_prefix_t ip4_prefix;
103   vl_api_ip6_prefix_t ip6_src;
104   u8 ea_bits_len;
105   u8 psid_offset;
106   u8 psid_length;
107   u8 flags;
108   u16 mtu;
109 };
110
111 define map_rule_dump
112 {
113   u32 client_index;
114   u32 context;
115   u32 domain_index;
116 };
117
118 define map_rule_details
119 {
120   u32 context;
121   vl_api_ip6_address_t ip6_dst;
122   u16 psid;
123 };
124
125 /** \brief Enable or disable a MAP interface
126     @param client_index - opaque cookie to identify the sender
127     @param context - sender context, to match reply w/ request
128     @param sw_if_index - 
129     @param is_enable - 0=disable, 1=enable interface
130     @param is_translation -  0=encapsulation, 1=translation
131 */
132 autoreply define map_if_enable_disable
133 {
134   u32 client_index;
135   u32 context;
136   u32 sw_if_index;
137   bool is_enable;
138   bool is_translation; /* 0 - encapsulation, 1 - translation */
139 };
140
141 /** \brief Request for a single block of summary stats
142     @param client_index - opaque cookie to identify the sender
143     @param context - sender context, to match reply w/ request
144 */
145 define map_summary_stats
146 {
147   u32 client_index;
148   u32 context;
149 };
150
151 /** \brief Reply for map_summary_stats request
152     @param context - sender context, to match reply w/ request
153     @param retval - return code for request
154     @param total_bindings -
155     @param total_pkts -
156     @param total_ip4_fragments -
157     @param total_security_check -
158 */
159 define map_summary_stats_reply
160 {
161   u32 context;
162   i32 retval;
163   u64 total_bindings;
164   u64 total_pkts[2];
165   u64 total_bytes[2];
166   u64 total_ip4_fragments;
167   u64 total_security_check[2];
168 };
169
170
171 /** \brief Set MAP fragmentation parameters
172     @param client_index - opaque cookie to identify the sender
173     @param context - sender context, to match reply w/ request
174     @param inner - 1=frag inner packet, 0=frag tunnel packets
175     @param ignore_df - 1=IP4 fragment despite DF bit, 0=honor DF
176 */
177 autoreply define map_param_set_fragmentation
178 {
179   u32 client_index;
180   u32 context;
181   bool inner;
182   bool ignore_df;
183 };
184
185
186 /** \brief Set MAP ICMP parameters
187     @param client_index - opaque cookie to identify the sender
188     @param context - sender context, to match reply w/ request
189     @param icmp4_err_relay_src - IPv4 ICMP err relay src address
190 */
191 autoreply define map_param_set_icmp
192 {
193   u32 client_index;
194   u32 context;
195   vl_api_ip4_address_t ip4_err_relay_src;
196 };
197
198
199 /** \brief Set MAP ICMP6 parameters
200     @param client_index - opaque cookie to identify the sender
201     @param context - sender context, to match reply w/ request
202     @param enable_unreachable - 1 = send ICMP unreachable err msgs
203 */
204 autoreply define map_param_set_icmp6
205 {
206   u32 client_index;
207   u32 context;
208   bool enable_unreachable;
209 };
210
211
212 /** \brief Add/delete MAP pre-resolve IP addresses parameters
213     @param client_index - opaque cookie to identify the sender
214     @param context - sender context, to match reply w/ request
215     @param is_add - 1 = Add non-zero IP addresses, 0 = delete
216     @param ip4_nh_address - direct IP4 next-hop address
217     @param ip6_nh_address - direct IP6 next-hop address
218 */
219 autoreply define map_param_add_del_pre_resolve
220 {
221   u32 client_index;
222   u32 context;
223   bool is_add;
224   vl_api_ip4_address_t ip4_nh_address;
225   vl_api_ip6_address_t ip6_nh_address;
226 };
227
228
229 /** \brief Set MAP reassembly parameters
230     @param client_index - opaque cookie to identify the sender
231     @param context - sender context, to match reply w/ request
232     @param is_ip6 - 1 = params apply to IPv6, 0 = params apply to IPv4
233     @param lifetime_ms - reassembly valid lifetime, or ~0
234     @param pool_size - max number of reassemblies, or ~0
235     @param buffers -  max number of reassembly buffers, or ~0 
236     @param ht_ratio - hash-table size factor, or ~0
237 */
238 autoreply define map_param_set_reassembly
239 {
240   u32 client_index;
241   u32 context;
242   bool is_ip6;
243   u16 lifetime_ms;
244   u16 pool_size;
245   u32 buffers;
246   f64 ht_ratio;
247 };
248
249
250 /** \brief Set MAP security-check parameters
251     @param client_index - opaque cookie to identify the sender
252     @param context - sender context, to match reply w/ request
253     @param enable - 1=enable security check on first inbound packet
254     @param fragments - 1=enable check on (subsequent) fragments too
255 */
256 autoreply define map_param_set_security_check
257 {
258   u32 client_index;
259   u32 context;
260   bool enable;
261   bool fragments;
262 };
263
264
265 /** \brief Set MAP traffic class parameters
266     @param client_index - opaque cookie to identify the sender
267     @param context - sender context, to match reply w/ request
268     @param copy - 1 = copy packet class/TOS field, 0 = use class instead
269     @param class - class field value when copy == 0
270 */
271 autoreply define map_param_set_traffic_class
272 {
273   u32 client_index;
274   u32 context;
275   bool copy;
276   u8 class;
277 };
278
279
280 /** \brief Set MAP TCP parammeters
281     @param client_index - opaque cookie to identify the sender
282     @param context - sender context, to match reply w/ request
283     @parma tcp_mss - TCP MSS clamping value
284 */
285 autoreply define map_param_set_tcp
286 {
287   u32 client_index;
288   u32 context;
289   u16 tcp_mss;
290 };
291
292
293 /** \brief Request for a single block of MAP parameters
294     @param client_index - opaque cookie to identify the sender
295     @param context - sender context, to match reply w/ request
296 */
297 define map_param_get
298 {
299   u32 client_index;
300   u32 context;
301 };
302
303
304 /** \brief Reply for map_param_get request
305     @param context - sender context, to match reply w/ request
306     @param retval - return code for request
307     @param inner - 1=frag inner packet, 0=frag tunnel packets, ~0=untouched
308     @param ignore_df - 1=IP4 fragm despite DF bit, 0=honor DF, ~0=untouched
309     @param icmp_ip4_err_relay_src - IPv4 ICMP err relay src address
310     @param icmp6_enable_unreachable - 1 = send ICMP unreachable err msgs
311     @param ip4_nh_address - direct IP4 next-hop address
312     @param ip6_nh_address - direct IP6 next-hop address
313     @param ip4_lifetime_ms - reassembly valid lifetime, or ~0
314     @param ip4_pool_size - max number of reassemblies, or ~0
315     @param ip4_buffers -  max number of reassembly buffers, or ~0
316     @param ip4_ht_ratio - reassembly valid lifetime, or ~0
317     @param ip6_lifetime_ms - max number of reassemblies, or ~0
318     @param ip6_pool_size - max number of reassemblies, or ~0
319     @param ip6_buffers -  max number of reassembly buffers, or ~0 
320     @param ip6_ht_ratio - hash-table size factor, or ~0
321     @param sec_check_enable - 1=enable security check on first inbound packet
322     @param sec_check_fragments - 1=enable check on (subsequent) fragments too
323     @param tc_copy - 1 = copy packet class/TOS field, 0 = use class instead
324     @param tc_class - class field value when copy == 0
325 */
326 define map_param_get_reply
327 {
328   u32 context;
329   i32 retval;
330   u8 frag_inner;
331   u8 frag_ignore_df;
332   vl_api_ip4_address_t icmp_ip4_err_relay_src;
333   bool icmp6_enable_unreachable;
334   vl_api_ip4_address_t ip4_nh_address;
335   vl_api_ip6_address_t ip6_nh_address;
336   u16 ip4_lifetime_ms;
337   u16 ip4_pool_size;
338   u32 ip4_buffers;
339   f64 ip4_ht_ratio;
340   u16 ip6_lifetime_ms;
341   u16 ip6_pool_size;
342   u32 ip6_buffers;
343   f64 ip6_ht_ratio;
344   bool sec_check_enable;
345   bool sec_check_fragments;
346   bool tc_copy;
347   u8 tc_class;
348 };