Fix: intialization of ust_metadata_poll_pipe to garbage value
[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>
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License, version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc., 51
16 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 */
18
19#ifndef _MI_LTTNG_H
20#define _MI_LTTNG_H
21
22#include <stdint.h>
23
24#include <common/error.h>
25#include <common/macros.h>
26#include <common/config/config.h>
27#include <lttng/lttng.h>
28
50534d6f
JRJ
29/* Don't want to reference snapshot-internal.h here */
30struct lttng_snapshot_output;
31
c7e35b03
JR
32/* Instance of a machine interface writer. */
33struct mi_writer {
34 struct config_writer *writer;
35 enum lttng_mi_output_type type;
36};
37
38/*
39 * Version information for the machine interface.
40 */
41struct mi_lttng_version {
42 char version[NAME_MAX]; /* Version number of package */
43 uint32_t version_major; /* LTTng-Tools major version number */
44 uint32_t version_minor; /* LTTng-Tools minor version number */
45 uint32_t version_patchlevel; /* LTTng-Tools patchlevel version number */
314d5222 46 char version_commit[NAME_MAX]; /* Commit hash of the current version */
c7e35b03
JR
47 char version_name[NAME_MAX];
48 char package_url[NAME_MAX]; /* Define to the home page for this package. */
49};
50
51/* Strings related to command */
4965f956
JG
52extern const char * const mi_lttng_element_command;
53extern const char * const mi_lttng_element_command_action;
54extern const char * const mi_lttng_element_command_add_context;
55extern const char * const mi_lttng_element_command_calibrate;
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;
64extern const char * const mi_lttng_element_command_name;
65extern const char * const mi_lttng_element_command_output;
66extern const char * const mi_lttng_element_command_save;
67extern const char * const mi_lttng_element_command_set_session;
68extern const char * const mi_lttng_element_command_snapshot;
69extern const char * const mi_lttng_element_command_snapshot_add;
70extern const char * const mi_lttng_element_command_snapshot_del;
71extern const char * const mi_lttng_element_command_snapshot_list;
72extern const char * const mi_lttng_element_command_snapshot_record;
73extern const char * const mi_lttng_element_command_start;
74extern const char * const mi_lttng_element_command_stop;
75extern const char * const mi_lttng_element_command_success;
76extern const char * const mi_lttng_element_command_track;
77extern const char * const mi_lttng_element_command_untrack;
78extern const char * const mi_lttng_element_command_version;
c7e35b03 79
1734c658 80/* Strings related to version command */
4965f956
JG
81extern const char * const mi_lttng_element_version;
82extern const char * const mi_lttng_element_version_commit;
83extern const char * const mi_lttng_element_version_description;
84extern const char * const mi_lttng_element_version_license;
85extern const char * const mi_lttng_element_version_major;
86extern const char * const mi_lttng_element_version_minor;
87extern const char * const mi_lttng_element_version_patch_level;
88extern const char * const mi_lttng_element_version_str;
89extern const char * const mi_lttng_element_version_web;
c7e35b03 90
5e18ec73 91/* String related to a lttng_event_field */
4965f956
JG
92extern const char * const mi_lttng_element_event_field;
93extern const char * const mi_lttng_element_event_fields;
5e18ec73 94
89b72577 95/* String related to lttng_event_context */
4965f956
JG
96extern const char * const mi_lttng_context_type_perf_counter;
97extern const char * const mi_lttng_context_type_perf_cpu_counter;
98extern const char * const mi_lttng_context_type_perf_thread_counter;
89b72577
JRJ
99
100/* String related to lttng_event_perf_counter_ctx */
4965f956 101extern const char * const mi_lttng_element_perf_counter_context;
89b72577 102
5e18ec73 103/* Strings related to pid */
4965f956
JG
104extern const char * const mi_lttng_element_pids;
105extern const char * const mi_lttng_element_pid;
106extern const char * const mi_lttng_element_pid_id;
5e18ec73 107
1734c658 108/* Strings related to save command */
4965f956 109extern const char * const mi_lttng_element_save;
1734c658
JRJ
110
111/* Strings related to load command */
4965f956 112extern const char * const mi_lttng_element_load;
1734c658 113
5e18ec73 114/* General element of mi_lttng */
4965f956
JG
115extern const char * const mi_lttng_element_empty;
116extern const char * const mi_lttng_element_id;
117extern const char * const mi_lttng_element_nowrite;
118extern const char * const mi_lttng_element_success;
119extern const char * const mi_lttng_element_type_enum;
120extern const char * const mi_lttng_element_type_float;
121extern const char * const mi_lttng_element_type_integer;
122extern const char * const mi_lttng_element_type_other;
123extern const char * const mi_lttng_element_type_string;
5e18ec73
JR
124
125/* String related to loglevel */
4965f956
JG
126extern const char * const mi_lttng_loglevel_str_alert;
127extern const char * const mi_lttng_loglevel_str_crit;
128extern const char * const mi_lttng_loglevel_str_debug;
129extern const char * const mi_lttng_loglevel_str_debug_function;
130extern const char * const mi_lttng_loglevel_str_debug_line;
131extern const char * const mi_lttng_loglevel_str_debug_module;
132extern const char * const mi_lttng_loglevel_str_debug_process;
133extern const char * const mi_lttng_loglevel_str_debug_program;
134extern const char * const mi_lttng_loglevel_str_debug_system;
135extern const char * const mi_lttng_loglevel_str_debug_unit;
136extern const char * const mi_lttng_loglevel_str_emerg;
137extern const char * const mi_lttng_loglevel_str_err;
138extern const char * const mi_lttng_loglevel_str_info;
139extern const char * const mi_lttng_loglevel_str_notice;
140extern const char * const mi_lttng_loglevel_str_unknown;
141extern const char * const mi_lttng_loglevel_str_warning;
5e18ec73 142
136f2f81 143/* String related to loglevel JUL */
4965f956
JG
144extern const char * const mi_lttng_loglevel_str_jul_all;
145extern const char * const mi_lttng_loglevel_str_jul_config;
146extern const char * const mi_lttng_loglevel_str_jul_fine;
147extern const char * const mi_lttng_loglevel_str_jul_finer;
148extern const char * const mi_lttng_loglevel_str_jul_finest;
149extern const char * const mi_lttng_loglevel_str_jul_info;
150extern const char * const mi_lttng_loglevel_str_jul_off;
151extern const char * const mi_lttng_loglevel_str_jul_severe;
152extern const char * const mi_lttng_loglevel_str_jul_warning;
136f2f81 153
970d848b 154/* String related to loglevel Log4j */
4965f956
JG
155extern const char * const mi_lttng_loglevel_str_log4j_off;
156extern const char * const mi_lttng_loglevel_str_log4j_fatal;
157extern const char * const mi_lttng_loglevel_str_log4j_error;
158extern const char * const mi_lttng_loglevel_str_log4j_warn;
159extern const char * const mi_lttng_loglevel_str_log4j_info;
160extern const char * const mi_lttng_loglevel_str_log4j_debug;
161extern const char * const mi_lttng_loglevel_str_log4j_trace;
162extern const char * const mi_lttng_loglevel_str_log4j_all;
970d848b 163
0e115563 164/* String related to loglevel Python */
4965f956
JG
165extern const char * const mi_lttng_loglevel_str_python_critical;
166extern const char * const mi_lttng_loglevel_str_python_error;
167extern const char * const mi_lttng_loglevel_str_python_warning;
168extern const char * const mi_lttng_loglevel_str_python_info;
169extern const char * const mi_lttng_loglevel_str_python_debug;
170extern const char * const mi_lttng_loglevel_str_python_notset;
0e115563 171
1734c658 172/* String related to loglevel type */
4965f956
JG
173extern const char * const mi_lttng_loglevel_type_all;
174extern const char * const mi_lttng_loglevel_type_range;
175extern const char * const mi_lttng_loglevel_type_single;
176extern const char * const mi_lttng_loglevel_type_unknown;
5e18ec73 177
7e66b1b0 178/* Sting related to lttng_calibrate */
4965f956
JG
179extern const char * const mi_lttng_element_calibrate;
180extern const char * const mi_lttng_element_calibrate_function;
7e66b1b0 181
136f2f81 182/* String related to a lttng_snapshot */
4965f956
JG
183extern const char * const mi_lttng_element_snapshot_ctrl_url;
184extern const char * const mi_lttng_element_snapshot_data_url;
185extern const char * const mi_lttng_element_snapshot_max_size;
186extern const char * const mi_lttng_element_snapshot_n_ptr;
187extern const char * const mi_lttng_element_snapshot_session_name;
188extern const char * const mi_lttng_element_snapshots;
50534d6f 189
5e18ec73 190/* Utility string function */
970d848b 191const char *mi_lttng_loglevel_string(int value, enum lttng_domain_type domain);
5e18ec73
JR
192const char *mi_lttng_logleveltype_string(enum lttng_loglevel_type value);
193const char *mi_lttng_eventfieldtype_string(enum lttng_event_field_type value);
194const char *mi_lttng_domaintype_string(enum lttng_domain_type value);
195const char *mi_lttng_buffertype_string(enum lttng_buffer_type value);
7e66b1b0 196const char *mi_lttng_calibratetype_string(enum lttng_calibrate_type val);
5e18ec73 197
c7e35b03
JR
198/*
199 * Create an instance of a machine interface writer.
200 *
201 * fd_output File to which the XML content must be written. The file will be
202 * closed once the mi_writer has been destroyed.
203 *
204 * Returns an instance of a machine interface writer on success, NULL on
205 * error.
206 */
207struct mi_writer *mi_lttng_writer_create(int fd_output, int mi_output_type);
208
209/*
210 * Destroy an instance of a machine interface writer.
211 *
212 * writer An instance of a machine interface writer.
213 *
214 * Returns zero if the XML document could be closed cleanly. Negative values
215 * indicate an error.
216 */
217int mi_lttng_writer_destroy(struct mi_writer *writer);
218
219/*
220 * Open a command tag and add it's name node.
221 *
222 * writer An instance of a machine interface writer.
c7e35b03
JR
223 * command The command name.
224 *
225 * Returns zero if the XML document could be closed cleanly.
226 * Negative values indicate an error.
227 */
228int mi_lttng_writer_command_open(struct mi_writer *writer, const char *command);
229
230/*
231 * Close a command tag.
232 *
233 * writer An instance of a machine interface writer.
234 *
235 * Returns zero if the XML document could be closed cleanly.
236 * Negative values indicate an error.
237 */
238int mi_lttng_writer_command_close(struct mi_writer *writer);
239
240/*
241 * Open an element tag.
242 *
243 * writer An instance of a machine interface writer.
c7e35b03
JR
244 * element_name Element tag name.
245 *
246 * Returns zero if the XML document could be closed cleanly.
247 * Negative values indicate an error.
248 */
249int mi_lttng_writer_open_element(struct mi_writer *writer,
250 const char *element_name);
251
252/*
253 * Close the current element tag.
254 *
255 * writer An instance of a machine interface writer.
256 *
257 * Returns zero if the XML document could be closed cleanly.
258 * Negative values indicate an error.
259 */
260int mi_lttng_writer_close_element(struct mi_writer *writer);
261
262/*
5e18ec73 263 * Close multiple element.
c7e35b03
JR
264 *
265 * writer An instance of a machine interface writer.
5e18ec73 266 * nb_element Number of elements.
c7e35b03 267 *
5e18ec73
JR
268 * Returns zero if the XML document could be closed cleanly.
269 * Negative values indicate an error.
270 */
271int mi_lttng_close_multi_element(struct mi_writer *writer,
272 unsigned int nb_element);
273
274/*
275 * Write an element of type unsigned int.
c7e35b03 276 *
5e18ec73
JR
277 * writer An instance of a machine interface writer.
278 * element_name Element name.
c7e35b03
JR
279 * value Unsigned int value of the element
280 *
281 * Returns zero if the element's value could be written.
282 * Negative values indicate an error.
283 */
284int mi_lttng_writer_write_element_unsigned_int(struct mi_writer *writer,
285 const char *element_name, uint64_t value);
286
287/*
288 * Write an element of type signed int.
289 *
290 * writer An instance of a machine interface writer.
c7e35b03 291 * element_name Element name.
5e18ec73 292 * value Signed int value of the element.
c7e35b03
JR
293 *
294 * Returns zero if the element's value could be written.
295 * Negative values indicate an error.
296 */
297int mi_lttng_writer_write_element_signed_int(struct mi_writer *writer,
298 const char *element_name, int64_t value);
299
300/*
301 * Write an element of type boolean.
302 *
303 * writer An instance of a machine interface writer.
c7e35b03 304 * element_name Element name.
5e18ec73 305 * value Boolean value of the element.
c7e35b03
JR
306 *
307 * Returns zero if the element's value could be written.
308 * Negative values indicate an error.
309 */
310int mi_lttng_writer_write_element_bool(struct mi_writer *writer,
311 const char *element_name, int value);
312
313/*
314 * Write an element of type string.
315 *
316 * writer An instance of a machine interface writer.
c7e35b03 317 * element_name Element name.
5e18ec73 318 * value String value of the element.
c7e35b03
JR
319 *
320 * Returns zero if the element's value could be written.
321 * Negative values indicate an error.
322 */
323int mi_lttng_writer_write_element_string(struct mi_writer *writer,
324 const char *element_name, const char *value);
325
326/*
327 * Machine interface of struct version.
328 *
329 * writer An instance of a machine interface writer.
c7e35b03 330 * version Version struct.
c7e35b03 331 * lttng_description String value of the version description.
c7e35b03
JR
332 * lttng_license String value of the version license.
333 *
334 * Returns zero if the element's value could be written.
335 * Negative values indicate an error.
336 */
337int mi_lttng_version(struct mi_writer *writer, struct mi_lttng_version *version,
338 const char *lttng_description, const char *lttng_license);
339
340/*
5e18ec73 341 * Machine interface: open a sessions element.
c7e35b03 342 *
5e18ec73 343 * writer An instance of a machine interface writer.
c7e35b03 344 *
5e18ec73
JR
345 * Returns zero if the element's value could be written.
346 * Negative values indicate an error.
347 */
348int mi_lttng_sessions_open(struct mi_writer *writer);
349
350/*
351 * Machine interface of struct session.
c7e35b03 352 *
5e18ec73
JR
353 * writer An instance of a machine interface writer.
354 * session An instance of a session.
355 * is_open Defines whether or not the session element shall be closed.
356 * This should be used carefully and the client
357 * must close the session element.
136f2f81 358 * Use case: nested additional information on a session
c7e35b03 359 * ex: domain,channel event.
c7e35b03
JR
360 *
361 * Returns zero if the element's value could be written.
362 * Negative values indicate an error.
363 */
364int mi_lttng_session(struct mi_writer *writer,
5e18ec73
JR
365 struct lttng_session *session, int is_open);
366
367/*
368 * Machine interface: open a domains element.
369 *
370 * writer An instance of a machine interface writer.
371 *
372 * Returns zero if the element's value could be written.
373 * Negative values indicate an error.
374 */
375int mi_lttng_domains_open(struct mi_writer *writer);
376
377/*
378 * Machine interface of struct domain.
379 *
380 * writer An instance of a machine interface writer.
381 * domain An instance of a domain.
382 *
383 * is_open Defines whether or not the session element shall be closed.
384 * This should be used carefully and the client
385 * must close the domain element.
386 * Use case: nested addition information on a domain
387 * ex: channel event.
388 *
389 * Returns zero if the element's value could be written.
390 * Negative values indicate an error.
391 */
392int mi_lttng_domain(struct mi_writer *writer,
393 struct lttng_domain *domain, int is_open);
394
395/*
396 * Machine interface: open a channels element.
397 *
398 * writer An instance of a machine interface writer.
399 *
400 * Returns zero if the element's value could be written.
401 * Negative values indicate an error.
402 */
403int mi_lttng_channels_open(struct mi_writer *writer);
404
405/*
406 * Machine interface of struct channel.
407 *
408 * writer An instance of a machine interface writer.
409 * channel An instance of a channel.
410 *
411 * is_open Defines whether or not the session element shall be closed.
412 * This should be used carefully and the client
413 * must close the channel element.
414 * Use case: nested addition information on a channel.
415 * ex: channel event.
416 *
417 * Returns zero if the element's value could be written.
418 * Negative values indicate an error.
419 */
420int mi_lttng_channel(struct mi_writer *writer,
421 struct lttng_channel *channel, int is_open);
422
423/*
424 * Machine interface of struct channel_attr.
425 *
426 * writer An instance of a machine interface writer.
427 * attr An instance of a channel_attr struct.
428 *
429 * Returns zero if the element's value could be written.
430 * Negative values indicate an error.
431 */
432int mi_lttng_channel_attr(struct mi_writer *writer,
433 struct lttng_channel_attr *attr);
434
435/*
436* Machine interface for event common attributes.
437*
438* writer An instance of a mi writer.
439* event single trace event.
440*
441* The common attribute are:
442* - mi event element
443* - event name
444* - event type
445* - enabled tag
446* - event filter
447*
448* Returns zero if the element's value could be written.
449* Negative values indicate an error.
450*/
451int mi_lttng_event_common_attributes(struct mi_writer *writer,
452 struct lttng_event *event);
453
454/*
455 * Machine interface for kernel tracepoint event with a loglevel.
456 *
457 * writer An instance of a mi writer.
458 * event single trace event.
970d848b 459 * domain Event's domain
5e18ec73
JR
460 *
461 * Returns zero if the element's value could be written.
462 * Negative values indicate an error.
463 */
464int mi_lttng_event_tracepoint_loglevel(struct mi_writer *writer,
970d848b 465 struct lttng_event *event, enum lttng_domain_type domain);
5e18ec73
JR
466
467/*
468 * Machine interface for kernel tracepoint event with no loglevel.
469 *
470 * writer An instance of a mi writer.
471 * event single trace event.
472 *
473 * Returns zero if the element's value could be written.
474 * Negative values indicate an error.
475 */
476int mi_lttng_event_tracepoint_no_loglevel(struct mi_writer *writer,
477 struct lttng_event *event);
478
479/*
480 * Machine interface for kernel function and probe event.
481 *
482 * writer An instance of a mi writer.
483 * event single trace event.
484 *
485 * Returns zero if the element's value could be written.
486 * Negative values indicate an error.
487 */
488int mi_lttng_event_function_probe(struct mi_writer *writer,
489 struct lttng_event *event);
490
491/*
492 * Machine interface for kernel function entry event.
493 *
494 * writer An instance of a mi writer.
495 * event single trace event.
496 *
497 * Returns zero if the element's value could be written.
498 * Negative values indicate an error.
499 */
500int mi_lttng_event_function_entry(struct mi_writer *writer,
501 struct lttng_event *event);
502
503/*
504 * Machine interface: open an events element.
505 *
506 * writer An instance of a machine interface writer.
507 *
508 * Returns zero if the element's value could be written.
509 * Negative values indicate an error.
510 */
511int mi_lttng_events_open(struct mi_writer *writer);
512
513/*
514 * Machine interface for printing an event.
515 * The trace event type currently supported are:
516 * TRACEPOINT,
517 * PROBE,
518 * FUNCTION,
519 * FUNCTION_ENTRY,
520 * SYSCALL
521 *
522 * writer An instance of a mi writer.
523 * event single trace event.
524 * is_open Defines whether or not the session element shall be closed.
525 * This should be used carefully and the client
526 * must close the event element.
527 * Use case: nested additional information
970d848b 528 * domain Event's domain
5e18ec73
JR
529 *
530 * Returns zero if the element's value could be written.
531 * Negative values indicate an error.
532 */
533int mi_lttng_event(struct mi_writer *writer, struct lttng_event *event,
970d848b 534 int is_open, enum lttng_domain_type domain);
5e18ec73
JR
535
536/*
537 * Machine interface for struct lttng_event_field.
538 *
539 * writer An instance of a mi writer.
540 * field An event_field instance.
541 *
542 * Returns zero if the element's value could be written.
543 * Negative values indicate an error.
544 */
545int mi_lttng_event_field(struct mi_writer *writer,
546 struct lttng_event_field *field);
547
548/*
549 * Machine interface: open a event_fields element.
550 *
551 * writer An instance of a machine interface writer.
552 *
e4d484a5 553 * Returns zero if the element have be written.
5e18ec73
JR
554 * Negative values indicate an error.
555 */
556int mi_lttng_event_fields_open(struct mi_writer *writer);
557
558/*
559 * Machine interface: open a PIDs element.
560 *
561 * writer An instance of a machine interface writer.
562 *
563 * Returns zero if the element's value could be written.
564 * Negative values indicate an error.
565 */
566int mi_lttng_pids_open(struct mi_writer *writer);
567
568/*
569 * Machine interface of a PID.
570 *
571 * writer An instance of a machine interface writer.
572 * pid A PID.
573 *
574 * is_open Defines whether or not the session element shall be closed.
575 * This should be used carefully and the client
576 * must close the pid element.
577 * Use case: nested addition information on a domain
578 * ex: channel event.
579 *
580 * Returns zero if the element's value could be written.
581 * Negative values indicate an error.
582 */
583int mi_lttng_pid(struct mi_writer *writer, pid_t pid , const char *cmdline,
584 int is_open);
c7e35b03 585
7e66b1b0
JRJ
586/*
587 * Machine interface for struct lttng_calibrate.
588 *
589 * writer An instance of a machine interface writer.
590 *
591 * calibrate A lttng_calibrate instance.
592 *
593 * Returns zero if the element's value could be written.
594 * Negative values indicate an error.
595 */
596int mi_lttng_calibrate(struct mi_writer *writer,
597 struct lttng_calibrate *calibrate);
598
89b72577
JRJ
599/*
600 * Machine interface of a context.
601 *
602 * writer An instance of a machine interface writer
603 *
604 * context An instance of a lttng_event_context
605 *
606 * is_open Define if we close the context element
607 * This should be used carefully and the client
608 * need to close the context element.
89b72577
JRJ
609 * Returns zero if the element's value could be written.
610 * Negative values indicate an error.
611 */
612int mi_lttng_context(struct mi_writer *writer,
613 struct lttng_event_context *context, int is_open);
614
615/*
616 * Machine interface of a perf_counter_context.
617 *
618 * writer An instance of a machine interface writer
619 *
620 * contest An instance of a lttng_event_perf_counter_ctx
621 *
622 * Returns zero if the element's value could be written.
623 * Negative values indicate an error.
624 */
625int mi_lttng_perf_counter_context(struct mi_writer *writer,
626 struct lttng_event_perf_counter_ctx *perf_context);
627
50534d6f
JRJ
628/*
629 * Machine interface of the snapshot list_output.
630 * It specifies the session for which we are listing snapshots,
631 * and it opens a snapshots element to list a sequence
632 * of snapshots.
633 *
634 * writer An instance of a machine interface writer.
635 *
636 * session_name: Snapshot output for session "session_name".
637 *
638 * Note: The client has to close the session and the snapshots elements after
639 * having listed every lttng_snapshot_output.
640 *
641 * Returns zero if the element's value could be written.
642 * Negative values indicate an error.
643 */
644int mi_lttng_snapshot_output_session_name(struct mi_writer *writer,
645 const char *session_name);
646
647/*
648 * Machine interface of the snapshot output.
649 * The machine interface serializes the following attributes:
650 * - id: ID of the snapshot output.
651 * - name: Name of the output.
652 * - data_url : Destination of the output.
653 * - ctrl_url: Destination of the output.
654 * - max_size: total size of all stream combined.
655 *
656 * writer An instance of a machine interface writer.
657 *
658 * output: A list of snapshot_output.
659 *
660 * Returns zero if the element's value could be written.
661 * Negative values indicate an error.
662 */
663int mi_lttng_snapshot_list_output(struct mi_writer *writer,
664 struct lttng_snapshot_output *output);
665
666/*
667 * Machine interface of the output of the command snapshot del output
668 * when deleting a snapshot either by id or by name.
669 * If the snapshot was found and successfully deleted using its id,
670 * it return the id of the snapshot and the current session name on which it
671 * was attached.
672 *
673 * Otherwise, it do the same process with the name of the snapshot, if the
674 * snapshot output id is undefined.
675 *
676 * writer An instance of a machine interface writer.
677 *
678 * id: ID of the snapshot output.
679 *
680 * name: Name of the snapshot.
681 *
682 * current_session_name: Session to which the snapshot belongs.
683 *
684 * Returns zero if the element's value could be written.
685 * Negative values indicate an error.
686 */
687int mi_lttng_snapshot_del_output(struct mi_writer *writer, int id,
688 const char *name, const char *current_session_name);
689
690/*
691 * Machine interface of the output of the command snapshot add output
692 * when adding a snapshot from a user URL.
693 *
694 * If the snapshot was successfully added, the machine interface lists
695 * these information:
696 * - id: ID of the newly add snapshot output.
697 * - current_session_name: Name of the session to which the output was added.
698 * - ctrl_url: Destination of the output.
699 * - max_size: total size of all stream combined.
700 *
701 * writer An instance of a machine interface writer.
702 *
703 * current_session_name: Session to which the snapshot belongs.
704 *
705 * n_ptr:
706 *
707 * output: iterator over a lttng_snapshot_output_list which contain
708 * the snapshot output informations.
709 *
710 * Returns zero if the element's value could be written.
711 * Negative values indicate an error.
712 */
713int mi_lttng_snapshot_add_output(struct mi_writer *writer,
714 const char *current_session_name, const char *n_ptr,
715 struct lttng_snapshot_output *output);
716
717/*
718 * Machine interface of the output of the command snapshot
719 * record from a URL (if given).
720 *
721 * If the snapshot is successfully recorded from a url, the machine interface
722 * output the following information:
723 * - url: Destination of the output stored in the snapshot.
724 *
725 * Otherwise, the machine interface output the data and ctrl url received
726 * from the command-line.
727 *
728 * writer An instance of a machine interface writer.
729 *
730 * current_session_name: Snapshot record for session "current_session_name".
731 *
732 * ctrl_url, data_url: Destination of the output receive from the command-line.
733 *
734 * Returns zero if the element's value could be written.
735 * Negative values indicate an error.
736 */
737int mi_lttng_snapshot_record(struct mi_writer *writer,
738 const char *current_session_name, const char *url,
739 const char *cmdline_ctrl_url, const char *cmdline_data_url);
740
c7e35b03 741#endif /* _MI_LTTNG_H */
This page took 0.087821 seconds and 4 git commands to generate.