FD.io VPP  v21.10.1-2-g0a485f517
Vector Packet Processing
ip4_fib_hash.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016 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  * @brief The IPv4 FIB Hash table
17  */
18 
19 #ifndef __IP4_FIB_HASH_H__
20 #define __IP4_FIB_HASH_H__
21 
22 #include <vlib/vlib.h>
23 #include <vnet/ip/ip.h>
24 
25 typedef struct ip4_fib_hash_t_
26 {
27  /* Hash table for each prefix length mapping. */
29 
30  /* Table ID (hash key) for this FIB. */
33 
35  const ip4_address_t *addr,
36  u32 len);
38  const ip4_address_t *addr);
40  const ip4_address_t *addr,
41  u32 len);
42 
44  const ip4_address_t *addr,
45  u32 len);
46 
48  const ip4_address_t *addr,
49  u32 len,
50  fib_node_index_t fib_entry_index);
51 extern void ip4_fib_hash_table_init(ip4_fib_hash_t *fib);
53 
54 /**
55  * @brief Walk all entries in a FIB table
56  * N.B: This is NOT safe to deletes. If you need to delete walk the whole
57  * table and store elements in a vector, then delete the elements
58  */
61  void *ctx);
62 
63 /**
64  * @brief Walk all entries in a sub-tree of the FIB table
65  * N.B: This is NOT safe to deletes. If you need to delete walk the whole
66  * table and store elements in a vector, then delete the elements
67  */
69  const fib_prefix_t *root,
71  void *ctx);
72 
73 #endif
74 
vlib.h
ip4_fib_hash_table_entry_insert
void ip4_fib_hash_table_entry_insert(ip4_fib_hash_t *fib, const ip4_address_t *addr, u32 len, fib_node_index_t fib_entry_index)
Definition: ip4_fib_hash.c:97
ip4_fib_hash_table_walk
void ip4_fib_hash_table_walk(ip4_fib_hash_t *fib, fib_table_walk_fn_t fn, void *ctx)
Walk all entries in a FIB table N.B: This is NOT safe to deletes.
Definition: ip4_fib_hash.c:155
ip4_fib_hash_table_lookup_lb
index_t ip4_fib_hash_table_lookup_lb(const ip4_fib_hash_t *fib, const ip4_address_t *addr)
Definition: ip4_fib_hash.c:50
ip4_fib_hash_table_sub_tree_walk
void ip4_fib_hash_table_sub_tree_walk(ip4_fib_hash_t *fib, const fib_prefix_t *root, fib_table_walk_fn_t fn, void *ctx)
Walk all entries in a sub-tree of the FIB table N.B: This is NOT safe to deletes.
Definition: ip4_fib_hash.c:172
ip4_fib_hash_table_init
void ip4_fib_hash_table_init(ip4_fib_hash_t *fib)
ip4_fib_hash_table_lookup_exact_match
fib_node_index_t ip4_fib_hash_table_lookup_exact_match(const ip4_fib_hash_t *fib, const ip4_address_t *addr, u32 len)
Definition: ip4_fib_hash.c:26
ip4_fib_hash_table_entry_remove
void ip4_fib_hash_table_entry_remove(ip4_fib_hash_t *fib, const ip4_address_t *addr, u32 len)
Definition: ip4_fib_hash.c:129
addr
vhost_vring_addr_t addr
Definition: vhost_user.h:130
ip4_fib_hash_table_lookup
fib_node_index_t ip4_fib_hash_table_lookup(const ip4_fib_hash_t *fib, const ip4_address_t *addr, u32 len)
Definition: ip4_fib_hash.c:74
len
u8 len
Definition: ip_types.api:103
ip4_fib_hash_t_
The IPv4 FIB Hash table.
Definition: ip4_fib_hash.h:25
ip4_fib_hash_t
struct ip4_fib_hash_t_ ip4_fib_hash_t
The IPv4 FIB Hash table.
index_t
u32 index_t
A Data-Path Object is an object that represents actions that are applied to packets are they are swit...
Definition: dpo.h:43
fib_node_index_t
u32 fib_node_index_t
A typedef of a node index.
Definition: fib_types.h:29
uword
u64 uword
Definition: types.h:112
ip4_fib_hash_table_destroy
void ip4_fib_hash_table_destroy(ip4_fib_hash_t *fib)
ip4_address_t
Definition: ip4_packet.h:50
fib_table_walk_fn_t
fib_table_walk_rc_t(* fib_table_walk_fn_t)(fib_node_index_t fei, void *ctx)
Call back function when walking entries in a FIB table.
Definition: fib_table.h:930
ip4_fib_hash_t_::table_id
u32 table_id
Definition: ip4_fib_hash.h:31
ip.h
u32
unsigned int u32
Definition: types.h:88
ctx
long ctx[MAX_CONNS]
Definition: main.c:144
ip4_fib_hash_t_::fib_entry_by_dst_address
uword * fib_entry_by_dst_address[33]
Definition: ip4_fib_hash.h:28
fib_prefix_t_
Aggregate type for a prefix.
Definition: fib_types.h:202