diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2018-10-09 00:03:28 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2018-10-15 14:04:27 +0200 |
commit | 80077787f8f21da1efd8dc27a4c5767ab47a1df6 (patch) | |
tree | 01d9b399a1aad23d7ea1d1e1daa0ad98bec69e0a /src/common.c | |
parent | aaf20ad0dc22d2ebcad1b2c43288e984f0efe2c3 (diff) |
src: remove json support
We have better json support in libnftables these days.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/common.c')
-rw-r--r-- | src/common.c | 74 |
1 files changed, 0 insertions, 74 deletions
diff --git a/src/common.c b/src/common.c index 561c954..feb13b2 100644 --- a/src/common.c +++ b/src/common.c @@ -91,80 +91,6 @@ int nftnl_parse_perror(const char *msg, struct nftnl_parse_err *err) } } -int nftnl_cmd_header_snprintf(char *buf, size_t size, uint32_t cmd, uint32_t type, - uint32_t flags) -{ - NFTNL_BUF_INIT(b, buf, size); - - if (cmd == NFTNL_CMD_UNSPEC) - return 0; - - switch (type) { - case NFTNL_OUTPUT_XML: - case NFTNL_OUTPUT_JSON: - nftnl_buf_open_array(&b, type, nftnl_cmd2tag(cmd)); - break; - default: - switch (cmd) { - case NFTNL_CMD_ADD: - return snprintf(buf, size, "%9s", "[ADD] "); - case NFTNL_CMD_DELETE: - return snprintf(buf, size, "%9s", "[DELETE] "); - default: - return snprintf(buf, size, "%9s", "[unknown] "); - } - break; - } - return nftnl_buf_done(&b); -} - -static int nftnl_cmd_header_fprintf_cb(char *buf, size_t size, const void *obj, - uint32_t cmd, uint32_t type, - uint32_t flags) -{ - return nftnl_cmd_header_snprintf(buf, size, cmd, type, flags); -} - -int nftnl_cmd_header_fprintf(FILE *fp, uint32_t cmd, uint32_t type, - uint32_t flags) -{ - return nftnl_fprintf(fp, NULL, cmd, type, flags, - nftnl_cmd_header_fprintf_cb); -} - -int nftnl_cmd_footer_snprintf(char *buf, size_t size, uint32_t cmd, uint32_t type, - uint32_t flags) -{ - NFTNL_BUF_INIT(b, buf, size); - - if (cmd == NFTNL_CMD_UNSPEC) - return 0; - - switch (type) { - case NFTNL_OUTPUT_XML: - case NFTNL_OUTPUT_JSON: - nftnl_buf_close_array(&b, type, nftnl_cmd2tag(cmd)); - break; - default: - return 0; - } - return nftnl_buf_done(&b); -} - -static int nftnl_cmd_footer_fprintf_cb(char *buf, size_t size, const void *obj, - uint32_t cmd, uint32_t type, - uint32_t flags) -{ - return nftnl_cmd_footer_snprintf(buf, size, cmd, type, flags); -} - -int nftnl_cmd_footer_fprintf(FILE *fp, uint32_t cmd, uint32_t type, - uint32_t flags) -{ - return nftnl_fprintf(fp, NULL, cmd, type, flags, - nftnl_cmd_footer_fprintf_cb); -} - EXPORT_SYMBOL(nftnl_batch_begin); struct nlmsghdr *nftnl_batch_begin(char *buf, uint32_t seq) { |