lttng-ctl: add override helper to load api
[lttng-tools.git] / include / lttng / load.h
CommitLineData
9245bd0e
DG
1/*
2 * Copyright (C) 2014 - Jérémie Galarneau <jeremie.galarneau@efficios.com>
3 * David Goulet <dgoulet@efficios.com>
4 *
5 * This library is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU Lesser General Public License, version 2.1 only,
7 * as published by the Free Software Foundation.
8 *
9 * This library 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 Lesser General Public License
12 * for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with this library; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19#ifndef LTTNG_LOAD_H
20#define LTTNG_LOAD_H
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
26/*
27 * The lttng_load_session_attr object is opaque to the user. Use the helper
28 * functions below to use them.
29 */
30struct lttng_load_session_attr;
31
32/*
33 * Return a newly allocated load session attribute object or NULL on error.
34 */
35struct lttng_load_session_attr *lttng_load_session_attr_create(void);
36
37/*
38 * Free a given load session attribute object.
39 */
40void lttng_load_session_attr_destroy(struct lttng_load_session_attr *attr);
41
42
43/*
6c1832fe 44 * Load session attribute getter family functions.
9245bd0e
DG
45 */
46
6c1832fe 47/* Return session name. NULL indicated all sessions must be loaded. */
9245bd0e
DG
48const char *lttng_load_session_attr_get_session_name(
49 struct lttng_load_session_attr *attr);
50/*
6c1832fe
JR
51 * Return input URL. A NULL value indicates the default session
52 * configuration location. The URL format used is documented in lttng-create(1).
9245bd0e
DG
53 * NULL indicates that the default session configuration path is used.
54 */
55const char *lttng_load_session_attr_get_input_url(
56 struct lttng_load_session_attr *attr);
57
58/*
59 * Return the configuration overwrite attribute. This attribute indicates
6c1832fe
JR
60 * whether or not the loaded session is loaded even if a session with the same
61 * name already exist. If so the existing session is deleted before the
62 * replacement is loaded.
9245bd0e
DG
63 */
64int lttng_load_session_attr_get_overwrite(
65 struct lttng_load_session_attr *attr);
96607445
JR
66/*
67 * Return the configuration override path url attribute. This attribute
68 * indicate an override to be applied during the loading of the configuration.
69 * Null indicates no override will be applied on configuration load.
70 *
71 * Caller is responsible for freeing the return value.
72 */
73const char *lttng_load_session_attr_get_override_path_url(
74 struct lttng_load_session_attr *attr);
75
76/*
77 * Return the configuration override control url attribute. This attribute
78 * indicate an override to be applied during the loading of the configuration.
79 * Null indicates no override will be applied on configuration load.
80 *
81 * Caller is responsible for freeing the return value.
82 */
83const char *lttng_load_session_attr_get_override_ctrl_url(
84 struct lttng_load_session_attr *attr);
85
86/*
87 * Return the configuration override data url attribute. This attribute
88 * indicate an override to be applied during the loading of the configuration.
89 * Null indicates no override will be applied on configuration load.
90 *
91 * Caller is responsible for freeing the return value.
92 */
93const char *lttng_load_session_attr_get_override_data_url(
94 struct lttng_load_session_attr *attr);
95
96/*
97 * Return the configuration override url attribute. This attribute
98 * indicate an override to be applied during the loading of the configuration.
99 * Null indicates no override will be applied on configuration load.
100 *
101 * Caller is responsible for freeing the return value.
102 */
103const char *lttng_load_session_attr_get_override_url(
104 struct lttng_load_session_attr *attr);
9245bd0e
DG
105
106/*
6c1832fe 107 * Load session attribute setter family functions.
9245bd0e
DG
108 *
109 * For every set* call, 0 is returned on success or else -LTTNG_ERR_INVALID is
110 * returned indicating that at least one given parameter is invalid.
111 */
112
113/*
114 * Set the name of the session to load. A NULL name means all sessions
6c1832fe 115 * known to the session daemon will be loaded.
9245bd0e
DG
116 */
117int lttng_load_session_attr_set_session_name(
118 struct lttng_load_session_attr *attr, const char *session_name);
119
120/*
121 * Set the URL of the session configuration to load. A NULL value indicates the
122 * use of the default location being the session one.
123 *
124 * Note that file:// is the only supported URL format.
125 */
126int lttng_load_session_attr_set_input_url(
127 struct lttng_load_session_attr *attr, const char *url);
128
129/*
6c1832fe
JR
130 * Set the overwrite attribute. If set to true, current session matching the
131 * loaded sessions will be deleted and the loaded sessions created.
9245bd0e
DG
132 */
133int lttng_load_session_attr_set_overwrite(
134 struct lttng_load_session_attr *attr, int overwrite);
135
96607445
JR
136/*
137 * The following setter are for overriding sessions attributes during the
138 * loading of a configuration files. Those attributes prevail upon those
139 * specified in the loaded configuration file.
140 * */
141
142/*
143 * Set the path url override attribute.
144 *
145 * Supported format:
146 * file://TRACEPATH
147 */
148int lttng_load_session_attr_set_override_path_url(
149 struct lttng_load_session_attr *attr, const char *url);
150
151/*
152 * Set the control url override attribute.
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 */
161int lttng_load_session_attr_set_override_ctrl_url(
162 struct lttng_load_session_attr *attr, const char *url);
163
164/*
165 * Set the data url override attribute.
166 *
167 * Supported format:
168 * NETPROTO://(HOST | IPADDR)[:PORT][/TRACEPATH]
169 *
170 * Where NETPROTO is one of tcp,tcp6
171 *
172 * See lttng-create(1) for more detail.
173 */
174int lttng_load_session_attr_set_override_data_url(
175 struct lttng_load_session_attr *attr, const char *url);
176
177/*
178 * Set the url override attribute.
179 *
180 * Supported format:
181 * file://TRACEPATH
182 * NETPROTO://(HOST | IPADDR)[:CTRLPORT[:DATAPORT]][/TRACEPATH]
183 *
184 * See lttng-create(1) for more detail.
185 */
186int lttng_load_session_attr_set_override_url(
187 struct lttng_load_session_attr *attr, const char *url);
9245bd0e 188/*
6c1832fe 189 * Load session configuration(s).
9245bd0e
DG
190 *
191 * The lttng_load_session_attr object must not be NULL. No ownership of the
192 * object is kept by the function; it must be released by the caller.
193 *
194 * Returns 0 on success or a negative LTTNG_ERR value on error.
195 */
196int lttng_load_session(struct lttng_load_session_attr *attr);
197
198#ifdef __cplusplus
199}
200#endif
201
202#endif /* LTTNG_LOAD_H */
This page took 0.043261 seconds and 5 git commands to generate.