dhcp.api revision 02bfd641
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
16option version = "3.0.1";
17
18import "vnet/interface_types.api";
19import "vnet/ip/ip_types.api";
20import "vnet/ethernet/ethernet_types.api";
21
22enum 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
29enum dhcp_client_state {
30  DHCP_CLIENT_STATE_API_DISCOVER,
31  DHCP_CLIENT_STATE_API_REQUEST,
32  DHCP_CLIENT_STATE_API_BOUND,
33};
34
35enum 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
57define 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
69define 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*/
80define 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*/
92define 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[] - <fix this, need details>
109*/
110autoreply 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*/
132autoreply 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*/
156typedef 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*/
173autoreply 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*/
184typedef 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*/
198typedef 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*/
217define dhcp_compl_event
218{
219  u32 client_index;
220  u32 pid;
221  vl_api_dhcp_lease_t lease;
222};
223
224service {
225  rpc dhcp_client_config returns dhcp_client_config_reply events dhcp_compl_event;
226};
227
228/** \brief Dump the DHCP client configurations
229 */
230define 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 */
240define 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*/
251define dhcp_proxy_dump
252{
253  u32 client_index;
254  u32 context;
255  bool  is_ip6;
256};
257
258typedef 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*/
267manual_endian manual_print 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/** \brief Set DHCPv6 DUID-LL
282    @param client_index - opaque cookie to identify the sender
283    @param context - sender context, to match reply w/ request
284    @param duid_ll - DUID-LL binary string
285*/
286autoreply define dhcp6_duid_ll_set
287{
288  u32 client_index;
289  u32 context;
290  u8 duid_ll[10];
291};
292
293/** \brief Enable/disable listening on DHCPv6 client port
294    @param client_index - opaque cookie to identify the sender
295    @param context - sender context, to match reply w/ request
296*/
297autoreply define dhcp6_clients_enable_disable
298{
299  u32 client_index;
300  u32 context;
301  bool enable;
302};
303
304/** \brief Struct representing DHCPv6 address
305    @param address - address
306    @param valid_time - valid lifetime
307    @param preferred_time - preferred lifetime
308*/
309typedef dhcp6_address_info
310{
311  vl_api_ip6_address_t address;
312  u32 valid_time;
313  u32 preferred_time;
314};
315
316/** \brief Struct representing DHCPv6 PD prefix
317    @param prefix - prefix
318    @param valid_time - valid lifetime
319    @param preferred_time - preferred lifetime
320*/
321typedef dhcp6_pd_prefix_info
322{
323  vl_api_ip6_prefix_t prefix;
324  u32 valid_time;
325  u32 preferred_time;
326};
327
328/** \brief Send DHCPv6 client message of specified type
329    @param client_index - opaque cookie to identify the sender
330    @param context - sender context, to match reply w/ request
331    @param sw_if_index - index of TX interface, also identifies IAID
332    @param server_index - used to dentify DHCPv6 server,
333                          unique for each DHCPv6 server on the link,
334                          value obrtained from dhcp6_reply_event API message,
335                          use ~0 to send message to all DHCPv6 servers
336    @param irt - initial retransmission time
337    @param mrt - maximum retransmission time
338    @param mrc - maximum retransmission count
339    @param mrd - maximum retransmission duration
340                         for sending the message
341    @param stop - if non-zero then stop resending the message,
342                  otherwise start sending the message
343    @param msg_type - message type
344    @param T1 - value of T1 in IA_NA option
345    @param T2 - value of T2 in IA_NA option
346    @param n_addresses - number of addresses in IA_NA option
347    @param addresses - list of addresses in IA_NA option
348*/
349autoreply define dhcp6_send_client_message
350{
351  u32 client_index;
352  u32 context;
353  vl_api_interface_index_t sw_if_index;
354  u32 server_index;
355  u32 irt;
356  u32 mrt;
357  u32 mrc;
358  u32 mrd;
359  bool stop;
360  vl_api_dhcpv6_msg_type_t msg_type;
361  u32 T1;
362  u32 T2;
363  u32 n_addresses;
364  vl_api_dhcp6_address_info_t addresses[n_addresses];
365};
366
367/** \brief Send DHCPv6 PD client message of specified type
368    @param client_index - opaque cookie to identify the sender
369    @param context - sender context, to match reply w/ request
370    @param sw_if_index - index of TX interface
371    @param server_index - used to dentify DHCPv6 server,
372                          unique for each DHCPv6 server on the link,
373                          value obrtained from dhcp6_pd_reply_event API message,
374                          use ~0 to send message to all DHCPv6 servers
375    @param irt - initial retransmission time
376    @param mrt - maximum retransmission time
377    @param mrc - maximum retransmission count
378    @param mrd - maximum retransmission duration
379                         for sending the message
380    @param stop - if non-zero then stop resending the message,
381                  otherwise start sending the message
382    @param msg_type - message type
383    @param T1 - value of T1 in IA_PD option
384    @param T2 - value of T2 in IA_PD option
385    @param n_prefixes - number of addresses in IA_PD option
386    @param prefixes - list of prefixes in IA_PD option
387*/
388autoreply define dhcp6_pd_send_client_message
389{
390  u32 client_index;
391  u32 context;
392  vl_api_interface_index_t sw_if_index;
393  u32 server_index;
394  u32 irt;
395  u32 mrt;
396  u32 mrc;
397  u32 mrd;
398  bool stop;
399  vl_api_dhcpv6_msg_type_t msg_type;
400  u32 T1;
401  u32 T2;
402  u32 n_prefixes;
403  vl_api_dhcp6_pd_prefix_info_t prefixes[n_prefixes];
404};
405
406service {
407  rpc want_dhcp6_reply_events returns want_dhcp6_reply_events_reply
408    events dhcp6_reply_event;
409};
410
411service {
412  rpc want_dhcp6_pd_reply_events returns want_dhcp6_pd_reply_events_reply
413    events dhcp6_pd_reply_event;
414};
415
416/** \brief Register for DHCPv6 reply events
417    @param client_index - opaque cookie to identify the sender
418    @param context - sender context, to match reply w/ request
419    @param enable_disable - 1 => register for events, 0 => cancel registration
420    @param pid - sender's pid
421*/
422autoreply define want_dhcp6_reply_events
423{
424  u32 client_index;
425  u32 context;
426  u8 enable_disable;
427  u32 pid;
428};
429
430/** \brief Register for DHCPv6 PD reply events
431    @param client_index - opaque cookie to identify the sender
432    @param context - sender context, to match reply w/ request
433    @param enable_disable - 1 => register for events, 0 => cancel registration
434    @param pid - sender's pid
435*/
436autoreply define want_dhcp6_pd_reply_events
437{
438  u32 client_index;
439  u32 context;
440  bool enable_disable;
441  u32 pid;
442};
443
444/** \brief Tell client about a DHCPv6 server reply event
445    @param client_index - opaque cookie to identify the sender
446    @param pid - client pid registered to receive notification
447    @param sw_if_index - index of RX interface, also identifies IAID
448    @param server_index - used to dentify DHCPv6 server,
449                          unique for each DHCPv6 server on the link
450    @param msg_type - message type
451    @param T1 - value of T1 in IA_NA option
452    @param T2 - value of T2 in IA_NA option
453    @param inner_status_code - value of status code inside IA_NA option
454    @param status_code - value of status code
455    @param preference - value of preference option in reply message
456    @param n_addresses - number of addresses in IA_NA option
457    @param addresses - list of addresses in IA_NA option
458*/
459define dhcp6_reply_event
460{
461  u32 client_index;
462  u32 pid;
463  vl_api_interface_index_t sw_if_index;
464  u32 server_index;
465  vl_api_dhcpv6_msg_type_t msg_type;
466  u32 T1;
467  u32 T2;
468  u16 inner_status_code;
469  u16 status_code;
470  u8 preference;
471  u32 n_addresses;
472  vl_api_dhcp6_address_info_t addresses[n_addresses];
473};
474
475/** \brief Tell client about a DHCPv6 PD server reply event
476    @param client_index - opaque cookie to identify the sender
477    @param pid - client pid registered to receive notification
478    @param sw_if_index - index of RX interface
479    @param server_index - used to dentify DHCPv6 server,
480                          unique for each DHCPv6 server on the link
481    @param msg_type - message type
482    @param T1 - value of T1 in IA_PD option
483    @param T2 - value of T2 in IA_PD option
484    @param inner_status_code - value of status code inside IA_PD option
485    @param status_code - value of the main status code of DHCPv6 message
486    @param preference - value of preference option in reply message
487    @param n_prefixes - number of prefixes in IA_PD option
488    @param prefixes - list of prefixes in IA_PD option
489*/
490define dhcp6_pd_reply_event
491{
492  u32 client_index;
493  u32 pid;
494  vl_api_interface_index_t sw_if_index;
495  u32 server_index;
496  vl_api_dhcpv6_msg_type_t msg_type;
497  u32 T1;
498  u32 T2;
499  u16 inner_status_code;
500  u16 status_code;
501  u8 preference;
502  u32 n_prefixes;
503  vl_api_dhcp6_pd_prefix_info_t prefixes[n_prefixes];
504};
505
506/*
507 * Local Variables:
508 * eval: (c-set-style "gnu")
509 * End:
510 */
511