summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--toxav/audio.c5
-rw-r--r--toxav/audio.h6
-rw-r--r--toxav/bwcontroller.c4
-rw-r--r--toxav/bwcontroller.h1
-rw-r--r--toxav/group.c3
-rw-r--r--toxav/group.h4
-rw-r--r--toxav/msi.c3
-rw-r--r--toxav/msi.h9
-rw-r--r--toxav/rtp.c6
-rw-r--r--toxav/rtp.h6
-rw-r--r--toxav/toxav.c2
-rw-r--r--toxav/toxav_old.c3
-rw-r--r--toxav/video.c7
-rw-r--r--toxav/video.h10
-rw-r--r--toxcore/DHT.c11
-rw-r--r--toxcore/LAN_discovery.c1
-rw-r--r--toxcore/LAN_discovery.h1
-rw-r--r--toxcore/Messenger.c9
-rw-r--r--toxcore/TCP_client.c4
-rw-r--r--toxcore/TCP_connection.c1
-rw-r--r--toxcore/TCP_server.c4
-rw-r--r--toxcore/TCP_server.h2
-rw-r--r--toxcore/assoc.c9
-rw-r--r--toxcore/friend_connection.c1
-rw-r--r--toxcore/friend_connection.h1
-rw-r--r--toxcore/friend_requests.c2
-rw-r--r--toxcore/group.c1
-rw-r--r--toxcore/net_crypto.c5
-rw-r--r--toxcore/net_crypto.h1
-rw-r--r--toxcore/network.c6
-rw-r--r--toxcore/onion.c1
-rw-r--r--toxcore/onion_announce.c3
-rw-r--r--toxcore/onion_client.c3
-rw-r--r--toxcore/ping.c6
-rw-r--r--toxcore/ping_array.c3
-rw-r--r--toxcore/tox.c9
-rw-r--r--toxcore/tox_group.c7
-rw-r--r--toxcore/util.c7
38 files changed, 93 insertions, 74 deletions
diff --git a/toxav/audio.c b/toxav/audio.c
index c0bfa608..0b0aaf2d 100644
--- a/toxav/audio.c
+++ b/toxav/audio.c
@@ -23,13 +23,14 @@
23#include "config.h" 23#include "config.h"
24#endif /* HAVE_CONFIG_H */ 24#endif /* HAVE_CONFIG_H */
25 25
26#include <stdlib.h>
27
28#include "audio.h" 26#include "audio.h"
27
29#include "rtp.h" 28#include "rtp.h"
30 29
31#include "../toxcore/logger.h" 30#include "../toxcore/logger.h"
32 31
32#include <stdlib.h>
33
33static struct JitterBuffer *jbuf_new(uint32_t capacity); 34static struct JitterBuffer *jbuf_new(uint32_t capacity);
34static void jbuf_clear(struct JitterBuffer *q); 35static void jbuf_clear(struct JitterBuffer *q);
35static void jbuf_free(struct JitterBuffer *q); 36static void jbuf_free(struct JitterBuffer *q);
diff --git a/toxav/audio.h b/toxav/audio.h
index 6832f6a9..5f9d7f7d 100644
--- a/toxav/audio.h
+++ b/toxav/audio.h
@@ -22,14 +22,14 @@
22#ifndef AUDIO_H 22#ifndef AUDIO_H
23#define AUDIO_H 23#define AUDIO_H
24 24
25#include <opus.h>
26#include <pthread.h>
27
28#include "toxav.h" 25#include "toxav.h"
29 26
30#include "../toxcore/logger.h" 27#include "../toxcore/logger.h"
31#include "../toxcore/util.h" 28#include "../toxcore/util.h"
32 29
30#include <opus.h>
31#include <pthread.h>
32
33struct RTPMessage; 33struct RTPMessage;
34 34
35typedef struct ACSession_s { 35typedef struct ACSession_s {
diff --git a/toxav/bwcontroller.c b/toxav/bwcontroller.c
index 49a2d9e1..8ca22fbf 100644
--- a/toxav/bwcontroller.c
+++ b/toxav/bwcontroller.c
@@ -23,9 +23,11 @@
23#include "config.h" 23#include "config.h"
24#endif /* HAVE_CONFIG_H */ 24#endif /* HAVE_CONFIG_H */
25 25
26#include "bwcontroller.h"
27
26#include "../toxcore/logger.h" 28#include "../toxcore/logger.h"
27#include "../toxcore/util.h" 29#include "../toxcore/util.h"
28#include "bwcontroller.h" 30
29#include <assert.h> 31#include <assert.h>
30 32
31#define BWC_PACKET_ID 196 33#define BWC_PACKET_ID 196
diff --git a/toxav/bwcontroller.h b/toxav/bwcontroller.h
index 5e7ae9df..610194bf 100644
--- a/toxav/bwcontroller.h
+++ b/toxav/bwcontroller.h
@@ -21,6 +21,7 @@
21 21
22#ifndef BWCONROLER_H 22#ifndef BWCONROLER_H
23#define BWCONROLER_H 23#define BWCONROLER_H
24
24#include "../toxcore/Messenger.h" 25#include "../toxcore/Messenger.h"
25 26
26typedef struct BWController_s BWController; 27typedef struct BWController_s BWController;
diff --git a/toxav/group.c b/toxav/group.c
index 969250f8..ea84bf72 100644
--- a/toxav/group.c
+++ b/toxav/group.c
@@ -22,9 +22,10 @@
22#include "config.h" 22#include "config.h"
23#endif /* HAVE_CONFIG_H */ 23#endif /* HAVE_CONFIG_H */
24 24
25#include "group.h"
26
25#include "../toxcore/logger.h" 27#include "../toxcore/logger.h"
26#include "../toxcore/util.h" 28#include "../toxcore/util.h"
27#include "group.h"
28 29
29#define GROUP_JBUF_SIZE 6 30#define GROUP_JBUF_SIZE 6
30#define GROUP_JBUF_DEAD_SECONDS 4 31#define GROUP_JBUF_DEAD_SECONDS 4
diff --git a/toxav/group.h b/toxav/group.h
index e255796b..1929b17c 100644
--- a/toxav/group.h
+++ b/toxav/group.h
@@ -18,11 +18,11 @@
18 * along with Tox. If not, see <http://www.gnu.org/licenses/>. 18 * along with Tox. If not, see <http://www.gnu.org/licenses/>.
19 */ 19 */
20 20
21#include "../toxcore/group.h"
22
21/* Audio encoding/decoding */ 23/* Audio encoding/decoding */
22#include <opus.h> 24#include <opus.h>
23 25
24#include "../toxcore/group.h"
25
26#define GROUP_AUDIO_PACKET_ID 192 26#define GROUP_AUDIO_PACKET_ID 192
27 27
28/* Create a new toxav group. 28/* Create a new toxav group.
diff --git a/toxav/msi.c b/toxav/msi.c
index 505a7df5..cb92525a 100644
--- a/toxav/msi.c
+++ b/toxav/msi.c
@@ -24,9 +24,10 @@
24#include "config.h" 24#include "config.h"
25#endif /* HAVE_CONFIG_H */ 25#endif /* HAVE_CONFIG_H */
26 26
27#include "msi.h"
28
27#include "../toxcore/logger.h" 29#include "../toxcore/logger.h"
28#include "../toxcore/util.h" 30#include "../toxcore/util.h"
29#include "msi.h"
30 31
31#include <assert.h> 32#include <assert.h>
32#include <stdbool.h> 33#include <stdbool.h>
diff --git a/toxav/msi.h b/toxav/msi.h
index 8cb47384..f69e67ef 100644
--- a/toxav/msi.h
+++ b/toxav/msi.h
@@ -22,13 +22,14 @@
22#ifndef MSI_H 22#ifndef MSI_H
23#define MSI_H 23#define MSI_H
24 24
25#include <inttypes.h>
26#include <pthread.h>
27
28#include "../toxcore/Messenger.h"
29#include "audio.h" 25#include "audio.h"
30#include "video.h" 26#include "video.h"
31 27
28#include "../toxcore/Messenger.h"
29
30#include <inttypes.h>
31#include <pthread.h>
32
32/** 33/**
33 * Error codes. 34 * Error codes.
34 */ 35 */
diff --git a/toxav/rtp.c b/toxav/rtp.c
index 6e0c22b2..05430c62 100644
--- a/toxav/rtp.c
+++ b/toxav/rtp.c
@@ -23,11 +23,13 @@
23#include "config.h" 23#include "config.h"
24#endif /* HAVE_CONFIG_H */ 24#endif /* HAVE_CONFIG_H */
25 25
26#include "rtp.h"
27
28#include "bwcontroller.h"
29
26#include "../toxcore/Messenger.h" 30#include "../toxcore/Messenger.h"
27#include "../toxcore/logger.h" 31#include "../toxcore/logger.h"
28#include "../toxcore/util.h" 32#include "../toxcore/util.h"
29#include "bwcontroller.h"
30#include "rtp.h"
31 33
32#include <assert.h> 34#include <assert.h>
33#include <stdlib.h> 35#include <stdlib.h>
diff --git a/toxav/rtp.h b/toxav/rtp.h
index 18929e12..30d8ca65 100644
--- a/toxav/rtp.h
+++ b/toxav/rtp.h
@@ -22,9 +22,11 @@
22#ifndef RTP_H 22#ifndef RTP_H
23#define RTP_H 23#define RTP_H
24 24
25#include "../toxcore/Messenger.h"
26#include "bwcontroller.h" 25#include "bwcontroller.h"
27#include "stdbool.h" 26
27#include "../toxcore/Messenger.h"
28
29#include <stdbool.h>
28 30
29/** 31/**
30 * Payload type identifier. Also used as rtp callback prefix. 32 * Payload type identifier. Also used as rtp callback prefix.
diff --git a/toxav/toxav.c b/toxav/toxav.c
index 749519a2..9cb7be33 100644
--- a/toxav/toxav.c
+++ b/toxav/toxav.c
@@ -23,6 +23,8 @@
23#include "config.h" 23#include "config.h"
24#endif /* HAVE_CONFIG_H */ 24#endif /* HAVE_CONFIG_H */
25 25
26#include "toxav.h"
27
26#include "msi.h" 28#include "msi.h"
27#include "rtp.h" 29#include "rtp.h"
28 30
diff --git a/toxav/toxav_old.c b/toxav/toxav_old.c
index b132080b..a344455d 100644
--- a/toxav/toxav_old.c
+++ b/toxav/toxav_old.c
@@ -22,9 +22,10 @@
22 * This file contains the group chats code for the backwards compatibility. 22 * This file contains the group chats code for the backwards compatibility.
23 */ 23 */
24 24
25#include "group.h"
26#include "toxav.h" 25#include "toxav.h"
27 26
27#include "group.h"
28
28/* Create a new toxav group. 29/* Create a new toxav group.
29 * 30 *
30 * return group number on success. 31 * return group number on success.
diff --git a/toxav/video.c b/toxav/video.c
index 195ff041..9aba27ed 100644
--- a/toxav/video.c
+++ b/toxav/video.c
@@ -23,16 +23,17 @@
23#include "config.h" 23#include "config.h"
24#endif /* HAVE_CONFIG_H */ 24#endif /* HAVE_CONFIG_H */
25 25
26#include <assert.h> 26#include "video.h"
27#include <stdlib.h>
28 27
29#include "msi.h" 28#include "msi.h"
30#include "rtp.h" 29#include "rtp.h"
31#include "video.h"
32 30
33#include "../toxcore/logger.h" 31#include "../toxcore/logger.h"
34#include "../toxcore/network.h" 32#include "../toxcore/network.h"
35 33
34#include <assert.h>
35#include <stdlib.h>
36
36#define MAX_DECODE_TIME_US 0 /* Good quality encode. */ 37#define MAX_DECODE_TIME_US 0 /* Good quality encode. */
37#define VIDEO_DECODE_BUFFER_SIZE 20 38#define VIDEO_DECODE_BUFFER_SIZE 20
38 39
diff --git a/toxav/video.h b/toxav/video.h
index 6aeeaef6..335240c7 100644
--- a/toxav/video.h
+++ b/toxav/video.h
@@ -22,6 +22,11 @@
22#ifndef VIDEO_H 22#ifndef VIDEO_H
23#define VIDEO_H 23#define VIDEO_H
24 24
25#include "toxav.h"
26
27#include "../toxcore/logger.h"
28#include "../toxcore/util.h"
29
25#include <vpx/vpx_decoder.h> 30#include <vpx/vpx_decoder.h>
26#include <vpx/vpx_encoder.h> 31#include <vpx/vpx_encoder.h>
27#include <vpx/vpx_image.h> 32#include <vpx/vpx_image.h>
@@ -33,11 +38,6 @@
33 38
34#include <pthread.h> 39#include <pthread.h>
35 40
36#include "toxav.h"
37
38#include "../toxcore/logger.h"
39#include "../toxcore/util.h"
40
41struct RTPMessage; 41struct RTPMessage;
42 42
43typedef struct VCSession_s { 43typedef struct VCSession_s {
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
39static void set_friend_status(Messenger *m, int32_t friendnumber, uint8_t status, void *userdata); 40static void set_friend_status(Messenger *m, int32_t friendnumber, uint8_t status, void *userdata);
40static int write_cryptpacket_id(const Messenger *m, int32_t friendnumber, uint8_t packet_id, const uint8_t *data, 41static 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. */
33void set_nospam(Friend_Requests *fr, uint32_t num) 33void 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
34static uint8_t crypt_connection_id_not_valid(const Net_Crypto *c, int crypt_connection_id) 37static 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
48static const char *inet_ntop(sa_family_t family, void *addr, char *buf, size_t bufsize) 48static 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
33static void clear_entry(Ping_Array *array, uint32_t index) 34static 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
29typedef 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
35typedef 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
32typedef struct Messenger Tox; 29typedef 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 */