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

/** \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:
 */
