/*
 * Copyright (c) 2015-2016 Cisco and/or its affiliates.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at:
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

option version = "2.0.1";

/** \brief DHCP Proxy config add / del request
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param rx_vrf_id - Rx/interface vrf id
    @param server_vrf_id - server vrf id
    @param if_ipv6 - ipv6 if non-zero, else ipv4
    @param is_add - add the config if non-zero, else delete
    @param insert_circuit_id - option82 suboption 1 fib number
    @param dhcp_server[] - server address
    @param dhcp_src_address[] - <fix this, need details>
*/
autoreply define dhcp_proxy_config
{
  u32 client_index;
  u32 context;
  u32 rx_vrf_id;
  u32 server_vrf_id;
  u8 is_ipv6;
  u8 is_add;
  u8 dhcp_server[16];
  u8 dhcp_src_address[16];
};

/** \brief DHCP Proxy set / unset vss request
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param tbl_id - table id
    @vss_type - 0: use ASCI vpn_id; 1: use oui/vpn_index; 255: global vpn
    @vpn_ascii - null terminated ASCII VPN ID up to 128 characters
    @param oui - first part of rfc2685 vpn id, 3 bytes oui 
    @param vpn_index - second part of rfc2685 vpn id, 4 bytes vpn index
    @param is_ipv6 - ip6 if non-zero, else ip4
    @param is_add - set vss if non-zero, else delete
*/
autoreply define dhcp_proxy_set_vss
{
  u32 client_index;
  u32 context;
  u32 tbl_id;
  u8 vss_type;
  u8 vpn_ascii_id[129];
  u32 oui;
  u32 vpn_index;
  u8 is_ipv6;
  u8 is_add;
};

/** \brief DHCP Client config data
    @param sw_if_index - index of the interface for DHCP client
    @param hostname - hostname
    @param id - Client ID - option 61
    @param want_dhcp_event - DHCP event sent to the sender
           via dhcp_compl_event API message if non-zero
    @param set_broadcast_flag - in the DHCP Discover to control
                                how the resulting OFFER is addressed.
    @param pid - sender's pid
*/
typeonly define dhcp_client
{
  u32 sw_if_index;
  u8 hostname[64];
  u8 id[64];
  u8 want_dhcp_event;
  u8 set_broadcast_flag;
  u32 pid;
};

/** \brief DHCP Client config add / del request
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param is_add - add the config if non-zero, else delete
    @param client - client configuration data
*/
autoreply define dhcp_client_config
{
  u32 client_index;
  u32 context;
  u8 is_add;
  vl_api_dhcp_client_t client;
};

/** \brief Data learned by the client during the DHCP process
    @param sw_if_index - the interface on which the client is configured
    @param state - the state of the lease (see dhcp_client_state_t)
    @param is_ipv6 - if non-zero the address is ipv6, else ipv4
    @param mask_width - The length of the subnet mask assigned
    @param host_address - Host IP address
    @param router_address - Router IP address
    @param host_mac - Host MAC address
*/
typeonly define dhcp_lease
{
  u32 sw_if_index;
  u8 state;
  u8 hostname[64];
  u8 is_ipv6;
  u8 mask_width;
  u8 host_address[16];
  u8 router_address[16];
  u8 host_mac[6];
};

/** \brief Tell client about a DHCP completion event
    @param client_index - opaque cookie to identify the sender
    @param pid - client pid registered to receive notification
    @param lease - Data learned during the DHCP process;
*/
define dhcp_compl_event
{
  u32 client_index;
  u32 pid;
  vl_api_dhcp_lease_t lease;
};

service {
  rpc dhcp_client_config returns dhcp_client_config_reply events dhcp_compl_event;
};

/** \brief Dump the DHCP client configurations
 */
define dhcp_client_dump
{
  u32 client_index;
  u32 context;
};

/** \brief DHCP Client details returned from dump
 *  @param client - The configured client
 *  @param lease - The learned lease data
 */
