summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAvneesh Sachdev <avneesh@opensourcerouting.org>2012-11-13 22:48:55 +0000
committerDavid Lamparter <equinox@opensourcerouting.org>2012-11-30 21:41:16 +0100
commit0915bb0ce2ca6b5fee2cd214be4499eeeaf1c9af (patch)
treeeb3cb410ed0dd341e2e565e71d74bba81c0dbf8a /lib
parent1b5ed1b054b955275bb7cf0f80fb7767094bc28b (diff)
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>
Diffstat (limited to 'lib')
-rw-r--r--lib/zebra.h2
1 files changed, 2 insertions, 0 deletions
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