From 7a6f12d75034fed940ce635e76a13123430f088e Mon Sep 17 00:00:00 2001
From: Pablo Neira Ayuso <pablo@netfilter.org>
Date: Sat, 27 Oct 2018 12:02:02 +0200
Subject: 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>
---
 doc/libnftables.adoc | 18 +++++-------------
 1 file changed, 5 insertions(+), 13 deletions(-)

(limited to 'doc/libnftables.adoc')

diff --git a/doc/libnftables.adoc b/doc/libnftables.adoc
index dbd38bdd..b385567c 100644
--- a/doc/libnftables.adoc
+++ b/doc/libnftables.adoc
@@ -31,9 +31,6 @@ 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'*);
 int nft_ctx_unbuffer_output(struct nft_ctx* '\*ctx'*);
@@ -94,6 +91,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),
 };
 ----
 
@@ -109,6 +107,10 @@ NFT_CTX_OUTPUT_HANDLE::
 For example, when deleting a table or chain, it may be identified either by name or handle.
 Rules on the other hand must be deleted by handle because there is no other way to uniquely identify them.
 This flag makes ruleset listings include handle values.
+NFT_CTX_OUTPUT_JSON::
+	If enabled at compile-time, libnftables accepts input in JSON format and is able to print output in JSON format as well.
+See *libnftables-json*(5) for a description of the supported schema.
+This flag controls JSON output format, input is auto-detected.
 
 The *nft_ctx_output_get_flags*() function returns the output flags setting's value in 'ctx'.
 
@@ -190,16 +192,6 @@ The *nft_ctx_output_get_echo*() function returns the echo output setting's value
 
 The *nft_ctx_output_set_echo*() function sets the echo output setting in 'ctx' to the value of 'val'.
 
-=== nft_ctx_output_get_json() and nft_ctx_output_set_json()
-If enabled at compile-time, libnftables accepts input in JSON format and is able to print output in JSON format as well.
-See *libnftables-json*(5) for a description of the supported schema.
-These functions control JSON output format, input is auto-detected.
-The default setting is *false*.
-
-The *nft_ctx_output_get_json*() function returns the JSON output setting's value in 'ctx'.
-
-The *nft_ctx_output_set_json*() function sets the JSON output setting in 'ctx' to the value of 'val'.
-
 === Controlling library standard and error output
 By default, any output from the library (e.g., after a *list* command) is written to 'stdout' and any error messages are written to 'stderr'.
 To give applications control over them, there are functions to assign custom file pointers as well as having the library buffer what would be written for later retrieval in a static buffer.
-- 
cgit v1.2.3

