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 | ||
12 | #ifdef __cplusplus | |
13 | extern "C" { | |
14 | #endif | |
15 | ||
16 | /* | |
17 | * The lttng_load_session_attr object is opaque to the user. Use the helper | |
d13d3ec7 | 18 | * functions below to use it. |
9245bd0e DG |
19 | */ |
20 | struct lttng_load_session_attr; | |
21 | ||
22 | /* | |
23 | * Return a newly allocated load session attribute object or NULL on error. | |
24 | */ | |
25 | struct lttng_load_session_attr *lttng_load_session_attr_create(void); | |
26 | ||
27 | /* | |
28 | * Free a given load session attribute object. | |
29 | */ | |
30 | void lttng_load_session_attr_destroy(struct lttng_load_session_attr *attr); | |
31 | ||
32 | ||
33 | /* | |
d13d3ec7 | 34 | * Load session attribute getter family of functions. |
9245bd0e DG |
35 | */ |
36 | ||
d13d3ec7 | 37 | /* Return session name. NULL indicates all sessions must be loaded. */ |
9245bd0e DG |
38 | const char *lttng_load_session_attr_get_session_name( |
39 | struct lttng_load_session_attr *attr); | |
40 | /* | |
c4fc6c6c JR |
41 | * Return input URL. A NULL value indicates the default session |
42 | * configuration location. The URL format used is documented in lttng-create(1). | |
9245bd0e DG |
43 | * NULL indicates that the default session configuration path is used. |
44 | */ | |
45 | const char *lttng_load_session_attr_get_input_url( | |
46 | struct lttng_load_session_attr *attr); | |
47 | ||
48 | /* | |
49 | * Return the configuration overwrite attribute. This attribute indicates | |
d13d3ec7 JG |
50 | * whether or not the loaded session should be loaded even if a session with the |
51 | * same name already exists. If such a session exists, it is destroyed before | |
52 | * the replacement is loaded. | |
9245bd0e DG |
53 | */ |
54 | int lttng_load_session_attr_get_overwrite( | |
55 | struct lttng_load_session_attr *attr); | |
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 JR |
63 | */ |
64 | const char *lttng_load_session_attr_get_override_url( | |
65 | struct lttng_load_session_attr *attr); | |
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 JR |
73 | */ |
74 | const char *lttng_load_session_attr_get_override_ctrl_url( | |
75 | struct lttng_load_session_attr *attr); | |
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 JR |
83 | */ |
84 | const char *lttng_load_session_attr_get_override_data_url( | |
85 | struct lttng_load_session_attr *attr); | |
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 | */ | |
95 | const char *lttng_load_session_attr_get_override_session_name( | |
96 | struct lttng_load_session_attr *attr); | |
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 DG |
108 | */ |
109 | int lttng_load_session_attr_set_session_name( | |
110 | struct lttng_load_session_attr *attr, const char *session_name); | |
111 | ||
112 | /* | |
113 | * Set the URL of the session configuration to load. A NULL value indicates the | |
d13d3ec7 | 114 | * use of the default session configuration location. |
9245bd0e DG |
115 | * |
116 | * Note that file:// is the only supported URL format. | |
117 | */ | |
118 | int lttng_load_session_attr_set_input_url( | |
119 | struct lttng_load_session_attr *attr, const char *url); | |
120 | ||
121 | /* | |
d13d3ec7 | 122 | * Set the overwrite attribute. If set to true, current sessions matching the |
a2a75fa4 | 123 | * loaded sessions will be destroyed and be replaced by the session(s) being |
d13d3ec7 | 124 | * loaded. |
9245bd0e DG |
125 | */ |
126 | int lttng_load_session_attr_set_overwrite( | |
127 | struct lttng_load_session_attr *attr, int overwrite); | |
128 | ||
a2a75fa4 JR |
129 | /* |
130 | * The following setter are for overriding sessions attributes during the | |
131 | * loading of a configuration files. Those attributes prevail upon those | |
132 | * specified in the loaded configuration file. | |
133 | * */ | |
134 | ||
135 | /* | |
d5d2ef2b | 136 | * Set the url override attribute. |
a2a75fa4 JR |
137 | * |
138 | * Supported format: | |
d5d2ef2b JG |
139 | * file://TRACEPATH |
140 | * NETPROTO://(HOST | IPADDR)[:CTRLPORT[:DATAPORT]][/TRACEPATH] | |
a2a75fa4 JR |
141 | * |
142 | * Where NETPROTO is one of {tcp, tcp6} | |
143 | * | |
144 | * See lttng-create(1) for more detail. | |
145 | */ | |
d5d2ef2b | 146 | int lttng_load_session_attr_set_override_url( |
a2a75fa4 JR |
147 | struct lttng_load_session_attr *attr, const char *url); |
148 | ||
149 | /* | |
d5d2ef2b | 150 | * Set the control url override attribute. |
a2a75fa4 JR |
151 | * |
152 | * Supported format: | |
153 | * NETPROTO://(HOST | IPADDR)[:PORT][/TRACEPATH] | |
154 | * | |
155 | * Where NETPROTO is one of {tcp, tcp6} | |
156 | * | |
157 | * See lttng-create(1) for more detail. | |
158 | */ | |
d5d2ef2b | 159 | int lttng_load_session_attr_set_override_ctrl_url( |
a2a75fa4 JR |
160 | struct lttng_load_session_attr *attr, const char *url); |
161 | ||
162 | /* | |
d5d2ef2b | 163 | * Set the data url override attribute. |
a2a75fa4 JR |
164 | * |
165 | * Supported format: | |
d5d2ef2b | 166 | * NETPROTO://(HOST | IPADDR)[:PORT][/TRACEPATH] |
a2a75fa4 JR |
167 | * |
168 | * Where NETPROTO is one of {tcp, tcp6} | |
169 | * | |
170 | * See lttng-create(1) for more detail. | |
171 | */ | |
d5d2ef2b | 172 | int lttng_load_session_attr_set_override_data_url( |
a2a75fa4 JR |
173 | struct lttng_load_session_attr *attr, const char *url); |
174 | ||
2aaf5fc7 JR |
175 | /* |
176 | * Set the session name override attribute. | |
177 | * | |
178 | * Loading a configuration file defining multiple sessions will fail if a | |
179 | * session name is provided. | |
180 | */ | |
181 | int lttng_load_session_attr_set_override_session_name( | |
182 | struct lttng_load_session_attr *attr, const char *session_name); | |
183 | ||
9245bd0e | 184 | /* |
c4fc6c6c | 185 | * Load session configuration(s). |
9245bd0e DG |
186 | * |
187 | * The lttng_load_session_attr object must not be NULL. No ownership of the | |
188 | * object is kept by the function; it must be released by the caller. | |
189 | * | |
190 | * Returns 0 on success or a negative LTTNG_ERR value on error. | |
191 | */ | |
192 | int lttng_load_session(struct lttng_load_session_attr *attr); | |
193 | ||
194 | #ifdef __cplusplus | |
195 | } | |
196 | #endif | |
197 | ||
198 | #endif /* LTTNG_LOAD_H */ |