Commit | Line | Data |
---|---|---|
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 |
15 | extern "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 | */ |
22 | struct lttng_load_session_attr; | |
23 | ||
24 | /* | |
25 | * Return a newly allocated load session attribute object or NULL on error. | |
26 | */ | |
4bd69c5f | 27 | LTTNG_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 | 32 | LTTNG_EXPORT extern void lttng_load_session_attr_destroy(struct lttng_load_session_attr *attr); |
9245bd0e | 33 | |
9245bd0e | 34 | /* |
d13d3ec7 | 35 | * Load session attribute getter family of functions. |
9245bd0e DG |
36 | */ |
37 | ||
d13d3ec7 | 38 | /* Return session name. NULL indicates all sessions must be loaded. */ |
28f23191 JG |
39 | LTTNG_EXPORT extern const char * |
40 | lttng_load_session_attr_get_session_name(struct lttng_load_session_attr *attr); | |
9245bd0e | 41 | /* |
c4fc6c6c JR |
42 | * Return input URL. A NULL value indicates the default session |
43 | * configuration location. The URL format used is documented in lttng-create(1). | |
9245bd0e DG |
44 | * NULL indicates that the default session configuration path is used. |
45 | */ | |
28f23191 JG |
46 | LTTNG_EXPORT extern const char * |
47 | lttng_load_session_attr_get_input_url(struct lttng_load_session_attr *attr); | |
9245bd0e DG |
48 | |
49 | /* | |
50 | * Return the configuration overwrite attribute. This attribute indicates | |
d13d3ec7 JG |
51 | * whether or not the loaded session should be loaded even if a session with the |
52 | * same name already exists. If such a session exists, it is destroyed before | |
53 | * the replacement is loaded. | |
9245bd0e | 54 | */ |
28f23191 | 55 | LTTNG_EXPORT extern int lttng_load_session_attr_get_overwrite(struct lttng_load_session_attr *attr); |
9245bd0e | 56 | |
a2a75fa4 JR |
57 | /* |
58 | * Return the destination URL configuration override attribute. This attribute | |
59 | * indicates a destination URL override to be applied during the loading of the | |
60 | * configuration. | |
61 | * | |
62 | * NULL indicates no override will be applied on configuration load. | |
a2a75fa4 | 63 | */ |
28f23191 JG |
64 | LTTNG_EXPORT extern const char * |
65 | lttng_load_session_attr_get_override_url(struct lttng_load_session_attr *attr); | |
a2a75fa4 JR |
66 | |
67 | /* | |
68 | * Return the configuration override control URL attribute. This attribute | |
69 | * indicates a control URL override to be applied during the loading of the | |
70 | * configuration(s). | |
71 | * | |
72 | * NULL indicates no control URL override will be applied on configuration load. | |
a2a75fa4 | 73 | */ |
28f23191 JG |
74 | LTTNG_EXPORT extern const char * |
75 | lttng_load_session_attr_get_override_ctrl_url(struct lttng_load_session_attr *attr); | |
a2a75fa4 JR |
76 | |
77 | /* | |
78 | * Return the configuration override data URL attribute. This attribute | |
6c103048 | 79 | * indicates a data URL override to be applied during the loading of the |
a2a75fa4 JR |
80 | * configuration(s). |
81 | * | |
82 | * NULL indicates no data URL override will be applied on configuration load. | |
a2a75fa4 | 83 | */ |
28f23191 JG |
84 | LTTNG_EXPORT extern const char * |
85 | lttng_load_session_attr_get_override_data_url(struct lttng_load_session_attr *attr); | |
a2a75fa4 | 86 | |
2aaf5fc7 JR |
87 | /* |
88 | * Return the configuration override session name attribute. | |
89 | * This attribute indicates a session name override to be applied during | |
90 | * the loading of the configuration(s). | |
91 | * | |
92 | * NULL indicates no session name override will be applied on configuration | |
93 | * load. | |
94 | */ | |
28f23191 JG |
95 | LTTNG_EXPORT extern const char * |
96 | lttng_load_session_attr_get_override_session_name(struct lttng_load_session_attr *attr); | |
2aaf5fc7 | 97 | |
9245bd0e | 98 | /* |
d13d3ec7 | 99 | * Load session attribute setter family of functions. |
9245bd0e DG |
100 | * |
101 | * For every set* call, 0 is returned on success or else -LTTNG_ERR_INVALID is | |
102 | * returned indicating that at least one given parameter is invalid. | |
103 | */ | |
104 | ||
105 | /* | |
106 | * Set the name of the session to load. A NULL name means all sessions | |
d13d3ec7 | 107 | * found at the input URL will be loaded. |
9245bd0e | 108 | */ |
28f23191 JG |
109 | LTTNG_EXPORT extern int |
110 | lttng_load_session_attr_set_session_name(struct lttng_load_session_attr *attr, | |
111 | const char *session_name); | |
9245bd0e DG |
112 | |
113 | /* | |
114 | * Set the URL of the session configuration to load. A NULL value indicates the | |
d13d3ec7 | 115 | * use of the default session configuration location. |
9245bd0e DG |
116 | * |
117 | * Note that file:// is the only supported URL format. | |
118 | */ | |
28f23191 JG |
119 | LTTNG_EXPORT extern int lttng_load_session_attr_set_input_url(struct lttng_load_session_attr *attr, |
120 | const char *url); | |
9245bd0e DG |
121 | |
122 | /* | |
d13d3ec7 | 123 | * Set the overwrite attribute. If set to true, current sessions matching the |
a2a75fa4 | 124 | * loaded sessions will be destroyed and be replaced by the session(s) being |
d13d3ec7 | 125 | * loaded. |
9245bd0e | 126 | */ |
28f23191 JG |
127 | LTTNG_EXPORT extern int lttng_load_session_attr_set_overwrite(struct lttng_load_session_attr *attr, |
128 | int overwrite); | |
9245bd0e | 129 | |
a2a75fa4 JR |
130 | /* |
131 | * The following setter are for overriding sessions attributes during the | |
132 | * loading of a configuration files. Those attributes prevail upon those | |
133 | * specified in the loaded configuration file. | |
134 | * */ | |
135 | ||
136 | /* | |
d5d2ef2b | 137 | * Set the url override attribute. |
a2a75fa4 JR |
138 | * |
139 | * Supported format: | |
d5d2ef2b JG |
140 | * file://TRACEPATH |
141 | * NETPROTO://(HOST | IPADDR)[:CTRLPORT[:DATAPORT]][/TRACEPATH] | |
a2a75fa4 JR |
142 | * |
143 | * Where NETPROTO is one of {tcp, tcp6} | |
144 | * | |
145 | * See lttng-create(1) for more detail. | |
146 | */ | |
28f23191 JG |
147 | LTTNG_EXPORT extern int |
148 | lttng_load_session_attr_set_override_url(struct lttng_load_session_attr *attr, const char *url); | |
a2a75fa4 JR |
149 | |
150 | /* | |
d5d2ef2b | 151 | * Set the control url override attribute. |
a2a75fa4 JR |
152 | * |
153 | * Supported format: | |
154 | * NETPROTO://(HOST | IPADDR)[:PORT][/TRACEPATH] | |
155 | * | |
156 | * Where NETPROTO is one of {tcp, tcp6} | |
157 | * | |
158 | * See lttng-create(1) for more detail. | |
159 | */ | |
28f23191 JG |
160 | LTTNG_EXPORT extern int |
161 | lttng_load_session_attr_set_override_ctrl_url(struct lttng_load_session_attr *attr, | |
162 | const char *url); | |
a2a75fa4 JR |
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 | */ | |
28f23191 JG |
174 | LTTNG_EXPORT extern int |
175 | lttng_load_session_attr_set_override_data_url(struct lttng_load_session_attr *attr, | |
176 | const char *url); | |
a2a75fa4 | 177 | |
2aaf5fc7 JR |
178 | /* |
179 | * Set the session name override attribute. | |
180 | * | |
181 | * Loading a configuration file defining multiple sessions will fail if a | |
182 | * session name is provided. | |
183 | */ | |
28f23191 JG |
184 | LTTNG_EXPORT extern int |
185 | lttng_load_session_attr_set_override_session_name(struct lttng_load_session_attr *attr, | |
186 | const char *session_name); | |
2aaf5fc7 | 187 | |
9245bd0e | 188 | /* |
c4fc6c6c | 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 | */ | |
4bd69c5f | 196 | LTTNG_EXPORT extern int lttng_load_session(struct lttng_load_session_attr *attr); |
9245bd0e DG |
197 | |
198 | #ifdef __cplusplus | |
199 | } | |
200 | #endif | |
201 | ||
202 | #endif /* LTTNG_LOAD_H */ |