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