23#define ASSERT_DFVM_OP_NOT_REACHED(op) \
24 ws_error("Invalid dfvm opcode '%s'.", dfvm_opcode_tostr(op))
71#define dfvm_value_get_fvalue(val) ((val)->value.fvalue_p->pdata[0])
dfvm_value_t * dfvm_value_new(dfvm_value_type_t type)
Create a new DFVM value.
Definition dfvm.c:172
dfvm_value_t * dfvm_value_new_pcre(ws_regex_t *re)
Creates a new PCRE value.
Definition dfvm.c:231
void dfvm_value_unref(dfvm_value_t *v)
Decrements the reference count of a dfvm_value_t object and frees it if the reference count reaches z...
Definition dfvm.c:115
bool dfvm_apply(dfilter_t *df, proto_tree *tree)
Applies a display filter to a protocol tree.
Definition dfvm.c:1825
dfvm_value_t * dfvm_value_new_drange(drange_t *dr)
Creates a new dfvm_value_t with type DRANGE.
Definition dfvm.c:215
dfvm_value_t * dfvm_value_new_uint(unsigned num)
Create a new DFVM value with an unsigned integer.
Definition dfvm.c:239
dfvm_value_type_t
Discriminator tag identifying the active payload in a dfvm_value_t union.
Definition dfvm.h:30
@ RAW_HFINFO
Definition dfvm.h:34
@ PCRE
Definition dfvm.h:41
@ EMPTY
Definition dfvm.h:31
@ INSN_NUMBER
Definition dfvm.h:36
@ INTEGER
Definition dfvm.h:38
@ DRANGE
Definition dfvm.h:39
@ HFINFO_VS
Definition dfvm.h:35
@ REGISTER
Definition dfvm.h:37
@ FVALUE
Definition dfvm.h:32
@ FUNCTION_DEF
Definition dfvm.h:40
@ HFINFO
Definition dfvm.h:33
void dfvm_dump(FILE *f, dfilter_t *df, uint16_t flags)
Dumps the bytecode of a dfilter_t to a file.
Definition dfvm.c:736
dfvm_value_t * dfvm_value_new_funcdef(df_func_def_t *funcdef)
Create a new DFVM value of type FUNCTION_DEF.
Definition dfvm.c:223
char * dfvm_dump_str(wmem_allocator_t *alloc, dfilter_t *df, uint16_t flags)
Dumps a string representation of a dfilter.
Definition dfvm.c:675
dfvm_value_t * dfvm_value_new_hfinfo(header_field_info *hfinfo, bool raw, bool val_str)
Create a new dfvm_value_t with header field information.
Definition dfvm.c:192
void dfvm_insn_free(dfvm_insn_t *insn)
Free a DFVM instruction.
Definition dfvm.c:156
dfvm_opcode_t
Opcodes for the Display Filter Virtual Machine (DFVM) instruction set.
Definition dfvm.h:77
@ DFVM_ANY_LT
Definition dfvm.h:99
@ DFVM_LENGTH
Definition dfvm.h:114
@ DFVM_READ_TREE
Definition dfvm.h:85
@ DFVM_ADD
Definition dfvm.h:117
@ DFVM_CALL_FUNCTION
Definition dfvm.h:122
@ DFVM_ALL_GE
Definition dfvm.h:96
@ DFVM_IF_TRUE_GOTO
Definition dfvm.h:79
@ DFVM_SUBTRACT
Definition dfvm.h:118
@ DFVM_READ_TREE_R
Definition dfvm.h:86
@ DFVM_ANY_CONTAINS
Definition dfvm.h:103
@ DFVM_ANY_EQ
Definition dfvm.h:91
@ DFVM_RETURN
Definition dfvm.h:84
@ DFVM_ALL_MATCHES
Definition dfvm.h:104
@ DFVM_CHECK_EXISTS_R
Definition dfvm.h:82
@ DFVM_NOT_ALL_ZERO
Definition dfvm.h:125
@ DFVM_STACK_POP
Definition dfvm.h:124
@ DFVM_ALL_GT
Definition dfvm.h:94
@ DFVM_SET_CLEAR
Definition dfvm.h:112
@ DFVM_ANY_GT
Definition dfvm.h:95
@ DFVM_SET_ANY_IN
Definition dfvm.h:107
@ DFVM_MODULO
Definition dfvm.h:121
@ DFVM_MULTIPLY
Definition dfvm.h:119
@ DFVM_SET_ALL_NOT_IN
Definition dfvm.h:108
@ DFVM_ANY_LE
Definition dfvm.h:101
@ DFVM_ALL_EQ
Definition dfvm.h:90
@ DFVM_ANY_MATCHES
Definition dfvm.h:105
@ DFVM_READ_REFERENCE_R
Definition dfvm.h:88
@ DFVM_NOT
Definition dfvm.h:83
@ DFVM_BITWISE_AND
Definition dfvm.h:115
@ DFVM_SET_ANY_NOT_IN
Definition dfvm.h:109
@ DFVM_ANY_NE
Definition dfvm.h:93
@ DFVM_ALL_LT
Definition dfvm.h:98
@ DFVM_SET_ADD
Definition dfvm.h:110
@ DFVM_READ_REFERENCE
Definition dfvm.h:87
@ DFVM_PUT_FVALUE
Definition dfvm.h:89
@ DFVM_SET_ALL_IN
Definition dfvm.h:106
@ DFVM_NULL
Definition dfvm.h:78
@ DFVM_ALL_LE
Definition dfvm.h:100
@ DFVM_STACK_PUSH
Definition dfvm.h:123
@ DFVM_SLICE
Definition dfvm.h:113
@ DFVM_SET_ADD_RANGE
Definition dfvm.h:111
@ DFVM_ANY_GE
Definition dfvm.h:97
@ DFVM_NO_OP
Definition dfvm.h:126
@ DFVM_UNARY_MINUS
Definition dfvm.h:116
@ DFVM_ALL_CONTAINS
Definition dfvm.h:102
@ DFVM_DIVIDE
Definition dfvm.h:120
@ DFVM_IF_FALSE_GOTO
Definition dfvm.h:80
@ DFVM_CHECK_EXISTS
Definition dfvm.h:81
@ DFVM_ALL_NE
Definition dfvm.h:92
dfvm_value_t * dfvm_value_new_fvalue(fvalue_t *fv)
Creates a new DFVM value of type FVALUE.
Definition dfvm.c:183
dfvm_value_t * dfvm_value_ref(dfvm_value_t *v)
Increment the reference count of a dfvm_value_t.
Definition dfvm.c:106
void dfvm_insn_replace_no_op(dfvm_insn_t *insn)
Replaces an instruction with a no-op.
Definition dfvm.c:138
dfvm_value_t * dfvm_value_new_register(int reg)
Creates a new dfvm_value_t representing a register.
Definition dfvm.c:207
dfvm_insn_t * dfvm_insn_new(dfvm_opcode_t op)
Creates a new DFVM instruction with the specified opcode.
Definition dfvm.c:125
const char * dfvm_opcode_tostr(dfvm_opcode_t code)
Converts a DFVM opcode to its string representation.
Definition dfvm.c:23
bool dfvm_apply_full(dfilter_t *df, proto_tree *tree, GPtrArray **fvals)
Apply a full Dissector Filter VM (DFVM) to a protocol tree.
Definition dfvm.c:1591
fvalue_t * dfvm_get_raw_fvalue(const field_info *fi)
Retrieves the raw value of a field as a GByteArray.
Definition dfvm.c:788
A display filter range composed of one or more drange_node slices.
Definition drange.h:51
Represents a typed field value used in protocol dissection.
Definition ftypes-int.h:22
Internal memory allocator interface used by the wmem subsystem.
Definition wmem_allocator.h:34
Defines a display filter function, holding its name, implementation, arity, and type information.
Definition dfunctions.h:40
Represents a single instruction in the display filter virtual machine (DFVM).
Definition dfvm.h:141
dfvm_value_t * arg3
Definition dfvm.h:146
int id
Definition dfvm.h:142
dfvm_opcode_t op
Definition dfvm.h:143
dfvm_value_t * arg2
Definition dfvm.h:145
dfvm_value_t * arg1
Definition dfvm.h:144
Represents a typed value used in display filter virtual machine (DFVM) operations.
Definition dfvm.h:51
drange_t * drange
Definition dfvm.h:57
ws_regex_t * pcre
Definition dfvm.h:60
uint32_t numeric
Definition dfvm.h:56
header_field_info * hfinfo
Definition dfvm.h:58
GPtrArray * fvalue_p
Definition dfvm.h:55
dfvm_value_type_t type
Definition dfvm.h:52
df_func_def_t * funcdef
Definition dfvm.h:59
int ref_count
Definition dfvm.h:63
The compiled display filter object passed back to the user.
Definition dfilter-int.h:46