aboutsummaryrefslogtreecommitdiffstats
path: root/ethertype.c
diff options
context:
space:
mode:
authorGilbert Ramirez <gram@alumni.rice.edu>2000-04-13 18:18:56 +0000
committerGilbert Ramirez <gram@alumni.rice.edu>2000-04-13 18:18:56 +0000
commitdb187f965c6ca47932a009f3cb011770a687e289 (patch)
tree1d58b40531c9ca503d57229b9cc8c9bf394a2052 /ethertype.c
parent2fa56170d39e86f703ee0a6c5d3ddc1d14afa905 (diff)
downloadwireshark-db187f965c6ca47932a009f3cb011770a687e289.tar.gz
wireshark-db187f965c6ca47932a009f3cb011770a687e289.tar.bz2
wireshark-db187f965c6ca47932a009f3cb011770a687e289.zip
Change the sub-dissector handoff registration routines so that the
sub-dissector table is not stored in the header_field_info struct, but in a separate namespace. Dissector tables are now registered by name and not by field ID. For example: udp_dissector_table = register_dissector_table("udp.port"); Because of this different namespace, dissector tables can have names that are not field names. This is useful for ethertype, since multiple fields are "ethertypes". packet-ethertype.c replaces ethertype.c (the name was changed so that it would be named in the same fashion as all the filenames passed to make-reg-dotc) Although it registers no protocol or field, it registers one dissector table: ethertype_dissector_table = register_dissector_table("ethertype"); All protocols that can be called because of an ethertype field now register that fact with dissector_add() calls. In this way, one dissector_table services all ethertype fields (hf_eth_type, hf_llc_type, hf_null_etype, hf_vlan_etype) Furthermore, the code allows for names of protocols to exist in the etype_vals, yet a dissector for that protocol doesn't exist. The name of the dissector is printed in COL_INFO. You're welcome, Richard. :-) svn path=/trunk/; revision=1848
Diffstat (limited to 'ethertype.c')
-rw-r--r--ethertype.c158
1 files changed, 0 insertions, 158 deletions
diff --git a/ethertype.c b/ethertype.c
deleted file mode 100644
index 93344ec03b..0000000000
--- a/ethertype.c
+++ /dev/null
@@ -1,158 +0,0 @@
-/* ethertype.c
- * Routines for calling the right protocol for the ethertype.
- * This is called by both packet-eth.c (Ethernet II) and packet-llc.c (SNAP)
- *
- * $Id: ethertype.c,v 1.28 2000/03/09 18:31:50 ashokn Exp $
- *
- * Gilbert Ramirez <gram@xiexie.org>
- *
- * Ethereal - Network traffic analyzer
- * By Gerald Combs <gerald@zing.org>
- * Copyright 1998 Gerald Combs
- *
- *
- * 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.
- */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#ifdef HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#include <glib.h>
-#include "packet.h"
-#include "etypes.h"
-#include "packet-aarp.h"
-#include "packet-arp.h"
-#include "packet-atalk.h"
-#include "packet-ip.h"
-#include "packet-ipv6.h"
-#include "packet-ipx.h"
-#include "packet-pppoe.h"
-#include "packet-snmp.h"
-#include "packet-vines.h"
-#include "packet-vlan.h"
-#include "packet-x25.h"
-#include "packet-mpls.h"
-
-const value_string etype_vals[] = {
- {ETHERTYPE_IP, "IP" },
- {ETHERTYPE_IPv6, "IPv6" },
- {ETHERTYPE_X25L3, "X.25 Layer 3" },
- {ETHERTYPE_ARP, "ARP" },
- {ETHERTYPE_REVARP, "RARP" },
- {ETHERTYPE_ATALK, "Appletalk" },
- {ETHERTYPE_AARP, "AARP" },
- {ETHERTYPE_IPX, "Netware IPX/SPX"},
- {ETHERTYPE_VINES, "Vines" },
- {ETHERTYPE_TRAIN, "Netmon Train" },
- {ETHERTYPE_LOOP, "Loopback" }, /* Ethernet Loopback */
- {ETHERTYPE_PPPOED, "PPPoE Discovery"},
- {ETHERTYPE_PPPOES, "PPPoE Session" },
- {ETHERTYPE_VLAN, "802.1Q Virtual LAN" },
- {ETHERTYPE_MPLS, "MPLS label switched packet" },
- {ETHERTYPE_MPLS_MULTI, "MPLS multicast label switched packet" },
- {0, NULL } };
-
-void
-capture_ethertype(guint16 etype, int offset,
- const u_char *pd, packet_counts *ld)
-{
- switch (etype) {
- case ETHERTYPE_IP:
- capture_ip(pd, offset, ld);
- break;
- case ETHERTYPE_IPX:
- capture_ipx(pd, offset, ld);
- break;
- case ETHERTYPE_VLAN:
- capture_vlan(pd, offset, ld);
- break;
- case ETHERTYPE_VINES:
- capture_vines(pd, offset, ld);
- break;
- default:
- ld->other++;
- break;
- }
-}
-
-void
-ethertype(guint16 etype, int offset,
- const u_char *pd, frame_data *fd, proto_tree *tree, proto_tree
- *fh_tree, int item_id)
-{
- if (tree) {
- proto_tree_add_item(fh_tree, item_id, offset - 2, 2, etype);
- }
- switch (etype) {
- case ETHERTYPE_IP:
- dissect_ip(pd, offset, fd, tree);
- break;
- case ETHERTYPE_IPv6:
- dissect_ipv6(pd, offset, fd, tree);
- break;
- case ETHERTYPE_X25L3:
- dissect_x25(pd, offset, fd, tree);
- break;
- case ETHERTYPE_ARP:
- dissect_arp(pd, offset, fd, tree);
- break;
- case ETHERTYPE_REVARP:
- dissect_arp(pd, offset, fd, tree);
- break;
- case ETHERTYPE_ATALK:
- dissect_ddp(pd, offset, fd, tree);
- break;
- case ETHERTYPE_AARP:
- dissect_aarp(pd, offset, fd, tree);
- break;
- case ETHERTYPE_IPX:
- dissect_ipx(pd, offset, fd, tree);
- break;
- case ETHERTYPE_VINES:
- dissect_vines(pd, offset, fd, tree);
- break;
- case ETHERTYPE_LOOP:
- dissect_data(pd, offset, fd, tree);
- if (check_col(fd, COL_PROTOCOL)) { col_add_fstr(fd, COL_PROTOCOL, "LOOP"); }
- break;
- case ETHERTYPE_PPPOED:
- dissect_pppoed(pd, offset, fd, tree);
- break;
- case ETHERTYPE_PPPOES:
- dissect_pppoes(pd, offset, fd, tree);
- break;
- case ETHERTYPE_VLAN:
- dissect_vlan(pd, offset, fd, tree);
- break;
- case ETHERTYPE_SNMP:
- dissect_snmp(pd, offset, fd, tree);
- break;
- case ETHERTYPE_MPLS:
- dissect_mpls(pd, offset, fd, tree);
- break;
- default:
- dissect_data(pd, offset, fd, tree);
- if (check_col(fd, COL_PROTOCOL)) { col_add_fstr(fd, COL_PROTOCOL, "0x%04x", etype); }
- break;
- }
-}
-
-
-