/* Hey Emacs use -*- mode: C -*- */
/*
 * Copyright (c) 2018 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 = "1.1.0";
import "vnet/ip/ip_types.api";

/** \brief Definition of a VXLAN GBP tunnel
    @param instance - optional unique custom device instance, else ~0.
    @param src - Source IP address
    @param dst - Destination IP address, can be multicast
    @param mcast_sw_if_index - Interface for multicast destination
    @param encap_table_id - Encap route table 
    @param vni - The VXLAN Network Identifier, uint24
    @param sw_ifindex - Ignored in add message, set in details
*/
typedef vxlan_gbp_tunnel
{
  u32 instance;
  vl_api_address_t src;
  vl_api_address_t dst;
  u32 mcast_sw_if_index;
  u32 encap_table_id;
  u32 vni;
  u32 sw_if_index;
};

/** \brief Create or delete a VXLAN-GBP tunnel
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param is_add - Use 1 to create the tunnel, 0 to remove it
*/
define vxlan_gbp_tunnel_add_del
{
  u32 client_index;
  u32 context;
  u8 is_add;
  vl_api_vxlan_gbp_tunnel_t tunnel;
};

define vxlan_gbp_tunnel_add_del_reply
{
  u32 context;
  i32 retval;
  u32 sw_if_index;
};

define vxlan_gbp_tunnel_dump
{
  u32 client_index;
  u32 context;
  u32 sw_if_index;
};

define vxlan_gbp_tunnel_details
{
  u32 context;
  vl_api_vxlan_gbp_tunnel_t tunnel;
};

/** \brief Interface set vxlan-bypass request
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param sw_if_index - interface used to reach neighbor
    @param is_ipv6 - if non-zero, enable ipv6-vxlan-bypass, else ipv4-vxlan-bypass
    @param enable - if non-zero enable, else disable
*/
autoreply define sw_interface_set_vxlan_gbp_bypass
{
  u32 client_index;
  u32 context;
  u32 sw_if_index;
  u8 is_ipv6;
  u8 enable;
};

