aboutsummaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2007-08-18 01:38:11 +0000
committerNick Mathewson <nickm@torproject.org>2007-08-18 01:38:11 +0000
commita237f25f9a12dc1220b06438d812dd639bf53e6e (patch)
treeee2d1963d50f7a01f0da0dd25e980d5fbfcd83ba /src/common
parent50c0e6b37fcca5c68abfd2d3376cb359b4c4692b (diff)
downloadtor-a237f25f9a12dc1220b06438d812dd639bf53e6e.tar
tor-a237f25f9a12dc1220b06438d812dd639bf53e6e.tar.gz
r14651@catbus: nickm | 2007-08-17 21:37:03 -0400
Another attempt to confirm to msvc for bug 482. svn:r11162
Diffstat (limited to 'src/common')
-rw-r--r--src/common/compat.h19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/common/compat.h b/src/common/compat.h
index 6cf006bb3..113399719 100644
--- a/src/common/compat.h
+++ b/src/common/compat.h
@@ -338,6 +338,15 @@ 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 const struct in6_addr *
+IN6_ADDRESS(const tor_addr_t *a)
+{
+ return &a->sa6.sin6_addr;
+}
+
+#define IN6_ADDRESS16(x) S6_ADDR16(*IN6_ADDRESS(x))
+#define IN6_ADDRESS32(x) S6_ADDR32(*IN6_ADDRESS(x))
+
static INLINE uint32_t
IPV4IP(const tor_addr_t *a)
{
@@ -351,7 +360,7 @@ static INLINE uint32_t IPV4IPh(const tor_addr_t *a)
static INLINE uint32_t
IPV4MAPh(const tor_addr_t *a)
{
- return ntohl(a->sa6.sin6_addr.s6_addr32[3]);
+ return ntohl(IN6_ADDRESS32(a)[3]);
}
static INLINE uint16_t
IN_FAMILY(const tor_addr_t *a)
@@ -363,11 +372,6 @@ IN4_ADDRESS(const tor_addr_t *a)
{
return &a->sa.sin_addr;
}
-static INLINE const struct in6_addr *
-IN6_ADDRESS(const tor_addr_t *a)
-{
- return &a->sa6.sin6_addr;
-}
static INLINE uint16_t
IN_PORT(const tor_addr_t *a)
{
@@ -377,9 +381,6 @@ IN_PORT(const tor_addr_t *a)
return a->sa6.sin6_port;
}
-#define IN6_ADDRESS16(x) S6_ADDR16(*IN6_ADDRESS(x))
-#define IN6_ADDRESS32(x) S6_ADDR32(*IN6_ADDRESS(x))
-
#define INET_NTOA_BUF_LEN 16 /* 255.255.255.255 */
#define TOR_ADDR_BUF_LEN 46 /* ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255 */