summaryrefslogtreecommitdiff
path: root/other/bootstrap_daemon/src/config.h
diff options
context:
space:
mode:
Diffstat (limited to 'other/bootstrap_daemon/src/config.h')
-rw-r--r--other/bootstrap_daemon/src/config.h52
1 files changed, 52 insertions, 0 deletions
diff --git a/other/bootstrap_daemon/src/config.h b/other/bootstrap_daemon/src/config.h
new file mode 100644
index 00000000..13cf929a
--- /dev/null
+++ b/other/bootstrap_daemon/src/config.h
@@ -0,0 +1,52 @@
1/* config.h
2 *
3 * Tox DHT bootstrap daemon.
4 * Functionality related to dealing with the config file.
5 *
6 * Copyright (C) 2014-2016 Tox project All Rights Reserved.
7 *
8 * This file is part of Tox.
9 *
10 * Tox is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * Tox is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with Tox. If not, see <http://www.gnu.org/licenses/>.
22 *
23 */
24
25#ifndef CONFIG_H
26#define CONFIG_H
27
28#include "../../../toxcore/DHT.h"
29
30/**
31 * Gets general config options from the config file.
32 *
33 * Important: You are responsible for freeing `pid_file_path` and `keys_file_path`
34 * also, iff `tcp_relay_ports_count` > 0, then you are responsible for freeing `tcp_relay_ports`
35 * and also `motd` iff `enable_motd` is set.
36 *
37 * @return 1 on success,
38 * 0 on failure, doesn't modify any data pointed by arguments.
39 */
40int get_general_config(const char *cfg_file_path, char **pid_file_path, char **keys_file_path, int *port, int *enable_ipv6,
41 int *enable_ipv4_fallback, int *enable_lan_discovery, int *enable_tcp_relay, uint16_t **tcp_relay_ports,
42 int *tcp_relay_port_count, int *enable_motd, char **motd);
43
44/**
45 * Bootstraps off nodes listed in the config file.
46 *
47 * @return 1 on success, some or no bootstrap nodes were added
48 * 0 on failure, a error accured while parsing config file.
49 */
50int bootstrap_from_config(const char *cfg_file_path, DHT *dht, int enable_ipv6);
51
52#endif // CONFIG_H