add JSON output format
PATCH 1/1 add JSON output format
the original output format looks a bit like JSON, but isn't. The XML output is useful if you deal with XML, but a lot of applications prefer more lightweight formats like YAML/JSON.
This adds the JSON output format to libnetfilter_acct, which will subsequently be used by a similar change in the nfacct utility.
--- include/libnetfilter_acct/libnetfilter_acct.h | 1 + src/libnetfilter_acct.c | 46 +++++++++++++++++++++++++++ 2 files changed, 47 insertions(+)
include/libnetfilter_acct/libnetfilter_acct.h +1 -0
@@ -41,6 +41,7 @@ int nfacct_nlmsg_parse_payload(const struct nlmsghdr *nlh, struct nfacct *nfacct#define NFACCT_SNPRINTF_T_PLAIN 0#define NFACCT_SNPRINTF_T_XML 1 +#define NFACCT_SNPRINTF_T_JSON 2int nfacct_snprintf (char *buf,size_t size,struct nfacct *nfacct,uint16_t type,uint16_t flags);
src/libnetfilter_acct.c +46 -0
58 lines not on this page · raw message
Signature · 1 line
2.7.0
Quoted 6 lines · Harald Welte
the original output format looks a bit like JSON, but isn't. The XML output is useful if you deal with XML, but a lot of applications prefer more lightweight formats like YAML/JSON.
This adds the JSON output format to
libnetfilter_acct, which will subsequently be used by a similar change in the nfacct utility.
Applied, thanks Harald!