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 | 10 | |
c9e313bc | 11 | #include <common/buffer-view.hpp> |
28f23191 | 12 | #include <common/dynamic-array.hpp> |
c9e313bc SM |
13 | #include <common/macros.hpp> |
14 | #include <common/optional.hpp> | |
28f23191 JG |
15 | |
16 | #include <lttng/condition/condition-internal.hpp> | |
c9e313bc | 17 | #include <lttng/condition/evaluation-internal.hpp> |
7c920b63 | 18 | #include <lttng/event-field-value.h> |
683d081a | 19 | |
0912b5ea JR |
20 | struct lttng_capture_descriptor { |
21 | struct lttng_event_expr *event_expression; | |
22 | struct lttng_bytecode *bytecode; | |
23 | }; | |
24 | ||
8dbb86b8 | 25 | struct lttng_condition_event_rule_matches { |
683d081a JR |
26 | struct lttng_condition parent; |
27 | struct lttng_event_rule *rule; | |
683d081a | 28 | |
35a9ac41 FD |
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 | |
8dbb86b8 | 39 | struct lttng_evaluation_event_rule_matches { |
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 | ||
28f23191 JG |
55 | ssize_t lttng_condition_event_rule_matches_create_from_payload(struct lttng_payload_view *view, |
56 | struct lttng_condition **condition); | |
683d081a | 57 | |
683d081a | 58 | enum lttng_condition_status |
28f23191 JG |
59 | lttng_condition_event_rule_matches_borrow_rule_mutable(const struct lttng_condition *condition, |
60 | struct lttng_event_rule **rule); | |
683d081a | 61 | |
28f23191 JG |
62 | void lttng_condition_event_rule_matches_set_error_counter_index(struct lttng_condition *condition, |
63 | uint64_t error_counter_index); | |
35a9ac41 | 64 | |
28f23191 JG |
65 | uint64_t |
66 | lttng_condition_event_rule_matches_get_error_counter_index(const struct lttng_condition *condition); | |
35a9ac41 | 67 | |
8dbb86b8 | 68 | struct lttng_evaluation *lttng_evaluation_event_rule_matches_create( |
28f23191 JG |
69 | const struct lttng_condition_event_rule_matches *condition, |
70 | const char *capture_payload, | |
71 | size_t capture_payload_size, | |
72 | bool decode_capture_payload); | |
683d081a | 73 | |
8dbb86b8 | 74 | ssize_t lttng_evaluation_event_rule_matches_create_from_payload( |
28f23191 JG |
75 | const struct lttng_condition_event_rule_matches *condition, |
76 | struct lttng_payload_view *view, | |
77 | struct lttng_evaluation **_evaluation); | |
683d081a | 78 | |
28f23191 JG |
79 | enum lttng_error_code lttng_condition_event_rule_matches_generate_capture_descriptor_bytecode( |
80 | struct lttng_condition *condition); | |
834966af | 81 | |
28f23191 JG |
82 | const struct lttng_bytecode *lttng_condition_event_rule_matches_get_capture_bytecode_at_index( |
83 | const struct lttng_condition *condition, unsigned int index); | |
51dbe985 | 84 | |
8dbb86b8 | 85 | #endif /* LTTNG_CONDITION_EVENT_RULE_MATCHES_INTERNAL_H */ |