hs-test: logging improvements
[vpp.git] / src / plugins / dhcp / dhcp.api
1 /*
2  * Copyright (c) 2015-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.1";
17
18 import "vnet/interface_types.api";
19 import "vnet/ip/ip_types.api";
20 import "vnet/ethernet/ethernet_types.api";
21
22 enum vss_type {
23   VSS_TYPE_API_ASCII = 0,
24   VSS_TYPE_API_VPN_ID = 1,
25   VSS_TYPE_API_INVALID = 123,
26   VSS_TYPE_API_DEFAULT = 255,
27 };
28
29 enum dhcp_client_state {
30   DHCP_CLIENT_STATE_API_DISCOVER,
31   DHCP_CLIENT_STATE_API_REQUEST,
32   DHCP_CLIENT_STATE_API_BOUND,
33 };
34
35 enum dhcpv6_msg_type
36 {
37   DHCPV6_MSG_API_SOLICIT = 1,
38   DHCPV6_MSG_API_ADVERTISE = 2,
39   DHCPV6_MSG_API_REQUEST = 3,
40   DHCPV6_MSG_API_CONFIRM = 4,
41   DHCPV6_MSG_API_RENEW = 5,
42   DHCPV6_MSG_API_REBIND = 6,
43   DHCPV6_MSG_API_REPLY = 7,
44   DHCPV6_MSG_API_RELEASE = 8,
45   DHCPV6_MSG_API_DECLINE = 9,
46   DHCPV6_MSG_API_RECONFIGURE = 10,
47   DHCPV6_MSG_API_INFORMATION_REQUEST = 11,
48   DHCPV6_MSG_API_RELAY_FORW = 12,
49   DHCPV6_MSG_API_RELAY_REPL = 13,
50 };
51
52 /** \brief Get the plugin version
53     @param client_index - opaque cookie to identify the sender
54     @param context - sender context, to match reply w/ request
55 */
56
57 define dhcp_plugin_get_version
58 {
59   u32 client_index;
60   u32 context;
61 };
62
63 /** \brief Reply to get the plugin version
64     @param context - returned sender context, to match reply w/ request
65     @param major - Incremented every time a known breaking behavior change is introduced
66     @param minor - Incremented with small changes, may be used to avoid buggy versions
67 */
68
69 define dhcp_plugin_get_version_reply
70 {
71   u32 context;
72   u32 major;
73   u32 minor;
74 };
75
76 /** \brief Control ping from client to api server request
77     @param client_index - opaque cookie to identify the sender
78     @param context - sender context, to match reply w/ request
79 */
80 define dhcp_plugin_control_ping
81 {
82   u32 client_index;
83   u32 context;
84 };
85
86 /** \brief Control ping from the client to the server response
87     @param client_index - opaque cookie to identify the sender
88     @param context - sender context, to match reply w/ request
89     @param retval - return code for the request
90     @param vpe_pid - the pid of the vpe, returned by the server
91 */
92 define dhcp_plugin_control_ping_reply
93 {
94   u32 context;
95   i32 retval;
96   u32 client_index;
97   u32 vpe_pid;
98 };
99
100 /** \brief DHCP Proxy config add / del request
101     @param client_index - opaque cookie to identify the sender
102     @param context - sender context, to match reply w/ request
103     @param rx_vrf_id - Rx/interface vrf id
104     @param server_vrf_id - server vrf id
105     @param is_add - add the config if non-zero, else delete
106     @param insert_circuit_id - option82 suboption 1 fib number
107     @param dhcp_server[] - server address
108     @param dhcp_src_address[] - sc address for packets sent to the server
109 */
110 autoreply define dhcp_proxy_config
111 {
112   u32 client_index;
113   u32 context;
114   u32 rx_vrf_id;
115   u32 server_vrf_id;
116   bool is_add;
117   vl_api_address_t dhcp_server;
118   vl_api_address_t dhcp_src_address;
119 };
120
121 /** \brief DHCP Proxy set / unset vss request
122     @param client_index - opaque cookie to identify the sender
123     @param context - sender context, to match reply w/ request
124     @param tbl_id - table id
125     @vss_type - 0: use ASCI vpn_id; 1: use oui/vpn_index; 255: global vpn
126     @vpn_ascii - null terminated ASCII VPN ID up to 128 characters
127     @param oui - first part of rfc2685 vpn id, 3 bytes oui
128     @param vpn_index - second part of rfc2685 vpn id, 4 bytes vpn index
129     @param is_ipv6 - ip6 if non-zero, else ip4
130     @param is_add - set vss if non-zero, else delete
131 */
132 autoreply define dhcp_proxy_set_vss
133 {
134   u32 client_index;
135   u32 context;
136   u32 tbl_id;
137   vl_api_vss_type_t vss_type;
138   string vpn_ascii_id[129];
139   u32 oui;
140   u32 vpn_index;
141   bool is_ipv6;
142   bool is_add;
143 };
144
145 /** \brief DHCP Client config data
146     @param sw_if_index - index of the interface for DHCP client
147     @param hostname - hostname
148     @param id - Client ID - option 61
149     @param want_dhcp_event - DHCP event sent to the sender
150            via dhcp_compl_event API message if non-zero
151     @param set_broadcast_flag - in the DHCP Discover to control
152                                 how the resulting OFFER is addressed.
153     @param dscp - DSCP value set in IP packets sent by the client
154     @param pid - sender's pid
155 */
156 typedef dhcp_client
157 {
158   vl_api_interface_index_t sw_if_index;
159   string hostname[64];
160   u8 id[64];
161   bool want_dhcp_event;
162   bool set_broadcast_flag;
163   vl_api_ip_dscp_t dscp;
164   u32 pid;
165 };
166
167 /** \brief DHCP Client config add / del request
168     @param client_index - opaque cookie to identify the sender
169     @param context - sender context, to match reply w/ request
170     @param is_add - add the config if non-zero, else delete
171     @param client - client configuration data
172 */
173 autoreply define dhcp_client_config
174 {
175   u32 client_index;
176   u32 context;
177   bool is_add;
178   vl_api_dhcp_client_t client;
179 };
180
181 /** \brief Struct representing domain server
182     @param address - IP address
183 */
184 typedef domain_server
185 {
186   vl_api_address_t address;
187 };
188
189 /** \brief Data learned by the client during the DHCP process
190     @param sw_if_index - the interface on which the client is configured
191     @param state - the state of the lease
192     @param is_ipv6 - if non-zero the address is ipv6, else ipv4
193     @param mask_width - The length of the subnet mask assigned
194     @param host_address - Host IP address
195     @param router_address - Router IP address
196     @param host_mac - Host MAC address
197 */
198 typedef dhcp_lease
199 {
200   vl_api_interface_index_t sw_if_index;
201   vl_api_dhcp_client_state_t state;
202   bool is_ipv6;
203   string hostname[64];
204   u8 mask_width;
205   vl_api_address_t host_address;
206   vl_api_address_t router_address;
207   vl_api_mac_address_t host_mac;
208   u8 count;
209   vl_api_domain_server_t domain_server[count];
210 };
211
212 /** \brief Tell client about a DHCP completion event
213     @param client_index - opaque cookie to identify the sender
214     @param pid - client pid registered to receive notification
215     @param lease - Data learned during the DHCP process;
216 */
217 define dhcp_compl_event
218 {
219   u32 client_index;
220   u32 pid;
221   vl_api_dhcp_lease_t lease;
222 };
223
224 service {
225   rpc dhcp_client_config returns dhcp_client_config_reply events dhcp_compl_event;
226 };
227
228 /** \brief Dump the DHCP client configurations
229  */
230 define dhcp_client_dump
231 {
232   u32 client_index;
233   u32 context;
234 };
235
236 /** \brief DHCP Client details returned from dump
237  *  @param client - The configured client
238  *  @param lease - The learned lease data
239  */
240 define dhcp_client_details
241 {
242   u32 context;
243   vl_api_dhcp_client_t client;
244   vl_api_dhcp_lease_t lease;
245 };
246
247 /** \brief Dump DHCP proxy table
248     @param client_index - opaque cookie to identify the sender
249     @param True for IPv6 proxy table
250 */
251 define dhcp_proxy_dump
252 {
253   u32 client_index;
254   u32 context;
255   bool  is_ip6;
256 };
257
258 typedef dhcp_server
259 {
260   u32 server_vrf_id;
261   vl_api_address_t dhcp_server;
262 };
263
264 /** \brief Tell client about a DHCP completion event
265     @param client_index - opaque cookie to identify the sender
266 */
267 define dhcp_proxy_details
268 {
269   u32 context;
270   u32 rx_vrf_id;
271   u32 vss_oui;
272   u32 vss_fib_id;
273   vl_api_vss_type_t vss_type;
274   bool is_ipv6;
275   string vss_vpn_ascii_id[129];
276   vl_api_address_t dhcp_src_address;
277   u8 count;
278   vl_api_dhcp_server_t servers[count];
279 };
280
281 autoreply define dhcp_client_detect_enable_disable
282 {
283   u32 client_index;
284   u32 context;
285
286   vl_api_interface_index_t sw_if_index;
287   bool enable;
288 };
289
290 /** \brief Set DHCPv6 DUID-LL
291     @param client_index - opaque cookie to identify the sender
292     @param context - sender context, to match reply w/ request
293     @param duid_ll - DUID-LL binary string
294 */
295 autoreply define dhcp6_duid_ll_set
296 {
297   u32 client_index;
298   u32 context;
299   u8 duid_ll[10];
300 };
301
302 /** \brief Enable/disable listening on DHCPv6 client port
303     @param client_index - opaque cookie to identify the sender
304     @param context - sender context, to match reply w/ request
305 */
306 autoreply define dhcp6_clients_enable_disable
307 {
308   u32 client_index;
309   u32 context;
310   bool enable;
311 };
312
313 /** \brief Struct representing DHCPv6 address
314     @param address - address
315     @param valid_time - valid lifetime
316     @param preferred_time - preferred lifetime
317 */
318 typedef dhcp6_address_info
319 {
320   vl_api_ip6_address_t address;
321   u32 valid_time;
322   u32 preferred_time;
323 };
324
325 /** \brief Struct representing DHCPv6 PD prefix
326     @param prefix - prefix
327     @param valid_time - valid lifetime
328     @param preferred_time - preferred lifetime
329 */
330 typedef dhcp6_pd_prefix_info
331 {
332   vl_api_ip6_prefix_t prefix;
333   u32 valid_time;
334   u32 preferred_time;
335 };
336
337 /** \brief Send DHCPv6 client message of specified type
338     @param client_index - opaque cookie to identify the sender
339     @param context - sender context, to match reply w/ request
340     @param sw_if_index - index of TX interface, also identifies IAID
341     @param server_index - used to dentify DHCPv6 server,
342                           unique for each DHCPv6 server on the link,
343                           value obrtained from dhcp6_reply_event API message,
344                           use ~0 to send message to all DHCPv6 servers
345     @param irt - initial retransmission time
346     @param mrt - maximum retransmission time
347     @param mrc - maximum retransmission count
348     @param mrd - maximum retransmission duration
349                          for sending the message
350     @param stop - if non-zero then stop resending the message,
351                   otherwise start sending the message
352     @param msg_type - message type
353     @param T1 - value of T1 in IA_NA option
354     @param T2 - value of T2 in IA_NA option
355     @param n_addresses - number of addresses in IA_NA option
356     @param addresses - list of addresses in IA_NA option
357 */
358 autoreply define dhcp6_send_client_message
359 {
360   u32 client_index;
361   u32 context;
362   vl_api_interface_index_t sw_if_index;
363   u32 server_index;
364   u32 irt;
365   u32 mrt;
366   u32 mrc;
367   u32 mrd;
368   bool stop;
369   vl_api_dhcpv6_msg_type_t msg_type;
370   u32 T1;
371   u32 T2;
372   u32 n_addresses;
373   vl_api_dhcp6_address_info_t addresses[n_addresses];
374 };
375
376 /** \brief Send DHCPv6 PD client message of specified type
377     @param client_index - opaque cookie to identify the sender
378     @param context - sender context, to match reply w/ request
379     @param sw_if_index - index of TX interface
380     @param server_index - used to dentify DHCPv6 server,
381                           unique for each DHCPv6 server on the link,
382                           value obrtained from dhcp6_pd_reply_event API message,
383                           use ~0 to send message to all DHCPv6 servers
384     @param irt - initial retransmission time
385     @param mrt - maximum retransmission time
386     @param mrc - maximum retransmission count
387     @param mrd - maximum retransmission duration
388                          for sending the message
389     @param stop - if non-zero then stop resending the message,
390                   otherwise start sending the message
391     @param msg_type - message type
392     @param T1 - value of T1 in IA_PD option
393     @param T2 - value of T2 in IA_PD option
394     @param n_prefixes - number of addresses in IA_PD option
395     @param prefixes - list of prefixes in IA_PD option
396 */
397 autoreply define dhcp6_pd_send_client_message
398 {
399   u32 client_index;
400   u32 context;
401   vl_api_interface_index_t sw_if_index;
402   u32 server_index;
403   u32 irt;
404   u32 mrt;
405   u32 mrc;
406   u32 mrd;
407   bool stop;
408   vl_api_dhcpv6_msg_type_t msg_type;
409   u32 T1;
410   u32 T2;
411   u32 n_prefixes;
412   vl_api_dhcp6_pd_prefix_info_t prefixes[n_prefixes];
413 };
414
415 service {
416   rpc want_dhcp6_reply_events returns want_dhcp6_reply_events_reply
417     events dhcp6_reply_event;
418 };
419
420 service {
421   rpc want_dhcp6_pd_reply_events returns want_dhcp6_pd_reply_events_reply
422     events dhcp6_pd_reply_event;
423 };
424
425 /** \brief Register for DHCPv6 reply events
426     @param client_index - opaque cookie to identify the sender
427     @param context - sender context, to match reply w/ request
428     @param enable_disable - 1 => register for events, 0 => cancel registration
429     @param pid - sender's pid
430 */
431 autoreply define want_dhcp6_reply_events
432 {
433   u32 client_index;
434   u32 context;
435   u8 enable_disable;
436   u32 pid;
437 };
438
439 /** \brief Register for DHCPv6 PD reply events
440     @param client_index - opaque cookie to identify the sender
441     @param context - sender context, to match reply w/ request
442     @param enable_disable - 1 => register for events, 0 => cancel registration
443     @param pid - sender's pid
444 */
445 autoreply define want_dhcp6_pd_reply_events
446 {
447   u32 client_index;
448   u32 context;
449   bool enable_disable;
450   u32 pid;
451 };
452
453 /** \brief Tell client about a DHCPv6 server reply event
454     @param client_index - opaque cookie to identify the sender
455     @param pid - client pid registered to receive notification
456     @param sw_if_index - index of RX interface, also identifies IAID
457     @param server_index - used to dentify DHCPv6 server,
458                           unique for each DHCPv6 server on the link
459     @param msg_type - message type
460     @param T1 - value of T1 in IA_NA option
461     @param T2 - value of T2 in IA_NA option
462     @param inner_status_code - value of status code inside IA_NA option
463     @param status_code - value of status code
464     @param preference - value of preference option in reply message
465     @param n_addresses - number of addresses in IA_NA option
466     @param addresses - list of addresses in IA_NA option
467 */
468 define dhcp6_reply_event
469 {
470   u32 client_index;
471   u32 pid;
472   vl_api_interface_index_t sw_if_index;
473   u32 server_index;
474   vl_api_dhcpv6_msg_type_t msg_type;
475   u32 T1;
476   u32 T2;
477   u16 inner_status_code;
478   u16 status_code;
479   u8 preference;
480   u32 n_addresses;
481   vl_api_dhcp6_address_info_t addresses[n_addresses];
482 };
483
484 /** \brief Tell client about a DHCPv6 PD server reply event
485     @param client_index - opaque cookie to identify the sender
486     @param pid - client pid registered to receive notification
487     @param sw_if_index - index of RX interface
488     @param server_index - used to dentify DHCPv6 server,
489                           unique for each DHCPv6 server on the link
490     @param msg_type - message type
491     @param T1 - value of T1 in IA_PD option
492     @param T2 - value of T2 in IA_PD option
493     @param inner_status_code - value of status code inside IA_PD option
494     @param status_code - value of the main status code of DHCPv6 message
495     @param preference - value of preference option in reply message
496     @param n_prefixes - number of prefixes in IA_PD option
497     @param prefixes - list of prefixes in IA_PD option
498 */
499 define dhcp6_pd_reply_event
500 {
501   u32 client_index;
502   u32 pid;
503   vl_api_interface_index_t sw_if_index;
504   u32 server_index;
505   vl_api_dhcpv6_msg_type_t msg_type;
506   u32 T1;
507   u32 T2;
508   u16 inner_status_code;
509   u16 status_code;
510   u8 preference;
511   u32 n_prefixes;
512   vl_api_dhcp6_pd_prefix_info_t prefixes[n_prefixes];
513 };
514
515 /*
516  * Local Variables:
517  * eval: (c-set-style "gnu")
518  * End:
519  */