FD.io VPP  v17.04-9-g99c0734
Vector Packet Processing
bfd_udp.h
Go to the documentation of this file.
1 /* * 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 UDP transport layer 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>
25 #include <vnet/bfd/bfd_api.h>
26 
27 /* *INDENT-OFF* */
28 /** identifier of BFD session based on UDP transport only */
29 typedef CLIB_PACKED (struct {
30  /** interface to which the session is tied */
31  u32 sw_if_index;
32  /** local address */
33  ip46_address_t local_addr;
34  /** peer address */
35  ip46_address_t peer_addr;
36 }) bfd_udp_key_t;
37 /* *INDENT-ON* */
38 
39 /** UDP transport specific data embedded in bfd_session's union */
40 typedef struct
41 {
42  /** key identifying this session */
43  bfd_udp_key_t key;
44  /** adjacency index returned from adj lock call */
47 
48 /** bfd udp echo packet trace capture */
49 typedef struct
50 {
52  u8 data[400];
54 
55 struct bfd_session_s;
56 
57 /**
58  * @brief add the necessary transport layer by prepending it to existing data
59  *
60  *
61  * @param is_echo 1 if this is echo packet, 0 if control frame
62  *
63  * @return 1 on success, 0 on failure
64  */
66  const struct bfd_session_s *bs, int is_echo);
67 
68 /**
69  * @brief add the necessary transport layer by prepending it to existing data
70  *
71  * @param is_echo 1 if this is echo packet, 0 if control frame
72  *
73  * @return 1 on success, 0 on failure
74  */
76  const struct bfd_session_s *bs, int is_echo);
77 
78 /**
79  * @brief transport packet over udpv4
80  *
81  * @param is_echo 1 if this is echo packet, 0 if control frame
82  *
83  * @return 1 on success, 0 on failure
84  */
86  const struct bfd_session_s *bs);
87 
88 /**
89  * @brief transport packet over udpv6
90  *
91  * @param is_echo 1 if this is echo packet, 0 if control frame
92  *
93  * @return 1 on success, 0 on failure
94  */
96  const struct bfd_session_s *bs);
97 
98 /**
99  * @brief check if the bfd udp layer is echo-capable at this time
100  *
101  * @return 1 if available, 0 otherwise
102  */
104 
105 /**
106  * @brief get echo source information - used by CLI
107  */
108 void bfd_udp_get_echo_source (int *is_set, u32 * sw_if_index,
109  int *have_usable_ip4, ip4_address_t * ip4,
110  int *have_usable_ip6, ip6_address_t * ip6);
111 
112 #endif /* __included_bfd_udp_h__ */
113 
114 /*
115  * fd.io coding-style-patch-verification: ON
116  *
117  * Local Variables:
118  * eval: (c-set-style "gnu")
119  * End:
120  */
bfd udp echo packet trace capture
Definition: bfd_udp.h:49
int bfd_add_udp6_transport(vlib_main_t *vm, u32 bi, const struct bfd_session_s *bs, int is_echo)
add the necessary transport layer by prepending it to existing data
typedef CLIB_PACKED(struct{u32 sw_if_index;ip46_address_t local_addr;ip46_address_t peer_addr;}) bfd_udp_key_t
identifier of BFD session based on UDP transport only
UDP transport specific data embedded in bfd_session&#39;s union.
Definition: bfd_udp.h:40
int bfd_add_udp4_transport(vlib_main_t *vm, u32 bi, const struct bfd_session_s *bs, int is_echo)
add the necessary transport layer by prepending it to existing data
bfd_udp_key_t key
key identifying this session
Definition: bfd_udp.h:43
bfd_transport_e transport
transport type for this session
Definition: bfd_main.h:214
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)
get echo source information - used by CLI
Definition: bfd_udp.c:224
int bfd_transport_udp4(vlib_main_t *vm, u32 bi, const struct bfd_session_s *bs)
transport packet over udpv4
Definition: bfd_udp.c:410
vlib_main_t * vm
Definition: buffer.c:276
u32 adj_index_t
An index for adjacencies.
Definition: adj_types.h:30
unsigned int u32
Definition: types.h:88
adj_index_t adj_index
adjacency index returned from adj lock call
Definition: bfd_udp.h:45
unsigned char u8
Definition: types.h:56
BFD API declarations.
int bfd_udp_is_echo_available(bfd_transport_e transport)
check if the bfd udp layer is echo-capable at this time
Definition: bfd_udp.c:94
int bfd_transport_udp6(vlib_main_t *vm, u32 bi, const struct bfd_session_s *bs)
transport packet over udpv6
Definition: bfd_udp.c:422
bfd_transport_e
Definition: bfd_api.h:30