/*
 * 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 Add / del ipsec gre tunnel request
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param local_sa_id - local SA id
    @param remote_sa_id - remote SA id
    @param is_add - 1 if adding the tunnel, 0 if deleting
    @param src_address - tunnel source address
    @param dst_address - tunnel destination address
*/
define ipsec_gre_add_del_tunnel {
    u32 client_index;
    u32 context;
    u32 local_sa_id;
    u32 remote_sa_id;
    u8 is_add;
    u8 src_address[4];
    u8 dst_address[4];
};

/** \brief Reply for add / del ipsec gre tunnel request
    @param context - returned sender context, to match reply w/ request
    @param retval - return code
    @param sw_if_index - software index of the new ipsec gre tunnel
*/
define ipsec_gre_add_del_tunnel_reply {
    u32 context;
    i32 retval;
    u32 sw_if_index;
};

/** \brief Dump ipsec gre tunnel table
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param tunnel_index - gre tunnel identifier or -1 in case of all tunnels
*/
define ipsec_gre_tunnel_dump {
    u32 client_index;
    u32 context;
    u32 sw_if_index;
};

/** \brief ipsec gre tunnel operational state response
    @param context - returned sender context, to match reply w/ request
    @param sw_if_index - software index of the ipsec gre tunnel
    @param local_sa_id - local SA id
    @param remote_sa_id - remote SA id
    @param src_address - tunnel source address
    @param dst_address - tunnel destination address
*/
define ipsec_gre_tunnel_details {
    u32 context;
    u32 sw_if_index;
    u32 local_sa_id;
    u32 remote_sa_id;
    u8 src_address[4];
    u8 dst_address[4];
};

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