/*
 * 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 Set BFD echo source
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param sw_if_index - interface to use as echo source
*/
define bfd_udp_set_echo_source
{
  u32 client_index;
  u32 context;
  u32 sw_if_index;
};

/** \brief Set BFD feature response
    @param context - sender context, to match reply w/ request
    @param retval - return code for the request
*/
define bfd_udp_set_echo_source_reply
{
  u32 context;
  i32 retval;
};

/** \brief Delete BFD echo source
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
*/
define bfd_udp_del_echo_source
{
  u32 client_index;
  u32 context;
};

/** \brief Delete BFD feature response
    @param context - sender context, to match reply w/ request
    @param retval - return code for the request
*/
define bfd_udp_del_echo_source_reply
{
  u32 context;
  i32 retval;
};

/** \brief Get BFD configuration
*/
define bfd_get_config
{
  u32 client_index;
  u32 context;
};

/** \brief Get BFD configuration response
    @param context - sender context, to match reply w/ request
    @param retval - return code for the request
    @param slow_timer - slow timer (seconds)
    @param min_tx - desired min tx interval
    @param min_rx - desired min rx interval
    @param detect_mult - desired detection multiplier
*/
define bfd_get_config_reply
{
  u32 client_index;
  u32 context;
  u32 slow_timer;
  u32 min_tx;
  u32 min_rx;
  u8 detect_mult;
};

/** \brief Add UDP BFD session on interface
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param sw_if_index - sw index of the interface
    @param desired_min_tx - desired min transmit interval (microseconds)
    @param required_min_rx - required min receive interval (microseconds)
    @param local_addr - local address
    @param peer_addr - peer address
    @param is_ipv6 - local_addr, peer_addr are IPv6 if non-zero, otherwise IPv4
    @param detect_mult - detect multiplier (# of packets missed before connection goes down)
    @param is_authenticated - non-zero if authentication is required
    @param bfd_key_id - key id sent out in BFD packets (if is_authenticated)
    @param conf_key_id - id of already configured key (if is_authenticated)
*/
define bfd_udp_add
{
  u32 client_index;
  u32 context;
  u32 sw_if_index;
  u32 desired_min_tx;
  u32 required_min_rx;
  u8 local_addr[16];
  u8 peer_addr[16];
  u8 is_ipv6;
  u8 detect_mult;
  u8 is_authenticated;
  u8 bfd_key_id;
  u32 conf_key_id;
};

/** \brief Add UDP BFD session response
    @param context - sender context, to match reply w/ request
    @param retval - return code for the request
*/
define bfd_udp_add_reply
{
  u32 context;
  i32 retval;
};

/** \brief Modify UDP BFD session on interface
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param sw_if_index - sw index of the interface
    @param desired_min_tx - desired min transmit interval (microseconds)
    @param required_min_rx - required min receive interval (microseconds)
    @param local_addr - local address
    @param peer_addr - peer address
    @param is_ipv6 - local_addr, peer_addr are IPv6 if non-zero, otherwise IPv4
    @param detect_mult - detect multiplier (# of packets missed before connection goes down)
*/
define bfd_udp_mod
{
  u32 client_index;
  u32 context;
  u32 sw_if_index;
  u32 desired_min_tx;
  u32 required_min_rx;
  u8 local_addr[16];
  u8 peer_addr[16];
  u8 is_ipv6;
  u8 detect_mult;
};

/** \brief Modify UDP BFD session response
    @param context - sender context, to match reply w/ request
    @param retval - return code for the request
*/
define bfd_udp_mod_reply
{
  u32 context;
  i32 retval;
};

/** \brief Delete UDP BFD session on interface
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param sw_if_index - sw index of the interface
    @param local_addr - local address
    @param peer_addr - peer address
    @param is_ipv6 - local_addr, peer_addr are IPv6 if non-zero, otherwise IPv4
*/
define bfd_udp_del
{
  u32 client_index;
  u32 context;
  u32 sw_if_index;
  u8 local_addr[16];
  u8 peer_addr[16];
  u8 is_ipv6;
};

/** \brief Delete UDP BFD session response
    @param context - sender context, to match reply w/ request
    @param retval - return code for the request
*/
define bfd_udp_del_reply
{
  u32 context;
  i32 retval;
};

/** \brief Get all BFD sessions
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
*/
define bfd_udp_session_dump
{
  u32 client_index;
  u32 context;
};

/** \brief BFD session details structure
    @param context - sender context, to match reply w/ request
    @param sw_if_index - sw index of the interface
    @param local_addr - local address
    @param peer_addr - peer address
    @param is_ipv6 - local_addr, peer_addr are IPv6 if non-zero, otherwise IPv4
    @param state - session state
    @param is_authenticated - non-zero if authentication in-use, zero otherwise
    @param bfd_key_id - ID of key currently in-use if auth is on
    @param conf_key_id - configured key ID for this session
    @param required_min_rx - required min receive interval (microseconds)
    @param desired_min_tx - desired min transmit interval (microseconds)
    @param detect_mult - detect multiplier (# of packets missed before connection goes down)
*/
define bfd_udp_session_details
{
  u32 context;
  u32 sw_if_index;
  u8 local_addr[16];
  u8 peer_addr[16];
  u8 is_ipv6;
  u8 state;
  u8 is_authenticated;
  u8 bfd_key_id;
  u32 conf_key_id;
  u32 required_min_rx;
  u32 desired_min_tx;
  u8 detect_mult;
};

