2 * Routines for IPv6 packet disassembly
4 * $Id: packet-ipv6.c,v 1.4 1998/11/12 00:06:29 gram Exp $
6 * Ethereal - Network traffic analyzer
7 * By Gerald Combs <gerald@zing.org>
8 * Copyright 1998 Gerald Combs
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 2
14 * of the License, or (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
34 #ifdef HAVE_SYS_TYPES_H
35 # include <sys/types.h>
38 #ifdef HAVE_NETINET_IN_H
39 # include <netinet/in.h>
44 #include "packet-ipv6.h"
48 dissect_ipv6(const u_char *pd, int offset, frame_data *fd, GtkTree *tree) {
49 GtkWidget *ipv6_tree, *ti;
53 memcpy(&ipv6, (void *) &pd[offset], 8);
55 if (fd->win_info[COL_NUM]) {
56 switch(ipv6.next_header){
64 /* Names are set in the associated dissect_* routines */
67 strcpy(fd->win_info[COL_PROTOCOL], "IPv6");
68 sprintf(fd->win_info[COL_INFO], "IPv6 support is still under development (%d)", ipv6.next_header);
72 /* !!! specify length */
73 ti = add_item_to_tree(GTK_WIDGET(tree), offset, 40,
74 "Internet Protocol Version 6");
75 ipv6_tree = gtk_tree_new();
76 add_subtree(ti, ipv6_tree, ETT_IPv6);
78 /* !!! warning: version also contains 4 Bit priority */
79 add_item_to_tree(ipv6_tree, offset, 1, "Version: %d Priority: %d", ipv6.version >> 4 , ipv6.version & 15);
80 add_item_to_tree(ipv6_tree, offset + 6, 1, "Next Header: %d", ipv6.next_header);
81 add_item_to_tree(ipv6_tree, offset + 4, 2, "Payload Length: %d", ntohs(ipv6.payload_length));
84 /* start of the new header (could be a extension header) */
86 switch (ipv6.next_header) {
88 dissect_icmp(pd, offset, fd, tree);
91 dissect_igmp(pd, offset, fd, tree);
94 dissect_tcp(pd, offset, fd, tree);
97 dissect_udp(pd, offset, fd, tree);
100 dissect_ospf(pd, offset, fd, tree);
103 dissect_data(pd, offset, fd, tree);