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 instead of 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 instead of 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)