mactime: add a "top" command to watch device stats
[vpp.git] / src / vnet / 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 DHCP Proxy config add / del request
53     @param client_index - opaque cookie to identify the sender
54     @param context - sender context, to match reply w/ request
55     @param rx_vrf_id - Rx/interface vrf id
56     @param server_vrf_id - server vrf id
57     @param is_add - add the config if non-zero, else delete
58     @param insert_circuit_id - option82 suboption 1 fib number
59     @param dhcp_server[] - server address
60     @param dhcp_src_address[] - <fix this, need details>
61 */
62 autoreply define dhcp_proxy_config
63 {
64   u32 client_index;
65   u32 context;
66   u32 rx_vrf_id;
67   u32 server_vrf_id;
68   bool is_add;
69   vl_api_address_t dhcp_server;
70   vl_api_address_t dhcp_src_address;
71 };
72
73 /** \brief DHCP Proxy set / unset vss request
74     @param client_index - opaque cookie to identify the sender
75     @param context - sender context, to match reply w/ request
76     @param tbl_id - table id
77     @vss_type - 0: use ASCI vpn_id; 1: use oui/vpn_index; 255: global vpn
78     @vpn_ascii - null terminated ASCII VPN ID up to 128 characters
79     @param oui - first part of rfc2685 vpn id, 3 bytes oui
80     @param vpn_index - second part of rfc2685 vpn id, 4 bytes vpn index
81     @param is_ipv6 - ip6 if non-zero, else ip4
82     @param is_add - set vss if non-zero, else delete
83 */
84 autoreply define dhcp_proxy_set_vss
85 {
86   u32 client_index;
87   u32 context;
88   u32 tbl_id;
89   vl_api_vss_type_t vss_type;
90   string vpn_ascii_id[129];
91   u32 oui;
92   u32 vpn_index;
93   bool is_ipv6;
94   bool is_add;
95 };
96
97 /** \brief DHCP Client config data
98     @param sw_if_index - index of the interface for DHCP client
99     @param hostname - hostname
100     @param id - Client ID - option 61
101     @param want_dhcp_event - DHCP event sent to the sender
102            via dhcp_compl_event API message if non-zero
103     @param set_broadcast_flag - in the DHCP Discover to control
104                                 how the resulting OFFER is addressed.
105     @param dscp - DSCP value set in IP packets sent by the client
106     @param pid - sender's pid
107 */
108 typedef dhcp_client
109 {
110   vl_api_interface_index_t sw_if_index;
111   string hostname[64];
112   u8 id[64];
113   bool want_dhcp_event;
114   bool set_broadcast_flag;
115   vl_api_ip_dscp_t dscp;
116   u32 pid;
117 };
118
119 /** \brief DHCP Client config add / del request
120     @param client_index - opaque cookie to identify the sender
121     @param context - sender context, to match reply w/ request
122     @param is_add - add the config if non-zero, else delete
123     @param client - client configuration data
124 */
125 autoreply define dhcp_client_config
126 {
127   u32 client_index;
128   u32 context;
129   bool is_add;
130   vl_api_dhcp_client_t client;
131 };
132
133 /** \brief Struct representing domain server
134     @param address - IP address
135 */
136 typedef domain_server
137 {
138   vl_api_address_t address;
139 };
140
141 /** \brief Data learned by the client during the DHCP process
142     @param sw_if_index - the interface on which the client is configured
143     @param state - the state of the lease
144     @param is_ipv6 - if non-zero the address is ipv6, else ipv4
145     @param mask_width - The length of the subnet mask assigned
146     @param host_address - Host IP address
147     @param router_address - Router IP address
148     @param host_mac - Host MAC address
149 */
150 typedef dhcp_lease
151 {
152   vl_api_interface_index_t sw_if_index;
153   vl_api_dhcp_client_state_t state;
154   bool is_ipv6;
155   string hostname[64];
156   u8 mask_width;
157   vl_api_address_t host_address;
158   vl_api_address_t router_address;
159   vl_api_mac_address_t host_mac;
160   u8 count;
161   vl_api_domain_server_t domain_server[count];
162 };
163
164 /** \brief Tell client about a DHCP completion event
165     @param client_index - opaque cookie to identify the sender
166     @param pid - client pid registered to receive notification
167     @param lease - Data learned during the DHCP process;
168 */
169 define dhcp_compl_event
170 {
171   u32 client_index;
172   u32 pid;
173   vl_api_dhcp_lease_t lease;
174 };
175
176 service {
177   rpc dhcp_client_config returns dhcp_client_config_reply events dhcp_compl_event;
178 };
179
180 /** \brief Dump the DHCP client configurations
181  */
182 define dhcp_client_dump
183 {
184   u32 client_index;
185   u32 context;
186 };
187
188 /** \brief DHCP Client details returned from dump
189  *  @param client - The configured client
190  *  @param lease - The learned lease data
191  */
192 define dhcp_client_details
193 {
194   u32 context;
195   vl_api_dhcp_client_t client;
196   vl_api_dhcp_lease_t lease;
197 };
198
199 /** \brief Dump DHCP proxy table
200     @param client_index - opaque cookie to identify the sender
201     @param True for IPv6 proxy table
202 */
203 define dhcp_proxy_dump
204 {
205   u32 client_index;
206   u32 context;
207   bool  is_ip6;
208 };
209
210 typedef dhcp_server
211 {
212   u32 server_vrf_id;
213   vl_api_address_t dhcp_server;
214 };
215
216 /** \brief Tell client about a DHCP completion event
217     @param client_index - opaque cookie to identify the sender
218 */
219 manual_endian manual_print define dhcp_proxy_details
220 {
221   u32 context;
222   u32 rx_vrf_id;
223   u32 vss_oui;
224   u32 vss_fib_id;
225   vl_api_vss_type_t vss_type;
226   bool is_ipv6;
227   string vss_vpn_ascii_id[129];
228   vl_api_address_t dhcp_src_address;
229   u8 count;
230   vl_api_dhcp_server_t servers[count];
231 };
232
233 /** \brief Set DHCPv6 DUID-LL
234     @param client_index - opaque cookie to identify the sender
235     @param context - sender context, to match reply w/ request
236     @param duid_ll - DUID-LL binary string
237 */
238 autoreply define dhcp6_duid_ll_set
239 {
240   u32 client_index;
241   u32 context;
242   u8 duid_ll[10];
243 };
244
245 /** \brief Enable/disable listening on DHCPv6 client port
246     @param client_index - opaque cookie to identify the sender
247     @param context - sender context, to match reply w/ request
248 */
249 autoreply define dhcp6_clients_enable_disable
250 {
251   u32 client_index;
252   u32 context;
253   bool enable;
254 };
255
256 /** \brief Struct representing DHCPv6 address
257     @param address - address
258     @param valid_time - valid lifetime
259     @param preferred_time - preferred lifetime
260 */
261 typedef dhcp6_address_info
262 {
263   vl_api_ip6_address_t address;
264   u32 valid_time;
265   u32 preferred_time;
266 };
267
268 /** \brief Struct representing DHCPv6 PD prefix
269     @param prefix - prefix
270     @param valid_time - valid lifetime
271     @param preferred_time - preferred lifetime
272 */
273 typedef dhcp6_pd_prefix_info
274 {
275   vl_api_ip6_prefix_t prefix;
276   u32 valid_time;
277   u32 preferred_time;
278 };
279
280 /** \brief Send DHCPv6 client message of specified type
281     @param client_index - opaque cookie to identify the sender
282     @param context - sender context, to match reply w/ request
283     @param sw_if_index - index of TX interface, also identifies IAID
284     @param server_index - used to dentify DHCPv6 server,
285                           unique for each DHCPv6 server on the link,
286                           value obrtained from dhcp6_reply_event API message,
287                           use ~0 to send message to all DHCPv6 servers
288     @param irt - initial retransmission time
289     @param mrt - maximum retransmission time
290     @param mrc - maximum retransmission count
291     @param mrd - maximum retransmission duration
292                          for sending the message
293     @param stop - if non-zero then stop resending the message,
294                   otherwise start sending the message
295     @param msg_type - message type
296     @param T1 - value of T1 in IA_NA option
297     @param T2 - value of T2 in IA_NA option
298     @param n_addresses - number of addresses in IA_NA option
299     @param addresses - list of addresses in IA_NA option
300 */
301 autoreply define dhcp6_send_client_message
302 {
303   u32 client_index;
304   u32 context;
305   vl_api_interface_index_t sw_if_index;
306   u32 server_index;
307   u32 irt;
308   u32 mrt;
309   u32 mrc;
310   u32 mrd;
311   bool stop;
312   vl_api_dhcpv6_msg_type_t msg_type;
313   u32 T1;
314   u32 T2;
315   u32 n_addresses;
316   vl_api_dhcp6_address_info_t addresses[n_addresses];
317 };
318
319 /** \brief Send DHCPv6 PD client message of specified type
320     @param client_index - opaque cookie to identify the sender
321     @param context - sender context, to match reply w/ request
322     @param sw_if_index - index of TX interface
323     @param server_index - used to dentify DHCPv6 server,
324                           unique for each DHCPv6 server on the link,
325                           value obrtained from dhcp6_pd_reply_event API message,
326                           use ~0 to send message to all DHCPv6 servers
327     @param irt - initial retransmission time
328     @param mrt - maximum retransmission time
329     @param mrc - maximum retransmission count
330     @param mrd - maximum retransmission duration
331                          for sending the message
332     @param stop - if non-zero then stop resending the message,
333                   otherwise start sending the message
334     @param msg_type - message type
335     @param T1 - value of T1 in IA_PD option
336     @param T2 - value of T2 in IA_PD option
337     @param n_prefixes - number of addresses in IA_PD option
338     @param prefixes - list of prefixes in IA_PD option
339 */
340 autoreply define dhcp6_pd_send_client_message
341 {
342   u32 client_index;
343   u32 context;
344   vl_api_interface_index_t sw_if_index;
345   u32 server_index;
346   u32 irt;
347   u32 mrt;
348   u32 mrc;
349   u32 mrd;
350   bool stop;
351   vl_api_dhcpv6_msg_type_t msg_type;
352   u32 T1;
353   u32 T2;
354   u32 n_prefixes;
355   vl_api_dhcp6_pd_prefix_info_t prefixes[n_prefixes];
356 };
357
358 service {
359   rpc want_dhcp6_reply_events returns want_dhcp6_reply_events_reply
360     events dhcp6_reply_event;
361 };
362
363 service {
364   rpc want_dhcp6_pd_reply_events returns want_dhcp6_pd_reply_events_reply
365     events dhcp6_pd_reply_event;
366 };
367
368 /** \brief Register for DHCPv6 reply events
369     @param client_index - opaque cookie to identify the sender
370     @param context - sender context, to match reply w/ request
371     @param enable_disable - 1 => register for events, 0 => cancel registration
372     @param pid - sender's pid
373 */
374 autoreply define want_dhcp6_reply_events
375 {
376   u32 client_index;
377   u32 context;
378   u8 enable_disable;
379   u32 pid;
380 };
381
382 /** \brief Register for DHCPv6 PD reply events
383     @param client_index - opaque cookie to identify the sender
384     @param context - sender context, to match reply w/ request
385     @param enable_disable - 1 => register for events, 0 => cancel registration
386     @param pid - sender's pid
387 */
388 autoreply define want_dhcp6_pd_reply_events
389 {
390   u32 client_index;
391   u32 context;
392   bool enable_disable;
393   u32 pid;
394 };
395
396 /** \brief Tell client about a DHCPv6 server reply event
397     @param client_index - opaque cookie to identify the sender
398     @param pid - client pid registered to receive notification
399     @param sw_if_index - index of RX interface, also identifies IAID
400     @param server_index - used to dentify DHCPv6 server,
401                           unique for each DHCPv6 server on the link
402     @param msg_type - message type
403     @param T1 - value of T1 in IA_NA option
404     @param T2 - value of T2 in IA_NA option
405     @param inner_status_code - value of status code inside IA_NA option
406     @param status_code - value of status code
407     @param preference - value of preference option in reply message
408     @param n_addresses - number of addresses in IA_NA option
409     @param addresses - list of addresses in IA_NA option
410 */
411 define dhcp6_reply_event
412 {
413   u32 client_index;
414   u32 pid;
415   vl_api_interface_index_t sw_if_index;
416   u32 server_index;
417   vl_api_dhcpv6_msg_type_t msg_type;
418   u32 T1;
419   u32 T2;
420   u16 inner_status_code;
421   u16 status_code;
422   u8 preference;
423   u32 n_addresses;
424   vl_api_dhcp6_address_info_t addresses[n_addresses];
425 };
426
427 /** \brief Tell client about a DHCPv6 PD server reply event
428     @param client_index - opaque cookie to identify the sender
429     @param pid - client pid registered to receive notification
430     @param sw_if_index - index of RX interface
431     @param server_index - used to dentify DHCPv6 server,
432                           unique for each DHCPv6 server on the link
433     @param msg_type - message type
434     @param T1 - value of T1 in IA_PD option
435     @param T2 - value of T2 in IA_PD option
436     @param inner_status_code - value of status code inside IA_PD option
437     @param status_code - value of the main status code of DHCPv6 message
438     @param preference - value of preference option in reply message
439     @param n_prefixes - number of prefixes in IA_PD option
440     @param prefixes - list of prefixes in IA_PD option
441 */
442 define dhcp6_pd_reply_event
443 {
444   u32 client_index;
445   u32 pid;
446   vl_api_interface_index_t sw_if_index;
447   u32 server_index;
448   vl_api_dhcpv6_msg_type_t msg_type;
449   u32 T1;
450   u32 T2;
451   u16 inner_status_code;
452   u16 status_code;
453   u8 preference;
454   u32 n_prefixes;
455   vl_api_dhcp6_pd_prefix_info_t prefixes[n_prefixes];
456 };
457
458 /*
459  * Local Variables:
460  * eval: (c-set-style "gnu")
461  * End:
462  */