/* * Copyright (c) 2011-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.
 */
/**
 * @file
 * @brief BFD UDP transport layer declarations
 */

#ifndef __included_bfd_udp_h__
#define __included_bfd_udp_h__

#include <vppinfra/clib.h>
#include <vnet/adj/adj_types.h>
#include <vnet/ip/ip6_packet.h>
#include <vnet/bfd/bfd_api.h>

/** identifier of BFD session based on UDP transport only */
typedef CLIB_PACKED (struct {
  union {
    /** interface to which the session is tied - single-hop */
    u32 sw_if_index;
    /** the FIB index the peer is in - multi-hop*/
    u32 fib_index;
  };
  /** local address */
  ip46_address_t local_addr;
  /** peer address */
  ip46_address_t peer_addr;
}) bfd_udp_key_t;

/** UDP transport specific data embedded in bfd_session's union */
typedef struct
{
  /** key identifying this session */
  bfd_udp_key_t key;
  /** adjacency index returned from adj lock call */
  adj_index_t adj_index;
} bfd_udp_session_t;

/** bfd udp echo packet trace capture */
typedef struct
{
  u32 len;
  u8 data[400];
} bfd_udp_echo_input_trace_t;

struct bfd_session_s;

/**
 * @brief add the necessary transport layer by prepending it to existing data
 *
 *
 * @param is_echo 1 if this is echo packet, 0 if control frame
 *
 * @return 1 on success, 0 on failure
 */
int bfd_add_udp4_transport (vlib_main_t * vm, u32 bi,
			    const struct bfd_session_s *bs, int is_echo);

/**
 * @brief add the necessary transport layer by prepending it to existing data
 *
 * @param is_echo 1 if this is echo packet, 0 if control frame
 *
 * @return 1 on success, 0 on failure
 */
int bfd_add_udp6_transport (vlib_main_t * vm, u32 bi,
			    const struct bfd_session_s *bs, int is_echo);

/**
 * @brief transport packet over udpv4
 *
 * @return 1 on success, 0 on failure
 */
int bfd_transport_udp4 (vlib_main_t *vm, vlib_node_runtime_t *rt, u32 bi,
			const struct bfd_session_s *bs, int is_echo);

/**
 * @brief transport packet over udpv6
 *
 * @return 1 on success, 0 on failure
 */
int bfd_transport_udp6 (vlib_main_t *vm, vlib_node_runtime_t *rt, u32 bi,
			const struct bfd_session_s *bs, int is_echo);

/**
 * @brief check if the bfd udp layer is echo-capable at this time
 *
 * @return 1 if available, 0 otherwise
 */
int bfd_udp_is_echo_available (bfd_transport_e transport);

/**
 * @brief get echo source information - used by CLI
 */
void bfd_udp_get_echo_source (int *is_set, u32 * sw_if_index,
			      int *have_usable_ip4, ip4_address_t * ip4,
			      int *have_usable_ip6, ip6_address_t * ip6);

#endif /* __included_bfd_udp_h__ */

/*
 * fd.io coding-style-patch-verification: ON
 *
 * Local Variables:
 * eval: (c-set-style "gnu")
 * End:
 */
