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> | |
14 | #include <lttng/condition/evaluation-internal.h> | |
38114013 | 15 | #include <common/dynamic-array.h> |
7c920b63 | 16 | #include <lttng/event-field-value.h> |
683d081a | 17 | |
0912b5ea JR |
18 | struct lttng_capture_descriptor { |
19 | struct lttng_event_expr *event_expression; | |
20 | struct lttng_bytecode *bytecode; | |
21 | }; | |
22 | ||
d602bd6a | 23 | struct lttng_condition_on_event { |
683d081a JR |
24 | struct lttng_condition parent; |
25 | struct lttng_event_rule *rule; | |
683d081a | 26 | |
0912b5ea | 27 | /* Array of `struct lttng_capture_descriptor *`. */ |
38114013 PP |
28 | struct lttng_dynamic_pointer_array capture_descriptors; |
29 | }; | |
683d081a | 30 | |
d602bd6a | 31 | struct lttng_evaluation_on_event { |
683d081a JR |
32 | struct lttng_evaluation parent; |
33 | char *name; | |
7c920b63 PP |
34 | |
35 | /* MessagePack-encoded captured event field values. */ | |
36 | struct lttng_dynamic_buffer capture_payload; | |
37 | ||
38 | /* | |
39 | * The content of this array event field value is the decoded | |
40 | * version of `capture_payload` above. | |
41 | * | |
42 | * This is a cache: it's not serialized/deserialized in | |
43 | * communications from/to the library and the session daemon. | |
44 | */ | |
45 | struct lttng_event_field_value *captured_values; | |
683d081a JR |
46 | }; |
47 | ||
d602bd6a | 48 | struct lttng_evaluation_on_event_comm { |
683d081a JR |
49 | /* Includes the null terminator. */ |
50 | uint32_t trigger_name_length; | |
51 | /* Trigger name. */ | |
52 | char payload[]; | |
53 | } LTTNG_PACKED; | |
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 | ||
66 | LTTNG_HIDDEN | |
d602bd6a JR |
67 | struct lttng_evaluation *lttng_evaluation_on_event_create( |
68 | const struct lttng_condition_on_event *condition, | |
7c920b63 PP |
69 | const char* trigger_name, |
70 | const char *capture_payload, size_t capture_payload_size, | |
71 | bool decode_capture_payload); | |
683d081a JR |
72 | |
73 | LTTNG_HIDDEN | |
d602bd6a JR |
74 | ssize_t lttng_evaluation_on_event_create_from_payload( |
75 | const struct lttng_condition_on_event *condition, | |
683d081a JR |
76 | struct lttng_payload_view *view, |
77 | struct lttng_evaluation **_evaluation); | |
78 | ||
834966af JR |
79 | LTTNG_HIDDEN |
80 | enum lttng_error_code | |
d602bd6a | 81 | lttng_condition_on_event_generate_capture_descriptor_bytecode( |
834966af JR |
82 | struct lttng_condition *condition); |
83 | ||
51dbe985 JR |
84 | LTTNG_HIDDEN |
85 | const struct lttng_bytecode * | |
d602bd6a | 86 | lttng_condition_on_event_get_capture_bytecode_at_index( |
51dbe985 JR |
87 | const struct lttng_condition *condition, unsigned int index); |
88 | ||
d602bd6a | 89 | #endif /* LTTNG_CONDITION_ON_EVENT_INTERNAL_H */ |