From f34e11fabead2968fab30e5c3caab8b377aaa287 Mon Sep 17 00:00:00 2001 From: Michael Mann Date: Wed, 20 Nov 2013 02:28:14 +0000 Subject: Convert ethertype() function into a pure dissector. Bug 9454 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9454) The main driving force for this was my new Decode As functionality (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9450) that wants a dissector/subdissector table relationship for all dissectors wanting to use Decode As functionality. The ethertype() function provides the value to the "ethertype" subdissector table, so I think it should be matched to a dissector. Only odd side effect is the display filter of "ethertype" returns no packets because there is no "item" associated with the dissector. svn path=/trunk/; revision=53443 --- epan/dissectors/packet-gmhdr.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'epan/dissectors/packet-gmhdr.c') diff --git a/epan/dissectors/packet-gmhdr.c b/epan/dissectors/packet-gmhdr.c index 5f4276e7a7..e066c0bf52 100644 --- a/epan/dissectors/packet-gmhdr.c +++ b/epan/dissectors/packet-gmhdr.c @@ -88,6 +88,8 @@ static const value_string gmhdr_plfm_str[] = { { 0, NULL } }; +static dissector_handle_t ethertype_handle; + static gboolean gmhdr_summary_in_tree = TRUE; static gboolean gmtrailer_summary_in_tree = TRUE; static gboolean gmhdr_decode_timestamp_trailer = TRUE; @@ -260,8 +262,16 @@ dissect_gmhdr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) dissect_802_3(encap_proto, is_802_2, tvb, offset, pinfo, tree, gmhdr_tree, hf_gmhdr_len, hf_gmhdr_trailer, &ei_gmhdr_len, 0); } else { - ethertype(encap_proto, tvb, offset, pinfo, tree, gmhdr_tree, - hf_gmhdr_etype, hf_gmhdr_trailer, 0); + ethertype_data_t ethertype_data; + + ethertype_data.etype = encap_proto; + ethertype_data.offset_after_ethertype = offset; + ethertype_data.fh_tree = gmhdr_tree; + ethertype_data.etype_id = hf_gmhdr_etype; + ethertype_data.trailer_id = hf_gmhdr_trailer; + ethertype_data.fcs_len = 0; + + call_dissector_with_data(ethertype_handle, tvb, pinfo, tree, ðertype_data); } } @@ -502,6 +512,8 @@ proto_reg_handoff_gmhdr(void) { dissector_handle_t gmhdr_handle; + ethertype_handle = find_dissector("ethertype"); + gmhdr_handle = create_dissector_handle(dissect_gmhdr, proto_gmhdr); dissector_add_uint("ethertype", ETHERTYPE_GIGAMON, gmhdr_handle); heur_dissector_add("eth.trailer", dissect_gmtrailer, proto_gmhdr); -- cgit v1.2.3