summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2020-12-12 20:17:31 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2020-12-17 15:38:41 +0100
commit373445dc54eda77fc7b64fddf5e7d35536df51b0 (patch)
tree5a053465d53ccd53375f45b863d1eed01ec2bfed /include
parent3469f09286ceeb041dd74e4b145d26620f314587 (diff)
src: add NFTNL_EXPR_DYNSET_EXPRESSIONS
NFTNL_EXPR_DYNSET_EXPR defines the stateful expression type that an element stores when added from the packet path. This patch adds support for the set expression list, which generalizes NFTNL_EXPR_DYNSET_EXPR. This patch also adds nftnl_expr_add_expr() to add new expressions to elements and nftnl_set_expr_expr_foreach() to iterate over the list of expressions. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'include')
-rw-r--r--include/expr_ops.h1
-rw-r--r--include/libnftnl/expr.h7
2 files changed, 8 insertions, 0 deletions
diff --git a/include/expr_ops.h b/include/expr_ops.h
index a7f1b9a..5237ac7 100644
--- a/include/expr_ops.h
+++ b/include/expr_ops.h
@@ -12,6 +12,7 @@ struct expr_ops {
const char *name;
uint32_t alloc_len;
int max_attr;
+ void (*init)(const struct nftnl_expr *e);
void (*free)(const struct nftnl_expr *e);
int (*set)(struct nftnl_expr *e, uint16_t type, const void *data, uint32_t data_len);
const void *(*get)(const struct nftnl_expr *e, uint16_t type, uint32_t *data_len);
diff --git a/include/libnftnl/expr.h b/include/libnftnl/expr.h
index c2b2d86..13c55e7 100644
--- a/include/libnftnl/expr.h
+++ b/include/libnftnl/expr.h
@@ -38,6 +38,12 @@ const char *nftnl_expr_get_str(const struct nftnl_expr *expr, uint16_t type);
void nftnl_expr_build_payload(struct nlmsghdr *nlh, struct nftnl_expr *expr);
+/* For dynset expressions. */
+void nftnl_expr_add_expr(struct nftnl_expr *expr, uint32_t type, struct nftnl_expr *e);
+int nftnl_expr_expr_foreach(const struct nftnl_expr *e,
+ int (*cb)(struct nftnl_expr *e, void *data),
+ void *data);
+
int nftnl_expr_snprintf(char *buf, size_t buflen, const struct nftnl_expr *expr, uint32_t type, uint32_t flags);
int nftnl_expr_fprintf(FILE *fp, const struct nftnl_expr *expr, uint32_t type, uint32_t flags);
@@ -167,6 +173,7 @@ enum {
NFTNL_EXPR_DYNSET_SET_NAME,
NFTNL_EXPR_DYNSET_SET_ID,
NFTNL_EXPR_DYNSET_EXPR,
+ NFTNL_EXPR_DYNSET_EXPRESSIONS,
};
enum {