diff options
Diffstat (limited to 'toxcore')
-rw-r--r-- | toxcore/DHT.c | 11 | ||||
-rw-r--r-- | toxcore/LAN_discovery.c | 1 | ||||
-rw-r--r-- | toxcore/LAN_discovery.h | 1 | ||||
-rw-r--r-- | toxcore/Messenger.c | 9 | ||||
-rw-r--r-- | toxcore/TCP_client.c | 4 | ||||
-rw-r--r-- | toxcore/TCP_connection.c | 1 | ||||
-rw-r--r-- | toxcore/TCP_server.c | 4 | ||||
-rw-r--r-- | toxcore/TCP_server.h | 2 | ||||
-rw-r--r-- | toxcore/assoc.c | 9 | ||||
-rw-r--r-- | toxcore/friend_connection.c | 1 | ||||
-rw-r--r-- | toxcore/friend_connection.h | 1 | ||||
-rw-r--r-- | toxcore/friend_requests.c | 2 | ||||
-rw-r--r-- | toxcore/group.c | 1 | ||||
-rw-r--r-- | toxcore/net_crypto.c | 5 | ||||
-rw-r--r-- | toxcore/net_crypto.h | 1 | ||||
-rw-r--r-- | toxcore/network.c | 6 | ||||
-rw-r--r-- | toxcore/onion.c | 1 | ||||
-rw-r--r-- | toxcore/onion_announce.c | 3 | ||||
-rw-r--r-- | toxcore/onion_client.c | 3 | ||||
-rw-r--r-- | toxcore/ping.c | 6 | ||||
-rw-r--r-- | toxcore/ping_array.c | 3 | ||||
-rw-r--r-- | toxcore/tox.c | 9 | ||||
-rw-r--r-- | toxcore/tox_group.c | 7 | ||||
-rw-r--r-- | toxcore/util.c | 7 |
24 files changed, 51 insertions, 47 deletions
diff --git a/toxcore/DHT.c b/toxcore/DHT.c index f9910b06..beff0499 100644 --- a/toxcore/DHT.c +++ b/toxcore/DHT.c | |||
@@ -27,23 +27,20 @@ | |||
27 | #include "config.h" | 27 | #include "config.h" |
28 | #endif | 28 | #endif |
29 | 29 | ||
30 | #include <assert.h> | ||
31 | |||
32 | #include "logger.h" | ||
33 | |||
34 | #include "DHT.h" | 30 | #include "DHT.h" |
35 | 31 | ||
36 | #ifdef ENABLE_ASSOC_DHT | 32 | #ifdef ENABLE_ASSOC_DHT |
37 | #include "assoc.h" | 33 | #include "assoc.h" |
38 | #endif | 34 | #endif |
39 | |||
40 | #include "ping.h" | ||
41 | |||
42 | #include "LAN_discovery.h" | 35 | #include "LAN_discovery.h" |
36 | #include "logger.h" | ||
43 | #include "misc_tools.h" | 37 | #include "misc_tools.h" |
44 | #include "network.h" | 38 | #include "network.h" |
39 | #include "ping.h" | ||
45 | #include "util.h" | 40 | #include "util.h" |
46 | 41 | ||
42 | #include <assert.h> | ||
43 | |||
47 | /* The timeout after which a node is discarded completely. */ | 44 | /* The timeout after which a node is discarded completely. */ |
48 | #define KILL_NODE_TIMEOUT (BAD_NODE_TIMEOUT + PING_INTERVAL) | 45 | #define KILL_NODE_TIMEOUT (BAD_NODE_TIMEOUT + PING_INTERVAL) |
49 | 46 | ||
diff --git a/toxcore/LAN_discovery.c b/toxcore/LAN_discovery.c index f0b12a3e..115b626d 100644 --- a/toxcore/LAN_discovery.c +++ b/toxcore/LAN_discovery.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #endif | 26 | #endif |
27 | 27 | ||
28 | #include "LAN_discovery.h" | 28 | #include "LAN_discovery.h" |
29 | |||
29 | #include "util.h" | 30 | #include "util.h" |
30 | 31 | ||
31 | /* Used for get_broadcast(). */ | 32 | /* Used for get_broadcast(). */ |
diff --git a/toxcore/LAN_discovery.h b/toxcore/LAN_discovery.h index 358bea2f..65304791 100644 --- a/toxcore/LAN_discovery.h +++ b/toxcore/LAN_discovery.h | |||
@@ -25,7 +25,6 @@ | |||
25 | #ifndef LAN_DISCOVERY_H | 25 | #ifndef LAN_DISCOVERY_H |
26 | #define LAN_DISCOVERY_H | 26 | #define LAN_DISCOVERY_H |
27 | 27 | ||
28 | |||
29 | #include "DHT.h" | 28 | #include "DHT.h" |
30 | 29 | ||
31 | /* Interval in seconds between LAN discovery packet sending. */ | 30 | /* Interval in seconds between LAN discovery packet sending. */ |
diff --git a/toxcore/Messenger.c b/toxcore/Messenger.c index 8616bd8d..b72fac93 100644 --- a/toxcore/Messenger.c +++ b/toxcore/Messenger.c | |||
@@ -25,16 +25,17 @@ | |||
25 | #include "config.h" | 25 | #include "config.h" |
26 | #endif | 26 | #endif |
27 | 27 | ||
28 | #ifdef TOX_DEBUG | ||
29 | #include <assert.h> | ||
30 | #endif | ||
31 | |||
32 | #include "Messenger.h" | 28 | #include "Messenger.h" |
29 | |||
33 | #include "assoc.h" | 30 | #include "assoc.h" |
34 | #include "logger.h" | 31 | #include "logger.h" |
35 | #include "network.h" | 32 | #include "network.h" |
36 | #include "util.h" | 33 | #include "util.h" |
37 | 34 | ||
35 | #ifdef TOX_DEBUG | ||
36 | #include <assert.h> | ||
37 | #endif | ||
38 | |||
38 | 39 | ||
39 | static void set_friend_status(Messenger *m, int32_t friendnumber, uint8_t status, void *userdata); | 40 | static void set_friend_status(Messenger *m, int32_t friendnumber, uint8_t status, void *userdata); |
40 | static int write_cryptpacket_id(const Messenger *m, int32_t friendnumber, uint8_t packet_id, const uint8_t *data, | 41 | static int write_cryptpacket_id(const Messenger *m, int32_t friendnumber, uint8_t packet_id, const uint8_t *data, |
diff --git a/toxcore/TCP_client.c b/toxcore/TCP_client.c index 15e26107..d825cf38 100644 --- a/toxcore/TCP_client.c +++ b/toxcore/TCP_client.c | |||
@@ -26,12 +26,12 @@ | |||
26 | 26 | ||
27 | #include "TCP_client.h" | 27 | #include "TCP_client.h" |
28 | 28 | ||
29 | #include "util.h" | ||
30 | |||
29 | #if !defined(_WIN32) && !defined(__WIN32__) && !defined (WIN32) | 31 | #if !defined(_WIN32) && !defined(__WIN32__) && !defined (WIN32) |
30 | #include <sys/ioctl.h> | 32 | #include <sys/ioctl.h> |
31 | #endif | 33 | #endif |
32 | 34 | ||
33 | #include "util.h" | ||
34 | |||
35 | /* return 1 on success | 35 | /* return 1 on success |
36 | * return 0 on failure | 36 | * return 0 on failure |
37 | */ | 37 | */ |
diff --git a/toxcore/TCP_connection.c b/toxcore/TCP_connection.c index 623aeb4f..6a0b2c8a 100644 --- a/toxcore/TCP_connection.c +++ b/toxcore/TCP_connection.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #endif | 26 | #endif |
27 | 27 | ||
28 | #include "TCP_connection.h" | 28 | #include "TCP_connection.h" |
29 | |||
29 | #include "util.h" | 30 | #include "util.h" |
30 | 31 | ||
31 | /* Set the size of the array to num. | 32 | /* Set the size of the array to num. |
diff --git a/toxcore/TCP_server.c b/toxcore/TCP_server.c index 81f884d8..d4b5ddd1 100644 --- a/toxcore/TCP_server.c +++ b/toxcore/TCP_server.c | |||
@@ -26,12 +26,12 @@ | |||
26 | 26 | ||
27 | #include "TCP_server.h" | 27 | #include "TCP_server.h" |
28 | 28 | ||
29 | #include "util.h" | ||
30 | |||
29 | #if !defined(_WIN32) && !defined(__WIN32__) && !defined (WIN32) | 31 | #if !defined(_WIN32) && !defined(__WIN32__) && !defined (WIN32) |
30 | #include <sys/ioctl.h> | 32 | #include <sys/ioctl.h> |
31 | #endif | 33 | #endif |
32 | 34 | ||
33 | #include "util.h" | ||
34 | |||
35 | /* return 1 on success | 35 | /* return 1 on success |
36 | * return 0 on failure | 36 | * return 0 on failure |
37 | */ | 37 | */ |
diff --git a/toxcore/TCP_server.h b/toxcore/TCP_server.h index f5768594..dedb819f 100644 --- a/toxcore/TCP_server.h +++ b/toxcore/TCP_server.h | |||
@@ -28,7 +28,7 @@ | |||
28 | #include "onion.h" | 28 | #include "onion.h" |
29 | 29 | ||
30 | #ifdef TCP_SERVER_USE_EPOLL | 30 | #ifdef TCP_SERVER_USE_EPOLL |
31 | #include "sys/epoll.h" | 31 | #include <sys/epoll.h> |
32 | #endif | 32 | #endif |
33 | 33 | ||
34 | #if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(__MACH__) | 34 | #if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(__MACH__) |
diff --git a/toxcore/assoc.c b/toxcore/assoc.c index 0a3845bc..df84fff5 100644 --- a/toxcore/assoc.c +++ b/toxcore/assoc.c | |||
@@ -1,16 +1,15 @@ | |||
1 | |||
2 | #ifdef HAVE_CONFIG_H | 1 | #ifdef HAVE_CONFIG_H |
3 | #include "config.h" | 2 | #include "config.h" |
4 | #endif | 3 | #endif |
5 | 4 | ||
6 | #include "DHT.h" | ||
7 | #include "assoc.h" | 5 | #include "assoc.h" |
8 | #include "logger.h" | ||
9 | #include "ping.h" | ||
10 | 6 | ||
7 | #include "DHT.h" | ||
11 | #include "LAN_discovery.h" | 8 | #include "LAN_discovery.h" |
12 | 9 | #include "logger.h" | |
10 | #include "ping.h" | ||
13 | #include "util.h" | 11 | #include "util.h" |
12 | |||
14 | #include <assert.h> | 13 | #include <assert.h> |
15 | 14 | ||
16 | /* | 15 | /* |
diff --git a/toxcore/friend_connection.c b/toxcore/friend_connection.c index 9e78a0c5..fa88f1bc 100644 --- a/toxcore/friend_connection.c +++ b/toxcore/friend_connection.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #endif | 26 | #endif |
27 | 27 | ||
28 | #include "friend_connection.h" | 28 | #include "friend_connection.h" |
29 | |||
29 | #include "util.h" | 30 | #include "util.h" |
30 | 31 | ||
31 | /* return 1 if the friendcon_id is not valid. | 32 | /* return 1 if the friendcon_id is not valid. |
diff --git a/toxcore/friend_connection.h b/toxcore/friend_connection.h index c5179a6a..df017c1f 100644 --- a/toxcore/friend_connection.h +++ b/toxcore/friend_connection.h | |||
@@ -30,7 +30,6 @@ | |||
30 | #include "net_crypto.h" | 30 | #include "net_crypto.h" |
31 | #include "onion_client.h" | 31 | #include "onion_client.h" |
32 | 32 | ||
33 | |||
34 | #define MAX_FRIEND_CONNECTION_CALLBACKS 2 | 33 | #define MAX_FRIEND_CONNECTION_CALLBACKS 2 |
35 | #define MESSENGER_CALLBACK_INDEX 0 | 34 | #define MESSENGER_CALLBACK_INDEX 0 |
36 | #define GROUPCHAT_CALLBACK_INDEX 1 | 35 | #define GROUPCHAT_CALLBACK_INDEX 1 |
diff --git a/toxcore/friend_requests.c b/toxcore/friend_requests.c index 3d10213b..a011c72e 100644 --- a/toxcore/friend_requests.c +++ b/toxcore/friend_requests.c | |||
@@ -26,8 +26,8 @@ | |||
26 | #endif | 26 | #endif |
27 | 27 | ||
28 | #include "friend_requests.h" | 28 | #include "friend_requests.h" |
29 | #include "util.h" | ||
30 | 29 | ||
30 | #include "util.h" | ||
31 | 31 | ||
32 | /* Set and get the nospam variable used to prevent one type of friend request spam. */ | 32 | /* Set and get the nospam variable used to prevent one type of friend request spam. */ |
33 | void set_nospam(Friend_Requests *fr, uint32_t num) | 33 | void set_nospam(Friend_Requests *fr, uint32_t num) |
diff --git a/toxcore/group.c b/toxcore/group.c index c7844d6d..a85b7320 100644 --- a/toxcore/group.c +++ b/toxcore/group.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #endif | 26 | #endif |
27 | 27 | ||
28 | #include "group.h" | 28 | #include "group.h" |
29 | |||
29 | #include "util.h" | 30 | #include "util.h" |
30 | 31 | ||
31 | /* return 1 if the groupnumber is not valid. | 32 | /* return 1 if the groupnumber is not valid. |
diff --git a/toxcore/net_crypto.c b/toxcore/net_crypto.c index 72a34811..b93b5cde 100644 --- a/toxcore/net_crypto.c +++ b/toxcore/net_crypto.c | |||
@@ -27,10 +27,13 @@ | |||
27 | #include "config.h" | 27 | #include "config.h" |
28 | #endif | 28 | #endif |
29 | 29 | ||
30 | #include "math.h" | ||
31 | #include "net_crypto.h" | 30 | #include "net_crypto.h" |
31 | |||
32 | #include "util.h" | 32 | #include "util.h" |
33 | 33 | ||
34 | #include <math.h> | ||
35 | |||
36 | |||
34 | static uint8_t crypt_connection_id_not_valid(const Net_Crypto *c, int crypt_connection_id) | 37 | static uint8_t crypt_connection_id_not_valid(const Net_Crypto *c, int crypt_connection_id) |
35 | { | 38 | { |
36 | if ((uint32_t)crypt_connection_id >= c->crypto_connections_length) { | 39 | if ((uint32_t)crypt_connection_id >= c->crypto_connections_length) { |
diff --git a/toxcore/net_crypto.h b/toxcore/net_crypto.h index e676b864..7d2644f4 100644 --- a/toxcore/net_crypto.h +++ b/toxcore/net_crypto.h | |||
@@ -28,6 +28,7 @@ | |||
28 | #include "LAN_discovery.h" | 28 | #include "LAN_discovery.h" |
29 | #include "TCP_connection.h" | 29 | #include "TCP_connection.h" |
30 | #include "logger.h" | 30 | #include "logger.h" |
31 | |||
31 | #include <pthread.h> | 32 | #include <pthread.h> |
32 | 33 | ||
33 | #define CRYPTO_CONN_NO_CONNECTION 0 | 34 | #define CRYPTO_CONN_NO_CONNECTION 0 |
diff --git a/toxcore/network.c b/toxcore/network.c index 2097078a..1e6661cb 100644 --- a/toxcore/network.c +++ b/toxcore/network.c | |||
@@ -29,7 +29,10 @@ | |||
29 | #include "config.h" | 29 | #include "config.h" |
30 | #endif | 30 | #endif |
31 | 31 | ||
32 | #include "network.h" | ||
33 | |||
32 | #include "logger.h" | 34 | #include "logger.h" |
35 | #include "util.h" | ||
33 | 36 | ||
34 | #if !defined(_WIN32) && !defined(__WIN32__) && !defined (WIN32) | 37 | #if !defined(_WIN32) && !defined(__WIN32__) && !defined (WIN32) |
35 | #include <errno.h> | 38 | #include <errno.h> |
@@ -40,9 +43,6 @@ | |||
40 | #include <mach/mach.h> | 43 | #include <mach/mach.h> |
41 | #endif | 44 | #endif |
42 | 45 | ||
43 | #include "network.h" | ||
44 | #include "util.h" | ||
45 | |||
46 | #if defined(_WIN32) || defined(__WIN32__) || defined (WIN32) | 46 | #if defined(_WIN32) || defined(__WIN32__) || defined (WIN32) |
47 | 47 | ||
48 | static const char *inet_ntop(sa_family_t family, void *addr, char *buf, size_t bufsize) | 48 | static const char *inet_ntop(sa_family_t family, void *addr, char *buf, size_t bufsize) |
diff --git a/toxcore/onion.c b/toxcore/onion.c index 0f0abf26..ba3f1f4a 100644 --- a/toxcore/onion.c +++ b/toxcore/onion.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #endif | 24 | #endif |
25 | 25 | ||
26 | #include "onion.h" | 26 | #include "onion.h" |
27 | |||
27 | #include "util.h" | 28 | #include "util.h" |
28 | 29 | ||
29 | #define RETURN_1 ONION_RETURN_1 | 30 | #define RETURN_1 ONION_RETURN_1 |
diff --git a/toxcore/onion_announce.c b/toxcore/onion_announce.c index 3be76ddf..42b3a635 100644 --- a/toxcore/onion_announce.c +++ b/toxcore/onion_announce.c | |||
@@ -23,8 +23,9 @@ | |||
23 | #include "config.h" | 23 | #include "config.h" |
24 | #endif | 24 | #endif |
25 | 25 | ||
26 | #include "LAN_discovery.h" | ||
27 | #include "onion_announce.h" | 26 | #include "onion_announce.h" |
27 | |||
28 | #include "LAN_discovery.h" | ||
28 | #include "util.h" | 29 | #include "util.h" |
29 | 30 | ||
30 | #define PING_ID_TIMEOUT 20 | 31 | #define PING_ID_TIMEOUT 20 |
diff --git a/toxcore/onion_client.c b/toxcore/onion_client.c index 092198f2..a140e008 100644 --- a/toxcore/onion_client.c +++ b/toxcore/onion_client.c | |||
@@ -24,8 +24,9 @@ | |||
24 | #include "config.h" | 24 | #include "config.h" |
25 | #endif | 25 | #endif |
26 | 26 | ||
27 | #include "LAN_discovery.h" | ||
28 | #include "onion_client.h" | 27 | #include "onion_client.h" |
28 | |||
29 | #include "LAN_discovery.h" | ||
29 | #include "util.h" | 30 | #include "util.h" |
30 | 31 | ||
31 | /* defines for the array size and | 32 | /* defines for the array size and |
diff --git a/toxcore/ping.c b/toxcore/ping.c index a0cfbf18..d2a01f5d 100644 --- a/toxcore/ping.c +++ b/toxcore/ping.c | |||
@@ -27,15 +27,15 @@ | |||
27 | #include "config.h" | 27 | #include "config.h" |
28 | #endif | 28 | #endif |
29 | 29 | ||
30 | #include <stdint.h> | ||
31 | |||
32 | #include "DHT.h" | ||
33 | #include "ping.h" | 30 | #include "ping.h" |
34 | 31 | ||
32 | #include "DHT.h" | ||
35 | #include "network.h" | 33 | #include "network.h" |
36 | #include "ping_array.h" | 34 | #include "ping_array.h" |
37 | #include "util.h" | 35 | #include "util.h" |
38 | 36 | ||
37 | #include <stdint.h> | ||
38 | |||
39 | #define PING_NUM_MAX 512 | 39 | #define PING_NUM_MAX 512 |
40 | 40 | ||
41 | /* Maximum newly announced nodes to ping per TIME_TO_PING seconds. */ | 41 | /* Maximum newly announced nodes to ping per TIME_TO_PING seconds. */ |
diff --git a/toxcore/ping_array.c b/toxcore/ping_array.c index 8c5d72e9..8a23c6d8 100644 --- a/toxcore/ping_array.c +++ b/toxcore/ping_array.c | |||
@@ -26,8 +26,9 @@ | |||
26 | #include "config.h" | 26 | #include "config.h" |
27 | #endif | 27 | #endif |
28 | 28 | ||
29 | #include "crypto_core.h" | ||
30 | #include "ping_array.h" | 29 | #include "ping_array.h" |
30 | |||
31 | #include "crypto_core.h" | ||
31 | #include "util.h" | 32 | #include "util.h" |
32 | 33 | ||
33 | static void clear_entry(Ping_Array *array, uint32_t index) | 34 | static void clear_entry(Ping_Array *array, uint32_t index) |
diff --git a/toxcore/tox.c b/toxcore/tox.c index 40746656..9ec472c0 100644 --- a/toxcore/tox.c +++ b/toxcore/tox.c | |||
@@ -25,17 +25,16 @@ | |||
25 | #include "config.h" | 25 | #include "config.h" |
26 | #endif | 26 | #endif |
27 | 27 | ||
28 | #define TOX_DEFINED | ||
29 | typedef struct Messenger Tox; | ||
30 | #include "tox.h" | ||
31 | |||
28 | #include "Messenger.h" | 32 | #include "Messenger.h" |
29 | #include "group.h" | 33 | #include "group.h" |
30 | #include "logger.h" | 34 | #include "logger.h" |
31 | 35 | ||
32 | #include "../toxencryptsave/defines.h" | 36 | #include "../toxencryptsave/defines.h" |
33 | 37 | ||
34 | #define TOX_DEFINED | ||
35 | typedef struct Messenger Tox; | ||
36 | |||
37 | #include "tox.h" | ||
38 | |||
39 | #define SET_ERROR_PARAMETER(param, x) {if(param) {*param = x;}} | 38 | #define SET_ERROR_PARAMETER(param, x) {if(param) {*param = x;}} |
40 | 39 | ||
41 | #if TOX_HASH_LENGTH != crypto_hash_sha256_BYTES | 40 | #if TOX_HASH_LENGTH != crypto_hash_sha256_BYTES |
diff --git a/toxcore/tox_group.c b/toxcore/tox_group.c index 2228ed88..62c84b22 100644 --- a/toxcore/tox_group.c +++ b/toxcore/tox_group.c | |||
@@ -25,13 +25,12 @@ | |||
25 | #include "config.h" | 25 | #include "config.h" |
26 | #endif | 26 | #endif |
27 | 27 | ||
28 | #include "Messenger.h" | ||
29 | #include "group.h" | ||
30 | |||
31 | #define TOX_DEFINED | 28 | #define TOX_DEFINED |
32 | typedef struct Messenger Tox; | 29 | typedef struct Messenger Tox; |
30 | #include "tox_group.h" | ||
33 | 31 | ||
34 | #include "tox.h" | 32 | #include "Messenger.h" |
33 | #include "group.h" | ||
35 | 34 | ||
36 | /**********GROUP CHAT FUNCTIONS: WARNING Group chats will be rewritten so this might change ************/ | 35 | /**********GROUP CHAT FUNCTIONS: WARNING Group chats will be rewritten so this might change ************/ |
37 | 36 | ||
diff --git a/toxcore/util.c b/toxcore/util.c index 92ad4510..40bf2849 100644 --- a/toxcore/util.c +++ b/toxcore/util.c | |||
@@ -26,12 +26,11 @@ | |||
26 | #include "config.h" | 26 | #include "config.h" |
27 | #endif | 27 | #endif |
28 | 28 | ||
29 | #include <time.h> | 29 | #include "util.h" |
30 | 30 | ||
31 | /* for crypto_box_PUBLICKEYBYTES */ | 31 | #include "crypto_core.h" /* for crypto_box_PUBLICKEYBYTES */ |
32 | #include "crypto_core.h" | ||
33 | 32 | ||
34 | #include "util.h" | 33 | #include <time.h> |
35 | 34 | ||
36 | 35 | ||
37 | /* don't call into system billions of times for no reason */ | 36 | /* don't call into system billions of times for no reason */ |