Add BIND 9.2.4rc7.
[dragonfly.git] / contrib / bind-9.2.4rc7 / lib / isc / include / isc / ipv6.h
blob3ab3bd6a039a05476cf5c20ef350ca3a108b0a1e
1 /*
2 * Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC")
3 * Copyright (C) 1999-2001 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.2.1 2004/03/09 06:11:57 marka Exp $ */
20 #ifndef ISC_IPV6_H
21 #define ISC_IPV6_H 1
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
29 /*****
30 ***** Module Info
31 *****/
34 * IPv6 definitions for systems which do not support IPv6.
36 * MP:
37 * No impact.
39 * Reliability:
40 * No anticipated impact.
42 * Resources:
43 * N/A.
45 * Security:
46 * No anticipated impact.
48 * Standards:
49 * RFC 2553.
52 /***
53 *** Imports.
54 ***/
56 #include <isc/int.h>
57 #include <isc/platform.h>
59 /***
60 *** Types.
61 ***/
63 struct in6_addr {
64 union {
65 isc_uint8_t _S6_u8[16];
66 isc_uint16_t _S6_u16[8];
67 isc_uint32_t _S6_u32[4];
68 } _S6_un;
70 #define s6_addr _S6_un._S6_u8
71 #define s6_addr8 _S6_un._S6_u8
72 #define s6_addr16 _S6_un._S6_u16
73 #define s6_addr32 _S6_un._S6_u32
75 #define IN6ADDR_ANY_INIT {{{ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }}}
76 #define IN6ADDR_LOOPBACK_INIT {{{ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 }}}
78 extern const struct in6_addr in6addr_any;
79 extern const struct in6_addr in6addr_loopback;
81 struct sockaddr_in6 {
82 #ifdef ISC_PLATFORM_HAVESALEN
83 isc_uint8_t sin6_len;
84 isc_uint8_t sin6_family;
85 #else
86 isc_uint16_t sin6_family;
87 #endif
88 isc_uint16_t sin6_port;
89 isc_uint32_t sin6_flowinfo;
90 struct in6_addr sin6_addr;
91 isc_uint32_t sin6_scope_id;
94 #ifdef ISC_PLATFORM_HAVESALEN
95 #define SIN6_LEN 1
96 #endif
99 * Unspecified
101 #define IN6_IS_ADDR_UNSPECIFIED(a) \
102 (((a)->s6_addr32[0] == 0) && \
103 ((a)->s6_addr32[1] == 0) && \
104 ((a)->s6_addr32[2] == 0) && \
105 ((a)->s6_addr32[3] == 0))
108 * Loopback
110 #define IN6_IS_ADDR_LOOPBACK(a) \
111 (((a)->s6_addr32[0] == 0) && \
112 ((a)->s6_addr32[1] == 0) && \
113 ((a)->s6_addr32[2] == 0) && \
114 ((a)->s6_addr32[3] == htonl(1)))
117 * IPv4 compatible
119 #define IN6_IS_ADDR_V4COMPAT(a) \
120 (((a)->s6_addr32[0] == 0) && \
121 ((a)->s6_addr32[1] == 0) && \
122 ((a)->s6_addr32[2] == 0) && \
123 ((a)->s6_addr32[3] != 0) && \
124 ((a)->s6_addr32[3] != htonl(1)))
127 * Mapped
129 #define IN6_IS_ADDR_V4MAPPED(a) \
130 (((a)->s6_addr32[0] == 0) && \
131 ((a)->s6_addr32[1] == 0) && \
132 ((a)->s6_addr32[2] == htonl(0x0000ffff)))
135 * Multicast
137 #define IN6_IS_ADDR_MULTICAST(a) \
138 ((a)->s6_addr8[0] == 0xffU)
140 #endif /* ISC_IPV6_H */