00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #include <winsock2.h>
00029
00030 #ifndef __MINGW32__
00031 #include <ws2tcpip.h>
00032 #endif
00033
00034 #define IN_MULTICAST(a) IN_CLASSD(a)
00035
00036 #define IN_EXPERIMENTAL(a) ((((u_int32_t) (a)) & 0xf0000000) == 0xf0000000)
00037
00038 #define IN_LOOPBACKNET 127
00039
00040 #ifdef __MINGW32__
00041
00042 struct in6_addr
00043 {
00044 union
00045 {
00046 u_int8_t u6_addr8[16];
00047 u_int16_t u6_addr16[8];
00048 u_int32_t u6_addr32[4];
00049 } in6_u;
00050 #define s6_addr in6_u.u6_addr8
00051 #define s6_addr16 in6_u.u6_addr16
00052 #define s6_addr32 in6_u.u6_addr32
00053 #define s6_addr64 in6_u.u6_addr64
00054 };
00055
00056 #define IN6ADDR_ANY_INIT { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }
00057 #define IN6ADDR_LOOPBACK_INIT { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 }
00058 #endif
00059
00060
00061 #if (defined WIN32) || (defined __MINGW32__)
00062 typedef unsigned short sa_family_t;
00063 #endif
00064
00065
00066 #ifdef __MINGW32__
00067
00068 #define __SOCKADDR_COMMON(sa_prefix) \
00069 sa_family_t sa_prefix##family
00070
00071
00072 struct sockaddr_in6
00073 {
00074 __SOCKADDR_COMMON (sin6_);
00075 u_int16_t sin6_port;
00076 u_int32_t sin6_flowinfo;
00077 struct in6_addr sin6_addr;
00078 };
00079
00080 #define IN6_IS_ADDR_V4MAPPED(a) \
00081 ((((u_int32_t *) (a))[0] == 0) && (((u_int32_t *) (a))[1] == 0) && \
00082 (((u_int32_t *) (a))[2] == htonl (0xffff)))
00083
00084 #define IN6_IS_ADDR_MULTICAST(a) (((u_int8_t *) (a))[0] == 0xff)
00085
00086 #define IN6_IS_ADDR_LINKLOCAL(a) \
00087 ((((u_int32_t *) (a))[0] & htonl (0xffc00000)) == htonl (0xfe800000))
00088
00089 #define IN6_IS_ADDR_LOOPBACK(a) \
00090 (((u_int32_t *) (a))[0] == 0 && ((u_int32_t *) (a))[1] == 0 && \
00091 ((u_int32_t *) (a))[2] == 0 && ((u_int32_t *) (a))[3] == htonl (1))
00092 #endif
00093
00094 #define ip6_vfc ip6_ctlun.ip6_un2_vfc
00095 #define ip6_flow ip6_ctlun.ip6_un1.ip6_un1_flow
00096 #define ip6_plen ip6_ctlun.ip6_un1.ip6_un1_plen
00097 #define ip6_nxt ip6_ctlun.ip6_un1.ip6_un1_nxt
00098 #define ip6_hlim ip6_ctlun.ip6_un1.ip6_un1_hlim
00099 #define ip6_hops ip6_ctlun.ip6_un1.ip6_un1_hlim
00100
00101 #define nd_rd_type nd_rd_hdr.icmp6_type
00102 #define nd_rd_code nd_rd_hdr.icmp6_code
00103 #define nd_rd_cksum nd_rd_hdr.icmp6_cksum
00104 #define nd_rd_reserved nd_rd_hdr.icmp6_data32[0]
00105
00106
00107
00108
00109 #define IPPROTO_HOPOPTS 0
00110 #define IPPROTO_IPV6 41
00111 #define IPPROTO_ROUTING 43
00112 #define IPPROTO_FRAGMENT 44
00113 #define IPPROTO_ESP 50
00114 #define IPPROTO_AH 51
00115 #define IPPROTO_ICMPV6 58
00116 #define IPPROTO_NONE 59
00117 #define IPPROTO_DSTOPTS 60
00118 #define IPPROTO_PIM 103
00119
00120 #define IPV6_RTHDR_TYPE_0 0
00121
00122
00123 #define IP6OPT_PAD1 0x00
00124 #define IP6OPT_PADN 0x01
00125 #define IP6OPT_JUMBO 0xC2
00126 #define IP6OPT_JUMBO_LEN 6
00127 #define IP6OPT_ROUTER_ALERT 0x05
00128
00129 #define IP6OPT_RTALERT_LEN 4
00130 #define IP6OPT_RTALERT_MLD 0
00131 #define IP6OPT_RTALERT_RSVP 1
00132 #define IP6OPT_RTALERT_ACTNET 2
00133 #define IP6OPT_MINLEN 2
00134
00135 #define IP6OPT_BINDING_UPDATE 0xc6
00136 #define IP6OPT_BINDING_ACK 0x07
00137 #define IP6OPT_BINDING_REQ 0x08
00138 #define IP6OPT_HOME_ADDRESS 0xc9
00139 #define IP6OPT_EID 0x8a
00140
00141 #define IP6OPT_TYPE(o) ((o) & 0xC0)
00142 #define IP6OPT_TYPE_SKIP 0x00
00143 #define IP6OPT_TYPE_DISCARD 0x40
00144 #define IP6OPT_TYPE_FORCEICMP 0x80
00145 #define IP6OPT_TYPE_ICMP 0xC0
00146
00147 #define IP6OPT_MUTABLE 0x20
00148
00149
00150 #ifdef __MINGW32__
00151 #ifndef EAI_ADDRFAMILY
00152 struct addrinfo {
00153 int ai_flags;
00154 int ai_family;
00155 int ai_socktype;
00156 int ai_protocol;
00157 size_t ai_addrlen;
00158 char *ai_canonname;
00159 struct sockaddr *ai_addr;
00160 struct addrinfo *ai_next;
00161 };
00162 #endif
00163 #endif