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_INTERNAL_H
9 #define LTTNG_CONDITION_EVENT_RULE_INTERNAL_H
11 #include <lttng/condition/condition-internal.h>
12 #include <common/buffer-view.h>
13 #include <common/macros.h>
14 #include <lttng/condition/evaluation-internal.h>
15 #include <common/dynamic-array.h>
16 #include <lttng/event-field-value.h>
18 struct lttng_capture_descriptor
{
19 struct lttng_event_expr
*event_expression
;
20 struct lttng_bytecode
*bytecode
;
23 struct lttng_condition_event_rule
{
24 struct lttng_condition parent
;
25 struct lttng_event_rule
*rule
;
27 /* Array of `struct lttng_capture_descriptor *`. */
28 struct lttng_dynamic_pointer_array capture_descriptors
;
31 struct lttng_evaluation_event_rule
{
32 struct lttng_evaluation parent
;
35 /* MessagePack-encoded captured event field values. */
36 struct lttng_dynamic_buffer capture_payload
;
39 * The content of this array event field value is the decoded
40 * version of `capture_payload` above.
42 * This is a cache: it's not serialized/deserialized in
43 * communications from/to the library and the session daemon.
45 struct lttng_event_field_value
*captured_values
;
48 struct lttng_evaluation_event_rule_comm
{
49 /* Includes the null terminator. */
50 uint32_t trigger_name_length
;
56 ssize_t
lttng_condition_event_rule_create_from_payload(
57 struct lttng_payload_view
*view
,
58 struct lttng_condition
**condition
);
61 enum lttng_condition_status
62 lttng_condition_event_rule_borrow_rule_mutable(
63 const struct lttng_condition
*condition
,
64 struct lttng_event_rule
**rule
);
67 struct lttng_evaluation
*lttng_evaluation_event_rule_create(
68 const struct lttng_condition_event_rule
*condition
,
69 const char* trigger_name
,
70 const char *capture_payload
, size_t capture_payload_size
,
71 bool decode_capture_payload
);
74 ssize_t
lttng_evaluation_event_rule_create_from_payload(
75 const struct lttng_condition_event_rule
*condition
,
76 struct lttng_payload_view
*view
,
77 struct lttng_evaluation
**_evaluation
);
81 lttng_condition_event_rule_generate_capture_descriptor_bytecode(
82 struct lttng_condition
*condition
);
85 const struct lttng_bytecode
*
86 lttng_condition_event_rule_get_capture_bytecode_at_index(
87 const struct lttng_condition
*condition
, unsigned int index
);
89 #endif /* LTTNG_CONDITION_EVENT_RULE_INTERNAL_H */