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