Fix: lttng: uninitialized pointer free'd when no sessiond is present
[lttng-tools.git] / src / lib / lttng-ctl / filter / filter-ir.h
CommitLineData
953192ba
MD
1#ifndef _FILTER_IR_H
2#define _FILTER_IR_H
3
4/*
5 * filter-ir.h
6 *
7 * LTTng filter ir
8 *
ab5be9fa 9 * Copyright 2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
953192ba 10 *
ab5be9fa 11 * SPDX-License-Identifier: LGPL-2.1-only
953192ba 12 *
953192ba
MD
13 */
14
15#include "filter-ast.h"
16
17enum ir_op_signedness {
18 IR_SIGN_UNKNOWN = 0,
19 IR_SIGNED,
20 IR_UNSIGNED,
21 IR_SIGN_DYN, /* signedness determined dynamically */
22};
23
24enum ir_data_type {
25 IR_DATA_UNKNOWN = 0,
26 IR_DATA_STRING,
27 IR_DATA_NUMERIC, /* numeric and boolean */
e90d8561 28 IR_DATA_FLOAT,
953192ba 29 IR_DATA_FIELD_REF,
586dc72f 30 IR_DATA_GET_CONTEXT_REF,
bff988fa 31 IR_DATA_EXPRESSION,
953192ba
MD
32};
33
34enum ir_op_type {
35 IR_OP_UNKNOWN = 0,
36 IR_OP_ROOT,
37 IR_OP_LOAD,
38 IR_OP_UNARY,
39 IR_OP_BINARY,
40 IR_OP_LOGICAL,
41};
42
43/* left or right child */
44enum ir_side {
45 IR_SIDE_UNKNOWN = 0,
46 IR_LEFT,
47 IR_RIGHT,
48};
49
9f449915
PP
50enum ir_load_string_type {
51 /* Plain, no globbing at all: `hello world`. */
52 IR_LOAD_STRING_TYPE_PLAIN = 0,
53
54 /* Star at the end only: `hello *`. */
55 IR_LOAD_STRING_TYPE_GLOB_STAR_END,
56
57 /* At least one star, anywhere, but not at the end only: `he*wor*`. */
58 IR_LOAD_STRING_TYPE_GLOB_STAR,
59};
60
953192ba
MD
61struct ir_op_root {
62 struct ir_op *child;
63};
64
bff988fa
MD
65enum ir_load_expression_type {
66 IR_LOAD_EXPRESSION_GET_CONTEXT_ROOT,
67 IR_LOAD_EXPRESSION_GET_APP_CONTEXT_ROOT,
68 IR_LOAD_EXPRESSION_GET_PAYLOAD_ROOT,
69 IR_LOAD_EXPRESSION_GET_SYMBOL,
70 IR_LOAD_EXPRESSION_GET_INDEX,
71 IR_LOAD_EXPRESSION_LOAD_FIELD,
72};
73
74struct ir_load_expression_op {
75 struct ir_load_expression_op *next;
76 enum ir_load_expression_type type;
77 union {
78 char *symbol;
79 uint64_t index;
80 } u;
81};
82
83struct ir_load_expression {
84 struct ir_load_expression_op *child;
85};
86
953192ba
MD
87struct ir_op_load {
88 union {
9f449915
PP
89 struct {
90 enum ir_load_string_type type;
91 char *value;
92 } string;
953192ba 93 int64_t num;
e90d8561 94 double flt;
953192ba 95 char *ref;
bff988fa 96 struct ir_load_expression *expression;
953192ba
MD
97 } u;
98};
99
100struct ir_op_unary {
101 enum unary_op_type type;
102 struct ir_op *child;
103};
104
105struct ir_op_binary {
106 enum op_type type;
107 struct ir_op *left;
108 struct ir_op *right;
109};
110
111struct ir_op_logical {
112 enum op_type type;
113 struct ir_op *left;
114 struct ir_op *right;
115};
116
117struct ir_op {
118 /* common to all ops */
119 enum ir_op_type op;
120 enum ir_data_type data_type;
121 enum ir_op_signedness signedness;
122 enum ir_side side;
123
124 union {
125 struct ir_op_root root;
126 struct ir_op_load load;
127 struct ir_op_unary unary;
128 struct ir_op_binary binary;
129 struct ir_op_logical logical;
130 } u;
131};
132
133#endif /* _FILTER_IR_H */
This page took 0.067679 seconds and 5 git commands to generate.