2 * Copyright (C) 2019 Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
4 * SPDX-License-Identifier: LGPL-2.1-only
8 #ifndef LTTNG_CONDITION_EVENT_RULE_MATCHES_INTERNAL_H
9 #define LTTNG_CONDITION_EVENT_RULE_MATCHES_INTERNAL_H
11 #include <common/buffer-view.hpp>
12 #include <common/dynamic-array.hpp>
13 #include <common/macros.hpp>
14 #include <common/optional.hpp>
16 #include <lttng/condition/condition-internal.hpp>
17 #include <lttng/condition/evaluation-internal.hpp>
18 #include <lttng/event-field-value.h>
20 struct lttng_capture_descriptor {
21 struct lttng_event_expr *event_expression;
22 struct lttng_bytecode *bytecode;
25 struct lttng_condition_event_rule_matches {
26 struct lttng_condition parent;
27 struct lttng_event_rule *rule;
31 * Error accounting counter index.
33 LTTNG_OPTIONAL(uint64_t) error_counter_index;
35 /* Array of `struct lttng_capture_descriptor *`. */
36 struct lttng_dynamic_pointer_array capture_descriptors;
39 struct lttng_evaluation_event_rule_matches {
40 struct lttng_evaluation parent;
42 /* MessagePack-encoded captured event field values. */
43 struct lttng_dynamic_buffer capture_payload;
46 * The content of this array event field value is the decoded
47 * version of `capture_payload` above.
49 * This is a cache: it's not serialized/deserialized in
50 * communications from/to the library and the session daemon.
52 struct lttng_event_field_value *captured_values;
55 ssize_t lttng_condition_event_rule_matches_create_from_payload(struct lttng_payload_view *view,
56 struct lttng_condition **condition);
58 enum lttng_condition_status
59 lttng_condition_event_rule_matches_borrow_rule_mutable(const struct lttng_condition *condition,
60 struct lttng_event_rule **rule);
62 void lttng_condition_event_rule_matches_set_error_counter_index(struct lttng_condition *condition,
63 uint64_t error_counter_index);
66 lttng_condition_event_rule_matches_get_error_counter_index(const struct lttng_condition *condition);
68 struct lttng_evaluation *lttng_evaluation_event_rule_matches_create(
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);
74 ssize_t lttng_evaluation_event_rule_matches_create_from_payload(
75 const struct lttng_condition_event_rule_matches *condition,
76 struct lttng_payload_view *view,
77 struct lttng_evaluation **_evaluation);
79 enum lttng_error_code lttng_condition_event_rule_matches_generate_capture_descriptor_bytecode(
80 struct lttng_condition *condition);
82 const struct lttng_bytecode *lttng_condition_event_rule_matches_get_capture_bytecode_at_index(
83 const struct lttng_condition *condition, unsigned int index);
85 #endif /* LTTNG_CONDITION_EVENT_RULE_MATCHES_INTERNAL_H */