From eb5d458b3f5e2813ad6c473323b2b37e243aad4f Mon Sep 17 00:00:00 2001 From: Stephen Worley Date: Tue, 3 Dec 2019 16:14:34 -0500 Subject: [PATCH] lib: Add zapi_rule_notify_owner2str() function Add a function for converting the zapi_rule_notify_owner enum type to a string for ease of use. Signed-off-by: Stephen Worley --- lib/zclient.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/lib/zclient.h b/lib/zclient.h index 7adb294a31..99ed34138e 100644 --- a/lib/zclient.h +++ b/lib/zclient.h @@ -485,6 +485,29 @@ enum zapi_iptable_notify_owner { ZAPI_IPTABLE_FAIL_REMOVE, }; +static inline const char * +zapi_rule_notify_owner2str(enum zapi_rule_notify_owner note) +{ + const char *ret = "UNKNOWN"; + + switch (note) { + case ZAPI_RULE_FAIL_INSTALL: + ret = "ZAPI_RULE_FAIL_INSTALL"; + break; + case ZAPI_RULE_INSTALLED: + ret = "ZAPI_RULE_INSTALLED"; + break; + case ZAPI_RULE_FAIL_REMOVE: + ret = "ZAPI_RULE_FAIL_REMOVE"; + break; + case ZAPI_RULE_REMOVED: + ret = "ZAPI_RULE_REMOVED"; + break; + } + + return ret; +} + /* Zebra MAC types */ #define ZEBRA_MACIP_TYPE_STICKY 0x01 /* Sticky MAC*/ #define ZEBRA_MACIP_TYPE_GW 0x02 /* gateway (SVI) mac*/