From 80077787f8f21da1efd8dc27a4c5767ab47a1df6 Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Tue, 9 Oct 2018 00:03:28 +0200 Subject: src: remove json support We have better json support in libnftables these days. Signed-off-by: Pablo Neira Ayuso --- src/common.c | 74 ------------------------------------------------------------ 1 file changed, 74 deletions(-) (limited to 'src/common.c') 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) { -- cgit v1.2.3