2 * Copyright (C) 2013 Jérémie Galarneau <jeremie.galarneau@efficios.com>
4 * SPDX-License-Identifier: GPL-2.0-only
12 /* section is NULL if the entry is not in a section */
19 * A config_entry_handler_cb receives config_entry structures belonging to the
20 * sections the handler has been registered to.
22 * The config_entry and its members are only valid for the duration of the call
23 * and must not be freed.
25 * config_entry_handler_cb may return negative value to indicate an error in
26 * the configuration file.
28 typedef int (*config_entry_handler_cb)(const struct config_entry *, void *);
31 * Read a section's entries in an INI configuration file.
33 * path may be NULL, in which case the following paths will be tried:
34 * 1) $HOME/.lttng/lttng.conf
35 * 2) /etc/lttng/lttng.conf
37 * handler will only be called with entries belonging to the provided section.
38 * If section is NULL, all entries will be relayed to handler. If section is
39 * "", only the global entries are relayed.
41 * Returns 0 on success. Negative values are error codes. If the return value
42 * is positive, it represents the line number on which a parsing error occurred.
44 int config_get_section_entries(const char *path, const char *section,
45 config_entry_handler_cb handler, void *user_data);
48 * Parse a configuration value.
50 * This function expects either an unsigned integer or a boolean text option.
51 * The following strings are recognized: true, yes, on, false, no and off.
53 * Returns either the value of the parsed integer, or 0/1 if a boolean text
54 * string was recognized. Negative values indicate an error.
56 int config_parse_value(const char *value);
58 #endif /* INI_CONFIG_H */