2 * Copyright (C) 1999-2001 Internet Software Consortium.
4 * Permission to use, copy, modify, and distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
8 * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
9 * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
10 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
11 * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
12 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
13 * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
14 * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
15 * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 /* $Id: ipv6.h,v 1.19 2002/04/03 06:38:33 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 #define IN6_IS_ADDR_UNSPECIFIED(a) \
106 (((a)->s6_addr32[0] == 0) && \
107 ((a)->s6_addr32[1] == 0) && \
108 ((a)->s6_addr32[2] == 0) && \
109 ((a)->s6_addr32[3] == 0))
114 #define IN6_IS_ADDR_LOOPBACK(a) \
115 (((a)->s6_addr32[0] == 0) && \
116 ((a)->s6_addr32[1] == 0) && \
117 ((a)->s6_addr32[2] == 0) && \
118 ((a)->s6_addr32[3] == htonl(1)))
123 #define IN6_IS_ADDR_V4COMPAT(a) \
124 (((a)->s6_addr32[0] == 0) && \
125 ((a)->s6_addr32[1] == 0) && \
126 ((a)->s6_addr32[2] == 0) && \
127 ((a)->s6_addr32[3] != 0) && \
128 ((a)->s6_addr32[3] != htonl(1)))
133 #define IN6_IS_ADDR_V4MAPPED(a) \
134 (((a)->s6_addr32[0] == 0) && \
135 ((a)->s6_addr32[1] == 0) && \
136 ((a)->s6_addr32[2] == htonl(0x0000ffff)))
141 #define IN6_IS_ADDR_MULTICAST(a) \
142 ((a)->s6_addr8[0] == 0xffU)
145 * Unicast link / site local.
147 #define IN6_IS_ADDR_LINKLOCAL(a) \
148 (((a)->s6_addr[0] == 0xfe) && (((a)->s6_addr[1] & 0xc0) == 0x80))
149 #define IN6_IS_ADDR_SITELOCAL(a) \
150 (((a)->s6_addr[0] == 0xfe) && (((a)->s6_addr[1] & 0xc0) == 0xc0))
152 #endif /* ISC_ONLY_IPV6 */
153 #endif /* ISC_IPV6_H */