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:
7 * http://www.apache.org/licenses/LICENSE-2.0
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.
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.
22 #ifndef __FIB_NODE_LIST_H__
23 #define __FIB_NODE_LIST_H__
25 #include <vnet/fib/fib_node.h>
27 extern fib_node_list_t fib_node_list_create(void);
28 extern void fib_node_list_destroy(fib_node_list_t *list);
30 extern u32 fib_node_list_push_front(fib_node_list_t head,
33 fib_node_index_t index);
34 extern u32 fib_node_list_push_back(fib_node_list_t head,
37 fib_node_index_t index);
38 extern void fib_node_list_remove(fib_node_list_t head,
40 extern void fib_node_list_elt_remove(u32 sibling);
42 extern int fib_node_list_advance(u32 sibling);
44 extern int fib_node_list_get_front(fib_node_list_t head,
47 extern int fib_node_list_elt_get_next(u32 elt,
50 extern u32 fib_node_list_get_size(fib_node_list_t head);
53 * @brief Callback function invoked during a list walk
55 typedef walk_rc_t (*fib_node_list_walk_cb_t)(fib_node_ptr_t *owner,
58 extern void fib_node_list_walk(fib_node_list_t head,
59 fib_node_list_walk_cb_t fn,
62 extern void fib_node_list_memory_show(void);