summaryrefslogtreecommitdiff
path: root/plugins/wimax/msg_ulmap.c
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2016-07-10 23:47:28 -0400
committerMichael Mann <mmann78@netscape.net>2016-07-21 12:35:22 +0000
commitad6fc87d64de30cdcdca18168a117d2ec24591da (patch)
treeb5df109654ae6806db7544933f8bf1a848a02ae7 /plugins/wimax/msg_ulmap.c
parent1e19f55f0c44b850bc6304be28d5b272a3553204 (diff)
downloadwireshark-ad6fc87d64de30cdcdca18168a117d2ec24591da.tar.gz
Add proto_tree_add_checksum.
This is an attempt to standardize display/handling of checksum fields for all dissectors. The main target is for dissectors that do validation, but dissectors that just report the checksum were also included just to make them easier to find in the future. Bug: 10620 Bug: 12058 Ping-Bug: 8859 Change-Id: Ia8abd86e42eaf8ed50de6b173409e914b17993bf Reviewed-on: https://code.wireshark.org/review/16380 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Jeff Morriss <jeff.morriss.ws@gmail.com> Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'plugins/wimax/msg_ulmap.c')
-rw-r--r--plugins/wimax/msg_ulmap.c109
1 files changed, 39 insertions, 70 deletions
diff --git a/plugins/wimax/msg_ulmap.c b/plugins/wimax/msg_ulmap.c
index afce354898..dd19011bd8 100644
--- a/plugins/wimax/msg_ulmap.c
+++ b/plugins/wimax/msg_ulmap.c
@@ -634,16 +634,10 @@ static gint UL_HARQ_Chase_Sub_Burst_IE(proto_tree *uiuc_tree, gint offset, gint
#if 0
if (include_cor2_changes)
{
- /* CRC-16 is always appended */
- data = TVB_BIT_BITS(bit, tvb, 16);
- generic_item = proto_tree_add_uint(tree, hf_ulmap_crc16, tvb, BITHI(bit,16), data);
- /* calculate the CRC */
- calculated_crc = wimax_mac_calc_crc16((guint8 *)tvb_get_ptr(tvb, 0, BIT_TO_BYTE(bit)), BIT_TO_BYTE(bit));
- if (data != calculated_crc)
- {
- proto_item_append_text(generic_item, " - incorrect! (should be: 0x%x)", calculated_crc);
- }
- bit += 16;
+ calculated_crc = wimax_mac_calc_crc16((guint8 *)tvb_get_ptr(tvb, 0, BIT_TO_BYTE(bit)), BIT_TO_BYTE(bit));
+ proto_tree_add_checksum(tree, tvb, BITHI(bit,16), hf_ulmap_crc16, -1, NULL, pinfo, calculated_crc,
+ ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY);
+ bit += 16;
}
#endif
@@ -680,16 +674,11 @@ static gint UL_HARQ_IR_CTC_Sub_Burst_IE(proto_tree *uiuc_tree, gint offset, gint
#if 0
if (include_cor2_changes)
{
- /* CRC-16 is always appended */
- data = TVB_BIT_BITS(bit, tvb, 16);
- generic_item = proto_tree_add_uint(tree, hf_ulmap_crc16, tvb, BITHI(bit,16), data);
- /* calculate the CRC */
- calculated_crc = wimax_mac_calc_crc16((guint8 *)tvb_get_ptr(tvb, 0, BIT_TO_BYTE(bit)), BIT_TO_BYTE(bit));
- if (data != calculated_crc)
- {
- proto_item_append_text(generic_item, " - incorrect! (should be: 0x%x)", calculated_crc);
- }
- bit += 16;
+ /* CRC-16 is always appended */
+ calculated_crc = wimax_mac_calc_crc16((guint8 *)tvb_get_ptr(tvb, 0, BIT_TO_BYTE(bit)), BIT_TO_BYTE(bit));
+ proto_tree_add_checksum(tree, tvb, BITHI(bit,16), hf_ulmap_crc16, -1, NULL, pinfo, calculated_crc,
+ ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY);
+ bit += 16;
}
#endif
@@ -727,16 +716,12 @@ static gint UL_HARQ_IR_CC_Sub_Burst_IE(proto_tree *uiuc_tree, gint offset, gint
#if 0
if (include_cor2_changes)
{
- /* CRC-16 is always appended */
- data = TVB_BIT_BITS(bit, tvb, 16);
- generic_item = proto_tree_add_uint(tree, hf_ulmap_crc16, tvb, BITHI(bit,16), data);
- /* calculate the CRC */
- calculated_crc = wimax_mac_calc_crc16((guint8 *)tvb_get_ptr(tvb, 0, BIT_TO_BYTE(bit)), BIT_TO_BYTE(bit));
- if (data != calculated_crc)
- {
- proto_item_append_text(generic_item, " - incorrect! (should be: 0x%x)", calculated_crc);
- }
- bit += 16;
+ /* CRC-16 is always appended */
+ calculated_crc = wimax_mac_calc_crc16((guint8 *)tvb_get_ptr(tvb, 0, BIT_TO_BYTE(bit)), BIT_TO_BYTE(bit));
+ proto_tree_add_checksum(tree, tvb, BITHI(bit,16), hf_ulmap_crc16, -1, NULL, pinfo, calculated_crc,
+ ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY);
+
+ bit += 16;
}
#endif
@@ -784,16 +769,12 @@ static gint MIMO_UL_Chase_HARQ_Sub_Burst_IE(proto_tree *uiuc_tree, gint offset,
#if 0
if (include_cor2_changes)
{
- /* CRC-16 is always appended */
- data = TVB_BIT_BITS(bit, tvb, 16);
- generic_item = proto_tree_add_uint(tree, hf_ulmap_crc16, tvb, BITHI(bit,16), data);
- /* calculate the CRC */
- calculated_crc = wimax_mac_calc_crc16((guint8 *)tvb_get_ptr(tvb, 0, BIT_TO_BYTE(bit)), BIT_TO_BYTE(bit));
- if (data != calculated_crc)
- {
- proto_item_append_text(generic_item, " - incorrect! (should be: 0x%x)", calculated_crc);
- }
- bit += 16;
+ /* CRC-16 is always appended */
+ calculated_crc = wimax_mac_calc_crc16((guint8 *)tvb_get_ptr(tvb, 0, BIT_TO_BYTE(bit)), BIT_TO_BYTE(bit));
+ proto_tree_add_checksum(tree, tvb, BITHI(bit,16), hf_ulmap_crc16, -1, NULL, pinfo, calculated_crc,
+ ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY);
+
+ bit += 16;
}
#endif
@@ -841,16 +822,12 @@ static gint MIMO_UL_IR_HARQ__Sub_Burst_IE(proto_tree *uiuc_tree, gint offset, gi
#if 0
if (include_cor2_changes)
{
- /* CRC-16 is always appended */
- data = TVB_BIT_BITS(bit, tvb, 16);
- generic_item = proto_tree_add_uint(tree, hf_ulmap_crc16, tvb, BITHI(bit,16), data);
- /* calculate the CRC */
- calculated_crc = wimax_mac_calc_crc16((guint8 *)tvb_get_ptr(tvb, 0, BIT_TO_BYTE(bit)), BIT_TO_BYTE(bit));
- if (data != calculated_crc)
- {
- proto_item_append_text(generic_item, " - incorrect! (should be: 0x%x)", calculated_crc);
- }
- bit += 16;
+ /* CRC-16 is always appended */
+ calculated_crc = wimax_mac_calc_crc16((guint8 *)tvb_get_ptr(tvb, 0, BIT_TO_BYTE(bit)), BIT_TO_BYTE(bit));
+ proto_tree_add_checksum(tree, tvb, BITHI(bit,16), hf_ulmap_crc16, -1, NULL, pinfo, calculated_crc,
+ ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY);
+
+ bit += 16;
}
#endif
@@ -899,16 +876,12 @@ static gint MIMO_UL_IR_HARQ_for_CC_Sub_Burst_UIE(proto_tree *uiuc_tree, gint off
#if 0
if (include_cor2_changes)
{
- /* CRC-16 is always appended */
- data = TVB_BIT_BITS(bit, tvb, 16);
- generic_item = proto_tree_add_uint(tree, hf_ulmap_crc16, tvb, BITHI(bit,16), data);
- /* calculate the CRC */
- calculated_crc = wimax_mac_calc_crc16((guint8 *)tvb_get_ptr(tvb, 0, BIT_TO_BYTE(bit)), BIT_TO_BYTE(bit));
- if (data != calculated_crc)
- {
- proto_item_append_text(generic_item, " - incorrect! (should be: 0x%x)", calculated_crc);
- }
- bit += 16;
+ /* CRC-16 is always appended */
+ calculated_crc = wimax_mac_calc_crc16((guint8 *)tvb_get_ptr(tvb, 0, BIT_TO_BYTE(bit)), BIT_TO_BYTE(bit));
+ proto_tree_add_checksum(tree, tvb, BITHI(bit,16), hf_ulmap_crc16, -1, NULL, pinfo, calculated_crc,
+ ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY);
+
+ bit += 16;
}
#endif
@@ -949,16 +922,12 @@ static gint MIMO_UL_STC_HARQ_Sub_Burst_IE(proto_tree *uiuc_tree, gint offset, gi
#if 0
if (include_cor2_changes)
{
- /* CRC-16 is always appended */
- data = TVB_BIT_BITS(bit, tvb, 16);
- generic_item = proto_tree_add_uint(tree, hf_ulmap_crc16, tvb, BITHI(bit,16), data);
- /* calculate the CRC */
- calculated_crc = wimax_mac_calc_crc16((guint8 *)tvb_get_ptr(tvb, 0, BIT_TO_BYTE(bit)), BIT_TO_BYTE(bit));
- if (data != calculated_crc)
- {
- proto_item_append_text(generic_item, " - incorrect! (should be: 0x%x)", calculated_crc);
- }
- bit += 16;
+ /* CRC-16 is always appended */
+ calculated_crc = wimax_mac_calc_crc16((guint8 *)tvb_get_ptr(tvb, 0, BIT_TO_BYTE(bit)), BIT_TO_BYTE(bit));
+ proto_tree_add_checksum(tree, tvb, BITHI(bit,16), hf_ulmap_crc16, -1, NULL, pinfo, calculated_crc,
+ ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY);
+
+ bit += 16;
}
#endif