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

import "vnet/interface_types.api";
import "vnet/ethernet/ethernet_types.api";
import "vnet/ip/ip_types.api";

/** \brief l2tpv3 tunnel interface create request
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param client_address - remote client tunnel ip address
    @param client_address - local tunnel ip address
    @param is_ipv6 - ipv6 if non-zero, else ipv4
    @param local_session_id - local tunnel session id
    @param remote_session_id - remote tunnel session id
    @param local_cookie - local tunnel cookie
    @param l2_sublayer_present - l2 sublayer is present in packets if non-zero
    @param encap_vrf_id - fib identifier used for outgoing encapsulated packets
*/
define l2tpv3_create_tunnel
{
  u32 client_index;
  u32 context;
  vl_api_address_t client_address;
  vl_api_address_t our_address;
  u32 local_session_id;
  u32 remote_session_id;
  u64 local_cookie;
  u64 remote_cookie;
  bool l2_sublayer_present;
  u32 encap_vrf_id;
};

/** \brief l2tpv3 tunnel interface create response
    @param context - sender context, to match reply w/ request
    @param retval - return code for the request
    @param sw_if_index - index of the new tunnel interface
*/
define l2tpv3_create_tunnel_reply
{
  u32 context;
  i32 retval;
  vl_api_interface_index_t sw_if_index;
};

autoreply define l2tpv3_set_tunnel_cookies
{
  u32 client_index;
  u32 context;
  vl_api_interface_index_t sw_if_index;
  u64 new_local_cookie;
  u64 new_remote_cookie;
};

define sw_if_l2tpv3_tunnel_details
{
  u32 context;
  vl_api_interface_index_t sw_if_index;
  string interface_name[64];
  vl_api_address_t client_address;
  vl_api_address_t our_address;
  u32 local_session_id;
  u32 remote_session_id;
  u64 local_cookie[2];
  u64 remote_cookie;
  bool l2_sublayer_present;
};

define sw_if_l2tpv3_tunnel_dump
{
  u32 client_index;
  u32 context;
};

autoreply define l2tpv3_interface_enable_disable
{
  u32 client_index;
  u32 context;
  bool enable_disable;
  vl_api_interface_index_t sw_if_index;
};

enum l2t_lookup_key : u8
{
	L2T_LOOKUP_KEY_API_SRC_ADDR = 0,
	L2T_LOOKUP_KEY_API_DST_ADDR = 1,
	L2T_LOOKUP_KEY_API_SESSION_ID = 2,
};

autoreply define l2tpv3_set_lookup_key
{
  u32 client_index;
  u32 context;
  vl_api_l2t_lookup_key_t key;
};

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