Expand PMF_FN_* macros.
[netbsd-mini2440.git] / dist / ntp / include / isc / ipv6.h
blob07bd32f447d906e83420e9739532b1a446af740a
1 /* $NetBSD: ipv6.h,v 1.2 2003/12/04 16:23:36 drochner Exp $ */
3 /*
4 * Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC")
5 * Copyright (C) 1999-2002 Internet Software Consortium.
7 * Permission to use, copy, modify, and distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above
9 * copyright notice and this permission notice appear in all copies.
11 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
12 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
13 * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
14 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
15 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
16 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17 * PERFORMANCE OF THIS SOFTWARE.
20 /* Id: ipv6.h,v 1.17.12.4 2004/03/09 05:21:09 marka Exp */
22 #ifndef ISC_IPV6_H
23 #define ISC_IPV6_H 1
26 * Also define LWRES_IPV6_H to keep it from being included if liblwres is
27 * being used, or redefinition errors will occur.
29 #define LWRES_IPV6_H 1
31 /*****
32 ***** Module Info
33 *****/
36 * IPv6 definitions for systems which do not support IPv6.
38 * MP:
39 * No impact.
41 * Reliability:
42 * No anticipated impact.
44 * Resources:
45 * N/A.
47 * Security:
48 * No anticipated impact.
50 * Standards:
51 * RFC 2553.
54 /***
55 *** Imports.
56 ***/
58 #include <isc/int.h>
59 #include <isc/platform.h>
62 * We probably don't need this on NTP
64 #ifdef ISC_ONLY_IPV6
65 /***
66 *** Types.
67 ***/
69 struct in6_addr {
70 union {
71 isc_uint8_t _S6_u8[16];
72 isc_uint16_t _S6_u16[8];
73 isc_uint32_t _S6_u32[4];
74 } _S6_un;
76 #define s6_addr _S6_un._S6_u8
77 #define s6_addr8 _S6_un._S6_u8
78 #define s6_addr16 _S6_un._S6_u16
79 #define s6_addr32 _S6_un._S6_u32
81 #define IN6ADDR_ANY_INIT {{ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }}
82 #define IN6ADDR_LOOPBACK_INIT {{ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 }}
84 LIBISC_EXTERNAL_DATA extern const struct in6_addr in6addr_any;
85 LIBISC_EXTERNAL_DATA extern const struct in6_addr in6addr_loopback;
87 struct sockaddr_in6 {
88 #ifdef ISC_PLATFORM_HAVESALEN
89 isc_uint8_t sin6_len;
90 isc_uint8_t sin6_family;
91 #else
92 isc_uint16_t sin6_family;
93 #endif
94 isc_uint16_t sin6_port;
95 isc_uint32_t sin6_flowinfo;
96 struct in6_addr sin6_addr;
97 isc_uint32_t sin6_scope_id;
100 #ifdef ISC_PLATFORM_HAVESALEN
101 #define SIN6_LEN 1
102 #endif
105 * Unspecified
107 #ifndef IN6_IS_ADDR_UNSPECIFIED
108 #define IN6_IS_ADDR_UNSPECIFIED(a) \
109 (((a)->s6_addr32[0] == 0) && \
110 ((a)->s6_addr32[1] == 0) && \
111 ((a)->s6_addr32[2] == 0) && \
112 ((a)->s6_addr32[3] == 0))
113 #endif
115 * Loopback
117 #define IN6_IS_ADDR_LOOPBACK(a) \
118 (((a)->s6_addr32[0] == 0) && \
119 ((a)->s6_addr32[1] == 0) && \
120 ((a)->s6_addr32[2] == 0) && \
121 ((a)->s6_addr32[3] == htonl(1)))
124 * IPv4 compatible
126 #define IN6_IS_ADDR_V4COMPAT(a) \
127 (((a)->s6_addr32[0] == 0) && \
128 ((a)->s6_addr32[1] == 0) && \
129 ((a)->s6_addr32[2] == 0) && \
130 ((a)->s6_addr32[3] != 0) && \
131 ((a)->s6_addr32[3] != htonl(1)))
134 * Mapped
136 #define IN6_IS_ADDR_V4MAPPED(a) \
137 (((a)->s6_addr32[0] == 0) && \
138 ((a)->s6_addr32[1] == 0) && \
139 ((a)->s6_addr32[2] == htonl(0x0000ffff)))
142 * Multicast
144 #ifndef IN6_IS_ADDR_MULTICAST
145 #define IN6_IS_ADDR_MULTICAST(a) \
146 ((a)->s6_addr8[0] == 0xffU)
147 #endif
149 * Unicast link / site local.
151 #define IN6_IS_ADDR_LINKLOCAL(a) \
152 (((a)->s6_addr[0] == 0xfe) && (((a)->s6_addr[1] & 0xc0) == 0x80))
153 #define IN6_IS_ADDR_SITELOCAL(a) \
154 (((a)->s6_addr[0] == 0xfe) && (((a)->s6_addr[1] & 0xc0) == 0xc0))
156 #endif /* ISC_ONLY_IPV6 */
157 #endif /* ISC_IPV6_H */