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.24 2000/01/20 21:34:16 guy 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>
41 const value_string etype_vals[] = {
42 {ETHERTYPE_IP, "IP" },
43 {ETHERTYPE_IPv6, "IPv6" },
44 {ETHERTYPE_X25L3, "X.25 Layer 3" },
45 {ETHERTYPE_ARP, "ARP" },
46 {ETHERTYPE_REVARP, "RARP" },
47 {ETHERTYPE_ATALK, "Appletalk" },
48 {ETHERTYPE_AARP, "AARP" },
49 {ETHERTYPE_IPX, "Netware IPX/SPX"},
50 {ETHERTYPE_VINES, "Vines" },
51 {ETHERTYPE_TRAIN, "Netmon Train" },
52 {ETHERTYPE_LOOP, "Loopback" }, /* Ethernet Loopback */
53 {ETHERTYPE_PPPOED, "PPPoE Discovery"},
54 {ETHERTYPE_PPPOES, "PPPoE Session" },
55 {ETHERTYPE_VLAN, "802.1Q Virtual LAN" },
59 capture_ethertype(guint16 etype, int offset,
60 const u_char *pd, guint32 cap_len, packet_counts *ld)
64 capture_ip(pd, offset, cap_len, ld);
67 capture_ipx(pd, offset, cap_len, ld);
70 capture_vlan(pd, offset, cap_len, ld);
73 capture_vines(pd, offset, cap_len, ld);
82 ethertype(guint16 etype, int offset,
83 const u_char *pd, frame_data *fd, proto_tree *tree, proto_tree
84 *fh_tree, int item_id)
87 proto_tree_add_item(fh_tree, item_id, offset - 2, 2, etype);
91 dissect_ip(pd, offset, fd, tree);
94 dissect_ipv6(pd, offset, fd, tree);
97 dissect_x25(pd, offset, fd, tree);
100 dissect_arp(pd, offset, fd, tree);
102 case ETHERTYPE_REVARP:
103 dissect_arp(pd, offset, fd, tree);
105 case ETHERTYPE_ATALK:
106 dissect_ddp(pd, offset, fd, tree);
109 dissect_aarp(pd, offset, fd, tree);
112 dissect_ipx(pd, offset, fd, tree);
114 case ETHERTYPE_VINES:
115 dissect_vines(pd, offset, fd, tree);
118 dissect_data(pd, offset, fd, tree);
119 if (check_col(fd, COL_PROTOCOL)) { col_add_fstr(fd, COL_PROTOCOL, "LOOP"); }
121 case ETHERTYPE_PPPOED:
122 dissect_pppoed(pd, offset, fd, tree);
124 case ETHERTYPE_PPPOES:
125 dissect_pppoes(pd, offset, fd, tree);
128 dissect_vlan(pd, offset, fd, tree);
131 dissect_snmp(pd, offset, fd, tree);
134 dissect_data(pd, offset, fd, tree);
135 if (check_col(fd, COL_PROTOCOL)) { col_add_fstr(fd, COL_PROTOCOL, "0x%04x", etype); }