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 <avneesh@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
diff --git a/lib/zebra.h b/lib/zebra.h
index f8a6be3..404b832 100644
--- a/lib/zebra.h
+++ b/lib/zebra.h
@@ -387,6 +387,8 @@
#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