2000-03-26 00:33:07 +00:00
|
|
|
/*
|
|
|
|
conf.h -- header for conf.c
|
2001-01-07 17:09:07 +00:00
|
|
|
Copyright (C) 1998-2001 Ivo Timmermans <itimmermans@bigfoot.com>
|
|
|
|
2000,2001 Guus Sliepen <guus@sliepen.warande.net>
|
2000-03-26 00:33:07 +00:00
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
2000-05-30 11:18:12 +00:00
|
|
|
|
2001-06-05 19:39:54 +00:00
|
|
|
$Id: conf.h,v 1.6.4.24 2001/06/05 19:39:54 guus Exp $
|
2000-03-26 00:33:07 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __TINC_CONF_H__
|
|
|
|
#define __TINC_CONF_H__
|
|
|
|
|
2000-10-24 15:46:18 +00:00
|
|
|
#include "net.h"
|
|
|
|
|
2000-06-30 11:45:16 +00:00
|
|
|
#define MAXTIMEOUT 900 /* Maximum timeout value for retries. Should this be a configuration option? */
|
|
|
|
|
2000-03-26 00:33:07 +00:00
|
|
|
typedef struct ip_mask_t {
|
2000-10-24 15:46:18 +00:00
|
|
|
ipv4_t address;
|
|
|
|
ipv4_t mask;
|
2000-03-26 00:33:07 +00:00
|
|
|
} ip_mask_t;
|
|
|
|
|
|
|
|
typedef enum which_t {
|
2000-12-06 13:33:49 +00:00
|
|
|
config_dummy = 0,
|
2000-11-04 22:57:33 +00:00
|
|
|
config_name = 1,
|
|
|
|
config_connectto,
|
|
|
|
config_pingtimeout,
|
|
|
|
config_tapdevice,
|
|
|
|
config_privatekey,
|
2000-12-22 21:34:24 +00:00
|
|
|
config_privatekeyfile,
|
2000-11-04 22:57:33 +00:00
|
|
|
config_keyexpire,
|
|
|
|
config_hostnames,
|
|
|
|
config_interface,
|
|
|
|
config_interfaceip,
|
|
|
|
config_address,
|
|
|
|
config_port,
|
|
|
|
config_publickey,
|
2000-12-22 21:34:24 +00:00
|
|
|
config_publickeyfile,
|
2000-11-04 22:57:33 +00:00
|
|
|
config_subnet,
|
|
|
|
config_restricthosts,
|
|
|
|
config_restrictsubnets,
|
|
|
|
config_restrictaddress,
|
|
|
|
config_restrictport,
|
|
|
|
config_indirectdata,
|
|
|
|
config_tcponly,
|
2001-06-05 19:39:54 +00:00
|
|
|
config_mode,
|
2000-03-26 00:33:07 +00:00
|
|
|
} which_t;
|
|
|
|
|
|
|
|
typedef struct config_t {
|
|
|
|
struct config_t *next;
|
|
|
|
which_t which;
|
2000-06-30 11:45:16 +00:00
|
|
|
int argtype;
|
2000-10-11 22:01:02 +00:00
|
|
|
union data {
|
|
|
|
unsigned long val;
|
2001-01-05 23:53:53 +00:00
|
|
|
char *ptr;
|
2000-10-11 22:01:02 +00:00
|
|
|
ip_mask_t *ip;
|
|
|
|
struct config_t *next; /* For nested configs! */
|
|
|
|
} data;
|
2000-03-26 00:33:07 +00:00
|
|
|
} config_t;
|
|
|
|
|
2000-10-11 13:42:52 +00:00
|
|
|
typedef struct internal_config_t {
|
|
|
|
char *name;
|
|
|
|
enum which_t which;
|
|
|
|
int argtype;
|
|
|
|
} internal_config_t;
|
|
|
|
|
2000-03-26 00:33:07 +00:00
|
|
|
enum {
|
|
|
|
stupid_false = 1,
|
|
|
|
stupid_true
|
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
|
|
|
TYPE_NAME = 1,
|
|
|
|
TYPE_INT,
|
|
|
|
TYPE_IP,
|
|
|
|
TYPE_BOOL
|
|
|
|
};
|
|
|
|
|
|
|
|
extern config_t *config;
|
|
|
|
extern int debug_lvl;
|
|
|
|
extern int timeout;
|
2000-06-29 19:47:04 +00:00
|
|
|
extern int sighup;
|
2000-10-14 17:04:16 +00:00
|
|
|
extern char *confbase;
|
2000-10-15 00:59:37 +00:00
|
|
|
extern char *netname;
|
2000-03-26 00:33:07 +00:00
|
|
|
|
|
|
|
extern config_t *add_config_val(config_t **, int, char *);
|
2000-10-11 22:01:02 +00:00
|
|
|
extern int read_config_file(config_t **, const char *);
|
|
|
|
extern const config_t *get_config_val(config_t *, which_t type);
|
2000-08-07 16:27:29 +00:00
|
|
|
extern void clear_config();
|
2000-10-14 17:04:16 +00:00
|
|
|
extern int read_server_config(void);
|
2001-01-13 16:36:23 +00:00
|
|
|
extern FILE *ask_and_safe_open(const char*, const char*, const char *);
|
2001-02-27 16:37:31 +00:00
|
|
|
extern int is_safe_path(const char *);
|
2000-03-26 00:33:07 +00:00
|
|
|
|
|
|
|
#endif /* __TINC_CONF_H__ */
|