common: compile libcompat as C++
[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 <common/macros.h>
12 #include <lttng/event-expr.h>
13
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17
18 struct lttng_bytecode;
19 struct mi_writer;
20
21 struct lttng_event_expr {
22 enum lttng_event_expr_type type;
23 };
24
25 /*
26 * `LTTNG_EVENT_EXPR_TYPE_EVENT_PAYLOAD_FIELD` and
27 * `LTTNG_EVENT_EXPR_TYPE_CHANNEL_CONTEXT_FIELD`.
28 */
29 struct lttng_event_expr_field {
30 struct lttng_event_expr parent;
31 char *name;
32 };
33
34 /* `LTTNG_EVENT_EXPR_TYPE_APP_SPECIFIC_CONTEXT_FIELD` */
35 struct lttng_event_expr_app_specific_context_field {
36 struct lttng_event_expr parent;
37 char *provider_name;
38 char *type_name;
39 };
40
41 /* `LTTNG_EVENT_EXPR_TYPE_ARRAY_FIELD_ELEMENT` */
42 struct lttng_event_expr_array_field_element {
43 struct lttng_event_expr parent;
44
45 /* Owned by this */
46 struct lttng_event_expr *array_field_expr;
47
48 unsigned int index;
49 };
50
51 /*
52 * Returns whether or not `expr` is an l-value (locator value).
53 */
54 static inline
55 bool lttng_event_expr_is_lvalue(const struct lttng_event_expr *expr)
56 {
57 LTTNG_ASSERT(expr);
58 return expr->type == LTTNG_EVENT_EXPR_TYPE_EVENT_PAYLOAD_FIELD ||
59 expr->type == LTTNG_EVENT_EXPR_TYPE_CHANNEL_CONTEXT_FIELD ||
60 expr->type == LTTNG_EVENT_EXPR_TYPE_APP_SPECIFIC_CONTEXT_FIELD ||
61 expr->type == LTTNG_EVENT_EXPR_TYPE_ARRAY_FIELD_ELEMENT;
62 }
63
64 int lttng_event_expr_to_bytecode(const struct lttng_event_expr *expr,
65 struct lttng_bytecode **bytecode_out);
66
67 enum lttng_error_code lttng_event_expr_mi_serialize(
68 const struct lttng_event_expr *expression,
69 struct mi_writer *writer);
70
71 #ifdef __cplusplus
72 }
73 #endif
74
75 #endif /* LTTNG_EVENT_EXPR_INTERNAL_H */
This page took 0.031179 seconds and 4 git commands to generate.