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 | ||
8dbb86b8 JR |
8 | #ifndef LTTNG_CONDITION_EVENT_RULE_MATCHES_INTERNAL_H |
9 | #define LTTNG_CONDITION_EVENT_RULE_MATCHES_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 | |
7966af57 SM |
19 | #ifdef __cplusplus |
20 | extern "C" { | |
21 | #endif | |
22 | ||
0912b5ea JR |
23 | struct lttng_capture_descriptor { |
24 | struct lttng_event_expr *event_expression; | |
25 | struct lttng_bytecode *bytecode; | |
26 | }; | |
27 | ||
8dbb86b8 | 28 | struct lttng_condition_event_rule_matches { |
683d081a JR |
29 | struct lttng_condition parent; |
30 | struct lttng_event_rule *rule; | |
683d081a | 31 | |
35a9ac41 FD |
32 | /* |
33 | * Internal use only. | |
34 | * Error accounting counter index. | |
35 | */ | |
36 | LTTNG_OPTIONAL(uint64_t) error_counter_index; | |
37 | ||
0912b5ea | 38 | /* Array of `struct lttng_capture_descriptor *`. */ |
38114013 PP |
39 | struct lttng_dynamic_pointer_array capture_descriptors; |
40 | }; | |
683d081a | 41 | |
8dbb86b8 | 42 | struct lttng_evaluation_event_rule_matches { |
683d081a | 43 | struct lttng_evaluation parent; |
7c920b63 PP |
44 | |
45 | /* MessagePack-encoded captured event field values. */ | |
46 | struct lttng_dynamic_buffer capture_payload; | |
47 | ||
48 | /* | |
49 | * The content of this array event field value is the decoded | |
50 | * version of `capture_payload` above. | |
51 | * | |
52 | * This is a cache: it's not serialized/deserialized in | |
53 | * communications from/to the library and the session daemon. | |
54 | */ | |
55 | struct lttng_event_field_value *captured_values; | |
683d081a JR |
56 | }; |
57 | ||
8dbb86b8 | 58 | ssize_t lttng_condition_event_rule_matches_create_from_payload( |
683d081a JR |
59 | struct lttng_payload_view *view, |
60 | struct lttng_condition **condition); | |
61 | ||
683d081a | 62 | enum lttng_condition_status |
8dbb86b8 | 63 | lttng_condition_event_rule_matches_borrow_rule_mutable( |
683d081a JR |
64 | const struct lttng_condition *condition, |
65 | struct lttng_event_rule **rule); | |
66 | ||
8dbb86b8 JR |
67 | void lttng_condition_event_rule_matches_set_error_counter_index( |
68 | struct lttng_condition *condition, | |
69 | uint64_t error_counter_index); | |
35a9ac41 | 70 | |
8dbb86b8 | 71 | uint64_t lttng_condition_event_rule_matches_get_error_counter_index( |
35a9ac41 FD |
72 | const struct lttng_condition *condition); |
73 | ||
8dbb86b8 JR |
74 | struct lttng_evaluation *lttng_evaluation_event_rule_matches_create( |
75 | const struct lttng_condition_event_rule_matches *condition, | |
76 | const char *capture_payload, | |
77 | size_t capture_payload_size, | |
7c920b63 | 78 | bool decode_capture_payload); |
683d081a | 79 | |
8dbb86b8 JR |
80 | ssize_t lttng_evaluation_event_rule_matches_create_from_payload( |
81 | const struct lttng_condition_event_rule_matches *condition, | |
683d081a JR |
82 | struct lttng_payload_view *view, |
83 | struct lttng_evaluation **_evaluation); | |
84 | ||
834966af | 85 | enum lttng_error_code |
8dbb86b8 | 86 | lttng_condition_event_rule_matches_generate_capture_descriptor_bytecode( |
834966af JR |
87 | struct lttng_condition *condition); |
88 | ||
51dbe985 | 89 | const struct lttng_bytecode * |
8dbb86b8 | 90 | lttng_condition_event_rule_matches_get_capture_bytecode_at_index( |
51dbe985 JR |
91 | const struct lttng_condition *condition, unsigned int index); |
92 | ||
7966af57 SM |
93 | #ifdef __cplusplus |
94 | } | |
95 | #endif | |
96 | ||
8dbb86b8 | 97 | #endif /* LTTNG_CONDITION_EVENT_RULE_MATCHES_INTERNAL_H */ |