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 FIELD_REF_UNKNOWN
= 0,
47 /* Initially, symbol offset. After link, field offset. */
49 uint8_t type
; /* enum field_ref_type */
50 } __attribute__((packed
));
52 struct literal_numeric
{
54 } __attribute__((packed
));
56 struct literal_double
{
58 } __attribute__((packed
));
60 struct literal_string
{
62 } __attribute__((packed
));
65 FILTER_OP_UNKNOWN
= 0,
89 FILTER_OP_UNARY_MINUS
,
97 FILTER_OP_LOAD_FIELD_REF
,
98 FILTER_OP_LOAD_STRING
,
100 FILTER_OP_LOAD_DOUBLE
,
105 typedef uint8_t filter_opcode_t
;
109 uint8_t reg
; /* enum filter_register */
111 /* data to load. Size known by enum filter_opcode and null-term char. */
112 } __attribute__((packed
));
116 } __attribute__((packed
));
120 uint8_t reg
; /* enum filter_register */
121 } __attribute__((packed
));
123 /* skip_offset is absolute from start of bytecode */
126 uint16_t skip_offset
; /* bytecode insn, if skip second test */
127 } __attribute__((packed
));
131 } __attribute__((packed
));
133 struct lttng_filter_bytecode_alloc
{
135 struct lttng_filter_bytecode b
;
139 unsigned int bytecode_get_len(struct lttng_filter_bytecode
*bytecode
)
141 return bytecode
->len
;
144 #endif /* _FILTER_BYTECODE_H */