[Orxonox-commit 2692] r7397 - in code/branches/ipv6/src/external/enet: . include/enet

adrfried at orxonox.net adrfried at orxonox.net
Fri Sep 10 14:30:21 CEST 2010


Author: adrfried
Date: 2010-09-10 14:30:21 +0200 (Fri, 10 Sep 2010)
New Revision: 7397

Modified:
   code/branches/ipv6/src/external/enet/host.c
   code/branches/ipv6/src/external/enet/include/enet/enet.h
   code/branches/ipv6/src/external/enet/protocol.c
   code/branches/ipv6/src/external/enet/unix.c
   code/branches/ipv6/src/external/enet/win32.c
Log:
add _INIT macros for the address variables

Modified: code/branches/ipv6/src/external/enet/host.c
===================================================================
--- code/branches/ipv6/src/external/enet/host.c	2010-09-10 01:14:40 UTC (rev 7396)
+++ code/branches/ipv6/src/external/enet/host.c	2010-09-10 12:30:21 UTC (rev 7397)
@@ -14,6 +14,9 @@
     if (socket == ENET_SOCKET_NULL)
         return ENET_SOCKET_NULL;
 
+    /* This is not a conditional bind anymore,
+     * because WSARecvFrom returned WSAEINVAL on the IPv6 socket.
+     * TODO: Check for it's consequences. */
     if (enet_socket_bind (socket, address, family) < 0)
     {
         enet_socket_destroy (socket);

Modified: code/branches/ipv6/src/external/enet/include/enet/enet.h
===================================================================
--- code/branches/ipv6/src/external/enet/include/enet/enet.h	2010-09-10 01:14:40 UTC (rev 7396)
+++ code/branches/ipv6/src/external/enet/include/enet/enet.h	2010-09-10 12:30:21 UTC (rev 7397)
@@ -58,11 +58,16 @@
    enet_uint8 addr[16];
 } ENetHostAddress;
 
-ENET_API const ENetHostAddress ENET_HOST_ANY;          /**< specifies the default server host */
-ENET_API const ENetHostAddress ENET_IPV4MAPPED_PREFIX; /**< specifies the IPv4-mapped IPv6 prefix */
-ENET_API const ENetHostAddress ENET_HOST_BROADCAST;    /**< specifies a IPv4 subnet-wide broadcast */
-#define ENET_IPV4MAPPED_PREFIX_LEN 12                  /**< specifies the length of the IPv4-mapped IPv6 prefix */
-#define ENET_PORT_ANY 0                                /**< specifies that a port should be automatically chosen */
+#define ENET_HOST_ANY_INIT { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } }                         /**< specifies the default server host (macro for variable initialization) */
+ENET_API const ENetHostAddress ENET_HOST_ANY;                                              /**< specifies the default server host (global constant variable) */
+#define ENET_IPV4MAPPED_PREFIX_INIT { { 0,0,0,0,0,0,0,0,0,0,0xff,0xff,0,0,0,0 } }          /**< specifies the IPv4-mapped IPv6 prefix (macro for variable initialization) */
+ENET_API const ENetHostAddress ENET_IPV4MAPPED_PREFIX;                                     /**< specifies the IPv4-mapped IPv6 prefix (global constant variable) */
+#define ENET_HOST_BROADCAST_INIT { { 0,0,0,0,0,0,0,0,0,0,0xff,0xff,0xff,0xff,0xff,0xff } } /**< specifies a IPv4 subnet-wide broadcast (macro for variable initialization) */
+ENET_API const ENetHostAddress ENET_HOST_BROADCAST;                                        /**< specifies a IPv4 subnet-wide broadcast (global constant variable) */
+enum {
+    ENET_IPV4MAPPED_PREFIX_LEN = 12,                                                       /**< specifies the length of the IPv4-mapped IPv6 prefix */
+    ENET_PORT_ANY              = 0                                                         /**< specifies that a port should be automatically chosen */
+};
 
 /**
  * Portable internet address structure. 

Modified: code/branches/ipv6/src/external/enet/protocol.c
===================================================================
--- code/branches/ipv6/src/external/enet/protocol.c	2010-09-10 01:14:40 UTC (rev 7396)
+++ code/branches/ipv6/src/external/enet/protocol.c	2010-09-10 12:30:21 UTC (rev 7397)
@@ -9,9 +9,9 @@
 #include "enet/time.h"
 #include "enet/enet.h"
 
-const ENetHostAddress ENET_HOST_ANY = { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } };
-const ENetHostAddress ENET_IPV4MAPPED_PREFIX = { { 0,0,0,0,0,0,0,0,0,0, 0xff, 0xff, 0,0,0,0 } };
-const ENetHostAddress ENET_HOST_BROADCAST = { { 0,0,0,0,0,0,0,0,0,0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff } };
+const ENetHostAddress ENET_HOST_ANY = ENET_HOST_ANY_INIT;
+const ENetHostAddress ENET_IPV4MAPPED_PREFIX = ENET_IPV4MAPPED_PREFIX_INIT;
+const ENetHostAddress ENET_HOST_BROADCAST = ENET_HOST_BROADCAST_INIT;
 
 static size_t commandSizes [ENET_PROTOCOL_COMMAND_COUNT] =
 {
@@ -32,7 +32,7 @@
 ENetHostAddress
 enet_address_map4 (enet_uint32 address)
 {
-    ENetHostAddress addr = ENET_IPV4MAPPED_PREFIX;
+    ENetHostAddress addr = ENET_IPV4MAPPED_PREFIX_INIT;
     ((enet_uint32 *)addr.addr)[3] = address;
     return addr;
 }

Modified: code/branches/ipv6/src/external/enet/unix.c
===================================================================
--- code/branches/ipv6/src/external/enet/unix.c	2010-09-10 01:14:40 UTC (rev 7396)
+++ code/branches/ipv6/src/external/enet/unix.c	2010-09-10 12:30:21 UTC (rev 7397)
@@ -199,10 +199,7 @@
     }
     else
     {
-        ENetAddress address_;
-        address_.host = ENET_HOST_ANY;
-        address_.scopeID = 0;
-        address_.port = 0;
+        ENetAddress address_ = { ENET_HOST_ANY_INIT, 0, 0 };
         enet_address_set_sin((struct sockaddr *) & sin, & address_, family);
     }
 

Modified: code/branches/ipv6/src/external/enet/win32.c
===================================================================
--- code/branches/ipv6/src/external/enet/win32.c	2010-09-10 01:14:40 UTC (rev 7396)
+++ code/branches/ipv6/src/external/enet/win32.c	2010-09-10 12:30:21 UTC (rev 7397)
@@ -180,10 +180,7 @@
     }
     else
     {
-        ENetAddress address_;
-        address_.host = ENET_HOST_ANY;
-        address_.scopeID = 0;
-        address_.port = 0;
+        ENetAddress address_ = { ENET_HOST_ANY_INIT, 0, 0 };
         enet_address_set_sin((SOCKADDR *) & sin, & address_, family);
     }
 




More information about the Orxonox-commit mailing list