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

define vxlan_add_del_tunnel
{
  u32 client_index;
  u32 context;
  u8 is_add;
  u8 is_ipv6;
  u8 src_address[16];
  u8 dst_address[16];
  u32 mcast_sw_if_index;
  u32 encap_vrf_id;
  u32 decap_next_index;
  u32 vni;
};

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

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

define vxlan_tunnel_details
{
  u32 context;
  u32 sw_if_index;
  u8 src_address[16];
  u8 dst_address[16];
  u32 mcast_sw_if_index;
  u32 encap_vrf_id;
  u32 decap_next_index;
  u32 vni;
  u8 is_ipv6;
};

/** \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_bypass
{
  u32 client_index;
  u32 context;
  u32 sw_if_index;
  u8 is_ipv6;
  u8 enable;
};
