on-event: add error counter fields to condition
[lttng-tools.git] / include / lttng / condition / on-event-internal.h
CommitLineData
683d081a
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
d602bd6a
JR
8#ifndef LTTNG_CONDITION_ON_EVENT_INTERNAL_H
9#define LTTNG_CONDITION_ON_EVENT_INTERNAL_H
683d081a
JR
10
11#include <lttng/condition/condition-internal.h>
12#include <common/buffer-view.h>
13#include <common/macros.h>
35a9ac41 14#include <common/optional.h>
683d081a 15#include <lttng/condition/evaluation-internal.h>
38114013 16#include <common/dynamic-array.h>
7c920b63 17#include <lttng/event-field-value.h>
683d081a 18
0912b5ea
JR
19struct lttng_capture_descriptor {
20 struct lttng_event_expr *event_expression;
21 struct lttng_bytecode *bytecode;
22};
23
d602bd6a 24struct lttng_condition_on_event {
683d081a
JR
25 struct lttng_condition parent;
26 struct lttng_event_rule *rule;
683d081a 27
35a9ac41
FD
28 LTTNG_OPTIONAL(uint64_t) error_count;
29 /*
30 * Internal use only.
31 * Error accounting counter index.
32 */
33 LTTNG_OPTIONAL(uint64_t) error_counter_index;
34
0912b5ea 35 /* Array of `struct lttng_capture_descriptor *`. */
38114013
PP
36 struct lttng_dynamic_pointer_array capture_descriptors;
37};
683d081a 38
d602bd6a 39struct lttng_evaluation_on_event {
683d081a
JR
40 struct lttng_evaluation parent;
41 char *name;
7c920b63
PP
42
43 /* MessagePack-encoded captured event field values. */
44 struct lttng_dynamic_buffer capture_payload;
45
46 /*
47 * The content of this array event field value is the decoded
48 * version of `capture_payload` above.
49 *
50 * This is a cache: it's not serialized/deserialized in
51 * communications from/to the library and the session daemon.
52 */
53 struct lttng_event_field_value *captured_values;
683d081a
JR
54};
55
d602bd6a 56struct lttng_evaluation_on_event_comm {
683d081a
JR
57 /* Includes the null terminator. */
58 uint32_t trigger_name_length;
59 /* Trigger name. */
60 char payload[];
61} LTTNG_PACKED;
62
683d081a 63LTTNG_HIDDEN
d602bd6a 64ssize_t lttng_condition_on_event_create_from_payload(
683d081a
JR
65 struct lttng_payload_view *view,
66 struct lttng_condition **condition);
67
68LTTNG_HIDDEN
69enum lttng_condition_status
d602bd6a 70lttng_condition_on_event_borrow_rule_mutable(
683d081a
JR
71 const struct lttng_condition *condition,
72 struct lttng_event_rule **rule);
73
35a9ac41
FD
74LTTNG_HIDDEN
75void lttng_condition_on_event_set_error_counter_index(
76 struct lttng_condition *condition, uint64_t error_counter_index);
77
78LTTNG_HIDDEN
79uint64_t lttng_condition_on_event_get_error_counter_index(
80 const struct lttng_condition *condition);
81
82LTTNG_HIDDEN
83uint64_t lttng_condition_on_event_get_error_count(
84 const struct lttng_condition *condition);
85
86LTTNG_HIDDEN
87void lttng_condition_on_event_set_error_count(struct lttng_condition *condition,
88 uint64_t error_count);
89
683d081a 90LTTNG_HIDDEN
d602bd6a
JR
91struct lttng_evaluation *lttng_evaluation_on_event_create(
92 const struct lttng_condition_on_event *condition,
7c920b63
PP
93 const char* trigger_name,
94 const char *capture_payload, size_t capture_payload_size,
95 bool decode_capture_payload);
683d081a
JR
96
97LTTNG_HIDDEN
d602bd6a
JR
98ssize_t lttng_evaluation_on_event_create_from_payload(
99 const struct lttng_condition_on_event *condition,
683d081a
JR
100 struct lttng_payload_view *view,
101 struct lttng_evaluation **_evaluation);
102
834966af
JR
103LTTNG_HIDDEN
104enum lttng_error_code
d602bd6a 105lttng_condition_on_event_generate_capture_descriptor_bytecode(
834966af
JR
106 struct lttng_condition *condition);
107
51dbe985
JR
108LTTNG_HIDDEN
109const struct lttng_bytecode *
d602bd6a 110lttng_condition_on_event_get_capture_bytecode_at_index(
51dbe985
JR
111 const struct lttng_condition *condition, unsigned int index);
112
d602bd6a 113#endif /* LTTNG_CONDITION_ON_EVENT_INTERNAL_H */
This page took 0.031016 seconds and 4 git commands to generate.