/*
 * 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 = "4.1.1";

import "vnet/interface_types.api";
import "vnet/ethernet/ethernet_types.api";
import "vnet/devices/virtio/virtio_types.api";

/** \brief vhost-user interface create request
    @param client_index - opaque cookie to identify the sender
    @param is_server - our side is socket server
    @param sock_filename - unix socket filename, used to speak with frontend
    @param use_custom_mac - enable or disable the use of the provided hardware address
    @param disable_mrg_rxbuf - disable the use of merge receive buffers
    @param disable_indirect_desc - disable the use of indirect descriptors which driver can use
    @param enable_gso - enable gso support (default 0)
    @param enable_packed - enable packed ring support (default 0)
    @param mac_address - hardware address to use if 'use_custom_mac' is set
*/
define create_vhost_user_if
{
  option deprecated;
  u32 client_index;
  u32 context;
  bool is_server;
  string sock_filename[256];
  bool renumber;
  bool disable_mrg_rxbuf;
  bool disable_indirect_desc;
  bool enable_gso;
  bool enable_packed;
  u32 custom_dev_instance;
  bool use_custom_mac;
  vl_api_mac_address_t mac_address;
  string tag[64];
};

/** \brief vhost-user interface create response
    @param context - sender context, to match reply w/ request
    @param retval - return code for the request
    @param sw_if_index - interface the operation is applied to
*/
define create_vhost_user_if_reply
{
  option deprecated;
  u32 context;
  i32 retval;
  vl_api_interface_index_t sw_if_index;
};

/** \brief vhost-user interface modify request
    @param client_index - opaque cookie to identify the sender
    @param is_server - our side is socket server
    @param sock_filename - unix socket filename, used to speak with frontend
    @param enable_gso - enable gso support (default 0)
    @param enable_packed - enable packed ring support (default 0)
*/
autoreply define modify_vhost_user_if
{
  option deprecated;
  u32 client_index;
  u32 context;
  vl_api_interface_index_t sw_if_index;
  bool is_server;
  string sock_filename[256];
  bool renumber;
  bool enable_gso;
  bool enable_packed;
  u32 custom_dev_instance;
};

/** \brief vhost-user interface create request
    @param client_index - opaque cookie to identify the sender
    @param is_server - our side is socket server
    @param sock_filename - unix socket filename, used to speak with frontend
    @param use_custom_mac - enable or disable the use of the provided hardware address
    @param disable_mrg_rxbuf - disable the use of merge receive buffers
    @param disable_indirect_desc - disable the use of indirect descriptors which driver can use
    @param enable_gso - enable gso support (default 0)
    @param enable_packed - enable packed ring support (default 0)
    @param enable_event_idx - enable event_idx support (default 0)
    @param mac_address - hardware address to use if 'use_custom_mac' is set
    @param renumber - if true, use custom_dev_instance is valid
    @param custom_dev_instance - custom device instance number
*/
define create_vhost_user_if_v2
{
  u32 client_index;
  u32 context;
  bool is_server;
  string sock_filename[256];
  bool renumber;
  bool disable_mrg_rxbuf;
  bool disable_indirect_desc;
  bool enable_gso;
  bool enable_packed;
  bool enable_event_idx;
  u32 custom_dev_instance;
  bool use_custom_mac;
  vl_api_mac_address_t mac_address;
  string tag[64];
};

/** \brief vhost-user interface create response
    @param context - sender context, to match reply w/ request
    @param retval - return code for the request
    @param sw_if_index - interface the operation is applied to
*/
define create_vhost_user_if_v2_reply
{
  u32 context;
  i32 retval;
  vl_api_interface_index_t sw_if_index;
};

/** \brief vhost-user interface modify request
    @param client_index - opaque cookie to identify the sender
    @param is_server - our side is socket server
    @param sock_filename - unix socket filename, used to speak with frontend
    @param enable_gso - enable gso support (default 0)
    @param enable_packed - enable packed ring support (default 0)
    @param enable_event_idx - enable event idx support (default 0)
    @param renumber - if true, use custom_dev_instance is valid
    @param custom_dev_instance - custom device instance number
*/
autoreply define modify_vhost_user_if_v2
{
  u32 client_index;
  u32 context;
  vl_api_interface_index_t sw_if_index;
  bool is_server;
  string sock_filename[256];
  bool renumber;
  bool enable_gso;
  bool enable_packed;
  bool enable_event_idx;
  u32 custom_dev_instance;
};

/** \brief vhost-user interface delete request
    @param client_index - opaque cookie to identify the sender
*/
autoreply define delete_vhost_user_if
{
  u32 client_index;
  u32 context;
  vl_api_interface_index_t sw_if_index;
};

/** \brief Vhost-user interface details structure (fix this)
    @param sw_if_index - index of the interface
    @param interface_name - name of interface
    @param virtio_net_hdr_sz - net header size
    @param features_first_32 - interface features, first 32 bits
    @param features_last_32 - interface features, last 32 bits
    @param is_server - vhost-user server socket
    @param sock_filename - socket filename
    @param num_regions - number of used memory regions
    @param sock_errno - socket errno
*/
define sw_interface_vhost_user_details
{
  u32 context;
  vl_api_interface_index_t sw_if_index;
  string interface_name[64];
  u32 virtio_net_hdr_sz;
  vl_api_virtio_net_features_first_32_t features_first_32;
  vl_api_virtio_net_features_last_32_t features_last_32;
  bool is_server;
  string sock_filename[256];
  u32 num_regions;
  i32 sock_errno;
};

/** \brief Vhost-user interface dump request
    @param sw_if_index - filter by sw_if_index
*/
define sw_interface_vhost_user_dump
{
  u32 client_index;
  u32 context;
  vl_api_interface_index_t sw_if_index [default=0xffffffff];
};
/*
 * Local Variables:
 * eval: (c-set-style "gnu")
 * End:
 */