From f4c87d0a7037188ff69dff29d5154a102230b792 Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Tue, 8 May 2018 13:08:34 +0200 Subject: libnftables: Make some arrays globally accessible This removes static flag and adds declarations in headers for the following arrays: * ct_templates from src/ct.c * mark_tbl from src/datatype.c * meta_templates and devgroup_tbl from src/meta.c * table_flags_name from src/rule.c * set_stmt_op_names from src/statement.c * tcpopthdr_protocols from src/tcpopt.c Signed-off-by: Phil Sutter Signed-off-by: Pablo Neira Ayuso --- include/ct.h | 2 ++ include/datatype.h | 1 + include/meta.h | 4 ++++ include/rt.h | 2 ++ include/rule.h | 3 +++ include/statement.h | 2 ++ include/tcpopt.h | 4 ++++ 7 files changed, 18 insertions(+) (limited to 'include') diff --git a/include/ct.h b/include/ct.h index 2c3392d3..dadd820f 100644 --- a/include/ct.h +++ b/include/ct.h @@ -16,6 +16,8 @@ struct ct_template { unsigned int len; }; +extern const struct ct_template ct_templates[__NFT_CT_MAX]; + #define CT_TEMPLATE(__token, __dtype, __byteorder, __len) { \ .token = (__token), \ .dtype = (__dtype), \ diff --git a/include/datatype.h b/include/datatype.h index aca08dec..56892ddc 100644 --- a/include/datatype.h +++ b/include/datatype.h @@ -218,6 +218,7 @@ extern struct symbol_table *rt_symbol_table_init(const char *filename); extern void rt_symbol_table_free(struct symbol_table *tbl); extern const struct symbol_table inet_service_tbl; +extern struct symbol_table *mark_tbl; extern const struct datatype invalid_type; extern const struct datatype verdict_type; diff --git a/include/meta.h b/include/meta.h index 6086a71c..a49b4ff5 100644 --- a/include/meta.h +++ b/include/meta.h @@ -16,6 +16,8 @@ struct meta_template { unsigned int len; }; +extern const struct meta_template meta_templates[]; + #define META_TEMPLATE(__token, __dtype, __len, __byteorder) { \ .token = (__token), \ .dtype = (__dtype), \ @@ -40,4 +42,6 @@ extern const struct datatype devgroup_type; extern const struct datatype pkttype_type; extern const struct datatype ifname_type; +extern struct symbol_table *devgroup_tbl; + #endif /* NFTABLES_META_H */ diff --git a/include/rt.h b/include/rt.h index 9828e634..195af943 100644 --- a/include/rt.h +++ b/include/rt.h @@ -18,6 +18,8 @@ struct rt_template { bool invalid; }; +extern const struct rt_template rt_templates[]; + #define RT_TEMPLATE(__token, __dtype, __len, __byteorder, __invalid) { \ .token = (__token), \ .dtype = (__dtype), \ diff --git a/include/rule.h b/include/rule.h index a3764bda..2c44ccea 100644 --- a/include/rule.h +++ b/include/rule.h @@ -115,6 +115,9 @@ struct symbol *symbol_get(const struct scope *scope, const char *identifier); enum table_flags { TABLE_F_DORMANT = (1 << 0), }; +#define TABLE_FLAGS_MAX 1 + +extern const char *table_flags_name[TABLE_FLAGS_MAX]; /** * struct table - nftables table diff --git a/include/statement.h b/include/statement.h index 7315e7ae..5987b181 100644 --- a/include/statement.h +++ b/include/statement.h @@ -163,6 +163,8 @@ struct set_stmt { enum nft_dynset_ops op; }; +extern const char * const set_stmt_op_names[]; + extern struct stmt *set_stmt_alloc(const struct location *loc); struct map_stmt { diff --git a/include/tcpopt.h b/include/tcpopt.h index 9be84817..ffdbcb02 100644 --- a/include/tcpopt.h +++ b/include/tcpopt.h @@ -29,6 +29,7 @@ enum tcpopt_hdr_types { TCPOPTHDR_TIMESTAMP, TCPOPTHDR_ECHO, TCPOPTHDR_ECHO_REPLY, + __TCPOPTHDR_MAX }; enum tcpopt_hdr_fields { @@ -42,4 +43,7 @@ enum tcpopt_hdr_fields { TCPOPTHDR_FIELD_TSVAL, TCPOPTHDR_FIELD_TSECR, }; + +extern const struct exthdr_desc *tcpopthdr_protocols[__TCPOPTHDR_MAX]; + #endif /* NFTABLES_TCPOPT_H */ -- cgit v1.2.3