#ifndef SETTINGS_PARSER_H
#define SETTINGS_PARSER_H
struct var_expand_table;
struct var_expand_func_table;
/* STR_VARS pointer begins with either of these initially. Before actually
using the variables all variables in all unexpanded strings need to be
expanded. Afterwards the string pointers should be increased to skip
the initial '1' so it'll be easy to use them. */
/* When parsing streams, this character is translated to LF. */
enum setting_type {
};
struct setting_define {
const char *key;
};
((struct struct_name *)0)->name, bool), \
((struct struct_name *)0)->name, unsigned int), \
((struct struct_name *)0)->name, unsigned int), \
((struct struct_name *)0)->name, unsigned int), \
((struct struct_name *)0)->name, const char *), \
struct setting_parser_info {
const char *module_name;
const void *defaults;
};
/* name=NULL-terminated list of parsers. These follow the static settings.
After this list follows the actual settings. */
struct dynamic_settings_parser {
const char *name;
};
enum settings_parser_flags {
};
struct setting_parser_context;
struct setting_parser_context *
enum settings_parser_flags flags);
struct setting_parser_context *
const struct setting_parser_info *const *roots,
/* Return pointer to root setting structure. */
/* If there are multiple roots, return a NULL-terminated list to all of
their settings. */
/* Like settings_parser_get(), but return change struct. */
/* Returns the setting parser's roots (same as given to init()). */
const struct setting_parser_info *const *
/* Return the last error. */
/* Return the parser info used for the previously parsed line. */
const struct setting_parser_info *
/* Returns TRUE if the given key is a valid setting. */
const char *key);
/* If key is an alias, return the primary key name. If key exists, return key
itself. If key doesn't exist, return NULL. */
const char *key);
/* Returns pointer to value for a key, or NULL if not found. */
const void *
/* Returns TRUE if setting has been changed by this parser. */
const char *key);
/* Parse a single line. Returns 1 if OK, 0 if key is unknown, -1 if error. */
/* Parse data already read in input stream. */
/* Read data from input stream and parser it. returns -1 = error,
0 = done, 1 = not finished yet (stream is non-blocking) */
/* Open file and parse it. */
/* Execute the given binary and wait for it to return the configuration. */
const char *bin_path, const char *config_path,
const char *service);
/* Call all check_func()s to see if currently parsed settings are valid. */
const char **error_r);
/* While parsing values, specifies if STR_VARS strings are already expanded. */
bool is_expanded);
/* Mark all the parsed settings with given keys as being already expanded. */
/* Update variable string pointers to skip over the '1' or '0'.
This is mainly useful when you want to run settings_parser_check() without
actually knowing what the variables are. */
/* Expand all unexpanded variables using the given table. Update the string
pointers so that they can be used without skipping over the '1'.
Returns the same as var_expand(). */
const struct var_expand_table *table,
const char **error_r);
const struct var_expand_table *table,
const struct var_expand_func_table *func_table,
void *func_context, const char **error_r);
/* Go through all the settings and return the first one that has an unexpanded
setting containing the given %key. */
char var_key, const char *long_var_key,
/* Duplicate the entire settings structure. */
/* Same as settings_dup(), but assume that the old pointers can still be safely
used. This saves memory since strings don't have to be duplicated. */
/* Duplicate the entire setting parser. */
struct setting_parser_context *
/* parsers is a name=NULL -terminated list. The parsers are appended as
dynamic_settings_list structures to their parent. All must have the same
parent. The new structures are allocated from the given pool. */
struct setting_parser_info *parent,
const struct dynamic_settings_parser *parsers);
const struct setting_parser_info *const **roots,
const struct dynamic_settings_parser *dyn_parsers);
/* Return pointer to beginning of settings for given name, or NULL if there is
no such registered name. */
/* Copy changed settings from src to dest. If conflict_key_r is not NULL and
both src and dest have changed the same setting, return -1 and set the
key name. If it's NULL, the old setting is kept.
KLUDGE: For SET_STRLIST types if both source and destination have identical
keys, the duplicates in the source side are ignored. This is required to
make the current config code work correctly. */
const struct setting_parser_context *src,
/* Return section name escaped */
const char *settings_section_escape(const char *name);
/* Parse time interval string, return as seconds. */
const char **error_r);
/* Parse time interval string, return as milliseconds. */
const char **error_r);
/* Parse size string, return as bytes. */
const char **error_r);
#endif