diff options
author | Michael Mann <mmann78@netscape.net> | 2015-11-17 20:16:06 -0500 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2015-11-18 07:33:08 +0000 |
commit | 4adeb424f5cdb74ca1f98cd4b87bd72e4d811f03 (patch) | |
tree | 6c73d6e0795cc5181ad53242581e4c7f2282081f /epan/dissectors/packet-sdlc.c | |
parent | 13297438d98e3388d650fc55c2a77d5b52367e1f (diff) |
create_dissector_handle -> new_create_dissector_handle
Picking off "easy" dissectors that only have one or two exit points at most.
Change-Id: I9c7d1c092bbae896ec0c2832617891346927f2e1
Reviewed-on: https://code.wireshark.org/review/11932
Reviewed-by: Michael Mann <mmann78@netscape.net>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-sdlc.c')
-rw-r--r-- | epan/dissectors/packet-sdlc.c | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/epan/dissectors/packet-sdlc.c b/epan/dissectors/packet-sdlc.c index 798ca492c4..b3ab0b3d98 100644 --- a/epan/dissectors/packet-sdlc.c +++ b/epan/dissectors/packet-sdlc.c @@ -65,8 +65,8 @@ static const xdlc_cf_items sdlc_cf_items = { &hf_sdlc_ftype_s_u }; -static void -dissect_sdlc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_sdlc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_tree *sdlc_tree; proto_item *sdlc_ti; @@ -99,17 +99,12 @@ dissect_sdlc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) col_set_str(pinfo->cinfo, COL_RES_DL_SRC, "DCE"); } - if (tree) { - sdlc_ti = proto_tree_add_item(tree, proto_sdlc, tvb, 0, -1, - ENC_NA); - sdlc_tree = proto_item_add_subtree(sdlc_ti, ett_sdlc); + sdlc_ti = proto_tree_add_item(tree, proto_sdlc, tvb, 0, -1, + ENC_NA); + sdlc_tree = proto_item_add_subtree(sdlc_ti, ett_sdlc); - proto_tree_add_uint(sdlc_tree, hf_sdlc_address, tvb, 0, 1, - addr); - } else { - sdlc_ti = NULL; - sdlc_tree = NULL; - } + proto_tree_add_uint(sdlc_tree, hf_sdlc_address, tvb, 0, 1, + addr); /* * XXX - SDLC has a mod-128 mode as well as a mod-7 mode. @@ -122,8 +117,7 @@ dissect_sdlc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) is_response, FALSE, FALSE); sdlc_header_len += XDLC_CONTROL_LEN(control, FALSE); - if (tree) - proto_item_set_len(sdlc_ti, sdlc_header_len); + proto_item_set_len(sdlc_ti, sdlc_header_len); /* * XXX - is there an FCS at the end, at least in Sniffer @@ -135,6 +129,8 @@ dissect_sdlc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) call_dissector(sna_handle, next_tvb, pinfo, tree); } else call_dissector(data_handle, next_tvb, pinfo, tree); + + return tvb_captured_length(tvb); } void @@ -207,7 +203,7 @@ proto_reg_handoff_sdlc(void) sna_handle = find_dissector("sna"); data_handle = find_dissector("data"); - sdlc_handle = create_dissector_handle(dissect_sdlc, proto_sdlc); + sdlc_handle = new_create_dissector_handle(dissect_sdlc, proto_sdlc); dissector_add_uint("wtap_encap", WTAP_ENCAP_SDLC, sdlc_handle); } |