]> git.ipfire.org Git - people/ms/systemd.git/blame - conf-parser.h
add basic (and not very useful) D-Bus support
[people/ms/systemd.git] / conf-parser.h
CommitLineData
ed5bcfbe
LP
1/*-*- Mode: C; c-basic-offset: 8 -*-*/
2
3#ifndef fooconfparserhfoo
4#define fooconfparserhfoo
5
6#include <stdio.h>
7
8/* An abstract parser for simple, line based, shallow configuration
9 * files consisting of variable assignments only. */
10
ea430986 11typedef int (*ConfigParserCallback)(const char *filename, unsigned line, const char *section, const char *lvalue, const char *rvalue, void *data, void *userdata);
ed5bcfbe
LP
12
13/* Wraps info for parsing a specific configuration variable */
14typedef struct ConfigItem {
15 const char *lvalue; /* name of the variable */
ea430986 16 ConfigParserCallback parse; /* Function that is called to parse the variable's value */
ed5bcfbe
LP
17 void *data; /* Where to store the variable's data */
18 const char *section;
19} ConfigItem;
20
21/* The configuration file parsing routine. Expects a table of
22 * config_items in *t that is terminated by an item where lvalue is
23 * NULL */
87f0e418 24int config_parse(const char *filename, FILE *f, const char* const * sections, const ConfigItem *t, void *userdata);
ed5bcfbe
LP
25
26/* Generic parsers */
27int config_parse_int(const char *filename, unsigned line, const char *section, const char *lvalue, const char *rvalue, void *data, void *userdata);
28int config_parse_unsigned(const char *filename, unsigned line, const char *section, const char *lvalue, const char *rvalue, void *data, void *userdata);
29int config_parse_size(const char *filename, unsigned line, const char *section, const char *lvalue, const char *rvalue, void *data, void *userdata);
30int config_parse_bool(const char *filename, unsigned line, const char *section, const char *lvalue, const char *rvalue, void *data, void *userdata);
31int config_parse_string(const char *filename, unsigned line, const char *section, const char *lvalue, const char *rvalue, void *data, void *userdata);
034c6ed7 32int config_parse_path(const char *filename, unsigned line, const char *section, const char *lvalue, const char *rvalue, void *data, void *userdata);
57d42a5f 33int config_parse_strv(const char *filename, unsigned line, const char *section, const char *lvalue, const char *rvalue, void *data, void *userdata);
ed5bcfbe
LP
34
35#endif