diff options
author | Michael Mann <mmann78@netscape.net> | 2014-09-06 08:44:23 -0400 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2014-09-09 01:25:36 +0000 |
commit | 80407a46df538011c1dcea96714c401a4078a697 (patch) | |
tree | f62b063004ba6a8946c552c6a3180cb8f417cd83 /epan/dissectors/packet-rpl.c | |
parent | 124923b02f3113a1f2aeae205417a18828671850 (diff) |
Eliminate proto_tree_add_text from some of the dissectors.
Other minor cleanups while in the area.
Change-Id: I99096ade9c69a4c148962d45bb6b0bd775040ba1
Reviewed-on: https://code.wireshark.org/review/4020
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan/dissectors/packet-rpl.c')
-rw-r--r-- | epan/dissectors/packet-rpl.c | 41 |
1 files changed, 20 insertions, 21 deletions
diff --git a/epan/dissectors/packet-rpl.c b/epan/dissectors/packet-rpl.c index 9239d0fff7..d3545e8786 100644 --- a/epan/dissectors/packet-rpl.c +++ b/epan/dissectors/packet-rpl.c @@ -35,6 +35,7 @@ void proto_reg_handoff_rpl(void); static int proto_rpl = -1; static int hf_rpl_type = -1; +static int hf_rpl_len = -1; static int hf_rpl_corrval = -1; static int hf_rpl_respval = -1; static int hf_rpl_maxframe = -1; @@ -104,11 +105,10 @@ dissect_rpl_container(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) gint length, reported_length; len = tvb_get_ntohs(tvb, 0); - proto_tree_add_text(tree, tvb, 0, 2, "Length: %u", len); + proto_tree_add_item(tree, hf_rpl_len, tvb, 0, 2, ENC_BIG_ENDIAN); type = tvb_get_ntohs(tvb, 2); - proto_tree_add_text(tree, tvb, 2, 2, "Type: %s", - val_to_str_const(type, rpl_type_vals, "Unknown Type")); + proto_tree_add_item(tree, hf_rpl_type, tvb, 2, 2, ENC_BIG_ENDIAN); offset = 4; switch (type) { @@ -264,7 +264,7 @@ static void dissect_rpl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { guint16 rpl_len, rpl_type; - proto_item *ti, *hidden_item; + proto_item *ti; proto_tree *rpl_tree; tvbuff_t *next_tvb; @@ -276,22 +276,17 @@ dissect_rpl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) col_set_str(pinfo->cinfo, COL_INFO, val_to_str_const(rpl_type, rpl_type_vals, "Unknown Type")); - if (tree) { - ti = proto_tree_add_item(tree, proto_rpl, tvb, 0, - rpl_len, ENC_NA); - rpl_tree = proto_item_add_subtree(ti, ett_rpl); - hidden_item = proto_tree_add_uint(rpl_tree, hf_rpl_type, tvb, 2, 2, - rpl_type); - PROTO_ITEM_SET_HIDDEN(hidden_item); - next_tvb = tvb_new_subset_remaining(tvb, 0); - set_actual_length(next_tvb, rpl_len); - dissect_rpl_container(next_tvb, pinfo, rpl_tree); - - if (tvb_reported_length(tvb) > rpl_len) - call_dissector(data_handle, - tvb_new_subset_remaining(tvb, rpl_len), pinfo, - tree); - } + ti = proto_tree_add_item(tree, proto_rpl, tvb, 0, + rpl_len, ENC_NA); + rpl_tree = proto_item_add_subtree(ti, ett_rpl); + next_tvb = tvb_new_subset_remaining(tvb, 0); + set_actual_length(next_tvb, rpl_len); + dissect_rpl_container(next_tvb, pinfo, rpl_tree); + + if (tvb_reported_length(tvb) > rpl_len) + call_dissector(data_handle, + tvb_new_subset_remaining(tvb, rpl_len), pinfo, + tree); } void @@ -300,8 +295,12 @@ proto_register_rpl(void) static hf_register_info hf[] = { { &hf_rpl_type, { "Type", "rpl.type", - FT_UINT16, BASE_DEC, NULL, 0x0, + FT_UINT16, BASE_DEC, VALS(rpl_type_vals), 0x0, "RPL Packet Type", HFILL }}, + { &hf_rpl_len, + { "Length", "rpl.len", + FT_UINT16, BASE_DEC, NULL, 0x0, + "RPL Packet Length", HFILL }}, { &hf_rpl_corrval, { "Correlator Value", "rpl.corrval", FT_UINT32, BASE_HEX, NULL, 0x0, |