694c20b9292a078cbdfe1eaecc9dc3d9823b67aa
[lttng-tools.git] / include / lttng / load.h
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
23 extern "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 it.
29 */
30 struct lttng_load_session_attr;
31
32 /*
33 * Return a newly allocated load session attribute object or NULL on error.
34 */
35 struct lttng_load_session_attr *lttng_load_session_attr_create(void);
36
37 /*
38 * Free a given load session attribute object.
39 */
40 void lttng_load_session_attr_destroy(struct lttng_load_session_attr *attr);
41
42
43 /*
44 * Load session attribute getter family of functions.
45 */
46
47 /* Return session name. NULL indicates all sessions must be loaded. */
48 const char *lttng_load_session_attr_get_session_name(
49 struct lttng_load_session_attr *attr);
50 /*
51 * Return input URL. A NULL value indicates the default session
52 * configuration location. The URL format used is documented in lttng-create(1).
53 * NULL indicates that the default session configuration path is used.
54 */
55 const 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
60 * whether or not the loaded session should be loaded even if a session with the
61 * same name already exists. If such a session exists, it is destroyed before
62 * the replacement is loaded.
63 */
64 int lttng_load_session_attr_get_overwrite(
65 struct lttng_load_session_attr *attr);
66
67 /*
68 * Return the destination URL configuration override attribute. This attribute
69 * indicates a destination URL override to be applied during the loading of the
70 * configuration.
71 *
72 * NULL indicates no override will be applied on configuration load.
73 *
74 * Caller is responsible for freeing the return value.
75 */
76 const char *lttng_load_session_attr_get_override_url(
77 struct lttng_load_session_attr *attr);
78
79 /*
80 * Return the configuration override control URL attribute. This attribute
81 * indicates a control URL override to be applied during the loading of the
82 * configuration(s).
83 *
84 * NULL indicates no control URL override will be applied on configuration load.
85 *
86 * Caller is responsible for freeing the return value.
87 */
88 const char *lttng_load_session_attr_get_override_ctrl_url(
89 struct lttng_load_session_attr *attr);
90
91 /*
92 * Return the configuration override data URL attribute. This attribute
93 * indicate a data URL override to be applied during the loading of the
94 * configuration(s).
95 *
96 * NULL indicates no data URL override will be applied on configuration load.
97 *
98 * Caller is responsible for freeing the return value.
99 */
100 const char *lttng_load_session_attr_get_override_data_url(
101 struct lttng_load_session_attr *attr);
102
103 /*
104 * Load session attribute setter family of functions.
105 *
106 * For every set* call, 0 is returned on success or else -LTTNG_ERR_INVALID is
107 * returned indicating that at least one given parameter is invalid.
108 */
109
110 /*
111 * Set the name of the session to load. A NULL name means all sessions
112 * found at the input URL will be loaded.
113 */
114 int lttng_load_session_attr_set_session_name(
115 struct lttng_load_session_attr *attr, const char *session_name);
116
117 /*
118 * Set the URL of the session configuration to load. A NULL value indicates the
119 * use of the default session configuration location.
120 *
121 * Note that file:// is the only supported URL format.
122 */
123 int lttng_load_session_attr_set_input_url(
124 struct lttng_load_session_attr *attr, const char *url);
125
126 /*
127 * Set the overwrite attribute. If set to true, current sessions matching the
128 * loaded sessions will be destroyed and be replaced by the session(s) being
129 * loaded.
130 */
131 int lttng_load_session_attr_set_overwrite(
132 struct lttng_load_session_attr *attr, int overwrite);
133
134 /*
135 * The following setter are for overriding sessions attributes during the
136 * loading of a configuration files. Those attributes prevail upon those
137 * specified in the loaded configuration file.
138 * */
139
140 /*
141 * Set the url override attribute.
142 *
143 * Supported format:
144 * file://TRACEPATH
145 * NETPROTO://(HOST | IPADDR)[:CTRLPORT[:DATAPORT]][/TRACEPATH]
146 *
147 * Where NETPROTO is one of {tcp, tcp6}
148 *
149 * See lttng-create(1) for more detail.
150 */
151 int lttng_load_session_attr_set_override_url(
152 struct lttng_load_session_attr *attr, const char *url);
153
154 /*
155 * Set the control url override attribute.
156 *
157 * Supported format:
158 * NETPROTO://(HOST | IPADDR)[:PORT][/TRACEPATH]
159 *
160 * Where NETPROTO is one of {tcp, tcp6}
161 *
162 * See lttng-create(1) for more detail.
163 */
164 int lttng_load_session_attr_set_override_ctrl_url(
165 struct lttng_load_session_attr *attr, const char *url);
166
167 /*
168 * Set the data url override attribute.
169 *
170 * Supported format:
171 * NETPROTO://(HOST | IPADDR)[:PORT][/TRACEPATH]
172 *
173 * Where NETPROTO is one of {tcp, tcp6}
174 *
175 * See lttng-create(1) for more detail.
176 */
177 int lttng_load_session_attr_set_override_data_url(
178 struct lttng_load_session_attr *attr, const char *url);
179
180 /*
181 * Load session configuration(s).
182 *
183 * The lttng_load_session_attr object must not be NULL. No ownership of the
184 * object is kept by the function; it must be released by the caller.
185 *
186 * Returns 0 on success or a negative LTTNG_ERR value on error.
187 */
188 int lttng_load_session(struct lttng_load_session_attr *attr);
189
190 #ifdef __cplusplus
191 }
192 #endif
193
194 #endif /* LTTNG_LOAD_H */
This page took 0.031588 seconds and 3 git commands to generate.