diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2019-08-07 23:51:18 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2019-08-08 12:03:26 +0200 |
commit | a805eab34e34aaf2f08c607e770ec0b8df992f4a (patch) | |
tree | 20cbd71040e52ee4d4fe3dc450e5d9d6eeb71d1d /include/datatype.h | |
parent | e8417f7bcbfe20524307557f8687bdd3a665f73e (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/datatype.h')
-rw-r--r-- | include/datatype.h | 14 |
1 files changed, 11 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, |