Skip to contentSkip to conversation

add JSON output format

PATCH Applied Harald Welte 2 participants 2 messages Feb 22, 2016 – Feb 29, 2016 netfilter

lore
Share & tools
lore
#0 lore raw

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
index c6ed858..647490f 100644
@@ -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 2
 
 int 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
maintainer Applied
#1 lore raw
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!