/** \brief Set flags of BFD UDP session
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param sw_if_index - sw index of the interface
    @param local_addr - local address
    @param peer_addr - peer address
    @param is_ipv6 - local_addr, peer_addr are IPv6 if non-zero, otherwise IPv4
    @param admin_up_down - set the admin state, 1 = up, 0 = down
*/
define bfd_udp_session_set_flags
{
  u32 client_index;
  u32 context;
  u32 sw_if_index;
  u8 local_addr[16];
  u8 peer_addr[16];
  u8 is_ipv6;
  u8 admin_up_down;
};

/** \brief Reply to bfd_udp_session_set_flags
    @param context - sender context which was passed in the request
    @param retval - return code of the set flags request
*/
define bfd_udp_session_set_flags_reply
{
  u32 context;
  i32 retval;
};

/** \brief Register for BFD events
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param enable_disable - 1 => register for events, 0 => cancel registration
    @param pid - sender's pid
*/
define want_bfd_events
{
  u32 client_index;
  u32 context;
  u32 enable_disable;
  u32 pid;
};

/** \brief Reply for BFD events registration
    @param context - returned sender context, to match reply w/ request
    @param retval - return code
*/
define want_bfd_events_reply
{
  u32 context;
  i32 retval;
};

/** \brief BFD UDP - add/replace key to configuration
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param conf_key_id - key ID to add/replace/delete
    @param key_len - length of key (must be non-zero)
    @param auth_type - authentication type (RFC 5880/4.1/Auth Type)
    @param key - key data
*/
define bfd_auth_set_key
{
  u32 client_index;
  u32 context;
  u32 conf_key_id;
  u8 key_len;
  u8 auth_type;
  u8 key[20];
};

/** \brief BFD UDP - add/replace key reply
    @param context - returned sender context, to match reply w/ request
    @param retval - return code
*/
define bfd_auth_set_key_reply
{
  u32 context;
  i32 retval;
};

/** \brief BFD UDP - delete key from configuration
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param conf_key_id - key ID to add/replace/delete
    @param key_len - length of key (must be non-zero)
    @param key - key data
*/
define bfd_auth_del_key
{
  u32 client_index;
  u32 context;
  u32 conf_key_id;
};

/** \brief BFD UDP - delete key reply
    @param context - returned sender context, to match reply w/ request
    @param retval - return code
*/
define bfd_auth_del_key_reply
{
  u32 context;
  i32 retval;
};

/** \brief Get a list of configured authentication keys
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
*/
define bfd_auth_keys_dump
{
  u32 client_index;
  u32 context;
};

/** \brief BFD authentication key details
    @param context - sender context, to match reply w/ request
    @param conf_key_id - configured key ID
    @param use_count - how many BFD sessions currently use this key
    @param auth_type - authentication type (RFC 5880/4.1/Auth Type)
*/
define bfd_auth_keys_details
{
  u32 context;
  u32 conf_key_id;
  u32 use_count;
  u8 auth_type;
};

/** \brief BFD UDP - activate/change authentication
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param sw_if_index - sw index of the interface
    @param local_addr - local address
    @param peer_addr - peer address
    @param is_ipv6 - local_addr, peer_addr are IPv6 if non-zero, otherwise IPv4
    @param is_delayed - change is applied once peer applies the change (on first received packet with this auth)
    @param bfd_key_id - key id sent out in BFD packets
    @param conf_key_id - id of already configured key
*/
define bfd_udp_auth_activate
{
  u32 client_index;
  u32 context;
  u32 sw_if_index;
  u8 local_addr[16];
  u8 peer_addr[16];
  u8 is_ipv6;
  u8 is_delayed;
  u8 bfd_key_id;
  u32 conf_key_id;
};

/** \brief BFD UDP - activate/change authentication reply
    @param context - returned sender context, to match reply w/ request
    @param retval - return code
*/
define bfd_udp_auth_activate_reply
{
  u32 context;
  i32 retval;
};

/** \brief BFD UDP - deactivate authentication
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param sw_if_index - sw index of the interface
    @param local_addr - local address
    @param peer_addr - peer address
    @param is_ipv6 - local_addr, peer_addr are IPv6 if non-zero, otherwise IPv4
    @param is_delayed - change is applied once peer applies the change (on first received non-authenticated packet)
*/
define bfd_udp_auth_deactivate
{
  u32 client_index;
  u32 context;
  u32 sw_if_index;
  u8 local_addr[16];
  u8 peer_addr[16];
  u8 is_ipv6;
  u8 is_delayed;
};

/** \brief BFD UDP - deactivate authentication reply
    @param context - returned sender context, to match reply w/ request
    @param retval - return code
*/
define bfd_udp_auth_deactivate_reply
{
  u32 context;
  i32 retval;
};

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