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