First used in an upcoming commit. Signed-off-by: Ben Pfaff <b...@nicira.com> --- ovn/lib/lex.c | 22 +++++++++++++++++++++- ovn/lib/lex.h | 1 + 2 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/ovn/lib/lex.c b/ovn/lib/lex.c index 8fe0508..73f0ca3 100644 --- a/ovn/lib/lex.c +++ b/ovn/lib/lex.c @@ -22,7 +22,27 @@ #include "dynamic-string.h" #include "json.h" #include "util.h" - + +/* Returns a string that represents 'format'. */ +const char * +lex_format_to_string(enum lex_format format) +{ + switch (format) { + case LEX_F_DECIMAL: + return "decimal"; + case LEX_F_HEXADECIMAL: + return "hexadecimal"; + case LEX_F_IPV4: + return "IPv4"; + case LEX_F_IPV6: + return "IPv6"; + case LEX_F_ETHERNET: + return "Ethernet"; + default: + abort(); + } +} + /* Initializes 'token'. */ void lex_token_init(struct lex_token *token) diff --git a/ovn/lib/lex.h b/ovn/lib/lex.h index 5d391ea..29e922c 100644 --- a/ovn/lib/lex.h +++ b/ovn/lib/lex.h @@ -73,6 +73,7 @@ enum lex_format { LEX_F_IPV6, LEX_F_ETHERNET, }; +const char *lex_format_to_string(enum lex_format); /* A token. * -- 2.1.3 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev