diff options
Diffstat (limited to 'toxcore/network.h')
-rw-r--r-- | toxcore/network.h | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/toxcore/network.h b/toxcore/network.h index c9fb4637..ffd3d6db 100644 --- a/toxcore/network.h +++ b/toxcore/network.h | |||
@@ -89,7 +89,7 @@ typedef int sock_t; | |||
89 | #endif | 89 | #endif |
90 | 90 | ||
91 | #if defined(__sun__) | 91 | #if defined(__sun__) |
92 | #define __EXTENSIONS__ 1 // SunOS! | 92 | #define __EXTENSIONS__ 1 // SunOS! |
93 | #if defined(__SunOS5_6__) || defined(__SunOS5_7__) || defined(__SunOS5_8__) || defined(__SunOS5_9__) || defined(__SunOS5_10__) | 93 | #if defined(__SunOS5_6__) || defined(__SunOS5_7__) || defined(__SunOS5_8__) || defined(__SunOS5_9__) || defined(__SunOS5_10__) |
94 | //Nothing needed | 94 | //Nothing needed |
95 | #else | 95 | #else |
@@ -192,6 +192,13 @@ typedef struct __attribute__ ((__packed__)) __attribute__((gcc_struct)) | |||
192 | } | 192 | } |
193 | IP_Port; | 193 | IP_Port; |
194 | 194 | ||
195 | |||
196 | #define SIZE_IP4 4 | ||
197 | #define SIZE_IP6 16 | ||
198 | #define SIZE_IP (1 + SIZEOF_IP6) | ||
199 | #define SIZE_PORT 2 | ||
200 | #define SIZE_IPPORT (SIZE_IP + SIZE_PORT) | ||
201 | |||
195 | #define TOX_ENABLE_IPV6_DEFAULT 1 | 202 | #define TOX_ENABLE_IPV6_DEFAULT 1 |
196 | 203 | ||
197 | /* ip_ntoa | 204 | /* ip_ntoa |
@@ -229,6 +236,12 @@ void ip_copy(IP *target, IP *source); | |||
229 | /* copies an ip_port structure */ | 236 | /* copies an ip_port structure */ |
230 | void ipport_copy(IP_Port *target, IP_Port *source); | 237 | void ipport_copy(IP_Port *target, IP_Port *source); |
231 | 238 | ||
239 | |||
240 | void ip_pack(uint8_t *data, IP *source); | ||
241 | void ip_unpack(IP *target, uint8_t *data); | ||
242 | void ipport_pack(uint8_t *data, IP_Port *source); | ||
243 | void ipport_unpack(IP_Port *target, uint8_t *data); | ||
244 | |||
232 | /* | 245 | /* |
233 | * addr_resolve(): | 246 | * addr_resolve(): |
234 | * uses getaddrinfo to resolve an address into an IP address | 247 | * uses getaddrinfo to resolve an address into an IP address |