diff options
author | Stig Bjørlykke <stig@bjorlykke.org> | 2017-03-24 09:33:47 +0100 |
---|---|---|
committer | Stig Bjørlykke <stig@bjorlykke.org> | 2017-03-24 09:26:55 +0000 |
commit | e61189d838cfe7bda65aff2a5e7e2a43aef24827 (patch) | |
tree | 205fd54506a9d1fb0937045a1a021a9dcd8c51e5 /epan/dissectors/packet-coap.c | |
parent | 0b2eb9d242d9ea1b7aa69dee4a13ac8474fb8b60 (diff) |
coap: Add filterable payload length
Also fix payload desc abbrev.
Change-Id: I355658d7722383e5d1ef84efddf43e545bfda269
Reviewed-on: https://code.wireshark.org/review/20695
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
Diffstat (limited to 'epan/dissectors/packet-coap.c')
-rw-r--r-- | epan/dissectors/packet-coap.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/epan/dissectors/packet-coap.c b/epan/dissectors/packet-coap.c index 0b8756628e..90787c80b1 100644 --- a/epan/dissectors/packet-coap.c +++ b/epan/dissectors/packet-coap.c @@ -53,6 +53,7 @@ static int hf_coap_code = -1; static int hf_coap_mid = -1; static int hf_coap_payload = -1; static int hf_coap_payload_desc = -1; +static int hf_coap_payload_length = -1; static int hf_coap_opt_name = -1; static int hf_coap_opt_desc = -1; static int hf_coap_opt_delta = -1; @@ -1013,7 +1014,7 @@ dissect_coap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* d /* dissect the payload */ if (coap_length > offset) { proto_tree *payload_tree; - proto_item *payload_item; + proto_item *payload_item, *length_item; tvbuff_t *payload_tvb; guint payload_length = coap_length - offset; const char *coap_ctype_str_dis; @@ -1053,7 +1054,9 @@ dissect_coap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* d str_payload); payload_tree = proto_item_add_subtree(payload_item, ett_coap_payload); - proto_tree_add_string(payload_tree, hf_coap_payload_desc, tvb, offset, -1, coinfo->ctype_str); + proto_tree_add_string(payload_tree, hf_coap_payload_desc, tvb, offset, 0, coinfo->ctype_str); + length_item = proto_tree_add_uint(payload_tree, hf_coap_payload_length, tvb, offset, 0, payload_length); + PROTO_ITEM_SET_GENERATED(length_item); payload_tvb = tvb_new_subset_length(tvb, offset, payload_length); dissector_try_string(media_type_dissector_table, coap_ctype_str_dis, @@ -1106,10 +1109,15 @@ proto_register_coap(void) NULL, HFILL } }, { &hf_coap_payload_desc, - { "Payload Desc", "coap.opt.payload_desc", + { "Payload Desc", "coap.payload_desc", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, + { &hf_coap_payload_length, + { "Payload Length", "coap.payload_length", + FT_UINT32, BASE_DEC, NULL, 0x0, + NULL, HFILL } + }, { &hf_coap_opt_name, { "Opt Name", "coap.opt.name", FT_STRING, BASE_NONE, NULL, 0x0, |