tinc/src/conf.h

73 lines
2.4 KiB
C
Raw Normal View History

2000-03-26 00:33:07 +00:00
/*
conf.h -- header for conf.c
Copyright (C) 1998-2005 Ivo Timmermans
2013-01-20 20:03:22 +00:00
2000-2013 Guus Sliepen <guus@tinc-vpn.org>
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.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
2000-03-26 00:33:07 +00:00
*/
#ifndef __TINC_CONF_H__
#define __TINC_CONF_H__
#include "list.h"
2016-04-16 23:13:56 +00:00
#include "splay_tree.h"
#include "subnet.h"
#define DEFAULT_SLPD_GROUP "ff02::42:1"
#define DEFAULT_SLPD_PORT "1655"
#define DEFAULT_SLPD_EXPIRE 300
Introduction to Simple Local Peer Discovery Protocol (SLPD) Full functionality of tinc mesh relays on having at least one node, accessible, with known address to which all other nodes must connect in order to exchange information about other peers. Sometimes, however, in smaller networks or if two or more peers are located in the same LAN segment without access to any of the nodes with known address, there is no way of establishing a functional mesh without manually changing the configuration. SLPD addresses this problem utilizing multicast groups and autoconnect. - Node sends periodically simple message to multicast group (default 224.0.42.23 port 1655) in this format: "sLPD 0 1 nodename port publickey" "0 1" is the "major minior" version of the protocol - Node listens to the multicast group for messages on all interfaces: - if the nodename is known and the publickey matches the node's public key the source address of the packet will be stored as learned ip address - at this point setup_outgoing_connection() will be able to choose the learned ip for connect Configarion example: * Roadwarriors: SLPDInterval = 30 * Router on your home network or in your hackerspace: - It should broadcast only in the direction of the LAN thus you should set SLPDInterface = eth0 and SLPDInterval = 10 * Defaults: SLPDGroup = "224.0.42.23" SLPDPort = 1655 SLPDInterval = 0 (means SLPD is disabled) The check of the publickey is not implemented yet. IPv6 support must be implemented. This is the first commit - highly experimental.
2016-05-14 22:24:35 +00:00
2000-03-26 00:33:07 +00:00
typedef struct config_t {
2002-09-09 21:25:28 +00:00
char *variable;
char *value;
char *file;
int line;
2000-03-26 00:33:07 +00:00
} config_t;
2003-07-22 20:55:21 +00:00
2007-05-18 10:05:26 +00:00
extern splay_tree_t *config_tree;
extern bool use_logfile;
extern bool use_syslog;
extern bool bypass_security;
2000-03-26 00:33:07 +00:00
extern int pinginterval;
2002-02-10 21:57:54 +00:00
extern int pingtimeout;
extern int maxtimeout;
2003-07-22 20:55:21 +00:00
extern bool bypass_security;
extern list_t *cmdline_conf;
2000-03-26 00:33:07 +00:00
2007-05-18 10:05:26 +00:00
extern void init_configuration(splay_tree_t **);
extern void exit_configuration(splay_tree_t **);
extern config_t *new_config(void) __attribute__ ((__malloc__));
extern void free_config(config_t *);
2007-05-18 10:05:26 +00:00
extern void config_add(splay_tree_t *, config_t *);
extern config_t *lookup_config(splay_tree_t *, char *);
extern config_t *lookup_config_next(splay_tree_t *, const config_t *);
extern bool get_config_bool(const config_t *, bool *);
extern bool get_config_int(const config_t *, int *);
extern bool get_config_string(const config_t *, char **);
extern bool get_config_address(const config_t *, struct addrinfo **);
extern bool get_config_subnet(const config_t *, struct subnet_t **);
extern config_t *parse_config_line(char *, const char *, int);
extern bool read_config_file(splay_tree_t *, const char *);
extern void read_config_options(splay_tree_t *, const char *);
2003-07-22 20:55:21 +00:00
extern bool read_server_config(void);
extern bool read_host_config(splay_tree_t *, const char *);
extern bool append_config_file(const char *, const char *, const char *);
2000-03-26 00:33:07 +00:00
2012-10-10 15:17:49 +00:00
#endif /* __TINC_CONF_H__ */