Commit | Line | Data |
---|---|---|
683d081a JR |
1 | /* |
2 | * Copyright (C) 2019 Jonathan Rajotte <jonathan.rajotte-julien@efficios.com> | |
3 | * | |
4 | * SPDX-License-Identifier: LGPL-2.1-only | |
5 | * | |
6 | */ | |
7 | ||
d602bd6a JR |
8 | #ifndef LTTNG_CONDITION_ON_EVENT_INTERNAL_H |
9 | #define LTTNG_CONDITION_ON_EVENT_INTERNAL_H | |
683d081a JR |
10 | |
11 | #include <lttng/condition/condition-internal.h> | |
12 | #include <common/buffer-view.h> | |
13 | #include <common/macros.h> | |
35a9ac41 | 14 | #include <common/optional.h> |
683d081a | 15 | #include <lttng/condition/evaluation-internal.h> |
38114013 | 16 | #include <common/dynamic-array.h> |
7c920b63 | 17 | #include <lttng/event-field-value.h> |
683d081a | 18 | |
0912b5ea JR |
19 | struct lttng_capture_descriptor { |
20 | struct lttng_event_expr *event_expression; | |
21 | struct lttng_bytecode *bytecode; | |
22 | }; | |
23 | ||
d602bd6a | 24 | struct lttng_condition_on_event { |
683d081a JR |
25 | struct lttng_condition parent; |
26 | struct lttng_event_rule *rule; | |
683d081a | 27 | |
35a9ac41 FD |
28 | LTTNG_OPTIONAL(uint64_t) error_count; |
29 | /* | |
30 | * Internal use only. | |
31 | * Error accounting counter index. | |
32 | */ | |
33 | LTTNG_OPTIONAL(uint64_t) error_counter_index; | |
34 | ||
0912b5ea | 35 | /* Array of `struct lttng_capture_descriptor *`. */ |
38114013 PP |
36 | struct lttng_dynamic_pointer_array capture_descriptors; |
37 | }; | |
683d081a | 38 | |
d602bd6a | 39 | struct lttng_evaluation_on_event { |
683d081a | 40 | struct lttng_evaluation parent; |
7c920b63 PP |
41 | |
42 | /* MessagePack-encoded captured event field values. */ | |
43 | struct lttng_dynamic_buffer capture_payload; | |
44 | ||
45 | /* | |
46 | * The content of this array event field value is the decoded | |
47 | * version of `capture_payload` above. | |
48 | * | |
49 | * This is a cache: it's not serialized/deserialized in | |
50 | * communications from/to the library and the session daemon. | |
51 | */ | |
52 | struct lttng_event_field_value *captured_values; | |
683d081a JR |
53 | }; |
54 | ||
683d081a | 55 | LTTNG_HIDDEN |
d602bd6a | 56 | ssize_t lttng_condition_on_event_create_from_payload( |
683d081a JR |
57 | struct lttng_payload_view *view, |
58 | struct lttng_condition **condition); | |
59 | ||
60 | LTTNG_HIDDEN | |
61 | enum lttng_condition_status | |
d602bd6a | 62 | lttng_condition_on_event_borrow_rule_mutable( |
683d081a JR |
63 | const struct lttng_condition *condition, |
64 | struct lttng_event_rule **rule); | |
65 | ||
35a9ac41 FD |
66 | LTTNG_HIDDEN |
67 | void lttng_condition_on_event_set_error_counter_index( | |
68 | struct lttng_condition *condition, uint64_t error_counter_index); | |
69 | ||
70 | LTTNG_HIDDEN | |
71 | uint64_t lttng_condition_on_event_get_error_counter_index( | |
72 | const struct lttng_condition *condition); | |
73 | ||
74 | LTTNG_HIDDEN | |
75 | uint64_t lttng_condition_on_event_get_error_count( | |
76 | const struct lttng_condition *condition); | |
77 | ||
78 | LTTNG_HIDDEN | |
79 | void lttng_condition_on_event_set_error_count(struct lttng_condition *condition, | |
80 | uint64_t error_count); | |
81 | ||
683d081a | 82 | LTTNG_HIDDEN |
d602bd6a JR |
83 | struct lttng_evaluation *lttng_evaluation_on_event_create( |
84 | const struct lttng_condition_on_event *condition, | |
7c920b63 PP |
85 | const char *capture_payload, size_t capture_payload_size, |
86 | bool decode_capture_payload); | |
683d081a JR |
87 | |
88 | LTTNG_HIDDEN | |
d602bd6a JR |
89 | ssize_t lttng_evaluation_on_event_create_from_payload( |
90 | const struct lttng_condition_on_event *condition, | |
683d081a JR |
91 | struct lttng_payload_view *view, |
92 | struct lttng_evaluation **_evaluation); | |
93 | ||
834966af JR |
94 | LTTNG_HIDDEN |
95 | enum lttng_error_code | |
d602bd6a | 96 | lttng_condition_on_event_generate_capture_descriptor_bytecode( |
834966af JR |
97 | struct lttng_condition *condition); |
98 | ||
51dbe985 JR |
99 | LTTNG_HIDDEN |
100 | const struct lttng_bytecode * | |
d602bd6a | 101 | lttng_condition_on_event_get_capture_bytecode_at_index( |
51dbe985 JR |
102 | const struct lttng_condition *condition, unsigned int index); |
103 | ||
d602bd6a | 104 | #endif /* LTTNG_CONDITION_ON_EVENT_INTERNAL_H */ |