blob: e33b7407d5678778e795170413fe08537b4ef3f4 [file] [log] [blame]
Klement Sekera0e3c0de2016-09-29 14:43:44 +02001/* * Copyright (c) 2011-2016 Cisco and/or its affiliates.
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at:
5 *
6 * http://www.apache.org/licenses/LICENSE-2.0
7 *
8 * Unless required by applicable law or agreed to in writing, software
9 * distributed under the License is distributed on an "AS IS" BASIS,
10 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 * See the License for the specific language governing permissions and
12 * limitations under the License.
13 */
14/**
15 * @file
16 * @brief BFD global declarations
17 */
18
19#ifndef __included_bfd_udp_h__
20#define __included_bfd_udp_h__
21
22#include <vppinfra/clib.h>
23#include <vnet/adj/adj_types.h>
24#include <vnet/ip/ip6_packet.h>
Klement Sekera239790f2017-02-16 10:53:53 +010025#include <vnet/bfd/bfd_api.h>
Klement Sekera0e3c0de2016-09-29 14:43:44 +020026
Klement Sekera0e3c0de2016-09-29 14:43:44 +020027/* *INDENT-OFF* */
28typedef CLIB_PACKED (struct {
29
30 u32 sw_if_index;
31 ip46_address_t local_addr;
32 ip46_address_t peer_addr;
33
34}) bfd_udp_key_t;
35/* *INDENT-ON* */
36
37typedef struct
38{
39 bfd_udp_key_t key;
40
41 adj_index_t adj_index;
42} bfd_udp_session_t;
43
Klement Sekeraaeeac3b2017-02-14 07:11:52 +010044/* bfd udp echo packet trace capture */
45typedef struct
46{
47 u32 len;
48 u8 data[400];
49} bfd_udp_echo_input_trace_t;
50
Klement Sekera2bce0332017-02-09 06:03:46 +010051struct bfd_session_s;
52
Klement Sekera239790f2017-02-16 10:53:53 +010053int bfd_add_udp4_transport (vlib_main_t * vm, vlib_buffer_t * b,
54 const struct bfd_session_s *bs, int is_echo);
55int bfd_add_udp6_transport (vlib_main_t * vm, vlib_buffer_t * b,
56 const struct bfd_session_s *bs, int is_echo);
57
58/**
59 * @brief check if the bfd udp layer is echo-capable at this time
60 *
61 * @return 1 if available, 0 otherwise
62 */
63int bfd_udp_is_echo_available (bfd_transport_e transport);
Klement Sekera0e3c0de2016-09-29 14:43:44 +020064
Klement Sekera73884482017-02-23 09:26:30 +010065void
66bfd_udp_get_echo_source (int *is_set, u32 * sw_if_index, int *have_usable_ip4,
67 ip4_address_t * ip4, int *have_usable_ip6,
68 ip6_address_t * ip6);
69
Klement Sekera0e3c0de2016-09-29 14:43:44 +020070#endif /* __included_bfd_udp_h__ */
71
72/*
73 * fd.io coding-style-patch-verification: ON
74 *
75 * Local Variables:
76 * eval: (c-set-style "gnu")
77 * End:
78 */