/* packet-ipv6.h
- * Definitions for IPv6 packet disassembly
+ * Definitions for IPv6 packet disassembly
*
- * $Id: packet-ipv6.h,v 1.17 2000/12/14 08:35:07 guy Exp $
+ * $Id: packet-ipv6.h,v 1.31 2003/11/22 08:35:45 guy Exp $
*
* Ethereal - Network traffic analyzer
- * By Gerald Combs <gerald@zing.org>
+ * By Gerald Combs <gerald@ethereal.com>
+ *
* Copyright 1998 Gerald Combs
*
- *
+ * MobileIPv6 support added by Tomislav Borosa <tomislav.borosa@siemens.hr>
+ *
+ * HMIPv6 support added by Martti Kuparinen <martti.kuparinen@iki.fi>
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef __PACKET_IPV6_H_DEFINED__
#define __PACKET_IPV6_H_DEFINED__
-void dissect_ipv6(const u_char *, int, frame_data *, proto_tree *);
-
-struct e_in6_addr {
- union {
- guint32 u6_addr32[4];
- guint16 u6_addr16[8];
- guint8 u6_addr8[16];
- } u6_addr; /* 128 bit IP6 address */
-};
-
-#ifdef s6_addr32
-#undef s6_addr32
-#endif
-
-#ifdef s6_addr16
-#undef s6_addr16
-#endif
-
-#ifdef s6_addr8
-#undef s6_addr8
-#endif
-
-#ifdef s6_addr
-#undef s6_addr
-#endif
-
-#define s6_addr32 u6_addr.u6_addr32
-#define s6_addr16 u6_addr.u6_addr16
-#define s6_addr8 u6_addr.u6_addr8
-#define s6_addr u6_addr.u6_addr8
+#include <epan/ipv6-utils.h>
#define INET6_ADDRSTRLEN 46
*/
struct ip6_ext {
- u_char ip6e_nxt;
- u_char ip6e_len;
+ guchar ip6e_nxt;
+ guchar ip6e_len;
};
/* Hop-by-Hop options header */
#define IP6OPT_JUMBO 0xC2 /* 11 0 00010 = 194 */
#define IP6OPT_JUMBO_LEN 6
#define IP6OPT_RTALERT 0x05 /* 00 0 00101 */
+
#define IP6OPT_RTALERT_LEN 4
#define IP6OPT_RTALERT_MLD 0 /* Datagram contains MLD message */
#define IP6OPT_RTALERT_RSVP 1 /* Datagram contains RSVP message */
+#define IP6OPT_RTALERT_ACTNET 2 /* contains an Active Networks msg */
#define IP6OPT_MINLEN 2
+#define IP6OPT_HOME_ADDRESS 0xC9 /* 11 0 01001 */
+
#define IP6OPT_TYPE(o) ((o) & 0xC0)
#define IP6OPT_TYPE_SKIP 0x00
#define IP6OPT_TYPE_DISCARD 0x40
#define IP6F_RESERVED_MASK 0x0006 /* reserved bits in ip6f_offlg */
#define IP6F_MORE_FRAG 0x0001 /* more-fragments flag */
-/*
- * Mobile IPv6
- */
-#define IP6OPT_BINDING_UPDATE 0xC6 /* 11 0 00110 */
-#define IP6OPT_BINDING_ACK 0x07 /* 00 0 00111 */
-#define IP6OPT_BINDING_REQ 0x08 /* 00 0 01000 */
-#define IP6OPT_HOME_ADDRESS 0xC9 /* 11 0 01001 */
-#define IP6OPT_EID 0x8A /* 10 0 01010 */
-#define IP6SUBOPT_UNIQUE_ID 0x02 /* Unique Id */
-#define IP6SUBOPT_ALTERNATE_COA 0x04 /* Alternate CoA */
-
-/* Binding Update Option */
-struct ip6_opt_binding_update {
- guint8 ip6bu_type;
- guint8 ip6bu_len;
- guint8 ip6bu_flags;
-#define IP6_BU_ACK 0x80 /* Request a binding ack */
-#define IP6_BU_HOME 0x40 /* Home Registration */
-#define IP6_BU_COA 0x20 /* Care-of-address present in option */
-#define IP6_BU_ROUTER 0x10 /* Sending mobile node is a router */
- guint8 ip6bu_prefixlen;
- guint16 ip6bu_seqno;
- guint32 ip6bu_lifetime;
- /* followed by sub-options */
-};
-
-/* Binding Ack Option */
-struct ip6_opt_binding_ack {
- guint8 ip6ba_type;
- guint8 ip6ba_len;
- guint8 ip6ba_status;
-#define IP6_BINDING_ACK_OK 0 /* Binding Update accepted */
-#define IP6_BINDING_ACK_EUNKNOWN 128 /* Reason unspecified */
-#define IP6_BINDING_ACK_EPERM 130 /* Administratively prohib. */
-#define IP6_BINDING_ACK_EAGAIN 131 /* Insufficient resources */
-#define IP6_BINDING_ACK_EHOMENOSUPPORT 132 /* Home registration */
-#define IP6_BINDING_ACK_ENOTHOMESUBNET 133 /* Not home subnet */
-#define IP6_BINDING_ACK_EBADIFLEN 136 /* Incorrect interface id len */
-#define IP6_BINDING_ACK_ENOTHOME 137 /* Not home agent for this MN */
- guint16 ip6ba_seqno;
- guint32 ip6ba_lifetime;
- guint32 ip6ba_refresh;
- /* followed by sub-options */
-};
-
-/* Binding Request Option */
-struct ip6_opt_binding_request {
- guint8 ip6br_type;
- guint8 ip6br_len;
- /* followed by sub-options */
-};
-
-/* Home Address Option */
-struct ip6_opt_home_address {
- guint8 ip6ha_type;
- guint8 ip6ha_len;
- struct e_in6_addr ip6ha_ha; /* Home Address */
- /* followed by sub-options */
-};
-
-/* Unique Identifier sub-option */
-struct ip6_subopt_unique_id {
- guint8 ip6ui_type;
- guint8 ip6ui_len;
- guint16 ip6ui_id; /* Unique Identifier */
-};
-
-/* Alternate CoA sub-option */
-struct ip6_subopt_alternate_coa {
- guint8 ip6acoa_type;
- guint8 ip6acoa_len;
- struct e_in6_addr coa; /* Alternate CoA */
-};
-
-
/*
* Definition for ICMPv6.
* RFC 1885
#define MLD6_MTRACE_RESP 141 /* mtrace response(to sender) */
#define MLD6_MTRACE 142 /* mtrace messages */
-#define ICMP6_MAXTYPE 142
+#define ICMP6_MIP6_DHAAD_REQUEST 144 /* Mobile IPv6 DHAAD */
+#define ICMP6_MIP6_DHAAD_REPLY 145 /* Mobile IPv6 DHAAD */
+#define ICMP6_MIP6_MPS 146 /* Mobile IPv6 MPS */
+#define ICMP6_MIP6_MPA 147 /* Mobile IPv6 MPA */
+
+#define ICMP6_MAXTYPE 153
#define ICMP6_DST_UNREACH_NOROUTE 0 /* no route to destination */
#define ICMP6_DST_UNREACH_ADMIN 1 /* administratively prohibited */
#define nd_ra_flags_reserved nd_ra_hdr.icmp6_data8[1]
#define ND_RA_FLAG_MANAGED 0x80
#define ND_RA_FLAG_OTHER 0x40
+#define ND_RA_FLAG_HOME_AGENT 0x20
+
+/*
+ * Router preference values based on draft-draves-ipngwg-router-selection-01.
+ * These are non-standard definitions.
+ */
+#define ND_RA_FLAG_RTPREF_MASK 0x18 /* 00011000 */
+
+#define ND_RA_FLAG_RTPREF_HIGH 0x08 /* 00001000 */
+#define ND_RA_FLAG_RTPREF_MEDIUM 0x00 /* 00000000 */
+#define ND_RA_FLAG_RTPREF_LOW 0x18 /* 00011000 */
+#define ND_RA_FLAG_RTPREF_RSV 0x10 /* 00010000 */
+
#define nd_ra_router_lifetime nd_ra_hdr.icmp6_data16[1]
struct nd_neighbor_solicit { /* neighbor solicitation */
#define ND_OPT_PREFIX_INFORMATION 3
#define ND_OPT_REDIRECTED_HEADER 4
#define ND_OPT_MTU 5
+#define ND_OPT_ADVINTERVAL 7
+#define ND_OPT_HOMEAGENT_INFO 8
+#define ND_OPT_SOURCE_ADDRLIST 9
+#define ND_OPT_TARGET_ADDRLIST 10
+
+/* draft-ietf-ipngwg-router-preference, not officially assigned yet */
+#define ND_OPT_ROUTE_INFO 200
+/* draft-ietf-mobileip-hmipv6, not officially assigned yet */
+#define ND_OPT_MAP 201
struct nd_opt_prefix_info { /* prefix information */
guint8 nd_opt_pi_type;
#define ND_OPT_PI_FLAG_ONLINK 0x80
#define ND_OPT_PI_FLAG_AUTO 0x40
+#define ND_OPT_PI_FLAG_ROUTER 0x20
+#define ND_OPT_PI_FLAG_SITEPREF 0x10
struct nd_opt_rd_hdr { /* redirected header */
guint8 nd_opt_rh_type;
guint32 nd_opt_mtu_mtu;
};
+struct nd_opt_adv_int { /* Advertisement Interval option */
+ guint8 nd_opt_adv_int_type;
+ guint8 nd_opt_adv_int_len;
+ guint16 nd_opt_adv_int_reserved;
+ guint32 nd_opt_adv_int_advint;
+};
+
+struct nd_opt_ha_info { /* Home Agent Information option */
+ guint8 nd_opt_ha_info_type;
+ guint8 nd_opt_ha_info_len;
+ guint16 nd_opt_ha_info_reserved;
+ guint16 nd_opt_ha_info_ha_pref;
+ guint16 nd_opt_ha_info_ha_life;
+};
+
+struct nd_opt_route_info { /* route info */
+ guint8 nd_opt_rti_type;
+ guint8 nd_opt_rti_len;
+ guint8 nd_opt_rti_prefixlen;
+ guint8 nd_opt_rti_flags;
+ guint32 nd_opt_rti_lifetime;
+ /* prefix follows */
+};
+
+struct nd_opt_map_info { /* HMIPv6 MAP option */
+ guint8 nd_opt_map_type;
+ guint8 nd_opt_map_len;
+ guint8 nd_opt_map_dist_and_pref;
+ guint8 nd_opt_map_flags;
+ guint32 nd_opt_map_lifetime;
+ struct e_in6_addr nd_opt_map_address;
+};
+
+#define ND_OPT_MAP_FLAG_R 0x80
+#define ND_OPT_MAP_FLAG_M 0x40
+#define ND_OPT_MAP_FLAG_I 0x20
+#define ND_OPT_MAP_FLAG_T 0x10
+#define ND_OPT_MAP_FLAG_P 0x08
+#define ND_OPT_MAP_FLAG_V 0x04
+
/*
* icmp6 node information
*/
#define ICMP6_RR_RESULT_FLAGS_OOB 0x0002
#define ICMP6_RR_RESULT_FLAGS_FORBIDDEN 0x0001
+void capture_ipv6(const guchar *, int, int, packet_counts *);
+
+
#endif /* __PACKET_IPV6_H_DEFINED__ */