/*
 * 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 Struct representing domain server
    @param address - IP address
*/
typeonly manual_print manual_endian define domain_server
{
  u8 address[16];
};

/** \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];
  u8 count;
  vl_api_domain_server_t domain_server[count];
};

/** \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:
 */
