/*
 * 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.1.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, 0xffffffff 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
    @param host_mtu_set - host MTU should be set
    @param host_mtu_size - host MTU size
    @param tap_flags - flags for the TAP interface creation
*/
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 host_mtu_set;
  u32 host_mtu_size;
  u8 tag[64];
  u32 tap_flags;
};

/** \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
    @param host_mtu_size - host mtu size
*/
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;
  u32 host_mtu_size;
  u32 tap_flags;
};

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