diff options
author | Michael Mann <mmann78@netscape.net> | 2016-07-21 10:21:25 -0400 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2016-07-27 03:40:02 +0000 |
commit | 8b0e9c66728f6a39bbe3ada1029e13ad1378013a (patch) | |
tree | c0c1b4da1845069520d4e131db96e6143e4ca772 /plugins/wimax/mac_hd_generic_decoder.c | |
parent | b7f1e99f7f4c75fa4bac1ccba77087fb0e50b8ac (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 'plugins/wimax/mac_hd_generic_decoder.c')
-rw-r--r-- | plugins/wimax/mac_hd_generic_decoder.c | 29 |
1 files changed, 26 insertions, 3 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; |