summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGDR! <gdr@gdr.name>2016-12-07 14:56:26 +0100
committerGDR! <gdr@gdr.name>2016-12-07 14:56:26 +0100
commite093c65637385fe3b3db6ce5a830e5c9c2a00dd4 (patch)
tree933d17400354412b2ac0fe895884a76e6534d6e0
parentae6ff817c202fa6e41b6ec705152fbfee6c92cd1 (diff)
Made tuntox build with TokTok/c-toxcore
-rw-r--r--Makefile11
-rw-r--r--main.c10
-rw-r--r--util.h2
3 files changed, 15 insertions, 8 deletions
diff --git a/Makefile b/Makefile
index 5e19d0a..1c4effd 100644
--- a/Makefile
+++ b/Makefile
@@ -1,10 +1,12 @@
1SOURCES = $(wildcard *.c) 1SOURCES = $(wildcard *.c)
2DEPS=libtoxcore 2DEPS=libsodium toxcore
3CC=gcc 3CC=gcc
4CFLAGS=-g #-std=c99 4CFLAGS=-g #-std=c99
5CFLAGS += $(shell pkg-config --cflags $(DEPS)) 5CFLAGS += $(shell pkg-config --cflags $(DEPS))
6LDFLAGS=-g -pthread -lm -static -lrt 6LDFLAGS=-g -pthread -lm -static -lrt
7LDFLAGS += $(shell pkg-config --libs $(DEPS)) 7LDFLAGS += $(shell pkg-config --static --libs $(DEPS))
8DSO_LDFLAGS=-g -pthread -lm -lrt
9DSO_LDFLAGS += $(shell pkg-config --libs $(DEPS))
8OBJECTS=$(SOURCES:.c=.o) 10OBJECTS=$(SOURCES:.c=.o)
9INCLUDES = $(wildcard *.h) 11INCLUDES = $(wildcard *.h)
10 12
@@ -19,7 +21,10 @@ gitversion.c: gitversion.h
19 $(CC) $(CFLAGS) $< -c -o $@ 21 $(CC) $(CFLAGS) $< -c -o $@
20 22
21tuntox: $(OBJECTS) $(INCLUDES) 23tuntox: $(OBJECTS) $(INCLUDES)
22 $(CC) -o $@ $(OBJECTS) -ltoxcore -lpthread $(LDFLAGS) /usr/local/lib/libsodium.a /usr/local/lib/libtoxcore.a 24 $(CC) -o $@ $(OBJECTS) -lpthread $(LDFLAGS) /usr/local/lib/libtoxmessenger.a /usr/local/lib/libtoxcore.a
25
26tuntox_nostatic: $(OBJECTS) $(INCLUDES)
27 $(CC) -o $@ $(OBJECTS) -lpthread $(DSO_LDFLAGS)
23 28
24cscope.out: 29cscope.out:
25 cscope -bv ./*.[ch] 30 cscope -bv ./*.[ch]
diff --git a/main.c b/main.c
index f9e3092..783b509 100644
--- a/main.c
+++ b/main.c
@@ -331,7 +331,7 @@ int send_frame(protocol_frame *frame, uint8_t *data)
331 331
332 for(j = 0; j < i; j++) 332 for(j = 0; j < i; j++)
333 { 333 {
334 tox_iterate(tox); 334 tox_iterate(tox, NULL);
335 usleep(j * 10000); 335 usleep(j * 10000);
336 } 336 }
337 } 337 }
@@ -904,7 +904,7 @@ int do_server_loop()
904 tunnel *tmp = NULL; 904 tunnel *tmp = NULL;
905 TOX_CONNECTION connected = 0; 905 TOX_CONNECTION connected = 0;
906 906
907 tox_callback_friend_lossless_packet(tox, parse_lossless_packet, NULL); 907 tox_callback_friend_lossless_packet(tox, parse_lossless_packet);
908 908
909 tv.tv_sec = 0; 909 tv.tv_sec = 0;
910 tv.tv_usec = 20000; 910 tv.tv_usec = 20000;
@@ -918,7 +918,7 @@ int do_server_loop()
918 int select_rv = 0; 918 int select_rv = 0;
919 919
920 /* Let tox do its stuff */ 920 /* Let tox do its stuff */
921 tox_iterate(tox); 921 tox_iterate(tox, NULL);
922 922
923 /* Get the desired sleep time, used in select() later */ 923 /* Get the desired sleep time, used in select() later */
924 tox_do_interval_ms = tox_iteration_interval(tox); 924 tox_do_interval_ms = tox_iteration_interval(tox);
@@ -1378,7 +1378,7 @@ int main(int argc, char *argv[])
1378 } 1378 }
1379 1379
1380 set_tox_username(tox); 1380 set_tox_username(tox);
1381 tox_callback_self_connection_status(tox, handle_connection_status_change, NULL); 1381 tox_callback_self_connection_status(tox, handle_connection_status_change);
1382 1382
1383 do_bootstrap(tox); 1383 do_bootstrap(tox);
1384 1384
@@ -1411,7 +1411,7 @@ int main(int argc, char *argv[])
1411 tox_printable_id[TOX_ADDRESS_SIZE * 2] = '\0'; 1411 tox_printable_id[TOX_ADDRESS_SIZE * 2] = '\0';
1412 log_printf(L_INFO, "Using Tox ID: %s\n", tox_printable_id); 1412 log_printf(L_INFO, "Using Tox ID: %s\n", tox_printable_id);
1413 1413
1414 tox_callback_friend_request(tox, accept_friend_request, NULL); 1414 tox_callback_friend_request(tox, accept_friend_request);
1415 do_server_loop(); 1415 do_server_loop();
1416 clear_rules(); 1416 clear_rules();
1417 } 1417 }
diff --git a/util.h b/util.h
index 1a210d5..7dced6b 100644
--- a/util.h
+++ b/util.h
@@ -13,5 +13,7 @@ void id_to_string(char_t *dest, const char_t *src);
13int string_to_id(char_t *w, char_t *a); 13int string_to_id(char_t *w, char_t *a);
14void* file_raw(char *path, uint32_t *size); 14void* file_raw(char *path, uint32_t *size);
15const char *readable_connection_status(TOX_CONNECTION status); 15const char *readable_connection_status(TOX_CONNECTION status);
16int parse_local_port_forward(char *string, int *local_port, char **hostname, int *remote_port);
17int parse_pipe_port_forward(char *string, char **hostname, int *remote_port);
16 18
17#endif 19#endif