From e70354f53e9f6be4a4be31dbc46c5e23291d3587 Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Tue, 8 May 2018 13:08:37 +0200 Subject: libnftables: Implement JSON output support Although technically there already is support for JSON output via 'nft export json' command, it is hardly useable since it exports all the gory details of nftables VM. Also, libnftables has no control over what is exported since the content comes directly from libnftnl. Instead, implement JSON format support for regular 'nft list' commands. Signed-off-by: Phil Sutter Signed-off-by: Pablo Neira Ayuso --- include/datatype.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include/datatype.h') diff --git a/include/datatype.h b/include/datatype.h index 56892ddc..b641f0ed 100644 --- a/include/datatype.h +++ b/include/datatype.h @@ -1,6 +1,8 @@ #ifndef NFTABLES_DATATYPE_H #define NFTABLES_DATATYPE_H +#include + /** * enum datatypes * @@ -149,6 +151,8 @@ struct datatype { const char *basefmt; void (*print)(const struct expr *expr, struct output_ctx *octx); + json_t *(*json)(const struct expr *expr, + struct output_ctx *octx); struct error_record *(*parse)(const struct expr *sym, struct expr **res); const struct symbol_table *sym_tbl; -- cgit v1.2.3