summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2018-10-27 12:02:02 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2018-10-29 15:07:35 +0100
commit7a6f12d75034fed940ce635e76a13123430f088e (patch)
treef58e0e41f725ae50820889fcc55712b13da6ac55 /include
parent3c69cf7603534ef6df01ec079c6a4d3d3382f580 (diff)
src: add nft_ctx_output_{get,set}_json() to nft_ctx_output_{get,set}_flags
Add NFT_CTX_OUTPUT_JSON flag and display output in json format. Acked-by: Phil Sutter <phil@nwl.cc> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'include')
-rw-r--r--include/nftables.h6
-rw-r--r--include/nftables/libnftables.h3
2 files changed, 6 insertions, 3 deletions
diff --git a/include/nftables.h b/include/nftables.h
index e0e7a113..86788a43 100644
--- a/include/nftables.h
+++ b/include/nftables.h
@@ -19,7 +19,6 @@ struct output_ctx {
unsigned int flags;
unsigned int numeric;
unsigned int echo;
- unsigned int json;
union {
FILE *output_fp;
struct cookie output_cookie;
@@ -50,6 +49,11 @@ static inline bool nft_output_handle(const struct output_ctx *octx)
return octx->flags & NFT_CTX_OUTPUT_HANDLE;
}
+static inline bool nft_output_json(const struct output_ctx *octx)
+{
+ return octx->flags & NFT_CTX_OUTPUT_JSON;
+}
+
struct nft_cache {
uint16_t genid;
struct list_head list;
diff --git a/include/nftables/libnftables.h b/include/nftables/libnftables.h
index a6ce9383..35374072 100644
--- a/include/nftables/libnftables.h
+++ b/include/nftables/libnftables.h
@@ -49,6 +49,7 @@ enum {
NFT_CTX_OUTPUT_SERVICE = (1 << 1),
NFT_CTX_OUTPUT_STATELESS = (1 << 2),
NFT_CTX_OUTPUT_HANDLE = (1 << 3),
+ NFT_CTX_OUTPUT_JSON = (1 << 4),
};
unsigned int nft_ctx_output_get_flags(struct nft_ctx *ctx);
@@ -60,8 +61,6 @@ unsigned int nft_ctx_output_get_debug(struct nft_ctx *ctx);
void nft_ctx_output_set_debug(struct nft_ctx *ctx, unsigned int mask);
bool nft_ctx_output_get_echo(struct nft_ctx *ctx);
void nft_ctx_output_set_echo(struct nft_ctx *ctx, bool val);
-bool nft_ctx_output_get_json(struct nft_ctx *ctx);
-void nft_ctx_output_set_json(struct nft_ctx *ctx, bool val);
FILE *nft_ctx_set_output(struct nft_ctx *ctx, FILE *fp);
int nft_ctx_buffer_output(struct nft_ctx *ctx);