Now that WinPcap is a DLL, I can load it at run-time rather than load-time.
[obnox/wireshark/wip.git] / packet-ipv6.h
1 /* packet-ipv6.h
2  * Definitions for IPv6 packet disassembly 
3  *
4  * $Id: packet-ipv6.h,v 1.19 2001/04/01 07:06:22 hagbard Exp $
5  *
6  * Ethereal - Network traffic analyzer
7  * By Gerald Combs <gerald@ethereal.com>
8  *
9  * Copyright 1998 Gerald Combs
10  *
11  * MobileIPv6 support added by Tomislav Borosa <tomislav.borosa@siemens.hr>
12  * 
13  * This program is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU General Public License
15  * as published by the Free Software Foundation; either version 2
16  * of the License, or (at your option) any later version.
17  * 
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21  * GNU General Public License for more details.
22  * 
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software
25  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
26  */
27
28 #ifndef __PACKET_IPV6_H_DEFINED__
29 #define __PACKET_IPV6_H_DEFINED__
30
31 #include "ipv6-utils.h"
32
33 void dissect_ipv6(const u_char *, int, frame_data *, proto_tree *);
34
35 #define INET6_ADDRSTRLEN        46
36
37 /*
38  * Definition for internet protocol version 6.
39  * RFC 1883
40  */
41 struct ip6_hdr {
42         union {
43                 struct ip6_hdrctl {
44                         guint32 ip6_un1_flow;   /* 20 bits of flow-ID */
45                         guint16 ip6_un1_plen;   /* payload length */
46                         guint8  ip6_un1_nxt;    /* next header */
47                         guint8  ip6_un1_hlim;   /* hop limit */
48                 } ip6_un1;
49                 guint8 ip6_un2_vfc;     /* 4 bits version, 4 bits class */
50         } ip6_ctlun;
51         struct e_in6_addr ip6_src;      /* source address */
52         struct e_in6_addr ip6_dst;      /* destination address */
53 };
54
55 #define ip6_vfc         ip6_ctlun.ip6_un2_vfc
56 #define ip6_flow        ip6_ctlun.ip6_un1.ip6_un1_flow
57 #define ip6_plen        ip6_ctlun.ip6_un1.ip6_un1_plen
58 #define ip6_nxt         ip6_ctlun.ip6_un1.ip6_un1_nxt
59 #define ip6_hlim        ip6_ctlun.ip6_un1.ip6_un1_hlim
60 #define ip6_hops        ip6_ctlun.ip6_un1.ip6_un1_hlim
61
62 /* Offsets of fields within an IPv6 header. */
63 #define IP6H_CTL        0
64 #define IP6H_CTL_FLOW   0
65 #define IP6H_CTL_PLEN   4
66 #define IP6H_CTL_NXT    6
67 #define IP6H_CTL_HLIM   7
68 #define IP6H_CTL_VFC    0
69 #define IP6H_SRC        8
70 #define IP6H_DST        24
71
72 #define IPV6_FLOWINFO_MASK      0x0fffffff      /* flow info (28 bits) */
73 #define IPV6_FLOWLABEL_MASK     0x000fffff      /* flow label (20 bits) */
74
75 /*
76  * Extension Headers
77  */
78
79 struct  ip6_ext {
80         u_char  ip6e_nxt;
81         u_char  ip6e_len;
82 };
83
84 /* Hop-by-Hop options header */
85 /* XXX should we pad it to force alignment on an 8-byte boundary? */
86 struct ip6_hbh {
87         guint8 ip6h_nxt;        /* next header */
88         guint8 ip6h_len;        /* length in units of 8 octets */
89         /* followed by options */
90 };
91
92 /* Destination options header */
93 /* XXX should we pad it to force alignment on an 8-byte boundary? */
94 struct ip6_dest {
95         guint8 ip6d_nxt;        /* next header */
96         guint8 ip6d_len;        /* length in units of 8 octets */
97         /* followed by options */
98 };
99
100 /* Option types and related macros */
101 #define IP6OPT_PAD1             0x00    /* 00 0 00000 */
102 #define IP6OPT_PADN             0x01    /* 00 0 00001 */
103 #define IP6OPT_JUMBO            0xC2    /* 11 0 00010 = 194 */
104 #define IP6OPT_JUMBO_LEN        6
105 #define IP6OPT_RTALERT          0x05    /* 00 0 00101 */
106 #define IP6OPT_RTALERT_LEN      4
107 #define IP6OPT_RTALERT_MLD      0       /* Datagram contains MLD message */
108 #define IP6OPT_RTALERT_RSVP     1       /* Datagram contains RSVP message */
109 #define IP6OPT_MINLEN           2
110
111 #define IP6OPT_TYPE(o)          ((o) & 0xC0)
112 #define IP6OPT_TYPE_SKIP        0x00
113 #define IP6OPT_TYPE_DISCARD     0x40
114 #define IP6OPT_TYPE_FORCEICMP   0x80
115 #define IP6OPT_TYPE_ICMP        0xC0
116
117 #define IP6OPT_MUTABLE          0x20
118
119 /* BT INSERT BEGIN  */
120 /* Mobile IP option types and sub-option types*/
121 #define IP6OPT_BINDING_UPDATE 0xC6  /* 11 0 00110 */
122 #define IP6OPT_BINDING_ACK 0x07  /* 00 0 00111 */
123 #define IP6OPT_BINDING_REQUEST 0x08  /* 00 0 01000 */
124 #define IP6OPT_HOME_ADDRESS 0xC9  /* 11 0 01001 */
125 #define IP6OPT_MIPv6_UNIQUE_ID_SUB 0x02  /* 00 0 00010 */
126 #define IP6OPT_MIPv6_ALTERNATIVE_COA_SUB 0x04  /* 00 0 00100 */
127
128 /* MIPv6 Lifetime */
129 #define MIP_INFINITY 0xffffffff /* Infinity lifetime */
130
131 /*      Binding Update Flags */
132 #define IP6_MIPv6_BU_A_FLAG 0x80 /* 1000 0000 - Acknowledge */
133 #define IP6_MIPv6_BU_H_FLAG 0x40 /* 0100 0000 - Home Registration */
134 #define IP6_MIPv6_BU_R_FLAG 0x20 /* 0010 0000 - Router */
135 #define IP6_MIPv6_BU_D_FLAG 0x10 /* 0001 0000 - Duplicate Address Detection */
136 #define IP6_MIPv6_BU_M_FLAG 0x8  /* 0000 1000 - MAP Registration */
137 #define IP6_MIPv6_BU_B_FLAG 0x4  /* 0000 0100 - Request for bicasting */
138
139 #define IP6_MIPv6_OPTION_TYPE_LENGTH    1
140 #define IP6_MIPv6_OPTION_LENGTH_LENGTH  1
141 #define IP6_MIPv6_FLAGS_LENGTH  1
142 #define IP6_MIPv6_PREFIX_LENGTH_LENGTH  1
143 #define IP6_MIPv6_SEQUENCE_NUMBER_LENGTH        2
144 #define IP6_MIPv6_LIFE_TIME_LENGTH      4
145 #define IP6_MIPv6_REFRESH_LENGTH        4
146 #define IP6_MIPv6_STATUS_LENGTH 1
147 #define IP6_MIPv6_HOME_ADDRESS_LENGTH   16
148 #define IP6_MIPv6_SUB_TYPE_LENGTH       1
149 #define IP6_MIPv6_SUB_LENGTH_LENGTH     1
150 #define IP6_MIPv6_SUB_UNIQUE_ID_LENGTH  2
151 #define IP6_MIPv6_SUB_ALTERNATIVE_COA_LENGTH    16
152
153 /* Binding Ackonwledgement Status */
154 #define BA_OK 0 /* Binding update accepted */
155 #define BA_REAS_UNSPEC 128 /*Reason unspecified */
156 #define BA_ADMIN_PROH 130 /* Administratively prohibited */
157 #define BA_INSUF_RES 131 /* Insufficient resources */
158 #define BA_NO_HR 132 /* Home registration not supported */
159 #define BA_NO_SUBNET 133 /* Not home subnet */
160 #define BA_ERR_ID_LEN 136 /* Incorrect interface identifier length */
161 #define BA_NO_HA 137 /* Not home agent for this mobile node */
162 #define BA_DUPL_ADDR 138 /* Duplicate Address Detection failed */
163
164 /* Binding Update flag description */
165 static const true_false_string ipv6_mipv6_bu_a_flag_value =
166 {
167         "Binding Acknowledgement requested",
168         "Binding Acknowledgement not requested"
169 };
170 static const true_false_string ipv6_mipv6_bu_h_flag_value =
171 {
172         "Home Registration",
173         "No Home Registration"
174 };
175 static const true_false_string ipv6_mipv6_bu_r_flag_value =
176 {
177         "Router",
178         "Not a Router"
179 };
180 static const true_false_string ipv6_mipv6_bu_d_flag_value =
181 {
182         "Perform Duplicate Address Detection",
183         "Do not perform Duplicate Address Detection"
184 };
185 static const true_false_string ipv6_mipv6_bu_m_flag_value =
186 {
187         "MAP Registration",
188         "No MAP Registration"
189 };
190 static const true_false_string ipv6_mipv6_bu_b_flag_value =
191 {
192         "Request for bicasting",
193         "Do not request for bicasting"
194 };
195 /* BT INSERT END */
196
197 /* Routing header */
198 struct ip6_rthdr {
199         guint8  ip6r_nxt;       /* next header */
200         guint8  ip6r_len;       /* length in units of 8 octets */
201         guint8  ip6r_type;      /* routing type */
202         guint8  ip6r_segleft;   /* segments left */
203         /* followed by routing type specific data */
204 };
205
206 /* Type 0 Routing header */
207 struct ip6_rthdr0 {
208         guint8  ip6r0_nxt;              /* next header */
209         guint8  ip6r0_len;              /* length in units of 8 octets */
210         guint8  ip6r0_type;             /* always zero */
211         guint8  ip6r0_segleft;  /* segments left */
212         guint8  ip6r0_reserved; /* reserved field */
213         guint8  ip6r0_slmap[3]; /* strict/loose bit map */
214         struct e_in6_addr  ip6r0_addr[1];       /* up to 23 addresses */
215 };
216
217 /* Fragment header */
218 struct ip6_frag {
219         guint8  ip6f_nxt;               /* next header */
220         guint8  ip6f_reserved;  /* reserved field */
221         guint16 ip6f_offlg;             /* offset, reserved, and flag */
222         guint32 ip6f_ident;             /* identification */
223 };
224
225 #define IP6F_OFF_MASK           0xfff8  /* mask out offset from _offlg */
226 #define IP6F_RESERVED_MASK      0x0006  /* reserved bits in ip6f_offlg */
227 #define IP6F_MORE_FRAG          0x0001  /* more-fragments flag */
228
229 /*
230  * Definition for ICMPv6.
231  * RFC 1885
232  */
233
234 #define ICMPV6_PLD_MAXLEN       1232    /* IPV6_MMTU - sizeof(struct ip6_hdr)
235                                            - sizeof(struct icmp6_hdr) */
236
237 struct icmp6_hdr {
238         guint8  icmp6_type;     /* type field */
239         guint8  icmp6_code;     /* code field */
240         guint16 icmp6_cksum;    /* checksum field */
241         union {
242                 guint32 icmp6_un_data32[1]; /* type-specific field */
243                 guint16 icmp6_un_data16[2]; /* type-specific field */
244                 guint8  icmp6_un_data8[4];  /* type-specific field */
245         } icmp6_dataun;
246 };
247
248 #define icmp6_data32    icmp6_dataun.icmp6_un_data32
249 #define icmp6_data16    icmp6_dataun.icmp6_un_data16
250 #define icmp6_data8     icmp6_dataun.icmp6_un_data8
251 #define icmp6_pptr      icmp6_data32[0]         /* parameter prob */
252 #define icmp6_mtu       icmp6_data32[0]         /* packet too big */
253 #define icmp6_id        icmp6_data16[0]         /* echo request/reply */
254 #define icmp6_seq       icmp6_data16[1]         /* echo request/reply */
255 #define icmp6_maxdelay  icmp6_data16[0]         /* mcast group membership */
256
257 #define ICMP6_DST_UNREACH               1       /* dest unreachable, codes: */
258 #define ICMP6_PACKET_TOO_BIG            2       /* packet too big */
259 #define ICMP6_TIME_EXCEEDED             3       /* time exceeded, code: */
260 #define ICMP6_PARAM_PROB                4       /* ip6 header bad */
261
262 #define ICMP6_ECHO_REQUEST              128     /* echo service */
263 #define ICMP6_ECHO_REPLY                129     /* echo reply */
264 #define ICMP6_MEMBERSHIP_QUERY          130     /* group membership query */
265 #define MLD6_LISTENER_QUERY             130     /* multicast listener query */
266 #define ICMP6_MEMBERSHIP_REPORT         131     /* group membership report */
267 #define MLD6_LISTENER_REPORT            131     /* multicast listener report */
268 #define ICMP6_MEMBERSHIP_REDUCTION      132     /* group membership termination */
269 #define MLD6_LISTENER_DONE              132     /* multicast listener done */
270
271 #define ND_ROUTER_SOLICIT               133     /* router solicitation */
272 #define ND_ROUTER_ADVERT                134     /* router advertisment */
273 #define ND_NEIGHBOR_SOLICIT             135     /* neighbor solicitation */
274 #define ND_NEIGHBOR_ADVERT              136     /* neighbor advertisment */
275 #define ND_REDIRECT                     137     /* redirect */
276
277 #define ICMP6_ROUTER_RENUMBERING        138     /* router renumbering */
278
279 #define ICMP6_WRUREQUEST                139     /* who are you request */
280 #define ICMP6_WRUREPLY                  140     /* who are you reply */
281 #define ICMP6_FQDN_QUERY                139     /* FQDN query */
282 #define ICMP6_FQDN_REPLY                140     /* FQDN reply */
283 #define ICMP6_NI_QUERY                  139     /* node information request */
284 #define ICMP6_NI_REPLY                  140     /* node information reply */
285
286 /* The definitions below are experimental. TBA */
287 #define MLD6_MTRACE_RESP                141     /* mtrace response(to sender) */
288 #define MLD6_MTRACE                     142     /* mtrace messages */
289
290 #define ICMP6_MAXTYPE                   142
291
292 #define ICMP6_DST_UNREACH_NOROUTE       0       /* no route to destination */
293 #define ICMP6_DST_UNREACH_ADMIN         1       /* administratively prohibited */
294 #define ICMP6_DST_UNREACH_NOTNEIGHBOR   2       /* not a neighbor(obsolete) */
295 #define ICMP6_DST_UNREACH_BEYONDSCOPE   2       /* beyond scope of source address */
296 #define ICMP6_DST_UNREACH_ADDR          3       /* address unreachable */
297 #define ICMP6_DST_UNREACH_NOPORT        4       /* port unreachable */
298
299 #define ICMP6_TIME_EXCEED_TRANSIT       0       /* ttl==0 in transit */
300 #define ICMP6_TIME_EXCEED_REASSEMBLY    1       /* ttl==0 in reass */
301
302 #define ICMP6_PARAMPROB_HEADER          0       /* erroneous header field */
303 #define ICMP6_PARAMPROB_NEXTHEADER      1       /* unrecognized next header */
304 #define ICMP6_PARAMPROB_OPTION          2       /* unrecognized option */
305
306 #define ICMP6_INFOMSG_MASK              0x80    /* all informational messages */
307
308 #define ICMP6_NI_SUBJ_IPV6      0       /* Query Subject is an IPv6 address */
309 #define ICMP6_NI_SUBJ_FQDN      1       /* Query Subject is a Domain name */
310 #define ICMP6_NI_SUBJ_IPV4      2       /* Query Subject is an IPv4 address */
311
312 #define ICMP6_NI_SUCCESS        0       /* node information successful reply */
313 #define ICMP6_NI_REFUSED        1       /* node information request is refused */
314 #define ICMP6_NI_UNKNOWN        2       /* unknown Qtype */
315
316 #define ICMP6_ROUTER_RENUMBERING_COMMAND  0     /* rr command */
317 #define ICMP6_ROUTER_RENUMBERING_RESULT   1     /* rr result */
318 #define ICMP6_ROUTER_RENUMBERING_SEQNUM_RESET   255     /* rr seq num reset */
319
320 /*
321  * Multicast Listener Discovery
322  */
323 struct mld6_hdr {
324         struct icmp6_hdr        mld6_hdr;
325         struct e_in6_addr               mld6_addr; /* multicast address */
326 };
327
328 #define mld6_type       mld6_hdr.icmp6_type
329 #define mld6_code       mld6_hdr.icmp6_code
330 #define mld6_cksum      mld6_hdr.icmp6_cksum
331 #define mld6_maxdelay   mld6_hdr.icmp6_data16[0]
332 #define mld6_reserved   mld6_hdr.icmp6_data16[1]
333
334 /*
335  * Neighbor Discovery
336  */
337
338 struct nd_router_solicit {      /* router solicitation */
339         struct icmp6_hdr        nd_rs_hdr;
340         /* could be followed by options */
341 };
342
343 #define nd_rs_type      nd_rs_hdr.icmp6_type
344 #define nd_rs_code      nd_rs_hdr.icmp6_code
345 #define nd_rs_cksum     nd_rs_hdr.icmp6_cksum
346 #define nd_rs_reserved  nd_rs_hdr.icmp6_data32[0]
347
348 struct nd_router_advert {       /* router advertisement */
349         struct icmp6_hdr        nd_ra_hdr;
350         guint32         nd_ra_reachable;        /* reachable time */
351         guint32         nd_ra_retransmit;       /* retransmit timer */
352         /* could be followed by options */
353 };
354
355 #define nd_ra_type              nd_ra_hdr.icmp6_type
356 #define nd_ra_code              nd_ra_hdr.icmp6_code
357 #define nd_ra_cksum             nd_ra_hdr.icmp6_cksum
358 #define nd_ra_curhoplimit       nd_ra_hdr.icmp6_data8[0]
359 #define nd_ra_flags_reserved    nd_ra_hdr.icmp6_data8[1]
360 #define ND_RA_FLAG_MANAGED      0x80
361 #define ND_RA_FLAG_OTHER        0x40
362 #define nd_ra_router_lifetime   nd_ra_hdr.icmp6_data16[1]
363
364 struct nd_neighbor_solicit {    /* neighbor solicitation */
365         struct icmp6_hdr        nd_ns_hdr;
366         struct e_in6_addr               nd_ns_target;   /*target address */
367         /* could be followed by options */
368 };
369
370 #define nd_ns_type              nd_ns_hdr.icmp6_type
371 #define nd_ns_code              nd_ns_hdr.icmp6_code
372 #define nd_ns_cksum             nd_ns_hdr.icmp6_cksum
373 #define nd_ns_reserved          nd_ns_hdr.icmp6_data32[0]
374
375 struct nd_neighbor_advert {     /* neighbor advertisement */
376         struct icmp6_hdr        nd_na_hdr;
377         struct e_in6_addr               nd_na_target;   /* target address */
378         /* could be followed by options */
379 };
380
381 #define nd_na_type              nd_na_hdr.icmp6_type
382 #define nd_na_code              nd_na_hdr.icmp6_code
383 #define nd_na_cksum             nd_na_hdr.icmp6_cksum
384 #define nd_na_flags_reserved    nd_na_hdr.icmp6_data32[0]
385 #define ND_NA_FLAG_ROUTER               0x80000000
386 #define ND_NA_FLAG_SOLICITED            0x40000000
387 #define ND_NA_FLAG_OVERRIDE             0x20000000
388
389 struct nd_redirect {            /* redirect */
390         struct icmp6_hdr        nd_rd_hdr;
391         struct e_in6_addr               nd_rd_target;   /* target address */
392         struct e_in6_addr               nd_rd_dst;      /* destination address */
393         /* could be followed by options */
394 };
395
396 #define nd_rd_type              nd_rd_hdr.icmp6_type
397 #define nd_rd_code              nd_rd_hdr.icmp6_code
398 #define nd_rd_cksum             nd_rd_hdr.icmp6_cksum
399 #define nd_rd_reserved          nd_rd_hdr.icmp6_data32[0]
400
401 struct nd_opt_hdr {             /* Neighbor discovery option header */
402         guint8  nd_opt_type;
403         guint8  nd_opt_len;
404         /* followed by option specific data*/
405 };
406
407 #define ND_OPT_SOURCE_LINKADDR          1
408 #define ND_OPT_TARGET_LINKADDR          2
409 #define ND_OPT_PREFIX_INFORMATION       3
410 #define ND_OPT_REDIRECTED_HEADER        4
411 /* BT INSERT BEGIN */
412 #define ND_OPT_ADVERTISEMENT_INTERVAL   7
413 #define ND_OPT_HOME_AGENT_INFORMATION   8
414 /* BT INSERT END */
415 #define ND_OPT_MTU                      5
416
417 struct nd_opt_prefix_info {     /* prefix information */
418         guint8  nd_opt_pi_type;
419         guint8  nd_opt_pi_len;
420         guint8  nd_opt_pi_prefix_len;
421         guint8  nd_opt_pi_flags_reserved;
422         guint32 nd_opt_pi_valid_time;
423         guint32 nd_opt_pi_preferred_time;
424         guint32 nd_opt_pi_reserved2;
425         struct e_in6_addr       nd_opt_pi_prefix;
426 };
427
428 #define ND_OPT_PI_FLAG_ONLINK           0x80
429 #define ND_OPT_PI_FLAG_AUTO             0x40
430
431 struct nd_opt_rd_hdr {         /* redirected header */
432         guint8  nd_opt_rh_type;
433         guint8  nd_opt_rh_len;
434         guint16 nd_opt_rh_reserved1;
435         guint32 nd_opt_rh_reserved2;
436         /* followed by IP header and data */
437 };
438
439 struct nd_opt_mtu {             /* MTU option */
440         guint8  nd_opt_mtu_type;
441         guint8  nd_opt_mtu_len;
442         guint16 nd_opt_mtu_reserved;
443         guint32 nd_opt_mtu_mtu;
444 };
445 /* BT INSERT BEGIN */
446 struct nd_opt_adv_int {         /* Advertisement Interval option */
447         guint8  nd_opt_adv_int_type;
448         guint8  nd_opt_adv_int_len;
449         guint16 nd_opt_adv_int_reserved;
450         guint32 nd_opt_adv_int_advint;
451 };
452
453 struct nd_opt_ha_info {         /* Home Agent Information option */
454         guint8  nd_opt_ha_info_type;
455         guint8  nd_opt_ha_info_len;
456         guint16 nd_opt_ha_info_reserved;
457         guint16 nd_opt_ha_info_ha_pref;
458         guint16 nd_opt_ha_info_ha_life;
459 };
460
461 /* BT INSERT END */
462 /*
463  * icmp6 node information
464  */
465 struct icmp6_nodeinfo {
466         struct icmp6_hdr icmp6_ni_hdr;
467         guint8 icmp6_ni_nonce[8];
468         /* could be followed by reply data */
469 };
470
471 #define ni_type         icmp6_ni_hdr.icmp6_type
472 #define ni_code         icmp6_ni_hdr.icmp6_code
473 #define ni_cksum        icmp6_ni_hdr.icmp6_cksum
474 #define ni_qtype        icmp6_ni_hdr.icmp6_data16[0]
475 #define ni_flags        icmp6_ni_hdr.icmp6_data16[1]
476
477 #define NI_QTYPE_NOOP           0 /* NOOP  */
478 #define NI_QTYPE_SUPTYPES       1 /* Supported Qtypes */
479 #define NI_QTYPE_FQDN           2 /* FQDN (draft 04) */
480 #define NI_QTYPE_DNSNAME        2 /* DNS Name */
481 #define NI_QTYPE_NODEADDR       3 /* Node Addresses */
482 #define NI_QTYPE_IPV4ADDR       4 /* IPv4 Addresses */
483
484 #define NI_SUPTYPE_FLAG_COMPRESS        0x1
485 #define NI_FQDN_FLAG_VALIDTTL           0x1
486
487 #define NI_NODEADDR_FLAG_TRUNCATE       0x1
488 #define NI_NODEADDR_FLAG_ALL            0x2
489 #define NI_NODEADDR_FLAG_COMPAT         0x4
490 #define NI_NODEADDR_FLAG_LINKLOCAL      0x8
491 #define NI_NODEADDR_FLAG_SITELOCAL      0x10
492 #define NI_NODEADDR_FLAG_GLOBAL         0x20
493 #define NI_NODEADDR_FLAG_ANYCAST        0x40 /* just experimental. not in spec */
494
495 struct ni_reply_fqdn {
496         guint32 ni_fqdn_ttl;    /* TTL */
497         guint8  ni_fqdn_namelen; /* length in octets of the FQDN */
498         guint8  ni_fqdn_name[3]; /* XXX: alignment */
499 };
500
501 /*
502  * Router Renumbering. as router-renum-05.txt
503  */
504 struct icmp6_router_renum {     /* router renumbering header */
505         struct icmp6_hdr        rr_hdr;
506         guint8          rr_segnum;
507         guint8          rr_flags;
508         guint16         rr_maxdelay;
509         guint32         rr_reserved;
510 };
511
512 #define rr_type                 rr_hdr.icmp6_type
513 #define rr_code                 rr_hdr.icmp6_code
514 #define rr_cksum                rr_hdr.icmp6_cksum
515 #define rr_seqnum               rr_hdr.icmp6_data32[0]
516
517 struct rr_pco_match {           /* match prefix part */
518         guint8  rpm_code;
519         guint8  rpm_len;
520         guint8  rpm_ordinal;
521         guint8  rpm_matchlen;
522         guint8  rpm_minlen;
523         guint8  rpm_maxlen;
524         guint16 rpm_reserved;
525         struct e_in6_addr       rpm_prefix;
526 };
527
528 #define RPM_PCO_ADD             1
529 #define RPM_PCO_CHANGE          2
530 #define RPM_PCO_SETGLOBAL       3
531 #define RPM_PCO_MAX             4
532
533 struct rr_pco_use {             /* use prefix part */
534         guint8  rpu_uselen;
535         guint8  rpu_keeplen;
536         guint8  rpu_ramask;
537         guint8  rpu_raflags;
538         guint32 rpu_vltime;
539         guint32 rpu_pltime;
540         guint32 rpu_flags;
541         struct e_in6_addr rpu_prefix;
542 };
543
544 #define ICMP6_RR_PCOUSE_RAFLAGS_ONLINK  0x80
545 #define ICMP6_RR_PCOUSE_RAFLAGS_AUTO    0x40
546
547 /* network endian */
548 #define ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME        0x80000000
549 #define ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME        0x40000000
550
551 struct rr_result {              /* router renumbering result message */
552         guint16 rrr_flags;
553         guint8  rrr_ordinal;
554         guint8  rrr_matchedlen;
555         guint32 rrr_ifid;
556         struct e_in6_addr rrr_prefix;
557 };
558
559 /* network endian */
560 #define ICMP6_RR_RESULT_FLAGS_OOB               0x0002
561 #define ICMP6_RR_RESULT_FLAGS_FORBIDDEN         0x0001
562
563 #endif /* __PACKET_IPV6_H_DEFINED__ */