/*
 * 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 parameters
    @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_random 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 namespace 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 [default= 0xffffffff] ;
  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:
 */
