2 conf.h -- header for conf.c
4 Copyright (C) 1998-2004 Ivo Timmermans <ivo@tinc-vpn.org>
5 2000-2004 Guus Sliepen <guus@tinc-vpn.org>
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 #ifndef __TINC_CONF_H__
25 #define __TINC_CONF_H__
27 #include "support/avl.h"
36 typedef struct cfg_choice {
41 extern avl_tree_t *cfgs;
43 extern avl_tree_t *cfg_tree_new(void);
44 extern void cfg_tree_free(avl_tree_t *);
45 extern cfg_t *cfg_new(void) __attribute__ ((__malloc__));
46 extern void cfg_free(cfg_t *);
47 extern void cfg_add(avl_tree_t *, cfg_t *);
48 extern void cfg_del(avl_tree_t *, cfg_t *);
49 extern cfg_t *cfg_get(const avl_tree_t *, char *);
50 extern cfg_t *cfg_get_next(const avl_tree_t *, const cfg_t *);
51 extern bool cfg_bool(const cfg_t *, const bool, bool *);
52 extern bool cfg_int(const cfg_t *, const int, int *);
53 extern bool cfg_string(const cfg_t *, const char *, char **);
54 extern bool cfg_choice(const cfg_t *, const cfg_choice_t *, const int, int *);
55 extern bool cfg_period(const cfg_t *, const int, int *);
56 #define cfg_get_bool(tree, var, def, result) cfg_bool(cfg_get(tree, var), def, result)
57 #define cfg_get_int(tree, var, def, result) cfg_int(cfg_get(tree, var), def, result)
58 #define cfg_get_string(tree, var, def, result) cfg_string(cfg_get(tree, var), def, result)
59 #define cfg_get_choice(tree, var, choice, def, result) cfg_choice(cfg_get(tree, var), choice, def, (int *)result)
60 #define cfg_get_period(tree, var, def, result) cfg_period(cfg_get(tree, var), def, (int *)result)
62 extern bool cfg_read_file(avl_tree_t *, const char *);