diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/expression.h | 10 | ||||
-rw-r--r-- | include/rule.h | 5 |
2 files changed, 13 insertions, 2 deletions
diff --git a/include/expression.h b/include/expression.h index 26182120..7b9b6229 100644 --- a/include/expression.h +++ b/include/expression.h @@ -16,6 +16,7 @@ * @EXPR_INVALID: uninitialized type, should not happen * @EXPR_VERDICT: nftables verdict expression * @EXPR_SYMBOL: unparsed symbol + * @EXPR_VARIABLE: variable * @EXPR_VALUE: literal numeric or string expression * @EXPR_PREFIX: prefixed expression * @EXPR_RANGE: literal range @@ -41,6 +42,7 @@ enum expr_types { EXPR_INVALID, EXPR_VERDICT, EXPR_SYMBOL, + EXPR_VARIABLE, EXPR_VALUE, EXPR_PREFIX, EXPR_RANGE, @@ -97,7 +99,6 @@ extern const char *expr_op_symbols[]; enum symbol_types { SYMBOL_VALUE, - SYMBOL_DEFINE, SYMBOL_SET, }; @@ -226,6 +227,10 @@ struct expr { enum symbol_types symtype; }; struct { + /* EXPR_VARIABLE */ + struct symbol *sym; + }; + struct { /* EXPR_VERDICT */ int verdict; const char *chain; @@ -387,6 +392,9 @@ static inline void symbol_expr_set_type(struct expr *expr, expr->dtype = dtype; } +struct expr *variable_expr_alloc(const struct location *loc, + struct scope *scope, struct symbol *sym); + extern struct expr *constant_expr_alloc(const struct location *loc, const struct datatype *dtype, enum byteorder byteorder, diff --git a/include/rule.h b/include/rule.h index 531222ce..58c4aeef 100644 --- a/include/rule.h +++ b/include/rule.h @@ -73,18 +73,21 @@ extern void scope_release(const struct scope *scope); * @list: scope symbol list node * @identifier: identifier * @expr: initializer + * @refcnt: reference counter */ struct symbol { struct list_head list; const char *identifier; struct expr *expr; + int refcnt; }; extern void symbol_bind(struct scope *scope, const char *identifier, struct expr *expr); -extern int symbol_unbind(struct scope *scope, const char *identifier); +extern int symbol_unbind(const struct scope *scope, const char *identifier); extern struct symbol *symbol_lookup(const struct scope *scope, const char *identifier); +struct symbol *symbol_get(const struct scope *scope, const char *identifier); enum table_flags { TABLE_F_DORMANT = (1 << 0), |