diff options
author | Alexis La Goutte <alexis.lagoutte@gmail.com> | 2017-03-27 06:42:03 -0400 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2017-04-10 20:31:37 +0000 |
commit | 043df01c5645378bd61318c20cfdbf86c8f73288 (patch) | |
tree | 83cc90c67b765746aed3394ba1d1154e9a433155 /plugins | |
parent | ded9ad7017a9b04a9f63c9ea91961d19ff6b395e (diff) | |
download | wireshark-043df01c5645378bd61318c20cfdbf86c8f73288.tar.gz |
Add support for BASE_VALS_NO_UNKNOWN
BASE_VALS_NO_UNKNOWN is a special value_string value for only a single
(maybe 2) numerical value(s). If a field has the numerical value
that doesn't match anything in the value_string, just the number
is supplied for the field (no "Unknown")
Dissectors that had this use case have been converted in the patch.
Change-Id: Ie63a36cceec2fe4436938ec7e3d7f9e690d2b8d9
Reviewed-on: https://code.wireshark.org/review/20736
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/docsis/packet-docsis.c | 16 | ||||
-rw-r--r-- | plugins/docsis/packet-mdd.c | 13 | ||||
-rw-r--r-- | plugins/wimax/msg_reg_req.c | 21 |
3 files changed, 25 insertions, 25 deletions
diff --git a/plugins/docsis/packet-docsis.c b/plugins/docsis/packet-docsis.c index bc17b6eeb5..39a592b6d8 100644 --- a/plugins/docsis/packet-docsis.c +++ b/plugins/docsis/packet-docsis.c @@ -254,6 +254,11 @@ static const true_false_string odd_even_tfs = { "Even Key", }; +static const value_string unique_no_phs[] = { + { 0, "No PHS on current packet" }, + { 0, NULL } +}; + /* Fragmentation Flags / Sequence */ static guint8 frag_flags; static guint8 frag_seq; @@ -288,13 +293,11 @@ static void dissect_ehdr (tvbuff_t * tvb, proto_tree * tree, packet_info * pinfo) { proto_tree *ehdr_tree; - proto_item *item_pshi; proto_item *eh_length_item; gint ehdrlen; int pos; guint8 type; guint8 len; - guint8 val; ehdrlen = tvb_get_guint8 (tvb, 1); pos = 4; @@ -392,12 +395,7 @@ dissect_ehdr (tvbuff_t * tvb, proto_tree * tree, packet_info * pinfo) /* Deprecated in DOCSIS 3.1, was Downstream Service Flow EH Element in earlier revisions */ case EH_SFLOW_HDR_UP: /* Deprecated in DOCSIS 3.1, was Upstream Service Flow EH Element in earlier revisions */ - val = tvb_get_guint8 (tvb, pos+1); - item_pshi = proto_tree_add_item(ehdr_tree, hf_docsis_ehdr_phsi, tvb, pos+1, 1, ENC_BIG_ENDIAN); - if (val == 0) - { - proto_item_append_text(item_pshi, " (No PHS on current packet)" ); - } + proto_tree_add_item(ehdr_tree, hf_docsis_ehdr_phsi, tvb, pos+1, 1, ENC_BIG_ENDIAN); if (len == 2) { @@ -952,7 +950,7 @@ proto_register_docsis (void) }, {&hf_docsis_ehdr_phsi, {"Payload Header Suppression Index", "docsis.ehdr.phsi", - FT_UINT8, BASE_DEC, NULL, 0x0, + FT_UINT8, BASE_DEC|BASE_VALS_NO_UNKNOWN, VALS(unique_no_phs), 0x0, NULL, HFILL} }, {&hf_docsis_ehdr_qind, diff --git a/plugins/docsis/packet-mdd.c b/plugins/docsis/packet-mdd.c index 614da44357..71d99568d0 100644 --- a/plugins/docsis/packet-mdd.c +++ b/plugins/docsis/packet-mdd.c @@ -284,6 +284,12 @@ static const value_string upstream_transmit_power_reporting_vals[] = { {0, NULL} }; +static const value_string unique_unlimited[] = { + { 0, "Unlimited" }, + {0, NULL} +}; + + /* Windows does not allow data copy between dlls */ const true_false_string mdd_tfs_on_off = { "On", "Off" }; @@ -546,10 +552,7 @@ dissect_mdd (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data proto_item_append_text(text_item, " (%d ms)", (256*tvb_get_guint8 (tvb, subpos) + tvb_get_guint8 (tvb, subpos + 1)) * 20); break; case MAXIMUM_NUMBER_OF_REPORTS_PER_EVENT: - text_item = proto_tree_add_item (tlv_tree, hf_docsis_mdd_maximum_number_of_reports_per_event, tvb, subpos, 1, ENC_BIG_ENDIAN); - if ( tvb_get_guint8 (tvb, subpos) == 0) { - proto_item_append_text(text_item, " (Unlimited)"); - } + proto_tree_add_item (tlv_tree, hf_docsis_mdd_maximum_number_of_reports_per_event, tvb, subpos, 1, ENC_BIG_ENDIAN); break; } subpos += sublength + 2; @@ -770,7 +773,7 @@ void proto_register_docsis_mdd (void) }, {&hf_docsis_mdd_maximum_number_of_reports_per_event, {"Maximum Number of Reports per Event", "docsis_mdd.maximum_number_of_reports_per_event", - FT_UINT8, BASE_DEC, NULL, 0x0, + FT_UINT8, BASE_DEC|BASE_VALS_NO_UNKNOWN, VALS(unique_unlimited), 0x0, "Mdd Maximum Number of Reports per Event", HFILL} }, {&hf_docsis_mdd_upstream_transmit_power_reporting, diff --git a/plugins/wimax/msg_reg_req.c b/plugins/wimax/msg_reg_req.c index 61d2ad80f5..6cd764aab2 100644 --- a/plugins/wimax/msg_reg_req.c +++ b/plugins/wimax/msg_reg_req.c @@ -217,6 +217,11 @@ static const value_string tfs_support[] = { {0, NULL} }; +static const value_string unique_no_limit[] = { + {0, "no limit"}, + {0, NULL} +}; + /* Decode REG-REQ sub-TLV's. */ void dissect_extended_tlv(proto_tree *reg_req_tree, gint tlv_type, tvbuff_t *tvb, guint tlv_offset, guint tlv_len, packet_info *pinfo, guint offset, gint proto_registry) { @@ -314,10 +319,7 @@ void dissect_extended_tlv(proto_tree *reg_req_tree, gint tlv_type, tvbuff_t *tvb add_tlv_subtree(&tlv_info, reg_req_tree, hf_reg_arq, tvb, offset, ENC_BIG_ENDIAN); break; case REG_DSX_FLOW_CONTROL: - tlv_item = add_tlv_subtree(&tlv_info, reg_req_tree, hf_reg_dsx_flow_control, tvb, offset, ENC_BIG_ENDIAN); - if (tvb_get_guint8(tvb, tlv_offset) == 0) { - proto_item_append_text(tlv_item, " (no limit)"); - } + add_tlv_subtree(&tlv_info, reg_req_tree, hf_reg_dsx_flow_control, tvb, offset, ENC_BIG_ENDIAN); break; case REG_MAC_CRC_SUPPORT: if (!include_cor2_changes) { @@ -328,10 +330,7 @@ void dissect_extended_tlv(proto_tree *reg_req_tree, gint tlv_type, tvbuff_t *tvb } break; case REG_MCA_FLOW_CONTROL: - tlv_item = add_tlv_subtree(&tlv_info, reg_req_tree, hf_reg_mca_flow_control, tvb, offset, ENC_BIG_ENDIAN); - if (tvb_get_guint8(tvb, tlv_offset) == 0) { - proto_item_append_text(tlv_item, " (no limit)"); - } + add_tlv_subtree(&tlv_info, reg_req_tree, hf_reg_mca_flow_control, tvb, offset, ENC_BIG_ENDIAN); break; case REG_MCAST_POLLING_CIDS: add_tlv_subtree(&tlv_info, reg_req_tree, hf_reg_mcast_polling_cids, tvb, offset, ENC_BIG_ENDIAN); @@ -741,7 +740,7 @@ void proto_register_mac_mgmt_msg_reg_req(void) &hf_reg_dsx_flow_control, { "DSx flow control", "wmx.reg.dsx_flow_control", - FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL + FT_UINT8, BASE_DEC|BASE_VALS_NO_UNKNOWN, VALS(unique_no_limit), 0x0, NULL, HFILL } }, /* When REG-REQ TLV 7 is length 2 */ @@ -960,7 +959,7 @@ void proto_register_mac_mgmt_msg_reg_req(void) &hf_reg_tlv_t_43_bandwidth_request_ul_tx_power_report_header_support, { "Bandwidth request and UL Tx Power Report header support", - "wimax.reg.bandwidth_request_ul_tx_pwr_report_header_support", + "wmx.reg.bandwidth_request_ul_tx_pwr_report_header_support", FT_UINT24, BASE_DEC, VALS(tfs_support), 0x1, NULL, HFILL } }, @@ -1073,7 +1072,7 @@ void proto_register_mac_mgmt_msg_reg_req(void) &hf_reg_mca_flow_control, { "MCA flow control", "wmx.reg.mca_flow_control", - FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL + FT_UINT8, BASE_DEC|BASE_VALS_NO_UNKNOWN, VALS(unique_no_limit), 0x0, NULL, HFILL } }, { |