be sure to link in the swrast_setup code, too
[netbsd-mini2440.git] / dist / tcpdump / icmp6.h
blob96a711664729fa3daf6045361919680b371714c1
1 /* $NetBSD$ */
3 /* @(#) Header: /tcpdump/master/tcpdump/icmp6.h,v 1.16.2.1 2005/09/05 09:29:28 guy Exp (LBL) */
4 /* NetBSD: icmp6.h,v 1.13 2000/08/03 16:30:37 itojun Exp */
5 /* $KAME: icmp6.h,v 1.22 2000/08/03 15:25:16 jinmei Exp $ */
7 /*
8 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
9 * All rights reserved.
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
19 * 3. Neither the name of the project nor the names of its contributors
20 * may be used to endorse or promote products derived from this software
21 * without specific prior written permission.
23 * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * SUCH DAMAGE.
37 * Copyright (c) 1982, 1986, 1993
38 * The Regents of the University of California. All rights reserved.
40 * Redistribution and use in source and binary forms, with or without
41 * modification, are permitted provided that the following conditions
42 * are met:
43 * 1. Redistributions of source code must retain the above copyright
44 * notice, this list of conditions and the following disclaimer.
45 * 2. Redistributions in binary form must reproduce the above copyright
46 * notice, this list of conditions and the following disclaimer in the
47 * documentation and/or other materials provided with the distribution.
48 * 3. Neither the name of the University nor the names of its contributors
49 * may be used to endorse or promote products derived from this software
50 * without specific prior written permission.
52 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
53 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
54 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
55 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
56 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
57 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
58 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
59 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
60 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
61 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
62 * SUCH DAMAGE.
64 * @(#)ip_icmp.h 8.1 (Berkeley) 6/10/93
67 #ifndef _NETINET_ICMP6_H_
68 #define _NETINET_ICMP6_H_
70 struct icmp6_hdr {
71 u_int8_t icmp6_type; /* type field */
72 u_int8_t icmp6_code; /* code field */
73 u_int16_t icmp6_cksum; /* checksum field */
74 union {
75 u_int32_t icmp6_un_data32[1]; /* type-specific field */
76 u_int16_t icmp6_un_data16[2]; /* type-specific field */
77 u_int8_t icmp6_un_data8[4]; /* type-specific field */
78 } icmp6_dataun;
81 #define icmp6_data32 icmp6_dataun.icmp6_un_data32
82 #define icmp6_data16 icmp6_dataun.icmp6_un_data16
83 #define icmp6_data8 icmp6_dataun.icmp6_un_data8
84 #define icmp6_pptr icmp6_data32[0] /* parameter prob */
85 #define icmp6_mtu icmp6_data32[0] /* packet too big */
86 #define icmp6_id icmp6_data16[0] /* echo request/reply */
87 #define icmp6_seq icmp6_data16[1] /* echo request/reply */
88 #define icmp6_maxdelay icmp6_data16[0] /* mcast group membership */
90 #define ICMP6_DST_UNREACH 1 /* dest unreachable, codes: */
91 #define ICMP6_PACKET_TOO_BIG 2 /* packet too big */
92 #define ICMP6_TIME_EXCEEDED 3 /* time exceeded, code: */
93 #define ICMP6_PARAM_PROB 4 /* ip6 header bad */
95 #define ICMP6_ECHO_REQUEST 128 /* echo service */
96 #define ICMP6_ECHO_REPLY 129 /* echo reply */
97 #define ICMP6_MEMBERSHIP_QUERY 130 /* group membership query */
98 #define MLD6_LISTENER_QUERY 130 /* multicast listener query */
99 #define ICMP6_MEMBERSHIP_REPORT 131 /* group membership report */
100 #define MLD6_LISTENER_REPORT 131 /* multicast listener report */
101 #define ICMP6_MEMBERSHIP_REDUCTION 132 /* group membership termination */
102 #define MLD6_LISTENER_DONE 132 /* multicast listener done */
104 #define ND_ROUTER_SOLICIT 133 /* router solicitation */
105 #define ND_ROUTER_ADVERT 134 /* router advertisement */
106 #define ND_NEIGHBOR_SOLICIT 135 /* neighbor solicitation */
107 #define ND_NEIGHBOR_ADVERT 136 /* neighbor advertisement */
108 #define ND_REDIRECT 137 /* redirect */
110 #define ICMP6_ROUTER_RENUMBERING 138 /* router renumbering */
112 #define ICMP6_WRUREQUEST 139 /* who are you request */
113 #define ICMP6_WRUREPLY 140 /* who are you reply */
114 #define ICMP6_FQDN_QUERY 139 /* FQDN query */
115 #define ICMP6_FQDN_REPLY 140 /* FQDN reply */
116 #define ICMP6_NI_QUERY 139 /* node information request */
117 #define ICMP6_NI_REPLY 140 /* node information reply */
118 #define IND_SOLICIT 141 /* inverse neighbor solicitation */
119 #define IND_ADVERT 142 /* inverse neighbor advertisement */
121 #define ICMP6_V2_MEMBERSHIP_REPORT 143 /* v2 membership report */
122 #define MLDV2_LISTENER_REPORT 143 /* v2 multicast listener report */
123 #define ICMP6_HADISCOV_REQUEST 144
124 #define ICMP6_HADISCOV_REPLY 145
125 #define ICMP6_MOBILEPREFIX_SOLICIT 146
126 #define ICMP6_MOBILEPREFIX_ADVERT 147
128 #define MLD6_MTRACE_RESP 200 /* mtrace response(to sender) */
129 #define MLD6_MTRACE 201 /* mtrace messages */
131 #define ICMP6_MAXTYPE 201
133 #define ICMP6_DST_UNREACH_NOROUTE 0 /* no route to destination */
134 #define ICMP6_DST_UNREACH_ADMIN 1 /* administratively prohibited */
135 #define ICMP6_DST_UNREACH_NOTNEIGHBOR 2 /* not a neighbor(obsolete) */
136 #define ICMP6_DST_UNREACH_BEYONDSCOPE 2 /* beyond scope of source address */
137 #define ICMP6_DST_UNREACH_ADDR 3 /* address unreachable */
138 #define ICMP6_DST_UNREACH_NOPORT 4 /* port unreachable */
140 #define ICMP6_TIME_EXCEED_TRANSIT 0 /* ttl==0 in transit */
141 #define ICMP6_TIME_EXCEED_REASSEMBLY 1 /* ttl==0 in reass */
143 #define ICMP6_PARAMPROB_HEADER 0 /* erroneous header field */
144 #define ICMP6_PARAMPROB_NEXTHEADER 1 /* unrecognized next header */
145 #define ICMP6_PARAMPROB_OPTION 2 /* unrecognized option */
147 #define ICMP6_INFOMSG_MASK 0x80 /* all informational messages */
149 #define ICMP6_NI_SUBJ_IPV6 0 /* Query Subject is an IPv6 address */
150 #define ICMP6_NI_SUBJ_FQDN 1 /* Query Subject is a Domain name */
151 #define ICMP6_NI_SUBJ_IPV4 2 /* Query Subject is an IPv4 address */
153 #define ICMP6_NI_SUCCESS 0 /* node information successful reply */
154 #define ICMP6_NI_REFUSED 1 /* node information request is refused */
155 #define ICMP6_NI_UNKNOWN 2 /* unknown Qtype */
157 #define ICMP6_ROUTER_RENUMBERING_COMMAND 0 /* rr command */
158 #define ICMP6_ROUTER_RENUMBERING_RESULT 1 /* rr result */
159 #define ICMP6_ROUTER_RENUMBERING_SEQNUM_RESET 255 /* rr seq num reset */
161 /* Used in kernel only */
162 #define ND_REDIRECT_ONLINK 0 /* redirect to an on-link node */
163 #define ND_REDIRECT_ROUTER 1 /* redirect to a better router */
166 * Multicast Listener Discovery
168 struct mld6_hdr {
169 struct icmp6_hdr mld6_hdr;
170 struct in6_addr mld6_addr; /* multicast address */
173 #define mld6_type mld6_hdr.icmp6_type
174 #define mld6_code mld6_hdr.icmp6_code
175 #define mld6_cksum mld6_hdr.icmp6_cksum
176 #define mld6_maxdelay mld6_hdr.icmp6_data16[0]
177 #define mld6_reserved mld6_hdr.icmp6_data16[1]
179 #define MLD_MINLEN 24
180 #define MLDV2_MINLEN 28
183 * Neighbor Discovery
186 struct nd_router_solicit { /* router solicitation */
187 struct icmp6_hdr nd_rs_hdr;
188 /* could be followed by options */
191 #define nd_rs_type nd_rs_hdr.icmp6_type
192 #define nd_rs_code nd_rs_hdr.icmp6_code
193 #define nd_rs_cksum nd_rs_hdr.icmp6_cksum
194 #define nd_rs_reserved nd_rs_hdr.icmp6_data32[0]
196 struct nd_router_advert { /* router advertisement */
197 struct icmp6_hdr nd_ra_hdr;
198 u_int32_t nd_ra_reachable; /* reachable time */
199 u_int32_t nd_ra_retransmit; /* retransmit timer */
200 /* could be followed by options */
203 #define nd_ra_type nd_ra_hdr.icmp6_type
204 #define nd_ra_code nd_ra_hdr.icmp6_code
205 #define nd_ra_cksum nd_ra_hdr.icmp6_cksum
206 #define nd_ra_curhoplimit nd_ra_hdr.icmp6_data8[0]
207 #define nd_ra_flags_reserved nd_ra_hdr.icmp6_data8[1]
208 #define ND_RA_FLAG_MANAGED 0x80
209 #define ND_RA_FLAG_OTHER 0x40
210 #define ND_RA_FLAG_HOME_AGENT 0x20
213 * Router preference values based on draft-draves-ipngwg-router-selection-01.
214 * These are non-standard definitions.
216 #define ND_RA_FLAG_RTPREF_MASK 0x18 /* 00011000 */
218 #define ND_RA_FLAG_RTPREF_HIGH 0x08 /* 00001000 */
219 #define ND_RA_FLAG_RTPREF_MEDIUM 0x00 /* 00000000 */
220 #define ND_RA_FLAG_RTPREF_LOW 0x18 /* 00011000 */
221 #define ND_RA_FLAG_RTPREF_RSV 0x10 /* 00010000 */
223 #define nd_ra_router_lifetime nd_ra_hdr.icmp6_data16[1]
225 struct nd_neighbor_solicit { /* neighbor solicitation */
226 struct icmp6_hdr nd_ns_hdr;
227 struct in6_addr nd_ns_target; /*target address */
228 /* could be followed by options */
231 #define nd_ns_type nd_ns_hdr.icmp6_type
232 #define nd_ns_code nd_ns_hdr.icmp6_code
233 #define nd_ns_cksum nd_ns_hdr.icmp6_cksum
234 #define nd_ns_reserved nd_ns_hdr.icmp6_data32[0]
236 struct nd_neighbor_advert { /* neighbor advertisement */
237 struct icmp6_hdr nd_na_hdr;
238 struct in6_addr nd_na_target; /* target address */
239 /* could be followed by options */
242 #define nd_na_type nd_na_hdr.icmp6_type
243 #define nd_na_code nd_na_hdr.icmp6_code
244 #define nd_na_cksum nd_na_hdr.icmp6_cksum
245 #define nd_na_flags_reserved nd_na_hdr.icmp6_data32[0]
247 #define ND_NA_FLAG_ROUTER 0x80000000
248 #define ND_NA_FLAG_SOLICITED 0x40000000
249 #define ND_NA_FLAG_OVERRIDE 0x20000000
251 struct nd_redirect { /* redirect */
252 struct icmp6_hdr nd_rd_hdr;
253 struct in6_addr nd_rd_target; /* target address */
254 struct in6_addr nd_rd_dst; /* destination address */
255 /* could be followed by options */
258 #define nd_rd_type nd_rd_hdr.icmp6_type
259 #define nd_rd_code nd_rd_hdr.icmp6_code
260 #define nd_rd_cksum nd_rd_hdr.icmp6_cksum
261 #define nd_rd_reserved nd_rd_hdr.icmp6_data32[0]
263 struct nd_opt_hdr { /* Neighbor discovery option header */
264 u_int8_t nd_opt_type;
265 u_int8_t nd_opt_len;
266 /* followed by option specific data*/
269 #define ND_OPT_SOURCE_LINKADDR 1
270 #define ND_OPT_TARGET_LINKADDR 2
271 #define ND_OPT_PREFIX_INFORMATION 3
272 #define ND_OPT_REDIRECTED_HEADER 4
273 #define ND_OPT_MTU 5
274 #define ND_OPT_ADVINTERVAL 7
275 #define ND_OPT_HOMEAGENT_INFO 8
276 #define ND_OPT_ROUTE_INFO 9 /* draft-ietf-ipngwg-router-preference, not officially assigned yet */
279 struct nd_opt_prefix_info { /* prefix information */
280 u_int8_t nd_opt_pi_type;
281 u_int8_t nd_opt_pi_len;
282 u_int8_t nd_opt_pi_prefix_len;
283 u_int8_t nd_opt_pi_flags_reserved;
284 u_int8_t nd_opt_pi_valid_time[4];
285 u_int8_t nd_opt_pi_preferred_time[4];
286 u_int8_t nd_opt_pi_reserved2[4];
287 struct in6_addr nd_opt_pi_prefix;
290 #define ND_OPT_PI_FLAG_ONLINK 0x80
291 #define ND_OPT_PI_FLAG_AUTO 0x40
292 #define ND_OPT_PI_FLAG_ROUTER 0x20 /*2292bis*/
294 struct nd_opt_rd_hdr { /* redirected header */
295 u_int8_t nd_opt_rh_type;
296 u_int8_t nd_opt_rh_len;
297 u_int16_t nd_opt_rh_reserved1;
298 u_int32_t nd_opt_rh_reserved2;
299 /* followed by IP header and data */
302 struct nd_opt_mtu { /* MTU option */
303 u_int8_t nd_opt_mtu_type;
304 u_int8_t nd_opt_mtu_len;
305 u_int16_t nd_opt_mtu_reserved;
306 u_int32_t nd_opt_mtu_mtu;
309 struct nd_opt_advinterval { /* Advertisement interval option */
310 u_int8_t nd_opt_adv_type;
311 u_int8_t nd_opt_adv_len;
312 u_int16_t nd_opt_adv_reserved;
313 u_int32_t nd_opt_adv_interval;
316 struct nd_opt_homeagent_info { /* Home Agent info */
317 u_int8_t nd_opt_hai_type;
318 u_int8_t nd_opt_hai_len;
319 u_int16_t nd_opt_hai_reserved;
320 int16_t nd_opt_hai_preference;
321 u_int16_t nd_opt_hai_lifetime;
324 struct nd_opt_route_info { /* route info */
325 u_int8_t nd_opt_rti_type;
326 u_int8_t nd_opt_rti_len;
327 u_int8_t nd_opt_rti_prefixlen;
328 u_int8_t nd_opt_rti_flags;
329 u_int32_t nd_opt_rti_lifetime;
330 /* prefix follows */
334 * icmp6 namelookup
337 struct icmp6_namelookup {
338 struct icmp6_hdr icmp6_nl_hdr;
339 u_int8_t icmp6_nl_nonce[8];
340 int32_t icmp6_nl_ttl;
341 #if 0
342 u_int8_t icmp6_nl_len;
343 u_int8_t icmp6_nl_name[3];
344 #endif
345 /* could be followed by options */
349 * icmp6 node information
351 struct icmp6_nodeinfo {
352 struct icmp6_hdr icmp6_ni_hdr;
353 u_int8_t icmp6_ni_nonce[8];
354 /* could be followed by reply data */
357 #define ni_type icmp6_ni_hdr.icmp6_type
358 #define ni_code icmp6_ni_hdr.icmp6_code
359 #define ni_cksum icmp6_ni_hdr.icmp6_cksum
360 #define ni_qtype icmp6_ni_hdr.icmp6_data16[0]
361 #define ni_flags icmp6_ni_hdr.icmp6_data16[1]
363 #define NI_QTYPE_NOOP 0 /* NOOP */
364 #define NI_QTYPE_SUPTYPES 1 /* Supported Qtypes */
365 #define NI_QTYPE_FQDN 2 /* FQDN (draft 04) */
366 #define NI_QTYPE_DNSNAME 2 /* DNS Name */
367 #define NI_QTYPE_NODEADDR 3 /* Node Addresses */
368 #define NI_QTYPE_IPV4ADDR 4 /* IPv4 Addresses */
370 /* network endian */
371 #define NI_SUPTYPE_FLAG_COMPRESS ((u_int16_t)htons(0x1))
372 #define NI_FQDN_FLAG_VALIDTTL ((u_int16_t)htons(0x1))
374 /* network endian */
375 #define NI_NODEADDR_FLAG_TRUNCATE ((u_int16_t)htons(0x1))
376 #define NI_NODEADDR_FLAG_ALL ((u_int16_t)htons(0x2))
377 #define NI_NODEADDR_FLAG_COMPAT ((u_int16_t)htons(0x4))
378 #define NI_NODEADDR_FLAG_LINKLOCAL ((u_int16_t)htons(0x8))
379 #define NI_NODEADDR_FLAG_SITELOCAL ((u_int16_t)htons(0x10))
380 #define NI_NODEADDR_FLAG_GLOBAL ((u_int16_t)htons(0x20))
381 #define NI_NODEADDR_FLAG_ANYCAST ((u_int16_t)htons(0x40)) /* just experimental. not in spec */
383 struct ni_reply_fqdn {
384 u_int32_t ni_fqdn_ttl; /* TTL */
385 u_int8_t ni_fqdn_namelen; /* length in octets of the FQDN */
386 u_int8_t ni_fqdn_name[3]; /* XXX: alignment */
390 * Router Renumbering. as router-renum-08.txt
392 struct icmp6_router_renum { /* router renumbering header */
393 struct icmp6_hdr rr_hdr;
394 u_int8_t rr_segnum;
395 u_int8_t rr_flags;
396 u_int16_t rr_maxdelay;
397 u_int32_t rr_reserved;
399 #define ICMP6_RR_FLAGS_TEST 0x80
400 #define ICMP6_RR_FLAGS_REQRESULT 0x40
401 #define ICMP6_RR_FLAGS_FORCEAPPLY 0x20
402 #define ICMP6_RR_FLAGS_SPECSITE 0x10
403 #define ICMP6_RR_FLAGS_PREVDONE 0x08
405 #define rr_type rr_hdr.icmp6_type
406 #define rr_code rr_hdr.icmp6_code
407 #define rr_cksum rr_hdr.icmp6_cksum
408 #define rr_seqnum rr_hdr.icmp6_data32[0]
410 struct rr_pco_match { /* match prefix part */
411 u_int8_t rpm_code;
412 u_int8_t rpm_len;
413 u_int8_t rpm_ordinal;
414 u_int8_t rpm_matchlen;
415 u_int8_t rpm_minlen;
416 u_int8_t rpm_maxlen;
417 u_int16_t rpm_reserved;
418 struct in6_addr rpm_prefix;
421 #define RPM_PCO_ADD 1
422 #define RPM_PCO_CHANGE 2
423 #define RPM_PCO_SETGLOBAL 3
424 #define RPM_PCO_MAX 4
426 struct rr_pco_use { /* use prefix part */
427 u_int8_t rpu_uselen;
428 u_int8_t rpu_keeplen;
429 u_int8_t rpu_ramask;
430 u_int8_t rpu_raflags;
431 u_int32_t rpu_vltime;
432 u_int32_t rpu_pltime;
433 u_int32_t rpu_flags;
434 struct in6_addr rpu_prefix;
436 #define ICMP6_RR_PCOUSE_RAFLAGS_ONLINK 0x80
437 #define ICMP6_RR_PCOUSE_RAFLAGS_AUTO 0x40
439 /* network endian */
440 #define ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME ((u_int32_t)htonl(0x80000000))
441 #define ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME ((u_int32_t)htonl(0x40000000))
443 struct rr_result { /* router renumbering result message */
444 u_int16_t rrr_flags;
445 u_int8_t rrr_ordinal;
446 u_int8_t rrr_matchedlen;
447 u_int32_t rrr_ifid;
448 struct in6_addr rrr_prefix;
450 /* network endian */
451 #define ICMP6_RR_RESULT_FLAGS_OOB ((u_int16_t)htons(0x0002))
452 #define ICMP6_RR_RESULT_FLAGS_FORBIDDEN ((u_int16_t)htons(0x0001))
454 #endif /* not _NETINET_ICMP6_H_ */