summaryrefslogtreecommitdiffstats
path: root/src/expr/byteorder.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/expr/byteorder.c')
-rw-r--r--src/expr/byteorder.c59
1 files changed, 0 insertions, 59 deletions
diff --git a/src/expr/byteorder.c b/src/expr/byteorder.c
index 47c04cf..4cddd4a 100644
--- a/src/expr/byteorder.c
+++ b/src/expr/byteorder.c
@@ -197,63 +197,6 @@ static inline int nftnl_str2ntoh(const char *op)
}
}
-static int
-nftnl_expr_byteorder_json_parse(struct nftnl_expr *e, json_t *root,
- struct nftnl_parse_err *err)
-{
-#ifdef JSON_PARSING
- const char *op;
- uint32_t sreg, dreg, len, size;
- int ntoh;
-
- if (nftnl_jansson_parse_reg(root, "sreg", NFTNL_TYPE_U32, &sreg, err) == 0)
- nftnl_expr_set_u32(e, NFTNL_EXPR_BYTEORDER_SREG, sreg);
-
- if (nftnl_jansson_parse_reg(root, "dreg", NFTNL_TYPE_U32, &dreg, err) == 0)
- nftnl_expr_set_u32(e, NFTNL_EXPR_BYTEORDER_DREG, dreg);
-
- op = nftnl_jansson_parse_str(root, "op", err);
- if (op != NULL) {
- ntoh = nftnl_str2ntoh(op);
- if (ntoh < 0)
- return -1;
-
- nftnl_expr_set_u32(e, NFTNL_EXPR_BYTEORDER_OP, ntoh);
- }
-
- if (nftnl_jansson_parse_val(root, "len", NFTNL_TYPE_U32, &len, err) == 0)
- nftnl_expr_set_u32(e, NFTNL_EXPR_BYTEORDER_LEN, len);
-
- if (nftnl_jansson_parse_val(root, "size", NFTNL_TYPE_U32, &size, err) == 0)
- nftnl_expr_set_u32(e, NFTNL_EXPR_BYTEORDER_SIZE, size);
-
- return 0;
-#else
- errno = EOPNOTSUPP;
- return -1;
-#endif
-}
-
-static int nftnl_expr_byteorder_export(char *buf, size_t size,
- const struct nftnl_expr *e, int type)
-{
- struct nftnl_expr_byteorder *byteorder = nftnl_expr_data(e);
- NFTNL_BUF_INIT(b, buf, size);
-
- if (e->flags & (1 << NFTNL_EXPR_BYTEORDER_SREG))
- nftnl_buf_u32(&b, type, byteorder->sreg, SREG);
- if (e->flags & (1 << NFTNL_EXPR_BYTEORDER_DREG))
- nftnl_buf_u32(&b, type, byteorder->dreg, DREG);
- if (e->flags & (1 << NFTNL_EXPR_BYTEORDER_OP))
- nftnl_buf_str(&b, type, bo2str(byteorder->op), OP);
- if (e->flags & (1 << NFTNL_EXPR_BYTEORDER_LEN))
- nftnl_buf_u32(&b, type, byteorder->len, LEN);
- if (e->flags & (1 << NFTNL_EXPR_BYTEORDER_SIZE))
- nftnl_buf_u32(&b, type, byteorder->size, SIZE);
-
- return nftnl_buf_done(&b);
-}
-
static int nftnl_expr_byteorder_snprintf_default(char *buf, size_t size,
const struct nftnl_expr *e)
{
@@ -277,7 +220,6 @@ nftnl_expr_byteorder_snprintf(char *buf, size_t size, uint32_t type,
return nftnl_expr_byteorder_snprintf_default(buf, size, e);
case NFTNL_OUTPUT_XML:
case NFTNL_OUTPUT_JSON:
- return nftnl_expr_byteorder_export(buf, size, e, type);
default:
break;
}
@@ -315,5 +257,4 @@ struct expr_ops expr_ops_byteorder = {
.parse = nftnl_expr_byteorder_parse,
.build = nftnl_expr_byteorder_build,
.snprintf = nftnl_expr_byteorder_snprintf,
- .json_parse = nftnl_expr_byteorder_json_parse,
};