Commit | Line | Data |
---|---|---|
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 | |
23 | extern "C" { | |
24 | #endif | |
25 | ||
26 | /* | |
27 | * The lttng_load_session_attr object is opaque to the user. Use the helper | |
d13d3ec7 | 28 | * functions below to use it. |
9245bd0e DG |
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 | /* | |
d13d3ec7 | 44 | * Load session attribute getter family of functions. |
9245bd0e DG |
45 | */ |
46 | ||
d13d3ec7 | 47 | /* Return session name. NULL indicates all sessions must be loaded. */ |
9245bd0e DG |
48 | const char *lttng_load_session_attr_get_session_name( |
49 | struct lttng_load_session_attr *attr); | |
50 | /* | |
c4fc6c6c 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 | */ | |
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 | |
d13d3ec7 JG |
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. | |
9245bd0e DG |
63 | */ |
64 | int lttng_load_session_attr_get_overwrite( | |
65 | struct lttng_load_session_attr *attr); | |
66 | ||
a2a75fa4 JR |
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. | |
a2a75fa4 JR |
73 | */ |
74 | const char *lttng_load_session_attr_get_override_url( | |
75 | struct lttng_load_session_attr *attr); | |
76 | ||
77 | /* | |
78 | * Return the configuration override control URL attribute. This attribute | |
79 | * indicates a control URL override to be applied during the loading of the | |
80 | * configuration(s). | |
81 | * | |
82 | * NULL indicates no control URL override will be applied on configuration load. | |
a2a75fa4 JR |
83 | */ |
84 | const char *lttng_load_session_attr_get_override_ctrl_url( | |
85 | struct lttng_load_session_attr *attr); | |
86 | ||
87 | /* | |
88 | * Return the configuration override data URL attribute. This attribute | |
6c103048 | 89 | * indicates a data URL override to be applied during the loading of the |
a2a75fa4 JR |
90 | * configuration(s). |
91 | * | |
92 | * NULL indicates no data URL override will be applied on configuration load. | |
a2a75fa4 JR |
93 | */ |
94 | const char *lttng_load_session_attr_get_override_data_url( | |
95 | struct lttng_load_session_attr *attr); | |
96 | ||
2aaf5fc7 JR |
97 | /* |
98 | * Return the configuration override session name attribute. | |
99 | * This attribute indicates a session name override to be applied during | |
100 | * the loading of the configuration(s). | |
101 | * | |
102 | * NULL indicates no session name override will be applied on configuration | |
103 | * load. | |
104 | */ | |
105 | const char *lttng_load_session_attr_get_override_session_name( | |
106 | struct lttng_load_session_attr *attr); | |
107 | ||
9245bd0e | 108 | /* |
d13d3ec7 | 109 | * Load session attribute setter family of functions. |
9245bd0e DG |
110 | * |
111 | * For every set* call, 0 is returned on success or else -LTTNG_ERR_INVALID is | |
112 | * returned indicating that at least one given parameter is invalid. | |
113 | */ | |
114 | ||
115 | /* | |
116 | * Set the name of the session to load. A NULL name means all sessions | |
d13d3ec7 | 117 | * found at the input URL will be loaded. |
9245bd0e DG |
118 | */ |
119 | int lttng_load_session_attr_set_session_name( | |
120 | struct lttng_load_session_attr *attr, const char *session_name); | |
121 | ||
122 | /* | |
123 | * Set the URL of the session configuration to load. A NULL value indicates the | |
d13d3ec7 | 124 | * use of the default session configuration location. |
9245bd0e DG |
125 | * |
126 | * Note that file:// is the only supported URL format. | |
127 | */ | |
128 | int lttng_load_session_attr_set_input_url( | |
129 | struct lttng_load_session_attr *attr, const char *url); | |
130 | ||
131 | /* | |
d13d3ec7 | 132 | * Set the overwrite attribute. If set to true, current sessions matching the |
a2a75fa4 | 133 | * loaded sessions will be destroyed and be replaced by the session(s) being |
d13d3ec7 | 134 | * loaded. |
9245bd0e DG |
135 | */ |
136 | int lttng_load_session_attr_set_overwrite( | |
137 | struct lttng_load_session_attr *attr, int overwrite); | |
138 | ||
a2a75fa4 JR |
139 | /* |
140 | * The following setter are for overriding sessions attributes during the | |
141 | * loading of a configuration files. Those attributes prevail upon those | |
142 | * specified in the loaded configuration file. | |
143 | * */ | |
144 | ||
145 | /* | |
d5d2ef2b | 146 | * Set the url override attribute. |
a2a75fa4 JR |
147 | * |
148 | * Supported format: | |
d5d2ef2b JG |
149 | * file://TRACEPATH |
150 | * NETPROTO://(HOST | IPADDR)[:CTRLPORT[:DATAPORT]][/TRACEPATH] | |
a2a75fa4 JR |
151 | * |
152 | * Where NETPROTO is one of {tcp, tcp6} | |
153 | * | |
154 | * See lttng-create(1) for more detail. | |
155 | */ | |
d5d2ef2b | 156 | int lttng_load_session_attr_set_override_url( |
a2a75fa4 JR |
157 | struct lttng_load_session_attr *attr, const char *url); |
158 | ||
159 | /* | |
d5d2ef2b | 160 | * Set the control url override attribute. |
a2a75fa4 JR |
161 | * |
162 | * Supported format: | |
163 | * NETPROTO://(HOST | IPADDR)[:PORT][/TRACEPATH] | |
164 | * | |
165 | * Where NETPROTO is one of {tcp, tcp6} | |
166 | * | |
167 | * See lttng-create(1) for more detail. | |
168 | */ | |
d5d2ef2b | 169 | int lttng_load_session_attr_set_override_ctrl_url( |
a2a75fa4 JR |
170 | struct lttng_load_session_attr *attr, const char *url); |
171 | ||
172 | /* | |
d5d2ef2b | 173 | * Set the data url override attribute. |
a2a75fa4 JR |
174 | * |
175 | * Supported format: | |
d5d2ef2b | 176 | * NETPROTO://(HOST | IPADDR)[:PORT][/TRACEPATH] |
a2a75fa4 JR |
177 | * |
178 | * Where NETPROTO is one of {tcp, tcp6} | |
179 | * | |
180 | * See lttng-create(1) for more detail. | |
181 | */ | |
d5d2ef2b | 182 | int lttng_load_session_attr_set_override_data_url( |
a2a75fa4 JR |
183 | struct lttng_load_session_attr *attr, const char *url); |
184 | ||
2aaf5fc7 JR |
185 | /* |
186 | * Set the session name override attribute. | |
187 | * | |
188 | * Loading a configuration file defining multiple sessions will fail if a | |
189 | * session name is provided. | |
190 | */ | |
191 | int lttng_load_session_attr_set_override_session_name( | |
192 | struct lttng_load_session_attr *attr, const char *session_name); | |
193 | ||
9245bd0e | 194 | /* |
c4fc6c6c | 195 | * Load session configuration(s). |
9245bd0e DG |
196 | * |
197 | * The lttng_load_session_attr object must not be NULL. No ownership of the | |
198 | * object is kept by the function; it must be released by the caller. | |
199 | * | |
200 | * Returns 0 on success or a negative LTTNG_ERR value on error. | |
201 | */ | |
202 | int lttng_load_session(struct lttng_load_session_attr *attr); | |
203 | ||
204 | #ifdef __cplusplus | |
205 | } | |
206 | #endif | |
207 | ||
208 | #endif /* LTTNG_LOAD_H */ |