diff options
author | Michael Mann <mmann78@netscape.net> | 2013-11-20 02:28:14 +0000 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2013-11-20 02:28:14 +0000 |
commit | f34e11fabead2968fab30e5c3caab8b377aaa287 (patch) | |
tree | e2711798ee2270721ea8aca29b2419bbe78bcf5a /epan/dissectors/packet-vmlab.c | |
parent | ea278d3bf871239989365121270410930f197377 (diff) |
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
Diffstat (limited to 'epan/dissectors/packet-vmlab.c')
-rw-r--r-- | epan/dissectors/packet-vmlab.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/epan/dissectors/packet-vmlab.c b/epan/dissectors/packet-vmlab.c index 7eec47b5e9..37fca5a8c3 100644 --- a/epan/dissectors/packet-vmlab.c +++ b/epan/dissectors/packet-vmlab.c @@ -48,6 +48,8 @@ #include <epan/packet.h> #include <epan/etypes.h> +static dissector_handle_t ethertype_handle; + static int proto_vmlab = -1; static int hf_vmlab_flags_part1 = -1; /* Unknown so far */ @@ -72,7 +74,6 @@ static const value_string fragment_vals[] = { static void dissect_vmlab(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - proto_tree* volatile vmlab_tree; proto_item* ti; @@ -82,6 +83,7 @@ dissect_vmlab(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) const guint8* dst_addr; guint8 attributes; guint8 portgroup; + ethertype_data_t ethertype_data; volatile guint16 encap_proto; @@ -132,8 +134,14 @@ dissect_vmlab(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) offset += 2; /* Now call whatever was encapsulated*/ - ethertype(encap_proto, tvb, offset, pinfo, tree, vmlab_tree, hf_vmlab_etype, hf_vmlab_trailer, 0); - + ethertype_data.etype = encap_proto; + ethertype_data.offset_after_ethertype = offset; + ethertype_data.fh_tree = vmlab_tree; + ethertype_data.etype_id = hf_vmlab_etype; + ethertype_data.trailer_id = hf_vmlab_trailer; + ethertype_data.fcs_len = 0; + + call_dissector_with_data(ethertype_handle, tvb, pinfo, tree, ðertype_data); } void @@ -178,4 +186,6 @@ proto_reg_handoff_vmlab(void) vmlab_handle = create_dissector_handle(dissect_vmlab, proto_vmlab); dissector_add_uint("ethertype", ETHERTYPE_VMLAB, vmlab_handle); + + ethertype_handle = find_dissector("ethertype"); } |