Merge pull request #593 from BtbN/win_fixes

Fix compilation on windows for ipv6 code
This commit is contained in:
irungentoo 2013-09-20 16:27:24 -07:00
commit 01ec9d6e7b
2 changed files with 14 additions and 1 deletions

View File

@ -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) {

View File

@ -40,6 +40,15 @@
#include <ws2tcpip.h>
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