summaryrefslogtreecommitdiff
path: root/plugins/docsis
diff options
context:
space:
mode:
authorAlexis La Goutte <alexis.lagoutte@gmail.com>2017-03-27 06:42:03 -0400
committerMichael Mann <mmann78@netscape.net>2017-04-10 20:31:37 +0000
commit043df01c5645378bd61318c20cfdbf86c8f73288 (patch)
tree83cc90c67b765746aed3394ba1d1154e9a433155 /plugins/docsis
parentded9ad7017a9b04a9f63c9ea91961d19ff6b395e (diff)
downloadwireshark-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/docsis')
-rw-r--r--plugins/docsis/packet-docsis.c16
-rw-r--r--plugins/docsis/packet-mdd.c13
2 files changed, 15 insertions, 14 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,