sl@0
|
1 |
/*
|
sl@0
|
2 |
* Copyright (c) 1993, 1994, 1997
|
sl@0
|
3 |
* The Regents of the University of California. All rights reserved.
|
sl@0
|
4 |
*
|
sl@0
|
5 |
* Redistribution and use in source and binary forms, with or without
|
sl@0
|
6 |
* modification, are permitted provided that: (1) source code distributions
|
sl@0
|
7 |
* retain the above copyright notice and this paragraph in its entirety, (2)
|
sl@0
|
8 |
* distributions including binary code include the above copyright notice and
|
sl@0
|
9 |
* this paragraph in its entirety in the documentation or other materials
|
sl@0
|
10 |
* provided with the distribution, and (3) all advertising materials mentioning
|
sl@0
|
11 |
* features or use of this software display the following acknowledgement:
|
sl@0
|
12 |
* ``This product includes software developed by the University of California,
|
sl@0
|
13 |
* Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
|
sl@0
|
14 |
* the University nor the names of its contributors may be used to endorse
|
sl@0
|
15 |
* or promote products derived from this software without specific prior
|
sl@0
|
16 |
* written permission.
|
sl@0
|
17 |
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
|
sl@0
|
18 |
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
sl@0
|
19 |
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
sl@0
|
20 |
*
|
sl@0
|
21 |
* @(#) $Header: /tcpdump/master/libpcap/Win32/Include/ip6_misc.h,v 1.4.2.1 2006/01/22 18:13:47 gianluca Exp $ (LBL)
|
sl@0
|
22 |
*/
|
sl@0
|
23 |
|
sl@0
|
24 |
/*
|
sl@0
|
25 |
* This file contains a collage of declarations for IPv6 from FreeBSD not present in Windows
|
sl@0
|
26 |
*/
|
sl@0
|
27 |
|
sl@0
|
28 |
#include <winsock2.h>
|
sl@0
|
29 |
|
sl@0
|
30 |
#ifndef __MINGW32__
|
sl@0
|
31 |
#include <ws2tcpip.h>
|
sl@0
|
32 |
#endif /* __MINGW32__ */
|
sl@0
|
33 |
|
sl@0
|
34 |
#ifndef __MINGW32__
|
sl@0
|
35 |
#define IN_MULTICAST(a) IN_CLASSD(a)
|
sl@0
|
36 |
#endif
|
sl@0
|
37 |
|
sl@0
|
38 |
#define IN_EXPERIMENTAL(a) ((((u_int32_t) (a)) & 0xf0000000) == 0xf0000000)
|
sl@0
|
39 |
|
sl@0
|
40 |
#define IN_LOOPBACKNET 127
|
sl@0
|
41 |
|
sl@0
|
42 |
#ifdef __MINGW32__
|
sl@0
|
43 |
/* IPv6 address */
|
sl@0
|
44 |
struct in6_addr
|
sl@0
|
45 |
{
|
sl@0
|
46 |
union
|
sl@0
|
47 |
{
|
sl@0
|
48 |
u_int8_t u6_addr8[16];
|
sl@0
|
49 |
u_int16_t u6_addr16[8];
|
sl@0
|
50 |
u_int32_t u6_addr32[4];
|
sl@0
|
51 |
} in6_u;
|
sl@0
|
52 |
#define s6_addr in6_u.u6_addr8
|
sl@0
|
53 |
#define s6_addr16 in6_u.u6_addr16
|
sl@0
|
54 |
#define s6_addr32 in6_u.u6_addr32
|
sl@0
|
55 |
#define s6_addr64 in6_u.u6_addr64
|
sl@0
|
56 |
};
|
sl@0
|
57 |
|
sl@0
|
58 |
#define IN6ADDR_ANY_INIT { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }
|
sl@0
|
59 |
#define IN6ADDR_LOOPBACK_INIT { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 }
|
sl@0
|
60 |
#endif /* __MINGW32__ */
|
sl@0
|
61 |
|
sl@0
|
62 |
|
sl@0
|
63 |
#if (defined WIN32) || (defined __MINGW32__)
|
sl@0
|
64 |
typedef unsigned short sa_family_t;
|
sl@0
|
65 |
#endif
|
sl@0
|
66 |
|
sl@0
|
67 |
|
sl@0
|
68 |
#ifdef __MINGW32__
|
sl@0
|
69 |
|
sl@0
|
70 |
#define __SOCKADDR_COMMON(sa_prefix) \
|
sl@0
|
71 |
sa_family_t sa_prefix##family
|
sl@0
|
72 |
|
sl@0
|
73 |
/* Ditto, for IPv6. */
|
sl@0
|
74 |
struct sockaddr_in6
|
sl@0
|
75 |
{
|
sl@0
|
76 |
__SOCKADDR_COMMON (sin6_);
|
sl@0
|
77 |
u_int16_t sin6_port; /* Transport layer port # */
|
sl@0
|
78 |
u_int32_t sin6_flowinfo; /* IPv6 flow information */
|
sl@0
|
79 |
struct in6_addr sin6_addr; /* IPv6 address */
|
sl@0
|
80 |
};
|
sl@0
|
81 |
|
sl@0
|
82 |
#define IN6_IS_ADDR_V4MAPPED(a) \
|
sl@0
|
83 |
((((u_int32_t *) (a))[0] == 0) && (((u_int32_t *) (a))[1] == 0) && \
|
sl@0
|
84 |
(((u_int32_t *) (a))[2] == htonl (0xffff)))
|
sl@0
|
85 |
|
sl@0
|
86 |
#define IN6_IS_ADDR_MULTICAST(a) (((u_int8_t *) (a))[0] == 0xff)
|
sl@0
|
87 |
|
sl@0
|
88 |
#define IN6_IS_ADDR_LINKLOCAL(a) \
|
sl@0
|
89 |
((((u_int32_t *) (a))[0] & htonl (0xffc00000)) == htonl (0xfe800000))
|
sl@0
|
90 |
|
sl@0
|
91 |
#define IN6_IS_ADDR_LOOPBACK(a) \
|
sl@0
|
92 |
(((u_int32_t *) (a))[0] == 0 && ((u_int32_t *) (a))[1] == 0 && \
|
sl@0
|
93 |
((u_int32_t *) (a))[2] == 0 && ((u_int32_t *) (a))[3] == htonl (1))
|
sl@0
|
94 |
#endif /* __MINGW32__ */
|
sl@0
|
95 |
|
sl@0
|
96 |
#define ip6_vfc ip6_ctlun.ip6_un2_vfc
|
sl@0
|
97 |
#define ip6_flow ip6_ctlun.ip6_un1.ip6_un1_flow
|
sl@0
|
98 |
#define ip6_plen ip6_ctlun.ip6_un1.ip6_un1_plen
|
sl@0
|
99 |
#define ip6_nxt ip6_ctlun.ip6_un1.ip6_un1_nxt
|
sl@0
|
100 |
#define ip6_hlim ip6_ctlun.ip6_un1.ip6_un1_hlim
|
sl@0
|
101 |
#define ip6_hops ip6_ctlun.ip6_un1.ip6_un1_hlim
|
sl@0
|
102 |
|
sl@0
|
103 |
#define nd_rd_type nd_rd_hdr.icmp6_type
|
sl@0
|
104 |
#define nd_rd_code nd_rd_hdr.icmp6_code
|
sl@0
|
105 |
#define nd_rd_cksum nd_rd_hdr.icmp6_cksum
|
sl@0
|
106 |
#define nd_rd_reserved nd_rd_hdr.icmp6_data32[0]
|
sl@0
|
107 |
|
sl@0
|
108 |
/*
|
sl@0
|
109 |
* IPV6 extension headers
|
sl@0
|
110 |
*/
|
sl@0
|
111 |
#define IPPROTO_HOPOPTS 0 /* IPv6 hop-by-hop options */
|
sl@0
|
112 |
#define IPPROTO_IPV6 41 /* IPv6 header. */
|
sl@0
|
113 |
#define IPPROTO_ROUTING 43 /* IPv6 routing header */
|
sl@0
|
114 |
#define IPPROTO_FRAGMENT 44 /* IPv6 fragmentation header */
|
sl@0
|
115 |
#define IPPROTO_ESP 50 /* encapsulating security payload */
|
sl@0
|
116 |
#define IPPROTO_AH 51 /* authentication header */
|
sl@0
|
117 |
#define IPPROTO_ICMPV6 58 /* ICMPv6 */
|
sl@0
|
118 |
#define IPPROTO_NONE 59 /* IPv6 no next header */
|
sl@0
|
119 |
#define IPPROTO_DSTOPTS 60 /* IPv6 destination options */
|
sl@0
|
120 |
#define IPPROTO_PIM 103 /* Protocol Independent Multicast. */
|
sl@0
|
121 |
|
sl@0
|
122 |
#define IPV6_RTHDR_TYPE_0 0
|
sl@0
|
123 |
|
sl@0
|
124 |
/* Option types and related macros */
|
sl@0
|
125 |
#define IP6OPT_PAD1 0x00 /* 00 0 00000 */
|
sl@0
|
126 |
#define IP6OPT_PADN 0x01 /* 00 0 00001 */
|
sl@0
|
127 |
#define IP6OPT_JUMBO 0xC2 /* 11 0 00010 = 194 */
|
sl@0
|
128 |
#define IP6OPT_JUMBO_LEN 6
|
sl@0
|
129 |
#define IP6OPT_ROUTER_ALERT 0x05 /* 00 0 00101 */
|
sl@0
|
130 |
|
sl@0
|
131 |
#define IP6OPT_RTALERT_LEN 4
|
sl@0
|
132 |
#define IP6OPT_RTALERT_MLD 0 /* Datagram contains an MLD message */
|
sl@0
|
133 |
#define IP6OPT_RTALERT_RSVP 1 /* Datagram contains an RSVP message */
|
sl@0
|
134 |
#define IP6OPT_RTALERT_ACTNET 2 /* contains an Active Networks msg */
|
sl@0
|
135 |
#define IP6OPT_MINLEN 2
|
sl@0
|
136 |
|
sl@0
|
137 |
#define IP6OPT_BINDING_UPDATE 0xc6 /* 11 0 00110 */
|
sl@0
|
138 |
#define IP6OPT_BINDING_ACK 0x07 /* 00 0 00111 */
|
sl@0
|
139 |
#define IP6OPT_BINDING_REQ 0x08 /* 00 0 01000 */
|
sl@0
|
140 |
#define IP6OPT_HOME_ADDRESS 0xc9 /* 11 0 01001 */
|
sl@0
|
141 |
#define IP6OPT_EID 0x8a /* 10 0 01010 */
|
sl@0
|
142 |
|
sl@0
|
143 |
#define IP6OPT_TYPE(o) ((o) & 0xC0)
|
sl@0
|
144 |
#define IP6OPT_TYPE_SKIP 0x00
|
sl@0
|
145 |
#define IP6OPT_TYPE_DISCARD 0x40
|
sl@0
|
146 |
#define IP6OPT_TYPE_FORCEICMP 0x80
|
sl@0
|
147 |
#define IP6OPT_TYPE_ICMP 0xC0
|
sl@0
|
148 |
|
sl@0
|
149 |
#define IP6OPT_MUTABLE 0x20
|
sl@0
|
150 |
|
sl@0
|
151 |
|
sl@0
|
152 |
#ifdef __MINGW32__
|
sl@0
|
153 |
#ifndef EAI_ADDRFAMILY
|
sl@0
|
154 |
struct addrinfo {
|
sl@0
|
155 |
int ai_flags; /* AI_PASSIVE, AI_CANONNAME */
|
sl@0
|
156 |
int ai_family; /* PF_xxx */
|
sl@0
|
157 |
int ai_socktype; /* SOCK_xxx */
|
sl@0
|
158 |
int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */
|
sl@0
|
159 |
size_t ai_addrlen; /* length of ai_addr */
|
sl@0
|
160 |
char *ai_canonname; /* canonical name for hostname */
|
sl@0
|
161 |
struct sockaddr *ai_addr; /* binary address */
|
sl@0
|
162 |
struct addrinfo *ai_next; /* next structure in linked list */
|
sl@0
|
163 |
};
|
sl@0
|
164 |
#endif
|
sl@0
|
165 |
#endif /* __MINGW32__ */
|