define dhcp_client_details
{
  u32 context;
  vl_api_dhcp_client_t client;
  vl_api_dhcp_lease_t lease;
};

/** \brief Dump DHCP proxy table
    @param client_index - opaque cookie to identify the sender
    @param True for IPv6 proxy table
*/
define dhcp_proxy_dump
{
  u32 client_index;
  u32 context;
  u8  is_ip6;
};

typeonly manual_print manual_endian define dhcp_server
{
  u32 server_vrf_id;
  u8 dhcp_server[16];
};

/** \brief Tell client about a DHCP completion event
    @param client_index - opaque cookie to identify the sender
*/
manual_endian manual_print define dhcp_proxy_details
{
  u32 context;
  u32 rx_vrf_id;
  u32 vss_oui;
  u32 vss_fib_id;
  u8 vss_type;
  u8 vss_vpn_ascii_id[129];
  u8 is_ipv6;
  u8 dhcp_src_address[16];
  u8 count;
  vl_api_dhcp_server_t servers[count];
};

/** \brief Set DHCPv6 DUID-LL
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param duid_ll - DUID-LL binary string
*/
autoreply define dhcp6_duid_ll_set
{
  u32 client_index;
  u32 context;
  u8 duid_ll[10];
};

/** \brief Enable/disable listening on DHCPv6 client port
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
*/
autoreply define dhcp6_clients_enable_disable
{
  u32 client_index;
  u32 context;
  u8 enable;
};

/** \brief Struct representing DHCPv6 address
    @param address - address
    @param valid_time - valid lifetime
    @param preferred_time - preferred lifetime
*/
typeonly define dhcp6_address_info
{
  u8 address[16];
  u32 valid_time;
  u32 preferred_time;
};

/** \brief Struct representing DHCPv6 PD prefix
    @param prefix - prefix
    @param prefix_length - prefix length
    @param valid_time - valid lifetime
    @param preferred_time - preferred lifetime
*/
typeonly define dhcp6_pd_prefix_info
{
  u8 prefix[16];
  u8 prefix_length;
  u32 valid_time;
  u32 preferred_time;
};

/** \brief Send DHCPv6 client message of specified type
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param sw_if_index - index of TX interface, also identifies IAID
    @param server_index - used to dentify DHCPv6 server,
                          unique for each DHCPv6 server on the link,
                          value obrtained from dhcp6_reply_event API message,
                          use ~0 to send message to all DHCPv6 servers
    @param irt - initial retransmission time
    @param mrt - maximum retransmission time
    @param mrc - maximum retransmission count
    @param mrd - maximum retransmission duration
                         for sending the message
    @param stop - if non-zero then stop resending the message,
                  otherwise start sending the message
    @param msg_type - message type
    @param T1 - value of T1 in IA_NA option
    @param T2 - value of T2 in IA_NA option
    @param n_addresses - number of addresses in IA_NA option
    @param addresses - list of addresses in IA_NA option
*/
autoreply define dhcp6_send_client_message
{
  u32 client_index;
  u32 context;
  u32 sw_if_index;
  u32 server_index;
  u32 irt;
  u32 mrt;
  u32 mrc;
  u32 mrd;
  u8 stop;
  u8 msg_type;
  u32 T1;
  u32 T2;
  u32 n_addresses;
  vl_api_dhcp6_address_info_t addresses[n_addresses];
};

