diff options
author | Michael Mann <mmann78@netscape.net> | 2014-09-05 08:48:37 -0400 |
---|---|---|
committer | Alexis La Goutte <alexis.lagoutte@gmail.com> | 2014-09-06 07:44:46 +0000 |
commit | ceef7eba755cbecf670653360f72d864949dac49 (patch) | |
tree | 2cc48ebd17a4e7dc714f1b00af21f4f92546c948 /epan/dissectors/packet-pw-hdlc.c | |
parent | f1ad9eb212a6f4c5e1b6b1963bccf5f3a4900293 (diff) |
Eliminate proto_tree_add_text from some of the dissectors.
Other minor cleanups while in the area.
Change-Id: I8ea59205cfe6fab643d8fe01b75ce91532004fd9
Reviewed-on: https://code.wireshark.org/review/4004
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: Alexis La Goutte <alexis.lagoutte@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-pw-hdlc.c')
-rw-r--r-- | epan/dissectors/packet-pw-hdlc.c | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/epan/dissectors/packet-pw-hdlc.c b/epan/dissectors/packet-pw-hdlc.c index 15b418e8f5..6933b4420e 100644 --- a/epan/dissectors/packet-pw-hdlc.c +++ b/epan/dissectors/packet-pw-hdlc.c @@ -58,6 +58,7 @@ static int hf_pw_hdlc_cr_bit = -1; static int hf_pw_hdlc_control_field = -1; static int hf_pw_hdlc_pf_bit = -1; static int hf_pw_hdlc_modifier = -1; +static int hf_pw_hdlc_frame = -1; static const value_string pw_hdlc_modifier_vals[] = { {0x00, "UI - Unnumbered information" }, @@ -84,12 +85,11 @@ static void dissect_pw_hdlc_nocw_fr( tvbuff_t * tvb, packet_info * pinfo, proto_ } -static void dissect_pw_hdlc_nocw_hdlc_ppp( tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree ) +static int dissect_pw_hdlc_nocw_hdlc_ppp( tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data _U_ ) { if (tvb_reported_length_remaining(tvb, 0) < 2) { - proto_tree_add_text(tree, tvb, 0, -1, "Error processing message"); - return; + return 0; } if (tree) @@ -126,22 +126,24 @@ static void dissect_pw_hdlc_nocw_hdlc_ppp( tvbuff_t * tvb, packet_info * pinfo, { if ( control & 2 ) { - proto_tree_add_text( tr, tvb, 1, 1, "U frame" ); + proto_tree_add_uint_format( tr, hf_pw_hdlc_frame, tvb, 1, 1, control, "U frame" ); proto_tree_add_uint( tr, hf_pw_hdlc_pf_bit, tvb, 1, 1, ( control & 0x10 ) >> 4 ); proto_tree_add_uint( tr, hf_pw_hdlc_modifier, tvb, 1, 1, (control & 0xEC) >> 2); } else { - proto_tree_add_text( tr, tvb, 1, 1, "S frame" ); + proto_tree_add_uint_format( tr, hf_pw_hdlc_frame, tvb, 1, 1, control, "S frame" ); } } else { - proto_tree_add_text( tr, tvb, 1, 1, "I frame" ); + proto_tree_add_uint_format( tr, hf_pw_hdlc_frame, tvb, 1, 1, control, "I frame" ); } } + call_dissector( ppp_handle, tvb_new_subset_remaining(tvb, 2), pinfo, tree ); + return tvb_captured_length(tvb); } void proto_register_pw_hdlc(void) @@ -196,7 +198,14 @@ void proto_register_pw_hdlc(void) "Modifier", "pw_hdlc.modifier", FT_UINT8, BASE_HEX, VALS(pw_hdlc_modifier_vals), 0x0, NULL, HFILL } - } + }, + { + &hf_pw_hdlc_frame, + { + "Frame type", "pw_hdlc.frame", + FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL + } + }, }; static gint *ett[] = { @@ -214,7 +223,7 @@ void proto_register_pw_hdlc(void) proto_register_subtree_array(ett, array_length(ett)); register_dissector("pw_hdlc_nocw_fr", dissect_pw_hdlc_nocw_fr, proto_pw_hdlc_nocw_fr ); - register_dissector("pw_hdlc_nocw_hdlc_ppp", dissect_pw_hdlc_nocw_hdlc_ppp, proto_pw_hdlc_nocw_hdlc_ppp ); + new_register_dissector("pw_hdlc_nocw_hdlc_ppp", dissect_pw_hdlc_nocw_hdlc_ppp, proto_pw_hdlc_nocw_hdlc_ppp ); } void proto_reg_handoff_pw_hdlc(void) |