FD.io VPP  v21.06
Vector Packet Processing
dhcp.api
Go to the documentation of this file.
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 {
27 };
28 
33 };
34 
36 {
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 {
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 {
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 {
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 {
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 {
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 {
137  vl_api_vss_type_t vss_type;
138  string vpn_ascii_id[129];
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];
163  vl_api_ip_dscp_t dscp;
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 {
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];
205  vl_api_address_t host_address;
206  vl_api_address_t router_address;
207  vl_api_mac_address_t host_mac;
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 {
221  vl_api_dhcp_lease_t lease;
222 };
223 
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 {
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 {
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 */
252 {
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 {
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;
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 */
286 autoreply define dhcp6_duid_ll_set
287 {
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 */
298 {
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 */
309 typedef dhcp6_address_info
310 {
311  vl_api_ip6_address_t address;
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 */
321 typedef dhcp6_pd_prefix_info
322 {
323  vl_api_ip6_prefix_t prefix;
324  u32 valid_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 */
350 {
353  vl_api_interface_index_t sw_if_index;
359  bool stop;
360  vl_api_dhcpv6_msg_type_t msg_type;
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 */
389 {
392  vl_api_interface_index_t sw_if_index;
398  bool stop;
399  vl_api_dhcpv6_msg_type_t msg_type;
403  vl_api_dhcp6_pd_prefix_info_t prefixes[n_prefixes];
404 };
405 
406 service {
407  rpc want_dhcp6_reply_events returns want_dhcp6_reply_events_reply
408  events dhcp6_reply_event;
409 };
410 
411 service {
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 */
422 autoreply define want_dhcp6_reply_events
423 {
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 */
436 autoreply define want_dhcp6_pd_reply_events
437 {
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 */
459 define dhcp6_reply_event
460 {
463  vl_api_interface_index_t sw_if_index;
465  vl_api_dhcpv6_msg_type_t msg_type;
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 */
490 define dhcp6_pd_reply_event
491 {
494  vl_api_interface_index_t sw_if_index;
496  vl_api_dhcpv6_msg_type_t msg_type;
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  */
string hostname[64]
Definition: dhcp.api:159
dhcpv6_msg_type
Definition: dhcp.api:35
vl_api_dhcp_lease_t lease
Definition: dhcp.api:244
vss_type
Definition: dhcp.api:22
vl_api_address_t dhcp_src_address
Definition: dhcp.api:118
vl_api_dhcpv6_msg_type_t msg_type
Definition: dhcp.api:399
typedef dhcp6_pd_prefix_info
Struct representing DHCPv6 PD prefix.
Definition: dhcp.api:322
void dhcp6_pd_send_client_message(vlib_main_t *vm, u32 sw_if_index, u8 stop, dhcp6_pd_send_client_message_params_t *params)
vl_api_prefix_t prefix
Definition: ip.api:146
service
Definition: dhcp.api:224
unsigned char u8
Definition: types.h:56
unsigned int u32
Definition: types.h:88
void dhcp_proxy_dump(fib_protocol_t proto, void *opaque, u32 context)
Dump the proxy configs to the API.
Definition: dhcp_proxy.c:248
vl_api_dhcp_client_t client
Definition: dhcp.api:243
bool want_dhcp_event
Definition: dhcp.api:161
static perfmon_event_t events[]
Definition: core.c:21
vl_api_dhcpv6_msg_type_t msg_type
Definition: dhcp.api:496
typedef dhcp_client
DHCP Client config data.
Definition: dhcp.api:157
typedef dhcp_server
Definition: dhcp.api:259
vl_api_ip_dscp_t dscp
Definition: dhcp.api:163
vl_api_interface_index_t sw_if_index
Definition: wireguard.api:34
unsigned short u16
Definition: types.h:57
vl_api_dhcpv6_msg_type_t msg_type
Definition: dhcp.api:360
bool set_broadcast_flag
Definition: dhcp.api:162
int dhcp_proxy_set_vss(fib_protocol_t proto, u32 tbl_id, u8 vss_type, u8 *vpn_ascii_id, u32 oui, u32 vpn_index, u8 is_del)
Configure/set a new VSS info.
Definition: dhcp_proxy.c:309
typedef dhcp6_address_info
Struct representing DHCPv6 address.
Definition: dhcp.api:310
dhcp_client_state
Definition: dhcp.api:29
option version
Definition: dhcp.api:16
vl_api_vss_type_t vss_type
Definition: dhcp.api:137
u32 valid_time
Definition: dhcp.api:312
u8 mask_width
Definition: dhcp.api:204
vl_api_interface_index_t sw_if_index
Definition: dhcp.api:494
vl_api_mac_address_t host_mac
Definition: dhcp.api:207
vl_api_address_t host_address
Definition: dhcp.api:205
signed int i32
Definition: types.h:77
manual_print typedef address
Definition: ip_types.api:96
vl_api_dhcpv6_msg_type_t msg_type
Definition: dhcp.api:465
void dhcp6_send_client_message(vlib_main_t *vm, u32 sw_if_index, u8 stop, dhcp6_send_client_message_params_t *params)
vl_api_dhcp_lease_t lease
Definition: dhcp.api:221
vl_api_address_t router_address
Definition: dhcp.api:206
typedef domain_server
Struct representing domain server.
Definition: dhcp.api:185
vl_api_address_t dhcp_src_address
Definition: dhcp.api:276
typedef dhcp_lease
Data learned by the client during the DHCP process.
Definition: dhcp.api:199
vl_api_interface_index_t sw_if_index
Definition: dhcp.api:353
vl_api_address_t dhcp_server
Definition: dhcp.api:117
vl_api_interface_index_t sw_if_index
Definition: dhcp.api:392
u32 pid
Definition: dhcp.api:164
vl_api_dhcp_client_t client
Definition: dhcp.api:178
void dhcp6_clients_enable_disable(u8 enable)
vl_api_dhcp_client_state_t state
Definition: dhcp.api:201
u32 preferred_time
Definition: dhcp.api:313
u8 count
Definition: dhcp.api:208
vl_api_interface_index_t sw_if_index
Definition: dhcp.api:463
bool is_ipv6
Definition: dhcp.api:202
vl_api_vss_type_t vss_type
Definition: dhcp.api:273
int dhcp_client_config(u32 is_add, u32 client_index, vlib_main_t *vm, u32 sw_if_index, u8 *hostname, u8 *client_id, dhcp_event_cb_t event_callback, u8 set_broadcast_flag, ip_dscp_t dscp, u32 pid)
Add/Delete DHCP clients.
Definition: client.c:1031