Fix: liblttng-ctl comm: lttng_event is not packed
[lttng-tools.git] / include / lttng / event-rule / user-tracepoint.h
CommitLineData
0a23a07d
JR
1/*
2 * Copyright (C) 2021 Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
3 *
4 * SPDX-License-Identifier: LGPL-2.1-only
5 *
6 */
7
8#ifndef LTTNG_EVENT_RULE_USER_TRACEPOINT_H
9#define LTTNG_EVENT_RULE_USER_TRACEPOINT_H
10
11#include <lttng/domain.h>
12#include <lttng/event-rule/event-rule.h>
13#include <lttng/log-level-rule.h>
4bd69c5f 14#include <lttng/lttng-export.h>
0a23a07d
JR
15#include <lttng/event.h>
16
17#ifdef __cplusplus
18extern "C" {
19#endif
20
21/*
22 * Create a newly allocated user tracepoint event rule.
23 *
24 * The default pattern is '*'.
25 *
26 * Returns a new event rule on success, NULL on failure. This event rule must be
27 * destroyed using lttng_event_rule_destroy().
28 */
4bd69c5f 29LTTNG_EXPORT extern struct lttng_event_rule *lttng_event_rule_user_tracepoint_create(void);
0a23a07d
JR
30
31/*
32 * Set the name pattern of a user tracepoint event rule.
33 *
34 * Pattern can contain wildcard '*'. See man lttng-enable-event.
35 *
36 * Return LTTNG_EVENT_RULE_STATUS_OK on success, LTTNG_EVENT_RULE_STATUS_INVALID
37 * if invalid parameters are passed.
38 */
4bd69c5f 39LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_user_tracepoint_set_name_pattern(
0a23a07d
JR
40 struct lttng_event_rule *rule, const char *pattern);
41
42/*
43 * Get the name pattern of a user tracepoint event rule.
44 *
45 * The caller does not assume the ownership of the returned pattern. The
46 * pattern shall only only be used for the duration of the event rule's
47 * lifetime, or before a different pattern is set.
48 *
49 * Returns LTTNG_EVENT_RULE_STATUS_OK and a pointer to the event rule's pattern
50 * on success, LTTNG_EVENT_RULE_STATUS_INVALID if an invalid
51 * parameter is passed, or LTTNG_EVENT_RULE_STATUS_UNSET if a pattern
52 * was not set prior to this call.
53 */
4bd69c5f 54LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_user_tracepoint_get_name_pattern(
0a23a07d
JR
55 const struct lttng_event_rule *rule, const char **pattern);
56
57/*
58 * Set the filter expression of a user tracepoint event rule.
59 *
60 * The expression is copied internally.
61 *
62 * Return LTTNG_EVENT_RULE_STATUS_OK on success, LTTNG_EVENT_RULE_STATUS_INVALID
63 * if invalid parameters are passed.
64 */
4bd69c5f 65LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_user_tracepoint_set_filter(
0a23a07d
JR
66 struct lttng_event_rule *rule, const char *expression);
67
68/*
69 * Get the filter expression of a user tracepoint event rule.
70 *
71 * The caller does not assume the ownership of the returned filter expression.
72 * The filter expression shall only only be used for the duration of the event
73 * rule's lifetime, or before a different filter expression is set.
74 *
75 * Returns LTTNG_EVENT_RULE_STATUS_OK and a pointer to the event rule's filter
76 * expression on success, LTTNG_EVENT_RULE_STATUS_INVALID if an invalid
77 * parameter is passed, or LTTNG_EVENT_RULE_STATUS_UNSET if a filter expression
78 * was not set prior to this call.
79 */
4bd69c5f 80LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_user_tracepoint_get_filter(
0a23a07d
JR
81 const struct lttng_event_rule *rule, const char **expression);
82
83/*
84 * Set the log level rule of a user tracepoint event rule.
85 *
86 * The log level rule is copied internally.
87 *
88 * Return LTTNG_EVENT_RULE_STATUS_OK on success, LTTNG_EVENT_RULE_STATUS_INVALID
89 * if invalid parameters are passed.
90 */
4bd69c5f 91LTTNG_EXPORT extern enum lttng_event_rule_status
0a23a07d
JR
92lttng_event_rule_user_tracepoint_set_log_level_rule(struct lttng_event_rule *rule,
93 const struct lttng_log_level_rule *log_level_rule);
94
95/*
96 * Get the log level rule of a user tracepoint event rule.
97 *
98 * The caller does not assume the ownership of the returned log level rule. The
99 * log level rule shall only only be used for the duration of the event rule's
100 * lifetime, or before a different log level rule is set.
101 *
102 * Returns LTTNG_EVENT_RULE_STATUS_OK and sets the log level rule output
103 * parameter on success, LTTNG_EVENT_RULE_STATUS_INVALID if an invalid parameter
104 * is passed, or LTTNG_EVENT_RULE_STATUS_UNSET if a log level rule was not set prior
105 * to this call.
106 */
4bd69c5f 107LTTNG_EXPORT extern enum lttng_event_rule_status
0a23a07d
JR
108lttng_event_rule_user_tracepoint_get_log_level_rule(
109 const struct lttng_event_rule *rule,
110 const struct lttng_log_level_rule **log_level_rule);
111
112/*
113 * Add a name pattern exclusion to the set of name pattern exclusion of an event rule.
114 *
115 * The passed exclusion will be copied to the event_rule.
116 *
117 * Returns LTTNG_EVENT_RULE_STATUS_OK on success,
118 * LTTNG_EVENT_RULE_STATUS_INVALID if invalid parameters are passed.
119 */
4bd69c5f 120LTTNG_EXPORT extern enum lttng_event_rule_status lttng_event_rule_user_tracepoint_add_name_pattern_exclusion(
0a23a07d
JR
121 struct lttng_event_rule *rule,
122 const char *exclusion);
123
124/*
125 * Get the name pattern exclusions property count of an event rule.
126 *
127 * Returns LTTNG_EVENT_RULE_STATUS_OK and sets the count output parameter
128 * on success, LTTNG_EVENT_RULE_STATUS_INVALID if an invalid parameter is
129 * passed.
130 */
4bd69c5f 131LTTNG_EXPORT extern enum lttng_event_rule_status
0a23a07d
JR
132lttng_event_rule_user_tracepoint_get_name_pattern_exclusion_count(
133 const struct lttng_event_rule *rule, unsigned int *count);
134
135/*
136 * Get the pattern name exclusion at the given index.
137 *
138 * Returns LTTNG_EVENT_RULE_STATUS_OK and sets the exclusion output parameter
139 * on success, LTTNG_EVENT_RULE_STATUS_INVALID if an invalid parameter is
140 * passed.
141 */
4bd69c5f 142LTTNG_EXPORT extern enum lttng_event_rule_status
0a23a07d
JR
143lttng_event_rule_user_tracepoint_get_name_pattern_exclusion_at_index(
144 const struct lttng_event_rule *rule,
145 unsigned int index,
146 const char **exclusion);
147
148#ifdef __cplusplus
149}
150#endif
151
152#endif /* LTTNG_EVENT_RULE_USER_TRACEPOINT_H */
This page took 0.031818 seconds and 4 git commands to generate.