/*
 * 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.
 */

vl_api_version 1.0.0

/** \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
    @param oui - first part of vpn id
    @param fib_id - second part of vpn id
    @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;
  u32 oui;
  u32 fib_id;
  u8 is_ipv6;
  u8 is_add;
};

/** \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 sw_if_index - index of the interface for DHCP client
    @param hostname - hostname
    @param client_id - Client ID - option 61
    @param is_add - add the config if non-zero, else delete
    @param want_dhcp_event - DHCP event sent to the sender
           via dhcp_compl_event API message if non-zero
    @param pid - sender's pid
*/
autoreply define dhcp_client_config
{
  u32 client_index;
  u32 context;
  u32 sw_if_index;
  u8 hostname[64];
  u8 client_id[64];
  u8 is_add;
  u8 want_dhcp_event;
  u32 pid;
};

/** \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 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
*/
define dhcp_compl_event
{
  u32 client_index;
  u32 pid;
  u8 hostname[64];
  u8 is_ipv6;
  u8 mask_width;
  u8 host_address[16];
  u8 router_address[16];
  u8 host_mac[6];
};

/** \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 is_ipv6;
  u8 dhcp_src_address[16];
  u8 count;
  vl_api_dhcp_server_t servers[count];
};

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