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