diff options
author | Renato Westphal <renato@opensourcerouting.org> | 2016-10-29 03:03:35 +0200 |
---|---|---|
committer | Renato Westphal <renato@opensourcerouting.org> | 2016-11-28 19:18:35 +0100 |
commit | c7fdd84f36a262d062a10c1439121df361ab78d3 (patch) | |
tree | 31751b0f29e4c778abd74aafab19807dffff86e9 /lib/ns.h | |
parent | zebra: nuke zvrf_list and always use vrf_list instead (diff) | |
download | frr-c7fdd84f36a262d062a10c1439121df361ab78d3.tar.xz frr-c7fdd84f36a262d062a10c1439121df361ab78d3.zip |
lib: convert namespace code to use red-black trees
We definitely need to stop abusing the route table data structure when
it's not necessary. Convert the namespace code to use red-black trees
instead. This greatly improves code readability.
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'lib/ns.h')
-rw-r--r-- | lib/ns.h | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -23,6 +23,7 @@ #ifndef _ZEBRA_NS_H #define _ZEBRA_NS_H +#include "openbsd-tree.h" #include "linklist.h" typedef u_int16_t ns_id_t; @@ -35,10 +36,14 @@ typedef u_int16_t ns_id_t; struct ns { + RB_ENTRY(ns) entry; + /* Identifier, same as the vector index */ ns_id_t ns_id; + /* Name */ char *name; + /* File descriptor */ int fd; @@ -48,6 +53,10 @@ struct ns /* User data */ void *info; }; +RB_HEAD (ns_head, ns); +RB_PROTOTYPE (ns_head, ns, entry, ns_compare) + +extern struct ns_head ns_tree; /* * NS hooks |