diff options
author | Phil Sutter <phil@nwl.cc> | 2018-05-08 13:08:36 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2018-05-11 12:16:57 +0200 |
commit | e77b31f53a61a8995cd6baf91a6e557260f401bd (patch) | |
tree | 1ee2e9c20c746c8cb66ee5f70ce95c9ebcf8cafc /include | |
parent | 7feece21f72ebf4633048b2dd447e31da30819fb (diff) |
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 <phil@nwl.cc>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/ct.h | 2 | ||||
-rw-r--r-- | include/statement.h | 3 |
2 files changed, 5 insertions, 0 deletions
diff --git a/include/ct.h b/include/ct.h index dadd820f..4c5bd804 100644 --- a/include/ct.h +++ b/include/ct.h @@ -33,6 +33,8 @@ extern void ct_expr_update_type(struct proto_ctx *ctx, struct expr *expr); extern struct stmt *notrack_stmt_alloc(const struct location *loc); extern struct stmt *flow_offload_stmt_alloc(const struct location *loc, const char *table_name); +extern const char *ct_dir2str(int dir); +extern const char *ct_label2str(unsigned long value); extern const struct datatype ct_dir_type; extern const struct datatype ct_state_type; 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; |