summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormannol <eniz_vukovic@hotmail.com>2014-02-23 23:24:07 +0100
committermannol <eniz_vukovic@hotmail.com>2014-02-23 23:24:07 +0100
commitcf8a090cdeeb2630730203144001f1357b25ee01 (patch)
treeac52dcc5d043248cd719004d4eaffde64a65e3d3
parent4888d916d037e371c88d39951f24f6ef4219c7cc (diff)
parentf219fb4ac1bf60eea3117df4aa8615cd07738a69 (diff)
Merge remote-tracking branch 'upstream/master'
-rw-r--r--.travis.yml10
-rw-r--r--INSTALL.md9
-rw-r--r--auto_tests/tox_test.c85
-rw-r--r--other/DHT_bootstrap.c12
-rw-r--r--other/DHTnodes (renamed from other/DHTservers)2
-rw-r--r--other/Makefile.inc2
-rw-r--r--other/bootstrap_daemon/Makefile.inc (renamed from other/bootstrap_serverdaemon/Makefile.inc)8
-rw-r--r--other/bootstrap_daemon/README.md (renamed from other/bootstrap_serverdaemon/README.md)0
-rw-r--r--other/bootstrap_daemon/conf (renamed from other/bootstrap_serverdaemon/conf)15
-rw-r--r--other/bootstrap_daemon/tox_bootstrap_daemon.c (renamed from other/bootstrap_serverdaemon/tox_bootstrap_daemon.c)56
-rw-r--r--other/bootstrap_daemon/tox_bootstrap_daemon.sh (renamed from other/bootstrap_serverdaemon/tox_bootstrap_daemon.sh)0
-rw-r--r--other/bootstrap_node_packets.c (renamed from other/bootstrap_server_packets.c)6
-rw-r--r--testing/nTox.c2
-rw-r--r--toxcore/network.h2
-rw-r--r--toxcore/tox.c10
15 files changed, 153 insertions, 66 deletions
diff --git a/.travis.yml b/.travis.yml
index ace69e0d..49be669f 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -15,6 +15,14 @@ before_script:
15 - cd .. 15 - cd ..
16 #installing yasm, needed for compiling vpx 16 #installing yasm, needed for compiling vpx
17 - sudo apt-get install yasm > /dev/null 17 - sudo apt-get install yasm > /dev/null
18 #installing libconfig, needed for DHT_bootstrap_daemon
19 - wget http://www.hyperrealm.com/libconfig/libconfig-1.4.9.tar.gz > /dev/null
20 - tar -xvzf libconfig-1.4.9.tar.gz > /dev/null
21 - cd libconfig-1.4.9
22 - ./configure > /dev/null
23 - make -j3 > /dev/null
24 - sudo make install > /dev/null
25 - cd ..
18 #installing libopus, needed for audio encoding/decoding 26 #installing libopus, needed for audio encoding/decoding
19 - wget http://downloads.xiph.org/releases/opus/opus-1.0.3.tar.gz > /dev/null 27 - wget http://downloads.xiph.org/releases/opus/opus-1.0.3.tar.gz > /dev/null
20 - tar xzf opus-1.0.3.tar.gz > /dev/null 28 - tar xzf opus-1.0.3.tar.gz > /dev/null
@@ -37,7 +45,7 @@ before_script:
37 45
38script: 46script:
39 - autoreconf -i 47 - autoreconf -i
40 - CFLAGS=-Ofast ./configure 48 - CFLAGS=-Ofast ./configure --enable-daemon --enable-ntox
41 - make -j3 49 - make -j3
42 - make check 50 - make check
43 - make dist 51 - make dist
diff --git a/INSTALL.md b/INSTALL.md
index a7805018..1dc29804 100644
--- a/INSTALL.md
+++ b/INSTALL.md
@@ -49,8 +49,6 @@ On FreeBSD 10+:
49pkg install automake autoconf 49pkg install automake autoconf
50``` 50```
51 51
52Note that `libconfig-dev` should be >= 1.4.
53
54You should get and install [libsodium](https://github.com/jedisct1/libsodium): 52You should get and install [libsodium](https://github.com/jedisct1/libsodium):
55```bash 53```bash
56git clone git://github.com/jedisct1/libsodium.git 54git clone git://github.com/jedisct1/libsodium.git
@@ -112,7 +110,7 @@ brew install --HEAD libtoxcore
112 110
113To do it manually: 111To do it manually:
114``` 112```
115brew install libtool automake autoconf libconfig libsodium check 113brew install libtool automake autoconf libsodium check
116``` 114```
117Then clone this repo and generate makefile: 115Then clone this repo and generate makefile:
118```bash 116```bash
@@ -234,7 +232,7 @@ While [Toxic](https://github.com/tox/toxic) is no longer in core, a list of Tox
234 - --disable-av disable A/V support (default: auto) see: [libtoxav](#libtoxav) 232 - --disable-av disable A/V support (default: auto) see: [libtoxav](#libtoxav)
235 - --enable-phone build phone (default: no) see: [Test phone](#phone) 233 - --enable-phone build phone (default: no) see: [Test phone](#phone)
236 - --enable-ntox build nTox client (default: no) see: [nTox](#ntox) 234 - --enable-ntox build nTox client (default: no) see: [nTox](#ntox)
237 - --enable-daemon build DHT bootstrap daemon (default: no) see: [Bootstrap daemon](#bootstrapd) 235 - --enable-daemon build DHT bootstrap daemon (default=no) see: [Bootstrap daemon](#bootstrapd)
238 - --enable-shared[=PKGS] build shared libraries [default=yes] 236 - --enable-shared[=PKGS] build shared libraries [default=yes]
239 - --enable-static[=PKGS] build static libraries [default=yes] 237 - --enable-static[=PKGS] build static libraries [default=yes]
240 238
@@ -335,7 +333,7 @@ Daemon is disabled by default. You can enable it by adding --enable-daemon argum
335```bash 333```bash
336./configure --enable-daemon 334./configure --enable-daemon
337``` 335```
338There is one dependency required for bootstrap daemon: libconfig. 336There is one dependency required for bootstrap daemon: `libconfig-dev` >= 1.4.
339 337
340Install on fedora: 338Install on fedora:
341```bash 339```bash
@@ -354,6 +352,7 @@ brew install libconfig
354OS X non-homebrew: 352OS X non-homebrew:
355Grab the following [package] (http://www.hyperrealm.com/libconfig/), uncompress and install 353Grab the following [package] (http://www.hyperrealm.com/libconfig/), uncompress and install
356 354
355See this [readme](other\bootstrap_daemon\README.md) on how to set up the bootstrap daemon.
357 356
358 357
359<a name="ntox" /> 358<a name="ntox" />
diff --git a/auto_tests/tox_test.c b/auto_tests/tox_test.c
index def9e5df..7e74fba7 100644
--- a/auto_tests/tox_test.c
+++ b/auto_tests/tox_test.c
@@ -62,6 +62,51 @@ void print_typingchange(Tox *m, int friendnumber, int typing, void *userdata)
62 typing_changes = 2; 62 typing_changes = 2;
63} 63}
64 64
65uint8_t filenum;
66uint32_t file_accepted;
67uint64_t file_size;
68void file_request_accept(Tox *m, int friendnumber, uint8_t filenumber, uint64_t filesize, uint8_t *filename,
69 uint16_t filename_length, void *userdata)
70{
71 if (*((uint32_t *)userdata) != 974536)
72 return;
73
74 if (filename_length == sizeof("Gentoo.exe") && memcmp(filename, "Gentoo.exe", sizeof("Gentoo.exe")) == 0)
75 ++file_accepted;
76
77 file_size = filesize;
78 tox_file_send_control(m, friendnumber, 1, filenumber, TOX_FILECONTROL_ACCEPT, NULL, 0);
79}
80
81uint32_t file_sent;
82uint32_t sendf_ok;
83void file_print_control(Tox *m, int friendnumber, uint8_t send_recieve, uint8_t filenumber, uint8_t control_type,
84 uint8_t *data, uint16_t length, void *userdata)
85{
86 if (*((uint32_t *)userdata) != 974536)
87 return;
88
89 if (send_recieve == 0 && control_type == TOX_FILECONTROL_FINISHED)
90 file_sent = 1;
91
92 if (send_recieve == 1 && control_type == TOX_FILECONTROL_ACCEPT)
93 sendf_ok = 1;
94
95}
96
97uint64_t size_recv;
98void write_file(Tox *m, int friendnumber, uint8_t filenumber, uint8_t *data, uint16_t length, void *userdata)
99{
100 if (*((uint32_t *)userdata) != 974536)
101 return;
102
103 uint8_t *f_data = malloc(length);
104 memset(f_data, 6, length);
105
106 if (memcmp(f_data, data, length) == 0)
107 size_recv += length;
108}
109
65START_TEST(test_few_clients) 110START_TEST(test_few_clients)
66{ 111{
67 long long unsigned int cur_time = time(NULL); 112 long long unsigned int cur_time = time(NULL);
@@ -168,6 +213,44 @@ START_TEST(test_few_clients)
168 } 213 }
169 214
170 ck_assert_msg(tox_get_is_typing(tox2, 0) == 0, "Typing fail"); 215 ck_assert_msg(tox_get_is_typing(tox2, 0) == 0, "Typing fail");
216
217 filenum = file_accepted = file_size = file_sent = sendf_ok = size_recv = 0;
218 long long unsigned int f_time = time(NULL);
219 tox_callback_file_data(tox3, write_file, &to_compare);
220 tox_callback_file_control(tox2, file_print_control, &to_compare);
221 tox_callback_file_control(tox3, file_print_control, &to_compare);
222 tox_callback_file_send_request(tox3, file_request_accept, &to_compare);
223 uint64_t totalf_size = 100 * 1024 * 1024;
224 int fnum = tox_new_file_sender(tox2, 0, totalf_size, (uint8_t *)"Gentoo.exe", sizeof("Gentoo.exe"));
225 ck_assert_msg(fnum != -1, "tox_new_file_sender fail");
226 int fpiece_size = tox_file_data_size(tox2, 0);
227 uint8_t *f_data = malloc(fpiece_size);
228 memset(f_data, 6, fpiece_size);
229
230 while (1) {
231 file_sent = 0;
232 tox_do(tox1);
233 tox_do(tox2);
234 tox_do(tox3);
235
236 if (sendf_ok)
237 while (tox_file_send_data(tox2, 0, fnum, f_data, fpiece_size < totalf_size ? fpiece_size : totalf_size) == 0) {
238 if (totalf_size <= fpiece_size) {
239 sendf_ok = 0;
240 tox_file_send_control(tox2, 0, 0, fnum, TOX_FILECONTROL_FINISHED, NULL, 0);
241 }
242
243 totalf_size -= fpiece_size;
244 }
245
246 if (file_sent && size_recv == file_size)
247 break;
248
249 c_sleep(10);
250 }
251
252 printf("100MB file sent in %llu seconds\n", time(NULL) - f_time);
253
171 printf("test_few_clients succeeded, took %llu seconds\n", time(NULL) - cur_time); 254 printf("test_few_clients succeeded, took %llu seconds\n", time(NULL) - cur_time);
172} 255}
173END_TEST 256END_TEST
@@ -244,7 +327,7 @@ Suite *tox_suite(void)
244{ 327{
245 Suite *s = suite_create("Tox"); 328 Suite *s = suite_create("Tox");
246 329
247 DEFTESTCASE_SLOW(few_clients, 30); 330 DEFTESTCASE_SLOW(few_clients, 50);
248 DEFTESTCASE_SLOW(many_clients, 240); 331 DEFTESTCASE_SLOW(many_clients, 240);
249 return s; 332 return s;
250} 333}
diff --git a/other/DHT_bootstrap.c b/other/DHT_bootstrap.c
index 307f80f6..291d6589 100644
--- a/other/DHT_bootstrap.c
+++ b/other/DHT_bootstrap.c
@@ -1,7 +1,7 @@
1 1
2/* DHT boostrap 2/* DHT boostrap
3 * 3 *
4 * A simple DHT boostrap server for tox. 4 * A simple DHT boostrap node for tox.
5 * 5 *
6 * Copyright (C) 2013 Tox project All Rights Reserved. 6 * Copyright (C) 2013 Tox project All Rights Reserved.
7 * 7 *
@@ -33,8 +33,8 @@
33 33
34#include "../testing/misc_tools.c" 34#include "../testing/misc_tools.c"
35 35
36#ifdef DHT_SERVER_EXTRA_PACKETS 36#ifdef DHT_NODE_EXTRA_PACKETS
37#include "./bootstrap_server_packets.c" 37#include "./bootstrap_node_packets.c"
38 38
39#define DHT_VERSION_NUMBER 1 39#define DHT_VERSION_NUMBER 1
40#define DHT_MOTD "This is a test motd" 40#define DHT_MOTD "This is a test motd"
@@ -111,7 +111,7 @@ int main(int argc, char *argv[])
111 Onion *onion = new_onion(dht); 111 Onion *onion = new_onion(dht);
112 Onion_Announce *onion_a = new_onion_announce(dht); 112 Onion_Announce *onion_a = new_onion_announce(dht);
113 113
114#ifdef DHT_SERVER_EXTRA_PACKETS 114#ifdef DHT_NODE_EXTRA_PACKETS
115 bootstrap_set_callbacks(dht->net, DHT_VERSION_NUMBER, DHT_MOTD, sizeof(DHT_MOTD)); 115 bootstrap_set_callbacks(dht->net, DHT_VERSION_NUMBER, DHT_MOTD, sizeof(DHT_MOTD));
116#endif 116#endif
117 117
@@ -123,7 +123,7 @@ int main(int argc, char *argv[])
123 perror("Initialization"); 123 perror("Initialization");
124 124
125 manage_keys(dht); 125 manage_keys(dht);
126 /* We want our DHT public key to be the same as our internal one since this is a bootstrap server */ 126 /* We want our DHT public key to be the same as our internal one since this is a bootstrap node */
127 memcpy(dht->self_public_key, dht->c->self_public_key, crypto_box_PUBLICKEYBYTES); 127 memcpy(dht->self_public_key, dht->c->self_public_key, crypto_box_PUBLICKEYBYTES);
128 memcpy(dht->self_secret_key, dht->c->self_secret_key, crypto_box_SECRETKEYBYTES); 128 memcpy(dht->self_secret_key, dht->c->self_secret_key, crypto_box_SECRETKEYBYTES);
129 printf("Public key: "); 129 printf("Public key: ");
@@ -166,7 +166,7 @@ int main(int argc, char *argv[])
166 166
167 while (1) { 167 while (1) {
168 if (is_waiting_for_dht_connection && DHT_isconnected(dht)) { 168 if (is_waiting_for_dht_connection && DHT_isconnected(dht)) {
169 printf("Connected to other bootstrap server successfully.\n"); 169 printf("Connected to other bootstrap node successfully.\n");
170 is_waiting_for_dht_connection = 0; 170 is_waiting_for_dht_connection = 0;
171 } 171 }
172 172
diff --git a/other/DHTservers b/other/DHTnodes
index 48e1d115..35509931 100644
--- a/other/DHTservers
+++ b/other/DHTnodes
@@ -1,3 +1,3 @@
1As maintaining 2 seperate lists of the same information seemed redundant, this list has been phased out. 1As maintaining 2 seperate lists of the same information seemed redundant, this list has been phased out.
2 2
3For a current DHT server list please visit http://wiki.tox.im/Servers 3For a current DHT node list please visit http://wiki.tox.im/nodes
diff --git a/other/Makefile.inc b/other/Makefile.inc
index 5ec2fc2a..72a514ad 100644
--- a/other/Makefile.inc
+++ b/other/Makefile.inc
@@ -15,5 +15,5 @@ DHT_bootstrap_LDADD = $(LIBSODIUM_LDFLAGS) \
15 $(NACL_LIBS) \ 15 $(NACL_LIBS) \
16 $(WINSOCK2_LIBS) 16 $(WINSOCK2_LIBS)
17 17
18EXTRA_DIST += $(top_srcdir)/other/DHTservers \ 18EXTRA_DIST += $(top_srcdir)/other/DHTnodes \
19 $(top_srcdir)/other/tox.png 19 $(top_srcdir)/other/tox.png
diff --git a/other/bootstrap_serverdaemon/Makefile.inc b/other/bootstrap_daemon/Makefile.inc
index effe59e8..b75d935f 100644
--- a/other/bootstrap_serverdaemon/Makefile.inc
+++ b/other/bootstrap_daemon/Makefile.inc
@@ -3,10 +3,10 @@ if BUILD_DHT_BOOTSTRAP_DAEMON
3noinst_PROGRAMS += tox_bootstrap_daemon 3noinst_PROGRAMS += tox_bootstrap_daemon
4 4
5tox_bootstrap_daemon_SOURCES = \ 5tox_bootstrap_daemon_SOURCES = \
6 ../other/bootstrap_serverdaemon/tox_bootstrap_daemon.c 6 ../other/bootstrap_daemon/tox_bootstrap_daemon.c
7 7
8tox_bootstrap_daemon_CFLAGS = \ 8tox_bootstrap_daemon_CFLAGS = \
9 -I$(top_srcdir)/other/bootstrap_serverdaemon \ 9 -I$(top_srcdir)/other/bootstrap_daemon \
10 $(LIBSODIUM_CFLAGS) \ 10 $(LIBSODIUM_CFLAGS) \
11 $(NACL_CFLAGS) \ 11 $(NACL_CFLAGS) \
12 $(LIBCONFIG_CFLAGS) 12 $(LIBCONFIG_CFLAGS)
@@ -22,6 +22,6 @@ tox_bootstrap_daemon_LDADD = \
22endif 22endif
23 23
24EXTRA_DIST += \ 24EXTRA_DIST += \
25 $(top_srcdir)/other/bootstrap_serverdaemon/conf \ 25 $(top_srcdir)/other/bootstrap_daemon/conf \
26 $(top_srcdir)/other/bootstrap_serverdaemon/tox_bootstrap_daemon.sh 26 $(top_srcdir)/other/bootstrap_daemon/tox_bootstrap_daemon.sh
27 \ No newline at end of file 27 \ No newline at end of file
diff --git a/other/bootstrap_serverdaemon/README.md b/other/bootstrap_daemon/README.md
index 53a25cdb..53a25cdb 100644
--- a/other/bootstrap_serverdaemon/README.md
+++ b/other/bootstrap_daemon/README.md
diff --git a/other/bootstrap_serverdaemon/conf b/other/bootstrap_daemon/conf
index 8451d9a0..28e638c1 100644
--- a/other/bootstrap_serverdaemon/conf
+++ b/other/bootstrap_daemon/conf
@@ -1,4 +1,4 @@
1// ProjectTox dht bootstrap server daemon configuration file. 1// ProjectTox dht bootstrap node daemon configuration file.
2 2
3// Listening port. 3// Listening port.
4port = 33445 4port = 33445
@@ -20,20 +20,21 @@ enable_ipv6 = false
20// Automatically bootstrap with nodes on local area network. 20// Automatically bootstrap with nodes on local area network.
21enable_lan_discovery = true 21enable_lan_discovery = true
22 22
23// Any number of servers the daemon will bootstrap itself from. 23// Any number of nodes the daemon will bootstrap itself from.
24// Remember to replace the provided example with your own server list. 24// Remember to replace the provided example with your own node list.
25// You may leave the list empty or remove "bootstrap_servers" complitely, 25// There is a maintained list of bootstrap nodes on Tox's wiki, if you need it.
26// You may leave the list empty or remove "bootstrap_nodes" complitely,
26// in both cases this will be interpreted as if you don't want to bootstrap 27// in both cases this will be interpreted as if you don't want to bootstrap
27// from anyone. 28// from anyone.
28bootstrap_servers = ( 29bootstrap_nodes = (
29 { // Server 1 30 { // Node 1
30 // Any ipv4 or ipv6, depending if `enable_ipv6` is set or not, and also 31 // Any ipv4 or ipv6, depending if `enable_ipv6` is set or not, and also
31 // any US-ASCII domain name. 32 // any US-ASCII domain name.
32 address = "198.46.136.167" 33 address = "198.46.136.167"
33 port = 33445 34 port = 33445
34 public_key = "728925473812C7AAC482BE7250BCCAD0B8CB9F737BF3D42ABD34459C1768F854" 35 public_key = "728925473812C7AAC482BE7250BCCAD0B8CB9F737BF3D42ABD34459C1768F854"
35 }, 36 },
36 { // Server 2 37 { // Node 2
37 address = "example.org" 38 address = "example.org"
38 port = 33445 39 port = 33445
39 public_key = "8CD5A9BF0A6CE358BA36F7A653F99FA6B258FF756E490F52C1F98CC420F78858" 40 public_key = "8CD5A9BF0A6CE358BA36F7A653F99FA6B258FF756E490F52C1F98CC420F78858"
diff --git a/other/bootstrap_serverdaemon/tox_bootstrap_daemon.c b/other/bootstrap_daemon/tox_bootstrap_daemon.c
index b7684115..66f6436d 100644
--- a/other/bootstrap_serverdaemon/tox_bootstrap_daemon.c
+++ b/other/bootstrap_daemon/tox_bootstrap_daemon.c
@@ -1,6 +1,6 @@
1/* tox_bootstrap_daemon.c 1/* tox_bootstrap_daemon.c
2 * 2 *
3 * Tox DHT bootstrap server daemon. 3 * Tox DHT bootstrap node daemon.
4 * 4 *
5 * Copyright (C) 2014 Tox project All Rights Reserved. 5 * Copyright (C) 2014 Tox project All Rights Reserved.
6 * 6 *
@@ -92,7 +92,7 @@ int manage_keys(DHT *dht, char *keys_file_path)
92 92
93 fclose(keys_file); 93 fclose(keys_file);
94 94
95 // We want our DHT public key to be the same as our internal one since this is a bootstrap server 95 // We want our DHT public key to be the same as our internal one since this is a bootstrap node
96 memcpy(dht->self_public_key, dht->c->self_public_key, crypto_box_PUBLICKEYBYTES); 96 memcpy(dht->self_public_key, dht->c->self_public_key, crypto_box_PUBLICKEYBYTES);
97 memcpy(dht->self_secret_key, dht->c->self_secret_key, crypto_box_SECRETKEYBYTES); 97 memcpy(dht->self_secret_key, dht->c->self_secret_key, crypto_box_SECRETKEYBYTES);
98 98
@@ -184,14 +184,14 @@ int get_general_config(char *cfg_file_path, char **pid_file_path, char **keys_fi
184 return 1; 184 return 1;
185} 185}
186 186
187// Bootstraps servers listed in the config file 187// Bootstraps nodes listed in the config file
188// 188//
189// returns 1 on success, some or no bootstrap servers were added 189// returns 1 on success, some or no bootstrap nodes were added
190// 0 on failure, a error accured while parsing config file 190// 0 on failure, a error accured while parsing config file
191 191
192int bootstrap_from_config(char *cfg_file_path, DHT *dht, int enable_ipv6) 192int bootstrap_from_config(char *cfg_file_path, DHT *dht, int enable_ipv6)
193{ 193{
194 const char *NAME_BOOTSTRAP_SERVERS = "bootstrap_servers"; 194 const char *NAME_BOOTSTRAP_NODES = "bootstrap_nodes";
195 195
196 const char *NAME_PUBLIC_KEY = "public_key"; 196 const char *NAME_PUBLIC_KEY = "public_key";
197 const char *NAME_PORT = "port"; 197 const char *NAME_PORT = "port";
@@ -207,16 +207,16 @@ int bootstrap_from_config(char *cfg_file_path, DHT *dht, int enable_ipv6)
207 return 0; 207 return 0;
208 } 208 }
209 209
210 config_setting_t *server_list = config_lookup(&cfg, NAME_BOOTSTRAP_SERVERS); 210 config_setting_t *node_list = config_lookup(&cfg, NAME_BOOTSTRAP_NODES);
211 211
212 if (server_list == NULL) { 212 if (node_list == NULL) {
213 syslog(LOG_WARNING, "No '%s' setting in the configuration file. Skipping bootstrapping.\n", NAME_BOOTSTRAP_SERVERS); 213 syslog(LOG_WARNING, "No '%s' setting in the configuration file. Skipping bootstrapping.\n", NAME_BOOTSTRAP_NODES);
214 config_destroy(&cfg); 214 config_destroy(&cfg);
215 return 1; 215 return 1;
216 } 216 }
217 217
218 if (config_setting_length(server_list) == 0) { 218 if (config_setting_length(node_list) == 0) {
219 syslog(LOG_WARNING, "No bootstrap servers found. Skipping bootstrapping.\n"); 219 syslog(LOG_WARNING, "No bootstrap nodes found. Skipping bootstrapping.\n");
220 config_destroy(&cfg); 220 config_destroy(&cfg);
221 return 1; 221 return 1;
222 } 222 }
@@ -225,45 +225,45 @@ int bootstrap_from_config(char *cfg_file_path, DHT *dht, int enable_ipv6)
225 const char *bs_address; 225 const char *bs_address;
226 const char *bs_public_key; 226 const char *bs_public_key;
227 227
228 config_setting_t *server; 228 config_setting_t *node;
229 229
230 int i = 0; 230 int i = 0;
231 231
232 while (config_setting_length(server_list)) { 232 while (config_setting_length(node_list)) {
233 233
234 server = config_setting_get_elem(server_list, 0); 234 node = config_setting_get_elem(node_list, 0);
235 235
236 if (server == NULL) { 236 if (node == NULL) {
237 config_destroy(&cfg); 237 config_destroy(&cfg);
238 return 0; 238 return 0;
239 } 239 }
240 240
241 // Check that all settings are present 241 // Check that all settings are present
242 if (config_setting_lookup_string(server, NAME_PUBLIC_KEY, &bs_public_key) == CONFIG_FALSE) { 242 if (config_setting_lookup_string(node, NAME_PUBLIC_KEY, &bs_public_key) == CONFIG_FALSE) {
243 syslog(LOG_WARNING, "Bootstrap server #%d: Couldn't find '%s' setting. Skipping the server.\n", i, NAME_PUBLIC_KEY); 243 syslog(LOG_WARNING, "Bootstrap node #%d: Couldn't find '%s' setting. Skipping the node.\n", i, NAME_PUBLIC_KEY);
244 goto next; 244 goto next;
245 } 245 }
246 246
247 if (config_setting_lookup_int(server, NAME_PORT, &bs_port) == CONFIG_FALSE) { 247 if (config_setting_lookup_int(node, NAME_PORT, &bs_port) == CONFIG_FALSE) {
248 syslog(LOG_WARNING, "Bootstrap server #%d: Couldn't find '%s' setting. Skipping the server.\n", i, NAME_PORT); 248 syslog(LOG_WARNING, "Bootstrap node #%d: Couldn't find '%s' setting. Skipping the node.\n", i, NAME_PORT);
249 goto next; 249 goto next;
250 } 250 }
251 251
252 if (config_setting_lookup_string(server, NAME_ADDRESS, &bs_address) == CONFIG_FALSE) { 252 if (config_setting_lookup_string(node, NAME_ADDRESS, &bs_address) == CONFIG_FALSE) {
253 syslog(LOG_WARNING, "Bootstrap server #%d: Couldn't find '%s' setting. Skipping the server.\n", i, NAME_ADDRESS); 253 syslog(LOG_WARNING, "Bootstrap node #%d: Couldn't find '%s' setting. Skipping the node.\n", i, NAME_ADDRESS);
254 goto next; 254 goto next;
255 } 255 }
256 256
257 // Process settings 257 // Process settings
258 if (strlen(bs_public_key) != 64) { 258 if (strlen(bs_public_key) != 64) {
259 syslog(LOG_WARNING, "Bootstrap server #%d: Invalid '%s': %s. Skipping the server.\n", i, NAME_PUBLIC_KEY, 259 syslog(LOG_WARNING, "Bootstrap node #%d: Invalid '%s': %s. Skipping the node.\n", i, NAME_PUBLIC_KEY,
260 bs_public_key); 260 bs_public_key);
261 goto next; 261 goto next;
262 } 262 }
263 263
264 // not (1 <= port <= 65535) 264 // not (1 <= port <= 65535)
265 if (bs_port < 1 || bs_port > 65535) { 265 if (bs_port < 1 || bs_port > 65535) {
266 syslog(LOG_WARNING, "Bootstrap server #%d: Invalid '%s': %d. Skipping the server.\n", i, NAME_PORT, bs_port); 266 syslog(LOG_WARNING, "Bootstrap node #%d: Invalid '%s': %d. Skipping the node.\n", i, NAME_PORT, bs_port);
267 goto next; 267 goto next;
268 } 268 }
269 269
@@ -273,17 +273,17 @@ int bootstrap_from_config(char *cfg_file_path, DHT *dht, int enable_ipv6)
273 free(bs_public_key_bin); 273 free(bs_public_key_bin);
274 274
275 if (!address_resolved) { 275 if (!address_resolved) {
276 syslog(LOG_WARNING, "Bootstrap server #%d: Invalid '%s': %s. Skipping the server.\n", i, NAME_ADDRESS, bs_address); 276 syslog(LOG_WARNING, "Bootstrap node #%d: Invalid '%s': %s. Skipping the node.\n", i, NAME_ADDRESS, bs_address);
277 goto next; 277 goto next;
278 } 278 }
279 279
280 syslog(LOG_DEBUG, "Successfully added bootstrap server #%d: %s:%d %s\n", i, bs_address, bs_port, bs_public_key); 280 syslog(LOG_DEBUG, "Successfully added bootstrap node #%d: %s:%d %s\n", i, bs_address, bs_port, bs_public_key);
281 281
282next: 282next:
283 // config_setting_lookup_string() allocates string inside and doesn't allow us to free it 283 // config_setting_lookup_string() allocates string inside and doesn't allow us to free it
284 // so in order to reuse `bs_public_key` and `bs_address` we have to remove the element 284 // so in order to reuse `bs_public_key` and `bs_address` we have to remove the element
285 // which will cause libconfig to free allocated strings 285 // which will cause libconfig to free allocated strings
286 config_setting_remove_elem(server_list, 0); 286 config_setting_remove_elem(node_list, 0);
287 i++; 287 i++;
288 } 288 }
289 289
@@ -378,9 +378,9 @@ int main(int argc, char *argv[])
378 } 378 }
379 379
380 if (bootstrap_from_config(cfg_file_path, dht, enable_ipv6)) { 380 if (bootstrap_from_config(cfg_file_path, dht, enable_ipv6)) {
381 syslog(LOG_DEBUG, "List of bootstrap servers read successfully\n"); 381 syslog(LOG_DEBUG, "List of bootstrap nodes read successfully\n");
382 } else { 382 } else {
383 syslog(LOG_ERR, "Couldn't read list of bootstrap servers in %s. Exiting.\n", cfg_file_path); 383 syslog(LOG_ERR, "Couldn't read list of bootstrap nodes in %s. Exiting.\n", cfg_file_path);
384 return 1; 384 return 1;
385 } 385 }
386 386
@@ -449,7 +449,7 @@ int main(int argc, char *argv[])
449 networking_poll(dht->net); 449 networking_poll(dht->net);
450 450
451 if (waiting_for_dht_connection && DHT_isconnected(dht)) { 451 if (waiting_for_dht_connection && DHT_isconnected(dht)) {
452 syslog(LOG_DEBUG, "Connected to other bootstrap server successfully.\n"); 452 syslog(LOG_DEBUG, "Connected to other bootstrap node successfully.\n");
453 waiting_for_dht_connection = 0; 453 waiting_for_dht_connection = 0;
454 } 454 }
455 455
diff --git a/other/bootstrap_serverdaemon/tox_bootstrap_daemon.sh b/other/bootstrap_daemon/tox_bootstrap_daemon.sh
index 83d9a119..83d9a119 100644
--- a/other/bootstrap_serverdaemon/tox_bootstrap_daemon.sh
+++ b/other/bootstrap_daemon/tox_bootstrap_daemon.sh
diff --git a/other/bootstrap_server_packets.c b/other/bootstrap_node_packets.c
index c9297535..ea57b0d2 100644
--- a/other/bootstrap_server_packets.c
+++ b/other/bootstrap_node_packets.c
@@ -1,8 +1,8 @@
1/* bootstrap_server_packets.c 1/* bootstrap_node_packets.c
2 * 2 *
3 * Special bootstrap server only packets. 3 * Special bootstrap node only packets.
4 * 4 *
5 * Include it in your bootstrap server and use: bootstrap_set_callbacks() to enable. 5 * Include it in your bootstrap node and use: bootstrap_set_callbacks() to enable.
6 * 6 *
7 * Copyright (C) 2013 Tox project All Rights Reserved. 7 * Copyright (C) 2013 Tox project All Rights Reserved.
8 * 8 *
diff --git a/testing/nTox.c b/testing/nTox.c
index 8f7dc7ea..9d3eb9c0 100644
--- a/testing/nTox.c
+++ b/testing/nTox.c
@@ -995,7 +995,7 @@ void print_help(char *prog_name)
995 995
996 puts("Options: (order IS relevant)"); 996 puts("Options: (order IS relevant)");
997 puts(" --ipv4 / --ipv6 [Optional] Support IPv4 only or IPv4 & IPv6."); 997 puts(" --ipv4 / --ipv6 [Optional] Support IPv4 only or IPv4 & IPv6.");
998 puts(" IP PORT KEY [REQUIRED] A server to connect to (IP/Port) and its key."); 998 puts(" IP PORT KEY [REQUIRED] A node to connect to (IP/Port) and its key.");
999 puts(" -f keyfile [Optional] Specify a keyfile to read from and write to."); 999 puts(" -f keyfile [Optional] Specify a keyfile to read from and write to.");
1000} 1000}
1001 1001
diff --git a/toxcore/network.h b/toxcore/network.h
index aaf89f19..b0d306e4 100644
--- a/toxcore/network.h
+++ b/toxcore/network.h
@@ -149,7 +149,7 @@ typedef int sock_t;
149#define NET_PACKET_ONION_RECV_2 141 149#define NET_PACKET_ONION_RECV_2 141
150#define NET_PACKET_ONION_RECV_1 142 150#define NET_PACKET_ONION_RECV_1 142
151 151
152/* Only used for bootstrap servers */ 152/* Only used for bootstrap nodes */
153#define BOOTSTRAP_INFO_PACKET_ID 240 153#define BOOTSTRAP_INFO_PACKET_ID 240
154 154
155 155
diff --git a/toxcore/tox.c b/toxcore/tox.c
index bdef1eaa..0115e827 100644
--- a/toxcore/tox.c
+++ b/toxcore/tox.c
@@ -385,23 +385,19 @@ void tox_callback_status_message(Tox *tox, void (*function)(Messenger *tox, int,
385/* Set the callback for status type changes. 385/* Set the callback for status type changes.
386 * function(int friendnumber, USERSTATUS kind) 386 * function(int friendnumber, USERSTATUS kind)
387 */ 387 */
388void tox_callback_user_status(Tox *tox, void (*_function)(Tox *tox, int, TOX_USERSTATUS, void *), void *userdata) 388void tox_callback_user_status(Tox *tox, void (*function)(Messenger *tox, int, TOX_USERSTATUS, void *), void *userdata)
389{ 389{
390 Messenger *m = tox; 390 Messenger *m = tox;
391 typedef void (*function_type)(Messenger *, int, USERSTATUS, void *);
392 function_type function = (function_type)_function;
393 m_callback_userstatus(m, function, userdata); 391 m_callback_userstatus(m, function, userdata);
394} 392}
395 393
396/* Set the callback for typing changes. 394/* Set the callback for typing changes.
397 * function (int friendnumber, int is_typing) 395 * function (int friendnumber, int is_typing)
398 */ 396 */
399void tox_callback_typing_change(Tox *tox, void (*function)(Tox *tox, int, int, void *), void *userdata) 397void tox_callback_typing_change(Tox *tox, void (*function)(Messenger *tox, int, int, void *), void *userdata)
400{ 398{
401 Messenger *m = tox; 399 Messenger *m = tox;
402 typedef void (*function_type)(Messenger *, int, int, void *); 400 m_callback_typingchange(m, function, userdata);
403 function_type function_new = (function_type)function;
404 m_callback_typingchange(m, function_new, userdata);
405} 401}
406 402
407/* Set the callback for read receipts. 403/* Set the callback for read receipts.