diff options
Diffstat (limited to 'src/expr/limit.c')
-rw-r--r-- | src/expr/limit.c | 48 |
1 files changed, 0 insertions, 48 deletions
diff --git a/src/expr/limit.c b/src/expr/limit.c index 856ab18..4831abd 100644 --- a/src/expr/limit.c +++ b/src/expr/limit.c @@ -160,32 +160,6 @@ nftnl_expr_limit_parse(struct nftnl_expr *e, struct nlattr *attr) return 0; } -static int nftnl_expr_limit_json_parse(struct nftnl_expr *e, json_t *root, - struct nftnl_parse_err *err) -{ -#ifdef JSON_PARSING - uint64_t uval64; - uint32_t uval32; - - if (nftnl_jansson_parse_val(root, "rate", NFTNL_TYPE_U64, &uval64, err) == 0) - nftnl_expr_set_u64(e, NFTNL_EXPR_LIMIT_RATE, uval64); - - if (nftnl_jansson_parse_val(root, "unit", NFTNL_TYPE_U64, &uval64, err) == 0) - nftnl_expr_set_u64(e, NFTNL_EXPR_LIMIT_UNIT, uval64); - if (nftnl_jansson_parse_val(root, "burst", NFTNL_TYPE_U32, &uval32, err) == 0) - nftnl_expr_set_u32(e, NFTNL_EXPR_LIMIT_BURST, uval32); - if (nftnl_jansson_parse_val(root, "type", NFTNL_TYPE_U32, &uval32, err) == 0) - nftnl_expr_set_u32(e, NFTNL_EXPR_LIMIT_TYPE, uval32); - if (nftnl_jansson_parse_val(root, "flags", NFTNL_TYPE_U32, &uval32, err) == 0) - nftnl_expr_set_u32(e, NFTNL_EXPR_LIMIT_FLAGS, uval32); - - return 0; -#else - errno = EOPNOTSUPP; - return -1; -#endif -} - static const char *get_unit(uint64_t u) { switch (u) { @@ -198,26 +172,6 @@ static const char *get_unit(uint64_t u) return "error"; } -static int nftnl_expr_limit_export(char *buf, size_t size, - const struct nftnl_expr *e, int type) -{ - struct nftnl_expr_limit *limit = nftnl_expr_data(e); - NFTNL_BUF_INIT(b, buf, size); - - if (e->flags & (1 << NFTNL_EXPR_LIMIT_RATE)) - nftnl_buf_u64(&b, type, limit->rate, RATE); - if (e->flags & (1 << NFTNL_EXPR_LIMIT_UNIT)) - nftnl_buf_u64(&b, type, limit->unit, UNIT); - if (e->flags & (1 << NFTNL_EXPR_LIMIT_BURST)) - nftnl_buf_u32(&b, type, limit->burst, BURST); - if (e->flags & (1 << NFTNL_EXPR_LIMIT_TYPE)) - nftnl_buf_u32(&b, type, limit->type, TYPE); - if (e->flags & (1 << NFTNL_EXPR_LIMIT_FLAGS)) - nftnl_buf_u32(&b, type, limit->flags, FLAGS); - - return nftnl_buf_done(&b); -} - static const char *limit_to_type(enum nft_limit_type type) { switch (type) { @@ -248,7 +202,6 @@ nftnl_expr_limit_snprintf(char *buf, size_t len, uint32_t type, return nftnl_expr_limit_snprintf_default(buf, len, e); case NFTNL_OUTPUT_XML: case NFTNL_OUTPUT_JSON: - return nftnl_expr_limit_export(buf, len, e, type); default: break; } @@ -286,5 +239,4 @@ struct expr_ops expr_ops_limit = { .parse = nftnl_expr_limit_parse, .build = nftnl_expr_limit_build, .snprintf = nftnl_expr_limit_snprintf, - .json_parse = nftnl_expr_limit_json_parse, }; |