summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2019-08-07 23:51:18 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2019-08-08 12:03:26 +0200
commita805eab34e34aaf2f08c607e770ec0b8df992f4a (patch)
tree20cbd71040e52ee4d4fe3dc450e5d9d6eeb71d1d /include
parente8417f7bcbfe20524307557f8687bdd3a665f73e (diff)
src: add parse_ctx object
This object stores the dynamic symbol tables that are loaded from files. Pass this object to datatype parse functions, although this new parameter is not used yet, this is just a preparation patch. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'include')
-rw-r--r--include/datatype.h14
-rw-r--r--include/nftables.h8
2 files changed, 19 insertions, 3 deletions
diff --git a/include/datatype.h b/include/datatype.h
index 63617ebd..018f013a 100644
--- a/include/datatype.h
+++ b/include/datatype.h
@@ -123,6 +123,7 @@ enum datatype_flags {
DTYPE_F_PREFIX = (1 << 1),
};
+struct parse_ctx;
/**
* struct datatype
*
@@ -154,7 +155,8 @@ struct datatype {
struct output_ctx *octx);
json_t *(*json)(const struct expr *expr,
struct output_ctx *octx);
- struct error_record *(*parse)(const struct expr *sym,
+ struct error_record *(*parse)(struct parse_ctx *ctx,
+ const struct expr *sym,
struct expr **res);
const struct symbol_table *sym_tbl;
unsigned int refcnt;
@@ -166,7 +168,12 @@ extern struct datatype *datatype_get(const struct datatype *dtype);
extern void datatype_set(struct expr *expr, const struct datatype *dtype);
extern void datatype_free(const struct datatype *dtype);
-extern struct error_record *symbol_parse(const struct expr *sym,
+struct parse_ctx {
+ struct symbol_tables *tbl;
+};
+
+extern struct error_record *symbol_parse(struct parse_ctx *ctx,
+ const struct expr *sym,
struct expr **res);
extern void datatype_print(const struct expr *expr, struct output_ctx *octx);
@@ -218,7 +225,8 @@ struct symbol_table {
struct symbolic_constant symbols[];
};
-extern struct error_record *symbolic_constant_parse(const struct expr *sym,
+extern struct error_record *symbolic_constant_parse(struct parse_ctx *ctx,
+ const struct expr *sym,
const struct symbol_table *tbl,
struct expr **res);
extern void symbolic_constant_print(const struct symbol_table *tbl,
diff --git a/include/nftables.h b/include/nftables.h
index ed446e2d..407d7613 100644
--- a/include/nftables.h
+++ b/include/nftables.h
@@ -15,6 +15,13 @@ struct cookie {
size_t pos;
};
+struct symbol_tables {
+ const struct symbol_table *mark;
+ const struct symbol_table *devgroup;
+ const struct symbol_table *ct_label;
+ const struct symbol_table *realm;
+};
+
struct output_ctx {
unsigned int flags;
union {
@@ -25,6 +32,7 @@ struct output_ctx {
FILE *error_fp;
struct cookie error_cookie;
};
+ struct symbol_tables tbl;
};
static inline bool nft_output_reversedns(const struct output_ctx *octx)