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