netfilter
firewalling, NAT, and packet mangling for linux
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
expression.c File Reference
#include <stddef.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <limits.h>
#include <expression.h>
#include <datatype.h>
#include <rule.h>
#include <gmputil.h>
#include <utils.h>
#include <list.h>
#include <erec.h>
Include dependency graph for expression.c:

Functions

struct exprexpr_alloc (const struct location *loc, const struct expr_ops *ops, const struct datatype *dtype, enum byteorder byteorder, unsigned int len)
 
struct exprexpr_clone (const struct expr *expr)
 
struct exprexpr_get (struct expr *expr)
 
void expr_free (struct expr *expr)
 
void expr_print (const struct expr *expr)
 
bool expr_cmp (const struct expr *e1, const struct expr *e2)
 
void expr_describe (const struct expr *expr)
 
void expr_set_type (struct expr *expr, const struct datatype *dtype, enum byteorder byteorder)
 
const struct datatypeexpr_basetype (const struct expr *expr)
 
int __fmtstring (4, 5)
 
struct exprverdict_expr_alloc (const struct location *loc, int verdict, const char *chain)
 
struct exprsymbol_expr_alloc (const struct location *loc, enum symbol_types type, struct scope *scope, const char *identifier)
 
struct exprconstant_expr_alloc (const struct location *loc, const struct datatype *dtype, enum byteorder byteorder, unsigned int len, const void *data)
 
struct exprconstant_expr_join (const struct expr *e1, const struct expr *e2)
 
struct exprconstant_expr_splice (struct expr *expr, unsigned int len)
 
struct exprflag_expr_alloc (const struct location *loc, const struct datatype *dtype, enum byteorder byteorder, unsigned int len, unsigned long n)
 
struct exprbitmask_expr_to_binops (struct expr *expr)
 
struct exprprefix_expr_alloc (const struct location *loc, struct expr *expr, unsigned int prefix_len)
 
struct exprunary_expr_alloc (const struct location *loc, enum ops op, struct expr *arg)
 
struct exprbinop_expr_alloc (const struct location *loc, enum ops op, struct expr *left, struct expr *right)
 
struct exprrelational_expr_alloc (const struct location *loc, enum ops op, struct expr *left, struct expr *right)
 
struct exprrange_expr_alloc (const struct location *loc, struct expr *left, struct expr *right)
 
void compound_expr_add (struct expr *compound, struct expr *expr)
 
void compound_expr_remove (struct expr *compound, struct expr *expr)
 
struct exprconcat_expr_alloc (const struct location *loc)
 
struct exprlist_expr_alloc (const struct location *loc)
 
struct exprset_expr_alloc (const struct location *loc)
 
struct exprmapping_expr_alloc (const struct location *loc, struct expr *from, struct expr *to)
 
struct exprmap_expr_alloc (const struct location *loc, struct expr *arg, struct expr *mappings)
 
struct exprset_ref_expr_alloc (const struct location *loc, struct set *set)
 
void range_expr_value_low (mpz_t rop, const struct expr *expr)
 
void range_expr_value_high (mpz_t rop, const struct expr *expr)
 

Variables

const char * expr_op_symbols []
 

Function Documentation

int __fmtstring ( ,
 
)

References erec_add_location(), EREC_ERROR, erec_vcreate(), and NULL.

Here is the call graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

void compound_expr_add ( struct expr compound,
struct expr expr 
)

References expr::expressions, expr::list, and expr::size.

Referenced by interval_map_decompose().

Here is the caller graph for this function:

void compound_expr_remove ( struct expr compound,
struct expr expr 
)

References expr::list, and expr::size.

Referenced by interval_map_decompose().

Here is the caller graph for this function:

struct expr* concat_expr_alloc ( const struct location loc)
struct expr* constant_expr_alloc ( const struct location loc,
const struct datatype dtype,
enum byteorder byteorder  ,
unsigned int  len,
const void *  data 
)
struct expr* constant_expr_join ( const struct expr e1,
const struct expr e2 
)
const struct datatype* expr_basetype ( const struct expr expr)

References datatype::basetype, expr::dtype, NULL, and type.

Referenced by expr_describe(), and symbolic_constant_print().

Here is the caller graph for this function:

struct expr* expr_clone ( const struct expr expr)

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().

Here is the call graph for this function:

Here is the caller graph for this function:

bool expr_cmp ( const struct expr e1,
const struct expr e2 
)
void expr_describe ( const struct expr expr)
void expr_free ( struct expr expr)

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().

Here is the caller graph for this function:

struct expr* expr_get ( struct expr expr)

References expr::refcnt.

Referenced by interval_map_decompose().

Here is the caller graph for this function:

void expr_print ( const struct expr expr)

References expr::ops, and expr_ops::print.

Referenced by set_to_intervals().

Here is the caller graph for this function:

void expr_set_type ( struct expr expr,
const struct datatype dtype,
enum byteorder byteorder   
)
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().

Here is the call graph for this function:

Here is the caller graph for this function:

struct expr* list_expr_alloc ( const struct location loc)
struct expr* map_expr_alloc ( const struct location loc,
struct expr arg,
struct expr mappings 
)

References expr::arg, BYTEORDER_INVALID, expr_alloc(), invalid_type, expr::map, and expr::mappings.

Here is the call graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

struct expr* range_expr_alloc ( const struct location loc,
struct expr left,
struct expr right 
)

References BYTEORDER_INVALID, expr_alloc(), invalid_type, expr::left, and expr::right.

Referenced by interval_map_decompose().

Here is the call graph for this function:

Here is the caller graph for this function:

void range_expr_value_low ( mpz_t  rop,
const struct expr expr 
)

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

struct expr* set_expr_alloc ( const struct location loc)

Referenced by netlink_get_setelems().

Here is the caller graph for this function:

struct expr* set_ref_expr_alloc ( const struct location loc,
struct set set 
)

References expr_alloc(), EXPR_F_CONSTANT, expr::flags, set::keytype, expr::set, and set_get().

Here is the call graph for this function:

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().

Here is the call graph for this function:

struct expr* unary_expr_alloc ( const struct location loc,
enum ops  op,
struct expr arg 
)

References expr::arg, BYTEORDER_INVALID, expr_alloc(), invalid_type, and expr::op.

Here is the call graph for this function:

struct expr* verdict_expr_alloc ( const struct location loc,
int  verdict,
const char *  chain 
)

Variable Documentation

const char* expr_op_symbols[]
Initial value:
= {
[OP_INVALID] = "invalid",
[OP_HTON] = "hton",
[OP_NTOH] = "ntoh",
[OP_AND] = "&",
[OP_OR] = "|",
[OP_XOR] = "^",
[OP_LSHIFT] = "<<",
[OP_RSHIFT] = ">>",
[OP_EQ] = "==",
[OP_NEQ] = "!=",
[OP_LT] = "<",
[OP_GT] = ">",
[OP_LTE] = "<=",
[OP_GTE] = ">=",
[OP_RANGE] = "within range",
}
Definition: expression.h:74
#define NULL
Definition: linux_stddef.h:8
Definition: expression.h:68
Definition: expression.h:69
Definition: expression.h:63
Definition: expression.h:67
Definition: expression.h:82
Definition: expression.h:71
Definition: expression.h:75
Definition: expression.h:76
Definition: expression.h:59
Definition: expression.h:72
Definition: expression.h:65
Definition: expression.h:62
Definition: expression.h:73
Definition: expression.h:78
Definition: expression.h:66