trackers: update list/track/untrack commands
[lttng-tools.git] / src / common / mi-lttng.h
CommitLineData
c7e35b03
JR
1/*
2 * Copyright (C) 2014 - Jonathan Rajotte <jonathan.r.julien@gmail.com>
3 * - Olivier Cotte <olivier.cotte@polymtl.ca>
a23cb78a 4 * Copyright (C) 2016 - Jérémie Galarneau <jeremie.galarneau@efficios.com>
c7e35b03
JR
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License, version 2 only, as
8 * published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
14 *
15 * You should have received a copy of the GNU General Public License along with
16 * this program; if not, write to the Free Software Foundation, Inc., 51
17 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19
20#ifndef _MI_LTTNG_H
21#define _MI_LTTNG_H
22
23#include <stdint.h>
24
25#include <common/error.h>
26#include <common/macros.h>
f40ef1d5 27#include <common/config/session-config.h>
c7e35b03
JR
28#include <lttng/lttng.h>
29
50534d6f
JRJ
30/* Don't want to reference snapshot-internal.h here */
31struct lttng_snapshot_output;
32
c7e35b03
JR
33/* Instance of a machine interface writer. */
34struct mi_writer {
35 struct config_writer *writer;
36 enum lttng_mi_output_type type;
37};
38
39/*
40 * Version information for the machine interface.
41 */
42struct mi_lttng_version {
36d2e35d 43 char version[LTTNG_NAME_MAX]; /* Version number of package */
c7e35b03
JR
44 uint32_t version_major; /* LTTng-Tools major version number */
45 uint32_t version_minor; /* LTTng-Tools minor version number */
46 uint32_t version_patchlevel; /* LTTng-Tools patchlevel version number */
36d2e35d
MJ
47 char version_commit[LTTNG_NAME_MAX]; /* Commit hash of the current version */
48 char version_name[LTTNG_NAME_MAX];
49 char package_url[LTTNG_NAME_MAX]; /* Define to the home page for this package. */
c7e35b03
JR
50};
51
52/* Strings related to command */
4965f956
JG
53extern const char * const mi_lttng_element_command;
54extern const char * const mi_lttng_element_command_action;
55extern const char * const mi_lttng_element_command_add_context;
4965f956
JG
56extern const char * const mi_lttng_element_command_create;
57extern const char * const mi_lttng_element_command_destroy;
58extern const char * const mi_lttng_element_command_disable_channel;
59extern const char * const mi_lttng_element_command_disable_event;
60extern const char * const mi_lttng_element_command_enable_channels;
61extern const char * const mi_lttng_element_command_enable_event;
62extern const char * const mi_lttng_element_command_list;
63extern const char * const mi_lttng_element_command_load;
54897b57
JD
64extern const char * const mi_lttng_element_command_metadata;
65extern const char * const mi_lttng_element_command_metadata_action;
eded6438
JD
66extern const char * const mi_lttng_element_command_regenerate;
67extern const char * const mi_lttng_element_command_regenerate_action;
4965f956
JG
68extern const char * const mi_lttng_element_command_name;
69extern const char * const mi_lttng_element_command_output;
70extern const char * const mi_lttng_element_command_save;
71extern const char * const mi_lttng_element_command_set_session;
72extern const char * const mi_lttng_element_command_snapshot;
73extern const char * const mi_lttng_element_command_snapshot_add;
74extern const char * const mi_lttng_element_command_snapshot_del;
75extern const char * const mi_lttng_element_command_snapshot_list;
76extern const char * const mi_lttng_element_command_snapshot_record;
77extern const char * const mi_lttng_element_command_start;
78extern const char * const mi_lttng_element_command_stop;
79extern const char * const mi_lttng_element_command_success;
80extern const char * const mi_lttng_element_command_track;
81extern const char * const mi_lttng_element_command_untrack;
82extern const char * const mi_lttng_element_command_version;
d68c9a04 83extern const char * const mi_lttng_element_command_rotate;
259c2674
JD
84extern const char * const mi_lttng_element_command_enable_rotation;
85extern const char * const mi_lttng_element_command_disable_rotation;
511ed4e2 86extern const char * const mi_lttng_element_command_clear;
c7e35b03 87
1734c658 88/* Strings related to version command */
4965f956
JG
89extern const char * const mi_lttng_element_version;
90extern const char * const mi_lttng_element_version_commit;
91extern const char * const mi_lttng_element_version_description;
92extern const char * const mi_lttng_element_version_license;
93extern const char * const mi_lttng_element_version_major;
94extern const char * const mi_lttng_element_version_minor;
95extern const char * const mi_lttng_element_version_patch_level;
96extern const char * const mi_lttng_element_version_str;
97extern const char * const mi_lttng_element_version_web;
c7e35b03 98
5e18ec73 99/* String related to a lttng_event_field */
4965f956
JG
100extern const char * const mi_lttng_element_event_field;
101extern const char * const mi_lttng_element_event_fields;
5e18ec73 102
89b72577 103/* String related to lttng_event_perf_counter_ctx */
4965f956 104extern const char * const mi_lttng_element_perf_counter_context;
89b72577 105
5e18ec73 106/* Strings related to pid */
4965f956 107extern const char * const mi_lttng_element_pid_id;
5e18ec73 108
1734c658 109/* Strings related to save command */
4965f956 110extern const char * const mi_lttng_element_save;
1734c658
JRJ
111
112/* Strings related to load command */
4965f956 113extern const char * const mi_lttng_element_load;
23cb2d55
JR
114LTTNG_HIDDEN const char * const mi_lttng_element_load_overrides;
115LTTNG_HIDDEN const char * const mi_lttng_element_load_override_url;
1734c658 116
5e18ec73 117/* General element of mi_lttng */
4965f956
JG
118extern const char * const mi_lttng_element_empty;
119extern const char * const mi_lttng_element_id;
120extern const char * const mi_lttng_element_nowrite;
121extern const char * const mi_lttng_element_success;
122extern const char * const mi_lttng_element_type_enum;
123extern const char * const mi_lttng_element_type_float;
124extern const char * const mi_lttng_element_type_integer;
125extern const char * const mi_lttng_element_type_other;
126extern const char * const mi_lttng_element_type_string;
5e18ec73
JR
127
128/* String related to loglevel */
4965f956
JG
129extern const char * const mi_lttng_loglevel_str_alert;
130extern const char * const mi_lttng_loglevel_str_crit;
131extern const char * const mi_lttng_loglevel_str_debug;
132extern const char * const mi_lttng_loglevel_str_debug_function;
133extern const char * const mi_lttng_loglevel_str_debug_line;
134extern const char * const mi_lttng_loglevel_str_debug_module;
135extern const char * const mi_lttng_loglevel_str_debug_process;
136extern const char * const mi_lttng_loglevel_str_debug_program;
137extern const char * const mi_lttng_loglevel_str_debug_system;
138extern const char * const mi_lttng_loglevel_str_debug_unit;
139extern const char * const mi_lttng_loglevel_str_emerg;
140extern const char * const mi_lttng_loglevel_str_err;
141extern const char * const mi_lttng_loglevel_str_info;
142extern const char * const mi_lttng_loglevel_str_notice;
143extern const char * const mi_lttng_loglevel_str_unknown;
144extern const char * const mi_lttng_loglevel_str_warning;
5e18ec73 145
136f2f81 146/* String related to loglevel JUL */
4965f956
JG
147extern const char * const mi_lttng_loglevel_str_jul_all;
148extern const char * const mi_lttng_loglevel_str_jul_config;
149extern const char * const mi_lttng_loglevel_str_jul_fine;
150extern const char * const mi_lttng_loglevel_str_jul_finer;
151extern const char * const mi_lttng_loglevel_str_jul_finest;
152extern const char * const mi_lttng_loglevel_str_jul_info;
153extern const char * const mi_lttng_loglevel_str_jul_off;
154extern const char * const mi_lttng_loglevel_str_jul_severe;
155extern const char * const mi_lttng_loglevel_str_jul_warning;
136f2f81 156
970d848b 157/* String related to loglevel Log4j */
4965f956
JG
158extern const char * const mi_lttng_loglevel_str_log4j_off;
159extern const char * const mi_lttng_loglevel_str_log4j_fatal;
160extern const char * const mi_lttng_loglevel_str_log4j_error;
161extern const char * const mi_lttng_loglevel_str_log4j_warn;
162extern const char * const mi_lttng_loglevel_str_log4j_info;
163extern const char * const mi_lttng_loglevel_str_log4j_debug;
164extern const char * const mi_lttng_loglevel_str_log4j_trace;
165extern const char * const mi_lttng_loglevel_str_log4j_all;
970d848b 166
0e115563 167/* String related to loglevel Python */
4965f956
JG
168extern const char * const mi_lttng_loglevel_str_python_critical;
169extern const char * const mi_lttng_loglevel_str_python_error;
170extern const char * const mi_lttng_loglevel_str_python_warning;
171extern const char * const mi_lttng_loglevel_str_python_info;
172extern const char * const mi_lttng_loglevel_str_python_debug;
173extern const char * const mi_lttng_loglevel_str_python_notset;
0e115563 174
1734c658 175/* String related to loglevel type */
4965f956
JG
176extern const char * const mi_lttng_loglevel_type_all;
177extern const char * const mi_lttng_loglevel_type_range;
178extern const char * const mi_lttng_loglevel_type_single;
179extern const char * const mi_lttng_loglevel_type_unknown;
5e18ec73 180
136f2f81 181/* String related to a lttng_snapshot */
4965f956
JG
182extern const char * const mi_lttng_element_snapshot_ctrl_url;
183extern const char * const mi_lttng_element_snapshot_data_url;
184extern const char * const mi_lttng_element_snapshot_max_size;
185extern const char * const mi_lttng_element_snapshot_n_ptr;
186extern const char * const mi_lttng_element_snapshot_session_name;
187extern const char * const mi_lttng_element_snapshots;
50534d6f 188
a23cb78a
JG
189/* String related to track/untrack command */
190const char * const mi_lttng_element_track_untrack_all_wildcard;
191
d68c9a04
JD
192LTTNG_HIDDEN const char * const mi_lttng_element_session_name;
193
194/* String related to rotate command */
195LTTNG_HIDDEN const char * const mi_lttng_element_rotation;
d68c9a04 196LTTNG_HIDDEN const char * const mi_lttng_element_rotate_status;
259c2674 197LTTNG_HIDDEN const char * const mi_lttng_element_rotation_schedule;
66ea93b1
JG
198LTTNG_HIDDEN const char * const mi_lttng_element_rotation_schedules;
199LTTNG_HIDDEN const char * const mi_lttng_element_rotation_schedule_periodic;
200LTTNG_HIDDEN const char * const mi_lttng_element_rotation_schedule_periodic_time_us;
201LTTNG_HIDDEN const char * const mi_lttng_element_rotation_schedule_size_threshold;
202LTTNG_HIDDEN const char * const mi_lttng_element_rotation_schedule_size_threshold_bytes;
203LTTNG_HIDDEN const char * const mi_lttng_element_rotation_schedule_result;
204LTTNG_HIDDEN const char * const mi_lttng_element_rotation_schedule_results;
91c4d516
JG
205LTTNG_HIDDEN const char * const mi_lttng_element_rotation_state;
206LTTNG_HIDDEN const char * const mi_lttng_element_rotation_location;
207LTTNG_HIDDEN const char * const mi_lttng_element_rotation_location_local;
208LTTNG_HIDDEN const char * const mi_lttng_element_rotation_location_local_absolute_path;
209LTTNG_HIDDEN const char * const mi_lttng_element_rotation_location_relay;
210LTTNG_HIDDEN const char * const mi_lttng_element_rotation_location_relay_host;
211LTTNG_HIDDEN const char * const mi_lttng_element_rotation_location_relay_control_port;
212LTTNG_HIDDEN const char * const mi_lttng_element_rotation_location_relay_data_port;
213LTTNG_HIDDEN const char * const mi_lttng_element_rotation_location_relay_protocol;
214LTTNG_HIDDEN const char * const mi_lttng_element_rotation_location_relay_relative_path;
215
216/* String related to enum lttng_rotation_state */
217LTTNG_HIDDEN const char * const mi_lttng_rotation_state_str_ongoing;
218LTTNG_HIDDEN const char * const mi_lttng_rotation_state_str_completed;
219LTTNG_HIDDEN const char * const mi_lttng_rotation_state_str_expired;
220LTTNG_HIDDEN const char * const mi_lttng_rotation_state_str_error;
221
222/* String related to enum lttng_trace_archive_location_relay_protocol_type */
223LTTNG_HIDDEN const char * const mi_lttng_rotation_location_relay_protocol_str_tcp;
d68c9a04 224
59deec0c
JR
225/* String related to add-context command */
226LTTNG_HIDDEN extern const char * const mi_lttng_element_context_symbol;
227
5e18ec73 228/* Utility string function */
970d848b 229const char *mi_lttng_loglevel_string(int value, enum lttng_domain_type domain);
5e18ec73
JR
230const char *mi_lttng_logleveltype_string(enum lttng_loglevel_type value);
231const char *mi_lttng_eventfieldtype_string(enum lttng_event_field_type value);
232const char *mi_lttng_domaintype_string(enum lttng_domain_type value);
233const char *mi_lttng_buffertype_string(enum lttng_buffer_type value);
91c4d516
JG
234const char *mi_lttng_rotation_state_string(enum lttng_rotation_state value);
235const char *mi_lttng_trace_archive_location_relay_protocol_type_string(
236 enum lttng_trace_archive_location_relay_protocol_type value);
5e18ec73 237
c7e35b03
JR
238/*
239 * Create an instance of a machine interface writer.
240 *
241 * fd_output File to which the XML content must be written. The file will be
242 * closed once the mi_writer has been destroyed.
243 *
244 * Returns an instance of a machine interface writer on success, NULL on
245 * error.
246 */
247struct mi_writer *mi_lttng_writer_create(int fd_output, int mi_output_type);
248
249/*
250 * Destroy an instance of a machine interface writer.
251 *
252 * writer An instance of a machine interface writer.
253 *
254 * Returns zero if the XML document could be closed cleanly. Negative values
255 * indicate an error.
256 */
257int mi_lttng_writer_destroy(struct mi_writer *writer);
258
259/*
260 * Open a command tag and add it's name node.
261 *
262 * writer An instance of a machine interface writer.
c7e35b03
JR
263 * command The command name.
264 *
265 * Returns zero if the XML document could be closed cleanly.
266 * Negative values indicate an error.
267 */
268int mi_lttng_writer_command_open(struct mi_writer *writer, const char *command);
269
270/*
271 * Close a command tag.
272 *
273 * writer An instance of a machine interface writer.
274 *
275 * Returns zero if the XML document could be closed cleanly.
276 * Negative values indicate an error.
277 */
278int mi_lttng_writer_command_close(struct mi_writer *writer);
279
280/*
281 * Open an element tag.
282 *
283 * writer An instance of a machine interface writer.
c7e35b03
JR
284 * element_name Element tag name.
285 *
286 * Returns zero if the XML document could be closed cleanly.
287 * Negative values indicate an error.
288 */
289int mi_lttng_writer_open_element(struct mi_writer *writer,
290 const char *element_name);
291
292/*
293 * Close the current element tag.
294 *
295 * writer An instance of a machine interface writer.
296 *
297 * Returns zero if the XML document could be closed cleanly.
298 * Negative values indicate an error.
299 */
300int mi_lttng_writer_close_element(struct mi_writer *writer);
301
302/*
5e18ec73 303 * Close multiple element.
c7e35b03
JR
304 *
305 * writer An instance of a machine interface writer.
5e18ec73 306 * nb_element Number of elements.
c7e35b03 307 *
5e18ec73
JR
308 * Returns zero if the XML document could be closed cleanly.
309 * Negative values indicate an error.
310 */
311int mi_lttng_close_multi_element(struct mi_writer *writer,
312 unsigned int nb_element);
313
314/*
315 * Write an element of type unsigned int.
c7e35b03 316 *
5e18ec73
JR
317 * writer An instance of a machine interface writer.
318 * element_name Element name.
c7e35b03
JR
319 * value Unsigned int value of the element
320 *
321 * Returns zero if the element's value could be written.
322 * Negative values indicate an error.
323 */
324int mi_lttng_writer_write_element_unsigned_int(struct mi_writer *writer,
325 const char *element_name, uint64_t value);
326
327/*
328 * Write an element of type signed int.
329 *
330 * writer An instance of a machine interface writer.
c7e35b03 331 * element_name Element name.
5e18ec73 332 * value Signed int value of the element.
c7e35b03
JR
333 *
334 * Returns zero if the element's value could be written.
335 * Negative values indicate an error.
336 */
337int mi_lttng_writer_write_element_signed_int(struct mi_writer *writer,
338 const char *element_name, int64_t value);
339
340/*
341 * Write an element of type boolean.
342 *
343 * writer An instance of a machine interface writer.
c7e35b03 344 * element_name Element name.
5e18ec73 345 * value Boolean value of the element.
c7e35b03
JR
346 *
347 * Returns zero if the element's value could be written.
348 * Negative values indicate an error.
349 */
350int mi_lttng_writer_write_element_bool(struct mi_writer *writer,
351 const char *element_name, int value);
352
353/*
354 * Write an element of type string.
355 *
356 * writer An instance of a machine interface writer.
c7e35b03 357 * element_name Element name.
5e18ec73 358 * value String value of the element.
c7e35b03
JR
359 *
360 * Returns zero if the element's value could be written.
361 * Negative values indicate an error.
362 */
363int mi_lttng_writer_write_element_string(struct mi_writer *writer,
364 const char *element_name, const char *value);
365
366/*
367 * Machine interface of struct version.
368 *
369 * writer An instance of a machine interface writer.
c7e35b03 370 * version Version struct.
c7e35b03 371 * lttng_description String value of the version description.
c7e35b03
JR
372 * lttng_license String value of the version license.
373 *
374 * Returns zero if the element's value could be written.
375 * Negative values indicate an error.
376 */
377int mi_lttng_version(struct mi_writer *writer, struct mi_lttng_version *version,
378 const char *lttng_description, const char *lttng_license);
379
380/*
5e18ec73 381 * Machine interface: open a sessions element.
c7e35b03 382 *
5e18ec73 383 * writer An instance of a machine interface writer.
c7e35b03 384 *
5e18ec73
JR
385 * Returns zero if the element's value could be written.
386 * Negative values indicate an error.
387 */
388int mi_lttng_sessions_open(struct mi_writer *writer);
389
390/*
391 * Machine interface of struct session.
c7e35b03 392 *
5e18ec73
JR
393 * writer An instance of a machine interface writer.
394 * session An instance of a session.
395 * is_open Defines whether or not the session element shall be closed.
396 * This should be used carefully and the client
397 * must close the session element.
136f2f81 398 * Use case: nested additional information on a session
c7e35b03 399 * ex: domain,channel event.
c7e35b03
JR
400 *
401 * Returns zero if the element's value could be written.
402 * Negative values indicate an error.
403 */
404int mi_lttng_session(struct mi_writer *writer,
5e18ec73
JR
405 struct lttng_session *session, int is_open);
406
407/*
408 * Machine interface: open a domains element.
409 *
410 * writer An instance of a machine interface writer.
411 *
412 * Returns zero if the element's value could be written.
413 * Negative values indicate an error.
414 */
415int mi_lttng_domains_open(struct mi_writer *writer);
416
417/*
418 * Machine interface of struct domain.
419 *
420 * writer An instance of a machine interface writer.
421 * domain An instance of a domain.
422 *
423 * is_open Defines whether or not the session element shall be closed.
424 * This should be used carefully and the client
425 * must close the domain element.
426 * Use case: nested addition information on a domain
427 * ex: channel event.
428 *
429 * Returns zero if the element's value could be written.
430 * Negative values indicate an error.
431 */
432int mi_lttng_domain(struct mi_writer *writer,
433 struct lttng_domain *domain, int is_open);
434
435/*
436 * Machine interface: open a channels element.
437 *
438 * writer An instance of a machine interface writer.
439 *
440 * Returns zero if the element's value could be written.
441 * Negative values indicate an error.
442 */
443int mi_lttng_channels_open(struct mi_writer *writer);
444
445/*
446 * Machine interface of struct channel.
447 *
448 * writer An instance of a machine interface writer.
449 * channel An instance of a channel.
450 *
451 * is_open Defines whether or not the session element shall be closed.
452 * This should be used carefully and the client
453 * must close the channel element.
454 * Use case: nested addition information on a channel.
455 * ex: channel event.
456 *
457 * Returns zero if the element's value could be written.
458 * Negative values indicate an error.
459 */
460int mi_lttng_channel(struct mi_writer *writer,
461 struct lttng_channel *channel, int is_open);
462
463/*
464 * Machine interface of struct channel_attr.
465 *
466 * writer An instance of a machine interface writer.
467 * attr An instance of a channel_attr struct.
468 *
469 * Returns zero if the element's value could be written.
470 * Negative values indicate an error.
471 */
472int mi_lttng_channel_attr(struct mi_writer *writer,
473 struct lttng_channel_attr *attr);
474
475/*
476* Machine interface for event common attributes.
477*
478* writer An instance of a mi writer.
479* event single trace event.
480*
481* The common attribute are:
482* - mi event element
483* - event name
484* - event type
485* - enabled tag
486* - event filter
487*
488* Returns zero if the element's value could be written.
489* Negative values indicate an error.
490*/
491int mi_lttng_event_common_attributes(struct mi_writer *writer,
492 struct lttng_event *event);
493
494/*
495 * Machine interface for kernel tracepoint event with a loglevel.
496 *
497 * writer An instance of a mi writer.
498 * event single trace event.
970d848b 499 * domain Event's domain
5e18ec73
JR
500 *
501 * Returns zero if the element's value could be written.
502 * Negative values indicate an error.
503 */
504int mi_lttng_event_tracepoint_loglevel(struct mi_writer *writer,
970d848b 505 struct lttng_event *event, enum lttng_domain_type domain);
5e18ec73
JR
506
507/*
508 * Machine interface for kernel tracepoint event with no loglevel.
509 *
510 * writer An instance of a mi writer.
511 * event single trace event.
512 *
513 * Returns zero if the element's value could be written.
514 * Negative values indicate an error.
515 */
516int mi_lttng_event_tracepoint_no_loglevel(struct mi_writer *writer,
517 struct lttng_event *event);
518
519/*
520 * Machine interface for kernel function and probe event.
521 *
522 * writer An instance of a mi writer.
523 * event single trace event.
524 *
525 * Returns zero if the element's value could be written.
526 * Negative values indicate an error.
527 */
528int mi_lttng_event_function_probe(struct mi_writer *writer,
529 struct lttng_event *event);
530
531/*
532 * Machine interface for kernel function entry event.
533 *
534 * writer An instance of a mi writer.
535 * event single trace event.
536 *
537 * Returns zero if the element's value could be written.
538 * Negative values indicate an error.
539 */
540int mi_lttng_event_function_entry(struct mi_writer *writer,
541 struct lttng_event *event);
542
543/*
544 * Machine interface: open an events element.
545 *
546 * writer An instance of a machine interface writer.
547 *
548 * Returns zero if the element's value could be written.
549 * Negative values indicate an error.
550 */
551int mi_lttng_events_open(struct mi_writer *writer);
552
553/*
554 * Machine interface for printing an event.
555 * The trace event type currently supported are:
556 * TRACEPOINT,
557 * PROBE,
558 * FUNCTION,
559 * FUNCTION_ENTRY,
560 * SYSCALL
561 *
562 * writer An instance of a mi writer.
563 * event single trace event.
564 * is_open Defines whether or not the session element shall be closed.
565 * This should be used carefully and the client
566 * must close the event element.
567 * Use case: nested additional information
970d848b 568 * domain Event's domain
5e18ec73
JR
569 *
570 * Returns zero if the element's value could be written.
571 * Negative values indicate an error.
572 */
573int mi_lttng_event(struct mi_writer *writer, struct lttng_event *event,
970d848b 574 int is_open, enum lttng_domain_type domain);
5e18ec73
JR
575
576/*
577 * Machine interface for struct lttng_event_field.
578 *
579 * writer An instance of a mi writer.
580 * field An event_field instance.
581 *
582 * Returns zero if the element's value could be written.
583 * Negative values indicate an error.
584 */
585int mi_lttng_event_field(struct mi_writer *writer,
586 struct lttng_event_field *field);
587
588/*
589 * Machine interface: open a event_fields element.
590 *
591 * writer An instance of a machine interface writer.
592 *
e4d484a5 593 * Returns zero if the element have be written.
5e18ec73
JR
594 * Negative values indicate an error.
595 */
596int mi_lttng_event_fields_open(struct mi_writer *writer);
597
ebbf5ab7
JR
598/*
599 * Machine interface: open a trackers element.
600 *
601 * writer An instance of a machine interface writer.
602 *
603 * Returns zero if the element's value could be written.
604 * Negative values indicate an error.
605 */
606int mi_lttng_trackers_open(struct mi_writer *writer);
607
608/*
83d6d6c4 609 * Machine interface: open a id tracker element.
ebbf5ab7
JR
610 *
611 * writer An instance of a machine interface writer.
612 *
613 * Returns zero if the element's value could be written.
614 * Negative values indicate an error.
615 *
616 * Note: A targets element is also opened for each tracker definition
617 */
83d6d6c4
JR
618int mi_lttng_id_tracker_open(
619 struct mi_writer *writer, enum lttng_tracker_type tracker_type);
ebbf5ab7 620
5e18ec73
JR
621/*
622 * Machine interface: open a PIDs 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 */
629int mi_lttng_pids_open(struct mi_writer *writer);
630
631/*
ebbf5ab7
JR
632 * Machine interface: open a processes element.
633 *
634 * writer An instance of a machine interface writer.
635 *
636 * Returns zero if the element's value could be written.
637 * Negative values indicate an error.
638 */
639int mi_lttng_processes_open(struct mi_writer *writer);
640
641/*
642 * Machine interface of a Process.
5e18ec73
JR
643 *
644 * writer An instance of a machine interface writer.
645 * pid A PID.
646 *
647 * is_open Defines whether or not the session element shall be closed.
648 * This should be used carefully and the client
649 * must close the pid element.
650 * Use case: nested addition information on a domain
651 * ex: channel event.
652 *
653 * Returns zero if the element's value could be written.
654 * Negative values indicate an error.
655 */
ebbf5ab7 656int mi_lttng_process(struct mi_writer *writer, pid_t pid , const char *name,
5e18ec73 657 int is_open);
bf239d4c
JR
658
659/*
660 * TODO: move pid of lttng list -u to process semantic on mi api bump
661 * Machine interface of a Process.
662 *
663 * writer An instance of a machine interface writer.
664 * pid A PID.
665 *
666 * is_open Defines whether or not the session element shall be closed.
667 * This should be used carefully and the client
668 * must close the pid element.
669 * Use case: nested addition information on a domain
670 * ex: channel event.
671 *
672 * Returns zero if the element's value could be written.
673 * Negative values indicate an error.
674 */
675int mi_lttng_pid(struct mi_writer *writer, pid_t pid , const char *name,
676 int is_open);
ebbf5ab7
JR
677/*
678 * Machine interface: open a targets element.
679 *
680 * writer An instance of a machine interface writer.
681 *
682 * Returns zero if the element's value could be written.
683 * Negative values indicate an error.
684 */
685int mi_lttng_targets_open(struct mi_writer *writer);
686
687/*
83d6d6c4 688 * Machine interface for track/untrack an id_target
ebbf5ab7
JR
689 *
690 * writer An instance of a machine interface writer.
691 *
692 * Returns zero if the element's value could be written.
693 * Negative values indicate an error.
694 */
83d6d6c4
JR
695int mi_lttng_id_target(struct mi_writer *writer,
696 enum lttng_tracker_type tracker_type,
697 struct lttng_tracker_id *id,
698 int is_open);
c7e35b03 699
89b72577
JRJ
700/*
701 * Machine interface of a context.
702 *
703 * writer An instance of a machine interface writer
704 *
705 * context An instance of a lttng_event_context
706 *
707 * is_open Define if we close the context element
708 * This should be used carefully and the client
709 * need to close the context element.
89b72577
JRJ
710 * Returns zero if the element's value could be written.
711 * Negative values indicate an error.
712 */
713int mi_lttng_context(struct mi_writer *writer,
714 struct lttng_event_context *context, int is_open);
715
716/*
717 * Machine interface of a perf_counter_context.
718 *
719 * writer An instance of a machine interface writer
720 *
721 * contest An instance of a lttng_event_perf_counter_ctx
722 *
723 * Returns zero if the element's value could be written.
724 * Negative values indicate an error.
725 */
726int mi_lttng_perf_counter_context(struct mi_writer *writer,
727 struct lttng_event_perf_counter_ctx *perf_context);
728
50534d6f
JRJ
729/*
730 * Machine interface of the snapshot list_output.
731 * It specifies the session for which we are listing snapshots,
732 * and it opens a snapshots element to list a sequence
733 * of snapshots.
734 *
735 * writer An instance of a machine interface writer.
736 *
737 * session_name: Snapshot output for session "session_name".
738 *
739 * Note: The client has to close the session and the snapshots elements after
740 * having listed every lttng_snapshot_output.
741 *
742 * Returns zero if the element's value could be written.
743 * Negative values indicate an error.
744 */
745int mi_lttng_snapshot_output_session_name(struct mi_writer *writer,
746 const char *session_name);
747
748/*
749 * Machine interface of the snapshot output.
750 * The machine interface serializes the following attributes:
751 * - id: ID of the snapshot output.
752 * - name: Name of the output.
753 * - data_url : Destination of the output.
754 * - ctrl_url: Destination of the output.
755 * - max_size: total size of all stream combined.
756 *
757 * writer An instance of a machine interface writer.
758 *
759 * output: A list of snapshot_output.
760 *
761 * Returns zero if the element's value could be written.
762 * Negative values indicate an error.
763 */
764int mi_lttng_snapshot_list_output(struct mi_writer *writer,
765 struct lttng_snapshot_output *output);
766
767/*
768 * Machine interface of the output of the command snapshot del output
769 * when deleting a snapshot either by id or by name.
770 * If the snapshot was found and successfully deleted using its id,
771 * it return the id of the snapshot and the current session name on which it
772 * was attached.
773 *
774 * Otherwise, it do the same process with the name of the snapshot, if the
775 * snapshot output id is undefined.
776 *
777 * writer An instance of a machine interface writer.
778 *
779 * id: ID of the snapshot output.
780 *
781 * name: Name of the snapshot.
782 *
783 * current_session_name: Session to which the snapshot belongs.
784 *
785 * Returns zero if the element's value could be written.
786 * Negative values indicate an error.
787 */
788int mi_lttng_snapshot_del_output(struct mi_writer *writer, int id,
789 const char *name, const char *current_session_name);
790
791/*
792 * Machine interface of the output of the command snapshot add output
793 * when adding a snapshot from a user URL.
794 *
795 * If the snapshot was successfully added, the machine interface lists
796 * these information:
797 * - id: ID of the newly add snapshot output.
798 * - current_session_name: Name of the session to which the output was added.
799 * - ctrl_url: Destination of the output.
800 * - max_size: total size of all stream combined.
801 *
802 * writer An instance of a machine interface writer.
803 *
804 * current_session_name: Session to which the snapshot belongs.
805 *
806 * n_ptr:
807 *
808 * output: iterator over a lttng_snapshot_output_list which contain
809 * the snapshot output informations.
810 *
811 * Returns zero if the element's value could be written.
812 * Negative values indicate an error.
813 */
814int mi_lttng_snapshot_add_output(struct mi_writer *writer,
815 const char *current_session_name, const char *n_ptr,
816 struct lttng_snapshot_output *output);
817
818/*
819 * Machine interface of the output of the command snapshot
820 * record from a URL (if given).
821 *
822 * If the snapshot is successfully recorded from a url, the machine interface
823 * output the following information:
824 * - url: Destination of the output stored in the snapshot.
825 *
826 * Otherwise, the machine interface output the data and ctrl url received
827 * from the command-line.
828 *
829 * writer An instance of a machine interface writer.
830 *
831 * current_session_name: Snapshot record for session "current_session_name".
832 *
833 * ctrl_url, data_url: Destination of the output receive from the command-line.
834 *
835 * Returns zero if the element's value could be written.
836 * Negative values indicate an error.
837 */
838int mi_lttng_snapshot_record(struct mi_writer *writer,
839 const char *current_session_name, const char *url,
840 const char *cmdline_ctrl_url, const char *cmdline_data_url);
841
66ea93b1
JG
842/*
843 * Machine interface representation of a session rotation schedule.
844 *
845 * The machine interface serializes the provided schedule as one of the choices
846 * from 'rotation_schedule_type'.
847 *
848 * writer: An instance of a machine interface writer.
849 *
850 * schedule: An lttng rotation schedule descriptor object.
851 *
852 * Returns zero if the element's value could be written.
853 * Negative values indicate an error.
854 */
855int mi_lttng_rotation_schedule(struct mi_writer *writer,
856 const struct lttng_rotation_schedule *schedule);
857
858/*
859 * Machine interface of a session rotation schedule result.
860 * This is an element that is part of the output of the enable-rotation and
861 * disable-rotation commands.
862 *
863 * The machine interface provides the following information:
864 * - schedule: the session rotation schedule descriptor.
865 * - success: whether the sub-command succeeded.
866 *
867 * writer: An instance of a machine interface writer.
868 *
66ea93b1
JG
869 * schedule: An lttng rotation schedule descriptor object.
870 *
871 * success: Whether the sub-command suceeded.
872 *
873 * Returns zero if the element's value could be written.
874 * Negative values indicate an error.
875 */
876int mi_lttng_rotation_schedule_result(struct mi_writer *writer,
877 const struct lttng_rotation_schedule *schedule,
878 bool success);
879
91c4d516
JG
880/*
881 * Machine interface of a session rotation result.
882 * This is an element that is part of the output of the rotate command.
883 *
884 * The machine interface provides the following information:
885 * - session_name: the session to be rotated.
886 * - state: the session rotation state.
887 * - location: the location of the completed chunk archive.
888 *
889 * writer: An instance of a machine interface writer.
890 *
891 * session_name: The session to which the rotate command applies.
892 *
893 * location: A location descriptor object.
894 *
895 * success: Whether the sub-command suceeded.
896 *
897 * Returns zero if the element's value could be written.
898 * Negative values indicate an error.
899 */
900int mi_lttng_rotate(struct mi_writer *writer,
901 const char *session_name,
902 enum lttng_rotation_state rotation_state,
903 const struct lttng_trace_archive_location *location);
904
c7e35b03 905#endif /* _MI_LTTNG_H */
This page took 0.123732 seconds and 4 git commands to generate.