mi: support "add-context --list"
[lttng-tools.git] / src / common / mi-lttng.h
1 /*
2 * Copyright (C) 2014 - Jonathan Rajotte <jonathan.r.julien@gmail.com>
3 * - Olivier Cotte <olivier.cotte@polymtl.ca>
4 * Copyright (C) 2016 - Jérémie Galarneau <jeremie.galarneau@efficios.com>
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>
27 #include <common/config/session-config.h>
28 #include <lttng/lttng.h>
29
30 /* Don't want to reference snapshot-internal.h here */
31 struct lttng_snapshot_output;
32
33 /* Instance of a machine interface writer. */
34 struct 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 */
42 struct mi_lttng_version {
43 char version[LTTNG_NAME_MAX]; /* Version number of package */
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 */
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. */
50 };
51
52 /* Strings related to command */
53 extern const char * const mi_lttng_element_command;
54 extern const char * const mi_lttng_element_command_action;
55 extern const char * const mi_lttng_element_command_add_context;
56 extern const char * const mi_lttng_element_command_create;
57 extern const char * const mi_lttng_element_command_destroy;
58 extern const char * const mi_lttng_element_command_disable_channel;
59 extern const char * const mi_lttng_element_command_disable_event;
60 extern const char * const mi_lttng_element_command_enable_channels;
61 extern const char * const mi_lttng_element_command_enable_event;
62 extern const char * const mi_lttng_element_command_list;
63 extern const char * const mi_lttng_element_command_load;
64 extern const char * const mi_lttng_element_command_metadata;
65 extern const char * const mi_lttng_element_command_metadata_action;
66 extern const char * const mi_lttng_element_command_regenerate;
67 extern const char * const mi_lttng_element_command_regenerate_action;
68 extern const char * const mi_lttng_element_command_name;
69 extern const char * const mi_lttng_element_command_output;
70 extern const char * const mi_lttng_element_command_save;
71 extern const char * const mi_lttng_element_command_set_session;
72 extern const char * const mi_lttng_element_command_snapshot;
73 extern const char * const mi_lttng_element_command_snapshot_add;
74 extern const char * const mi_lttng_element_command_snapshot_del;
75 extern const char * const mi_lttng_element_command_snapshot_list;
76 extern const char * const mi_lttng_element_command_snapshot_record;
77 extern const char * const mi_lttng_element_command_start;
78 extern const char * const mi_lttng_element_command_stop;
79 extern const char * const mi_lttng_element_command_success;
80 extern const char * const mi_lttng_element_command_track;
81 extern const char * const mi_lttng_element_command_untrack;
82 extern const char * const mi_lttng_element_command_version;
83 extern const char * const mi_lttng_element_command_rotate;
84 extern const char * const mi_lttng_element_command_enable_rotation;
85 extern const char * const mi_lttng_element_command_disable_rotation;
86
87 /* Strings related to version command */
88 extern const char * const mi_lttng_element_version;
89 extern const char * const mi_lttng_element_version_commit;
90 extern const char * const mi_lttng_element_version_description;
91 extern const char * const mi_lttng_element_version_license;
92 extern const char * const mi_lttng_element_version_major;
93 extern const char * const mi_lttng_element_version_minor;
94 extern const char * const mi_lttng_element_version_patch_level;
95 extern const char * const mi_lttng_element_version_str;
96 extern const char * const mi_lttng_element_version_web;
97
98 /* String related to a lttng_event_field */
99 extern const char * const mi_lttng_element_event_field;
100 extern const char * const mi_lttng_element_event_fields;
101
102 /* String related to lttng_event_perf_counter_ctx */
103 extern const char * const mi_lttng_element_perf_counter_context;
104
105 /* Strings related to pid */
106 extern const char * const mi_lttng_element_pid_id;
107
108 /* Strings related to save command */
109 extern const char * const mi_lttng_element_save;
110
111 /* Strings related to load command */
112 extern const char * const mi_lttng_element_load;
113 LTTNG_HIDDEN const char * const mi_lttng_element_load_overrides;
114 LTTNG_HIDDEN const char * const mi_lttng_element_load_override_url;
115
116 /* General element of mi_lttng */
117 extern const char * const mi_lttng_element_empty;
118 extern const char * const mi_lttng_element_id;
119 extern const char * const mi_lttng_element_nowrite;
120 extern const char * const mi_lttng_element_success;
121 extern const char * const mi_lttng_element_type_enum;
122 extern const char * const mi_lttng_element_type_float;
123 extern const char * const mi_lttng_element_type_integer;
124 extern const char * const mi_lttng_element_type_other;
125 extern const char * const mi_lttng_element_type_string;
126
127 /* String related to loglevel */
128 extern const char * const mi_lttng_loglevel_str_alert;
129 extern const char * const mi_lttng_loglevel_str_crit;
130 extern const char * const mi_lttng_loglevel_str_debug;
131 extern const char * const mi_lttng_loglevel_str_debug_function;
132 extern const char * const mi_lttng_loglevel_str_debug_line;
133 extern const char * const mi_lttng_loglevel_str_debug_module;
134 extern const char * const mi_lttng_loglevel_str_debug_process;
135 extern const char * const mi_lttng_loglevel_str_debug_program;
136 extern const char * const mi_lttng_loglevel_str_debug_system;
137 extern const char * const mi_lttng_loglevel_str_debug_unit;
138 extern const char * const mi_lttng_loglevel_str_emerg;
139 extern const char * const mi_lttng_loglevel_str_err;
140 extern const char * const mi_lttng_loglevel_str_info;
141 extern const char * const mi_lttng_loglevel_str_notice;
142 extern const char * const mi_lttng_loglevel_str_unknown;
143 extern const char * const mi_lttng_loglevel_str_warning;
144
145 /* String related to loglevel JUL */
146 extern const char * const mi_lttng_loglevel_str_jul_all;
147 extern const char * const mi_lttng_loglevel_str_jul_config;
148 extern const char * const mi_lttng_loglevel_str_jul_fine;
149 extern const char * const mi_lttng_loglevel_str_jul_finer;
150 extern const char * const mi_lttng_loglevel_str_jul_finest;
151 extern const char * const mi_lttng_loglevel_str_jul_info;
152 extern const char * const mi_lttng_loglevel_str_jul_off;
153 extern const char * const mi_lttng_loglevel_str_jul_severe;
154 extern const char * const mi_lttng_loglevel_str_jul_warning;
155
156 /* String related to loglevel Log4j */
157 extern const char * const mi_lttng_loglevel_str_log4j_off;
158 extern const char * const mi_lttng_loglevel_str_log4j_fatal;
159 extern const char * const mi_lttng_loglevel_str_log4j_error;
160 extern const char * const mi_lttng_loglevel_str_log4j_warn;
161 extern const char * const mi_lttng_loglevel_str_log4j_info;
162 extern const char * const mi_lttng_loglevel_str_log4j_debug;
163 extern const char * const mi_lttng_loglevel_str_log4j_trace;
164 extern const char * const mi_lttng_loglevel_str_log4j_all;
165
166 /* String related to loglevel Python */
167 extern const char * const mi_lttng_loglevel_str_python_critical;
168 extern const char * const mi_lttng_loglevel_str_python_error;
169 extern const char * const mi_lttng_loglevel_str_python_warning;
170 extern const char * const mi_lttng_loglevel_str_python_info;
171 extern const char * const mi_lttng_loglevel_str_python_debug;
172 extern const char * const mi_lttng_loglevel_str_python_notset;
173
174 /* String related to loglevel type */
175 extern const char * const mi_lttng_loglevel_type_all;
176 extern const char * const mi_lttng_loglevel_type_range;
177 extern const char * const mi_lttng_loglevel_type_single;
178 extern const char * const mi_lttng_loglevel_type_unknown;
179
180 /* String related to a lttng_snapshot */
181 extern const char * const mi_lttng_element_snapshot_ctrl_url;
182 extern const char * const mi_lttng_element_snapshot_data_url;
183 extern const char * const mi_lttng_element_snapshot_max_size;
184 extern const char * const mi_lttng_element_snapshot_n_ptr;
185 extern const char * const mi_lttng_element_snapshot_session_name;
186 extern const char * const mi_lttng_element_snapshots;
187
188 /* String related to track/untrack command */
189 const char * const mi_lttng_element_track_untrack_all_wildcard;
190
191 LTTNG_HIDDEN const char * const mi_lttng_element_session_name;
192
193 /* String related to rotate command */
194 LTTNG_HIDDEN const char * const mi_lttng_element_rotation;
195 LTTNG_HIDDEN const char * const mi_lttng_element_rotations;
196 LTTNG_HIDDEN const char * const mi_lttng_element_rotate_status;
197 LTTNG_HIDDEN const char * const mi_lttng_element_rotation_schedule;
198
199 /* String related to add-context command */
200 LTTNG_HIDDEN extern const char * const mi_lttng_element_context_symbol;
201
202 /* Utility string function */
203 const char *mi_lttng_loglevel_string(int value, enum lttng_domain_type domain);
204 const char *mi_lttng_logleveltype_string(enum lttng_loglevel_type value);
205 const char *mi_lttng_eventfieldtype_string(enum lttng_event_field_type value);
206 const char *mi_lttng_domaintype_string(enum lttng_domain_type value);
207 const char *mi_lttng_buffertype_string(enum lttng_buffer_type value);
208
209 /*
210 * Create an instance of a machine interface writer.
211 *
212 * fd_output File to which the XML content must be written. The file will be
213 * closed once the mi_writer has been destroyed.
214 *
215 * Returns an instance of a machine interface writer on success, NULL on
216 * error.
217 */
218 struct mi_writer *mi_lttng_writer_create(int fd_output, int mi_output_type);
219
220 /*
221 * Destroy an instance of a machine interface writer.
222 *
223 * writer An instance of a machine interface writer.
224 *
225 * Returns zero if the XML document could be closed cleanly. Negative values
226 * indicate an error.
227 */
228 int mi_lttng_writer_destroy(struct mi_writer *writer);
229
230 /*
231 * Open a command tag and add it's name node.
232 *
233 * writer An instance of a machine interface writer.
234 * command The command name.
235 *
236 * Returns zero if the XML document could be closed cleanly.
237 * Negative values indicate an error.
238 */
239 int mi_lttng_writer_command_open(struct mi_writer *writer, const char *command);
240
241 /*
242 * Close a command tag.
243 *
244 * writer An instance of a machine interface writer.
245 *
246 * Returns zero if the XML document could be closed cleanly.
247 * Negative values indicate an error.
248 */
249 int mi_lttng_writer_command_close(struct mi_writer *writer);
250
251 /*
252 * Open an element tag.
253 *
254 * writer An instance of a machine interface writer.
255 * element_name Element tag name.
256 *
257 * Returns zero if the XML document could be closed cleanly.
258 * Negative values indicate an error.
259 */
260 int mi_lttng_writer_open_element(struct mi_writer *writer,
261 const char *element_name);
262
263 /*
264 * Close the current element tag.
265 *
266 * writer An instance of a machine interface writer.
267 *
268 * Returns zero if the XML document could be closed cleanly.
269 * Negative values indicate an error.
270 */
271 int mi_lttng_writer_close_element(struct mi_writer *writer);
272
273 /*
274 * Close multiple element.
275 *
276 * writer An instance of a machine interface writer.
277 * nb_element Number of elements.
278 *
279 * Returns zero if the XML document could be closed cleanly.
280 * Negative values indicate an error.
281 */
282 int mi_lttng_close_multi_element(struct mi_writer *writer,
283 unsigned int nb_element);
284
285 /*
286 * Write an element of type unsigned int.
287 *
288 * writer An instance of a machine interface writer.
289 * element_name Element name.
290 * value Unsigned int value of the element
291 *
292 * Returns zero if the element's value could be written.
293 * Negative values indicate an error.
294 */
295 int mi_lttng_writer_write_element_unsigned_int(struct mi_writer *writer,
296 const char *element_name, uint64_t value);
297
298 /*
299 * Write an element of type signed int.
300 *
301 * writer An instance of a machine interface writer.
302 * element_name Element name.
303 * value Signed int value of the element.
304 *
305 * Returns zero if the element's value could be written.
306 * Negative values indicate an error.
307 */
308 int mi_lttng_writer_write_element_signed_int(struct mi_writer *writer,
309 const char *element_name, int64_t value);
310
311 /*
312 * Write an element of type boolean.
313 *
314 * writer An instance of a machine interface writer.
315 * element_name Element name.
316 * value Boolean value of the element.
317 *
318 * Returns zero if the element's value could be written.
319 * Negative values indicate an error.
320 */
321 int mi_lttng_writer_write_element_bool(struct mi_writer *writer,
322 const char *element_name, int value);
323
324 /*
325 * Write an element of type string.
326 *
327 * writer An instance of a machine interface writer.
328 * element_name Element name.
329 * value String value of the element.
330 *
331 * Returns zero if the element's value could be written.
332 * Negative values indicate an error.
333 */
334 int mi_lttng_writer_write_element_string(struct mi_writer *writer,
335 const char *element_name, const char *value);
336
337 /*
338 * Machine interface of struct version.
339 *
340 * writer An instance of a machine interface writer.
341 * version Version struct.
342 * lttng_description String value of the version description.
343 * lttng_license String value of the version license.
344 *
345 * Returns zero if the element's value could be written.
346 * Negative values indicate an error.
347 */
348 int mi_lttng_version(struct mi_writer *writer, struct mi_lttng_version *version,
349 const char *lttng_description, const char *lttng_license);
350
351 /*
352 * Machine interface: open a sessions element.
353 *
354 * writer An instance of a machine interface writer.
355 *
356 * Returns zero if the element's value could be written.
357 * Negative values indicate an error.
358 */
359 int mi_lttng_sessions_open(struct mi_writer *writer);
360
361 /*
362 * Machine interface of struct session.
363 *
364 * writer An instance of a machine interface writer.
365 * session An instance of a session.
366 * is_open Defines whether or not the session element shall be closed.
367 * This should be used carefully and the client
368 * must close the session element.
369 * Use case: nested additional information on a session
370 * ex: domain,channel event.
371 *
372 * Returns zero if the element's value could be written.
373 * Negative values indicate an error.
374 */
375 int mi_lttng_session(struct mi_writer *writer,
376 struct lttng_session *session, int is_open);
377
378 /*
379 * Machine interface: open a domains element.
380 *
381 * writer An instance of a machine interface writer.
382 *
383 * Returns zero if the element's value could be written.
384 * Negative values indicate an error.
385 */
386 int mi_lttng_domains_open(struct mi_writer *writer);
387
388 /*
389 * Machine interface of struct domain.
390 *
391 * writer An instance of a machine interface writer.
392 * domain An instance of a domain.
393 *
394 * is_open Defines whether or not the session element shall be closed.
395 * This should be used carefully and the client
396 * must close the domain element.
397 * Use case: nested addition information on a domain
398 * ex: channel event.
399 *
400 * Returns zero if the element's value could be written.
401 * Negative values indicate an error.
402 */
403 int mi_lttng_domain(struct mi_writer *writer,
404 struct lttng_domain *domain, int is_open);
405
406 /*
407 * Machine interface: open a channels element.
408 *
409 * writer An instance of a machine interface writer.
410 *
411 * Returns zero if the element's value could be written.
412 * Negative values indicate an error.
413 */
414 int mi_lttng_channels_open(struct mi_writer *writer);
415
416 /*
417 * Machine interface of struct channel.
418 *
419 * writer An instance of a machine interface writer.
420 * channel An instance of a channel.
421 *
422 * is_open Defines whether or not the session element shall be closed.
423 * This should be used carefully and the client
424 * must close the channel element.
425 * Use case: nested addition information on a channel.
426 * ex: channel event.
427 *
428 * Returns zero if the element's value could be written.
429 * Negative values indicate an error.
430 */
431 int mi_lttng_channel(struct mi_writer *writer,
432 struct lttng_channel *channel, int is_open);
433
434 /*
435 * Machine interface of struct channel_attr.
436 *
437 * writer An instance of a machine interface writer.
438 * attr An instance of a channel_attr struct.
439 *
440 * Returns zero if the element's value could be written.
441 * Negative values indicate an error.
442 */
443 int mi_lttng_channel_attr(struct mi_writer *writer,
444 struct lttng_channel_attr *attr);
445
446 /*
447 * Machine interface for event common attributes.
448 *
449 * writer An instance of a mi writer.
450 * event single trace event.
451 *
452 * The common attribute are:
453 * - mi event element
454 * - event name
455 * - event type
456 * - enabled tag
457 * - event filter
458 *
459 * Returns zero if the element's value could be written.
460 * Negative values indicate an error.
461 */
462 int mi_lttng_event_common_attributes(struct mi_writer *writer,
463 struct lttng_event *event);
464
465 /*
466 * Machine interface for kernel tracepoint event with a loglevel.
467 *
468 * writer An instance of a mi writer.
469 * event single trace event.
470 * domain Event's domain
471 *
472 * Returns zero if the element's value could be written.
473 * Negative values indicate an error.
474 */
475 int mi_lttng_event_tracepoint_loglevel(struct mi_writer *writer,
476 struct lttng_event *event, enum lttng_domain_type domain);
477
478 /*
479 * Machine interface for kernel tracepoint event with no loglevel.
480 *
481 * writer An instance of a mi writer.
482 * event single trace event.
483 *
484 * Returns zero if the element's value could be written.
485 * Negative values indicate an error.
486 */
487 int mi_lttng_event_tracepoint_no_loglevel(struct mi_writer *writer,
488 struct lttng_event *event);
489
490 /*
491 * Machine interface for kernel function and probe event.
492 *
493 * writer An instance of a mi writer.
494 * event single trace event.
495 *
496 * Returns zero if the element's value could be written.
497 * Negative values indicate an error.
498 */
499 int mi_lttng_event_function_probe(struct mi_writer *writer,
500 struct lttng_event *event);
501
502 /*
503 * Machine interface for kernel function entry event.
504 *
505 * writer An instance of a mi writer.
506 * event single trace event.
507 *
508 * Returns zero if the element's value could be written.
509 * Negative values indicate an error.
510 */
511 int mi_lttng_event_function_entry(struct mi_writer *writer,
512 struct lttng_event *event);
513
514 /*
515 * Machine interface: open an events element.
516 *
517 * writer An instance of a machine interface writer.
518 *
519 * Returns zero if the element's value could be written.
520 * Negative values indicate an error.
521 */
522 int mi_lttng_events_open(struct mi_writer *writer);
523
524 /*
525 * Machine interface for printing an event.
526 * The trace event type currently supported are:
527 * TRACEPOINT,
528 * PROBE,
529 * FUNCTION,
530 * FUNCTION_ENTRY,
531 * SYSCALL
532 *
533 * writer An instance of a mi writer.
534 * event single trace event.
535 * is_open Defines whether or not the session element shall be closed.
536 * This should be used carefully and the client
537 * must close the event element.
538 * Use case: nested additional information
539 * domain Event's domain
540 *
541 * Returns zero if the element's value could be written.
542 * Negative values indicate an error.
543 */
544 int mi_lttng_event(struct mi_writer *writer, struct lttng_event *event,
545 int is_open, enum lttng_domain_type domain);
546
547 /*
548 * Machine interface for struct lttng_event_field.
549 *
550 * writer An instance of a mi writer.
551 * field An event_field instance.
552 *
553 * Returns zero if the element's value could be written.
554 * Negative values indicate an error.
555 */
556 int mi_lttng_event_field(struct mi_writer *writer,
557 struct lttng_event_field *field);
558
559 /*
560 * Machine interface: open a event_fields element.
561 *
562 * writer An instance of a machine interface writer.
563 *
564 * Returns zero if the element have be written.
565 * Negative values indicate an error.
566 */
567 int mi_lttng_event_fields_open(struct mi_writer *writer);
568
569 /*
570 * Machine interface: open a trackers element.
571 *
572 * writer An instance of a machine interface writer.
573 *
574 * Returns zero if the element's value could be written.
575 * Negative values indicate an error.
576 */
577 int mi_lttng_trackers_open(struct mi_writer *writer);
578
579 /*
580 * Machine interface: open a pid_tracker element.
581 *
582 * writer An instance of a machine interface writer.
583 *
584 * Returns zero if the element's value could be written.
585 * Negative values indicate an error.
586 *
587 * Note: A targets element is also opened for each tracker definition
588 */
589 int mi_lttng_pid_tracker_open(struct mi_writer *writer);
590
591 /*
592 * Machine interface: open a PIDs 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_pids_open(struct mi_writer *writer);
600
601 /*
602 * Machine interface: open a processes element.
603 *
604 * writer An instance of a machine interface writer.
605 *
606 * Returns zero if the element's value could be written.
607 * Negative values indicate an error.
608 */
609 int mi_lttng_processes_open(struct mi_writer *writer);
610
611 /*
612 * Machine interface of a Process.
613 *
614 * writer An instance of a machine interface writer.
615 * pid A PID.
616 *
617 * is_open Defines whether or not the session element shall be closed.
618 * This should be used carefully and the client
619 * must close the pid element.
620 * Use case: nested addition information on a domain
621 * ex: channel event.
622 *
623 * Returns zero if the element's value could be written.
624 * Negative values indicate an error.
625 */
626 int mi_lttng_process(struct mi_writer *writer, pid_t pid , const char *name,
627 int is_open);
628
629 /*
630 * TODO: move pid of lttng list -u to process semantic on mi api bump
631 * Machine interface of a Process.
632 *
633 * writer An instance of a machine interface writer.
634 * pid A PID.
635 *
636 * is_open Defines whether or not the session element shall be closed.
637 * This should be used carefully and the client
638 * must close the pid element.
639 * Use case: nested addition information on a domain
640 * ex: channel event.
641 *
642 * Returns zero if the element's value could be written.
643 * Negative values indicate an error.
644 */
645 int mi_lttng_pid(struct mi_writer *writer, pid_t pid , const char *name,
646 int is_open);
647 /*
648 * Machine interface: open a targets element.
649 *
650 * writer An instance of a machine interface writer.
651 *
652 * Returns zero if the element's value could be written.
653 * Negative values indicate an error.
654 */
655 int mi_lttng_targets_open(struct mi_writer *writer);
656
657 /*
658 * Machine interface for track/untrack a pid_target
659 *
660 * writer An instance of a machine interface writer.
661 *
662 * Returns zero if the element's value could be written.
663 * Negative values indicate an error.
664 */
665 int mi_lttng_pid_target(struct mi_writer *writer, pid_t pid, int is_open);
666
667 /*
668 * Machine interface of a context.
669 *
670 * writer An instance of a machine interface writer
671 *
672 * context An instance of a lttng_event_context
673 *
674 * is_open Define if we close the context element
675 * This should be used carefully and the client
676 * need to close the context element.
677 * Returns zero if the element's value could be written.
678 * Negative values indicate an error.
679 */
680 int mi_lttng_context(struct mi_writer *writer,
681 struct lttng_event_context *context, int is_open);
682
683 /*
684 * Machine interface of a perf_counter_context.
685 *
686 * writer An instance of a machine interface writer
687 *
688 * contest An instance of a lttng_event_perf_counter_ctx
689 *
690 * Returns zero if the element's value could be written.
691 * Negative values indicate an error.
692 */
693 int mi_lttng_perf_counter_context(struct mi_writer *writer,
694 struct lttng_event_perf_counter_ctx *perf_context);
695
696 /*
697 * Machine interface of the snapshot list_output.
698 * It specifies the session for which we are listing snapshots,
699 * and it opens a snapshots element to list a sequence
700 * of snapshots.
701 *
702 * writer An instance of a machine interface writer.
703 *
704 * session_name: Snapshot output for session "session_name".
705 *
706 * Note: The client has to close the session and the snapshots elements after
707 * having listed every lttng_snapshot_output.
708 *
709 * Returns zero if the element's value could be written.
710 * Negative values indicate an error.
711 */
712 int mi_lttng_snapshot_output_session_name(struct mi_writer *writer,
713 const char *session_name);
714
715 /*
716 * Machine interface of the snapshot output.
717 * The machine interface serializes the following attributes:
718 * - id: ID of the snapshot output.
719 * - name: Name of the output.
720 * - data_url : Destination of the output.
721 * - ctrl_url: Destination of the output.
722 * - max_size: total size of all stream combined.
723 *
724 * writer An instance of a machine interface writer.
725 *
726 * output: A list of snapshot_output.
727 *
728 * Returns zero if the element's value could be written.
729 * Negative values indicate an error.
730 */
731 int mi_lttng_snapshot_list_output(struct mi_writer *writer,
732 struct lttng_snapshot_output *output);
733
734 /*
735 * Machine interface of the output of the command snapshot del output
736 * when deleting a snapshot either by id or by name.
737 * If the snapshot was found and successfully deleted using its id,
738 * it return the id of the snapshot and the current session name on which it
739 * was attached.
740 *
741 * Otherwise, it do the same process with the name of the snapshot, if the
742 * snapshot output id is undefined.
743 *
744 * writer An instance of a machine interface writer.
745 *
746 * id: ID of the snapshot output.
747 *
748 * name: Name of the snapshot.
749 *
750 * current_session_name: Session to which the snapshot belongs.
751 *
752 * Returns zero if the element's value could be written.
753 * Negative values indicate an error.
754 */
755 int mi_lttng_snapshot_del_output(struct mi_writer *writer, int id,
756 const char *name, const char *current_session_name);
757
758 /*
759 * Machine interface of the output of the command snapshot add output
760 * when adding a snapshot from a user URL.
761 *
762 * If the snapshot was successfully added, the machine interface lists
763 * these information:
764 * - id: ID of the newly add snapshot output.
765 * - current_session_name: Name of the session to which the output was added.
766 * - ctrl_url: Destination of the output.
767 * - max_size: total size of all stream combined.
768 *
769 * writer An instance of a machine interface writer.
770 *
771 * current_session_name: Session to which the snapshot belongs.
772 *
773 * n_ptr:
774 *
775 * output: iterator over a lttng_snapshot_output_list which contain
776 * the snapshot output informations.
777 *
778 * Returns zero if the element's value could be written.
779 * Negative values indicate an error.
780 */
781 int mi_lttng_snapshot_add_output(struct mi_writer *writer,
782 const char *current_session_name, const char *n_ptr,
783 struct lttng_snapshot_output *output);
784
785 /*
786 * Machine interface of the output of the command snapshot
787 * record from a URL (if given).
788 *
789 * If the snapshot is successfully recorded from a url, the machine interface
790 * output the following information:
791 * - url: Destination of the output stored in the snapshot.
792 *
793 * Otherwise, the machine interface output the data and ctrl url received
794 * from the command-line.
795 *
796 * writer An instance of a machine interface writer.
797 *
798 * current_session_name: Snapshot record for session "current_session_name".
799 *
800 * ctrl_url, data_url: Destination of the output receive from the command-line.
801 *
802 * Returns zero if the element's value could be written.
803 * Negative values indicate an error.
804 */
805 int mi_lttng_snapshot_record(struct mi_writer *writer,
806 const char *current_session_name, const char *url,
807 const char *cmdline_ctrl_url, const char *cmdline_data_url);
808
809 #endif /* _MI_LTTNG_H */
This page took 0.04626 seconds and 6 git commands to generate.