2 * Copyright (C) 2013 Jérémie Galarneau <jeremie.galarneau@efficios.com>
4 * SPDX-License-Identifier: LGPL-2.1-only
11 #include <common/config/config-session-abi.hpp>
12 #include <common/macros.hpp>
16 struct config_load_session_override_attr {
23 /* Instance of a configuration writer. */
27 * Create an instance of a configuration writer.
29 * fd_output File to which the XML content must be written. fd_output is
30 * owned by the caller.
32 * indent If other than 0 the XML will be pretty printed
33 * with indentation and newline.
35 * Returns an instance of a configuration writer on success, NULL on
38 struct config_writer *config_writer_create(int fd_output, int indent);
41 * Destroy an instance of a configuration writer.
43 * writer An instance of a configuration writer.
45 * Returns zero if the XML document could be closed cleanly. Negative values
48 int config_writer_destroy(struct config_writer *writer);
51 * Open an element tag.
53 * writer An instance of a configuration writer.
55 * element_name Element tag name.
57 * Returns zero if the XML element could be opened.
58 * Negative values indicate an error.
60 int config_writer_open_element(struct config_writer *writer, const char *element_name);
63 * Write an element tag attribute.
65 * writer An instance of a configuration writer.
67 * name Attribute name.
69 * Returns zero if the XML element's attribute could be written.
70 * Negative values indicate an error.
72 int config_writer_write_attribute(struct config_writer *writer,
77 * Close the current element tag.
79 * writer An instance of a configuration writer.
81 * Returns zero if the XML document could be closed cleanly.
82 * Negative values indicate an error.
84 int config_writer_close_element(struct config_writer *writer);
87 * Write an element of type unsigned int.
89 * writer An instance of a configuration writer.
91 * element_name Element name.
93 * value Unsigned int value of the element
95 * Returns zero if the element's value could be written.
96 * Negative values indicate an error.
98 int config_writer_write_element_unsigned_int(struct config_writer *writer,
99 const char *element_name,
103 * Write an element of type signed int.
105 * writer An instance of a configuration writer.
107 * element_name Element name.
109 * value Signed int value of the element
111 * Returns zero if the element's value could be written.
112 * Negative values indicate an error.
114 int config_writer_write_element_signed_int(struct config_writer *writer,
115 const char *element_name,
119 * Write an element of type boolean.
121 * writer An instance of a configuration writer.
123 * element_name Element name.
125 * value Boolean value of the element
127 * Returns zero if the element's value could be written.
128 * Negative values indicate an error.
130 int config_writer_write_element_bool(struct config_writer *writer,
131 const char *element_name,
135 * Write an element of type string.
137 * writer An instance of a configuration writer.
139 * element_name Element name.
141 * value String value of the element
143 * Returns zero if the element's value could be written.
144 * Negative values indicate an error.
146 int config_writer_write_element_string(struct config_writer *writer,
147 const char *element_name,
151 * Write an element of type double.
153 * writer An instance of a configuration writer.
155 * element_name Element name.
157 * value Double value of the element
159 * Returns zero if the element's value could be written.
160 * Negative values indicate an error.
162 int config_writer_write_element_double(struct config_writer *writer,
163 const char *element_name,
167 * Load session configurations from a file.
169 * path Path to an LTTng session configuration file. All *.lttng files
170 * will be loaded if path is a directory. If path is NULL, the default
171 * paths will be searched in the following order:
172 * 1) $HOME/.lttng/sessions
173 * 2) /etc/lttng/sessions
175 * session_name Name of the session to load. Will load all
176 * sessions from path if NULL.
178 * overwrite Overwrite current session configuration if it exists.
179 * autoload Tell to load the auto session(s).
180 * overrides The override attribute structure specifying override parameters.
182 * Returns zero if the session could be loaded successfully. Returns
183 * a negative LTTNG_ERR code on error.
185 int config_load_session(const char *path,
186 const char *session_name,
188 unsigned int autoload,
189 const struct config_load_session_override_attr *overrides);
191 #endif /* _CONFIG_H */