summaryrefslogtreecommitdiff
path: root/plugins/wimax
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 /plugins/wimax
parentb7f1e99f7f4c75fa4bac1ccba77087fb0e50b8ac (diff)
downloadwireshark-8b0e9c66728f6a39bbe3ada1029e13ad1378013a.tar.gz
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 'plugins/wimax')
-rw-r--r--plugins/wimax/mac_hd_generic_decoder.c29
-rw-r--r--plugins/wimax/msg_dlmap.c78
-rw-r--r--plugins/wimax/msg_ulmap.c22
-rw-r--r--plugins/wimax/wimax_harq_map_decoder.c38
4 files changed, 127 insertions, 40 deletions
diff --git a/plugins/wimax/mac_hd_generic_decoder.c b/plugins/wimax/mac_hd_generic_decoder.c
index ad47a3915f..04e2c82eaf 100644
--- a/plugins/wimax/mac_hd_generic_decoder.c
+++ b/plugins/wimax/mac_hd_generic_decoder.c
@@ -170,6 +170,7 @@ static int hf_mac_header_generic_len = -1;
static int hf_mac_header_generic_cid = -1;
static int hf_mac_header_generic_hcs = -1;
static int hf_mac_header_generic_crc = -1;
+static int hf_mac_header_generic_crc_status = -1;
/* MAC Header types */
static const value_string ht_msgs[] =
@@ -586,6 +587,7 @@ static gint hf_mac_header_payload_fragment = -1;
static expert_field ei_mac_crc_malformed = EI_INIT;
static expert_field ei_mac_crc_missing = EI_INIT;
+static expert_field ei_mac_header_generic_crc = EI_INIT;
/* Last IE Indicators */
static const value_string last_ie_msgs[] =
@@ -595,6 +597,16 @@ static const value_string last_ie_msgs[] =
{ 0, NULL}
};
+/* Copied and renamed from proto.c because global value_strings don't work for plugins */
+static const value_string plugin_proto_checksum_vals[] = {
+ { PROTO_CHECKSUM_E_BAD, "Bad" },
+ { PROTO_CHECKSUM_E_GOOD, "Good" },
+ { PROTO_CHECKSUM_E_UNVERIFIED, "Unverified" },
+ { PROTO_CHECKSUM_E_NOT_PRESENT, "Not present" },
+
+ { 0, NULL }
+};
+
/* Register Wimax defrag table init routine. */
static void wimax_defragment_init(void)
{
@@ -1222,8 +1234,8 @@ check_crc:
/* calculate the CRC */
calculated_crc = wimax_mac_calc_crc32(tvb_get_ptr(tvb, 0, mac_len - (int)sizeof(mac_crc)), mac_len - (int)sizeof(mac_crc));
/* display the CRC */
- proto_tree_add_checksum(tree, tvb, mac_len - (int)sizeof(mac_crc), hf_mac_header_generic_crc, -1, NULL, pinfo, calculated_crc,
- ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY);
+ proto_tree_add_checksum(tree, tvb, mac_len - (int)sizeof(mac_crc), hf_mac_header_generic_crc, hf_mac_header_generic_crc_status, &ei_mac_header_generic_crc,
+ pinfo, calculated_crc, ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY);
}
else
{ /* display error message */
@@ -1612,7 +1624,17 @@ void proto_register_mac_header_generic(void)
FT_UINT32, BASE_HEX, NULL, 0x0,
NULL, HFILL
}
- }
+ },
+ {
+ &hf_mac_header_generic_crc_status,
+ {
+ "CRC Status", "wmx.genericCrc.status",
+ FT_UINT8, BASE_NONE, VALS(plugin_proto_checksum_vals), 0x0,
+ NULL, HFILL
+ }
+ },
+
+
};
/* Extended Subheader display */
@@ -2238,6 +2260,7 @@ void proto_register_mac_header_generic(void)
static ei_register_info ei[] = {
{ &ei_mac_crc_malformed, { "wmx.genericCrc.missing", PI_MALFORMED, PI_ERROR, "CRC missing - the frame is too short", EXPFILL }},
{ &ei_mac_crc_missing, { "wmx.genericCrc.missing", PI_PROTOCOL, PI_NOTE, "CRC is not included in this frame!", EXPFILL }},
+ { &ei_mac_header_generic_crc, { "wmx.genericCrc.bad_checksum", PI_CHECKSUM, PI_ERROR, "Bad checksum", EXPFILL }},
};
expert_module_t* expert_mac_header_generic;
diff --git a/plugins/wimax/msg_dlmap.c b/plugins/wimax/msg_dlmap.c
index 6f022cbdf4..6e2a0e4352 100644
--- a/plugins/wimax/msg_dlmap.c
+++ b/plugins/wimax/msg_dlmap.c
@@ -314,7 +314,9 @@ static gint hf_308a_type = -1;
static gint hf_308a_mult = -1;
static gint hf_308a_rsv = -1;
static gint hf_mac_header_compress_dlmap_crc = -1;
+static gint hf_mac_header_compress_dlmap_crc_status = -1;
static gint hf_crc16 = -1;
+static gint hf_crc16_status = -1;
static gint hf_padding = -1;
static gint hf_cid_mask = -1;
static gint hf_reserved = -1;
@@ -601,6 +603,18 @@ static int hf_dlmap_reduced_aas_spid = -1;
static expert_field ei_dlmap_not_implemented = EI_INIT;
+static expert_field ei_crc16 = EI_INIT;
+static expert_field ei_mac_header_compress_dlmap_crc = EI_INIT;
+
+/* Copied and renamed from proto.c because global value_strings don't work for plugins */
+static const value_string plugin_proto_checksum_vals[] = {
+ { PROTO_CHECKSUM_E_BAD, "Bad" },
+ { PROTO_CHECKSUM_E_GOOD, "Good" },
+ { PROTO_CHECKSUM_E_UNVERIFIED, "Unverified" },
+ { PROTO_CHECKSUM_E_NOT_PRESENT, "Not present" },
+
+ { 0, NULL }
+};
/********************************************************************
* DL-MAP Miscellaneous IEs and TLVs
@@ -818,7 +832,7 @@ static gint DL_HARQ_Chase_sub_burst_IE(proto_tree *diuc_tree, gint offset, gint
return (BIT_TO_NIB(bit) - offset);
}
-static gint DL_HARQ_IR_CTC_sub_burst_IE(proto_tree *diuc_tree, gint offset, gint length, tvbuff_t *tvb)
+static gint DL_HARQ_IR_CTC_sub_burst_IE(proto_tree *diuc_tree, packet_info *pinfo, gint offset, gint length, tvbuff_t *tvb)
{
/* offset of IE in nibbles, length is variable */
gint bit;
@@ -866,7 +880,7 @@ static gint DL_HARQ_IR_CTC_sub_burst_IE(proto_tree *diuc_tree, gint offset, gint
{
/* CRC-16 is always appended */
calculated_crc = wimax_mac_calc_crc16(tvb_get_ptr(tvb, 0, BIT_TO_BYTE(bit)), BIT_TO_BYTE(bit));
- proto_tree_add_checksum(tree, tvb, BIT_ADDR(bit), hf_crc16, -1, NULL, NULL, calculated_crc,
+ proto_tree_add_checksum(tree, tvb, BIT_ADDR(bit), hf_crc16, hf_crc16_status, &ei_crc16, pinfo, calculated_crc,
ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY);
bit += 16;
}
@@ -874,7 +888,7 @@ static gint DL_HARQ_IR_CTC_sub_burst_IE(proto_tree *diuc_tree, gint offset, gint
return (BIT_TO_NIB(bit) - offset);
}
-static gint DL_HARQ_IR_CC_sub_burst_IE(proto_tree *diuc_tree, gint offset, gint length, tvbuff_t *tvb)
+static gint DL_HARQ_IR_CC_sub_burst_IE(proto_tree *diuc_tree, packet_info *pinfo, gint offset, gint length, tvbuff_t *tvb)
{
/* offset of IE in nibbles, length is variable */
gint bit;
@@ -930,7 +944,7 @@ static gint DL_HARQ_IR_CC_sub_burst_IE(proto_tree *diuc_tree, gint offset, gint
{
/* CRC-16 is always appended */
calculated_crc = wimax_mac_calc_crc16(tvb_get_ptr(tvb, 0, BIT_TO_BYTE(bit)), BIT_TO_BYTE(bit));
- proto_tree_add_checksum(tree, tvb, BIT_ADDR(bit), hf_crc16, -1, NULL, NULL, calculated_crc,
+ proto_tree_add_checksum(tree, tvb, BIT_ADDR(bit), hf_crc16, hf_crc16_status, &ei_crc16, pinfo, calculated_crc,
ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY);
bit += 16;
}
@@ -938,7 +952,7 @@ static gint DL_HARQ_IR_CC_sub_burst_IE(proto_tree *diuc_tree, gint offset, gint
return (BIT_TO_NIB(bit) - offset);
}
-static gint MIMO_DL_Chase_HARQ_sub_burst_IE(proto_tree *diuc_tree, gint offset, gint length, tvbuff_t *tvb)
+static gint MIMO_DL_Chase_HARQ_sub_burst_IE(proto_tree *diuc_tree, packet_info *pinfo, gint offset, gint length, tvbuff_t *tvb)
{
/* offset of IE in nibbles, length is variable */
gint bit;
@@ -991,7 +1005,7 @@ static gint MIMO_DL_Chase_HARQ_sub_burst_IE(proto_tree *diuc_tree, gint offset,
{
/* CRC-16 is always appended */
calculated_crc = wimax_mac_calc_crc16(tvb_get_ptr(tvb, 0, BIT_TO_BYTE(bit)), BIT_TO_BYTE(bit));
- proto_tree_add_checksum(tree, tvb, BIT_ADDR(bit), hf_crc16, -1, NULL, NULL, calculated_crc,
+ proto_tree_add_checksum(tree, tvb, BIT_ADDR(bit), hf_crc16, hf_crc16_status, &ei_crc16, pinfo, calculated_crc,
ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY);
bit += 16;
}
@@ -999,7 +1013,7 @@ static gint MIMO_DL_Chase_HARQ_sub_burst_IE(proto_tree *diuc_tree, gint offset,
return (BIT_TO_NIB(bit) - offset);
}
-static gint MIMO_DL_IR_HARQ_sub_burst_IE(proto_tree *diuc_tree, gint offset, gint length, tvbuff_t *tvb)
+static gint MIMO_DL_IR_HARQ_sub_burst_IE(proto_tree *diuc_tree, packet_info *pinfo, gint offset, gint length, tvbuff_t *tvb)
{
/* offset of IE in nibbles, length is variable */
gint bit;
@@ -1045,7 +1059,7 @@ static gint MIMO_DL_IR_HARQ_sub_burst_IE(proto_tree *diuc_tree, gint offset, gin
{
/* CRC-16 is always appended */
calculated_crc = wimax_mac_calc_crc16(tvb_get_ptr(tvb, 0, BIT_TO_BYTE(bit)), BIT_TO_BYTE(bit));
- proto_tree_add_checksum(tree, tvb, BIT_ADDR(bit), hf_crc16, -1, NULL, NULL, calculated_crc,
+ proto_tree_add_checksum(tree, tvb, BIT_ADDR(bit), hf_crc16, hf_crc16_status, &ei_crc16, pinfo, calculated_crc,
ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY);
bit += 16;
}
@@ -1053,7 +1067,7 @@ static gint MIMO_DL_IR_HARQ_sub_burst_IE(proto_tree *diuc_tree, gint offset, gin
return (BIT_TO_NIB(bit) - offset);
}
-static gint MIMO_DL_IR_HARQ_for_CC_sub_burst_IE(proto_tree *diuc_tree, gint offset, gint length, tvbuff_t *tvb)
+static gint MIMO_DL_IR_HARQ_for_CC_sub_burst_IE(proto_tree *diuc_tree, packet_info *pinfo, gint offset, gint length, tvbuff_t *tvb)
{
/* offset of IE in nibbles, length is variable */
gint bit;
@@ -1100,7 +1114,7 @@ static gint MIMO_DL_IR_HARQ_for_CC_sub_burst_IE(proto_tree *diuc_tree, gint offs
{
/* CRC-16 is always appended */
calculated_crc = wimax_mac_calc_crc16(tvb_get_ptr(tvb, 0, BIT_TO_BYTE(bit)), BIT_TO_BYTE(bit));
- proto_tree_add_checksum(tree, tvb, BIT_ADDR(bit), hf_crc16, -1, NULL, NULL, calculated_crc,
+ proto_tree_add_checksum(tree, tvb, BIT_ADDR(bit), hf_crc16, hf_crc16_status, &ei_crc16, pinfo, calculated_crc,
ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY);
bit += 16;
}
@@ -1108,7 +1122,7 @@ static gint MIMO_DL_IR_HARQ_for_CC_sub_burst_IE(proto_tree *diuc_tree, gint offs
return (BIT_TO_NIB(bit) - offset);
}
-static gint MIMO_DL_STC_HARQ_sub_burst_IE(proto_tree *diuc_tree, gint offset, gint length, tvbuff_t *tvb)
+static gint MIMO_DL_STC_HARQ_sub_burst_IE(proto_tree *diuc_tree, packet_info *pinfo, gint offset, gint length, tvbuff_t *tvb)
{
/* offset of IE in nibbles, length is variable */
gint bit;
@@ -1153,7 +1167,7 @@ static gint MIMO_DL_STC_HARQ_sub_burst_IE(proto_tree *diuc_tree, gint offset, gi
{
/* CRC-16 is always appended */
calculated_crc = wimax_mac_calc_crc16(tvb_get_ptr(tvb, 0, BIT_TO_BYTE(bit)), BIT_TO_BYTE(bit));
- proto_tree_add_checksum(tree, tvb, BIT_ADDR(bit), hf_crc16, -1, NULL, NULL, calculated_crc,
+ proto_tree_add_checksum(tree, tvb, BIT_ADDR(bit), hf_crc16, hf_crc16_status, &ei_crc16, pinfo, calculated_crc,
ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY);
bit += 16;
}
@@ -1339,7 +1353,7 @@ static gint Skip_IE(proto_tree *diuc_tree, gint offset, gint length, tvbuff_t *t
return BIT_TO_NIB(bit);
}
-static gint HARQ_DL_MAP_IE(proto_tree *diuc_tree, gint offset, gint length, tvbuff_t *tvb)
+static gint HARQ_DL_MAP_IE(proto_tree *diuc_tree, packet_info *pinfo, gint offset, gint length, tvbuff_t *tvb)
{
/* DL-MAP Extended-2 IE = 7 */
/* 8.4.5.3.21 [2] HARQ_DL_MAP_IE */
@@ -1391,17 +1405,17 @@ static gint HARQ_DL_MAP_IE(proto_tree *diuc_tree, gint offset, gint length, tvbu
if (mode == 0) {
DL_HARQ_Chase_sub_burst_IE(tree, BIT_TO_NIB(bit), length, tvb);
} else if (mode == 1) {
- DL_HARQ_IR_CTC_sub_burst_IE(tree, BIT_TO_NIB(bit), length, tvb);
+ DL_HARQ_IR_CTC_sub_burst_IE(tree, pinfo, BIT_TO_NIB(bit), length, tvb);
} else if (mode == 2) {
- DL_HARQ_IR_CC_sub_burst_IE(tree, BIT_TO_NIB(bit), length, tvb);
+ DL_HARQ_IR_CC_sub_burst_IE(tree, pinfo, BIT_TO_NIB(bit), length, tvb);
} else if (mode == 3) {
- MIMO_DL_Chase_HARQ_sub_burst_IE(tree, BIT_TO_NIB(bit), length, tvb);
+ MIMO_DL_Chase_HARQ_sub_burst_IE(tree, pinfo, BIT_TO_NIB(bit), length, tvb);
} else if (mode == 4) {
- MIMO_DL_IR_HARQ_sub_burst_IE(tree, BIT_TO_NIB(bit), length, tvb);
+ MIMO_DL_IR_HARQ_sub_burst_IE(tree, pinfo, BIT_TO_NIB(bit), length, tvb);
} else if (mode == 5) {
- MIMO_DL_IR_HARQ_for_CC_sub_burst_IE(tree, BIT_TO_NIB(bit), length, tvb);
+ MIMO_DL_IR_HARQ_for_CC_sub_burst_IE(tree, pinfo, BIT_TO_NIB(bit), length, tvb);
} else if (mode == 6) {
- MIMO_DL_STC_HARQ_sub_burst_IE(tree, BIT_TO_NIB(bit), length, tvb);
+ MIMO_DL_STC_HARQ_sub_burst_IE(tree, pinfo, BIT_TO_NIB(bit), length, tvb);
} else {
proto_tree_add_bits_item(tree, hf_dlmap_harq_dl_map_reserved_mode, tvb, bit, 1, ENC_BIG_ENDIAN);
break; /* cannot continue */
@@ -2068,7 +2082,7 @@ static gint dissect_dlmap_ie(proto_tree *ie_tree, packet_info *pinfo, gint offse
break;
case 0x07:
/* 8.4.5.3.21 HARQ_DL_MAP_IE */
- nibble = HARQ_DL_MAP_IE(tree, nibble, len, tvb);
+ nibble = HARQ_DL_MAP_IE(tree, pinfo, nibble, len, tvb);
break;
case 0x08:
/* 8.4.5.3.22 HARQ_ACK IE */
@@ -2385,8 +2399,8 @@ gint wimax_decode_dlmapc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *base_tre
{
/* calculate the CRC */
calculated_crc = wimax_mac_calc_crc32(tvb_get_ptr(tvb, 0, mac_len - (int)sizeof(mac_crc)), mac_len - (int)sizeof(mac_crc));
- proto_tree_add_checksum(base_tree, tvb, mac_len - (int)sizeof(mac_crc), hf_mac_header_compress_dlmap_crc, -1, NULL, pinfo, calculated_crc,
- ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY);
+ proto_tree_add_checksum(base_tree, tvb, mac_len - (int)sizeof(mac_crc), hf_mac_header_compress_dlmap_crc, hf_mac_header_compress_dlmap_crc_status, &ei_mac_header_compress_dlmap_crc,
+ pinfo, calculated_crc, ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY);
}
else
{ /* display error message */
@@ -2464,7 +2478,7 @@ static gint wimax_decode_sub_dl_ul_map(tvbuff_t *tvb, packet_info *pinfo, proto_
/* CRC-16 is always appended */
calculated_crc = wimax_mac_calc_crc16(tvb_get_ptr(tvb, 0, NIB_TO_BYTE(nib)), NIB_TO_BYTE(nib));
- proto_tree_add_checksum(tree, tvb, NIBHI(nib,4), hf_crc16, -1, NULL, pinfo, calculated_crc,
+ proto_tree_add_checksum(tree, tvb, NIBHI(nib,4), hf_crc16, hf_crc16_status, &ei_crc16, pinfo, calculated_crc,
ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY);
/* nib += 4; */
@@ -2584,7 +2598,7 @@ gint wimax_decode_dlmap_reduced_aas(tvbuff_t *tvb, packet_info *pinfo _U_, proto
/* CRC-16 is always appended */
calculated_crc = wimax_mac_calc_crc16(tvb_get_ptr(tvb, 0, BIT_TO_BYTE(bit)), BIT_TO_BYTE(bit));
- proto_tree_add_checksum(tree, tvb, BIT_ADDR(bit), hf_crc16, -1, NULL, pinfo, calculated_crc,
+ proto_tree_add_checksum(tree, tvb, BIT_ADDR(bit), hf_crc16, hf_crc16_status, &ei_crc16, pinfo, calculated_crc,
ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY);
bit += 16;
@@ -3056,6 +3070,13 @@ void proto_register_mac_mgmt_msg_dlmap(void)
}
},
{
+ &hf_mac_header_compress_dlmap_crc_status,
+ {
+ "CRC Status", "wmx.compress_dlmap_crc.status",
+ FT_UINT8, BASE_NONE, VALS(plugin_proto_checksum_vals), 0x0, NULL, HFILL
+ }
+ },
+ {
&hf_crc16,
{
"CRC-16", "wmx.dlmap.crc16",
@@ -3063,6 +3084,13 @@ void proto_register_mac_mgmt_msg_dlmap(void)
}
},
{
+ &hf_crc16_status,
+ {
+ "CRC-16 Status", "wmx.dlmap.crc16.status",
+ FT_UINT8, BASE_NONE, VALS(plugin_proto_checksum_vals), 0x0, NULL, HFILL
+ }
+ },
+ {
&hf_padding,
{
"Padding", "wmx.dlmap.padding",
@@ -3418,6 +3446,8 @@ void proto_register_mac_mgmt_msg_dlmap(void)
static ei_register_info ei[] = {
{ &ei_dlmap_not_implemented, { "wmx.dlmap.not_implemented", PI_UNDECODED, PI_WARN, "Not implemented", EXPFILL }},
+ { &ei_crc16, { "wmx.dlmap.bad_checksum", PI_CHECKSUM, PI_ERROR, "Bad checksum", EXPFILL }},
+ { &ei_mac_header_compress_dlmap_crc, { "wmx.compress_dlmap.bad_checksum", PI_CHECKSUM, PI_ERROR, "Bad checksum", EXPFILL }},
};
expert_module_t* expert_mac_mgmt_msg_dlmap;
diff --git a/plugins/wimax/msg_ulmap.c b/plugins/wimax/msg_ulmap.c
index dd19011bd8..28e63fd68a 100644
--- a/plugins/wimax/msg_ulmap.c
+++ b/plugins/wimax/msg_ulmap.c
@@ -261,6 +261,7 @@ static gint hf_ulmap_uiuc13_papr = -1;
static gint hf_ulmap_uiuc13_zone = -1;
static gint hf_ulmap_uiuc13_rsv = -1;
/* static gint hf_ulmap_crc16 = -1; */
+/* static gint hf_ulmap_crc16_status = -1; */
static gint hf_ulmap_padding = -1;
/* Generated via "one time" script to help create filterable fields */
@@ -635,7 +636,7 @@ static gint UL_HARQ_Chase_Sub_Burst_IE(proto_tree *uiuc_tree, gint offset, gint
if (include_cor2_changes)
{
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,
+ proto_tree_add_checksum(tree, tvb, BITHI(bit,16), hf_ulmap_crc16, hf_ulmap_crc16_status, &ei_ulmap_crc16, pinfo, calculated_crc,
ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY);
bit += 16;
}
@@ -676,7 +677,7 @@ static gint UL_HARQ_IR_CTC_Sub_Burst_IE(proto_tree *uiuc_tree, gint offset, gint
{
/* 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,
+ proto_tree_add_checksum(tree, tvb, BITHI(bit,16), hf_ulmap_crc16, hf_ulmap_crc16_status, &ei_ulmap_crc16, pinfo, calculated_crc,
ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY);
bit += 16;
}
@@ -718,7 +719,7 @@ static gint UL_HARQ_IR_CC_Sub_Burst_IE(proto_tree *uiuc_tree, gint offset, gint
{
/* 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,
+ proto_tree_add_checksum(tree, tvb, BITHI(bit,16), hf_ulmap_crc16, hf_ulmap_crc16_status, &ei_ulmap_crc16, pinfo, calculated_crc,
ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY);
bit += 16;
@@ -771,7 +772,7 @@ static gint MIMO_UL_Chase_HARQ_Sub_Burst_IE(proto_tree *uiuc_tree, gint offset,
{
/* 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,
+ proto_tree_add_checksum(tree, tvb, BITHI(bit,16), hf_ulmap_crc16, hf_ulmap_crc16_status, &ei_ulmap_crc16, pinfo, calculated_crc,
ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY);
bit += 16;
@@ -824,7 +825,7 @@ static gint MIMO_UL_IR_HARQ__Sub_Burst_IE(proto_tree *uiuc_tree, gint offset, gi
{
/* 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,
+ proto_tree_add_checksum(tree, tvb, BITHI(bit,16), hf_ulmap_crc16, hf_ulmap_crc16_status, &ei_ulmap_crc16, pinfo, calculated_crc,
ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY);
bit += 16;
@@ -878,7 +879,7 @@ static gint MIMO_UL_IR_HARQ_for_CC_Sub_Burst_UIE(proto_tree *uiuc_tree, gint off
{
/* 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,
+ proto_tree_add_checksum(tree, tvb, BITHI(bit,16), hf_ulmap_crc16, hf_ulmap_crc16_status, &ei_ulmap_crc16, pinfo, calculated_crc,
ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY);
bit += 16;
@@ -924,7 +925,7 @@ static gint MIMO_UL_STC_HARQ_Sub_Burst_IE(proto_tree *uiuc_tree, gint offset, gi
{
/* 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,
+ proto_tree_add_checksum(tree, tvb, BITHI(bit,16), hf_ulmap_crc16, hf_ulmap_crc16_status, &ei_ulmap_crc16, pinfo, calculated_crc,
ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY);
bit += 16;
@@ -2463,6 +2464,13 @@ void proto_register_mac_mgmt_msg_ulmap(void)
FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL
}
},
+ {
+ &hf_ulmap_crc16_status,
+ {
+ "CRC-16 Status", "wmx.ulmap.crc16.status",
+ FT_UINT8, BASE_NONE, VALS(plugin_proto_checksum_vals), 0x0, NULL, HFILL
+ }
+ },
#endif
{
&hf_ulmap_padding,
diff --git a/plugins/wimax/wimax_harq_map_decoder.c b/plugins/wimax/wimax_harq_map_decoder.c
index 0666515160..ba94f3e2bb 100644
--- a/plugins/wimax/wimax_harq_map_decoder.c
+++ b/plugins/wimax/wimax_harq_map_decoder.c
@@ -29,6 +29,7 @@
#include "config.h"
#include <epan/packet.h>
+#include <epan/expert.h>
#include "crc.h"
#include "wimax_compact_dlmap_ie_decoder.h"
#include "wimax_compact_ulmap_ie_decoder.h"
@@ -59,7 +60,20 @@ static gint hf_harq_map_reserved = -1;
static gint hf_harq_map_msg_length = -1;
static gint hf_harq_dl_ie_count = -1;
static gint hf_harq_map_msg_crc = -1;
+static gint hf_harq_map_msg_crc_status = -1;
+static expert_field ei_harq_map_msg_crc = EI_INIT;
+
+
+/* Copied and renamed from proto.c because global value_strings don't work for plugins */
+static const value_string plugin_proto_checksum_vals[] = {
+ { PROTO_CHECKSUM_E_BAD, "Bad" },
+ { PROTO_CHECKSUM_E_GOOD, "Good" },
+ { PROTO_CHECKSUM_E_UNVERIFIED, "Unverified" },
+ { PROTO_CHECKSUM_E_NOT_PRESENT, "Not present" },
+
+ { 0, NULL }
+};
/* HARQ MAP message decoder */
static int dissector_wimax_harq_map_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
@@ -151,8 +165,8 @@ static int dissector_wimax_harq_map_decoder(tvbuff_t *tvb, packet_info *pinfo, p
proto_item_append_text(parent_item, ",CRC");
/* calculate the HARQ MAM Message CRC */
calculated_crc = wimax_mac_calc_crc32(tvb_get_ptr(tvb, 0, length - (int)sizeof(harq_map_msg_crc)), length - (int)sizeof(harq_map_msg_crc));
- proto_tree_add_checksum(tree, tvb, length - (int)sizeof(harq_map_msg_crc), hf_harq_map_msg_crc, -1, NULL, pinfo, calculated_crc,
- ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY);
+ proto_tree_add_checksum(tree, tvb, length - (int)sizeof(harq_map_msg_crc), hf_harq_map_msg_crc, hf_harq_map_msg_crc_status, &ei_harq_map_msg_crc,
+ pinfo, calculated_crc, ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY);
}
return tvb_captured_length(tvb);
}
@@ -186,19 +200,31 @@ void proto_register_wimax_harq_map(void)
{
&hf_harq_map_msg_crc,
{"HARQ MAP Message CRC", "wmx.harq_map.msg_crc", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL}
- }
+ },
+ {
+ &hf_harq_map_msg_crc_status,
+ {"HARQ MAP Message CRC Status", "wmx.harq_map.msg_crc.status", FT_UINT8, BASE_NONE, VALS(plugin_proto_checksum_vals), 0x0, NULL, HFILL}
+ },
};
/* Setup protocol subtree array */
static gint *ett[] =
- {
- &ett_wimax_harq_map_decoder,
- };
+ {
+ &ett_wimax_harq_map_decoder,
+ };
+
+ static ei_register_info ei[] = {
+ { &ei_harq_map_msg_crc, { "wmx.harq_map.bad_checksum", PI_CHECKSUM, PI_ERROR, "Bad checksum", EXPFILL }},
+ };
+
+ expert_module_t* expert_harq_map;
proto_wimax_harq_map_decoder = proto_wimax;
proto_register_subtree_array(ett, array_length(ett));
proto_register_field_array(proto_wimax_harq_map_decoder, hf_harq_map, array_length(hf_harq_map));
+ expert_harq_map = expert_register_protocol(proto_wimax_harq_map_decoder);
+ expert_register_field_array(expert_harq_map, ei, array_length(ei));
register_dissector("wimax_harq_map_handler", dissector_wimax_harq_map_decoder, proto_wimax_harq_map_decoder);
}