2 * Copyright (c) 2019 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 #ifndef __FIB_TRACKER_H__
17 #define __FIB_TRACKER_H__
19 #include <vnet/fib/fib_entry.h>
22 * Trackers are used on FIB entries by objects that which to track the
23 * changing state of the entry. For example a tunnel would track its
24 * destination address to be informed of reachability changes.
26 * The benefit of this aproach is that each time a new client tracks the
27 * entry it doesn't RR source it. When an entry is sourced all its children
28 * are updated. Thus, new clients tracking an entry is O(n^2). With the
29 * tracker as indirection, the entry is sourced only once.
34 * @param fib_index The FIB the entry is in
35 * @param prefix The Prefix of the entry to track
36 * @param child_type The type of object that is tracking this entry
37 * @param child_index The pool index of the object tracking
38 * @param sigbling [RETURNED] The sibling index of the child on the tracker
39 * @return The index of the FIB entry
41 extern fib_node_index_t fib_entry_track(u32 fib_index,
42 const fib_prefix_t *prefix,
43 fib_node_type_t child_type,
48 * Stop tracking a FIB entry
49 * @param fei FIB entry index (as returned from the track API above)
50 * @param sibling Sibling index (as returned from the track API above)
52 extern void fib_entry_untrack(fib_node_index_t fei,
55 extern void fib_entry_track_module_init(void);