91770973bf84f02fe831fe7ce75639280aa563ef
2 * Copyright (C) 2008 Martin Willi
3 * Hochschule fuer Technik Rapperswil
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19 * @defgroup settings settings
20 * @{ @ingroup libstrongswan
26 typedef struct settings_t settings_t
;
31 * Generic configuration options read from a config file.
33 * The sytax is quite simple:
35 * settings := (section|keyvalue)*
36 * section := name { settings }
37 * keyvalue := key = value\n
53 * The values are accesses using the get() functions using dotted keys, e.g.
54 * section-one.subsection.othervalue
59 * Get a settings value as a string.
61 * @param key key including sections
62 * @param def value returned if key not found
63 * @return value pointing to internal string
65 char* (*get_str
)(settings_t
*this, char *key
, char *def
);
68 * Get a boolean yes|no, true|false value.
70 * @param jey key including sections
71 * @param def default value returned if key not found
72 * @return value of the key
74 bool (*get_bool
)(settings_t
*this, char *key
, bool def
);
77 * Get an integer value.
79 * @param key key including sections
80 * @param def default value to return if key not found
81 * @return value of the key
83 int (*get_int
)(settings_t
*this, char *key
, bool def
);
86 * Destroy a settings instance.
88 void (*destroy
)(settings_t
*this);
92 * Load setings from a file.
94 settings_t
*settings_create(char *file
);
96 #endif /* SETTINGS_H_ @}*/