diff options
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, |