MAP: Add API support for MAP 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 = "2.3.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   bool is_translation;
42   bool is_rfc6052;
43   u16 mtu;
44 };
45
46 /** \brief Reply for MAP domain add
47     @param context - returned sender context, to match reply w/ request
48     @param index - MAP domain index
49     @param retval - return code
50 */
51 define map_add_domain_reply
52 {
53   u32 context;
54   u32 index;
55   i32 retval;
56 };
57
58 /** \brief Delete MAP domain
59     @param client_index - opaque cookie to identify the sender
60     @param context - sender context, to match reply w/ request
61     @param index - MAP Domain index
62 */
63 autoreply define map_del_domain
64 {
65   u32 client_index;
66   u32 context;
67   u32 index;
68 };
69
70
71 /** \brief Add or Delete MAP rule from a domain (Only used for shared IPv4 per subscriber)
72     @param client_index - opaque cookie to identify the sender
73     @param context - sender context, to match reply w/ request
74     @param index - MAP Domain index
75     @param is_add - If 1 add rule, if 0 delete rule
76     @param ip6_dst - MAP CE IPv6 address
77     @param psid - Rule PSID
78 */
79 autoreply define map_add_del_rule
80 {
81   u32 client_index;
82   u32 context;
83   u32 index;
84   bool is_add;
85   vl_api_ip6_address_t ip6_dst;
86   u16 psid;
87 };
88
89
90 /** \brief Get list of map domains
91     @param client_index - opaque cookie to identify the sender
92 */
93 define map_domain_dump
94 {
95   u32 client_index;
96   u32 context;
97 };
98
99 define map_domain_details
100 {
101   u32 context;
102   u32 domain_index;
103   vl_api_ip6_prefix_t ip6_prefix;
104   vl_api_ip4_prefix_t ip4_prefix;
105   vl_api_ip6_prefix_t ip6_src;
106   u8 ea_bits_len;
107   u8 psid_offset;
108   u8 psid_length;
109   u8 flags;
110   u16 mtu;
111   bool is_translation;
112 };
113
114 define map_rule_dump
115 {
116   u32 client_index;
117   u32 context;
118   u32 domain_index;
119 };
120
121 define map_rule_details
122 {
123   u32 context;
124   vl_api_ip6_address_t ip6_dst;
125   u16 psid;
126 };
127
128 /** \brief Enable or disable a MAP interface
129     @param client_index - opaque cookie to identify the sender
130     @param context - sender context, to match reply w/ request
131     @param sw_if_index - 
132     @param is_enable - 0=disable, 1=enable interface
133     @param is_translation -  0=encapsulation, 1=translation
134 */
135 autoreply define map_if_enable_disable
136 {
137   u32 client_index;
138   u32 context;
139   u32 sw_if_index;
140   bool is_enable;
141   bool is_translation; /* 0 - encapsulation, 1 - translation */
142 };
143
144 /** \brief Request for a single block of summary stats
145     @param client_index - opaque cookie to identify the sender
146     @param context - sender context, to match reply w/ request
147 */
148 define map_summary_stats
149 {
150   u32 client_index;
151   u32 context;
152 };
153
154 /** \brief Reply for map_summary_stats request
155     @param context - sender context, to match reply w/ request
156     @param retval - return code for request
157     @param total_bindings -
158     @param total_pkts -
159     @param total_ip4_fragments -
160     @param total_security_check -
161 */
162 define map_summary_stats_reply
163 {
164   u32 context;
165   i32 retval;
166   u64 total_bindings;
167   u64 total_pkts[2];
168   u64 total_bytes[2];
169   u64 total_ip4_fragments;
170   u64 total_security_check[2];
171 };
172
173
174 /** \brief Set MAP fragmentation parameters
175     @param client_index - opaque cookie to identify the sender
176     @param context - sender context, to match reply w/ request
177     @param inner - 1=frag inner packet, 0=frag tunnel packets
178     @param ignore_df - 1=IP4 fragment despite DF bit, 0=honor DF
179 */
180 autoreply define map_param_set_fragmentation
181 {
182   u32 client_index;
183   u32 context;
184   bool inner;
185   bool ignore_df;
186 };
187
188
189 /** \brief Set MAP ICMP parameters
190     @param client_index - opaque cookie to identify the sender
191     @param context - sender context, to match reply w/ request
192     @param icmp4_err_relay_src - IPv4 ICMP err relay src address
193 */
194 autoreply define map_param_set_icmp
195 {
196   u32 client_index;
197   u32 context;
198   vl_api_ip4_address_t ip4_err_relay_src;
199 };
200
201
202 /** \brief Set MAP ICMP6 parameters
203     @param client_index - opaque cookie to identify the sender
204     @param context - sender context, to match reply w/ request
205     @param enable_unreachable - 1 = send ICMP unreachable err msgs
206 */
207 autoreply define map_param_set_icmp6
208 {
209   u32 client_index;
210   u32 context;
211   bool enable_unreachable;
212 };
213
214
215 /** \brief Add/delete MAP pre-resolve IP addresses parameters
216     @param client_index - opaque cookie to identify the sender
217     @param context - sender context, to match reply w/ request
218     @param is_add - 1 = Add non-zero IP addresses, 0 = delete
219     @param ip4_nh_address - direct IP4 next-hop address
220     @param ip6_nh_address - direct IP6 next-hop address
221 */
222 autoreply define map_param_add_del_pre_resolve
223 {
224   u32 client_index;
225   u32 context;
226   bool is_add;
227   vl_api_ip4_address_t ip4_nh_address;
228   vl_api_ip6_address_t ip6_nh_address;
229 };
230
231
232 /** \brief Set MAP reassembly parameters
233     @param client_index - opaque cookie to identify the sender
234     @param context - sender context, to match reply w/ request
235     @param is_ip6 - 1 = params apply to IPv6, 0 = params apply to IPv4
236     @param lifetime_ms - reassembly valid lifetime, or ~0
237     @param pool_size - max number of reassemblies, or ~0
238     @param buffers -  max number of reassembly buffers, or ~0 
239     @param ht_ratio - hash-table size factor, or ~0
240 */
241 autoreply define map_param_set_reassembly
242 {
243   u32 client_index;
244   u32 context;
245   bool is_ip6;
246   u16 lifetime_ms;
247   u16 pool_size;
248   u32 buffers;
249   f64 ht_ratio;
250 };
251
252
253 /** \brief Set MAP security-check parameters
254     @param client_index - opaque cookie to identify the sender
255     @param context - sender context, to match reply w/ request
256     @param enable - 1=enable security check on first inbound packet
257     @param fragments - 1=enable check on (subsequent) fragments too
258 */
259 autoreply define map_param_set_security_check
260 {
261   u32 client_index;
262   u32 context;
263   bool enable;
264   bool fragments;
265 };
266
267
268 /** \brief Set MAP traffic class parameters
269     @param client_index - opaque cookie to identify the sender
270     @param context - sender context, to match reply w/ request
271     @param copy - 1 = copy packet class/TOS field, 0 = use class instead
272     @param class - class field value when copy == 0
273 */
274 autoreply define map_param_set_traffic_class
275 {
276   u32 client_index;
277   u32 context;
278   bool copy;
279   u8 class;
280 };
281
282
283 /** \brief Set MAP TCP parammeters
284     @param client_index - opaque cookie to identify the sender
285     @param context - sender context, to match reply w/ request
286     @parma tcp_mss - TCP MSS clamping value
287 */
288 autoreply define map_param_set_tcp
289 {
290   u32 client_index;
291   u32 context;
292   u16 tcp_mss;
293 };
294
295
296 /** \brief Request for a single block of MAP parameters
297     @param client_index - opaque cookie to identify the sender
298     @param context - sender context, to match reply w/ request
299 */
300 define map_param_get
301 {
302   u32 client_index;
303   u32 context;
304 };
305
306
307 /** \brief Reply for map_param_get request
308     @param context - sender context, to match reply w/ request
309     @param retval - return code for request
310     @param inner - 1=frag inner packet, 0=frag tunnel packets, ~0=untouched
311     @param ignore_df - 1=IP4 fragm despite DF bit, 0=honor DF, ~0=untouched
312     @param icmp_ip4_err_relay_src - IPv4 ICMP err relay src address
313     @param icmp6_enable_unreachable - 1 = send ICMP unreachable err msgs
314     @param ip4_nh_address - direct IP4 next-hop address
315     @param ip6_nh_address - direct IP6 next-hop address
316     @param ip4_lifetime_ms - reassembly valid lifetime, or ~0
317     @param ip4_pool_size - max number of reassemblies, or ~0
318     @param ip4_buffers -  max number of reassembly buffers, or ~0
319     @param ip4_ht_ratio - reassembly valid lifetime, or ~0
320     @param ip6_lifetime_ms - max number of reassemblies, or ~0
321     @param ip6_pool_size - max number of reassemblies, or ~0
322     @param ip6_buffers -  max number of reassembly buffers, or ~0 
323     @param ip6_ht_ratio - hash-table size factor, or ~0
324     @param sec_check_enable - 1=enable security check on first inbound packet
325     @param sec_check_fragments - 1=enable check on (subsequent) fragments too
326     @param tc_copy - 1 = copy packet class/TOS field, 0 = use class instead
327     @param tc_class - class field value when copy == 0
328 */
329 define map_param_get_reply
330 {
331   u32 context;
332   i32 retval;
333   u8 frag_inner;
334   u8 frag_ignore_df;
335   vl_api_ip4_address_t icmp_ip4_err_relay_src;
336   bool icmp6_enable_unreachable;
337   vl_api_ip4_address_t ip4_nh_address;
338   vl_api_ip6_address_t ip6_nh_address;
339   u16 ip4_lifetime_ms;
340   u16 ip4_pool_size;
341   u32 ip4_buffers;
342   f64 ip4_ht_ratio;
343   u16 ip6_lifetime_ms;
344   u16 ip6_pool_size;
345   u32 ip6_buffers;
346   f64 ip6_ht_ratio;
347   bool sec_check_enable;
348   bool sec_check_fragments;
349   bool tc_copy;
350   u8 tc_class;
351 };