-#ifndef _FILTER_BYTECODE_H
-#define _FILTER_BYTECODE_H
-
-/*
+/* SPDX-License-Identifier: MIT
+ *
* filter-bytecode.h
*
* LTTng filter bytecode
*
* Copyright 2012-2016 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
*/
+#ifndef _FILTER_BYTECODE_H
+#define _FILTER_BYTECODE_H
+
/*
* offsets are absolute from start of bytecode.
*/
uint16_t offset;
} __attribute__((packed));
+struct get_symbol {
+ /* Symbol offset. */
+ uint16_t offset;
+} __attribute__((packed));
+
+struct get_index_u16 {
+ uint16_t index;
+} __attribute__((packed));
+
+struct get_index_u64 {
+ uint64_t index;
+} __attribute__((packed));
+
struct literal_numeric {
int64_t v;
} __attribute__((packed));
double v;
} __attribute__((packed));
-struct literal_string {
- char string[0];
-} __attribute__((packed));
-
enum filter_op {
FILTER_OP_UNKNOWN = 0,
FILTER_OP_MOD = 4,
FILTER_OP_PLUS = 5,
FILTER_OP_MINUS = 6,
- FILTER_OP_RSHIFT = 7,
- FILTER_OP_LSHIFT = 8,
- FILTER_OP_BIN_AND = 9,
- FILTER_OP_BIN_OR = 10,
- FILTER_OP_BIN_XOR = 11,
+ FILTER_OP_BIT_RSHIFT = 7,
+ FILTER_OP_BIT_LSHIFT = 8,
+ FILTER_OP_BIT_AND = 9,
+ FILTER_OP_BIT_OR = 10,
+ FILTER_OP_BIT_XOR = 11,
/* binary comparators */
FILTER_OP_EQ = 12,
FILTER_OP_EQ_STAR_GLOB_STRING = 77,
FILTER_OP_NE_STAR_GLOB_STRING = 78,
+ /*
+ * Instructions for recursive traversal through composed types.
+ */
+ FILTER_OP_GET_CONTEXT_ROOT = 79,
+ FILTER_OP_GET_APP_CONTEXT_ROOT = 80,
+ FILTER_OP_GET_PAYLOAD_ROOT = 81,
+
+ FILTER_OP_GET_SYMBOL = 82,
+ FILTER_OP_GET_SYMBOL_FIELD = 83,
+ FILTER_OP_GET_INDEX_U16 = 84,
+ FILTER_OP_GET_INDEX_U64 = 85,
+
+ FILTER_OP_LOAD_FIELD = 86,
+ FILTER_OP_LOAD_FIELD_S8 = 87,
+ FILTER_OP_LOAD_FIELD_S16 = 88,
+ FILTER_OP_LOAD_FIELD_S32 = 89,
+ FILTER_OP_LOAD_FIELD_S64 = 90,
+ FILTER_OP_LOAD_FIELD_U8 = 91,
+ FILTER_OP_LOAD_FIELD_U16 = 92,
+ FILTER_OP_LOAD_FIELD_U32 = 93,
+ FILTER_OP_LOAD_FIELD_U64 = 94,
+ FILTER_OP_LOAD_FIELD_STRING = 95,
+ FILTER_OP_LOAD_FIELD_SEQUENCE = 96,
+ FILTER_OP_LOAD_FIELD_DOUBLE = 97,
+
+ FILTER_OP_UNARY_BIT_NOT = 98,
+
+ FILTER_OP_RETURN_S64 = 99,
+
NR_FILTER_OPS,
};
struct load_op {
filter_opcode_t op;
- char data[0];
+ char data[];
/* data to load. Size known by enum filter_opcode and null-term char. */
} __attribute__((packed));