SoW-2020-0002: Trace Hit Counters: trigger error reporting integration
[lttng-tools.git] / include / lttng / condition / event-rule-internal.h
CommitLineData
2463b787
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
8#ifndef LTTNG_CONDITION_event_rule_INTERNAL_H
9#define LTTNG_CONDITION_event_rule_INTERNAL_H
10
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>
17
18struct lttng_capture_descriptor {
19 /* The index at which the capture for this descriptor in the received
20 * payload from the tracer. This is populated on sessiond side.
21 * -1 is uninitialized.
22 * This is necessary since a single trigger can have multiple notify
23 * action, only an ordered set of capture desciptor is passed to the tracer.
24 */
25 int32_t capture_index;
26 struct lttng_event_expr *event_expression;
27};
28
29struct lttng_condition_event_rule {
30 struct lttng_condition parent;
31 struct lttng_event_rule *rule;
32
33 /* Array of `struct lttng_capture_descriptor *` */
34 struct lttng_dynamic_pointer_array capture_descriptors;
35};
36
37struct lttng_evaluation_event_rule {
38 struct lttng_evaluation parent;
39 char *name;
40
41 /* MessagePack-encoded captured event field values */
42 struct lttng_dynamic_buffer capture_payload;
43
44 /*
45 * The content of this array event field value is the decoded
46 * version of `capture_payload` above.
47 *
48 * This is a cache: it's not serialized/deserialized in
49 * communications from/to the library and the session daemon.
50 */
51 struct lttng_event_field_value *captured_values;
52};
53
54struct lttng_evaluation_event_rule_comm {
55 uint32_t trigger_name_length;
56 /* Trigger name */
57 char payload[];
58} LTTNG_PACKED;
59
60struct lttng_condition_event_rule_capture_bytecode_element
61{
62 struct lttng_event_expr *expression;
63 struct lttng_bytecode *bytecode;
64};
65
66LTTNG_HIDDEN
67ssize_t lttng_condition_event_rule_create_from_payload(
68 struct lttng_payload_view *view,
69 struct lttng_condition **condition);
70
71LTTNG_HIDDEN
72enum lttng_condition_status
73lttng_condition_event_rule_get_rule_mutable(
74 const struct lttng_condition *condition,
75 struct lttng_event_rule **rule);
76
77LTTNG_HIDDEN
78struct lttng_evaluation *lttng_evaluation_event_rule_create(
79 const struct lttng_condition_event_rule *condition,
80 const char* trigger_name,
81 const char *capture_payload, size_t capture_payload_size,
82 bool decode_capture_payload);
83
84LTTNG_HIDDEN
85ssize_t lttng_evaluation_event_rule_create_from_payload(
86 const struct lttng_condition_event_rule *condition,
87 struct lttng_payload_view *view,
88 struct lttng_evaluation **_evaluation);
89
90/*
91 * The returned `lttng_dynamic_pointer_array` contains a index ordered set of
92 * `lttng_condition_event_rule_capture_bytecode_element`.
93 * This ensure that minimal work will be done by the tracer for cases where
94 * multiple identical capture expression are present.
95 */
96LTTNG_HIDDEN
97enum lttng_error_code
98lttng_condition_event_rule_generate_capture_descriptor_bytecode_set(
99 struct lttng_condition *condition,
100 struct lttng_dynamic_pointer_array *bytecode_set);
101
102LTTNG_HIDDEN
103struct lttng_capture_descriptor *
104lttng_condition_event_rule_get_internal_capture_descriptor_at_index(
105 const struct lttng_condition *condition, unsigned int index);
106
107#endif /* LTTNG_CONDITION_event_rule_INTERNAL_H */
This page took 0.02844 seconds and 5 git commands to generate.