aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2016-12-30 12:26:34 -0500
committerMichael Mann <mmann78@netscape.net>2016-12-30 20:03:03 +0000
commit13964595ad09e5d1115f6c5cb604cded27f9f55d (patch)
tree6f1f34c286f9805f7b8ba0539a6a0f627200c6d3
parent2d8615948e06e70eef915085258660c23a5bd771 (diff)
Add BASE_NO_DISPLAY_VALUE to allow field value to not be shown.
There are times when byte arrays don't want to show their value in the packet tree or there is a field that is the "header" of a subtree where showing the field value distracts from the tree display. For these cases, BASE_NO_DISPLAY_VALUE can be used to not display the value. Change-Id: I8c9f1f57cd2e663dbee07e2289e7f5e1f22d1e32 Reviewed-on: https://code.wireshark.org/review/19479 Reviewed-by: Michael Mann <mmann78@netscape.net>
-rw-r--r--doc/README.dissector7
-rw-r--r--epan/proto.c26
-rw-r--r--epan/proto.h12
3 files changed, 28 insertions, 17 deletions
diff --git a/doc/README.dissector b/doc/README.dissector
index a3ae632e22..911fd78889 100644
--- a/doc/README.dissector
+++ b/doc/README.dissector
@@ -117,7 +117,7 @@ FIELDDISPLAY --For FT_UINT{8,16,24,32,40,48,56,64} and
BASE_DEC, BASE_HEX, BASE_OCT, BASE_DEC_HEX, BASE_HEX_DEC,
BASE_CUSTOM, or BASE_NONE, possibly ORed with
BASE_RANGE_STRING, BASE_EXT_STRING, BASE_VAL64_STRING,
- BASE_ALLOW_ZERO or BASE_UNIT_STRING
+ BASE_ALLOW_ZERO, BASE_UNIT_STRING or BASE_NO_DISPLAY_VALUE
BASE_NONE may be used with a non-NULL FIELDCONVERT when the
numeric value of the field itself is not of significance to
@@ -126,6 +126,11 @@ FIELDDISPLAY --For FT_UINT{8,16,24,32,40,48,56,64} and
user in the protocol decode nor is it used when preparing
filters for the field in question.
+ BASE_NO_DISPLAY_VALUE will just display the field name with
+ no value. It is intended for byte arrays (FT_BYTES) or
+ header fields above a subtree. The value will still be
+ filterable, just not displayed.
+
--For FT_UINT16:
BASE_PT_UDP, BASE_PT_TCP, BASE_PT_DCCP or BASE_PT_SCTP
diff --git a/epan/proto.c b/epan/proto.c
index fc67163d66..ceb74c6f1e 100644
--- a/epan/proto.c
+++ b/epan/proto.c
@@ -7198,8 +7198,10 @@ label_fill(char *label_str, gsize pos, const header_field_info *hfinfo, const ch
/* "%s: %s", hfinfo->name, text */
name_pos = pos = label_concat(label_str, pos, hfinfo->name);
- pos = label_concat(label_str, pos, ": ");
- pos = label_concat(label_str, pos, text ? text : "(null)");
+ if (!(hfinfo->display & BASE_NO_DISPLAY_VALUE)) {
+ pos = label_concat(label_str, pos, ": ");
+ pos = label_concat(label_str, pos, text ? text : "(null)");
+ }
if (pos >= ITEM_LABEL_LENGTH) {
/* Uh oh, we don't have enough room. Tell the user that the field is truncated. */
@@ -7216,15 +7218,17 @@ label_fill_descr(char *label_str, gsize pos, const header_field_info *hfinfo, co
/* "%s: %s (%s)", hfinfo->name, text, descr */
name_pos = pos = label_concat(label_str, pos, hfinfo->name);
- pos = label_concat(label_str, pos, ": ");
- if (hfinfo->display & BASE_UNIT_STRING) {
- pos = label_concat(label_str, pos, descr ? descr : "(null)");
- pos = label_concat(label_str, pos, text ? text : "(null)");
- } else {
- pos = label_concat(label_str, pos, text ? text : "(null)");
- pos = label_concat(label_str, pos, " (");
- pos = label_concat(label_str, pos, descr ? descr : "(null)");
- pos = label_concat(label_str, pos, ")");
+ if (!(hfinfo->display & BASE_NO_DISPLAY_VALUE)) {
+ pos = label_concat(label_str, pos, ": ");
+ if (hfinfo->display & BASE_UNIT_STRING) {
+ pos = label_concat(label_str, pos, descr ? descr : "(null)");
+ pos = label_concat(label_str, pos, text ? text : "(null)");
+ } else {
+ pos = label_concat(label_str, pos, text ? text : "(null)");
+ pos = label_concat(label_str, pos, " (");
+ pos = label_concat(label_str, pos, descr ? descr : "(null)");
+ pos = label_concat(label_str, pos, ")");
+ }
}
if (pos >= ITEM_LABEL_LENGTH) {
diff --git a/epan/proto.h b/epan/proto.h
index 30f6111109..ed4b6971e6 100644
--- a/epan/proto.h
+++ b/epan/proto.h
@@ -547,11 +547,13 @@ typedef enum {
/* Following constants have to be ORed with a field_display_e when dissector
* want to use specials value-string MACROs for a header_field_info */
-#define BASE_RANGE_STRING 0x100
-#define BASE_EXT_STRING 0x200
-#define BASE_VAL64_STRING 0x400
-#define BASE_ALLOW_ZERO 0x800 /**< Display <none> instead of <MISSING> for zero sized byte array */
-#define BASE_UNIT_STRING 0x1000 /**< Add unit text to the field value */
+#define BASE_RANGE_STRING 0x0100
+#define BASE_EXT_STRING 0x0200
+#define BASE_VAL64_STRING 0x0400
+#define BASE_ALLOW_ZERO 0x0800 /**< Display <none> instead of <MISSING> for zero sized byte array */
+#define BASE_UNIT_STRING 0x1000 /**< Add unit text to the field value */
+#define BASE_NO_DISPLAY_VALUE 0x2000 /**< Just display the field name with no value. Intended for
+ byte arrays or header fields above a subtree */
/** BASE_ values that cause the field value to be displayed twice */
#define IS_BASE_DUAL(b) ((b)==BASE_DEC_HEX||(b)==BASE_HEX_DEC)