diff options
author | Michael Mann <mmann78@netscape.net> | 2016-03-19 20:33:14 -0400 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2016-03-20 17:38:03 +0000 |
commit | 1e60d63c8c6882c8c0bdb00cf6df594e1bb6fccf (patch) | |
tree | 4147c4f2bee3b93c250a49fa8ec337072c80e713 /epan/dissectors/packet-gfp.c | |
parent | 2b2fc64447e5f778d969e6c850e9196d248cbbe1 (diff) |
Create call_data_dissector() to call data dissector.
This saves many dissectors the need to find the data dissector and store a handle to it.
There were also some that were finding it, but not using it.
For others this was the only reason for their handoff function, so it could be eliminated.
Change-Id: I5d3f951ee1daa3d30c060d21bd12bbc881a8027b
Reviewed-on: https://code.wireshark.org/review/14530
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan/dissectors/packet-gfp.c')
-rw-r--r-- | epan/dissectors/packet-gfp.c | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/epan/dissectors/packet-gfp.c b/epan/dissectors/packet-gfp.c index e7ffb9582c..9eb79daf4c 100644 --- a/epan/dissectors/packet-gfp.c +++ b/epan/dissectors/packet-gfp.c @@ -99,7 +99,6 @@ static gint ett_gfp_thec = -1; static gint ett_gfp_ehec = -1; static gint ett_gfp_fcs = -1; -static dissector_handle_t data_handle; static dissector_table_t gfp_dissector_table; /* ITU-T G.7041 6.1.1, 6.2 */ @@ -245,7 +244,6 @@ dissect_gfp_payload(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_t guint pti, pfi, exi, upi; guint fcs, fcs_calc; guint fcs_len = 0; - dissector_handle_t handle; /* G.7041 6.1.2.3 Payload area scrambling * Note that payload when sent on the wire is scrambled as per ATM @@ -364,18 +362,14 @@ dissect_gfp_payload(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_t switch (pti) { case GFP_USER_DATA: case GFP_MANAGEMENT_COMMUNICATIONS: - handle = dissector_get_uint_handle(gfp_dissector_table, upi); - if (handle == NULL) { + if (!dissector_try_uint(gfp_dissector_table, upi, payload_tvb, pinfo, tree)) { expert_add_info_format(pinfo, type_ti, &ei_gfp_payload_undecoded, "Payload type 0x%02x (%s) unsupported", upi, rval_to_str_const(upi, gfp_upi_data_rvals, "UNKNOWN")); - handle = data_handle; - } - if (!call_dissector(handle, payload_tvb, pinfo, tree)) { - call_dissector(data_handle, payload_tvb, pinfo, tree); + call_data_dissector(payload_tvb, pinfo, tree); } break; case GFP_CLIENT_MANAGEMENT: - call_dissector(data_handle, payload_tvb, pinfo, tree); + call_data_dissector(payload_tvb, pinfo, tree); break; default: @@ -648,8 +642,6 @@ proto_reg_handoff_gfp(void) gfp_handle = create_dissector_handle(dissect_gfp, proto_gfp); - data_handle = find_dissector("data"); - dissector_add_uint("wtap_encap", WTAP_ENCAP_GFP_T, gfp_handle); dissector_add_uint("wtap_encap", WTAP_ENCAP_GFP_F, gfp_handle); |