summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorPablo M. Bermudo Garay <pablombg@gmail.com>2017-06-23 18:38:24 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2017-06-26 18:57:03 +0200
commitf9d3e2e15b7ad968f30643ca6da55b75f03686fd (patch)
tree62209af9432b459d3a716d89c1cd6b9a4b82b7f0 /include
parent8750c928cf2a250065a4a0e7948b961be3c46a52 (diff)
src: add new generic context structure nft_ctx
The new structure nft_ctx is meant to be used as a generic container of context information. This is a preparatory patch. So at the moment the struct just carry output_ctx on his path through main.c and cli.c. Based on original idea from Eric Leblond. Signed-off-by: Pablo M. Bermudo Garay <pablombg@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'include')
-rw-r--r--include/cli.h4
-rw-r--r--include/nftables.h8
2 files changed, 8 insertions, 4 deletions
diff --git a/include/cli.h b/include/cli.h
index 1ae12376..6894f9d0 100644
--- a/include/cli.h
+++ b/include/cli.h
@@ -5,9 +5,9 @@
struct parser_state;
#ifdef HAVE_LIBREADLINE
-extern int cli_init(struct parser_state *state, struct output_ctx *octx);
+extern int cli_init(struct nft_ctx *nft, struct parser_state *state);
#else
-static inline int cli_init(struct parser_state *state, struct output_ctx *octx)
+static inline int cli_init(struct nft_ctx *nft, struct parser_state *state)
{
return -1;
}
diff --git a/include/nftables.h b/include/nftables.h
index 9e10be07..dbd46377 100644
--- a/include/nftables.h
+++ b/include/nftables.h
@@ -31,6 +31,10 @@ struct output_ctx {
unsigned int handle;
};
+struct nft_ctx {
+ struct output_ctx output;
+};
+
extern unsigned int max_errors;
extern unsigned int debug_level;
extern const char *include_paths[INCLUDE_PATHS_MAX];
@@ -110,7 +114,7 @@ struct input_descriptor {
struct parser_state;
-int nft_run(void *scanner, struct parser_state *state, struct list_head *msgs,
- struct output_ctx *octx);
+int nft_run(struct nft_ctx *nft, void *scanner, struct parser_state *state,
+ struct list_head *msgs);
#endif /* NFTABLES_NFTABLES_H */