[lib] Add string mapping table for Zserv commands
2006-05-15 Paul Jakma <paul.jakma@sun.com>
* log.c: (general) Generalise struct zebra_route_desc into
struct zebra_desc_table and, similar to route_types, add a
command_types table to describe Zserv protocol commands.
(route_types[]) use a macro to use designated initialisers
while avoiding tedious duplication.
(zserv_command_string) lookup string from zebra_desc_table,
similar to zebra_route_string
* zebra.h: Add declaration for zserv_command_string, adjust the
comments to reflect zebra_desc_table.
diff --git a/lib/zebra.h b/lib/zebra.h
index 00f13f5..bf7509e 100644
--- a/lib/zebra.h
+++ b/lib/zebra.h
@@ -417,13 +417,17 @@
#define ZEBRA_ROUTE_HSLS 10
#define ZEBRA_ROUTE_MAX 11
-/* Note: whenever a new route type is added (or the numbering is changed),
- the route_types[] table in lib/log.c must be updated! */
+/* Note: whenever a new route-type or zserv-command is added the
+ * corresponding {command,route}_types[] table in lib/log.c MUST be
+ * updated! */
/* Map a route type to a string. For example, ZEBRA_ROUTE_RIPNG -> "ripng". */
extern const char *zebra_route_string(unsigned int route_type);
/* Map a route type to a char. For example, ZEBRA_ROUTE_RIPNG -> 'R'. */
extern char zebra_route_char(unsigned int route_type);
+/* Map a zserv command type to the same string,
+ * e.g. ZEBRA_INTERFACE_ADD -> "ZEBRA_INTERFACE_ADD" */
+extern const char *zserv_command_string (unsigned int command);
/* Zebra's family types. */
#define ZEBRA_FAMILY_IPV4 1