2 * Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC")
3 * Copyright (C) 1999-2002 Internet Software Consortium.
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
9 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
10 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11 * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
12 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
14 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15 * PERFORMANCE OF THIS SOFTWARE.
18 /* $Id: ipv6.h,v 1.17.12.4 2004/03/09 05:21:09 marka Exp $ */
24 * Also define LWRES_IPV6_H to keep it from being included if liblwres is
25 * being used, or redefinition errors will occur.
27 #define LWRES_IPV6_H 1
34 * IPv6 definitions for systems which do not support IPv6.
40 * No anticipated impact.
46 * No anticipated impact.
57 #include <isc/platform.h>
60 * We probably don't need this on NTP
69 isc_uint8_t _S6_u8[16];
70 isc_uint16_t _S6_u16[8];
71 isc_uint32_t _S6_u32[4];
74 #define s6_addr _S6_un._S6_u8
75 #define s6_addr8 _S6_un._S6_u8
76 #define s6_addr16 _S6_un._S6_u16
77 #define s6_addr32 _S6_un._S6_u32
79 #define IN6ADDR_ANY_INIT {{ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }}
80 #define IN6ADDR_LOOPBACK_INIT {{ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 }}
82 LIBISC_EXTERNAL_DATA extern const struct in6_addr in6addr_any;
83 LIBISC_EXTERNAL_DATA extern const struct in6_addr in6addr_loopback;
86 #ifdef ISC_PLATFORM_HAVESALEN
88 isc_uint8_t sin6_family;
90 isc_uint16_t sin6_family;
92 isc_uint16_t sin6_port;
93 isc_uint32_t sin6_flowinfo;
94 struct in6_addr sin6_addr;
95 isc_uint32_t sin6_scope_id;
98 #ifdef ISC_PLATFORM_HAVESALEN
105 #ifndef IN6_IS_ADDR_UNSPECIFIED
106 #define IN6_IS_ADDR_UNSPECIFIED(a) \
107 (((a)->s6_addr32[0] == 0) && \
108 ((a)->s6_addr32[1] == 0) && \
109 ((a)->s6_addr32[2] == 0) && \
110 ((a)->s6_addr32[3] == 0))
115 #define IN6_IS_ADDR_LOOPBACK(a) \
116 (((a)->s6_addr32[0] == 0) && \
117 ((a)->s6_addr32[1] == 0) && \
118 ((a)->s6_addr32[2] == 0) && \
119 ((a)->s6_addr32[3] == htonl(1)))
124 #define IN6_IS_ADDR_V4COMPAT(a) \
125 (((a)->s6_addr32[0] == 0) && \
126 ((a)->s6_addr32[1] == 0) && \
127 ((a)->s6_addr32[2] == 0) && \
128 ((a)->s6_addr32[3] != 0) && \
129 ((a)->s6_addr32[3] != htonl(1)))
134 #define IN6_IS_ADDR_V4MAPPED(a) \
135 (((a)->s6_addr32[0] == 0) && \
136 ((a)->s6_addr32[1] == 0) && \
137 ((a)->s6_addr32[2] == htonl(0x0000ffff)))
142 #ifndef IN6_IS_ADDR_MULTICAST
143 #define IN6_IS_ADDR_MULTICAST(a) \
144 ((a)->s6_addr8[0] == 0xffU)
147 * Unicast link / site local.
149 #define IN6_IS_ADDR_LINKLOCAL(a) \
150 (((a)->s6_addr[0] == 0xfe) && (((a)->s6_addr[1] & 0xc0) == 0x80))
151 #define IN6_IS_ADDR_SITELOCAL(a) \
152 (((a)->s6_addr[0] == 0xfe) && (((a)->s6_addr[1] & 0xc0) == 0xc0))
154 #endif /* ISC_ONLY_IPV6 */
155 #endif /* ISC_IPV6_H */