MI: implement all objects related to trigger machine interface
[lttng-tools.git] / include / lttng / event-expr-internal.h
1 /*
2 * Copyright (C) 2020 Philippe Proulx <pproulx@efficios.com>
3 *
4 * SPDX-License-Identifier: LGPL-2.1-only
5 *
6 */
7
8 #ifndef LTTNG_EVENT_EXPR_INTERNAL_H
9 #define LTTNG_EVENT_EXPR_INTERNAL_H
10
11 #include <assert.h>
12 #include <common/macros.h>
13 #include <lttng/event-expr.h>
14
15 struct lttng_bytecode;
16 struct mi_writer;
17
18 struct lttng_event_expr {
19 enum lttng_event_expr_type type;
20 };
21
22 /*
23 * `LTTNG_EVENT_EXPR_TYPE_EVENT_PAYLOAD_FIELD` and
24 * `LTTNG_EVENT_EXPR_TYPE_CHANNEL_CONTEXT_FIELD`.
25 */
26 struct lttng_event_expr_field {
27 struct lttng_event_expr parent;
28 char *name;
29 };
30
31 /* `LTTNG_EVENT_EXPR_TYPE_APP_SPECIFIC_CONTEXT_FIELD` */
32 struct lttng_event_expr_app_specific_context_field {
33 struct lttng_event_expr parent;
34 char *provider_name;
35 char *type_name;
36 };
37
38 /* `LTTNG_EVENT_EXPR_TYPE_ARRAY_FIELD_ELEMENT` */
39 struct lttng_event_expr_array_field_element {
40 struct lttng_event_expr parent;
41
42 /* Owned by this */
43 struct lttng_event_expr *array_field_expr;
44
45 unsigned int index;
46 };
47
48 /*
49 * Returns whether or not `expr` is an l-value (locator value).
50 */
51 static inline
52 bool lttng_event_expr_is_lvalue(const struct lttng_event_expr *expr)
53 {
54 assert(expr);
55 return expr->type == LTTNG_EVENT_EXPR_TYPE_EVENT_PAYLOAD_FIELD ||
56 expr->type == LTTNG_EVENT_EXPR_TYPE_CHANNEL_CONTEXT_FIELD ||
57 expr->type == LTTNG_EVENT_EXPR_TYPE_APP_SPECIFIC_CONTEXT_FIELD ||
58 expr->type == LTTNG_EVENT_EXPR_TYPE_ARRAY_FIELD_ELEMENT;
59 }
60
61 LTTNG_HIDDEN
62 int lttng_event_expr_to_bytecode(const struct lttng_event_expr *expr,
63 struct lttng_bytecode **bytecode_out);
64
65 LTTNG_HIDDEN
66 enum lttng_error_code lttng_event_expr_mi_serialize(
67 const struct lttng_event_expr *expression,
68 struct mi_writer *writer);
69
70 #endif /* LTTNG_EVENT_EXPR_INTERNAL_H */
This page took 0.030927 seconds and 5 git commands to generate.