aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-rfid-pn532-hci.c
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2016-07-21 10:21:25 -0400
committerAnders Broman <a.broman58@gmail.com>2016-07-27 03:40:02 +0000
commit8b0e9c66728f6a39bbe3ada1029e13ad1378013a (patch)
treec0c1b4da1845069520d4e131db96e6143e4ca772 /epan/dissectors/packet-rfid-pn532-hci.c
parentb7f1e99f7f4c75fa4bac1ccba77087fb0e50b8ac (diff)
Follow up for proto_tree_add_checksum.
Fill in the "gaps" so that all dissectors that verify checksums have both a status and expert info field. Also address comments from original proto_tree_add_checksum patch that didn't make it. Ping-Bug: 8859 Change-Id: I2e6640108fd6bb218cb959fe9e4ba98a13e43a2f Reviewed-on: https://code.wireshark.org/review/16590 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-rfid-pn532-hci.c')
-rw-r--r--epan/dissectors/packet-rfid-pn532-hci.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/epan/dissectors/packet-rfid-pn532-hci.c b/epan/dissectors/packet-rfid-pn532-hci.c
index cbc3f2e475..3ec5a2655a 100644
--- a/epan/dissectors/packet-rfid-pn532-hci.c
+++ b/epan/dissectors/packet-rfid-pn532-hci.c
@@ -36,11 +36,13 @@ static int hf_preamble = -1;
static int hf_start_code = -1;
static int hf_length = -1;
static int hf_length_checksum = -1;
+static int hf_length_checksum_status = -1;
static int hf_extended_length = -1;
static int hf_packet_code = -1;
static int hf_postable = -1;
static int hf_specific_application_level_error_code = -1;
static int hf_data_checksum = -1;
+static int hf_data_checksum_status = -1;
static int hf_ignored = -1;
static gint ett_pn532_hci = -1;
@@ -126,11 +128,9 @@ dissect_pn532_hci(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
length = tvb_get_ntohs(tvb, offset);
offset += 2;
- proto_tree_add_item(main_tree, hf_length_checksum, tvb, offset, 1, ENC_BIG_ENDIAN);
checksum = (length >> 8) + (length & 0xFF) + tvb_get_guint8(tvb, offset);
- if (checksum != 0) {
- proto_tree_add_expert(main_tree, pinfo, &ei_invalid_length_checksum, tvb, offset, 1);
- }
+ proto_tree_add_checksum(main_tree, tvb, offset, hf_length_checksum, hf_length_checksum_status, &ei_invalid_length_checksum,
+ pinfo, checksum, ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY|PROTO_CHECKSUM_ZERO);
offset += 1;
next_tvb = tvb_new_subset_length(tvb, offset, length);
@@ -142,7 +142,7 @@ dissect_pn532_hci(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
checksum += tvb_get_guint8(tvb, offset - length);
length -= 1;
}
- proto_tree_add_checksum(main_tree, tvb, offset, hf_data_checksum, -1, &ei_invalid_data_checksum, pinfo, 0,
+ proto_tree_add_checksum(main_tree, tvb, offset, hf_data_checksum, hf_data_checksum_status, &ei_invalid_data_checksum, pinfo, 0,
ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY|PROTO_CHECKSUM_ZERO);
offset += 1;
} else { /* Normal Information Frame */
@@ -152,10 +152,9 @@ dissect_pn532_hci(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
length = tvb_get_guint8(tvb, offset);
offset += 1;
- proto_tree_add_item(main_tree, hf_length_checksum, tvb, offset, 1, ENC_BIG_ENDIAN);
checksum = length + tvb_get_guint8(tvb, offset);
- if (checksum != 0)
- proto_tree_add_expert(main_tree, pinfo, &ei_invalid_length_checksum, tvb, offset, 1);
+ proto_tree_add_checksum(main_tree, tvb, offset, hf_length_checksum, hf_length_checksum_status, &ei_invalid_length_checksum,
+ pinfo, checksum, ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY|PROTO_CHECKSUM_ZERO);
offset += 1;
next_tvb = tvb_new_subset_length(tvb, offset, length);
@@ -230,11 +229,21 @@ proto_register_pn532_hci(void)
FT_UINT8, BASE_HEX, NULL, 0x00,
NULL, HFILL }
},
+ { &hf_length_checksum_status,
+ { "Length Checksum Status", "pn532_hci.length_checksum.status",
+ FT_UINT8, BASE_NONE, VALS(proto_checksum_vals), 0x00,
+ NULL, HFILL }
+ },
{ &hf_data_checksum,
{ "Data Checksum", "pn532_hci.data_checksum",
FT_UINT8, BASE_HEX, NULL, 0x00,
NULL, HFILL }
},
+ { &hf_data_checksum_status,
+ { "Data Checksum Status", "pn532_hci.data_checksum.status",
+ FT_UINT8, BASE_NONE, VALS(proto_checksum_vals), 0x00,
+ NULL, HFILL }
+ },
{ &hf_specific_application_level_error_code,
{ "Specific Application Level Error Code","pn532_hci.specific_application_level_error_code",
FT_UINT8, BASE_HEX, NULL, 0x00,