lib: compile liblttng-ctl as C++
[lttng-tools.git] / include / lttng / load.h
CommitLineData
9245bd0e 1/*
ab5be9fa
MJ
2 * Copyright (C) 2014 Jérémie Galarneau <jeremie.galarneau@efficios.com>
3 * Copyright (C) 2014 David Goulet <dgoulet@efficios.com>
9245bd0e 4 *
ab5be9fa 5 * SPDX-License-Identifier: LGPL-2.1-only
9245bd0e 6 *
9245bd0e
DG
7 */
8
9#ifndef LTTNG_LOAD_H
10#define LTTNG_LOAD_H
11
4bd69c5f
SM
12#include <lttng/lttng-export.h>
13
9245bd0e
DG
14#ifdef __cplusplus
15extern "C" {
16#endif
17
18/*
19 * The lttng_load_session_attr object is opaque to the user. Use the helper
d13d3ec7 20 * functions below to use it.
9245bd0e
DG
21 */
22struct lttng_load_session_attr;
23
24/*
25 * Return a newly allocated load session attribute object or NULL on error.
26 */
4bd69c5f 27LTTNG_EXPORT extern struct lttng_load_session_attr *lttng_load_session_attr_create(void);
9245bd0e
DG
28
29/*
30 * Free a given load session attribute object.
31 */
4bd69c5f 32LTTNG_EXPORT extern void lttng_load_session_attr_destroy(struct lttng_load_session_attr *attr);
9245bd0e
DG
33
34
35/*
d13d3ec7 36 * Load session attribute getter family of functions.
9245bd0e
DG
37 */
38
d13d3ec7 39/* Return session name. NULL indicates all sessions must be loaded. */
4bd69c5f 40LTTNG_EXPORT extern const char *lttng_load_session_attr_get_session_name(
9245bd0e
DG
41 struct lttng_load_session_attr *attr);
42/*
c4fc6c6c
JR
43 * Return input URL. A NULL value indicates the default session
44 * configuration location. The URL format used is documented in lttng-create(1).
9245bd0e
DG
45 * NULL indicates that the default session configuration path is used.
46 */
4bd69c5f 47LTTNG_EXPORT extern const char *lttng_load_session_attr_get_input_url(
9245bd0e
DG
48 struct lttng_load_session_attr *attr);
49
50/*
51 * Return the configuration overwrite attribute. This attribute indicates
d13d3ec7
JG
52 * whether or not the loaded session should be loaded even if a session with the
53 * same name already exists. If such a session exists, it is destroyed before
54 * the replacement is loaded.
9245bd0e 55 */
4bd69c5f 56LTTNG_EXPORT extern int lttng_load_session_attr_get_overwrite(
9245bd0e
DG
57 struct lttng_load_session_attr *attr);
58
a2a75fa4
JR
59/*
60 * Return the destination URL configuration override attribute. This attribute
61 * indicates a destination URL override to be applied during the loading of the
62 * configuration.
63 *
64 * NULL indicates no override will be applied on configuration load.
a2a75fa4 65 */
4bd69c5f 66LTTNG_EXPORT extern const char *lttng_load_session_attr_get_override_url(
a2a75fa4
JR
67 struct lttng_load_session_attr *attr);
68
69/*
70 * Return the configuration override control URL attribute. This attribute
71 * indicates a control URL override to be applied during the loading of the
72 * configuration(s).
73 *
74 * NULL indicates no control URL override will be applied on configuration load.
a2a75fa4 75 */
4bd69c5f 76LTTNG_EXPORT extern const char *lttng_load_session_attr_get_override_ctrl_url(
a2a75fa4
JR
77 struct lttng_load_session_attr *attr);
78
79/*
80 * Return the configuration override data URL attribute. This attribute
6c103048 81 * indicates a data URL override to be applied during the loading of the
a2a75fa4
JR
82 * configuration(s).
83 *
84 * NULL indicates no data URL override will be applied on configuration load.
a2a75fa4 85 */
4bd69c5f 86LTTNG_EXPORT extern const char *lttng_load_session_attr_get_override_data_url(
a2a75fa4
JR
87 struct lttng_load_session_attr *attr);
88
2aaf5fc7
JR
89/*
90 * Return the configuration override session name attribute.
91 * This attribute indicates a session name override to be applied during
92 * the loading of the configuration(s).
93 *
94 * NULL indicates no session name override will be applied on configuration
95 * load.
96 */
4bd69c5f 97LTTNG_EXPORT extern const char *lttng_load_session_attr_get_override_session_name(
2aaf5fc7
JR
98 struct lttng_load_session_attr *attr);
99
9245bd0e 100/*
d13d3ec7 101 * Load session attribute setter family of functions.
9245bd0e
DG
102 *
103 * For every set* call, 0 is returned on success or else -LTTNG_ERR_INVALID is
104 * returned indicating that at least one given parameter is invalid.
105 */
106
107/*
108 * Set the name of the session to load. A NULL name means all sessions
d13d3ec7 109 * found at the input URL will be loaded.
9245bd0e 110 */
4bd69c5f 111LTTNG_EXPORT extern int lttng_load_session_attr_set_session_name(
9245bd0e
DG
112 struct lttng_load_session_attr *attr, const char *session_name);
113
114/*
115 * Set the URL of the session configuration to load. A NULL value indicates the
d13d3ec7 116 * use of the default session configuration location.
9245bd0e
DG
117 *
118 * Note that file:// is the only supported URL format.
119 */
4bd69c5f 120LTTNG_EXPORT extern int lttng_load_session_attr_set_input_url(
9245bd0e
DG
121 struct lttng_load_session_attr *attr, const char *url);
122
123/*
d13d3ec7 124 * Set the overwrite attribute. If set to true, current sessions matching the
a2a75fa4 125 * loaded sessions will be destroyed and be replaced by the session(s) being
d13d3ec7 126 * loaded.
9245bd0e 127 */
4bd69c5f 128LTTNG_EXPORT extern int lttng_load_session_attr_set_overwrite(
9245bd0e
DG
129 struct lttng_load_session_attr *attr, int overwrite);
130
a2a75fa4
JR
131/*
132 * The following setter are for overriding sessions attributes during the
133 * loading of a configuration files. Those attributes prevail upon those
134 * specified in the loaded configuration file.
135 * */
136
137/*
d5d2ef2b 138 * Set the url override attribute.
a2a75fa4
JR
139 *
140 * Supported format:
d5d2ef2b
JG
141 * file://TRACEPATH
142 * NETPROTO://(HOST | IPADDR)[:CTRLPORT[:DATAPORT]][/TRACEPATH]
a2a75fa4
JR
143 *
144 * Where NETPROTO is one of {tcp, tcp6}
145 *
146 * See lttng-create(1) for more detail.
147 */
4bd69c5f 148LTTNG_EXPORT extern int lttng_load_session_attr_set_override_url(
a2a75fa4
JR
149 struct lttng_load_session_attr *attr, const char *url);
150
151/*
d5d2ef2b 152 * Set the control url override attribute.
a2a75fa4
JR
153 *
154 * Supported format:
155 * NETPROTO://(HOST | IPADDR)[:PORT][/TRACEPATH]
156 *
157 * Where NETPROTO is one of {tcp, tcp6}
158 *
159 * See lttng-create(1) for more detail.
160 */
4bd69c5f 161LTTNG_EXPORT extern int lttng_load_session_attr_set_override_ctrl_url(
a2a75fa4
JR
162 struct lttng_load_session_attr *attr, const char *url);
163
164/*
d5d2ef2b 165 * Set the data url override attribute.
a2a75fa4
JR
166 *
167 * Supported format:
d5d2ef2b 168 * NETPROTO://(HOST | IPADDR)[:PORT][/TRACEPATH]
a2a75fa4
JR
169 *
170 * Where NETPROTO is one of {tcp, tcp6}
171 *
172 * See lttng-create(1) for more detail.
173 */
4bd69c5f 174LTTNG_EXPORT extern int lttng_load_session_attr_set_override_data_url(
a2a75fa4
JR
175 struct lttng_load_session_attr *attr, const char *url);
176
2aaf5fc7
JR
177/*
178 * Set the session name override attribute.
179 *
180 * Loading a configuration file defining multiple sessions will fail if a
181 * session name is provided.
182 */
4bd69c5f 183LTTNG_EXPORT extern int lttng_load_session_attr_set_override_session_name(
2aaf5fc7
JR
184 struct lttng_load_session_attr *attr, const char *session_name);
185
9245bd0e 186/*
c4fc6c6c 187 * Load session configuration(s).
9245bd0e
DG
188 *
189 * The lttng_load_session_attr object must not be NULL. No ownership of the
190 * object is kept by the function; it must be released by the caller.
191 *
192 * Returns 0 on success or a negative LTTNG_ERR value on error.
193 */
4bd69c5f 194LTTNG_EXPORT extern int lttng_load_session(struct lttng_load_session_attr *attr);
9245bd0e
DG
195
196#ifdef __cplusplus
197}
198#endif
199
200#endif /* LTTNG_LOAD_H */
This page took 0.043753 seconds and 4 git commands to generate.