/*
 * 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.
 */

vl_api_version 1.0.0

/** \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;
  u8 client_address[16];
  u8 our_address[16];
  u8 is_ipv6;
  u32 local_session_id;
  u32 remote_session_id;
  u64 local_cookie;
  u64 remote_cookie;
  u8 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;
  u32 sw_if_index;
};

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

define sw_if_l2tpv3_tunnel_details
{
  u32 context;
  u32 sw_if_index;
  u8 interface_name[64];
  u8 client_address[16];
  u8 our_address[16];
  u32 local_session_id;
  u32 remote_session_id;
  u64 local_cookie[2];
  u64 remote_cookie;
  u8 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;
  u8 enable_disable;
  u32 sw_if_index;
};

autoreply define l2tpv3_set_lookup_key
{
  u32 client_index;
  u32 context;
  /* 0 = ip6 src_address, 1 = ip6 dst_address, 2 = session_id */
  u8 key;
};

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