event-rule: tracepoint: set default pattern to '*'
[lttng-tools.git] / include / lttng / event-rule / tracepoint.h
CommitLineData
6d420eff
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_EVENT_RULE_TRACEPOINT_H
9#define LTTNG_EVENT_RULE_TRACEPOINT_H
10
11#include <lttng/domain.h>
12#include <lttng/event-rule/event-rule.h>
13#include <lttng/event.h>
14
15#ifdef __cplusplus
16extern "C" {
17#endif
18
19/*
20 * Create a newly allocated tracepoint event rule.
21 *
cb6096aa
JR
22 * The default pattern is '*'.
23 *
6d420eff
JR
24 * Returns a new event rule on success, NULL on failure. This event rule must be
25 * destroyed using lttng_event_rule_destroy().
26 */
27extern struct lttng_event_rule *lttng_event_rule_tracepoint_create(
28 enum lttng_domain_type domain);
29
30/*
31 * Set the pattern of a tracepoint event rule.
32 *
33 * Pattern can contain wildcard '*'. See man lttng-enable-event.
34 *
35 * Return LTTNG_EVENT_RULE_STATUS_OK on success, LTTNG_EVENT_RULE_STATUS_INVALID
36 * if invalid parameters are passed.
37 */
38extern enum lttng_event_rule_status lttng_event_rule_tracepoint_set_pattern(
39 struct lttng_event_rule *rule, const char *pattern);
40
41/*
42 * Get the pattern of a tracepoint event rule.
43 *
44 * The caller does not assume the ownership of the returned pattern. The
45 * pattern shall only only be used for the duration of the event rule's
46 * lifetime, or before a different pattern is set.
47 *
48 * Returns LTTNG_EVENT_RULE_STATUS_OK and a pointer to the event rule's pattern
49 * on success, LTTNG_EVENT_RULE_STATUS_INVALID if an invalid
50 * parameter is passed, or LTTNG_EVENT_RULE_STATUS_UNSET if a pattern
51 * was not set prior to this call.
52 */
53extern enum lttng_event_rule_status lttng_event_rule_tracepoint_get_pattern(
54 const struct lttng_event_rule *rule, const char **pattern);
55
56/*
57 * Get the domain type of a tracepoint event rule.
58 *
59 * Returns LTTNG_EVENT_RULE_STATUS_OK and sets the domain type output parameter
60 * on success, LTTNG_EVENT_RULE_STATUS_INVALID if an invalid parameter is
61 * passed, or LTTNG_EVENT_RULE_STATUS_UNSET if a pattern was not set prior to
62 * this call.
63 */
64extern enum lttng_event_rule_status lttng_event_rule_tracepoint_get_domain_type(
65 const struct lttng_event_rule *rule,
66 enum lttng_domain_type *type);
67
68/*
69 * Set the filter expression of a tracepoint event rule.
70 *
71 * The expression is copied internally.
72 *
73 * Return LTTNG_EVENT_RULE_STATUS_OK on success, LTTNG_EVENT_RULE_STATUS_INVALID
74 * if invalid parameters are passed.
75 */
76extern enum lttng_event_rule_status lttng_event_rule_tracepoint_set_filter(
77 struct lttng_event_rule *rule, const char *expression);
78
79/*
80 * Get the filter expression of a tracepoint event rule.
81 *
82 * The caller does not assume the ownership of the returned filter expression.
83 * The filter expression shall only only be used for the duration of the event
84 * rule's lifetime, or before a different filter expression is set.
85 *
86 * Returns LTTNG_EVENT_RULE_STATUS_OK and a pointer to the event rule's filter
87 * expression on success, LTTNG_EVENT_RULE_STATUS_INVALID if an invalid
88 * parameter is passed, or LTTNG_EVENT_RULE_STATUS_UNSET if a filter expression
89 * was not set prior to this call.
90 */
91extern enum lttng_event_rule_status lttng_event_rule_tracepoint_get_filter(
92 const struct lttng_event_rule *rule, const char **expression);
93
94/*
95 * Set the single log level of a tracepoint event rule.
96 *
97 * Return LTTNG_EVENT_RULE_STATUS_OK on success, LTTNG_EVENT_RULE_STATUS_INVALID
98 * if invalid parameters are passed.
99 */
100extern enum lttng_event_rule_status lttng_event_rule_tracepoint_set_log_level(
101 struct lttng_event_rule *rule, int level);
102
103/*
104 * Set the log level range lower bound of a tracepoint event rule.
105 *
106 * Return LTTNG_EVENT_RULE_STATUS_OK on success, LTTNG_EVENT_RULE_STATUS_INVALID
107 * if invalid parameters are passed.
108 */
109extern enum lttng_event_rule_status
110lttng_event_rule_tracepoint_set_log_level_range_lower_bound(
111 struct lttng_event_rule *rule, int level);
112
113/*
114 * Set the log level to all of a tracepoint event rule.
115 *
116 * Return LTTNG_EVENT_RULE_STATUS_OK on success, LTTNG_EVENT_RULE_STATUS_INVALID
117 * if invalid parameters are passed.
118 */
119extern enum lttng_event_rule_status
120lttng_event_rule_tracepoint_set_log_level_all(struct lttng_event_rule *rule);
121
122/*
123 * Get the log level type of a tracepoint event rule.
124 *
125 * Returns LTTNG_EVENT_RULE_STATUS_OK and sets the log level type output
126 * parameter on success, LTTNG_EVENT_RULE_STATUS_INVALID if an invalid parameter
127 * is passed, or LTTNG_EVENT_RULE_STATUS_UNSET if a log level was not set prior
128 * to this call.
129 */
130extern enum lttng_event_rule_status
131lttng_event_rule_tracepoint_get_log_level_type(
132 const struct lttng_event_rule *rule,
133 enum lttng_loglevel_type *type);
134
135/*
136 * Get the log level of a tracepoint event rule.
137 *
138 * For range log level , the lower bound log level is returned.
139 *
140 * Returns LTTNG_EVENT_RULE_STATUS_OK and sets the log level output parameter
141 * on success, LTTNG_EVENT_RULE_STATUS_INVALID if an invalid parameter is
142 * passed, or LTTNG_EVENT_RULE_STATUS_UNSET if a log level was not set prior to
143 * this call.
144 */
145extern enum lttng_event_rule_status lttng_event_rule_tracepoint_get_log_level(
146 const struct lttng_event_rule *rule, int *level);
147
148/*
149 * Add an exclusion to the set of exclusion of an event rule.
150 *
151 * The passed exclusion will be copied to the event_rule.
152 *
153 * Returns LTTNG_EVENT_RULE_STATUS_OK on success,
154 * LTTNG_EVENT_RULE_STATUS_INVALID if invalid parameters are passed, or
155 * LTTNG_EVENT_RULE_STATUS_UNSUPPORTED if this property is not supported by the
156 * domain.
157 */
158extern enum lttng_event_rule_status lttng_event_rule_tracepoint_add_exclusion(
159 struct lttng_event_rule *rule,
160 const char *exclusion);
161
162/*
163 * Get the exclusions property count of an event rule.
164 *
165 * Returns LTTNG_EVENT_RULE_STATUS_OK and sets the count output parameter
166 * on success, LTTNG_EVENT_RULE_STATUS_INVALID if an invalid parameter is
167 * passed.
168 */
169extern enum lttng_event_rule_status
170lttng_event_rule_tracepoint_get_exclusions_count(
171 const struct lttng_event_rule *rule, unsigned int *count);
172
173/*
174 * Get the event rule exclusion at the given index.
175 *
176 * Returns LTTNG_EVENT_RULE_STATUS_OK and sets the exclusion output parameter
177 * on success, LTTNG_EVENT_RULE_STATUS_INVALID if an invalid parameter is
178 * passed.
179 */
180extern enum lttng_event_rule_status
181lttng_event_rule_tracepoint_get_exclusion_at_index(
182 const struct lttng_event_rule *rule,
183 unsigned int index,
184 const char **exclusion);
185
186#ifdef __cplusplus
187}
188#endif
189
190#endif /* LTTNG_EVENT_RULE_TRACEPOINT_H */
This page took 0.043109 seconds and 4 git commands to generate.