1 #ifndef _FILTER_BYTECODE_H
2 #define _FILTER_BYTECODE_H
7 * LTTng filter bytecode
9 * Copyright 2012 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 * This library is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU Lesser General Public License, version 2.1 only,
13 * as published by the Free Software Foundation.
15 * This library is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Lesser General Public License for more details.
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with this library; if not, write to the Free Software Foundation,
22 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
25 #include "filter-ast.h"
26 #include "../../common/sessiond-comm/sessiond-comm.h"
29 * offsets are absolute from start of bytecode.
32 enum filter_register
{
39 /* Initially, symbol offset. After link, field offset. */
41 } __attribute__((packed
));
43 struct literal_numeric
{
45 } __attribute__((packed
));
47 struct literal_double
{
49 } __attribute__((packed
));
51 struct literal_string
{
53 } __attribute__((packed
));
56 FILTER_OP_UNKNOWN
= 0,
72 /* binary comparators */
80 /* string binary comparator */
88 /* s64 binary comparator */
96 /* double binary comparator */
105 FILTER_OP_UNARY_PLUS
,
106 FILTER_OP_UNARY_MINUS
,
108 FILTER_OP_UNARY_PLUS_S64
,
109 FILTER_OP_UNARY_MINUS_S64
,
110 FILTER_OP_UNARY_NOT_S64
,
111 FILTER_OP_UNARY_PLUS_DOUBLE
,
112 FILTER_OP_UNARY_MINUS_DOUBLE
,
113 FILTER_OP_UNARY_NOT_DOUBLE
,
120 FILTER_OP_LOAD_FIELD_REF
,
121 FILTER_OP_LOAD_FIELD_REF_STRING
,
122 FILTER_OP_LOAD_FIELD_REF_SEQUENCE
,
123 FILTER_OP_LOAD_FIELD_REF_S64
,
124 FILTER_OP_LOAD_FIELD_REF_DOUBLE
,
126 FILTER_OP_LOAD_STRING
,
128 FILTER_OP_LOAD_DOUBLE
,
133 typedef uint8_t filter_opcode_t
;
137 uint8_t reg
; /* enum filter_register */
139 /* data to load. Size known by enum filter_opcode and null-term char. */
140 } __attribute__((packed
));
144 } __attribute__((packed
));
148 uint8_t reg
; /* enum filter_register */
149 } __attribute__((packed
));
151 /* skip_offset is absolute from start of bytecode */
154 uint16_t skip_offset
; /* bytecode insn, if skip second test */
155 } __attribute__((packed
));
159 } __attribute__((packed
));
161 struct lttng_filter_bytecode_alloc
{
163 struct lttng_filter_bytecode b
;
167 unsigned int bytecode_get_len(struct lttng_filter_bytecode
*bytecode
)
169 return bytecode
->len
;
172 #endif /* _FILTER_BYTECODE_H */