/** \brief Send DHCPv6 PD client message of specified type
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param sw_if_index - index of TX interface
    @param server_index - used to dentify DHCPv6 server,
                          unique for each DHCPv6 server on the link,
                          value obrtained from dhcp6_pd_reply_event API message,
                          use ~0 to send message to all DHCPv6 servers
    @param irt - initial retransmission time
    @param mrt - maximum retransmission time
    @param mrc - maximum retransmission count
    @param mrd - maximum retransmission duration
                         for sending the message
    @param stop - if non-zero then stop resending the message,
                  otherwise start sending the message
    @param msg_type - message type
    @param T1 - value of T1 in IA_PD option
    @param T2 - value of T2 in IA_PD option
    @param n_prefixes - number of addresses in IA_PD option
    @param prefixes - list of prefixes in IA_PD option
*/
autoreply define dhcp6_pd_send_client_message
{
  u32 client_index;
  u32 context;
  u32 sw_if_index;
  u32 server_index;
  u32 irt;
  u32 mrt;
  u32 mrc;
  u32 mrd;
  u8 stop;
  u8 msg_type;
  u32 T1;
  u32 T2;
  u32 n_prefixes;
  vl_api_dhcp6_pd_prefix_info_t prefixes[n_prefixes];
};

service {
  rpc want_dhcp6_reply_events returns want_dhcp6_reply_events_reply
    events dhcp6_reply_event;
};

service {
  rpc want_dhcp6_pd_reply_events returns want_dhcp6_pd_reply_events_reply
    events dhcp6_pd_reply_event;
};

/** \brief Register for DHCPv6 reply events
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param enable_disable - 1 => register for events, 0 => cancel registration
    @param pid - sender's pid
*/
autoreply define want_dhcp6_reply_events
{
  u32 client_index;
  u32 context;
  u8 enable_disable;
  u32 pid;
};

/** \brief Register for DHCPv6 PD reply events
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param enable_disable - 1 => register for events, 0 => cancel registration
    @param pid - sender's pid
*/
autoreply define want_dhcp6_pd_reply_events
{
  u32 client_index;
  u32 context;
  u8 enable_disable;
  u32 pid;
};

/** \brief Tell client about a DHCPv6 server reply event
    @param client_index - opaque cookie to identify the sender
    @param pid - client pid registered to receive notification
    @param sw_if_index - index of RX interface, also identifies IAID
    @param server_index - used to dentify DHCPv6 server,
                          unique for each DHCPv6 server on the link
    @param msg_type - message type
    @param T1 - value of T1 in IA_NA option
    @param T2 - value of T2 in IA_NA option
    @param inner_status_code - value of status code inside IA_NA option
    @param status_code - value of status code
    @param preference - value of preference option in reply message
    @param n_addresses - number of addresses in IA_NA option
    @param addresses - list of addresses in IA_NA option
*/
define dhcp6_reply_event
{
  u32 client_index;
  u32 pid;
  u32 sw_if_index;
  u32 server_index;
  u8 msg_type;
  u32 T1;
  u32 T2;
  u16 inner_status_code;
  u16 status_code;
  u8 preference;
  u32 n_addresses;
  vl_api_dhcp6_address_info_t addresses[n_addresses];
};

/** \brief Tell client about a DHCPv6 PD server reply event
    @param client_index - opaque cookie to identify the sender
    @param pid - client pid registered to receive notification
    @param sw_if_index - index of RX interface
    @param server_index - used to dentify DHCPv6 server,
                          unique for each DHCPv6 server on the link
    @param msg_type - message type
    @param T1 - value of T1 in IA_PD option
    @param T2 - value of T2 in IA_PD option
    @param inner_status_code - value of status code inside IA_PD option
    @param status_code - value of the main status code of DHCPv6 message
    @param preference - value of preference option in reply message
    @param n_prefixes - number of prefixes in IA_PD option
    @param prefixes - list of prefixes in IA_PD option
*/
define dhcp6_pd_reply_event
{
  u32 client_index;
  u32 pid;
  u32 sw_if_index;
  u32 server_index;
  u8 msg_type;
  u32 T1;
  u32 T2;
  u16 inner_status_code;
  u16 status_code;
  u8 preference;
  u32 n_prefixes;
  vl_api_dhcp6_pd_prefix_info_t prefixes[n_prefixes];
};

/*
 * Local Variables:
 * eval: (c-set-style "gnu")
 * End:
 */
