FD.io VPP  v21.10.1-2-g0a485f517
Vector Packet Processing
fib_sas.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2020 Cisco and/or its affiliates.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at:
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 /**
17  * @brief FIB Source Address selection
18  *
19  * Use the FIB for source address selection on an interface
20  */
21 
22 #ifndef __FIB_SAS_H__
23 #define __FIB_SAS_H__
24 
25 #include <vnet/fib/fib_types.h>
26 #include <vnet/ip/ip_types.h>
27 
28 /**
29  * @brief Get a Source address to use in a packet being sent out
30  * an interface
31  *
32  * @param sw_if_index The interface on which the packet is to be sent
33  * @param af The address family of the packet
34  * @param dst The destination of the packet (can be NULL in which case any
35  * of the available address will be returned)
36  * @param src OUT the source address to use
37  *
38  * @return True if an address is available False (and src is unset) otherwise
39  */
40 extern bool fib_sas_get (u32 sw_if_index,
42  const ip46_address_t *dst,
43  ip46_address_t *src);
44 
45 /**
46  * @brief Get an IPv4 Source address to use in a packet being sent out
47  * an interface
48  *
49  * @param sw_if_index The interface on which the packet is to be sent
50  * @param dst The destination of the packet (can be NULL in which case any
51  * of the available address will be returned)
52  * @param src OUT the source address to use
53  *
54  * @return True if an address is available False (and src is unset) otherwise
55  */
56 extern bool fib_sas4_get (u32 sw_if_index,
57  const ip4_address_t *dst,
59 
60 /**
61  * @brief Get an IPv6 Source address to use in a packet being sent out
62  * an interface
63  *
64  * @param sw_if_index The interface on which the packet is to be sent
65  * @param dst The destination of the packet (can be NULL in which case any
66  * of the available address will be returned)
67  * @param src OUT the source address to use
68  *
69  * @return True if an address is available False (and src is unset) otherwise
70  */
71 extern bool fib_sas6_get (u32 sw_if_index,
72  const ip6_address_t *dst,
73  ip6_address_t *src);
74 
75 #endif
fib_sas4_get
bool fib_sas4_get(u32 sw_if_index, const ip4_address_t *dst, ip4_address_t *src)
Get an IPv4 Source address to use in a packet being sent out an interface.
Definition: fib_sas.c:50
fib_types.h
src
vl_api_address_t src
Definition: gre.api:54
ip_types.h
ip4_address_t
Definition: ip4_packet.h:50
u32
unsigned int u32
Definition: types.h:88
af
vl_api_address_family_t af
Definition: ip.api:619
dst
vl_api_ip4_address_t dst
Definition: pnat.api:41
fib_sas_get
bool fib_sas_get(u32 sw_if_index, ip_address_family_t af, const ip46_address_t *dst, ip46_address_t *src)
FIB Source Address selection.
Definition: fib_sas.c:28
sw_if_index
vl_api_interface_index_t sw_if_index
Definition: wireguard.api:34
fib_sas6_get
bool fib_sas6_get(u32 sw_if_index, const ip6_address_t *dst, ip6_address_t *src)
Get an IPv6 Source address to use in a packet being sent out an interface.
Definition: fib_sas.c:99
ip_address_family_t
enum ip_address_family_t_ ip_address_family_t