splay_tree.c splay_tree.h \
sptps.c sptps.h \
system.h \
- tincd.c \
utils.c utils.h \
xalloc.h \
$(ed25519_SOURCES) \
#include "conf.h"
#include "list.h"
#include "logger.h"
+#include "meshlink_internal.h"
#include "netutl.h" /* for str2address */
#include "protocol.h"
#include "utils.h" /* for cp */
#include "xalloc.h"
-splay_tree_t *config_tree;
-
int pinginterval = 0; /* seconds between pings */
int pingtimeout = 0; /* seconds to wait for response */
return a->file ? strcmp(a->file, b->file) : 0;
}
-void init_configuration(splay_tree_t ** config_tree) {
+void init_configuration(splay_tree_t **config_tree) {
*config_tree = splay_alloc_tree((splay_compare_t) config_compare, (splay_action_t) free_config);
}
-void exit_configuration(splay_tree_t ** config_tree) {
+void exit_configuration(splay_tree_t **config_tree) {
splay_delete_tree(*config_tree);
*config_tree = NULL;
}
xasprintf(&fname, "%s" SLASH "tinc.conf", confbase);
errno = 0;
- x = read_config_file(config_tree, fname);
+ x = read_config_file(mesh->config, fname);
if(!x && errno)
logger(DEBUG_ALWAYS, LOG_ERR, "Failed to read `%s': %s", fname, strerror(errno));
int line;
} config_t;
-extern struct splay_tree_t *config_tree;
-
extern int pinginterval;
extern int pingtimeout;
extern int maxtimeout;
/* Reread our own configuration file */
- exit_configuration(&config_tree);
- init_configuration(&config_tree);
+ exit_configuration(&mesh->config);
+ init_configuration(&mesh->config);
if(!read_server_config()) {
logger(DEBUG_ALWAYS, LOG_ERR, "Unable to reread configuration file.");
}
xasprintf(&fname, "%s" SLASH "hosts" SLASH "%s", confbase, mesh->self->name);
- read_config_file(config_tree, fname);
+ read_config_file(mesh->config, fname);
free(fname);
/* Parse some options that are allowed to be changed while tinc is running */
char *get_name(void) {
char *name = NULL;
- get_config_string(lookup_config(config_tree, "Name"), &name);
+ get_config_string(lookup_config(mesh->config, "Name"), &name);
if(!name)
return NULL;
mesh->self->connection = new_connection();
mesh->self->name = name;
mesh->self->connection->name = xstrdup(name);
- read_host_config(config_tree, name);
+ read_host_config(mesh->config, name);
- if(!get_config_string(lookup_config(config_tree, "Port"), &myport))
+ if(!get_config_string(lookup_config(mesh->config, "Port"), &myport))
myport = xstrdup("655");
else
port_specified = true;
/* Make sure there is one outgoing_t in the list for each ConnectTo. */
// TODO: Drop support for ConnectTo since AutoConnect is now always on?
- for(config_t *cfg = lookup_config(config_tree, "ConnectTo"); cfg; cfg = lookup_config_next(config_tree, cfg)) {
+ for(config_t *cfg = lookup_config(mesh->config, "ConnectTo"); cfg; cfg = lookup_config_next(mesh->config, cfg)) {
char *name;
get_config_string(cfg, &name);