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
;
30 * Error accounting counter index.
32 LTTNG_OPTIONAL(uint64_t) error_counter_index
;
34 /* Array of `struct lttng_capture_descriptor *`. */
35 struct lttng_dynamic_pointer_array capture_descriptors
;
38 struct lttng_evaluation_on_event
{
39 struct lttng_evaluation parent
;
41 /* MessagePack-encoded captured event field values. */
42 struct lttng_dynamic_buffer capture_payload
;
45 * The content of this array event field value is the decoded
46 * version of `capture_payload` above.
48 * This is a cache: it's not serialized/deserialized in
49 * communications from/to the library and the session daemon.
51 struct lttng_event_field_value
*captured_values
;
55 ssize_t
lttng_condition_on_event_create_from_payload(
56 struct lttng_payload_view
*view
,
57 struct lttng_condition
**condition
);
60 enum lttng_condition_status
61 lttng_condition_on_event_borrow_rule_mutable(
62 const struct lttng_condition
*condition
,
63 struct lttng_event_rule
**rule
);
66 void lttng_condition_on_event_set_error_counter_index(
67 struct lttng_condition
*condition
, uint64_t error_counter_index
);
70 uint64_t lttng_condition_on_event_get_error_counter_index(
71 const struct lttng_condition
*condition
);
74 struct lttng_evaluation
*lttng_evaluation_on_event_create(
75 const struct lttng_condition_on_event
*condition
,
76 const char *capture_payload
, size_t capture_payload_size
,
77 bool decode_capture_payload
);
80 ssize_t
lttng_evaluation_on_event_create_from_payload(
81 const struct lttng_condition_on_event
*condition
,
82 struct lttng_payload_view
*view
,
83 struct lttng_evaluation
**_evaluation
);
87 lttng_condition_on_event_generate_capture_descriptor_bytecode(
88 struct lttng_condition
*condition
);
91 const struct lttng_bytecode
*
92 lttng_condition_on_event_get_capture_bytecode_at_index(
93 const struct lttng_condition
*condition
, unsigned int index
);
95 #endif /* LTTNG_CONDITION_ON_EVENT_INTERNAL_H */