From e77b31f53a61a8995cd6baf91a6e557260f401bd Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Tue, 8 May 2018 13:08:36 +0200 Subject: libnftables: Introduce a few helper functions This adds a bunch of functions for conversion of different values into string (and vice-versa). * log_level_parse(): A simple helper to turn log level string representation into log level value. * nat_etype2str(): Translate nat statement type into string representation. * ct_dir2str(): Convert IP_CT_DIR_* values into string representation. * ct_label2str(): Convert ct_label values into string representation. Signed-off-by: Phil Sutter Signed-off-by: Pablo Neira Ayuso --- include/statement.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include/statement.h') diff --git a/include/statement.h b/include/statement.h index fc80dbd5..2c6d0dfa 100644 --- a/include/statement.h +++ b/include/statement.h @@ -77,6 +77,7 @@ struct log_stmt { }; extern const char *log_level(uint32_t level); +extern int log_level_parse(const char *level); extern struct stmt *log_stmt_alloc(const struct location *loc); @@ -107,6 +108,8 @@ enum nft_nat_etypes { NFT_NAT_REDIR, }; +extern const char *nat_etype2str(enum nft_nat_etypes type); + struct nat_stmt { enum nft_nat_etypes type; struct expr *addr; -- cgit v1.2.3