/* Hey Emacs use -*- mode: C -*- */
/*
 * Copyright (c) 2015-2020 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 = "2.1.0";

import "vnet/interface_types.api";
import "vnet/tunnel/tunnel_types.api";
import "vnet/ip/ip_types.api";

/** \brief A GRE tunnel type
*/
enum gre_tunnel_type : u8
{
  GRE_API_TUNNEL_TYPE_L3 = 0,
  /* L2 Transparent Ethernet Bridge */
  GRE_API_TUNNEL_TYPE_TEB,
  /* Encapsulated Remote Switched Port ANalyzer */
  GRE_API_TUNNEL_TYPE_ERSPAN,
};

/** \brief A composite type uniquely defining a GRE tunnel.
    @param type - tunnel type (see enum definition), 0: L3, 1: TEB, 2: ERSPAN
    @param mode - P2P or P2MP
    @param flags - to control encap/decap behaviour
    @param session_id - session for ERSPAN tunnel, range 0-1023
    @param instance - optional unique custom device instance, else ~0.
    @param outer_table_id - Encap FIB table ID
    @param sw_if_index - ignored on create/delete, present in details.
    @param src - Source IP address
    @param dst - Destination IP address, can be multicast
*/
typedef gre_tunnel
{
  vl_api_gre_tunnel_type_t type;
  vl_api_tunnel_mode_t mode;
  vl_api_tunnel_encap_decap_flags_t flags;
  u16 session_id;
  u32 instance;
  u32 outer_table_id;
  vl_api_interface_index_t sw_if_index;
  vl_api_address_t src;
  vl_api_address_t dst;
};

/** \brief Add or delete a single GRE tunnel.
    @param client_index - opaque cookie to identify the sender.
    @param context - sender context, to match reply w/ request.
    @param is_add - add if true, delete if false.
    @param tunnel - tunnel definition to add or delete.
*/
define gre_tunnel_add_del
{
  u32 client_index;
  u32 context;
  bool is_add;
  vl_api_gre_tunnel_t tunnel;
};

/** \brief Add or delete a single GRE tunnel.
    @param context - sender context, to match reply w/ request.
    @param retval - return code for the request.
    @param sw_if_index - the interface corresponding to the affected tunnel.
*/
define gre_tunnel_add_del_reply
{
  u32 context;
  i32 retval;
  vl_api_interface_index_t sw_if_index;
};

/** \brief Dump details of all or just a single GRE tunnel.
    @param client_index - opaque cookie to identify the sender.
    @param context - sender context, to match reply w/ request.
    @param sw_if_index - filter for tunnel of this interface index, ~0 for all.
*/
define gre_tunnel_dump
{
  u32 client_index;
  u32 context;
  vl_api_interface_index_t sw_if_index;
};

/** \brief Details response for one of the requested GRE tunnels.
    @param context - sender context, to match reply w/ request.
    @param tunnel - definition of the dumped tunnel.
*/
define gre_tunnel_details
{
  u32 context;
  vl_api_gre_tunnel_t tunnel;
};

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