#include <stdbool.h>
#include <gmputil.h>
#include <linux/netfilter/nf_tables.h>
#include <nftables.h>
#include <datatype.h>
#include <utils.h>
#include <list.h>
#include <payload.h>
#include <exthdr.h>
#include <meta.h>
#include <ct.h>
Data Structures | |
struct | expr_ctx |
struct expr_ctx - type context for symbol parsing during evaluation More... | |
struct | expr_ops |
struct | expr |
Macros | |
#define | OP_MAX (__OP_MAX - 1) |
Enumerations | |
enum | expr_types { EXPR_INVALID, EXPR_VERDICT, EXPR_SYMBOL, EXPR_VALUE, EXPR_PREFIX, EXPR_RANGE, EXPR_PAYLOAD, EXPR_EXTHDR, EXPR_META, EXPR_CT, EXPR_CONCAT, EXPR_LIST, EXPR_SET, EXPR_SET_REF, EXPR_MAPPING, EXPR_MAP, EXPR_UNARY, EXPR_BINOP, EXPR_RELATIONAL } |
enum expr_types More... | |
enum | ops { OP_INVALID, OP_IMPLICIT, OP_HTON, OP_NTOH, OP_LSHIFT, OP_RSHIFT, OP_AND, OP_XOR, OP_OR, OP_EQ, OP_NEQ, OP_LT, OP_GT, OP_LTE, OP_GTE, OP_RANGE, OP_FLAGCMP, OP_LOOKUP, __OP_MAX } |
enum | symbol_types { SYMBOL_VALUE, SYMBOL_DEFINE, SYMBOL_SET } |
Variables | |
const char * | expr_op_symbols [] |
#define expr_error | ( | msgs, | |
expr, | |||
fmt, | |||
args... | |||
) | expr_binary_error(msgs, expr, NULL, fmt, ## args) |
Referenced by payload_gen_dependency().
#define OP_MAX (__OP_MAX - 1) |
enum expr_flags |
enum expr_types |
enum expr_types
: uninitialized type, should not happen : nftables verdict expression : unparsed symbol : literal numeric or string expression : prefixed expression : literal range : payload expression : exthdr expression : meta expression : conntrack expression : concatenation : list of expressions : literal set : set reference : a single mapping (key : value) : map operation (expr map { EXPR_MAPPING, ... }) : byteorder conversion, generated during evaluation : binary operations (bitwise, shifts) : equality and relational expressions
enum ops |
enum symbol_types |
struct expr* binop_expr_alloc | ( | const struct location * | loc, |
enum ops | op, | ||
struct expr * | left, | ||
struct expr * | right | ||
) |
References expr::byteorder, expr::dtype, expr_alloc(), expr::left, expr::op, and expr::right.
Referenced by bitmask_expr_to_binops().
References datatype::basetype, binop_expr_alloc(), expr::byteorder, expr::dtype, expr_free(), EXPR_VALUE, flag_expr_alloc(), expr::len, expr::location, mpz_popcount(), mpz_scan1(), NULL, OP_OR, expr::ops, expr_ops::type, datatype::type, TYPE_BITMASK, and expr::value.
References expr::expressions, expr::list, and expr::size.
Referenced by interval_map_decompose().
References expr::list, and expr::size.
Referenced by interval_map_decompose().
struct expr* constant_expr_alloc | ( | const struct location * | loc, |
const struct datatype * | dtype, | ||
enum byteorder | byteorder, | ||
unsigned int | len, | ||
const void * | data | ||
) |
References BITS_PER_BYTE, div_round_up, expr_alloc(), EXPR_F_CONSTANT, EXPR_F_SINGLETON, expr::flags, mpz_import_data(), mpz_init2(), NULL, and expr::value.
Referenced by constant_expr_join(), constant_expr_splice(), flag_expr_alloc(), interval_map_decompose(), netlink_alloc_value(), payload_gen_dependency(), and symbolic_constant_parse().
References BITS_PER_BYTE, expr::byteorder, BYTEORDER_INVALID, constant_expr_alloc(), data, EXPR_VALUE, invalid_type, len, expr::len, expr::location, mpz_export_data(), expr::ops, expr_ops::type, and expr::value.
References BYTEORDER_INVALID, constant_expr_alloc(), EXPR_VALUE, invalid_type, len, expr::len, expr::location, mask, mpz_and(), mpz_bitmask(), mpz_clear(), mpz_init2(), mpz_lshift_ui(), mpz_rshift_ui(), mpz_set(), NULL, expr::ops, expr_ops::type, and expr::value.
struct expr* expr_alloc | ( | const struct location * | loc, |
const struct expr_ops * | ops, | ||
const struct datatype * | dtype, | ||
enum byteorder | byteorder, | ||
unsigned int | len | ||
) |
References expr::byteorder, expr::dtype, len, expr::len, expr::list, expr::location, expr::ops, expr::refcnt, and xzalloc().
Referenced by binop_expr_alloc(), constant_expr_alloc(), ct_expr_alloc(), expr_clone(), exthdr_expr_alloc(), map_expr_alloc(), mapping_expr_alloc(), meta_expr_alloc(), payload_expr_alloc(), prefix_expr_alloc(), range_expr_alloc(), relational_expr_alloc(), set_ref_expr_alloc(), symbol_expr_alloc(), unary_expr_alloc(), and verdict_expr_alloc().
References datatype::basetype, expr::dtype, NULL, and type.
Referenced by expr_describe(), and symbolic_constant_print().
int expr_binary_error | ( | struct list_head * | msgs, |
const struct expr * | e1, | ||
const struct expr * | e2, | ||
const char * | fmt, | ||
... | |||
) |
References expr::byteorder, expr_ops::clone, expr::dtype, expr_alloc(), expr::flags, expr::len, expr::location, expr::op, and expr::ops.
Referenced by interval_map_decompose().
References expr_ops::cmp, EXPR_F_SINGLETON, expr::flags, expr::ops, and expr_ops::type.
References datatype::basetype, BITS_PER_BYTE, datatype::desc, expr::dtype, expr_basetype(), expr::len, expr_ops::name, datatype::name, NULL, expr::ops, datatype::sym_tbl, symbol_table_print(), and TYPE_STRING.
References expr_ops::destroy, NULL, expr::ops, expr::refcnt, and xfree.
Referenced by bitmask_expr_to_binops(), cmd_free(), interval_map_decompose(), scope_release(), and set_free().
References expr::refcnt.
Referenced by interval_map_decompose().
References expr::ops, and expr_ops::print.
Referenced by set_to_intervals().
References expr::byteorder, expr::dtype, expr::ops, and expr_ops::set_type.
struct expr* flag_expr_alloc | ( | const struct location * | loc, |
const struct datatype * | dtype, | ||
enum byteorder | byteorder, | ||
unsigned int | len, | ||
unsigned long | n | ||
) |
References constant_expr_alloc(), mpz_lshift_ui(), mpz_set_ui(), NULL, and expr::value.
Referenced by bitmask_expr_to_binops().
References expr::arg, BYTEORDER_INVALID, expr_alloc(), invalid_type, expr::map, and expr::mappings.
struct expr* mapping_expr_alloc | ( | const struct location * | loc, |
struct expr * | from, | ||
struct expr * | to | ||
) |
References expr::byteorder, expr::dtype, expr_alloc(), expr::left, and expr::right.
Referenced by interval_map_decompose().
struct expr* prefix_expr_alloc | ( | const struct location * | loc, |
struct expr * | expr, | ||
unsigned int | prefix_len | ||
) |
References BYTEORDER_INVALID, expr_alloc(), invalid_type, expr::prefix, and expr::prefix_len.
Referenced by interval_map_decompose().
struct expr* range_expr_alloc | ( | const struct location * | loc, |
struct expr * | low, | ||
struct expr * | high | ||
) |
References BYTEORDER_INVALID, expr_alloc(), invalid_type, expr::left, and expr::right.
Referenced by interval_map_decompose().
References BUG, EXPR_MAPPING, EXPR_PREFIX, EXPR_RANGE, EXPR_VALUE, expr::left, expr::len, mpz_add(), mpz_clear(), mpz_init_bitmask(), mpz_set(), expr_ops::name, expr::ops, expr::prefix, expr::prefix_len, range_expr_value_low(), expr::right, expr_ops::type, and expr::value.
References BUG, EXPR_MAPPING, EXPR_PREFIX, EXPR_RANGE, EXPR_VALUE, expr::left, mpz_set(), expr_ops::name, expr::ops, expr::prefix, expr_ops::type, and expr::value.
Referenced by range_expr_value_high().
struct expr* relational_expr_alloc | ( | const struct location * | loc, |
enum ops | op, | ||
struct expr * | left, | ||
struct expr * | right | ||
) |
References BYTEORDER_INVALID, expr_alloc(), expr::left, expr::op, expr::right, and verdict_type.
Referenced by payload_gen_dependency().
References expr_alloc(), EXPR_F_CONSTANT, expr::flags, set::keytype, expr::set, and set_get().
References BITS_PER_BYTE, expr_print(), set::init, seg_tree::keylen, elementary_interval::left, list_for_each_entry_safe, LIST_HEAD, pr_gmp_debug, and elementary_interval::right.
struct expr* symbol_expr_alloc | ( | const struct location * | loc, |
enum symbol_types | type, | ||
struct scope * | scope, | ||
const char * | identifier | ||
) |
References BYTEORDER_INVALID, expr_alloc(), expr::identifier, invalid_type, expr::scope, expr::symtype, type, and xstrdup().
References expr::arg, BYTEORDER_INVALID, expr_alloc(), invalid_type, and expr::op.
References BYTEORDER_INVALID, expr::chain, expr_alloc(), EXPR_F_CONSTANT, EXPR_F_SINGLETON, expr::flags, NULL, verdict, expr::verdict, and verdict_type.
const char* expr_op_symbols[] |