diff options
author | Coren[m] <Break@Ocean> | 2013-10-20 16:56:12 +0200 |
---|---|---|
committer | Coren[m] <Break@Ocean> | 2013-10-20 16:56:12 +0200 |
commit | a0f08839bd134f3f964a6cccf1243cd42f15d4e5 (patch) | |
tree | a313feee4c0d2a251cb460b9afe3766ca2422d5f /toxcore/tox.h | |
parent | 8abad7bc822a548d4f6e73203e8d4f640c1217ae (diff) |
Main: Eliminate TOX_ENABLE_IPV6 (then always on), CLIENT_ONETOONE_IP (then always off).
Additionally (besides cleanups):
network.h/tox.h:
- WIN32: fix a strange sa_family_t definition
- WIN32: define EWOULDBLOCK to WSAEWOULDBLOCK
- WIN32: kill macro for an existing function (IN6_ADDR_EQUAL)
network.c:
- use EWOULDBLOCK instead of EAGAIN (same value, but EWOULDBLOCK is more "popular")
- new_networking(): only try to enable IPv4-in-IPv6 if it's not already enabled per default
- inet_ntop()/inet_pton(): WIN32: remove partial initializers in favor of a simple memset()
- ip_equal(): WIN32: use an existing function
- logging: networking_wait_execute(): only dump result if not timeout
- logging: loglogdata(): kill an unused variable
LAN_discovery.c:
- send_broadcasts(): re-enabled, can only support IPv4 by principle, split into fetch_broadcast_info() (to fetch the addresses once) and send_broadcasts() (actual sending)
DHT.c:
- DHT_load_state_callback(): enclosed a fprintf(stderr, ...) into #ifdef DEBUG
Lossless_UDP.c:
- change_handshake(): harden against strange sa_family_t definitions
Messenger.c:
- logging: fix ID to string conversion
util.c:
- logging: eliminate a signed-warning
Diffstat (limited to 'toxcore/tox.h')
-rw-r--r-- | toxcore/tox.h | 31 |
1 files changed, 6 insertions, 25 deletions
diff --git a/toxcore/tox.h b/toxcore/tox.h index 39832073..bcc89ce1 100644 --- a/toxcore/tox.h +++ b/toxcore/tox.h | |||
@@ -36,7 +36,9 @@ | |||
36 | #include <windows.h> | 36 | #include <windows.h> |
37 | #include <ws2tcpip.h> | 37 | #include <ws2tcpip.h> |
38 | 38 | ||
39 | typedef INT sa_family_t; | 39 | /* sa_family_t is the sockaddr_in / sockaddr_in6 family field */ |
40 | typedef short sa_family_t; | ||
41 | |||
40 | #ifndef true | 42 | #ifndef true |
41 | #define true 1 | 43 | #define true 1 |
42 | #endif | 44 | #endif |
@@ -69,7 +71,6 @@ typedef union { | |||
69 | uint32_t i; | 71 | uint32_t i; |
70 | } tox_IP4; | 72 | } tox_IP4; |
71 | 73 | ||
72 | |||
73 | typedef union { | 74 | typedef union { |
74 | uint8_t uint8[16]; | 75 | uint8_t uint8[16]; |
75 | uint16_t uint16[8]; | 76 | uint16_t uint16[8]; |
@@ -83,36 +84,16 @@ typedef struct { | |||
83 | tox_IP4 ip4; | 84 | tox_IP4 ip4; |
84 | tox_IP6 ip6; | 85 | tox_IP6 ip6; |
85 | }; | 86 | }; |
86 | } tox_IPAny; | 87 | } tox_IP; |
87 | |||
88 | typedef union { | ||
89 | struct { | ||
90 | tox_IP4 ip; | ||
91 | uint16_t port; | ||
92 | /* Not used for anything right now. */ | ||
93 | uint16_t padding; | ||
94 | }; | ||
95 | uint8_t uint8[8]; | ||
96 | } tox_IP4_Port; | ||
97 | 88 | ||
98 | /* will replace IP_Port as soon as the complete infrastructure is in place | 89 | /* will replace IP_Port as soon as the complete infrastructure is in place |
99 | * removed the unused union and padding also */ | 90 | * removed the unused union and padding also */ |
100 | typedef struct { | 91 | typedef struct { |
101 | tox_IPAny ip; | 92 | tox_IP ip; |
102 | uint16_t port; | 93 | uint16_t port; |
103 | } tox_IPAny_Port; | 94 | } tox_IP_Port; |
104 | 95 | ||
105 | /* #undef TOX_ENABLE_IPV6 */ | ||
106 | #define TOX_ENABLE_IPV6 | ||
107 | #ifdef TOX_ENABLE_IPV6 | ||
108 | #define TOX_ENABLE_IPV6_DEFAULT 1 | 96 | #define TOX_ENABLE_IPV6_DEFAULT 1 |
109 | typedef tox_IPAny tox_IP; | ||
110 | typedef tox_IPAny_Port tox_IP_Port; | ||
111 | #else | ||
112 | #define TOX_ENABLE_IPV6_DEFAULT 0 | ||
113 | typedef tox_IP4 tox_IP; | ||
114 | typedef tox_IP4_Port tox_IP_Port; | ||
115 | #endif | ||
116 | 97 | ||
117 | 98 | ||
118 | /* Errors for m_addfriend | 99 | /* Errors for m_addfriend |