00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef ISC_IPV6_H
00021 #define ISC_IPV6_H 1
00022
00023
00024
00025
00026
00027 #define LWRES_IPV6_H 1
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056 #include <isc/int.h>
00057 #include <isc/platform.h>
00058
00059
00060
00061
00062
00063 struct in6_addr {
00064 union {
00065 isc_uint8_t _S6_u8[16];
00066 isc_uint16_t _S6_u16[8];
00067 isc_uint32_t _S6_u32[4];
00068 } _S6_un;
00069 };
00070 #define s6_addr _S6_un._S6_u8
00071 #define s6_addr8 _S6_un._S6_u8
00072 #define s6_addr16 _S6_un._S6_u16
00073 #define s6_addr32 _S6_un._S6_u32
00074
00075 #define IN6ADDR_ANY_INIT {{{ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }}}
00076 #define IN6ADDR_LOOPBACK_INIT {{{ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 }}}
00077
00078 LIBISC_EXTERNAL_DATA extern const struct in6_addr in6addr_any;
00079 LIBISC_EXTERNAL_DATA extern const struct in6_addr in6addr_loopback;
00080
00081 struct sockaddr_in6 {
00082 #ifdef ISC_PLATFORM_HAVESALEN
00083 isc_uint8_t sin6_len;
00084 isc_uint8_t sin6_family;
00085 #else
00086 isc_uint16_t sin6_family;
00087 #endif
00088 isc_uint16_t sin6_port;
00089 isc_uint32_t sin6_flowinfo;
00090 struct in6_addr sin6_addr;
00091 isc_uint32_t sin6_scope_id;
00092 };
00093
00094 #ifdef ISC_PLATFORM_HAVESALEN
00095 #define SIN6_LEN 1
00096 #endif
00097
00098
00099
00100
00101 #define IN6_IS_ADDR_UNSPECIFIED(a) \
00102 (((a)->s6_addr32[0] == 0) && \
00103 ((a)->s6_addr32[1] == 0) && \
00104 ((a)->s6_addr32[2] == 0) && \
00105 ((a)->s6_addr32[3] == 0))
00106
00107
00108
00109
00110 #define IN6_IS_ADDR_LOOPBACK(a) \
00111 (((a)->s6_addr32[0] == 0) && \
00112 ((a)->s6_addr32[1] == 0) && \
00113 ((a)->s6_addr32[2] == 0) && \
00114 ((a)->s6_addr32[3] == htonl(1)))
00115
00116
00117
00118
00119 #define IN6_IS_ADDR_V4COMPAT(a) \
00120 (((a)->s6_addr32[0] == 0) && \
00121 ((a)->s6_addr32[1] == 0) && \
00122 ((a)->s6_addr32[2] == 0) && \
00123 ((a)->s6_addr32[3] != 0) && \
00124 ((a)->s6_addr32[3] != htonl(1)))
00125
00126
00127
00128
00129 #define IN6_IS_ADDR_V4MAPPED(a) \
00130 (((a)->s6_addr32[0] == 0) && \
00131 ((a)->s6_addr32[1] == 0) && \
00132 ((a)->s6_addr32[2] == htonl(0x0000ffff)))
00133
00134
00135
00136
00137 #define IN6_IS_ADDR_MULTICAST(a) \
00138 ((a)->s6_addr8[0] == 0xffU)
00139
00140
00141
00142
00143 #define IN6_IS_ADDR_LINKLOCAL(a) \
00144 (((a)->s6_addr[0] == 0xfe) && (((a)->s6_addr[1] & 0xc0) == 0x80))
00145 #define IN6_IS_ADDR_SITELOCAL(a) \
00146 (((a)->s6_addr[0] == 0xfe) && (((a)->s6_addr[1] & 0xc0) == 0xc0))
00147
00148 #endif