X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvnet%2Ffib%2Ffib_table.h;h=14ac7054059d675cc96ee7f0488582514ddfe9b2;hb=89541992000433b743cbbe8cb396faab42bcf6ae;hp=8a0c73968fb752f51dd776c4889da4c84a44c68f;hpb=bf246dff1b4ea0792c0083f7e5495930b3b225f7;p=vpp.git diff --git a/src/vnet/fib/fib_table.h b/src/vnet/fib/fib_table.h index 8a0c73968fb..14ac7054059 100644 --- a/src/vnet/fib/fib_table.h +++ b/src/vnet/fib/fib_table.h @@ -792,11 +792,30 @@ extern u32 fib_table_get_num_entries(u32 fib_index, extern fib_table_t *fib_table_get(fib_node_index_t index, fib_protocol_t proto); +/** + * @brief return code controlling how a table walk proceeds + */ +typedef enum fib_table_walk_rc_t_ +{ + /** + * Continue on to the next entry + */ + FIB_TABLE_WALK_CONTINUE, + /** + * Do no traverse down this sub-tree + */ + FIB_TABLE_WALK_SUB_TREE_STOP, + /** + * Stop the walk completely + */ + FIB_TABLE_WALK_STOP, +} fib_table_walk_rc_t; + /** * @brief Call back function when walking entries in a FIB table */ -typedef int (*fib_table_walk_fn_t)(fib_node_index_t fei, - void *ctx); +typedef fib_table_walk_rc_t (*fib_table_walk_fn_t)(fib_node_index_t fei, + void *ctx); /** * @brief Walk all entries in a FIB table @@ -808,6 +827,18 @@ extern void fib_table_walk(u32 fib_index, fib_table_walk_fn_t fn, void *ctx); +/** + * @brief Walk all entries in a sub-tree FIB table. The 'root' paraneter + * is the prefix at the root of the sub-tree. + * N.B: This is NOT safe to deletes. If you need to delete walk the whole + * table and store elements in a vector, then delete the elements + */ +extern void fib_table_sub_tree_walk(u32 fib_index, + fib_protocol_t proto, + const fib_prefix_t *root, + fib_table_walk_fn_t fn, + void *ctx); + /** * @brief format (display) the memory used by the FIB tables */