Commit | Line | Data |
---|---|---|
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> | |
85b05318 | 13 | #include <lttng/log-level-rule.h> |
6d420eff JR |
14 | #include <lttng/event.h> |
15 | ||
16 | #ifdef __cplusplus | |
17 | extern "C" { | |
18 | #endif | |
19 | ||
20 | /* | |
21 | * Create a newly allocated tracepoint event rule. | |
22 | * | |
cb6096aa JR |
23 | * The default pattern is '*'. |
24 | * | |
6d420eff JR |
25 | * Returns a new event rule on success, NULL on failure. This event rule must be |
26 | * destroyed using lttng_event_rule_destroy(). | |
27 | */ | |
28 | extern struct lttng_event_rule *lttng_event_rule_tracepoint_create( | |
29 | enum lttng_domain_type domain); | |
30 | ||
31 | /* | |
8bc73626 | 32 | * Set the name pattern of a tracepoint event rule. |
6d420eff JR |
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 | */ | |
8bc73626 | 39 | extern enum lttng_event_rule_status lttng_event_rule_tracepoint_set_name_pattern( |
6d420eff JR |
40 | struct lttng_event_rule *rule, const char *pattern); |
41 | ||
42 | /* | |
8bc73626 | 43 | * Get the name pattern of a tracepoint event rule. |
6d420eff JR |
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 | */ | |
8bc73626 | 54 | extern enum lttng_event_rule_status lttng_event_rule_tracepoint_get_name_pattern( |
6d420eff JR |
55 | const struct lttng_event_rule *rule, const char **pattern); |
56 | ||
57 | /* | |
58 | * Get the domain type of a tracepoint event rule. | |
59 | * | |
60 | * Returns LTTNG_EVENT_RULE_STATUS_OK and sets the domain type output parameter | |
61 | * on success, LTTNG_EVENT_RULE_STATUS_INVALID if an invalid parameter is | |
62 | * passed, or LTTNG_EVENT_RULE_STATUS_UNSET if a pattern was not set prior to | |
63 | * this call. | |
64 | */ | |
65 | extern enum lttng_event_rule_status lttng_event_rule_tracepoint_get_domain_type( | |
66 | const struct lttng_event_rule *rule, | |
67 | enum lttng_domain_type *type); | |
68 | ||
69 | /* | |
70 | * Set the filter expression of a tracepoint event rule. | |
71 | * | |
72 | * The expression is copied internally. | |
73 | * | |
74 | * Return LTTNG_EVENT_RULE_STATUS_OK on success, LTTNG_EVENT_RULE_STATUS_INVALID | |
75 | * if invalid parameters are passed. | |
76 | */ | |
77 | extern enum lttng_event_rule_status lttng_event_rule_tracepoint_set_filter( | |
78 | struct lttng_event_rule *rule, const char *expression); | |
79 | ||
80 | /* | |
81 | * Get the filter expression of a tracepoint event rule. | |
82 | * | |
83 | * The caller does not assume the ownership of the returned filter expression. | |
84 | * The filter expression shall only only be used for the duration of the event | |
85 | * rule's lifetime, or before a different filter expression is set. | |
86 | * | |
87 | * Returns LTTNG_EVENT_RULE_STATUS_OK and a pointer to the event rule's filter | |
88 | * expression on success, LTTNG_EVENT_RULE_STATUS_INVALID if an invalid | |
89 | * parameter is passed, or LTTNG_EVENT_RULE_STATUS_UNSET if a filter expression | |
90 | * was not set prior to this call. | |
91 | */ | |
92 | extern enum lttng_event_rule_status lttng_event_rule_tracepoint_get_filter( | |
93 | const struct lttng_event_rule *rule, const char **expression); | |
94 | ||
95 | /* | |
85b05318 | 96 | * Set the log level rule of a tracepoint event rule. |
6d420eff | 97 | * |
85b05318 | 98 | * The log level rule is copied internally. |
6d420eff JR |
99 | * |
100 | * Return LTTNG_EVENT_RULE_STATUS_OK on success, LTTNG_EVENT_RULE_STATUS_INVALID | |
101 | * if invalid parameters are passed. | |
102 | */ | |
103 | extern enum lttng_event_rule_status | |
85b05318 JR |
104 | lttng_event_rule_tracepoint_set_log_level_rule(struct lttng_event_rule *rule, |
105 | const struct lttng_log_level_rule *log_level_rule); | |
6d420eff JR |
106 | |
107 | /* | |
85b05318 | 108 | * Get the log level rule of a tracepoint event rule. |
6d420eff | 109 | * |
85b05318 JR |
110 | * The caller does not assume the ownership of the returned log level rule. The |
111 | * log level rule shall only only be used for the duration of the event rule's | |
112 | * lifetime, or before a different log level rule is set. | |
6d420eff | 113 | * |
85b05318 | 114 | * Returns LTTNG_EVENT_RULE_STATUS_OK and sets the log level rule output |
6d420eff | 115 | * parameter on success, LTTNG_EVENT_RULE_STATUS_INVALID if an invalid parameter |
85b05318 | 116 | * is passed, or LTTNG_EVENT_RULE_STATUS_UNSET if a log level rule was not set prior |
6d420eff JR |
117 | * to this call. |
118 | */ | |
119 | extern enum lttng_event_rule_status | |
85b05318 | 120 | lttng_event_rule_tracepoint_get_log_level_rule( |
6d420eff | 121 | const struct lttng_event_rule *rule, |
85b05318 | 122 | const struct lttng_log_level_rule **log_level_rule); |
6d420eff JR |
123 | |
124 | /* | |
975d26c5 | 125 | * Add a name pattern exclusion to the set of name pattern exclusion of an event rule. |
6d420eff JR |
126 | * |
127 | * The passed exclusion will be copied to the event_rule. | |
128 | * | |
129 | * Returns LTTNG_EVENT_RULE_STATUS_OK on success, | |
130 | * LTTNG_EVENT_RULE_STATUS_INVALID if invalid parameters are passed, or | |
131 | * LTTNG_EVENT_RULE_STATUS_UNSUPPORTED if this property is not supported by the | |
132 | * domain. | |
133 | */ | |
975d26c5 | 134 | extern enum lttng_event_rule_status lttng_event_rule_tracepoint_add_name_pattern_exclusion( |
6d420eff JR |
135 | struct lttng_event_rule *rule, |
136 | const char *exclusion); | |
137 | ||
138 | /* | |
975d26c5 | 139 | * Get the name pattern exclusions property count of an event rule. |
6d420eff JR |
140 | * |
141 | * Returns LTTNG_EVENT_RULE_STATUS_OK and sets the count output parameter | |
142 | * on success, LTTNG_EVENT_RULE_STATUS_INVALID if an invalid parameter is | |
143 | * passed. | |
144 | */ | |
145 | extern enum lttng_event_rule_status | |
975d26c5 | 146 | lttng_event_rule_tracepoint_get_name_pattern_exclusion_count( |
6d420eff JR |
147 | const struct lttng_event_rule *rule, unsigned int *count); |
148 | ||
149 | /* | |
975d26c5 | 150 | * Get the pattern name exclusion at the given index. |
6d420eff JR |
151 | * |
152 | * Returns LTTNG_EVENT_RULE_STATUS_OK and sets the exclusion output parameter | |
153 | * on success, LTTNG_EVENT_RULE_STATUS_INVALID if an invalid parameter is | |
154 | * passed. | |
155 | */ | |
156 | extern enum lttng_event_rule_status | |
975d26c5 | 157 | lttng_event_rule_tracepoint_get_name_pattern_exclusion_at_index( |
6d420eff JR |
158 | const struct lttng_event_rule *rule, |
159 | unsigned int index, | |
160 | const char **exclusion); | |
161 | ||
162 | #ifdef __cplusplus | |
163 | } | |
164 | #endif | |
165 | ||
166 | #endif /* LTTNG_EVENT_RULE_TRACEPOINT_H */ |