From 6e48df5329eab9b8316eb0d40f77b5a9457741a8 Mon Sep 17 00:00:00 2001 From: Florian Westphal Date: Sun, 4 Aug 2019 22:24:22 +0200 Subject: src: add "typeof" build/parse/print support This patch adds two new expression operations to build and to parse the userdata area that describe the set key and data typeof definitions. For maps, the grammar enforces either "type data_type : data_type" or or "typeof expression : expression". Check both key and data for valid user typeof info first. If they check out, flag set->key_typeof_valid as true and use it for printing the key info. This patch comes with initial support for using payload expressions with the 'typeof' keyword, followup patches will add support for other expressions as well. Signed-off-by: Pablo Neira Ayuso Signed-off-by: Florian Westphal --- include/expression.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include/expression.h') diff --git a/include/expression.h b/include/expression.h index d502fc2a..b3e79c49 100644 --- a/include/expression.h +++ b/include/expression.h @@ -10,6 +10,7 @@ #include #include #include +#include /** * enum expr_types @@ -166,6 +167,9 @@ struct expr_ops { const struct expr *e2); void (*pctx_update)(struct proto_ctx *ctx, const struct expr *expr); + int (*build_udata)(struct nftnl_udata_buf *udbuf, + const struct expr *expr); + struct expr * (*parse_udata)(const struct nftnl_udata *ud); }; const struct expr_ops *expr_ops(const struct expr *e); -- cgit v1.2.3