Implement DHCPv6 PD client (VPP-718, VPP-1050)
[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 = "2.0.1";
17
18 /** \brief DHCP Proxy config add / del request
19     @param client_index - opaque cookie to identify the sender
20     @param context - sender context, to match reply w/ request
21     @param rx_vrf_id - Rx/interface vrf id
22     @param server_vrf_id - server vrf id
23     @param if_ipv6 - ipv6 if non-zero, else ipv4
24     @param is_add - add the config if non-zero, else delete
25     @param insert_circuit_id - option82 suboption 1 fib number
26     @param dhcp_server[] - server address
27     @param dhcp_src_address[] - <fix this, need details>
28 */
29 autoreply define dhcp_proxy_config
30 {
31   u32 client_index;
32   u32 context;
33   u32 rx_vrf_id;
34   u32 server_vrf_id;
35   u8 is_ipv6;
36   u8 is_add;
37   u8 dhcp_server[16];
38   u8 dhcp_src_address[16];
39 };
40
41 /** \brief DHCP Proxy set / unset vss request
42     @param client_index - opaque cookie to identify the sender
43     @param context - sender context, to match reply w/ request
44     @param tbl_id - table id
45     @vss_type - 0: use ASCI vpn_id; 1: use oui/vpn_index; 255: global vpn
46     @vpn_ascii - null terminated ASCII VPN ID up to 128 characters
47     @param oui - first part of rfc2685 vpn id, 3 bytes oui 
48     @param vpn_index - second part of rfc2685 vpn id, 4 bytes vpn index
49     @param is_ipv6 - ip6 if non-zero, else ip4
50     @param is_add - set vss if non-zero, else delete
51 */
52 autoreply define dhcp_proxy_set_vss
53 {
54   u32 client_index;
55   u32 context;
56   u32 tbl_id;
57   u8 vss_type;
58   u8 vpn_ascii_id[129];
59   u32 oui;
60   u32 vpn_index;
61   u8 is_ipv6;
62   u8 is_add;
63 };
64
65 /** \brief DHCP Client config data
66     @param sw_if_index - index of the interface for DHCP client
67     @param hostname - hostname
68     @param id - Client ID - option 61
69     @param want_dhcp_event - DHCP event sent to the sender
70            via dhcp_compl_event API message if non-zero
71     @param set_broadcast_flag - in the DHCP Discover to control
72                                 how the resulting OFFER is addressed.
73     @param pid - sender's pid
74 */
75 typeonly define dhcp_client
76 {
77   u32 sw_if_index;
78   u8 hostname[64];
79   u8 id[64];
80   u8 want_dhcp_event;
81   u8 set_broadcast_flag;
82   u32 pid;
83 };
84
85 /** \brief DHCP Client config add / del request
86     @param client_index - opaque cookie to identify the sender
87     @param context - sender context, to match reply w/ request
88     @param is_add - add the config if non-zero, else delete
89     @param client - client configuration data
90 */
91 autoreply define dhcp_client_config
92 {
93   u32 client_index;
94   u32 context;
95   u8 is_add;
96   vl_api_dhcp_client_t client;
97 };
98
99 /** \brief Data learned by the client during the DHCP process
100     @param sw_if_index - the interface on which the client is configured
101     @param state - the state of the lease (see dhcp_client_state_t)
102     @param is_ipv6 - if non-zero the address is ipv6, else ipv4
103     @param mask_width - The length of the subnet mask assigned
104     @param host_address - Host IP address
105     @param router_address - Router IP address
106     @param host_mac - Host MAC address
107 */
108 typeonly define dhcp_lease
109 {
110   u32 sw_if_index;
111   u8 state;
112   u8 hostname[64];
113   u8 is_ipv6;
114   u8 mask_width;
115   u8 host_address[16];
116   u8 router_address[16];
117   u8 host_mac[6];
118 };
119
120 /** \brief Tell client about a DHCP completion event
121     @param client_index - opaque cookie to identify the sender
122     @param pid - client pid registered to receive notification
123     @param lease - Data learned during the DHCP process;
124 */
125 define dhcp_compl_event
126 {
127   u32 client_index;
128   u32 pid;
129   vl_api_dhcp_lease_t lease;
130 };
131
132 service {
133   rpc dhcp_client_config returns dhcp_client_config_reply events dhcp_compl_event;
134 };
135
136 /** \brief Dump the DHCP client configurations
137  */
138 define dhcp_client_dump
139 {
140   u32 client_index;
141   u32 context;
142 };
143
144 /** \brief DHCP Client details returned from dump
145  *  @param client - The configured client
146  *  @param lease - The learned lease data
147  */
148 define dhcp_client_details
149 {
150   u32 context;
151   vl_api_dhcp_client_t client;
152   vl_api_dhcp_lease_t lease;
153 };
154
155 /** \brief Dump DHCP proxy table
156     @param client_index - opaque cookie to identify the sender
157     @param True for IPv6 proxy table
158 */
159 define dhcp_proxy_dump
160 {
161   u32 client_index;
162   u32 context;
163   u8  is_ip6;
164 };
165
166 typeonly manual_print manual_endian define dhcp_server
167 {
168   u32 server_vrf_id;
169   u8 dhcp_server[16];
170 };
171
172 /** \brief Tell client about a DHCP completion event
173     @param client_index - opaque cookie to identify the sender
174 */
175 manual_endian manual_print define dhcp_proxy_details
176 {
177   u32 context;
178   u32 rx_vrf_id;
179   u32 vss_oui;
180   u32 vss_fib_id;
181   u8 vss_type;
182   u8 vss_vpn_ascii_id[129];
183   u8 is_ipv6;
184   u8 dhcp_src_address[16];
185   u8 count;
186   vl_api_dhcp_server_t servers[count];
187 };
188
189 /** \brief Enable/disable listening on DHCPv6 client port
190     @param client_index - opaque cookie to identify the sender
191     @param context - sender context, to match reply w/ request
192 */
193 autoreply define dhcp6_clients_enable_disable
194 {
195   u32 client_index;
196   u32 context;
197   u8 enable;
198 };
199
200 /** \brief Struct representing DHCPv6 PD prefix
201     @param prefix - prefix
202     @param prefix_length - prefix length
203     @param valid_time - valid lifetime
204     @param preferred_time - preferred lifetime
205 */
206 typeonly define dhcp6_pd_prefix_info
207 {
208   u8 prefix[16];
209   u8 prefix_length;
210   u32 valid_time;
211   u32 preferred_time;
212 };
213
214 /** \brief Send DHCPv6 PD client message of specified type
215     @param client_index - opaque cookie to identify the sender
216     @param context - sender context, to match reply w/ request
217     @param sw_if_index - index of TX interface
218     @param server_index - used to dentify DHCPv6 server,
219                           unique for each DHCPv6 server on the link,
220                           value obrtained from dhcp6_pd_reply_event API message,
221                           use ~0 to send message to all DHCPv6 servers
222     @param irt - initial retransmission time
223     @param mrt - maximum retransmission time
224     @param mrc - maximum retransmission count
225     @param mrd - maximum retransmission duration
226                          for sending the message
227     @param stop - if non-zero then stop resending the message,
228                   otherwise start sending the message
229     @param msg_type - message type
230     @param T1 - value of T1 in IA_PD option
231     @param T2 - value of T2 in IA_PD option
232     @param n_prefixes - number of addresses in IA_PD option
233     @param prefixes - list of prefixes in IA_PD option
234 */
235 autoreply define dhcp6_pd_send_client_message
236 {
237   u32 client_index;
238   u32 context;
239   u32 sw_if_index;
240   u32 server_index;
241   u32 irt;
242   u32 mrt;
243   u32 mrc;
244   u32 mrd;
245   u8 stop;
246   u8 msg_type;
247   u32 T1;
248   u32 T2;
249   u32 n_prefixes;
250   vl_api_dhcp6_pd_prefix_info_t prefixes[n_prefixes];
251 };
252
253 service {
254   rpc want_dhcp6_pd_reply_events returns want_dhcp6_pd_reply_events_reply
255     events dhcp6_pd_reply_event;
256 };
257
258 /** \brief Register for DHCPv6 PD reply events
259     @param client_index - opaque cookie to identify the sender
260     @param context - sender context, to match reply w/ request
261     @param enable_disable - 1 => register for events, 0 => cancel registration
262     @param pid - sender's pid
263 */
264 autoreply define want_dhcp6_pd_reply_events
265 {
266   u32 client_index;
267   u32 context;
268   u8 enable_disable;
269   u32 pid;
270 };
271
272 /** \brief Tell client about a DHCPv6 PD server reply event
273     @param client_index - opaque cookie to identify the sender
274     @param pid - client pid registered to receive notification
275     @param sw_if_index - index of RX interface
276     @param server_index - used to dentify DHCPv6 server,
277                           unique for each DHCPv6 server on the link
278     @param msg_type - message type
279     @param T1 - value of T1 in IA_PD option
280     @param T2 - value of T2 in IA_PD option
281     @param inner_status_code - value of status code inside IA_PD option
282     @param status_code - value of the main status code of DHCPv6 message
283     @param preference - value of preference option in reply message
284     @param n_prefixes - number of prefixes in IA_PD option
285     @param prefixes - list of prefixes in IA_PD option
286 */
287 define dhcp6_pd_reply_event
288 {
289   u32 client_index;
290   u32 pid;
291   u32 sw_if_index;
292   u32 server_index;
293   u8 msg_type;
294   u32 T1;
295   u32 T2;
296   u16 inner_status_code;
297   u16 status_code;
298   u8 preference;
299   u32 n_prefixes;
300   vl_api_dhcp6_pd_prefix_info_t prefixes[n_prefixes];
301 };
302
303 /*
304  * Local Variables:
305  * eval: (c-set-style "gnu")
306  * End:
307  */