FD.io VPP  v18.01.2-1-g9b554f3
Vector Packet Processing
fib_node_list.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 a hetrogeneous w.r.t. FIB node type, list of FIB nodes.
17  * Since we cannot use C pointers, due to memeory reallocs, the next/prev
18  * are described as an index to an element. Each element contains a pointer
19  * (key:{type, index}) to a FIB node.
20  */
21 
22 #ifndef __FIB_NODE_LIST_H__
23 #define __FIB_NODE_LIST_H__
24 
25 #include <vnet/fib/fib_node.h>
26 
28 extern void fib_node_list_destroy(fib_node_list_t *list);
29 
31  int owner_id,
32  fib_node_type_t type,
33  fib_node_index_t index);
35  int owner_id,
36  fib_node_type_t type,
37  fib_node_index_t index);
38 extern void fib_node_list_remove(fib_node_list_t head,
39  u32 sibling);
40 extern void fib_node_list_elt_remove(u32 sibling);
41 
42 extern int fib_node_list_advance(u32 sibling);
43 
45  fib_node_ptr_t *ptr);
46 
47 extern int fib_node_list_elt_get_next(u32 elt,
48  fib_node_ptr_t *ptr);
49 
51 
52 /**
53  * @brief Callback function invoked during a list walk
54  */
56  void *args);
57 
58 extern void fib_node_list_walk(fib_node_list_t head,
60  void *args);
61 
62 extern void fib_node_list_memory_show(void);
63 
64 #endif
u32 fib_node_list_push_back(fib_node_list_t head, int owner_id, fib_node_type_t type, fib_node_index_t index)
void fib_node_list_memory_show(void)
A representation of one pointer to another node.
Definition: fib_node.h:180
u32 fib_node_list_push_front(fib_node_list_t head, int owner_id, fib_node_type_t type, fib_node_index_t index)
Insert an element at the from of the list.
void fib_node_list_walk(fib_node_list_t head, fib_node_list_walk_cb_t fn, void *args)
Walk the list of node.
int fib_node_list_get_front(fib_node_list_t head, fib_node_ptr_t *ptr)
int(* fib_node_list_walk_cb_t)(fib_node_ptr_t *owner, void *args)
Callback function invoked during a list walk.
Definition: fib_node_list.h:55
fib_node_list_t fib_node_list_create(void)
a hetrogeneous w.r.t.
void fib_node_list_destroy(fib_node_list_t *list)
void fib_node_list_remove(fib_node_list_t head, u32 sibling)
u32 fib_node_list_get_size(fib_node_list_t head)
void fib_node_list_elt_remove(u32 sibling)
u32 fib_node_index_t
A typedef of a node index.
Definition: fib_types.h:29
unsigned int u32
Definition: types.h:88
int fib_node_list_elt_get_next(u32 elt, fib_node_ptr_t *ptr)
int fib_node_list_advance(u32 sibling)
Advance the sibling one step (toward the tail) in the list.
enum fib_node_type_t_ fib_node_type_t
The types of nodes in a FIB graph.
u32 fib_node_list_t
A list of FIB nodes.
Definition: fib_node.h:194