2 * Routines for calling the right protocol for the ethertype.
3 * This is called by both packet-eth.c (Ethernet II) and packet-llc.c (SNAP)
5 * $Id: ethertype.c,v 1.6 1998/10/16 01:18:28 gerald Exp $
7 * Gilbert Ramirez <gram@verdict.uthscsa.edu>
9 * Ethereal - Network traffic analyzer
10 * By Gerald Combs <gerald@zing.org>
11 * Copyright 1998 Gerald Combs
14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License
16 * as published by the Free Software Foundation; either version 2
17 * of the License, or (at your option) any later version.
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
33 #ifdef HAVE_SYS_TYPES_H
34 # include <sys/types.h>
48 ethertype(guint16 etype, int offset,
49 const u_char *pd, frame_data *fd, GtkTree *tree, GtkWidget
52 gchar etype_str[][10] = {"IP", "ARP", "RARP", "AppleTalk", "AARP"};
57 add_item_to_tree(fh_tree, offset - 2, 2, "Type: IP (0x%04x)",
60 dissect_ip(pd, offset, fd, tree);
64 add_item_to_tree(fh_tree, offset - 2, 2, "Type: IPv6 (0x%04x)",
67 dissect_ipv6(pd, offset, fd, tree);
71 add_item_to_tree(fh_tree, offset - 2, 2,
72 "Type: ARP (0x%04x)", etype);
74 dissect_arp(pd, offset, fd, tree);
76 case ETHERTYPE_REVARP:
78 add_item_to_tree(fh_tree, offset - 2, 2,
79 "Type: RARP (0x%04x)", etype);
81 dissect_arp(pd, offset, fd, tree);
85 add_item_to_tree(fh_tree, offset - 2, 2,
86 "Type: AppleTalk (0x%04x)", etype);
88 dissect_ddp(pd, offset, fd, tree);
92 add_item_to_tree(fh_tree, offset - 2, 2,
93 "Type: AARP (0x%04x)", etype);
95 dissect_aarp(pd, offset, fd, tree);
99 add_item_to_tree(fh_tree, offset - 2, 2,
100 "Type: Netware IPX/SPX (0x%04x)", etype);
102 dissect_ipx(pd, offset, fd, tree);
104 case ETHERTYPE_VINES:
106 add_item_to_tree(fh_tree, offset - 2, 2,
107 "Type Vines (0x%04x)", etype);
109 dissect_vines(pd, offset, fd, tree);
113 add_item_to_tree(fh_tree, offset - 2, 2,
114 "Type: Unknown (0x%04x)", etype);
115 dissect_data(pd, offset, fd, tree);
117 if (fd->win_info[COL_NUM]) { sprintf(fd->win_info[COL_PROTOCOL], "0x%04x", etype); }