Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Sep 9, 2010, 4:30:50 PM (14 years ago)
Author:
adrfried
Message:

IPv6 for Windows

I have not tested this, please test this and report issues to me.

Location:
code/branches/ipv6/src/external/enet/patches
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • code/branches/ipv6/src/external/enet/patches/0001-use-getaddrinfo-for-lookup-in-unix.c.patch

    r7378 r7390  
    22From: Adrian Friedli <adi@koalatux.ch>
    33Date: Thu, 2 Sep 2010 14:26:42 +0200
    4 Subject: [PATCH 1/4] use getaddrinfo for lookup in unix.c
     4Subject: [PATCH 1/5] use getaddrinfo for lookup in unix.c
    55
    66---
  • code/branches/ipv6/src/external/enet/patches/0002-basic-IPv6-support-on-Linux-systems.patch

    r7378 r7390  
    22From: Adrian Friedli <adi@koalatux.ch>
    33Date: Thu, 2 Sep 2010 14:27:07 +0200
    4 Subject: [PATCH 2/4] basic IPv6 support on Linux systems
     4Subject: [PATCH 2/5] basic IPv6 support on Linux systems
    55
    66this uses IPv4-mapped IPv6 addresses
  • code/branches/ipv6/src/external/enet/patches/0003-using-address-family-in-functions.patch

    r7389 r7390  
    1 From af3c0910bd25d73b1a3c06bbfa4e0a3c6b96ddc5 Mon Sep 17 00:00:00 2001
     1From b26e4ef3fa9c0139fc2ec086d2243b809365d683 Mon Sep 17 00:00:00 2001
    22From: Adrian Friedli <adi@koalatux.ch>
    33Date: Mon, 6 Sep 2010 14:58:50 +0200
    4 Subject: [PATCH 3/4] using address family in functions
     4Subject: [PATCH 3/5] using address family in functions
    55
    66---
     
    88 include/enet/enet.h |   22 +++++++++---
    99 protocol.c          |    5 ++-
    10  unix.c              |   87 ++++++++++++++++++++++++++++++++------------------
    11  4 files changed, 77 insertions(+), 41 deletions(-)
     10 unix.c              |   86 ++++++++++++++++++++++++++++++++------------------
     11 4 files changed, 76 insertions(+), 41 deletions(-)
    1212
    1313diff --git a/host.c b/host.c
     
    9191 
    9292diff --git a/unix.c b/unix.c
    93 index de032bb..13a24d8 100644
     93index de032bb..475c6e3 100644
    9494--- a/unix.c
    9595+++ b/unix.c
    96 @@ -71,7 +71,28 @@ enet_time_set (enet_uint32 newTimeBase)
     96@@ -71,7 +71,27 @@ enet_time_set (enet_uint32 newTimeBase)
    9797     timeBase = timeVal.tv_sec * 1000 + timeVal.tv_usec / 1000 - newTimeBase;
    9898 }
     
    119119+}
    120120+
    121 +
    122121+static ENetAddressFamily
    123122 enet_address_set_address (ENetAddress * address, const struct sockaddr * sin)
    124123 {
    125124     memset (address, 0, sizeof (ENetAddress));
    126 @@ -80,32 +101,31 @@ enet_address_set_address (ENetAddress * address, const struct sockaddr * sin)
     125@@ -80,32 +100,31 @@ enet_address_set_address (ENetAddress * address, const struct sockaddr * sin)
    127126         address -> host = enet_address_map4 ((((struct sockaddr_in *) sin) -> sin_addr.s_addr));
    128127         //address -> scopeID = 0;
     
    164163         ((struct sockaddr_in6 *) sin) -> sin6_addr = * (struct in6_addr *) & address -> host;
    165164         ((struct sockaddr_in6 *) sin) -> sin6_scope_id = address -> scopeID;
    166 @@ -132,7 +152,7 @@ enet_address_set_host (ENetAddress * address, const char * name)
     165@@ -132,7 +151,7 @@ enet_address_set_host (ENetAddress * address, const char * name)
    167166 
    168167     for (res = result; res != NULL; res = res -> ai_next)
     
    173172     }
    174173 
    175 @@ -147,9 +167,9 @@ static int
     174@@ -147,9 +166,9 @@ static int
    176175 enet_address_get_host_x (const ENetAddress * address, char * name, size_t nameLength, int flags)
    177176 {
     
    185184 
    186185     return 0;
    187 @@ -168,21 +188,21 @@ enet_address_get_host (const ENetAddress * address, char * name, size_t nameLeng
     186@@ -168,21 +187,21 @@ enet_address_get_host (const ENetAddress * address, char * name, size_t nameLeng
    188187 }
    189188 
     
    211210 
    212211 int
    213 @@ -192,13 +212,16 @@ enet_socket_listen (ENetSocket socket, int backlog)
     212@@ -192,13 +211,16 @@ enet_socket_listen (ENetSocket socket, int backlog)
    214213 }
    215214 
     
    232231 
    233232     return sock;
    234 @@ -241,25 +264,25 @@ enet_socket_set_option (ENetSocket socket, ENetSocketOption option, int value)
     233@@ -241,25 +263,25 @@ enet_socket_set_option (ENetSocket socket, ENetSocketOption option, int value)
    235234 }
    236235 
     
    264263       return ENET_SOCKET_NULL;
    265264 
    266 @@ -281,7 +304,8 @@ int
     265@@ -281,7 +303,8 @@ int
    267266 enet_socket_send (ENetSocket socket,
    268267                   const ENetAddress * address,
     
    274273     struct msghdr msgHdr;
    275274     struct sockaddr_storage sin;
    276 @@ -291,9 +315,9 @@ enet_socket_send (ENetSocket socket,
     275@@ -291,9 +314,9 @@ enet_socket_send (ENetSocket socket,
    277276 
    278277     if (address != NULL)
     
    286285 
    287286     msgHdr.msg_iov = (struct iovec *) buffers;
    288 @@ -316,7 +340,8 @@ int
     287@@ -316,7 +339,8 @@ int
    289288 enet_socket_receive (ENetSocket socket,
    290289                      ENetAddress * address,
     
    296295     struct msghdr msgHdr;
    297296     struct sockaddr_storage sin;
    298 @@ -327,7 +352,7 @@ enet_socket_receive (ENetSocket socket,
     297@@ -327,7 +351,7 @@ enet_socket_receive (ENetSocket socket,
    299298     if (address != NULL)
    300299     {
  • code/branches/ipv6/src/external/enet/patches/0004-using-two-separate-sockets-for-IPv4-and-IPv6.patch

    r7389 r7390  
    1 From 9801a6bcd072870248a6b07245fc09a9492f8f51 Mon Sep 17 00:00:00 2001
     1From 73fa28a84ce456561d3912578121a30bc8263c50 Mon Sep 17 00:00:00 2001
    22From: Adrian Friedli <adi@koalatux.ch>
    33Date: Wed, 8 Sep 2010 12:50:04 +0200
    4 Subject: [PATCH 4/4] using two separate sockets for IPv4 and IPv6
     4Subject: [PATCH 4/5] using two separate sockets for IPv4 and IPv6
    55
    66---
    7  host.c              |   53 +++++++++++++++++++++++++++++++++++++-------------
    8  include/enet/enet.h |   11 ++++++++-
    9  protocol.c          |   47 +++++++++++++++++++++++++++++++++++++++-----
    10  unix.c              |   47 ++++++++++++++++++++++++++++++++------------
    11  4 files changed, 123 insertions(+), 35 deletions(-)
     7 host.c              |   53 +++++++++++++++++++++++++++---------
     8 include/enet/enet.h |   11 ++++++-
     9 protocol.c          |   47 ++++++++++++++++++++++++++++----
     10 unix.c              |   74 +++++++++++++++++++++++++++++++++++++-------------
     11 4 files changed, 144 insertions(+), 41 deletions(-)
    1212
    1313diff --git a/host.c b/host.c
     
    233233        host -> serviceTime = enet_time_get ();
    234234diff --git a/unix.c b/unix.c
    235 index 13a24d8..22ffb76 100644
     235index 475c6e3..751cb6f 100644
    236236--- a/unix.c
    237237+++ b/unix.c
    238 @@ -117,7 +117,9 @@ static int
     238@@ -116,7 +116,9 @@ static int
    239239 enet_address_set_sin (struct sockaddr * sin, const ENetAddress * address, ENetAddressFamily family)
    240240 {
     
    247247         ((struct sockaddr_in *) sin) -> sin_family = AF_INET;
    248248         ((struct sockaddr_in *) sin) -> sin_addr = * (struct in_addr *) & address -> host.addr[12];
    249 @@ -219,7 +221,7 @@ enet_socket_create (ENetSocketType type, ENetAddressFamily family)
     249@@ -218,7 +220,7 @@ enet_socket_create (ENetSocketType type, ENetAddressFamily family)
    250250 #ifdef IPV6_V6ONLY
    251251     if (family == ENET_IPV6)
     
    256256     }
    257257 #endif // IPV6_V6ONLY
    258 @@ -393,22 +395,38 @@ enet_socketset_select (ENetSocket maxSocket, ENetSocketSet * readSet, ENetSocket
     258@@ -392,22 +394,38 @@ enet_socketset_select (ENetSocket maxSocket, ENetSocketSet * readSet, ENetSocket
    259259 }
    260260 
     
    263263+enet_socket_wait (ENetSocket socket4, ENetSocket socket6, enet_uint32 * condition, enet_uint32 timeout)
    264264 {
    265 -#ifdef HAS_POLL
     265 #ifdef HAS_POLL
    266266-    struct pollfd pollSocket;
    267 +//#ifdef HAS_POLL
    268267+    struct pollfd pollSocket[2];
    269268     int pollCount;
     
    304303     if (pollCount < 0)
    305304       return -1;
    306 @@ -418,13 +436,15 @@ enet_socket_wait (ENetSocket socket, enet_uint32 * condition, enet_uint32 timeou
     305@@ -417,10 +435,10 @@ enet_socket_wait (ENetSocket socket, enet_uint32 * condition, enet_uint32 timeou
    307306     if (pollCount == 0)
    308307       return 0;
     
    317316 
    318317     return 0;
    319 +/*
    320 +FIXME: implement or remove this
    321  #else
    322      fd_set readSet, writeSet;
    323      struct timeval timeVal;
    324 @@ -460,6 +480,7 @@ enet_socket_wait (ENetSocket socket, enet_uint32 * condition, enet_uint32 timeou
     318@@ -436,12 +454,28 @@ enet_socket_wait (ENetSocket socket, enet_uint32 * condition, enet_uint32 timeou
     319     FD_ZERO (& writeSet);
     320 
     321     if (* condition & ENET_SOCKET_WAIT_SEND)
     322-      FD_SET (socket, & writeSet);
     323+    {
     324+        if (socket4 != ENET_SOCKET_NULL)
     325+            FD_SET (socket4, & writeSet);
     326+        if (socket6 != ENET_SOCKET_NULL)
     327+            FD_SET (socket6, & writeSet);
     328+    }
     329 
     330     if (* condition & ENET_SOCKET_WAIT_RECEIVE)
     331-      FD_SET (socket, & readSet);
     332+    {
     333+        if (socket4 != ENET_SOCKET_NULL)
     334+            FD_SET (socket4, & readSet);
     335+        if (socket6 != ENET_SOCKET_NULL)
     336+            FD_SET (socket6, & readSet);
     337+    }
     338+
     339+    ENetSocket maxSocket = 0;
     340+    if (socket4 != ENET_SOCKET_NULL)
     341+        maxSocket = socket4;
     342+    if (socket6 != ENET_SOCKET_NULL && socket6 > maxSocket)
     343+        maxSocket = socket6;
     344 
     345-    selectCount = select (socket + 1, & readSet, & writeSet, NULL, & timeVal);
     346+    selectCount = select (maxSocket + 1, & readSet, & writeSet, NULL, & timeVal);
     347 
     348     if (selectCount < 0)
     349       return -1;
     350@@ -451,11 +485,13 @@ enet_socket_wait (ENetSocket socket, enet_uint32 * condition, enet_uint32 timeou
     351     if (selectCount == 0)
     352       return 0;
     353 
     354-    if (FD_ISSET (socket, & writeSet))
     355-      * condition |= ENET_SOCKET_WAIT_SEND;
     356+    if ( (socket4 != ENET_SOCKET_NULL && FD_ISSET (socket4, & writeSet)) ||
     357+        (socket6 != ENET_SOCKET_NULL && FD_ISSET (socket6, & writeSet)) )
     358+        * condition |= ENET_SOCKET_WAIT_SEND;
     359 
     360-    if (FD_ISSET (socket, & readSet))
     361-      * condition |= ENET_SOCKET_WAIT_RECEIVE;
     362+    if ( (socket4 != ENET_SOCKET_NULL && FD_ISSET (socket4, & readSet)) ||
     363+        (socket6 != ENET_SOCKET_NULL && FD_ISSET (socket6, & readSet)) )
     364+        * condition |= ENET_SOCKET_WAIT_RECEIVE;
    325365 
    326366     return 0;
    327  #endif
    328 +*/
    329  }
    330  
    331367 #endif
    332368--
Note: See TracChangeset for help on using the changeset viewer.