Clean-up: sessiond: cmd_enable_channel_internal
[lttng-tools.git] / src / common / config / session-config.h
... / ...
CommitLineData
1/*
2 * Copyright (C) 2013 Jérémie Galarneau <jeremie.galarneau@efficios.com>
3 *
4 * SPDX-License-Identifier: LGPL-2.1-only
5 *
6 */
7
8#ifndef _CONFIG_H
9#define _CONFIG_H
10
11#include <common/config/config-session-abi.h>
12#include <common/macros.h>
13#include <stdint.h>
14
15struct config_load_session_override_attr {
16 char *path_url;
17 char *ctrl_url;
18 char *data_url;
19 char *session_name;
20};
21
22/* Instance of a configuration writer. */
23struct config_writer;
24
25/*
26 * Create an instance of a configuration writer.
27 *
28 * fd_output File to which the XML content must be written. fd_output is
29 * owned by the caller.
30 *
31 * indent If other than 0 the XML will be pretty printed
32 * with indentation and newline.
33 *
34 * Returns an instance of a configuration writer on success, NULL on
35 * error.
36 */
37struct config_writer *config_writer_create(int fd_output, int indent);
38
39/*
40 * Destroy an instance of a configuration writer.
41 *
42 * writer An instance of a configuration writer.
43 *
44 * Returns zero if the XML document could be closed cleanly. Negative values
45 * indicate an error.
46 */
47int config_writer_destroy(struct config_writer *writer);
48
49/*
50 * Open an element tag.
51 *
52 * writer An instance of a configuration writer.
53 *
54 * element_name Element tag name.
55 *
56 * Returns zero if the XML element could be opened.
57 * Negative values indicate an error.
58 */
59int config_writer_open_element(struct config_writer *writer,
60 const char *element_name);
61
62/*
63 * Write an element tag attribute.
64 *
65 * writer An instance of a configuration writer.
66 *
67 * name Attribute name.
68 *
69 * Returns zero if the XML element's attribute could be written.
70 * Negative values indicate an error.
71 */
72int config_writer_write_attribute(struct config_writer *writer,
73 const char *name, const char *value);
74
75/*
76 * Close the current element tag.
77 *
78 * writer An instance of a configuration writer.
79 *
80 * Returns zero if the XML document could be closed cleanly.
81 * Negative values indicate an error.
82 */
83int config_writer_close_element(struct config_writer *writer);
84
85/*
86 * Write an element of type unsigned int.
87 *
88 * writer An instance of a configuration writer.
89 *
90 * element_name Element name.
91 *
92 * value Unsigned int value of the element
93 *
94 * Returns zero if the element's value could be written.
95 * Negative values indicate an error.
96 */
97int config_writer_write_element_unsigned_int(struct config_writer *writer,
98 const char *element_name, uint64_t value);
99
100/*
101 * Write an element of type signed int.
102 *
103 * writer An instance of a configuration writer.
104 *
105 * element_name Element name.
106 *
107 * value Signed int value of the element
108 *
109 * Returns zero if the element's value could be written.
110 * Negative values indicate an error.
111 */
112int config_writer_write_element_signed_int(struct config_writer *writer,
113 const char *element_name, int64_t value);
114
115/*
116 * Write an element of type boolean.
117 *
118 * writer An instance of a configuration writer.
119 *
120 * element_name Element name.
121 *
122 * value Boolean value of the element
123 *
124 * Returns zero if the element's value could be written.
125 * Negative values indicate an error.
126 */
127int config_writer_write_element_bool(struct config_writer *writer,
128 const char *element_name, int value);
129
130/*
131 * Write an element of type string.
132 *
133 * writer An instance of a configuration writer.
134 *
135 * element_name Element name.
136 *
137 * value String value of the element
138 *
139 * Returns zero if the element's value could be written.
140 * Negative values indicate an error.
141 */
142int config_writer_write_element_string(struct config_writer *writer,
143 const char *element_name, const char *value);
144
145/*
146 * Write an element of type double.
147 *
148 * writer An instance of a configuration writer.
149 *
150 * element_name Element name.
151 *
152 * value Double value of the element
153 *
154 * Returns zero if the element's value could be written.
155 * Negative values indicate an error.
156 */
157int config_writer_write_element_double(struct config_writer *writer,
158 const char *element_name,
159 double value);
160
161/*
162 * Load session configurations from a file.
163 *
164 * path Path to an LTTng session configuration file. All *.lttng files
165 * will be loaded if path is a directory. If path is NULL, the default
166 * paths will be searched in the following order:
167 * 1) $HOME/.lttng/sessions
168 * 2) /etc/lttng/sessions
169 *
170 * session_name Name of the session to load. Will load all
171 * sessions from path if NULL.
172 *
173 * overwrite Overwrite current session configuration if it exists.
174 * autoload Tell to load the auto session(s).
175 * overrides The override attribute structure specifying override parameters.
176 *
177 * Returns zero if the session could be loaded successfully. Returns
178 * a negative LTTNG_ERR code on error.
179 */
180int config_load_session(const char *path, const char *session_name,
181 int overwrite, unsigned int autoload,
182 const struct config_load_session_override_attr *overrides);
183
184#endif /* _CONFIG_H */
This page took 0.023806 seconds and 4 git commands to generate.