From 0915bb0ce2ca6b5fee2cd214be4499eeeaf1c9af Mon Sep 17 00:00:00 2001 From: Avneesh Sachdev Date: Tue, 13 Nov 2012 22:48:55 +0000 Subject: zebra: add iterator for walking all tables in RIB * lib/zebra.h Add macro ZEBRA_NUM_OF, which returns the number of elements in a static array. * zebra/rib.h Add the rib_tables_iter_t structure and associated functions, which allow one to walk all tables in the rib. * zebra/zebra_rib.c - Add vrf_id_get_next() to retrieve the first VRF id (if any) that is greater than a given VRF id. - Add rib_tables_iter_next(). Signed-off-by: Avneesh Sachdev Signed-off-by: David Lamparter --- lib/zebra.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib/zebra.h') diff --git a/lib/zebra.h b/lib/zebra.h index f8a6be30..404b832b 100644 --- a/lib/zebra.h +++ b/lib/zebra.h @@ -387,6 +387,8 @@ struct in_pktinfo #define MIN(a, b) ((a) < (b) ? (a) : (b)) #endif +#define ZEBRA_NUM_OF(x) (sizeof (x) / sizeof (x[0])) + /* For old definition. */ #ifndef IN6_ARE_ADDR_EQUAL #define IN6_ARE_ADDR_EQUAL IN6_IS_ADDR_EQUAL -- cgit v1.2.1