Commit | Line | Data |
---|---|---|
c7e35b03 | 1 | /* |
82d52a52 | 2 | * Copyright (C) 2014 EfficiOS Inc. |
ab5be9fa | 3 | * Copyright (C) 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com> |
c7e35b03 | 4 | * |
395004a1 | 5 | * SPDX-License-Identifier: LGPL-2.1-only |
c7e35b03 | 6 | * |
c7e35b03 JR |
7 | */ |
8 | ||
9 | #ifndef _MI_LTTNG_H | |
10 | #define _MI_LTTNG_H | |
11 | ||
12 | #include <stdint.h> | |
13 | ||
14 | #include <common/error.h> | |
15 | #include <common/macros.h> | |
f40ef1d5 | 16 | #include <common/config/session-config.h> |
c7e35b03 JR |
17 | #include <lttng/lttng.h> |
18 | ||
50534d6f JRJ |
19 | /* Don't want to reference snapshot-internal.h here */ |
20 | struct lttng_snapshot_output; | |
21 | ||
c7e35b03 JR |
22 | /* Instance of a machine interface writer. */ |
23 | struct mi_writer { | |
24 | struct config_writer *writer; | |
25 | enum lttng_mi_output_type type; | |
26 | }; | |
27 | ||
28 | /* | |
29 | * Version information for the machine interface. | |
30 | */ | |
31 | struct mi_lttng_version { | |
36d2e35d | 32 | char version[LTTNG_NAME_MAX]; /* Version number of package */ |
c7e35b03 JR |
33 | uint32_t version_major; /* LTTng-Tools major version number */ |
34 | uint32_t version_minor; /* LTTng-Tools minor version number */ | |
35 | uint32_t version_patchlevel; /* LTTng-Tools patchlevel version number */ | |
36d2e35d MJ |
36 | char version_commit[LTTNG_NAME_MAX]; /* Commit hash of the current version */ |
37 | char version_name[LTTNG_NAME_MAX]; | |
38 | char package_url[LTTNG_NAME_MAX]; /* Define to the home page for this package. */ | |
c7e35b03 JR |
39 | }; |
40 | ||
0f7c2963 JR |
41 | /* Error query callbacks. */ |
42 | typedef enum lttng_error_code (*mi_lttng_error_query_trigger_cb)( | |
43 | const struct lttng_trigger *trigger, | |
44 | struct lttng_error_query_results **results); | |
45 | typedef enum lttng_error_code (*mi_lttng_error_query_condition_cb)( | |
46 | const struct lttng_trigger *trigger, | |
47 | struct lttng_error_query_results **results); | |
48 | typedef enum lttng_error_code (*mi_lttng_error_query_action_cb)( | |
49 | const struct lttng_trigger *trigger, | |
50 | const struct lttng_action_path *action_path, | |
51 | struct lttng_error_query_results **results); | |
52 | ||
53 | struct mi_lttng_error_query_callbacks { | |
54 | mi_lttng_error_query_trigger_cb trigger_cb; | |
55 | mi_lttng_error_query_condition_cb condition_cb; | |
56 | mi_lttng_error_query_action_cb action_cb; | |
57 | }; | |
58 | ||
c7e35b03 | 59 | /* Strings related to command */ |
4965f956 JG |
60 | extern const char * const mi_lttng_element_command; |
61 | extern const char * const mi_lttng_element_command_action; | |
62 | extern const char * const mi_lttng_element_command_add_context; | |
ecd27e60 | 63 | LTTNG_HIDDEN extern const char * const mi_lttng_element_command_add_trigger; |
4965f956 JG |
64 | extern const char * const mi_lttng_element_command_create; |
65 | extern const char * const mi_lttng_element_command_destroy; | |
66 | extern const char * const mi_lttng_element_command_disable_channel; | |
67 | extern const char * const mi_lttng_element_command_disable_event; | |
68 | extern const char * const mi_lttng_element_command_enable_channels; | |
69 | extern const char * const mi_lttng_element_command_enable_event; | |
70 | extern const char * const mi_lttng_element_command_list; | |
ecd27e60 | 71 | LTTNG_HIDDEN extern const char * const mi_lttng_element_command_list_trigger; |
4965f956 | 72 | extern const char * const mi_lttng_element_command_load; |
54897b57 JD |
73 | extern const char * const mi_lttng_element_command_metadata; |
74 | extern const char * const mi_lttng_element_command_metadata_action; | |
eded6438 JD |
75 | extern const char * const mi_lttng_element_command_regenerate; |
76 | extern const char * const mi_lttng_element_command_regenerate_action; | |
4965f956 JG |
77 | extern const char * const mi_lttng_element_command_name; |
78 | extern const char * const mi_lttng_element_command_output; | |
ecd27e60 | 79 | LTTNG_HIDDEN extern const char * const mi_lttng_element_command_remove_trigger; |
4965f956 JG |
80 | extern const char * const mi_lttng_element_command_save; |
81 | extern const char * const mi_lttng_element_command_set_session; | |
82 | extern const char * const mi_lttng_element_command_snapshot; | |
83 | extern const char * const mi_lttng_element_command_snapshot_add; | |
84 | extern const char * const mi_lttng_element_command_snapshot_del; | |
85 | extern const char * const mi_lttng_element_command_snapshot_list; | |
86 | extern const char * const mi_lttng_element_command_snapshot_record; | |
87 | extern const char * const mi_lttng_element_command_start; | |
88 | extern const char * const mi_lttng_element_command_stop; | |
89 | extern const char * const mi_lttng_element_command_success; | |
90 | extern const char * const mi_lttng_element_command_track; | |
91 | extern const char * const mi_lttng_element_command_untrack; | |
92 | extern const char * const mi_lttng_element_command_version; | |
d68c9a04 | 93 | extern const char * const mi_lttng_element_command_rotate; |
259c2674 JD |
94 | extern const char * const mi_lttng_element_command_enable_rotation; |
95 | extern const char * const mi_lttng_element_command_disable_rotation; | |
511ed4e2 | 96 | extern const char * const mi_lttng_element_command_clear; |
c7e35b03 | 97 | |
1734c658 | 98 | /* Strings related to version command */ |
4965f956 JG |
99 | extern const char * const mi_lttng_element_version; |
100 | extern const char * const mi_lttng_element_version_commit; | |
101 | extern const char * const mi_lttng_element_version_description; | |
102 | extern const char * const mi_lttng_element_version_license; | |
103 | extern const char * const mi_lttng_element_version_major; | |
104 | extern const char * const mi_lttng_element_version_minor; | |
105 | extern const char * const mi_lttng_element_version_patch_level; | |
106 | extern const char * const mi_lttng_element_version_str; | |
107 | extern const char * const mi_lttng_element_version_web; | |
c7e35b03 | 108 | |
5e18ec73 | 109 | /* String related to a lttng_event_field */ |
4965f956 JG |
110 | extern const char * const mi_lttng_element_event_field; |
111 | extern const char * const mi_lttng_element_event_fields; | |
5e18ec73 | 112 | |
89b72577 | 113 | /* String related to lttng_event_perf_counter_ctx */ |
4965f956 | 114 | extern const char * const mi_lttng_element_perf_counter_context; |
89b72577 | 115 | |
5e18ec73 | 116 | /* Strings related to pid */ |
4965f956 | 117 | extern const char * const mi_lttng_element_pid_id; |
5e18ec73 | 118 | |
1734c658 | 119 | /* Strings related to save command */ |
4965f956 | 120 | extern const char * const mi_lttng_element_save; |
1734c658 JRJ |
121 | |
122 | /* Strings related to load command */ | |
4965f956 | 123 | extern const char * const mi_lttng_element_load; |
44cdb3a2 MJ |
124 | LTTNG_HIDDEN extern const char * const mi_lttng_element_load_overrides; |
125 | LTTNG_HIDDEN extern const char * const mi_lttng_element_load_override_url; | |
1734c658 | 126 | |
5e18ec73 | 127 | /* General element of mi_lttng */ |
4965f956 JG |
128 | extern const char * const mi_lttng_element_empty; |
129 | extern const char * const mi_lttng_element_id; | |
130 | extern const char * const mi_lttng_element_nowrite; | |
131 | extern const char * const mi_lttng_element_success; | |
132 | extern const char * const mi_lttng_element_type_enum; | |
133 | extern const char * const mi_lttng_element_type_float; | |
134 | extern const char * const mi_lttng_element_type_integer; | |
135 | extern const char * const mi_lttng_element_type_other; | |
136 | extern const char * const mi_lttng_element_type_string; | |
5e18ec73 JR |
137 | |
138 | /* String related to loglevel */ | |
4965f956 JG |
139 | extern const char * const mi_lttng_loglevel_str_alert; |
140 | extern const char * const mi_lttng_loglevel_str_crit; | |
141 | extern const char * const mi_lttng_loglevel_str_debug; | |
142 | extern const char * const mi_lttng_loglevel_str_debug_function; | |
143 | extern const char * const mi_lttng_loglevel_str_debug_line; | |
144 | extern const char * const mi_lttng_loglevel_str_debug_module; | |
145 | extern const char * const mi_lttng_loglevel_str_debug_process; | |
146 | extern const char * const mi_lttng_loglevel_str_debug_program; | |
147 | extern const char * const mi_lttng_loglevel_str_debug_system; | |
148 | extern const char * const mi_lttng_loglevel_str_debug_unit; | |
149 | extern const char * const mi_lttng_loglevel_str_emerg; | |
150 | extern const char * const mi_lttng_loglevel_str_err; | |
151 | extern const char * const mi_lttng_loglevel_str_info; | |
152 | extern const char * const mi_lttng_loglevel_str_notice; | |
153 | extern const char * const mi_lttng_loglevel_str_unknown; | |
154 | extern const char * const mi_lttng_loglevel_str_warning; | |
5e18ec73 | 155 | |
136f2f81 | 156 | /* String related to loglevel JUL */ |
4965f956 JG |
157 | extern const char * const mi_lttng_loglevel_str_jul_all; |
158 | extern const char * const mi_lttng_loglevel_str_jul_config; | |
159 | extern const char * const mi_lttng_loglevel_str_jul_fine; | |
160 | extern const char * const mi_lttng_loglevel_str_jul_finer; | |
161 | extern const char * const mi_lttng_loglevel_str_jul_finest; | |
162 | extern const char * const mi_lttng_loglevel_str_jul_info; | |
163 | extern const char * const mi_lttng_loglevel_str_jul_off; | |
164 | extern const char * const mi_lttng_loglevel_str_jul_severe; | |
165 | extern const char * const mi_lttng_loglevel_str_jul_warning; | |
136f2f81 | 166 | |
970d848b | 167 | /* String related to loglevel Log4j */ |
4965f956 JG |
168 | extern const char * const mi_lttng_loglevel_str_log4j_off; |
169 | extern const char * const mi_lttng_loglevel_str_log4j_fatal; | |
170 | extern const char * const mi_lttng_loglevel_str_log4j_error; | |
171 | extern const char * const mi_lttng_loglevel_str_log4j_warn; | |
172 | extern const char * const mi_lttng_loglevel_str_log4j_info; | |
173 | extern const char * const mi_lttng_loglevel_str_log4j_debug; | |
174 | extern const char * const mi_lttng_loglevel_str_log4j_trace; | |
175 | extern const char * const mi_lttng_loglevel_str_log4j_all; | |
970d848b | 176 | |
0e115563 | 177 | /* String related to loglevel Python */ |
4965f956 JG |
178 | extern const char * const mi_lttng_loglevel_str_python_critical; |
179 | extern const char * const mi_lttng_loglevel_str_python_error; | |
180 | extern const char * const mi_lttng_loglevel_str_python_warning; | |
181 | extern const char * const mi_lttng_loglevel_str_python_info; | |
182 | extern const char * const mi_lttng_loglevel_str_python_debug; | |
183 | extern const char * const mi_lttng_loglevel_str_python_notset; | |
0e115563 | 184 | |
1734c658 | 185 | /* String related to loglevel type */ |
4965f956 JG |
186 | extern const char * const mi_lttng_loglevel_type_all; |
187 | extern const char * const mi_lttng_loglevel_type_range; | |
188 | extern const char * const mi_lttng_loglevel_type_single; | |
189 | extern const char * const mi_lttng_loglevel_type_unknown; | |
5e18ec73 | 190 | |
136f2f81 | 191 | /* String related to a lttng_snapshot */ |
4965f956 JG |
192 | extern const char * const mi_lttng_element_snapshot_ctrl_url; |
193 | extern const char * const mi_lttng_element_snapshot_data_url; | |
194 | extern const char * const mi_lttng_element_snapshot_max_size; | |
195 | extern const char * const mi_lttng_element_snapshot_n_ptr; | |
196 | extern const char * const mi_lttng_element_snapshot_session_name; | |
197 | extern const char * const mi_lttng_element_snapshots; | |
50534d6f | 198 | |
a23cb78a | 199 | /* String related to track/untrack command */ |
44cdb3a2 | 200 | extern const char * const mi_lttng_element_track_untrack_all_wildcard; |
a23cb78a | 201 | |
44cdb3a2 | 202 | LTTNG_HIDDEN extern const char * const mi_lttng_element_session_name; |
d68c9a04 JD |
203 | |
204 | /* String related to rotate command */ | |
44cdb3a2 MJ |
205 | LTTNG_HIDDEN extern const char * const mi_lttng_element_rotation; |
206 | LTTNG_HIDDEN extern const char * const mi_lttng_element_rotate_status; | |
207 | LTTNG_HIDDEN extern const char * const mi_lttng_element_rotation_schedule; | |
208 | LTTNG_HIDDEN extern const char * const mi_lttng_element_rotation_schedules; | |
209 | LTTNG_HIDDEN extern const char * const mi_lttng_element_rotation_schedule_periodic; | |
210 | LTTNG_HIDDEN extern const char * const mi_lttng_element_rotation_schedule_periodic_time_us; | |
211 | LTTNG_HIDDEN extern const char * const mi_lttng_element_rotation_schedule_size_threshold; | |
212 | LTTNG_HIDDEN extern const char * const mi_lttng_element_rotation_schedule_size_threshold_bytes; | |
213 | LTTNG_HIDDEN extern const char * const mi_lttng_element_rotation_schedule_result; | |
214 | LTTNG_HIDDEN extern const char * const mi_lttng_element_rotation_schedule_results; | |
215 | LTTNG_HIDDEN extern const char * const mi_lttng_element_rotation_state; | |
216 | LTTNG_HIDDEN extern const char * const mi_lttng_element_rotation_location; | |
217 | LTTNG_HIDDEN extern const char * const mi_lttng_element_rotation_location_local; | |
218 | LTTNG_HIDDEN extern const char * const mi_lttng_element_rotation_location_local_absolute_path; | |
219 | LTTNG_HIDDEN extern const char * const mi_lttng_element_rotation_location_relay; | |
220 | LTTNG_HIDDEN extern const char * const mi_lttng_element_rotation_location_relay_host; | |
221 | LTTNG_HIDDEN extern const char * const mi_lttng_element_rotation_location_relay_control_port; | |
222 | LTTNG_HIDDEN extern const char * const mi_lttng_element_rotation_location_relay_data_port; | |
223 | LTTNG_HIDDEN extern const char * const mi_lttng_element_rotation_location_relay_protocol; | |
224 | LTTNG_HIDDEN extern const char * const mi_lttng_element_rotation_location_relay_relative_path; | |
91c4d516 JG |
225 | |
226 | /* String related to enum lttng_rotation_state */ | |
44cdb3a2 MJ |
227 | LTTNG_HIDDEN extern const char * const mi_lttng_rotation_state_str_ongoing; |
228 | LTTNG_HIDDEN extern const char * const mi_lttng_rotation_state_str_completed; | |
229 | LTTNG_HIDDEN extern const char * const mi_lttng_rotation_state_str_expired; | |
230 | LTTNG_HIDDEN extern const char * const mi_lttng_rotation_state_str_error; | |
91c4d516 JG |
231 | |
232 | /* String related to enum lttng_trace_archive_location_relay_protocol_type */ | |
44cdb3a2 | 233 | LTTNG_HIDDEN extern const char * const mi_lttng_rotation_location_relay_protocol_str_tcp; |
d68c9a04 | 234 | |
0f7c2963 JR |
235 | /* String related to rate_policy elements */ |
236 | LTTNG_HIDDEN extern const char *const mi_lttng_element_rate_policy; | |
237 | LTTNG_HIDDEN extern const char *const mi_lttng_element_rate_policy_every_n; | |
238 | LTTNG_HIDDEN extern const char *const mi_lttng_element_rate_policy_once_after_n; | |
239 | ||
240 | LTTNG_HIDDEN extern const char | |
241 | *const mi_lttng_element_rate_policy_every_n_interval; | |
242 | LTTNG_HIDDEN extern const char | |
243 | *const mi_lttng_element_rate_policy_once_after_n_threshold; | |
244 | ||
245 | /* String related to action elements */ | |
246 | LTTNG_HIDDEN extern const char *const mi_lttng_element_action; | |
247 | LTTNG_HIDDEN extern const char *const mi_lttng_element_action_list; | |
248 | LTTNG_HIDDEN extern const char *const mi_lttng_element_action_notify; | |
249 | LTTNG_HIDDEN extern const char *const mi_lttng_element_action_start_session; | |
250 | LTTNG_HIDDEN extern const char *const mi_lttng_element_action_stop_session; | |
251 | LTTNG_HIDDEN extern const char *const mi_lttng_element_action_rotate_session; | |
252 | LTTNG_HIDDEN extern const char *const mi_lttng_element_action_snapshot_session; | |
253 | LTTNG_HIDDEN extern const char | |
254 | *const mi_lttng_element_action_snapshot_session_output; | |
255 | ||
256 | /* String related to condition */ | |
257 | LTTNG_HIDDEN extern const char *const mi_lttng_element_condition; | |
258 | LTTNG_HIDDEN extern const char | |
259 | *const mi_lttng_element_condition_buffer_usage_high; | |
260 | LTTNG_HIDDEN extern const char | |
261 | *const mi_lttng_element_condition_buffer_usage_low; | |
262 | LTTNG_HIDDEN extern const char | |
263 | *const mi_lttng_element_condition_event_rule_matches; | |
264 | LTTNG_HIDDEN extern const char | |
265 | *const mi_lttng_element_condition_session_consumed_size; | |
266 | LTTNG_HIDDEN extern const char | |
267 | *const mi_lttng_element_condition_session_rotation; | |
268 | LTTNG_HIDDEN extern const char | |
269 | *const mi_lttng_element_condition_session_rotation_completed; | |
270 | LTTNG_HIDDEN extern const char | |
271 | *const mi_lttng_element_condition_session_rotation_ongoing; | |
272 | LTTNG_HIDDEN extern const char *const mi_lttng_element_condition_channel_name; | |
273 | LTTNG_HIDDEN extern const char *const mi_lttng_element_condition_threshold_ratio; | |
274 | LTTNG_HIDDEN extern const char *const mi_lttng_element_condition_threshold_bytes; | |
275 | ||
276 | /* String related to capture descriptor */ | |
277 | LTTNG_HIDDEN extern const char *const mi_lttng_element_capture_descriptor; | |
278 | LTTNG_HIDDEN extern const char *const mi_lttng_element_capture_descriptors; | |
279 | ||
280 | /* String related to event expression */ | |
281 | LTTNG_HIDDEN extern const char *const mi_lttng_element_event_expr; | |
282 | LTTNG_HIDDEN extern const char *const mi_lttng_element_event_expr_payload_field; | |
283 | LTTNG_HIDDEN extern const char | |
284 | *const mi_lttng_element_event_expr_channel_context_field; | |
285 | LTTNG_HIDDEN extern const char | |
286 | *const mi_lttng_element_event_expr_app_specific_context_field; | |
287 | LTTNG_HIDDEN extern const char | |
288 | *const mi_lttng_element_event_expr_array_field_element; | |
289 | ||
290 | LTTNG_HIDDEN extern const char *const mi_lttng_element_event_expr_provider_name; | |
291 | LTTNG_HIDDEN extern const char *const mi_lttng_element_event_expr_type_name; | |
292 | LTTNG_HIDDEN extern const char *const mi_lttng_element_event_expr_index; | |
293 | ||
294 | /* String related to event rule */ | |
295 | LTTNG_HIDDEN extern const char *const mi_lttng_element_event_rule; | |
296 | ||
297 | /* String related to lttng_event_rule */ | |
298 | LTTNG_HIDDEN extern const char *const mi_lttng_element_event_rule_event_name; | |
299 | LTTNG_HIDDEN extern const char *const mi_lttng_element_event_rule_name_pattern; | |
300 | LTTNG_HIDDEN extern const char | |
301 | *const mi_lttng_element_event_rule_filter_expression; | |
302 | LTTNG_HIDDEN extern const char *const mi_lttng_element_event_rule_jul_logging; | |
303 | LTTNG_HIDDEN extern const char *const mi_lttng_element_event_rule_kernel_kprobe; | |
304 | LTTNG_HIDDEN extern const char *const mi_lttng_element_event_rule_kernel_syscall; | |
305 | LTTNG_HIDDEN extern const char | |
306 | *const mi_lttng_element_event_rule_kernel_tracepoint; | |
307 | LTTNG_HIDDEN extern const char *const mi_lttng_element_event_rule_kernel_uprobe; | |
308 | LTTNG_HIDDEN extern const char *const mi_lttng_element_event_rule_log4j_logging; | |
309 | LTTNG_HIDDEN extern const char *const mi_lttng_element_event_rule_python_logging; | |
310 | LTTNG_HIDDEN extern const char | |
311 | *const mi_lttng_element_event_rule_user_tracepoint; | |
312 | ||
313 | /* String related to lttng_event_rule_kernel_syscall. */ | |
314 | LTTNG_HIDDEN extern const char | |
315 | *const mi_lttng_element_event_rule_kernel_syscall_emission_site; | |
316 | ||
317 | /* String related to enum lttng_event_rule_kernel_syscall_emission_site. */ | |
318 | LTTNG_HIDDEN extern const char *const | |
319 | mi_lttng_event_rule_kernel_syscall_emission_site_entry_exit; | |
320 | LTTNG_HIDDEN extern const char | |
321 | *const mi_lttng_event_rule_kernel_syscall_emission_site_entry; | |
322 | LTTNG_HIDDEN extern const char | |
323 | *const mi_lttng_event_rule_kernel_syscall_emission_site_exit; | |
324 | ||
325 | LTTNG_HIDDEN extern const char *const | |
326 | mi_lttng_element_event_rule_user_tracepoint_name_pattern_exclusions; | |
327 | LTTNG_HIDDEN extern const char *const | |
328 | mi_lttng_element_event_rule_user_tracepoint_name_pattern_exclusion; | |
329 | ||
330 | /* String related to log level rule. */ | |
331 | LTTNG_HIDDEN extern const char *const mi_lttng_element_log_level_rule; | |
332 | LTTNG_HIDDEN extern const char *const mi_lttng_element_log_level_rule_exactly; | |
333 | LTTNG_HIDDEN extern const char | |
334 | *const mi_lttng_element_log_level_rule_at_least_as_severe_as; | |
335 | LTTNG_HIDDEN extern const char *const | |
336 | mi_lttng_element_log_level_rule_at_least_as_severe_as_thre; | |
337 | LTTNG_HIDDEN extern const char *const mi_lttng_element_log_level_rule_level; | |
338 | ||
339 | /* String related to kernel probe location. */ | |
340 | LTTNG_HIDDEN extern const char *const mi_lttng_element_kernel_probe_location; | |
341 | LTTNG_HIDDEN extern const char | |
342 | *const mi_lttng_element_kernel_probe_location_symbol_offset; | |
343 | LTTNG_HIDDEN extern const char *const | |
344 | mi_lttng_element_kernel_probe_location_symbol_offset_name; | |
345 | LTTNG_HIDDEN extern const char *const | |
346 | mi_lttng_element_kernel_probe_location_symbol_offset_offset; | |
347 | LTTNG_HIDDEN extern const char | |
348 | *const mi_lttng_element_kernel_probe_location_address; | |
349 | LTTNG_HIDDEN extern const char | |
350 | *const mi_lttng_element_kernel_probe_location_address_address; | |
351 | ||
352 | /* String related to userspace probe location. */ | |
353 | LTTNG_HIDDEN extern const char *const mi_lttng_element_userspace_probe_location; | |
354 | LTTNG_HIDDEN extern const char | |
355 | *const mi_lttng_element_userspace_probe_location_binary_path; | |
356 | LTTNG_HIDDEN extern const char | |
357 | *const mi_lttng_element_userspace_probe_location_function; | |
358 | LTTNG_HIDDEN extern const char | |
359 | *const mi_lttng_element_userspace_probe_location_function_name; | |
360 | LTTNG_HIDDEN extern const char | |
361 | *const mi_lttng_element_userspace_probe_location_lookup_method; | |
362 | LTTNG_HIDDEN extern const char *const | |
363 | mi_lttng_element_userspace_probe_location_lookup_method_function_default; | |
364 | LTTNG_HIDDEN extern const char *const | |
365 | mi_lttng_element_userspace_probe_location_lookup_method_function_elf; | |
366 | LTTNG_HIDDEN extern const char *const | |
367 | mi_lttng_element_userspace_probe_location_lookup_method_tracepoint_sdt; | |
368 | LTTNG_HIDDEN extern const char | |
369 | *const mi_lttng_element_userspace_probe_location_tracepoint; | |
370 | LTTNG_HIDDEN extern const char *const | |
371 | mi_lttng_element_userspace_probe_location_tracepoint_probe_name; | |
372 | LTTNG_HIDDEN extern const char *const | |
373 | mi_lttng_element_userspace_probe_location_tracepoint_provider_name; | |
374 | ||
375 | /* String related to enum | |
376 | * lttng_userspace_probe_location_function_instrumentation_type */ | |
377 | LTTNG_HIDDEN extern const char *const | |
378 | mi_lttng_element_userspace_probe_location_function_instrumentation_type; | |
379 | LTTNG_HIDDEN extern const char *const | |
380 | mi_lttng_userspace_probe_location_function_instrumentation_type_entry; | |
381 | ||
382 | /* String related to trigger */ | |
383 | LTTNG_HIDDEN extern const char *const mi_lttng_element_triggers; | |
384 | LTTNG_HIDDEN extern const char *const mi_lttng_element_trigger; | |
385 | LTTNG_HIDDEN extern const char *const mi_lttng_element_trigger_owner_uid; | |
386 | ||
387 | /* String related to error_query. */ | |
388 | LTTNG_HIDDEN extern const char *const mi_lttng_element_error_query_result; | |
389 | LTTNG_HIDDEN extern const char | |
390 | *const mi_lttng_element_error_query_result_counter; | |
391 | LTTNG_HIDDEN extern const char | |
392 | *const mi_lttng_element_error_query_result_counter_value; | |
393 | LTTNG_HIDDEN extern const char | |
394 | *const mi_lttng_element_error_query_result_description; | |
395 | LTTNG_HIDDEN extern const char *const mi_lttng_element_error_query_result_name; | |
396 | LTTNG_HIDDEN extern const char *const mi_lttng_element_error_query_result_type; | |
397 | LTTNG_HIDDEN extern const char *const mi_lttng_element_error_query_results; | |
398 | ||
59deec0c JR |
399 | /* String related to add-context command */ |
400 | LTTNG_HIDDEN extern const char * const mi_lttng_element_context_symbol; | |
401 | ||
5e18ec73 | 402 | /* Utility string function */ |
970d848b | 403 | const char *mi_lttng_loglevel_string(int value, enum lttng_domain_type domain); |
5e18ec73 JR |
404 | const char *mi_lttng_logleveltype_string(enum lttng_loglevel_type value); |
405 | const char *mi_lttng_eventfieldtype_string(enum lttng_event_field_type value); | |
406 | const char *mi_lttng_domaintype_string(enum lttng_domain_type value); | |
407 | const char *mi_lttng_buffertype_string(enum lttng_buffer_type value); | |
91c4d516 JG |
408 | const char *mi_lttng_rotation_state_string(enum lttng_rotation_state value); |
409 | const char *mi_lttng_trace_archive_location_relay_protocol_type_string( | |
410 | enum lttng_trace_archive_location_relay_protocol_type value); | |
5e18ec73 | 411 | |
c7e35b03 JR |
412 | /* |
413 | * Create an instance of a machine interface writer. | |
414 | * | |
415 | * fd_output File to which the XML content must be written. The file will be | |
416 | * closed once the mi_writer has been destroyed. | |
417 | * | |
418 | * Returns an instance of a machine interface writer on success, NULL on | |
419 | * error. | |
420 | */ | |
421 | struct mi_writer *mi_lttng_writer_create(int fd_output, int mi_output_type); | |
422 | ||
423 | /* | |
424 | * Destroy an instance of a machine interface writer. | |
425 | * | |
426 | * writer An instance of a machine interface writer. | |
427 | * | |
428 | * Returns zero if the XML document could be closed cleanly. Negative values | |
429 | * indicate an error. | |
430 | */ | |
431 | int mi_lttng_writer_destroy(struct mi_writer *writer); | |
432 | ||
433 | /* | |
434 | * Open a command tag and add it's name node. | |
435 | * | |
436 | * writer An instance of a machine interface writer. | |
c7e35b03 JR |
437 | * command The command name. |
438 | * | |
439 | * Returns zero if the XML document could be closed cleanly. | |
440 | * Negative values indicate an error. | |
441 | */ | |
442 | int mi_lttng_writer_command_open(struct mi_writer *writer, const char *command); | |
443 | ||
444 | /* | |
445 | * Close a command tag. | |
446 | * | |
447 | * writer An instance of a machine interface writer. | |
448 | * | |
449 | * Returns zero if the XML document could be closed cleanly. | |
450 | * Negative values indicate an error. | |
451 | */ | |
452 | int mi_lttng_writer_command_close(struct mi_writer *writer); | |
453 | ||
454 | /* | |
455 | * Open an element tag. | |
456 | * | |
457 | * writer An instance of a machine interface writer. | |
c7e35b03 JR |
458 | * element_name Element tag name. |
459 | * | |
460 | * Returns zero if the XML document could be closed cleanly. | |
461 | * Negative values indicate an error. | |
462 | */ | |
463 | int mi_lttng_writer_open_element(struct mi_writer *writer, | |
464 | const char *element_name); | |
465 | ||
466 | /* | |
467 | * Close the current element tag. | |
468 | * | |
469 | * writer An instance of a machine interface writer. | |
470 | * | |
471 | * Returns zero if the XML document could be closed cleanly. | |
472 | * Negative values indicate an error. | |
473 | */ | |
474 | int mi_lttng_writer_close_element(struct mi_writer *writer); | |
475 | ||
476 | /* | |
5e18ec73 | 477 | * Close multiple element. |
c7e35b03 JR |
478 | * |
479 | * writer An instance of a machine interface writer. | |
5e18ec73 | 480 | * nb_element Number of elements. |
c7e35b03 | 481 | * |
5e18ec73 JR |
482 | * Returns zero if the XML document could be closed cleanly. |
483 | * Negative values indicate an error. | |
484 | */ | |
485 | int mi_lttng_close_multi_element(struct mi_writer *writer, | |
486 | unsigned int nb_element); | |
487 | ||
488 | /* | |
489 | * Write an element of type unsigned int. | |
c7e35b03 | 490 | * |
5e18ec73 JR |
491 | * writer An instance of a machine interface writer. |
492 | * element_name Element name. | |
c7e35b03 JR |
493 | * value Unsigned int value of the element |
494 | * | |
495 | * Returns zero if the element's value could be written. | |
496 | * Negative values indicate an error. | |
497 | */ | |
498 | int mi_lttng_writer_write_element_unsigned_int(struct mi_writer *writer, | |
499 | const char *element_name, uint64_t value); | |
500 | ||
501 | /* | |
502 | * Write an element of type signed int. | |
503 | * | |
504 | * writer An instance of a machine interface writer. | |
c7e35b03 | 505 | * element_name Element name. |
5e18ec73 | 506 | * value Signed int value of the element. |
c7e35b03 JR |
507 | * |
508 | * Returns zero if the element's value could be written. | |
509 | * Negative values indicate an error. | |
510 | */ | |
511 | int mi_lttng_writer_write_element_signed_int(struct mi_writer *writer, | |
512 | const char *element_name, int64_t value); | |
513 | ||
514 | /* | |
515 | * Write an element of type boolean. | |
516 | * | |
517 | * writer An instance of a machine interface writer. | |
c7e35b03 | 518 | * element_name Element name. |
5e18ec73 | 519 | * value Boolean value of the element. |
c7e35b03 JR |
520 | * |
521 | * Returns zero if the element's value could be written. | |
522 | * Negative values indicate an error. | |
523 | */ | |
524 | int mi_lttng_writer_write_element_bool(struct mi_writer *writer, | |
525 | const char *element_name, int value); | |
526 | ||
527 | /* | |
528 | * Write an element of type string. | |
529 | * | |
530 | * writer An instance of a machine interface writer. | |
c7e35b03 | 531 | * element_name Element name. |
5e18ec73 | 532 | * value String value of the element. |
c7e35b03 JR |
533 | * |
534 | * Returns zero if the element's value could be written. | |
535 | * Negative values indicate an error. | |
536 | */ | |
537 | int mi_lttng_writer_write_element_string(struct mi_writer *writer, | |
538 | const char *element_name, const char *value); | |
539 | ||
7c9e11fd JR |
540 | /* |
541 | * Write an element of type double. | |
542 | * | |
543 | * writer An instance of a machine interface writer. | |
544 | * element_name Element name. | |
545 | * value Double value of the element. | |
546 | * | |
547 | * Returns zero if the element's value could be written. | |
548 | * Negative values indicate an error. | |
549 | */ | |
550 | int mi_lttng_writer_write_element_double(struct mi_writer *writer, | |
551 | const char *element_name, | |
552 | double value); | |
553 | ||
c7e35b03 JR |
554 | /* |
555 | * Machine interface of struct version. | |
556 | * | |
557 | * writer An instance of a machine interface writer. | |
c7e35b03 | 558 | * version Version struct. |
c7e35b03 | 559 | * lttng_description String value of the version description. |
c7e35b03 JR |
560 | * lttng_license String value of the version license. |
561 | * | |
562 | * Returns zero if the element's value could be written. | |
563 | * Negative values indicate an error. | |
564 | */ | |
565 | int mi_lttng_version(struct mi_writer *writer, struct mi_lttng_version *version, | |
566 | const char *lttng_description, const char *lttng_license); | |
567 | ||
568 | /* | |
5e18ec73 | 569 | * Machine interface: open a sessions element. |
c7e35b03 | 570 | * |
5e18ec73 | 571 | * writer An instance of a machine interface writer. |
c7e35b03 | 572 | * |
5e18ec73 JR |
573 | * Returns zero if the element's value could be written. |
574 | * Negative values indicate an error. | |
575 | */ | |
576 | int mi_lttng_sessions_open(struct mi_writer *writer); | |
577 | ||
578 | /* | |
579 | * Machine interface of struct session. | |
c7e35b03 | 580 | * |
5e18ec73 JR |
581 | * writer An instance of a machine interface writer. |
582 | * session An instance of a session. | |
583 | * is_open Defines whether or not the session element shall be closed. | |
584 | * This should be used carefully and the client | |
585 | * must close the session element. | |
136f2f81 | 586 | * Use case: nested additional information on a session |
c7e35b03 | 587 | * ex: domain,channel event. |
c7e35b03 JR |
588 | * |
589 | * Returns zero if the element's value could be written. | |
590 | * Negative values indicate an error. | |
591 | */ | |
592 | int mi_lttng_session(struct mi_writer *writer, | |
5e18ec73 JR |
593 | struct lttng_session *session, int is_open); |
594 | ||
595 | /* | |
596 | * Machine interface: open a domains element. | |
597 | * | |
598 | * writer An instance of a machine interface writer. | |
599 | * | |
600 | * Returns zero if the element's value could be written. | |
601 | * Negative values indicate an error. | |
602 | */ | |
603 | int mi_lttng_domains_open(struct mi_writer *writer); | |
604 | ||
605 | /* | |
606 | * Machine interface of struct domain. | |
607 | * | |
608 | * writer An instance of a machine interface writer. | |
609 | * domain An instance of a domain. | |
610 | * | |
611 | * is_open Defines whether or not the session element shall be closed. | |
612 | * This should be used carefully and the client | |
613 | * must close the domain element. | |
614 | * Use case: nested addition information on a domain | |
615 | * ex: channel event. | |
616 | * | |
617 | * Returns zero if the element's value could be written. | |
618 | * Negative values indicate an error. | |
619 | */ | |
620 | int mi_lttng_domain(struct mi_writer *writer, | |
621 | struct lttng_domain *domain, int is_open); | |
622 | ||
623 | /* | |
624 | * Machine interface: open a channels element. | |
625 | * | |
626 | * writer An instance of a machine interface writer. | |
627 | * | |
628 | * Returns zero if the element's value could be written. | |
629 | * Negative values indicate an error. | |
630 | */ | |
631 | int mi_lttng_channels_open(struct mi_writer *writer); | |
632 | ||
633 | /* | |
634 | * Machine interface of struct channel. | |
635 | * | |
636 | * writer An instance of a machine interface writer. | |
637 | * channel An instance of a channel. | |
638 | * | |
639 | * is_open Defines whether or not the session element shall be closed. | |
640 | * This should be used carefully and the client | |
641 | * must close the channel element. | |
642 | * Use case: nested addition information on a channel. | |
643 | * ex: channel event. | |
644 | * | |
645 | * Returns zero if the element's value could be written. | |
646 | * Negative values indicate an error. | |
647 | */ | |
648 | int mi_lttng_channel(struct mi_writer *writer, | |
649 | struct lttng_channel *channel, int is_open); | |
650 | ||
651 | /* | |
652 | * Machine interface of struct channel_attr. | |
653 | * | |
654 | * writer An instance of a machine interface writer. | |
655 | * attr An instance of a channel_attr struct. | |
656 | * | |
657 | * Returns zero if the element's value could be written. | |
658 | * Negative values indicate an error. | |
659 | */ | |
660 | int mi_lttng_channel_attr(struct mi_writer *writer, | |
661 | struct lttng_channel_attr *attr); | |
662 | ||
663 | /* | |
664 | * Machine interface for event common attributes. | |
665 | * | |
666 | * writer An instance of a mi writer. | |
667 | * event single trace event. | |
668 | * | |
669 | * The common attribute are: | |
670 | * - mi event element | |
671 | * - event name | |
672 | * - event type | |
673 | * - enabled tag | |
674 | * - event filter | |
675 | * | |
676 | * Returns zero if the element's value could be written. | |
677 | * Negative values indicate an error. | |
678 | */ | |
679 | int mi_lttng_event_common_attributes(struct mi_writer *writer, | |
680 | struct lttng_event *event); | |
681 | ||
682 | /* | |
683 | * Machine interface for kernel tracepoint event with a loglevel. | |
684 | * | |
685 | * writer An instance of a mi writer. | |
686 | * event single trace event. | |
970d848b | 687 | * domain Event's domain |
5e18ec73 JR |
688 | * |
689 | * Returns zero if the element's value could be written. | |
690 | * Negative values indicate an error. | |
691 | */ | |
692 | int mi_lttng_event_tracepoint_loglevel(struct mi_writer *writer, | |
970d848b | 693 | struct lttng_event *event, enum lttng_domain_type domain); |
5e18ec73 JR |
694 | |
695 | /* | |
696 | * Machine interface for kernel tracepoint event with no loglevel. | |
697 | * | |
698 | * writer An instance of a mi writer. | |
699 | * event single trace event. | |
700 | * | |
701 | * Returns zero if the element's value could be written. | |
702 | * Negative values indicate an error. | |
703 | */ | |
704 | int mi_lttng_event_tracepoint_no_loglevel(struct mi_writer *writer, | |
705 | struct lttng_event *event); | |
706 | ||
707 | /* | |
708 | * Machine interface for kernel function and probe event. | |
709 | * | |
710 | * writer An instance of a mi writer. | |
711 | * event single trace event. | |
712 | * | |
713 | * Returns zero if the element's value could be written. | |
714 | * Negative values indicate an error. | |
715 | */ | |
716 | int mi_lttng_event_function_probe(struct mi_writer *writer, | |
717 | struct lttng_event *event); | |
718 | ||
719 | /* | |
720 | * Machine interface for kernel function entry event. | |
721 | * | |
722 | * writer An instance of a mi writer. | |
723 | * event single trace event. | |
724 | * | |
725 | * Returns zero if the element's value could be written. | |
726 | * Negative values indicate an error. | |
727 | */ | |
728 | int mi_lttng_event_function_entry(struct mi_writer *writer, | |
729 | struct lttng_event *event); | |
730 | ||
731 | /* | |
732 | * Machine interface: open an events element. | |
733 | * | |
734 | * writer An instance of a machine interface writer. | |
735 | * | |
736 | * Returns zero if the element's value could be written. | |
737 | * Negative values indicate an error. | |
738 | */ | |
739 | int mi_lttng_events_open(struct mi_writer *writer); | |
740 | ||
741 | /* | |
742 | * Machine interface for printing an event. | |
743 | * The trace event type currently supported are: | |
744 | * TRACEPOINT, | |
745 | * PROBE, | |
746 | * FUNCTION, | |
747 | * FUNCTION_ENTRY, | |
748 | * SYSCALL | |
749 | * | |
750 | * writer An instance of a mi writer. | |
751 | * event single trace event. | |
752 | * is_open Defines whether or not the session element shall be closed. | |
753 | * This should be used carefully and the client | |
754 | * must close the event element. | |
755 | * Use case: nested additional information | |
970d848b | 756 | * domain Event's domain |
5e18ec73 JR |
757 | * |
758 | * Returns zero if the element's value could be written. | |
759 | * Negative values indicate an error. | |
760 | */ | |
761 | int mi_lttng_event(struct mi_writer *writer, struct lttng_event *event, | |
970d848b | 762 | int is_open, enum lttng_domain_type domain); |
5e18ec73 JR |
763 | |
764 | /* | |
765 | * Machine interface for struct lttng_event_field. | |
766 | * | |
767 | * writer An instance of a mi writer. | |
768 | * field An event_field instance. | |
769 | * | |
770 | * Returns zero if the element's value could be written. | |
771 | * Negative values indicate an error. | |
772 | */ | |
773 | int mi_lttng_event_field(struct mi_writer *writer, | |
774 | struct lttng_event_field *field); | |
775 | ||
776 | /* | |
777 | * Machine interface: open a event_fields element. | |
778 | * | |
779 | * writer An instance of a machine interface writer. | |
780 | * | |
e4d484a5 | 781 | * Returns zero if the element have be written. |
5e18ec73 JR |
782 | * Negative values indicate an error. |
783 | */ | |
784 | int mi_lttng_event_fields_open(struct mi_writer *writer); | |
785 | ||
ebbf5ab7 JR |
786 | /* |
787 | * Machine interface: open a trackers element. | |
788 | * | |
789 | * writer An instance of a machine interface writer. | |
790 | * | |
791 | * Returns zero if the element's value could be written. | |
792 | * Negative values indicate an error. | |
793 | */ | |
794 | int mi_lttng_trackers_open(struct mi_writer *writer); | |
795 | ||
796 | /* | |
159b042f | 797 | * Machine interface: open a process attribute tracker element. |
ebbf5ab7 JR |
798 | * |
799 | * writer An instance of a machine interface writer. | |
800 | * | |
801 | * Returns zero if the element's value could be written. | |
802 | * Negative values indicate an error. | |
803 | * | |
804 | * Note: A targets element is also opened for each tracker definition | |
805 | */ | |
159b042f JG |
806 | int mi_lttng_process_attribute_tracker_open( |
807 | struct mi_writer *writer, enum lttng_process_attr process_attr); | |
ebbf5ab7 | 808 | |
5e18ec73 JR |
809 | /* |
810 | * Machine interface: open a PIDs element. | |
811 | * | |
812 | * writer An instance of a machine interface writer. | |
813 | * | |
814 | * Returns zero if the element's value could be written. | |
815 | * Negative values indicate an error. | |
816 | */ | |
817 | int mi_lttng_pids_open(struct mi_writer *writer); | |
818 | ||
819 | /* | |
ebbf5ab7 JR |
820 | * Machine interface: open a processes element. |
821 | * | |
822 | * writer An instance of a machine interface writer. | |
823 | * | |
824 | * Returns zero if the element's value could be written. | |
825 | * Negative values indicate an error. | |
826 | */ | |
827 | int mi_lttng_processes_open(struct mi_writer *writer); | |
828 | ||
829 | /* | |
830 | * Machine interface of a Process. | |
5e18ec73 JR |
831 | * |
832 | * writer An instance of a machine interface writer. | |
833 | * pid A PID. | |
834 | * | |
835 | * is_open Defines whether or not the session element shall be closed. | |
836 | * This should be used carefully and the client | |
837 | * must close the pid element. | |
838 | * Use case: nested addition information on a domain | |
839 | * ex: channel event. | |
840 | * | |
841 | * Returns zero if the element's value could be written. | |
842 | * Negative values indicate an error. | |
843 | */ | |
ebbf5ab7 | 844 | int mi_lttng_process(struct mi_writer *writer, pid_t pid , const char *name, |
5e18ec73 | 845 | int is_open); |
bf239d4c JR |
846 | |
847 | /* | |
848 | * TODO: move pid of lttng list -u to process semantic on mi api bump | |
849 | * Machine interface of a Process. | |
850 | * | |
851 | * writer An instance of a machine interface writer. | |
852 | * pid A PID. | |
853 | * | |
854 | * is_open Defines whether or not the session element shall be closed. | |
855 | * This should be used carefully and the client | |
856 | * must close the pid element. | |
857 | * Use case: nested addition information on a domain | |
858 | * ex: channel event. | |
859 | * | |
860 | * Returns zero if the element's value could be written. | |
861 | * Negative values indicate an error. | |
862 | */ | |
863 | int mi_lttng_pid(struct mi_writer *writer, pid_t pid , const char *name, | |
864 | int is_open); | |
159b042f | 865 | |
ebbf5ab7 | 866 | /* |
159b042f | 867 | * Machine interface: open a process attribute values element. |
ebbf5ab7 JR |
868 | * |
869 | * writer An instance of a machine interface writer. | |
870 | * | |
871 | * Returns zero if the element's value could be written. | |
872 | * Negative values indicate an error. | |
873 | */ | |
159b042f | 874 | int mi_lttng_process_attr_values_open(struct mi_writer *writer); |
ebbf5ab7 JR |
875 | |
876 | /* | |
159b042f | 877 | * Machine interface for track/untrack of all process attribute values. |
ebbf5ab7 JR |
878 | * |
879 | * writer An instance of a machine interface writer. | |
880 | * | |
881 | * Returns zero if the element's value could be written. | |
882 | * Negative values indicate an error. | |
883 | */ | |
159b042f JG |
884 | int mi_lttng_all_process_attribute_value(struct mi_writer *writer, |
885 | enum lttng_process_attr process_attr, | |
886 | bool is_open); | |
887 | ||
888 | /* | |
889 | * Machine interface for track/untrack of an integral process attribute value. | |
890 | * | |
891 | * writer An instance of a machine interface writer. | |
892 | * | |
893 | * Returns zero if the element's value could be written. | |
894 | * Negative values indicate an error. | |
895 | */ | |
896 | int mi_lttng_integral_process_attribute_value(struct mi_writer *writer, | |
897 | enum lttng_process_attr process_attr, | |
898 | int64_t value, | |
899 | bool is_open); | |
900 | ||
901 | /* | |
902 | * Machine interface for track/untrack of a string process attribute value. | |
903 | * | |
904 | * writer An instance of a machine interface writer. | |
905 | * | |
906 | * Returns zero if the element's value could be written. | |
907 | * Negative values indicate an error. | |
908 | */ | |
909 | int mi_lttng_string_process_attribute_value(struct mi_writer *writer, | |
910 | enum lttng_process_attr process_attr, | |
911 | const char *value, | |
912 | bool is_open); | |
c7e35b03 | 913 | |
89b72577 JRJ |
914 | /* |
915 | * Machine interface of a context. | |
916 | * | |
917 | * writer An instance of a machine interface writer | |
918 | * | |
919 | * context An instance of a lttng_event_context | |
920 | * | |
921 | * is_open Define if we close the context element | |
922 | * This should be used carefully and the client | |
923 | * need to close the context element. | |
89b72577 JRJ |
924 | * Returns zero if the element's value could be written. |
925 | * Negative values indicate an error. | |
926 | */ | |
927 | int mi_lttng_context(struct mi_writer *writer, | |
928 | struct lttng_event_context *context, int is_open); | |
929 | ||
930 | /* | |
931 | * Machine interface of a perf_counter_context. | |
932 | * | |
933 | * writer An instance of a machine interface writer | |
934 | * | |
935 | * contest An instance of a lttng_event_perf_counter_ctx | |
936 | * | |
937 | * Returns zero if the element's value could be written. | |
938 | * Negative values indicate an error. | |
939 | */ | |
940 | int mi_lttng_perf_counter_context(struct mi_writer *writer, | |
941 | struct lttng_event_perf_counter_ctx *perf_context); | |
942 | ||
50534d6f JRJ |
943 | /* |
944 | * Machine interface of the snapshot list_output. | |
945 | * It specifies the session for which we are listing snapshots, | |
946 | * and it opens a snapshots element to list a sequence | |
947 | * of snapshots. | |
948 | * | |
949 | * writer An instance of a machine interface writer. | |
950 | * | |
951 | * session_name: Snapshot output for session "session_name". | |
952 | * | |
953 | * Note: The client has to close the session and the snapshots elements after | |
954 | * having listed every lttng_snapshot_output. | |
955 | * | |
956 | * Returns zero if the element's value could be written. | |
957 | * Negative values indicate an error. | |
958 | */ | |
959 | int mi_lttng_snapshot_output_session_name(struct mi_writer *writer, | |
960 | const char *session_name); | |
961 | ||
962 | /* | |
963 | * Machine interface of the snapshot output. | |
964 | * The machine interface serializes the following attributes: | |
965 | * - id: ID of the snapshot output. | |
966 | * - name: Name of the output. | |
967 | * - data_url : Destination of the output. | |
968 | * - ctrl_url: Destination of the output. | |
969 | * - max_size: total size of all stream combined. | |
970 | * | |
971 | * writer An instance of a machine interface writer. | |
972 | * | |
973 | * output: A list of snapshot_output. | |
974 | * | |
975 | * Returns zero if the element's value could be written. | |
976 | * Negative values indicate an error. | |
977 | */ | |
978 | int mi_lttng_snapshot_list_output(struct mi_writer *writer, | |
0f7c2963 | 979 | const struct lttng_snapshot_output *output); |
50534d6f JRJ |
980 | |
981 | /* | |
982 | * Machine interface of the output of the command snapshot del output | |
983 | * when deleting a snapshot either by id or by name. | |
984 | * If the snapshot was found and successfully deleted using its id, | |
985 | * it return the id of the snapshot and the current session name on which it | |
986 | * was attached. | |
987 | * | |
988 | * Otherwise, it do the same process with the name of the snapshot, if the | |
989 | * snapshot output id is undefined. | |
990 | * | |
991 | * writer An instance of a machine interface writer. | |
992 | * | |
993 | * id: ID of the snapshot output. | |
994 | * | |
995 | * name: Name of the snapshot. | |
996 | * | |
997 | * current_session_name: Session to which the snapshot belongs. | |
998 | * | |
999 | * Returns zero if the element's value could be written. | |
1000 | * Negative values indicate an error. | |
1001 | */ | |
1002 | int mi_lttng_snapshot_del_output(struct mi_writer *writer, int id, | |
1003 | const char *name, const char *current_session_name); | |
1004 | ||
1005 | /* | |
1006 | * Machine interface of the output of the command snapshot add output | |
1007 | * when adding a snapshot from a user URL. | |
1008 | * | |
1009 | * If the snapshot was successfully added, the machine interface lists | |
1010 | * these information: | |
1011 | * - id: ID of the newly add snapshot output. | |
1012 | * - current_session_name: Name of the session to which the output was added. | |
1013 | * - ctrl_url: Destination of the output. | |
1014 | * - max_size: total size of all stream combined. | |
1015 | * | |
1016 | * writer An instance of a machine interface writer. | |
1017 | * | |
1018 | * current_session_name: Session to which the snapshot belongs. | |
1019 | * | |
1020 | * n_ptr: | |
1021 | * | |
1022 | * output: iterator over a lttng_snapshot_output_list which contain | |
1023 | * the snapshot output informations. | |
1024 | * | |
1025 | * Returns zero if the element's value could be written. | |
1026 | * Negative values indicate an error. | |
1027 | */ | |
1028 | int mi_lttng_snapshot_add_output(struct mi_writer *writer, | |
1029 | const char *current_session_name, const char *n_ptr, | |
1030 | struct lttng_snapshot_output *output); | |
1031 | ||
1032 | /* | |
1033 | * Machine interface of the output of the command snapshot | |
1034 | * record from a URL (if given). | |
1035 | * | |
1036 | * If the snapshot is successfully recorded from a url, the machine interface | |
1037 | * output the following information: | |
1038 | * - url: Destination of the output stored in the snapshot. | |
1039 | * | |
1040 | * Otherwise, the machine interface output the data and ctrl url received | |
1041 | * from the command-line. | |
1042 | * | |
1043 | * writer An instance of a machine interface writer. | |
1044 | * | |
1045 | * current_session_name: Snapshot record for session "current_session_name". | |
1046 | * | |
1047 | * ctrl_url, data_url: Destination of the output receive from the command-line. | |
1048 | * | |
1049 | * Returns zero if the element's value could be written. | |
1050 | * Negative values indicate an error. | |
1051 | */ | |
1052 | int mi_lttng_snapshot_record(struct mi_writer *writer, | |
1053 | const char *current_session_name, const char *url, | |
1054 | const char *cmdline_ctrl_url, const char *cmdline_data_url); | |
1055 | ||
66ea93b1 JG |
1056 | /* |
1057 | * Machine interface representation of a session rotation schedule. | |
1058 | * | |
1059 | * The machine interface serializes the provided schedule as one of the choices | |
1060 | * from 'rotation_schedule_type'. | |
1061 | * | |
1062 | * writer: An instance of a machine interface writer. | |
1063 | * | |
1064 | * schedule: An lttng rotation schedule descriptor object. | |
1065 | * | |
1066 | * Returns zero if the element's value could be written. | |
1067 | * Negative values indicate an error. | |
1068 | */ | |
1069 | int mi_lttng_rotation_schedule(struct mi_writer *writer, | |
1070 | const struct lttng_rotation_schedule *schedule); | |
1071 | ||
1072 | /* | |
1073 | * Machine interface of a session rotation schedule result. | |
1074 | * This is an element that is part of the output of the enable-rotation and | |
1075 | * disable-rotation commands. | |
1076 | * | |
1077 | * The machine interface provides the following information: | |
1078 | * - schedule: the session rotation schedule descriptor. | |
1079 | * - success: whether the sub-command succeeded. | |
1080 | * | |
1081 | * writer: An instance of a machine interface writer. | |
1082 | * | |
66ea93b1 JG |
1083 | * schedule: An lttng rotation schedule descriptor object. |
1084 | * | |
1085 | * success: Whether the sub-command suceeded. | |
1086 | * | |
1087 | * Returns zero if the element's value could be written. | |
1088 | * Negative values indicate an error. | |
1089 | */ | |
1090 | int mi_lttng_rotation_schedule_result(struct mi_writer *writer, | |
1091 | const struct lttng_rotation_schedule *schedule, | |
1092 | bool success); | |
1093 | ||
91c4d516 JG |
1094 | /* |
1095 | * Machine interface of a session rotation result. | |
1096 | * This is an element that is part of the output of the rotate command. | |
1097 | * | |
1098 | * The machine interface provides the following information: | |
1099 | * - session_name: the session to be rotated. | |
1100 | * - state: the session rotation state. | |
1101 | * - location: the location of the completed chunk archive. | |
1102 | * | |
1103 | * writer: An instance of a machine interface writer. | |
1104 | * | |
1105 | * session_name: The session to which the rotate command applies. | |
1106 | * | |
1107 | * location: A location descriptor object. | |
1108 | * | |
1109 | * success: Whether the sub-command suceeded. | |
1110 | * | |
1111 | * Returns zero if the element's value could be written. | |
1112 | * Negative values indicate an error. | |
1113 | */ | |
1114 | int mi_lttng_rotate(struct mi_writer *writer, | |
1115 | const char *session_name, | |
1116 | enum lttng_rotation_state rotation_state, | |
1117 | const struct lttng_trace_archive_location *location); | |
1118 | ||
c7e35b03 | 1119 | #endif /* _MI_LTTNG_H */ |