2 * Copyright (C) 2019 Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
4 * SPDX-License-Identifier: LGPL-2.1-only
8 #ifndef LTTNG_CONDITION_ON_EVENT_INTERNAL_H
9 #define LTTNG_CONDITION_ON_EVENT_INTERNAL_H
11 #include <lttng/condition/condition-internal.h>
12 #include <common/buffer-view.h>
13 #include <common/macros.h>
14 #include <common/optional.h>
15 #include <lttng/condition/evaluation-internal.h>
16 #include <common/dynamic-array.h>
17 #include <lttng/event-field-value.h>
19 struct lttng_capture_descriptor
{
20 struct lttng_event_expr
*event_expression
;
21 struct lttng_bytecode
*bytecode
;
24 struct lttng_condition_on_event
{
25 struct lttng_condition parent
;
26 struct lttng_event_rule
*rule
;
28 LTTNG_OPTIONAL(uint64_t) error_count
;
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_on_event
{
40 struct lttng_evaluation parent
;
43 /* MessagePack-encoded captured event field values. */
44 struct lttng_dynamic_buffer capture_payload
;
47 * The content of this array event field value is the decoded
48 * version of `capture_payload` above.
50 * This is a cache: it's not serialized/deserialized in
51 * communications from/to the library and the session daemon.
53 struct lttng_event_field_value
*captured_values
;
56 struct lttng_evaluation_on_event_comm
{
57 /* Includes the null terminator. */
58 uint32_t trigger_name_length
;
64 ssize_t
lttng_condition_on_event_create_from_payload(
65 struct lttng_payload_view
*view
,
66 struct lttng_condition
**condition
);
69 enum lttng_condition_status
70 lttng_condition_on_event_borrow_rule_mutable(
71 const struct lttng_condition
*condition
,
72 struct lttng_event_rule
**rule
);
75 void lttng_condition_on_event_set_error_counter_index(
76 struct lttng_condition
*condition
, uint64_t error_counter_index
);
79 uint64_t lttng_condition_on_event_get_error_counter_index(
80 const struct lttng_condition
*condition
);
83 uint64_t lttng_condition_on_event_get_error_count(
84 const struct lttng_condition
*condition
);
87 void lttng_condition_on_event_set_error_count(struct lttng_condition
*condition
,
88 uint64_t error_count
);
91 struct lttng_evaluation
*lttng_evaluation_on_event_create(
92 const struct lttng_condition_on_event
*condition
,
93 const char* trigger_name
,
94 const char *capture_payload
, size_t capture_payload_size
,
95 bool decode_capture_payload
);
98 ssize_t
lttng_evaluation_on_event_create_from_payload(
99 const struct lttng_condition_on_event
*condition
,
100 struct lttng_payload_view
*view
,
101 struct lttng_evaluation
**_evaluation
);
104 enum lttng_error_code
105 lttng_condition_on_event_generate_capture_descriptor_bytecode(
106 struct lttng_condition
*condition
);
109 const struct lttng_bytecode
*
110 lttng_condition_on_event_get_capture_bytecode_at_index(
111 const struct lttng_condition
*condition
, unsigned int index
);
113 #endif /* LTTNG_CONDITION_ON_EVENT_INTERNAL_H */