[or-cvs] r11011: Rename IN4_ADDR and IN6_ADDR to try to avoid conflicting wit (in tor/trunk: . src/common src/or)
nickm at seul.org
nickm at seul.org
Wed Aug 1 15:57:35 UTC 2007
Author: nickm
Date: 2007-08-01 11:57:34 -0400 (Wed, 01 Aug 2007)
New Revision: 11011
Modified:
tor/trunk/
tor/trunk/ChangeLog
tor/trunk/src/common/compat.h
tor/trunk/src/common/util.c
tor/trunk/src/or/test.c
Log:
r13872 at Kushana: nickm | 2007-07-31 08:27:54 -0700
Rename IN4_ADDR and IN6_ADDR to try to avoid conflicting with Windows definitions. This may fix the windows build.
Property changes on: tor/trunk
___________________________________________________________________
svk:merge ticket from /tor/trunk [r13872] on c95137ef-5f19-0410-b913-86e773d04f59
Modified: tor/trunk/ChangeLog
===================================================================
--- tor/trunk/ChangeLog 2007-08-01 15:57:07 UTC (rev 11010)
+++ tor/trunk/ChangeLog 2007-08-01 15:57:34 UTC (rev 11011)
@@ -1,4 +1,8 @@
Changes in version 0.2.0.4-alpha - 2007-??-??
+ o Major bugfixes (compilation):
+ - Fix win32 compilation: apparently IN_ADDR and IN6_ADDR are already
+ defined there.
+
o Minor features (performance):
- Be even more aggressive about releasing RAM from small
empty buffers. Thanks to our free-list code, this shouldn't be too
Modified: tor/trunk/src/common/compat.h
===================================================================
--- tor/trunk/src/common/compat.h 2007-08-01 15:57:07 UTC (rev 11010)
+++ tor/trunk/src/common/compat.h 2007-08-01 15:57:34 UTC (rev 11011)
@@ -319,8 +319,8 @@
static INLINE uint32_t IPV4IPh(const tor_addr_t *a);
static INLINE uint32_t IPV4MAPh(const tor_addr_t *a);
static INLINE uint16_t IN_FAMILY(const tor_addr_t *a);
-static INLINE const struct in_addr *IN4_ADDR(const tor_addr_t *a);
-static INLINE const struct in6_addr *IN6_ADDR(const tor_addr_t *a);
+static INLINE const struct in_addr *IN4_ADDRESS(const tor_addr_t *a);
+static INLINE const struct in6_addr *IN6_ADDRESS(const tor_addr_t *a);
static INLINE uint16_t IN_PORT(const tor_addr_t *a);
static INLINE uint32_t
@@ -344,12 +344,12 @@
return a->sa.sin_family;
}
static INLINE const struct in_addr *
-IN4_ADDR(const tor_addr_t *a)
+IN4_ADDRESS(const tor_addr_t *a)
{
return &a->sa.sin_addr;
}
static INLINE const struct in6_addr *
-IN6_ADDR(const tor_addr_t *a)
+IN6_ADDRESS(const tor_addr_t *a)
{
return &a->sa6.sin6_addr;
}
Modified: tor/trunk/src/common/util.c
===================================================================
--- tor/trunk/src/common/util.c 2007-08-01 15:57:07 UTC (rev 11010)
+++ tor/trunk/src/common/util.c 2007-08-01 15:57:34 UTC (rev 11011)
@@ -1872,15 +1872,15 @@
} else if (v_family == AF_INET6) {
if (tor_addr_is_v4(addr)) { /* v4-mapped */
v_family = AF_INET;
- iph4 = ntohl(IN6_ADDR(addr)->s6_addr32[3]);
+ iph4 = ntohl(IN6_ADDRESS(addr)->s6_addr32[3]);
}
}
if (v_family == AF_INET6) {
- iph6[0] = ntohl(IN6_ADDR(addr)->s6_addr32[0]);
- iph6[1] = ntohl(IN6_ADDR(addr)->s6_addr32[1]);
- iph6[2] = ntohl(IN6_ADDR(addr)->s6_addr32[2]);
- iph6[3] = ntohl(IN6_ADDR(addr)->s6_addr32[3]);
+ iph6[0] = ntohl(IN6_ADDRESS(addr)->s6_addr32[0]);
+ iph6[1] = ntohl(IN6_ADDRESS(addr)->s6_addr32[1]);
+ iph6[2] = ntohl(IN6_ADDRESS(addr)->s6_addr32[2]);
+ iph6[3] = ntohl(IN6_ADDRESS(addr)->s6_addr32[3]);
if (for_listening && !iph6[0] && !iph6[1] && !iph6[2] && !iph6[3]) /* :: */
return 0;
@@ -2278,14 +2278,14 @@
#ifdef ALWAYS_V6_MAP
if (v_family == AF_INET) {
v_family = AF_INET6;
- IN_ADDR6(addr_out).s6_addr32[3] = IN6_ADDR(addr_out).s_addr;
- memset(&IN6_ADDR(addr_out), 0, 10);
+ IN_ADDR6(addr_out).s6_addr32[3] = IN6_ADDRESS(addr_out).s_addr;
+ memset(&IN6_ADDRESS(addr_out), 0, 10);
IN_ADDR6(addr_out).s6_addr16[5] = 0xffff;
}
#else
if (v_family == AF_INET6 && v4map) {
v_family = AF_INET;
- IN4_ADDR(addr_out).s_addr = IN6_ADDR(addr_out).s6_addr32[3];
+ IN4_ADDRESS((addr_out).s_addr = IN6_ADDRESS(addr_out).s6_addr32[3];
}
#endif
*/
@@ -2392,9 +2392,9 @@
return 1;
if (IN_FAMILY(addr) == AF_INET6) { /* First two don't need to be ordered */
- if ((IN6_ADDR(addr)->s6_addr32[0] == 0) &&
- (IN6_ADDR(addr)->s6_addr32[1] == 0) &&
- (ntohl(IN6_ADDR(addr)->s6_addr32[2]) == 0x0000ffffu))
+ if ((IN6_ADDRESS(addr)->s6_addr32[0] == 0) &&
+ (IN6_ADDRESS(addr)->s6_addr32[1] == 0) &&
+ (ntohl(IN6_ADDRESS(addr)->s6_addr32[2]) == 0x0000ffffu))
return 1;
}
@@ -2411,14 +2411,12 @@
switch (IN_FAMILY(addr)) {
case AF_INET6:
- if (!IN6_ADDR(addr)->s6_addr32[0] && !IN6_ADDR(addr)->s6_addr32[1] &&
- !IN6_ADDR(addr)->s6_addr32[2] && !IN6_ADDR(addr)->s6_addr32[3])
- return 1;
- return 0;
+ return (!IN6_ADDRESS(addr)->s6_addr32[0] &&
+ !IN6_ADDRESS(addr)->s6_addr32[1] &&
+ !IN6_ADDRESS(addr)->s6_addr32[2] &&
+ !IN6_ADDRESS(addr)->s6_addr32[3]);
case AF_INET:
- if (!IN4_ADDR(addr)->s_addr)
- return 1;
- return 0;
+ return (!IN4_ADDRESS(addr)->s_addr);
default:
return 1;
}
@@ -2538,8 +2536,8 @@
return 1;
return 0;
} else if (v_family[0] == AF_INET6) { /* Real IPv6 */
- const uint32_t *a1 = IN6_ADDR(addr1)->s6_addr32;
- const uint32_t *a2 = IN6_ADDR(addr2)->s6_addr32;
+ const uint32_t *a1 = IN6_ADDRESS(addr1)->s6_addr32;
+ const uint32_t *a2 = IN6_ADDRESS(addr2)->s6_addr32;
for (idx = 0; idx < 4; ++idx) {
uint32_t masked_a = ntohl(a1[idx]);
uint32_t masked_b = ntohl(a2[idx]);
@@ -2590,9 +2588,9 @@
tor_assert(addr && dest);
if (IN_FAMILY(addr) == AF_INET) {
- return tor_inet_ntop(AF_INET, IN4_ADDR(addr), dest, len);
+ return tor_inet_ntop(AF_INET, IN4_ADDRESS(addr), dest, len);
} else if (IN_FAMILY(addr) == AF_INET6) {
- return tor_inet_ntop(AF_INET6, IN6_ADDR(addr), dest, len);
+ return tor_inet_ntop(AF_INET6, IN6_ADDRESS(addr), dest, len);
} else {
return NULL;
}
Modified: tor/trunk/src/or/test.c
===================================================================
--- tor/trunk/src/or/test.c 2007-08-01 15:57:07 UTC (rev 11010)
+++ tor/trunk/src/or/test.c 2007-08-01 15:57:34 UTC (rev 11011)
@@ -1069,10 +1069,10 @@
* conventions of the other test macros. */
#define test_addr_parse_check(ip1, ip2, ip3, ip4, mm, pt1, pt2) STMT_BEGIN \
test_assert(r>=0); \
- test_eq(htonl(ip1), IN6_ADDR(&t1)->s6_addr32[0]); \
- test_eq(htonl(ip2), IN6_ADDR(&t1)->s6_addr32[1]); \
- test_eq(htonl(ip3), IN6_ADDR(&t1)->s6_addr32[2]); \
- test_eq(htonl(ip4), IN6_ADDR(&t1)->s6_addr32[3]); \
+ test_eq(htonl(ip1), IN6_ADDRESS(&t1)->s6_addr32[0]); \
+ test_eq(htonl(ip2), IN6_ADDRESS(&t1)->s6_addr32[1]); \
+ test_eq(htonl(ip3), IN6_ADDRESS(&t1)->s6_addr32[2]); \
+ test_eq(htonl(ip4), IN6_ADDRESS(&t1)->s6_addr32[3]); \
test_eq(mask, mm); \
test_eq(port1, pt1); \
test_eq(port2, pt2); \
More information about the tor-commits
mailing list