- Fixed memory leak.
[oweals/tinc.git] / src / conf.h
1 /*
2     conf.h -- header for conf.c
3     Copyright (C) 1998,1999,2000 Ivo Timmermans <itimmermans@bigfoot.com>
4                             2000 Guus Sliepen <guus@sliepen.warande.net>
5
6     This program is free software; you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by
8     the Free Software Foundation; either version 2 of the License, or
9     (at your option) any later version.
10
11     This program is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.
15
16     You should have received a copy of the GNU General Public License
17     along with this program; if not, write to the Free Software
18     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19
20     $Id: conf.h,v 1.6.4.4 2000/06/29 19:47:03 guus Exp $
21 */
22
23 #ifndef __TINC_CONF_H__
24 #define __TINC_CONF_H__
25
26 typedef struct ip_mask_t {
27   unsigned long ip;
28   unsigned long mask;
29 } ip_mask_t;
30
31 typedef union data_t {
32   unsigned long val;
33   void *ptr;
34   ip_mask_t *ip;
35 } data_t;
36
37 typedef enum which_t {
38   passphrasesdir = 1,
39   upstreamip,
40   upstreamport,
41   listenport,
42   myvpnip,
43   tapdevice,
44   allowconnect,
45   pingtimeout,
46   keyexpire,
47   vpnmask,
48   resolve_dns,
49   indirectdata
50 } which_t;
51
52 typedef struct config_t {
53   struct config_t *next;
54   which_t which;
55   data_t data;
56 } config_t;
57
58 enum {
59   stupid_false = 1,
60   stupid_true
61 };
62
63 enum {
64   TYPE_NAME = 1,
65   TYPE_INT,
66   TYPE_IP,
67   TYPE_BOOL
68 };
69
70 extern config_t *config;
71 extern int debug_lvl;
72 extern int timeout;
73 extern int upstreamindex;
74 extern int sighup;
75 extern char *configfilename;
76
77 extern config_t *add_config_val(config_t **, int, char *);
78 extern int read_config_file(const char *);
79 extern const config_t *get_config_val(which_t type);
80 extern const config_t *get_next_config_val(which_t type, int);
81
82 #endif /* __TINC_CONF_H__ */