2007-01-20 16:46:42 +00:00
|
|
|
/* packet-ethertype.c
|
2009-05-05 21:05:06 +00:00
|
|
|
* Routines for processing Ethernet payloads and payloads like Ethernet
|
|
|
|
* payloads (i.e., payloads when there could be an Ethernet trailer and
|
|
|
|
* possibly an FCS).
|
1998-09-16 02:39:15 +00:00
|
|
|
*
|
2001-11-13 23:55:44 +00:00
|
|
|
* Gilbert Ramirez <gram@alumni.rice.edu>
|
1998-09-16 02:39:15 +00:00
|
|
|
*
|
2006-05-21 04:49:01 +00:00
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
1998-09-16 02:39:15 +00:00
|
|
|
* Copyright 1998 Gerald Combs
|
2002-08-28 21:04:11 +00:00
|
|
|
*
|
1998-09-16 02:39:15 +00:00
|
|
|
* 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.
|
2002-08-28 21:04:11 +00:00
|
|
|
*
|
1998-09-16 02:39:15 +00:00
|
|
|
* 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.
|
2002-08-28 21:04:11 +00:00
|
|
|
*
|
1998-09-16 02:39:15 +00:00
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2007-01-20 16:46:42 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
1998-09-16 02:39:15 +00:00
|
|
|
*/
|
|
|
|
|
2012-09-20 02:03:38 +00:00
|
|
|
#include "config.h"
|
1998-09-16 02:39:15 +00:00
|
|
|
|
1999-03-23 03:14:46 +00:00
|
|
|
#include <glib.h>
|
2002-01-21 07:37:49 +00:00
|
|
|
#include <epan/packet.h>
|
2013-11-10 15:59:37 +00:00
|
|
|
#include <epan/exceptions.h>
|
Move show_exception() and show_reported_bounds_error() to
epan/show_exception.c, as it's used outside
epan/dissectors/packet-frame.c. Update their callers to include
<epan/show_exception.h> to get their declaration.
Add a CATCH_NONFATAL_ERRORS macro that catches all exceptions that, if
there's more stuff in the packet to dissect after the dissector call
that threw the exception, doesn't mean you shouldn't go ahead and
dissect that stuff. Use it in all those cases, including ones where
BoundsError was inappropriately being caught (you want those passed up
to the top level, so that the packet is reported as having been cut
short in the capture process).
Add a CATCH_BOUNDS_ERRORS macro that catches all exceptions that
correspond to running past the end of the data for a tvbuff; use it
rather than explicitly catching those exceptions individually, and
rather than just catching all exceptions (the only place that
DissectorError should be caught, for example, is at the top level, so
dissector bugs show up in the protocol tree).
Don't catch and then immediately rethrow exceptions without doing
anything else; just let the exceptions go up to the final catcher.
Use show_exception() to report non-fatal errors, rather than doing it
yourself.
If a dissector is called from Lua, catch all non-fatal errors and use
show_exception() to report them rather than catching only
ReportedBoundsError and adding a proto_malformed item.
Don't catch exceptions when constructing a trailer tvbuff in
packet-ieee8023.c - just construct it after the payload has been
dissected, and let whatever exceptions that throws be handled at the top
level.
Avoid some TRY/CATCH/ENDTRY cases by using checks such as
tvb_bytes_exist() before even looking in the tvbuff.
svn path=/trunk/; revision=47924
2013-02-27 22:43:54 +00:00
|
|
|
#include <epan/etypes.h>
|
|
|
|
#include <epan/ppptypes.h>
|
|
|
|
#include <epan/show_exception.h>
|
2013-11-20 19:17:08 +00:00
|
|
|
#include <epan/decode_as.h>
|
2012-08-02 23:55:42 +00:00
|
|
|
#include "packet-bpq.h"
|
2003-08-21 21:05:30 +00:00
|
|
|
#include "packet-eth.h"
|
2000-04-13 19:38:55 +00:00
|
|
|
#include "packet-ip.h"
|
2002-10-22 22:04:23 +00:00
|
|
|
#include "packet-ipv6.h"
|
2000-04-13 19:38:55 +00:00
|
|
|
#include "packet-ipx.h"
|
2011-09-23 11:01:13 +00:00
|
|
|
#include "packet-vlan.h"
|
2007-08-17 21:21:18 +00:00
|
|
|
#include "packet-ieee8021ah.h"
|
2000-04-13 19:38:55 +00:00
|
|
|
#include "packet-vines.h"
|
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
2000-04-13 18:18:56 +00:00
|
|
|
|
2013-03-17 09:11:21 +00:00
|
|
|
|
|
|
|
void proto_register_ethertype(void);
|
|
|
|
void proto_reg_handoff_ethertype(void);
|
|
|
|
|
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
2000-04-13 18:18:56 +00:00
|
|
|
static dissector_table_t ethertype_dissector_table;
|
1998-09-16 02:39:15 +00:00
|
|
|
|
2001-11-26 04:52:51 +00:00
|
|
|
static dissector_handle_t data_handle;
|
|
|
|
|
2013-11-20 02:28:14 +00:00
|
|
|
static int proto_ethertype = -1;
|
|
|
|
|
1999-07-07 22:52:57 +00:00
|
|
|
const value_string etype_vals[] = {
|
2012-04-26 16:05:05 +00:00
|
|
|
{ ETHERTYPE_IP, "IP" },
|
|
|
|
{ ETHERTYPE_IPv6, "IPv6" },
|
|
|
|
{ ETHERTYPE_VLAN, "802.1Q Virtual LAN" },
|
|
|
|
{ ETHERTYPE_ARP, "ARP" },
|
|
|
|
{ ETHERTYPE_WLCCP, "Cisco Wireless Lan Context Control Protocol" },
|
2013-10-18 13:09:22 +00:00
|
|
|
{ ETHERTYPE_MINT, "Motorola Media Indepentent Network Transport" },
|
2012-04-26 16:05:05 +00:00
|
|
|
{ ETHERTYPE_CENTRINO_PROMISC, "IEEE 802.11 (Centrino promiscuous)" },
|
|
|
|
{ ETHERTYPE_XNS_IDP, "XNS Internet Datagram Protocol" },
|
|
|
|
{ ETHERTYPE_X25L3, "X.25 Layer 3" },
|
|
|
|
{ ETHERTYPE_WOL, "Wake on LAN" },
|
|
|
|
{ ETHERTYPE_WMX_M2M, "WiMax Mac-to-Mac" },
|
|
|
|
{ ETHERTYPE_EPL_V1, "EPL_V1" },
|
|
|
|
{ ETHERTYPE_REVARP, "RARP" },
|
|
|
|
{ ETHERTYPE_DEC_LB, "DEC LanBridge" },
|
|
|
|
{ ETHERTYPE_ATALK, "Appletalk" },
|
|
|
|
{ ETHERTYPE_SNA, "SNA-over-Ethernet" },
|
|
|
|
{ ETHERTYPE_DLR, "EtherNet/IP Device Level Ring" },
|
|
|
|
{ ETHERTYPE_AARP, "AARP" },
|
|
|
|
{ ETHERTYPE_IPX, "Netware IPX/SPX" },
|
|
|
|
{ ETHERTYPE_VINES_IP, "Vines IP" },
|
|
|
|
{ ETHERTYPE_VINES_ECHO, "Vines Echo" },
|
|
|
|
{ ETHERTYPE_TRAIN, "Netmon Train" },
|
|
|
|
/* Ethernet Loopback */
|
|
|
|
{ ETHERTYPE_LOOP, "Loopback" },
|
|
|
|
{ ETHERTYPE_FOUNDRY, "Foundry proprietary" },
|
|
|
|
{ ETHERTYPE_WCP, "Wellfleet Compression Protocol" },
|
|
|
|
{ ETHERTYPE_STP, "Spanning Tree Protocol" },
|
|
|
|
/* for ISMP, see RFC 2641, RFC 2642, RFC 2643 */
|
|
|
|
{ ETHERTYPE_ISMP, "Cabletron Interswitch Message Protocol" },
|
|
|
|
{ ETHERTYPE_ISMP_TBFLOOD, "Cabletron SFVLAN 1.8 Tag-Based Flood" },
|
|
|
|
/* In www.iana.org/assignments/ethernet-numbers, 8203-8205 description is
|
|
|
|
* Quantum Software. Now the company is called QNX Software Systems. */
|
|
|
|
{ ETHERTYPE_QNX_QNET6, "QNX 6 QNET protocol" },
|
|
|
|
{ ETHERTYPE_PPPOED, "PPPoE Discovery" },
|
|
|
|
{ ETHERTYPE_PPPOES, "PPPoE Session" },
|
|
|
|
{ ETHERTYPE_INTEL_ANS, "Intel ANS probe" },
|
|
|
|
{ ETHERTYPE_MS_NLB_HEARTBEAT, "MS NLB heartbeat" },
|
|
|
|
{ ETHERTYPE_JUMBO_LLC, "Jumbo LLC" },
|
|
|
|
{ ETHERTYPE_HOMEPLUG, "Homeplug" },
|
|
|
|
{ ETHERTYPE_HOMEPLUG_AV, "Homeplug AV" },
|
|
|
|
{ ETHERTYPE_IEEE_802_1AD, "802.1ad Provider Bridge (Q-in-Q)" },
|
|
|
|
{ ETHERTYPE_IEEE_802_1AH, "802.1ah Provider Backbone Bridge (mac-in-mac)" },
|
|
|
|
{ ETHERTYPE_EAPOL, "802.1X Authentication" },
|
|
|
|
{ ETHERTYPE_RSN_PREAUTH, "802.11i Pre-Authentication" },
|
|
|
|
{ ETHERTYPE_MPLS, "MPLS label switched packet" },
|
|
|
|
{ ETHERTYPE_MPLS_MULTI, "MPLS multicast label switched packet" },
|
|
|
|
{ ETHERTYPE_3C_NBP_DGRAM, "3Com NBP Datagram" },
|
|
|
|
{ ETHERTYPE_DEC, "DEC proto" },
|
|
|
|
{ ETHERTYPE_DNA_DL, "DEC DNA Dump/Load" },
|
|
|
|
{ ETHERTYPE_DNA_RC, "DEC DNA Remote Console" },
|
|
|
|
{ ETHERTYPE_DNA_RT, "DEC DNA Routing" },
|
|
|
|
{ ETHERTYPE_LAT, "DEC LAT" },
|
|
|
|
{ ETHERTYPE_DEC_DIAG, "DEC Diagnostics" },
|
|
|
|
{ ETHERTYPE_DEC_CUST, "DEC Customer use" },
|
|
|
|
{ ETHERTYPE_DEC_SCA, "DEC LAVC/SCA" },
|
|
|
|
{ ETHERTYPE_DEC_LAST, "DEC LAST" },
|
|
|
|
{ ETHERTYPE_ETHBRIDGE, "Transparent Ethernet bridging" },
|
|
|
|
{ ETHERTYPE_CGMP, "Cisco Group Management Protocol" },
|
|
|
|
{ ETHERTYPE_GIGAMON, "Gigamon Header" },
|
|
|
|
{ ETHERTYPE_MSRP, "802.1Qat Multiple Stream Reservation Protocol" },
|
|
|
|
{ ETHERTYPE_MMRP, "802.1ak Multiple Mac Registration Protocol" },
|
|
|
|
{ ETHERTYPE_AVBTP, "IEEE 1722 Audio Video Bridging Transport Protocol" },
|
|
|
|
{ ETHERTYPE_ROHC, "Robust Header Compression(RoHC)" },
|
2012-07-20 06:26:35 +00:00
|
|
|
{ ETHERTYPE_TRILL, "TRansparent Interconnection of Lots of Links" },
|
|
|
|
{ ETHERTYPE_L2ISIS, "Intermediate System to Intermediate System" },
|
2012-04-26 16:05:05 +00:00
|
|
|
{ ETHERTYPE_MAC_CONTROL, "MAC Control" },
|
|
|
|
{ ETHERTYPE_SLOW_PROTOCOLS, "Slow Protocols" },
|
|
|
|
{ ETHERTYPE_RTMAC, "Real-Time Media Access Control" },
|
|
|
|
{ ETHERTYPE_RTCFG, "Real-Time Configuration Protocol" },
|
|
|
|
{ ETHERTYPE_CDMA2000_A10_UBS, "CDMA2000 A10 Unstructured byte stream" },
|
2012-11-06 19:56:37 +00:00
|
|
|
{ ETHERTYPE_ATMOE, "ATM over Ethernet" },
|
2012-04-26 16:05:05 +00:00
|
|
|
{ ETHERTYPE_PROFINET, "PROFINET"},
|
|
|
|
{ ETHERTYPE_AOE, "ATA over Ethernet" },
|
|
|
|
{ ETHERTYPE_ECATF, "EtherCAT frame" },
|
|
|
|
{ ETHERTYPE_TELKONET, "Telkonet powerline" },
|
|
|
|
{ ETHERTYPE_EPL_V2, "ETHERNET Powerlink v2" },
|
|
|
|
{ ETHERTYPE_XIMETA, "XiMeta Technology" },
|
|
|
|
{ ETHERTYPE_CSM_ENCAPS, "CSM_ENCAPS Protocol" },
|
|
|
|
{ ETHERTYPE_IEEE802_OUI_EXTENDED, "IEEE 802a OUI Extended Ethertype" },
|
|
|
|
{ ETHERTYPE_IEC61850_GOOSE, "IEC 61850/GOOSE" },
|
|
|
|
{ ETHERTYPE_IEC61850_GSE, "IEC 61850/GSE management services" },
|
|
|
|
{ ETHERTYPE_IEC61850_SV, "IEC 61850/SV (Sampled Value Transmission" },
|
|
|
|
{ ETHERTYPE_TIPC, "Transparent Inter Process Communication" },
|
|
|
|
{ ETHERTYPE_LLDP, "802.1 Link Layer Discovery Protocol (LLDP)" },
|
|
|
|
{ ETHERTYPE_3GPP2, "CDMA2000 A10 3GPP2 Packet" },
|
|
|
|
{ ETHERTYPE_TTE_PCF, "TTEthernet Protocol Control Frame" },
|
2012-07-20 06:26:35 +00:00
|
|
|
{ ETHERTYPE_CESOETH, "Circuit Emulation Services over Ethernet (MEF8)" },
|
2012-04-26 16:05:05 +00:00
|
|
|
{ ETHERTYPE_LLTD, "Link Layer Topology Discovery (LLTD)" },
|
|
|
|
{ ETHERTYPE_WSMP, "(WAVE) Short Message Protocol (WSM)" },
|
|
|
|
{ ETHERTYPE_VMLAB, "VMware Lab Manager" },
|
|
|
|
{ ETHERTYPE_COBRANET, "Cirrus Cobranet Packet" },
|
|
|
|
{ ETHERTYPE_NSRP, "Juniper Netscreen Redundant Protocol" },
|
|
|
|
/*
|
|
|
|
* NDISWAN on Windows translates Ethernet frames from higher-level
|
|
|
|
* protocols into PPP frames to hand to the PPP driver, and translates
|
|
|
|
* PPP frames from the PPP driver to hand to the higher-level protocols.
|
|
|
|
*
|
|
|
|
* Apparently the PPP driver, on at least some versions of Windows,
|
|
|
|
* passes frames for internal-to-PPP protocols up through NDISWAN;
|
|
|
|
* the protocol type field appears to be passed through unchanged
|
|
|
|
* (unlike what's done with, for example, the protocol type field
|
|
|
|
* for IP, which is mapped from its PPP value to its Ethernet value).
|
|
|
|
*
|
|
|
|
* This means that we may see, on Ethernet captures, frames for
|
|
|
|
* protocols internal to PPP, so we list as "Ethernet" protocol
|
|
|
|
* types the PPP protocol types we've seen.
|
|
|
|
*/
|
|
|
|
{ PPP_IPCP, "PPP IP Control Protocol" },
|
|
|
|
{ PPP_LCP, "PPP Link Control Protocol" },
|
|
|
|
{ PPP_PAP, "PPP Password Authentication Protocol" },
|
|
|
|
{ PPP_CCP, "PPP Compression Control Protocol" },
|
|
|
|
{ ETHERTYPE_LLT, "Veritas Low Latency Transport (not officially registered)" },
|
|
|
|
{ ETHERTYPE_CFM, "IEEE 802.1ag Connectivity Fault Management (CFM) protocol" },
|
|
|
|
{ ETHERTYPE_DCE, "Data Center Ethernet (DCE) protocol(Cisco)" },
|
|
|
|
{ ETHERTYPE_FCOE, "Fibre Channel over Ethernet" },
|
|
|
|
{ ETHERTYPE_IEEE80211_DATA_ENCAP, "IEEE 802.11 data encapsulation" },
|
|
|
|
{ ETHERTYPE_LINX, "LINX IPC Protocol" },
|
|
|
|
{ ETHERTYPE_FIP, "FCoE Initialization Protocol" },
|
2012-12-27 11:19:46 +00:00
|
|
|
{ ETHERTYPE_MIH, "Media Independent Handover Protocol" },
|
2012-07-20 06:26:35 +00:00
|
|
|
{ ETHERTYPE_ELMI, "Ethernet Local Management Interface (MEF16)" },
|
2012-04-26 16:05:05 +00:00
|
|
|
{ ETHERTYPE_PTP, "PTPv2 over Ethernet (IEEE1588)" },
|
2013-02-16 10:31:20 +00:00
|
|
|
{ ETHERTYPE_NCSI, "Network Controller Sideband Interface" },
|
2012-04-26 16:05:05 +00:00
|
|
|
{ ETHERTYPE_PRP, "Parallel Redundancy Protocol (PRP) and HSR Supervision (IEC62439 Part 3)" },
|
|
|
|
{ ETHERTYPE_FLIP, "Flow Layer Internal Protocol" },
|
|
|
|
{ ETHERTYPE_ROCE, "RDMA over Converged Ethernet" },
|
|
|
|
{ ETHERTYPE_TDMOE, "Digium TDM over Ethernet Protocol" },
|
|
|
|
{ ETHERTYPE_WAI, "WAI Authentication Protocol" },
|
|
|
|
{ ETHERTYPE_HSR, "High-availability Seamless Redundancy (IEC62439 Part 3)" },
|
2012-08-02 23:55:42 +00:00
|
|
|
{ ETHERTYPE_BPQ, "AX.25"},
|
2013-08-07 22:52:43 +00:00
|
|
|
{ ETHERTYPE_CMD, "CiscoMetaData"},
|
2012-04-26 16:05:05 +00:00
|
|
|
{ 0, NULL }
|
2010-01-03 10:05:50 +00:00
|
|
|
};
|
1998-11-03 07:45:10 +00:00
|
|
|
|
2013-11-20 19:17:08 +00:00
|
|
|
static void eth_prompt(packet_info *pinfo, gchar* result)
|
|
|
|
{
|
2013-12-07 23:27:36 +00:00
|
|
|
g_snprintf(result, MAX_DECODE_AS_PROMPT_LEN, "Ethertype 0x%04x as",
|
|
|
|
GPOINTER_TO_UINT(p_get_proto_data(pinfo->pool, pinfo, proto_ethertype, 0)));
|
2013-11-20 19:17:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gpointer eth_value(packet_info *pinfo)
|
|
|
|
{
|
2013-12-07 23:27:36 +00:00
|
|
|
return p_get_proto_data(pinfo->pool, pinfo, proto_ethertype, 0);
|
2013-11-20 19:17:08 +00:00
|
|
|
}
|
|
|
|
|
2010-06-19 01:16:29 +00:00
|
|
|
static void add_dix_trailer(packet_info *pinfo, proto_tree *tree, proto_tree *fh_tree,
|
2012-04-26 16:05:05 +00:00
|
|
|
int trailer_id, tvbuff_t *tvb, tvbuff_t *next_tvb, int offset_after_etype,
|
|
|
|
guint length_before, gint fcs_len);
|
In "ethertype()", catch exceptions from the dissector we call, and, if
we get an exception, add in any trailer we and then rethrow the
exception, so that the trailer will be put into the tree even if some
subdissector threw an exception. (Yes, an exception can be thrown even
in a frame with a trailer; you could have a frame, all of which was
captured, that has an IP datagram containing a UDP datagram, and if the
UDP payload isn't big enough for the type of packet it's supposed to be,
a ReportedBoundsError exception can be thrown.)
svn path=/trunk/; revision=2917
2001-01-18 08:38:10 +00:00
|
|
|
|
1999-02-09 00:35:38 +00:00
|
|
|
void
|
2002-08-02 23:36:07 +00:00
|
|
|
capture_ethertype(guint16 etype, const guchar *pd, int offset, int len,
|
2001-11-20 21:59:18 +00:00
|
|
|
packet_counts *ld)
|
1999-02-09 00:35:38 +00:00
|
|
|
{
|
2012-04-26 16:05:05 +00:00
|
|
|
switch (etype) {
|
|
|
|
case ETHERTYPE_ARP:
|
|
|
|
ld->arp++;
|
|
|
|
break;
|
|
|
|
case ETHERTYPE_IP:
|
|
|
|
capture_ip(pd, offset, len, ld);
|
|
|
|
break;
|
|
|
|
case ETHERTYPE_IPv6:
|
|
|
|
capture_ipv6(pd, offset, len, ld);
|
|
|
|
break;
|
|
|
|
case ETHERTYPE_IPX:
|
|
|
|
capture_ipx(ld);
|
|
|
|
break;
|
|
|
|
case ETHERTYPE_VLAN:
|
|
|
|
capture_vlan(pd, offset, len, ld);
|
|
|
|
break;
|
|
|
|
case ETHERTYPE_IEEE_802_1AD:
|
|
|
|
case ETHERTYPE_IEEE_802_1AH:
|
|
|
|
capture_ieee8021ah(pd, offset, len, ld);
|
|
|
|
break;
|
|
|
|
case ETHERTYPE_VINES_IP:
|
|
|
|
case ETHERTYPE_VINES_ECHO:
|
|
|
|
capture_vines(ld);
|
|
|
|
break;
|
2012-08-02 23:55:42 +00:00
|
|
|
case ETHERTYPE_BPQ:
|
|
|
|
capture_bpq(pd, offset, len, ld);
|
|
|
|
break;
|
2012-04-26 16:05:05 +00:00
|
|
|
default:
|
|
|
|
ld->other++;
|
|
|
|
break;
|
|
|
|
}
|
1999-02-09 00:35:38 +00:00
|
|
|
}
|
|
|
|
|
2013-11-20 02:28:14 +00:00
|
|
|
/*
|
2001-01-18 07:44:41 +00:00
|
|
|
void
|
|
|
|
ethertype(guint16 etype, tvbuff_t *tvb, int offset_after_etype,
|
2010-10-08 17:48:22 +00:00
|
|
|
packet_info *pinfo, proto_tree *tree, proto_tree *fh_tree,
|
|
|
|
int etype_id, int trailer_id, int fcs_len)
|
2013-11-20 02:28:14 +00:00
|
|
|
*/
|
|
|
|
static int
|
|
|
|
dissect_ethertype(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
|
1998-09-16 02:39:15 +00:00
|
|
|
{
|
2014-10-04 15:28:35 +00:00
|
|
|
const char *description;
|
|
|
|
tvbuff_t *volatile next_tvb;
|
|
|
|
guint length_before;
|
|
|
|
gint captured_length, reported_length;
|
|
|
|
volatile gboolean dissector_found = FALSE;
|
|
|
|
const char *volatile saved_proto;
|
|
|
|
void *pd_save;
|
|
|
|
ethertype_data_t *ethertype_data;
|
2013-12-07 23:27:36 +00:00
|
|
|
|
|
|
|
/* Reject the packet if data is NULL */
|
|
|
|
if (data == NULL)
|
|
|
|
return 0;
|
|
|
|
ethertype_data = (ethertype_data_t*)data;
|
2002-08-28 21:04:11 +00:00
|
|
|
|
2003-08-21 21:05:30 +00:00
|
|
|
/* Add the Ethernet type to the protocol tree */
|
2013-11-20 02:28:14 +00:00
|
|
|
proto_tree_add_uint(ethertype_data->fh_tree, ethertype_data->etype_id, tvb,
|
|
|
|
ethertype_data->offset_after_ethertype - 2, 2, ethertype_data->etype);
|
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
2000-04-13 18:18:56 +00:00
|
|
|
|
2008-07-13 18:56:54 +00:00
|
|
|
/* Get the captured length and reported length of the data
|
|
|
|
after the Ethernet type. */
|
2014-06-19 17:18:16 +00:00
|
|
|
captured_length = tvb_length_remaining(tvb, ethertype_data->offset_after_ethertype);
|
2008-07-13 18:56:54 +00:00
|
|
|
reported_length = tvb_reported_length_remaining(tvb,
|
2013-11-20 02:28:14 +00:00
|
|
|
ethertype_data->offset_after_ethertype);
|
2000-05-19 04:54:36 +00:00
|
|
|
|
2008-07-13 18:56:54 +00:00
|
|
|
/* Remember how much data there is after the Ethernet type,
|
|
|
|
including any trailer and FCS. */
|
|
|
|
length_before = reported_length;
|
|
|
|
|
|
|
|
/* Construct a tvbuff for the payload after the Ethernet type.
|
|
|
|
If the FCS length is positive, remove the FCS.
|
|
|
|
(If it's zero, there's no FCS; if it's negative,
|
|
|
|
we don't know whether there's an FCS, so we'll
|
|
|
|
guess based on the length of the trailer.) */
|
2013-11-20 02:28:14 +00:00
|
|
|
if (ethertype_data->fcs_len > 0) {
|
2008-07-13 18:56:54 +00:00
|
|
|
if (captured_length >= 0 && reported_length >= 0) {
|
2013-11-20 02:28:14 +00:00
|
|
|
if (reported_length >= ethertype_data->fcs_len)
|
|
|
|
reported_length -= ethertype_data->fcs_len;
|
2008-07-13 18:56:54 +00:00
|
|
|
if (captured_length > reported_length)
|
|
|
|
captured_length = reported_length;
|
|
|
|
}
|
|
|
|
}
|
2013-11-20 02:28:14 +00:00
|
|
|
next_tvb = tvb_new_subset(tvb, ethertype_data->offset_after_ethertype, captured_length,
|
2012-04-26 16:05:05 +00:00
|
|
|
reported_length);
|
2001-02-01 07:34:33 +00:00
|
|
|
|
2013-11-23 02:20:13 +00:00
|
|
|
p_add_proto_data(pinfo->pool, pinfo, proto_ethertype, 0, GUINT_TO_POINTER((guint)ethertype_data->etype));
|
2001-01-18 07:44:41 +00:00
|
|
|
|
In "ethertype()", catch exceptions from the dissector we call, and, if
we get an exception, add in any trailer we and then rethrow the
exception, so that the trailer will be put into the tree even if some
subdissector threw an exception. (Yes, an exception can be thrown even
in a frame with a trailer; you could have a frame, all of which was
captured, that has an IP datagram containing a UDP datagram, and if the
UDP payload isn't big enough for the type of packet it's supposed to be,
a ReportedBoundsError exception can be thrown.)
svn path=/trunk/; revision=2917
2001-01-18 08:38:10 +00:00
|
|
|
/* Look for sub-dissector, and call it if found.
|
2004-02-21 00:33:31 +00:00
|
|
|
Catch exceptions, so that if the reported length of "next_tvb"
|
|
|
|
was reduced by some dissector before an exception was thrown,
|
|
|
|
we can still put in an item for the trailer. */
|
2004-02-21 05:12:45 +00:00
|
|
|
saved_proto = pinfo->current_proto;
|
2010-10-08 17:48:22 +00:00
|
|
|
pd_save = pinfo->private_data;
|
In "ethertype()", catch exceptions from the dissector we call, and, if
we get an exception, add in any trailer we and then rethrow the
exception, so that the trailer will be put into the tree even if some
subdissector threw an exception. (Yes, an exception can be thrown even
in a frame with a trailer; you could have a frame, all of which was
captured, that has an IP datagram containing a UDP datagram, and if the
UDP payload isn't big enough for the type of packet it's supposed to be,
a ReportedBoundsError exception can be thrown.)
svn path=/trunk/; revision=2917
2001-01-18 08:38:10 +00:00
|
|
|
TRY {
|
2010-12-20 05:35:29 +00:00
|
|
|
dissector_found = dissector_try_uint(ethertype_dissector_table,
|
2013-11-20 02:28:14 +00:00
|
|
|
ethertype_data->etype, next_tvb, pinfo, tree);
|
In "ethertype()", catch exceptions from the dissector we call, and, if
we get an exception, add in any trailer we and then rethrow the
exception, so that the trailer will be put into the tree even if some
subdissector threw an exception. (Yes, an exception can be thrown even
in a frame with a trailer; you could have a frame, all of which was
captured, that has an IP datagram containing a UDP datagram, and if the
UDP payload isn't big enough for the type of packet it's supposed to be,
a ReportedBoundsError exception can be thrown.)
svn path=/trunk/; revision=2917
2001-01-18 08:38:10 +00:00
|
|
|
}
|
Move show_exception() and show_reported_bounds_error() to
epan/show_exception.c, as it's used outside
epan/dissectors/packet-frame.c. Update their callers to include
<epan/show_exception.h> to get their declaration.
Add a CATCH_NONFATAL_ERRORS macro that catches all exceptions that, if
there's more stuff in the packet to dissect after the dissector call
that threw the exception, doesn't mean you shouldn't go ahead and
dissect that stuff. Use it in all those cases, including ones where
BoundsError was inappropriately being caught (you want those passed up
to the top level, so that the packet is reported as having been cut
short in the capture process).
Add a CATCH_BOUNDS_ERRORS macro that catches all exceptions that
correspond to running past the end of the data for a tvbuff; use it
rather than explicitly catching those exceptions individually, and
rather than just catching all exceptions (the only place that
DissectorError should be caught, for example, is at the top level, so
dissector bugs show up in the protocol tree).
Don't catch and then immediately rethrow exceptions without doing
anything else; just let the exceptions go up to the final catcher.
Use show_exception() to report non-fatal errors, rather than doing it
yourself.
If a dissector is called from Lua, catch all non-fatal errors and use
show_exception() to report them rather than catching only
ReportedBoundsError and adding a proto_malformed item.
Don't catch exceptions when constructing a trailer tvbuff in
packet-ieee8023.c - just construct it after the payload has been
dissected, and let whatever exceptions that throws be handled at the top
level.
Avoid some TRY/CATCH/ENDTRY cases by using checks such as
tvb_bytes_exist() before even looking in the tvbuff.
svn path=/trunk/; revision=47924
2013-02-27 22:43:54 +00:00
|
|
|
CATCH_NONFATAL_ERRORS {
|
|
|
|
/* Somebody threw an exception that means that there
|
|
|
|
was a problem dissecting the payload; that means
|
|
|
|
that a dissector was found, so we don't need to
|
|
|
|
dissect the payload as data or update the protocol
|
|
|
|
or info columns.
|
2004-02-21 00:33:31 +00:00
|
|
|
|
Move show_exception() and show_reported_bounds_error() to
epan/show_exception.c, as it's used outside
epan/dissectors/packet-frame.c. Update their callers to include
<epan/show_exception.h> to get their declaration.
Add a CATCH_NONFATAL_ERRORS macro that catches all exceptions that, if
there's more stuff in the packet to dissect after the dissector call
that threw the exception, doesn't mean you shouldn't go ahead and
dissect that stuff. Use it in all those cases, including ones where
BoundsError was inappropriately being caught (you want those passed up
to the top level, so that the packet is reported as having been cut
short in the capture process).
Add a CATCH_BOUNDS_ERRORS macro that catches all exceptions that
correspond to running past the end of the data for a tvbuff; use it
rather than explicitly catching those exceptions individually, and
rather than just catching all exceptions (the only place that
DissectorError should be caught, for example, is at the top level, so
dissector bugs show up in the protocol tree).
Don't catch and then immediately rethrow exceptions without doing
anything else; just let the exceptions go up to the final catcher.
Use show_exception() to report non-fatal errors, rather than doing it
yourself.
If a dissector is called from Lua, catch all non-fatal errors and use
show_exception() to report them rather than catching only
ReportedBoundsError and adding a proto_malformed item.
Don't catch exceptions when constructing a trailer tvbuff in
packet-ieee8023.c - just construct it after the payload has been
dissected, and let whatever exceptions that throws be handled at the top
level.
Avoid some TRY/CATCH/ENDTRY cases by using checks such as
tvb_bytes_exist() before even looking in the tvbuff.
svn path=/trunk/; revision=47924
2013-02-27 22:43:54 +00:00
|
|
|
Just show the exception and then drive on to show
|
|
|
|
the trailer, after noting that a dissector was found
|
|
|
|
and restoring the protocol value that was in effect
|
2004-02-21 05:12:45 +00:00
|
|
|
before we called the subdissector. */
|
2005-01-16 16:06:15 +00:00
|
|
|
show_exception(next_tvb, pinfo, tree, EXCEPT_CODE, GET_MESSAGE);
|
2010-10-08 17:48:22 +00:00
|
|
|
|
|
|
|
/* Restore the private_data structure in case one of the
|
|
|
|
* called dissectors modified it (and, due to the exception,
|
|
|
|
* was unable to restore it).
|
|
|
|
*/
|
|
|
|
pinfo->private_data = pd_save;
|
2004-02-21 05:12:45 +00:00
|
|
|
dissector_found = TRUE;
|
|
|
|
pinfo->current_proto = saved_proto;
|
In "ethertype()", catch exceptions from the dissector we call, and, if
we get an exception, add in any trailer we and then rethrow the
exception, so that the trailer will be put into the tree even if some
subdissector threw an exception. (Yes, an exception can be thrown even
in a frame with a trailer; you could have a frame, all of which was
captured, that has an IP datagram containing a UDP datagram, and if the
UDP payload isn't big enough for the type of packet it's supposed to be,
a ReportedBoundsError exception can be thrown.)
svn path=/trunk/; revision=2917
2001-01-18 08:38:10 +00:00
|
|
|
}
|
|
|
|
ENDTRY;
|
|
|
|
|
|
|
|
if (!dissector_found) {
|
Allow either old-style (pre-tvbuff) or new-style (tvbuffified)
dissectors to be registered as dissectors for particular ports,
registered as heuristic dissectors, and registered as dissectors for
conversations, and have routines to be used both by old-style and
new-style dissectors to call registered dissectors.
Have the code that calls those dissectors translate the arguments as
necessary. (For conversation dissectors, replace
"find_conversation_dissector()", which just returns a pointer to the
dissector, with "old_try_conversation_dissector()" and
"try_conversation_dissector()", which actually call the dissector, so
that there's a single place at which we can do that translation. Also
make "dissector_lookup()" static and, instead of calling it and, if it
returns a non-null pointer, calling that dissector, just use
"old_dissector_try_port()" or "dissector_try_port()", for the same
reason.)
This allows some dissectors that took old-style arguments and
immediately translated them to new-style arguments to just take
new-style arguments; make them do so. It also allows some new-style
dissectors not to have to translate arguments before calling routines to
look up and call dissectors; make them not do so.
Get rid of checks for too-short frames in new-style dissectors - the
tvbuff code does those checks for you.
Give the routines to register old-style dissectors, and to call
dissectors from old-style dissectors, names beginning with "old_", with
the routines for new-style dissectors not having the "old_". Update the
dissectors that use those routines appropriately.
Rename "dissect_data()" to "old_dissect_data()", and
"dissect_data_tvb()" to "dissect_data()".
svn path=/trunk/; revision=2218
2000-08-07 03:21:25 +00:00
|
|
|
/* No sub-dissector found.
|
|
|
|
Label rest of packet as "Data" */
|
2001-11-26 04:52:51 +00:00
|
|
|
call_dissector(data_handle,next_tvb, pinfo, tree);
|
1999-06-22 22:02:39 +00:00
|
|
|
|
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
2000-04-13 18:18:56 +00:00
|
|
|
/* Label protocol */
|
2013-11-20 02:28:14 +00:00
|
|
|
col_add_fstr(pinfo->cinfo, COL_PROTOCOL, "0x%04x", ethertype_data->etype);
|
2010-10-08 17:48:22 +00:00
|
|
|
|
2013-11-20 02:28:14 +00:00
|
|
|
description = try_val_to_str(ethertype_data->etype, etype_vals);
|
2010-10-08 17:48:22 +00:00
|
|
|
if (description) {
|
|
|
|
col_add_str(pinfo->cinfo, COL_INFO, description);
|
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
2000-04-13 18:18:56 +00:00
|
|
|
}
|
|
|
|
}
|
Tvbuffify the IP, ICMP, TCP, UDP, OSI CLNP, OSI COTP, OSI CLTP, and OSI
ESIS dissectors.
Register the IP dissector and have dissectors that call it directly
(rather than through a port table) call it through a handle.
Add a routine "tvb_set_reported_length()" which a dissector can use if
it was handed a tvbuff that contains more data than is actually in its
part of the packet - for example, handing a padded Ethernet frame to IP;
the routine sets the reported length of the tvbuff (and also adjusts the
actual length, as appropriate). Then use it in IP.
Given that, "ethertype()" can determine how much of the Ethernet frame
was actually part of an IP datagram (and can do the same for other
protocols under Ethernet that use "tvb_set_reported_length()"; have it
return the actual length, and have "dissect_eth()" and "dissect_vlan()"
use that to mark trailer data in Ethernet II frames as well as in 802.3
frames.
svn path=/trunk/; revision=2658
2000-11-18 10:38:33 +00:00
|
|
|
|
2013-11-20 02:28:14 +00:00
|
|
|
add_dix_trailer(pinfo, tree, ethertype_data->fh_tree, ethertype_data->trailer_id, tvb, next_tvb, ethertype_data->offset_after_ethertype,
|
|
|
|
length_before, ethertype_data->fcs_len);
|
|
|
|
|
2014-06-19 17:18:16 +00:00
|
|
|
return tvb_length(tvb);
|
In "ethertype()", catch exceptions from the dissector we call, and, if
we get an exception, add in any trailer we and then rethrow the
exception, so that the trailer will be put into the tree even if some
subdissector threw an exception. (Yes, an exception can be thrown even
in a frame with a trailer; you could have a frame, all of which was
captured, that has an IP datagram containing a UDP datagram, and if the
UDP payload isn't big enough for the type of packet it's supposed to be,
a ReportedBoundsError exception can be thrown.)
svn path=/trunk/; revision=2917
2001-01-18 08:38:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-06-19 01:16:29 +00:00
|
|
|
add_dix_trailer(packet_info *pinfo, proto_tree *tree, proto_tree *fh_tree, int trailer_id,
|
2010-10-08 17:48:22 +00:00
|
|
|
tvbuff_t *tvb, tvbuff_t *next_tvb, int offset_after_etype,
|
|
|
|
guint length_before, gint fcs_len)
|
In "ethertype()", catch exceptions from the dissector we call, and, if
we get an exception, add in any trailer we and then rethrow the
exception, so that the trailer will be put into the tree even if some
subdissector threw an exception. (Yes, an exception can be thrown even
in a frame with a trailer; you could have a frame, all of which was
captured, that has an IP datagram containing a UDP datagram, and if the
UDP payload isn't big enough for the type of packet it's supposed to be,
a ReportedBoundsError exception can be thrown.)
svn path=/trunk/; revision=2917
2001-01-18 08:38:10 +00:00
|
|
|
{
|
2012-04-26 16:05:05 +00:00
|
|
|
guint length;
|
2007-11-27 21:23:45 +00:00
|
|
|
tvbuff_t *trailer_tvb;
|
In "ethertype()", catch exceptions from the dissector we call, and, if
we get an exception, add in any trailer we and then rethrow the
exception, so that the trailer will be put into the tree even if some
subdissector threw an exception. (Yes, an exception can be thrown even
in a frame with a trailer; you could have a frame, all of which was
captured, that has an IP datagram containing a UDP datagram, and if the
UDP payload isn't big enough for the type of packet it's supposed to be,
a ReportedBoundsError exception can be thrown.)
svn path=/trunk/; revision=2917
2001-01-18 08:38:10 +00:00
|
|
|
|
2001-01-18 07:44:41 +00:00
|
|
|
/* OK, how much is there in that tvbuff now? */
|
|
|
|
length = tvb_reported_length(next_tvb);
|
|
|
|
|
|
|
|
/* If there's less than there was before, what's left is
|
|
|
|
a trailer. */
|
|
|
|
if (length < length_before) {
|
|
|
|
/*
|
2004-01-28 20:09:44 +00:00
|
|
|
* Is any of the padding present in the tvbuff?
|
2001-01-18 07:44:41 +00:00
|
|
|
*/
|
2004-01-28 20:09:44 +00:00
|
|
|
if (tvb_offset_exists(tvb, offset_after_etype + length)) {
|
|
|
|
/*
|
|
|
|
* Yes - create a tvbuff for the padding.
|
|
|
|
*/
|
2009-08-16 12:36:22 +00:00
|
|
|
trailer_tvb = tvb_new_subset_remaining(tvb,
|
2012-04-26 16:05:05 +00:00
|
|
|
offset_after_etype + length);
|
2004-01-28 20:09:44 +00:00
|
|
|
} else {
|
|
|
|
/*
|
|
|
|
* No - don't bother showing the trailer.
|
|
|
|
* XXX - show a Short Frame indication?
|
|
|
|
*/
|
2001-01-18 07:44:41 +00:00
|
|
|
trailer_tvb = NULL;
|
|
|
|
}
|
|
|
|
} else
|
|
|
|
trailer_tvb = NULL; /* no trailer */
|
|
|
|
|
2010-06-19 01:16:29 +00:00
|
|
|
add_ethernet_trailer(pinfo, tree, fh_tree, trailer_id, tvb, trailer_tvb, fcs_len);
|
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
2000-04-13 18:18:56 +00:00
|
|
|
}
|
1999-06-22 22:02:39 +00:00
|
|
|
|
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
2000-04-13 18:18:56 +00:00
|
|
|
void
|
|
|
|
proto_register_ethertype(void)
|
|
|
|
{
|
2013-11-20 19:17:08 +00:00
|
|
|
/* Decode As handling */
|
|
|
|
static build_valid_func eth_da_build_value[1] = {eth_value};
|
|
|
|
static decode_as_value_t eth_da_values = {eth_prompt, 1, eth_da_build_value};
|
|
|
|
static decode_as_t ethertype_da = {"ethertype", "Link", "ethertype", 1, 0, ð_da_values, NULL, NULL,
|
|
|
|
decode_as_default_populate_list, decode_as_default_reset, decode_as_default_change, NULL};
|
|
|
|
|
2013-11-20 02:28:14 +00:00
|
|
|
|
2013-11-20 19:17:08 +00:00
|
|
|
proto_ethertype = proto_register_protocol("Ethertype", "Ethertype", "ethertype");
|
|
|
|
|
|
|
|
new_register_dissector("ethertype", dissect_ethertype, proto_ethertype);
|
2013-11-20 02:28:14 +00:00
|
|
|
|
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
2000-04-13 18:18:56 +00:00
|
|
|
/* subdissector code */
|
2001-12-08 06:41:48 +00:00
|
|
|
ethertype_dissector_table = register_dissector_table("ethertype",
|
2013-11-20 19:17:08 +00:00
|
|
|
"Ethertype", FT_UINT16, BASE_HEX);
|
|
|
|
|
|
|
|
register_decode_as(ðertype_da);
|
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
2000-04-13 18:18:56 +00:00
|
|
|
}
|
2001-11-26 04:52:51 +00:00
|
|
|
|
|
|
|
void
|
2003-10-01 07:11:49 +00:00
|
|
|
proto_reg_handoff_ethertype(void)
|
|
|
|
{
|
|
|
|
data_handle = find_dissector("data");
|
2001-11-26 04:52:51 +00:00
|
|
|
}
|
2014-10-04 15:28:35 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Editor modelines - http://www.wireshark.org/tools/modelines.html
|
|
|
|
*
|
|
|
|
* Local variables:
|
|
|
|
* c-basic-offset: 8
|
|
|
|
* tab-width: 8
|
|
|
|
* indent-tabs-mode: t
|
|
|
|
* End:
|
|
|
|
*
|
|
|
|
* vi: set shiftwidth=8 tabstop=8 noexpandtab:
|
|
|
|
* :indentSize=8:tabSize=8:noTabs=false:
|
|
|
|
*/
|