From b9306d6d069b9e9b53fcd392e3d1b4f357a8cbcc Mon Sep 17 00:00:00 2001 From: BtbN Date: Fri, 20 Sep 2013 23:09:40 +0100 Subject: [PATCH] Fix compilation on windows for ipv6 code --- toxcore/network.c | 6 +++++- toxcore/network.h | 9 +++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/toxcore/network.c b/toxcore/network.c index 49e1726c..af9e8cdd 100644 --- a/toxcore/network.c +++ b/toxcore/network.c @@ -28,6 +28,10 @@ #include "network.h" #include "util.h" +#ifndef IPV6_V6ONLY +#define IPV6_V6ONLY 27 +#endif + /* return current UNIX time in microseconds (us). */ uint64_t current_time(void) { @@ -407,7 +411,7 @@ Networking_Core *new_networking(IP ip, uint16_t port) #ifdef LOGGING res = #endif - setsockopt(temp->sock, IPPROTO_IPV6, IPV6_ADD_MEMBERSHIP, &mreq, sizeof(mreq)); + setsockopt(temp->sock, IPPROTO_IPV6, IPV6_ADD_MEMBERSHIP, (char*)&mreq, sizeof(mreq)); #ifdef LOGGING if (res < 0) { diff --git a/toxcore/network.h b/toxcore/network.h index 4432baed..f6256ab4 100644 --- a/toxcore/network.h +++ b/toxcore/network.h @@ -40,6 +40,15 @@ #include typedef unsigned int sock_t; +typedef unsigned int sa_family_t; + +#ifndef IN6_ARE_ADDR_EQUAL +#define IN6_ARE_ADDR_EQUAL(a,b) \ + ((((__const uint32_t *) (a))[0] == ((__const uint32_t *) (b))[0]) \ + && (((__const uint32_t *) (a))[1] == ((__const uint32_t *) (b))[1]) \ + && (((__const uint32_t *) (a))[2] == ((__const uint32_t *) (b))[2]) \ + && (((__const uint32_t *) (a))[3] == ((__const uint32_t *) (b))[3])) +#endif #else // Linux includes