Commit | Line | Data |
---|---|---|
48c47564 PP |
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 <lttng/event-expr.h> | |
13 | ||
14 | struct lttng_event_expr { | |
15 | enum lttng_event_expr_type type; | |
16 | }; | |
17 | ||
18 | /* | |
19 | * `LTTNG_EVENT_EXPR_TYPE_EVENT_PAYLOAD_FIELD` and | |
20 | * `LTTNG_EVENT_EXPR_TYPE_CHANNEL_CONTEXT_FIELD`. | |
21 | */ | |
22 | struct lttng_event_expr_field { | |
23 | struct lttng_event_expr parent; | |
24 | char *name; | |
25 | }; | |
26 | ||
27 | /* `LTTNG_EVENT_EXPR_TYPE_APP_SPECIFIC_CONTEXT_FIELD` */ | |
28 | struct lttng_event_expr_app_specific_context_field { | |
29 | struct lttng_event_expr parent; | |
30 | char *provider_name; | |
31 | char *type_name; | |
32 | }; | |
33 | ||
34 | /* `LTTNG_EVENT_EXPR_TYPE_ARRAY_FIELD_ELEMENT` */ | |
35 | struct lttng_event_expr_array_field_element { | |
36 | struct lttng_event_expr parent; | |
37 | ||
38 | /* Owned by this */ | |
39 | struct lttng_event_expr *array_field_expr; | |
40 | ||
41 | unsigned int index; | |
42 | }; | |
43 | ||
44 | /* | |
45 | * Returns whether or not `expr` is an l-value (locator value). | |
46 | */ | |
47 | static inline | |
48 | bool lttng_event_expr_is_lvalue(const struct lttng_event_expr *expr) | |
49 | { | |
50 | assert(expr); | |
51 | return expr->type == LTTNG_EVENT_EXPR_TYPE_EVENT_PAYLOAD_FIELD || | |
52 | expr->type == LTTNG_EVENT_EXPR_TYPE_CHANNEL_CONTEXT_FIELD || | |
53 | expr->type == LTTNG_EVENT_EXPR_TYPE_APP_SPECIFIC_CONTEXT_FIELD || | |
54 | expr->type == LTTNG_EVENT_EXPR_TYPE_ARRAY_FIELD_ELEMENT; | |
55 | } | |
56 | ||
57 | #endif /* LTTNG_EVENT_EXPR_INTERNAL_H */ |