From 3cc5584dfaa18178e3d91ec740151a55dd5af674 Mon Sep 17 00:00:00 2001 From: paul Date: Mon, 15 May 2006 16:56:51 +0000 Subject: [lib] Add string mapping table for Zserv commands 2006-05-15 Paul Jakma * 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. --- lib/zebra.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'lib/zebra.h') diff --git a/lib/zebra.h b/lib/zebra.h index 00f13f57..bf7509e2 100644 --- a/lib/zebra.h +++ b/lib/zebra.h @@ -417,13 +417,17 @@ struct in_pktinfo #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 -- cgit v1.2.3