/*
 * Copyright (c) 2017 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.
 */

/** \file

    This file defines vpe control-plane API messages for
    the Linux kernel TAP device driver
*/

option version = "2.0.0";

/** \brief Initialize a new tap interface with the given paramters
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param id - interface id, 0xffff means auto
    @param use_random_mac - let the system generate a unique mac address
    @param mac_address - mac addr to assign to the interface if use_radom not set
    @param tx_ring_sz - the number of entries of TX ring
    @param rx_ring_sz - the number of entries of RX ring
    @param host_mac_addr_set - host side interface mac address should be set
    @param host_mac_addr - host side interface mac address
    @param host_if_name_set - host side interface name should be set
    @param host_if_name - host side interface name
    @param host_namespace_set - host namespece should be set
    @param host_namespace - host namespace to attach interface to
    @param host_bridge_set - host bridge should be set
    @param host_bridge - host bridge to attach interface to
    @param host_ip4_addr_set - host IPv4 ip address should be set
    @param host_ip4_addr - host IPv4 ip address
    @param host_ip4_prefix_len - host IPv4 ip address prefix length
    @param host_ip6_addr_set - host IPv6 ip address should be set
    @param host_ip6_addr - host IPv6 ip address
    @param host_ip6_prefix_len - host IPv6 ip address prefix length
    @param host_ip4_gw_set - host IPv4 default gateway should be set
    @param host_ip4_gw - host IPv4 default gateway
    @param host_ip6_gw_set - host IPv6 default gateway should be set
    @param host_ip6_gw - host IPv6 default gateway
*/
define tap_create_v2
{
  u32 client_index;
  u32 context;
  u32 id;
  u8 use_random_mac;
  u8 mac_address[6];
  u16 tx_ring_sz; /* optional, default is 256 entries, must be power of 2 */
  u16 rx_ring_sz; /* optional, default is 256 entries, must be power of 2 */
  u8 host_namespace_set;
  u8 host_namespace[64];
  u8 host_mac_addr_set;
  u8 host_mac_addr[6];
  u8 host_if_name_set;
  u8 host_if_name[64];
  u8 host_bridge_set;
  u8 host_bridge[64];
  u8 host_ip4_addr_set;
  u8 host_ip4_addr[4];
  u8 host_ip4_prefix_len;
  u8 host_ip6_addr_set;
  u8 host_ip6_addr[16];
  u8 host_ip6_prefix_len;
  u8 host_ip4_gw_set;
  u8 host_ip4_gw[4];
  u8 host_ip6_gw_set;
  u8 host_ip6_gw[16];
  u8 tag[64];
};

/** \brief Reply for tap create reply
    @param context - returned sender context, to match reply w/ request
    @param retval - return code
    @param sw_if_index - software index allocated for the new tap interface
*/
define tap_create_v2_reply
{
  u32 context;
  i32 retval;
  u32 sw_if_index;
};

/** \brief Delete tap interface
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param sw_if_index - interface index of existing tap interface
*/
autoreply define tap_delete_v2
{
  u32 client_index;
  u32 context;
  u32 sw_if_index;
};

/** \brief Dump tap interfaces request */
define sw_interface_tap_v2_dump
{
  u32 client_index;
  u32 context;
};

/** \brief Reply for tap dump request
    @param sw_if_index - software index of tap interface
    @param id - interface id
    @param dev_name - Linux tap device name
    @param tx_ring_sz - the number of entries of TX ring
    @param rx_ring_sz - the number of entries of RX ring
    @param host_mac_addr - mac address assigned to the host side of the interface
    @param host_if_name - host side interface name
    @param host_namespace - host namespace the interface is attached into
    @param host_bridge - host bridge the interface is attached into
    @param host_ip4_addr - host IPv4 ip address
    @param host_ip4_prefix_len - host IPv4 ip address prefix length; 0 if unset
    @param host_ip6_addr - host IPv6 ip address
    @param host_ip6_prefix_len - host IPv6 ip address prefix length; 0 if unset
*/
define sw_interface_tap_v2_details
{
  u32 context;
  u32 sw_if_index;
  u32 id;
  u8 dev_name[64];
  u16 tx_ring_sz;
  u16 rx_ring_sz;
  u8 host_mac_addr[6];
  u8 host_if_name[64];
  u8 host_namespace[64];
  u8 host_bridge[64];
  u8 host_ip4_addr[4];
  u8 host_ip4_prefix_len;
  u8 host_ip6_addr[16];
  u8 host_ip6_prefix_len;
};

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