summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--other/DHT_bootstrap.c51
-rw-r--r--testing/DHT_test.c52
-rw-r--r--testing/Lossless_UDP_testclient.c48
-rw-r--r--testing/Lossless_UDP_testserver.c41
-rw-r--r--testing/Messenger_test.c55
-rw-r--r--testing/nTox.c73
-rw-r--r--toxcore/DHT.c5
-rw-r--r--toxcore/DHT.h3
-rw-r--r--toxcore/tox.c4
-rw-r--r--toxcore/tox.h4
-rw-r--r--toxcore/util.h2
11 files changed, 270 insertions, 68 deletions
diff --git a/other/DHT_bootstrap.c b/other/DHT_bootstrap.c
index 7355ca10..795e24ac 100644
--- a/other/DHT_bootstrap.c
+++ b/other/DHT_bootstrap.c
@@ -81,11 +81,44 @@ void manage_keys(DHT *dht)
81 81
82int main(int argc, char *argv[]) 82int main(int argc, char *argv[])
83{ 83{
84 /* let use decide by cmdline: TODO */ 84 if (argc == 2 && !strncasecmp(argv[1], "-h", 3)) {
85 uint8_t ipv6enabled = TOX_ENABLE_IPV6_DEFAULT; 85 printf("Usage (connected) : %s [--ipv4|--ipv6] IP PORT KEY\n", argv[0]);
86 printf("Usage (unconnected): %s [--ipv4|--ipv6]\n", argv[0]);
87 exit(0);
88 }
89
90 /* let user override default by cmdline */
91 uint8_t ipv6enabled = TOX_ENABLE_IPV6_DEFAULT; /* x */
92
93 int argvoffset = 0, argi;
94 for(argi = 1; argi < argc; argi++)
95 if (!strncasecmp(argv[argi], "--ipv", 5)) {
96 if (argv[argi][5] && !argv[argi][6]) {
97 char c = argv[argi][5];
98 if (c == '4')
99 ipv6enabled = 0;
100 else if (c == '6')
101 ipv6enabled = 1;
102 else {
103 printf("Invalid argument: %s. Try --ipv4 or --ipv6!\n", argv[argi]);
104 exit(1);
105 }
106 }
107 else {
108 printf("Invalid argument: %s. Try --ipv4 or --ipv6!\n", argv[argi]);
109 exit(1);
110 }
111
112 if (argvoffset != argi - 1) {
113 printf("Argument must come first: %s.\n", argv[argi]);
114 exit(1);
115 }
116
117 argvoffset++;
118 }
86 119
87 /* Initialize networking - 120 /* Initialize networking -
88 Bind to ip 0.0.0.0:PORT */ 121 Bind to ip 0.0.0.0 / [::] : PORT */
89 IP ip; 122 IP ip;
90 ip_init(&ip, ipv6enabled); 123 ip_init(&ip, ipv6enabled);
91 124
@@ -112,11 +145,17 @@ int main(int argc, char *argv[])
112 145
113 perror("Initialization."); 146 perror("Initialization.");
114 147
115 if (argc > 3) { 148 if (argc > argvoffset + 3) {
116 printf("Trying to bootstrap into the network...\n"); 149 printf("Trying to bootstrap into the network...\n");
117 uint8_t *bootstrap_key = hex_string_to_bin(argv[3]); 150 uint16_t port = htons(atoi(argv[argvoffset + 2]));
118 DHT_bootstrap_ex(dht, argv[1], ipv6enabled, htons(atoi(argv[2])), bootstrap_key); 151 uint8_t *bootstrap_key = hex_string_to_bin(argv[argvoffset + 3]);
152 int res = DHT_bootstrap_ex(dht, argv[argvoffset + 1], ipv6enabled, port, bootstrap_key);
119 free(bootstrap_key); 153 free(bootstrap_key);
154
155 if (!res) {
156 printf("Failed to convert \"%s\" into an IP address. Exiting...\n", argv[argvoffset + 1]);
157 exit(1);
158 }
120 } 159 }
121 160
122 int is_waiting_for_dht_connection = 1; 161 int is_waiting_for_dht_connection = 1;
diff --git a/testing/DHT_test.c b/testing/DHT_test.c
index caa0cde2..61762162 100644
--- a/testing/DHT_test.c
+++ b/testing/DHT_test.c
@@ -133,8 +133,40 @@ void printpacket(uint8_t *data, uint32_t length, IP_Port ip_port)
133 133
134int main(int argc, char *argv[]) 134int main(int argc, char *argv[])
135{ 135{
136 /* let use decide by cmdline: TODO */ 136 if (argc < 4) {
137 uint8_t ipv6enabled = TOX_ENABLE_IPV6_DEFAULT; 137 printf("Usage: %s [--ipv4|--ipv6] ip port public_key\n", argv[0]);
138 exit(0);
139 }
140
141 /* let user override default by cmdline */
142 uint8_t ipv6enabled = TOX_ENABLE_IPV6_DEFAULT; /* x */
143
144 int argvoffset = 0, argi;
145 for(argi = 1; argi < argc; argi++)
146 if (!strncasecmp(argv[argi], "--ipv", 5)) {
147 if (argv[argi][5] && !argv[argi][6]) {
148 char c = argv[argi][5];
149 if (c == '4')
150 ipv6enabled = 0;
151 else if (c == '6')
152 ipv6enabled = 1;
153 else {
154 printf("Invalid argument: %s. Try --ipv4 or --ipv6!\n", argv[argi]);
155 exit(1);
156 }
157 }
158 else {
159 printf("Invalid argument: %s. Try --ipv4 or --ipv6!\n", argv[argi]);
160 exit(1);
161 }
162
163 if (argvoffset != argi - 1) {
164 printf("Argument must come first: %s.\n", argv[argi]);
165 exit(1);
166 }
167
168 argvoffset++;
169 }
138 170
139 //memcpy(self_client_id, "qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq", 32); 171 //memcpy(self_client_id, "qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq", 32);
140 /* initialize networking */ 172 /* initialize networking */
@@ -144,11 +176,6 @@ int main(int argc, char *argv[])
144 176
145 DHT *dht = new_DHT(new_net_crypto(new_networking(ip, PORT))); 177 DHT *dht = new_DHT(new_net_crypto(new_networking(ip, PORT)));
146 178
147 if (argc < 4) {
148 printf("usage %s ip port public_key\n", argv[0]);
149 exit(0);
150 }
151
152 new_keys(dht->c); 179 new_keys(dht->c);
153 printf("OUR ID: "); 180 printf("OUR ID: ");
154 uint32_t i; 181 uint32_t i;
@@ -168,9 +195,16 @@ int main(int argc, char *argv[])
168 195
169 DHT_addfriend(dht, hex_string_to_bin(temp_id)); 196 DHT_addfriend(dht, hex_string_to_bin(temp_id));
170 197
171
172 perror("Initialization"); 198 perror("Initialization");
173 DHT_bootstrap_ex(dht, argv[1], ipv6enabled, htons(atoi(argv[2])), hex_string_to_bin(argv[3])); 199
200 uint16_t port = htons(atoi(argv[argvoffset + 2]));
201 unsigned char *binary_string = hex_string_to_bin(argv[argvoffset + 3]);
202 int res = DHT_bootstrap_ex(dht, argv[argvoffset + 1], ipv6enabled, port, binary_string);
203 free(binary_string);
204 if (!res) {
205 printf("Failed to convert \"%s\" into an IP address. Exiting...\n", argv[argvoffset + 1]);
206 return 1;
207 }
174 208
175 /* 209 /*
176 IP_Port ip_port; 210 IP_Port ip_port;
diff --git a/testing/Lossless_UDP_testclient.c b/testing/Lossless_UDP_testclient.c
index 564b2ecf..5d4c8547 100644
--- a/testing/Lossless_UDP_testclient.c
+++ b/testing/Lossless_UDP_testclient.c
@@ -151,21 +151,50 @@ void printconnection(int connection_id)
151 151
152int main(int argc, char *argv[]) 152int main(int argc, char *argv[])
153{ 153{
154 /* let use decide by cmdline: TODO */ 154 /* let user override default by cmdline */
155 uint8_t ipv6enabled = TOX_ENABLE_IPV6_DEFAULT; 155 uint8_t ipv6enabled = TOX_ENABLE_IPV6_DEFAULT; /* x */
156
157 int argvoffset = 0, argi;
158 for(argi = 1; argi < argc; argi++)
159 if (!strncasecmp(argv[argi], "--ipv", 5)) {
160 if (argv[argi][5] && !argv[argi][6]) {
161 char c = argv[argi][5];
162 if (c == '4')
163 ipv6enabled = 0;
164 else if (c == '6')
165 ipv6enabled = 1;
166 else {
167 printf("Invalid argument: %s. Try --ipv4 or --ipv6!\n", argv[argi]);
168 exit(1);
169 }
170 }
171 else {
172 printf("Invalid argument: %s. Try --ipv4 or --ipv6!\n", argv[argi]);
173 exit(1);
174 }
175
176 if (argvoffset != argi - 1) {
177 printf("Argument must come first: %s.\n", argv[argi]);
178 exit(1);
179 }
156 180
157 if (argc < 4) { 181 argvoffset++;
158 printf("usage: %s ip port filename\n", argv[0]); 182 }
183
184 if (argc < argvoffset + 4) {
185 printf("Usage: %s [--ipv4|--ipv6] ip port filename\n", argv[0]);
159 exit(0); 186 exit(0);
160 } 187 }
161 188
162 uint8_t buffer[512]; 189 uint8_t buffer[512];
163 int read; 190 int read;
164 191
165 FILE *file = fopen(argv[3], "rb"); 192 FILE *file = fopen(argv[argvoffset + 3], "rb");
166 193
167 if (file == NULL) 194 if (file == NULL) {
195 printf("Failed to open file \"%s\".\n", argv[argvoffset + 3]);
168 return 1; 196 return 1;
197 }
169 198
170 199
171 /* initialize networking */ 200 /* initialize networking */
@@ -178,8 +207,11 @@ int main(int argc, char *argv[])
178 207
179 IP_Port serverip; 208 IP_Port serverip;
180 ip_init(&serverip.ip, ipv6enabled); 209 ip_init(&serverip.ip, ipv6enabled);
181 addr_resolve(argv[1], &serverip.ip); 210 if (!addr_resolve(argv[argvoffset + 1], &serverip.ip)) {
182 serverip.port = htons(atoi(argv[2])); 211 printf("Failed to convert \"%s\" into an IP address.\n", argv[argvoffset + 1]);
212 return 1;
213 }
214 serverip.port = htons(atoi(argv[argvoffset + 2]));
183 printip(serverip); 215 printip(serverip);
184 216
185 int connection = new_connection(ludp, serverip); 217 int connection = new_connection(ludp, serverip);
diff --git a/testing/Lossless_UDP_testserver.c b/testing/Lossless_UDP_testserver.c
index 3e54e9be..52dbcc80 100644
--- a/testing/Lossless_UDP_testserver.c
+++ b/testing/Lossless_UDP_testserver.c
@@ -147,21 +147,50 @@ void printconnection(int connection_id)
147 147
148int main(int argc, char *argv[]) 148int main(int argc, char *argv[])
149{ 149{
150 /* let use decide by cmdline: TODO */ 150 /* let user override default by cmdline */
151 uint8_t ipv6enabled = TOX_ENABLE_IPV6_DEFAULT; 151 uint8_t ipv6enabled = TOX_ENABLE_IPV6_DEFAULT; /* x */
152
153 int argvoffset = 0, argi;
154 for(argi = 1; argi < argc; argi++)
155 if (!strncasecmp(argv[argi], "--ipv", 5)) {
156 if (argv[argi][5] && !argv[argi][6]) {
157 char c = argv[argi][5];
158 if (c == '4')
159 ipv6enabled = 0;
160 else if (c == '6')
161 ipv6enabled = 1;
162 else {
163 printf("Invalid argument: %s. Try --ipv4 or --ipv6!\n", argv[argi]);
164 exit(1);
165 }
166 }
167 else {
168 printf("Invalid argument: %s. Try --ipv4 or --ipv6!\n", argv[argi]);
169 exit(1);
170 }
171
172 if (argvoffset != argi - 1) {
173 printf("Argument must come first: %s.\n", argv[argi]);
174 exit(1);
175 }
152 176
153 if (argc < 2) { 177 argvoffset++;
154 printf("usage: %s filename\n", argv[0]); 178 }
179
180 if (argc < argvoffset + 2) {
181 printf("Usage: %s [--ipv4|--ipv6] filename\n", argv[0]);
155 exit(0); 182 exit(0);
156 } 183 }
157 184
158 uint8_t buffer[512]; 185 uint8_t buffer[512];
159 int read; 186 int read;
160 187
161 FILE *file = fopen(argv[1], "wb"); 188 FILE *file = fopen(argv[argvoffset + 1], "wb");
162 189
163 if (file == NULL) 190 if (file == NULL) {
191 printf("Failed to open file \"%s\".\n", argv[argvoffset + 1]);
164 return 1; 192 return 1;
193 }
165 194
166 195
167 //initialize networking 196 //initialize networking
diff --git a/testing/Messenger_test.c b/testing/Messenger_test.c
index 73d44efb..e7a75c8c 100644
--- a/testing/Messenger_test.c
+++ b/testing/Messenger_test.c
@@ -95,13 +95,44 @@ void print_message(Messenger *m, int friendnumber, uint8_t *string, uint16_t len
95 95
96int main(int argc, char *argv[]) 96int main(int argc, char *argv[])
97{ 97{
98 if (argc < 4 && argc != 2) { 98 /* let user override default by cmdline */
99 printf("usage %s ip port public_key (of the DHT bootstrap node)\n or\n %s Save.bak\n", argv[0], argv[0]); 99 uint8_t ipv6enabled = TOX_ENABLE_IPV6_DEFAULT; /* x */
100
101 int argvoffset = 0, argi;
102 for(argi = 1; argi < argc; argi++)
103 if (!strncasecmp(argv[argi], "--ipv", 5)) {
104 if (argv[argi][5] && !argv[argi][6]) {
105 char c = argv[argi][5];
106 if (c == '4')
107 ipv6enabled = 0;
108 else if (c == '6')
109 ipv6enabled = 1;
110 else {
111 printf("Invalid argument: %s. Try --ipv4 or --ipv6!\n", argv[argi]);
112 exit(1);
113 }
114 }
115 else {
116 printf("Invalid argument: %s. Try --ipv4 or --ipv6!\n", argv[argi]);
117 exit(1);
118 }
119
120 if (argvoffset != argi - 1) {
121 printf("Argument must come first: %s.\n", argv[argi]);
122 exit(1);
123 }
124
125 argvoffset++;
126 }
127
128 /* with optional --ipvx, now it can be 1-4 arguments... */
129 if ((argc != argvoffset + 2) && (argc != argvoffset + 4)) {
130 printf("Usage: %s [--ipv4|--ipv6] ip port public_key (of the DHT bootstrap node)\n", argv[0]);
131 printf("or\n");
132 printf(" %s [--ipv4|--ipv6] Save.bak (to read Save.bak as state file)\n", argv[0], argv[0]);
100 exit(0); 133 exit(0);
101 } 134 }
102 135
103 /* IPv6: maybe allow from cmdline --ipv6? sticking to IPv4 for now */
104 uint8_t ipv6enabled = TOX_ENABLE_IPV6_DEFAULT;
105 m = initMessenger(ipv6enabled); 136 m = initMessenger(ipv6enabled);
106 137
107 if ( !m ) { 138 if ( !m ) {
@@ -109,13 +140,19 @@ int main(int argc, char *argv[])
109 exit(0); 140 exit(0);
110 } 141 }
111 142
112 if (argc > 3) { 143 if (argc == argvoffset + 4) {
113 uint16_t port = htons(atoi(argv[2])); 144 uint16_t port = htons(atoi(argv[argvoffset + 2]));
114 DHT_bootstrap_ex(m->dht, argv[1], ipv6enabled, port, hex_string_to_bin(argv[3])); 145 uint8_t *bootstrap_key = hex_string_to_bin(argv[argvoffset + 3]);
146 int res = DHT_bootstrap_ex(m->dht, argv[argvoffset + 1], ipv6enabled, port, bootstrap_key);
147 free(bootstrap_key);
148 if (!res) {
149 printf("Failed to convert \"%s\" into an IP address. Exiting...\n", argv[argvoffset + 1]);
150 exit(1);
151 }
115 } else { 152 } else {
116 FILE *file = fopen(argv[1], "rb"); 153 FILE *file = fopen(argv[argvoffset + 1], "rb");
117
118 if ( file == NULL ) { 154 if ( file == NULL ) {
155 printf("Failed to open \"%s\" - does it exist?\n", argv[argvoffset + 1]);
119 return 1; 156 return 1;
120 } 157 }
121 158
diff --git a/testing/nTox.c b/testing/nTox.c
index 6084aeda..6eeec5d3 100644
--- a/testing/nTox.c
+++ b/testing/nTox.c
@@ -537,8 +537,40 @@ void print_help(void)
537 537
538int main(int argc, char *argv[]) 538int main(int argc, char *argv[])
539{ 539{
540 /* let use decide by cmdline: TODO */ 540 if (argc < 4) {
541 uint8_t ipv6enabled = TOX_ENABLE_IPV6_DEFAULT; 541 printf("Usage: %s [--ipv4|--ipv6] IP PORT KEY [-f keyfile]\n", argv[0]);
542 exit(0);
543 }
544
545 /* let user override default by cmdline */
546 uint8_t ipv6enabled = TOX_ENABLE_IPV6_DEFAULT; /* x */
547
548 int argvoffset = 0, argi;
549 for(argi = 1; argi < argc; argi++)
550 if (!strncasecmp(argv[argi], "--ipv", 5)) {
551 if (argv[argi][5] && !argv[argi][6]) {
552 char c = argv[argi][5];
553 if (c == '4')
554 ipv6enabled = 0;
555 else if (c == '6')
556 ipv6enabled = 1;
557 else {
558 printf("Invalid argument: %s. Try --ipv4 or --ipv6!\n", argv[argi]);
559 exit(1);
560 }
561 }
562 else {
563 printf("Invalid argument: %s. Try --ipv4 or --ipv6!\n", argv[argi]);
564 exit(1);
565 }
566
567 if (argvoffset != argi - 1) {
568 printf("Argument must come first: %s.\n", argv[argi]);
569 exit(1);
570 }
571
572 argvoffset++;
573 }
542 574
543 int on = 0; 575 int on = 0;
544 int c = 0; 576 int c = 0;
@@ -547,27 +579,16 @@ int main(int argc, char *argv[])
547 char idstring[200] = {0}; 579 char idstring[200] = {0};
548 Tox *m; 580 Tox *m;
549 581
550 if (argc < 4) { 582 if ((argc == 2) && !strcmp(argv[1], "-h")) {
551 printf("[!] Usage: %s [IP] [port] [public_key] <keyfile>\n", argv[0]); 583 print_help();
552 exit(0); 584 exit(0);
553 } 585 }
554 586
555 for (i = 0; i < argc; i++) { 587 /* [-f keyfile] MUST be last two arguments, no point in walking over the list
556 if (argv[i] == NULL) { 588 * especially not a good idea to accept it anywhere in the middle */
557 break; 589 if (argc > argvoffset + 3)
558 } else if (argv[i][0] == '-') { 590 if (!strcmp(argv[argc - 2], "-f"))
559 if (argv[i][1] == 'h') { 591 filename = argv[argc - 1];
560 print_help();
561 exit(0);
562 } else if (argv[i][1] == 'f') {
563 if (argv[i + 1] != NULL)
564 filename = argv[i + 1];
565 else {
566 fputs("[!] you passed '-f' without giving an argument!\n", stderr);
567 }
568 }
569 }
570 }
571 592
572 m = tox_new_ex(ipv6enabled); 593 m = tox_new_ex(ipv6enabled);
573 594
@@ -593,11 +614,17 @@ int main(int argc, char *argv[])
593 new_lines(idstring); 614 new_lines(idstring);
594 strcpy(line, ""); 615 strcpy(line, "");
595 616
596 uint16_t port = htons(atoi(argv[2])); 617 uint16_t port = htons(atoi(argv[argvoffset + 2]));
597 unsigned char *binary_string = hex_string_to_bin(argv[3]); 618 unsigned char *binary_string = hex_string_to_bin(argv[argvoffset + 3]);
598 tox_bootstrap_ex(m, argv[1], ipv6enabled, port, binary_string); 619 int res = tox_bootstrap_ex(m, argv[argvoffset + 1], ipv6enabled, port, binary_string);
599 free(binary_string); 620 free(binary_string);
600 621
622 if (!res) {
623 printf("Failed to convert \"%s\" into an IP address. Exiting...\n", argv[argvoffset + 1]);
624 endwin();
625 exit(1);
626 }
627
601 nodelay(stdscr, TRUE); 628 nodelay(stdscr, TRUE);
602 while (1) { 629 while (1) {
603 if (on == 0 && tox_isconnected(m)) { 630 if (on == 0 && tox_isconnected(m)) {
diff --git a/toxcore/DHT.c b/toxcore/DHT.c
index 7663b1cc..1798ea1a 100644
--- a/toxcore/DHT.c
+++ b/toxcore/DHT.c
@@ -978,14 +978,17 @@ void DHT_bootstrap(DHT *dht, IP_Port ip_port, uint8_t *public_key)
978 getnodes(dht, ip_port, public_key, dht->c->self_public_key); 978 getnodes(dht, ip_port, public_key, dht->c->self_public_key);
979 send_ping_request(dht->ping, dht->c, ip_port, public_key); 979 send_ping_request(dht->ping, dht->c, ip_port, public_key);
980} 980}
981void DHT_bootstrap_ex(DHT *dht, const char *address, uint8_t ipv6enabled, uint16_t port, uint8_t *public_key) 981int DHT_bootstrap_ex(DHT *dht, const char *address, uint8_t ipv6enabled, uint16_t port, uint8_t *public_key)
982{ 982{
983 IP_Port ip_port; 983 IP_Port ip_port;
984 ip_init(&ip_port.ip, ipv6enabled); 984 ip_init(&ip_port.ip, ipv6enabled);
985 if (addr_resolve_or_parse_ip(address, &ip_port.ip)) { 985 if (addr_resolve_or_parse_ip(address, &ip_port.ip)) {
986 ip_port.port = port; 986 ip_port.port = port;
987 DHT_bootstrap(dht, ip_port, public_key); 987 DHT_bootstrap(dht, ip_port, public_key);
988 return 1;
988 } 989 }
990 else
991 return 0;
989} 992}
990 993
991/* Send the given packet to node with client_id 994/* Send the given packet to node with client_id
diff --git a/toxcore/DHT.h b/toxcore/DHT.h
index d980f269..90b76a2f 100644
--- a/toxcore/DHT.h
+++ b/toxcore/DHT.h
@@ -157,9 +157,10 @@ void do_DHT(DHT *dht);
157 157
158/* Use this function to bootstrap the client. 158/* Use this function to bootstrap the client.
159 * Sends a get nodes request to the given node with ip port and public_key. 159 * Sends a get nodes request to the given node with ip port and public_key.
160 * DHT_bootstrap_ex() returns 1 if the address could be converted, 0 otherwise
160 */ 161 */
161void DHT_bootstrap(DHT *dht, IP_Port ip_port, uint8_t *public_key); 162void DHT_bootstrap(DHT *dht, IP_Port ip_port, uint8_t *public_key);
162void DHT_bootstrap_ex(DHT *dht, const char *address, uint8_t ipv6enabled, uint16_t port, uint8_t *public_key); 163int DHT_bootstrap_ex(DHT *dht, const char *address, uint8_t ipv6enabled, uint16_t port, uint8_t *public_key);
163 164
164/* Add nodes to the toping list. 165/* Add nodes to the toping list.
165 * All nodes in this list are pinged every TIME_TOPING seconds 166 * All nodes in this list are pinged every TIME_TOPING seconds
diff --git a/toxcore/tox.c b/toxcore/tox.c
index 6417b16a..5e3893ec 100644
--- a/toxcore/tox.c
+++ b/toxcore/tox.c
@@ -374,11 +374,11 @@ void tox_bootstrap(void *tox, IP_Port ip_port, uint8_t *public_key)
374 Messenger *m = tox; 374 Messenger *m = tox;
375 DHT_bootstrap(m->dht, ip_port, public_key); 375 DHT_bootstrap(m->dht, ip_port, public_key);
376} 376}
377void tox_bootstrap_ex(void *tox, const char *address, uint8_t ipv6enabled, 377int tox_bootstrap_ex(void *tox, const char *address, uint8_t ipv6enabled,
378 uint16_t port, uint8_t *public_key) 378 uint16_t port, uint8_t *public_key)
379{ 379{
380 Messenger *m = tox; 380 Messenger *m = tox;
381 DHT_bootstrap_ex(m->dht, address, ipv6enabled, port, public_key); 381 return DHT_bootstrap_ex(m->dht, address, ipv6enabled, port, public_key);
382}; 382};
383 383
384/* return 0 if we are not connected to the DHT. 384/* return 0 if we are not connected to the DHT.
diff --git a/toxcore/tox.h b/toxcore/tox.h
index 15bef94c..cf5d6b2a 100644
--- a/toxcore/tox.h
+++ b/toxcore/tox.h
@@ -340,10 +340,10 @@ void tox_callback_connectionstatus(Tox *tox, void (*function)(Tox *tox, int, uin
340 340
341/* Use this function to bootstrap the client. 341/* Use this function to bootstrap the client.
342 * Sends a get nodes request to the given node with ip port and public_key. 342 * Sends a get nodes request to the given node with ip port and public_key.
343 * tox_bootstrap_ex converts the address into an IP_Port structure internally 343 * tox_bootstrap_ex() returns 1 if the address could be converted, 0 otherwise
344 */ 344 */
345void tox_bootstrap(Tox *tox, tox_IP_Port ip_port, uint8_t *public_key); 345void tox_bootstrap(Tox *tox, tox_IP_Port ip_port, uint8_t *public_key);
346void tox_bootstrap_ex(Tox *tox, const char *address, uint8_t ipv6enabled, 346int tox_bootstrap_ex(Tox *tox, const char *address, uint8_t ipv6enabled,
347 uint16_t port, uint8_t *public_key); 347 uint16_t port, uint8_t *public_key);
348 348
349/* return 0 if we are not connected to the DHT. 349/* return 0 if we are not connected to the DHT.
diff --git a/toxcore/util.h b/toxcore/util.h
index 20731a05..71be84ca 100644
--- a/toxcore/util.h
+++ b/toxcore/util.h
@@ -17,7 +17,7 @@ bool id_eq(uint8_t *dest, uint8_t *src);
17void id_cpy(uint8_t *dest, uint8_t *src); 17void id_cpy(uint8_t *dest, uint8_t *src);
18 18
19#undef LOGGING 19#undef LOGGING
20// #define LOGGING 20/* #define LOGGING */
21#ifdef LOGGING 21#ifdef LOGGING
22extern char logbuffer[512]; 22extern char logbuffer[512];
23void loginit(uint16_t port); 23void loginit(uint16_t port);