forked from osmocom/wireshark
Add BASE_ALLOW_ZERO for byte arrays that are validly zero sized.
<MISSING> implies that the field should be there and isn't. Allow dissectors to specify when a zero-sized array for a field is perfectly valid. Ping-Bug: 11803 Change-Id: I3fd60e3c6f832c6b4a3a8837ebc52c3e74e795ae Reviewed-on: https://code.wireshark.org/review/12271 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Reviewed-by: João Valverde <j@v6e.pt> Reviewed-by: Michael Mann <mmann78@netscape.net>
This commit is contained in:
parent
b3b30624f6
commit
dc9f782017
|
@ -141,6 +141,7 @@ FIELDDISPLAY --For FT_UINT{8,16,24,32,40,48,56,64} and
|
|||
SEP_DOT, SEP_DASH, SEP_COLON, or SEP_SPACE to provide
|
||||
a separator between bytes.
|
||||
BASE_NONE has no separator between bytes
|
||||
BASE_ALLOW_ZERO displays <none> instead of <MISSING> for zero sized byte array
|
||||
|
||||
--For FT_IPv4:
|
||||
|
||||
|
|
|
@ -2744,7 +2744,7 @@ proto_register_ipv6(void)
|
|||
},
|
||||
{ &hf_ipv6_opt_padn,
|
||||
{ "PadN", "ipv6.opt.padn",
|
||||
FT_BYTES, BASE_NONE, NULL, 0x0,
|
||||
FT_BYTES, BASE_NONE|BASE_ALLOW_ZERO, NULL, 0x0,
|
||||
"PadN Option", HFILL }
|
||||
},
|
||||
{ &hf_ipv6_opt_rtalert,
|
||||
|
|
|
@ -142,7 +142,7 @@ bytes_to_repr(fvalue_t *fv, ftrepr_t rtype, int field_display, char *buf)
|
|||
{
|
||||
char separator;
|
||||
|
||||
switch(field_display)
|
||||
switch(FIELD_DISPLAY(field_display))
|
||||
{
|
||||
case SEP_DOT:
|
||||
separator = '.';
|
||||
|
|
|
@ -4635,8 +4635,12 @@ proto_custom_set(proto_tree* tree, GSList *field_ids, gint occurrence,
|
|||
wmem_free(NULL, str);
|
||||
}
|
||||
else {
|
||||
if (hfinfo->display & BASE_ALLOW_ZERO) {
|
||||
offset_r += protoo_strlcpy(result+offset_r, "<none>", size-offset_r);
|
||||
} else {
|
||||
offset_r += protoo_strlcpy(result+offset_r, "<MISSING>", size-offset_r);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case FT_ABSOLUTE_TIME:
|
||||
|
@ -6630,9 +6634,13 @@ proto_item_fill_label(field_info *fi, gchar *label_str)
|
|||
}
|
||||
label_fill(label_str, 0, hfinfo, str);
|
||||
wmem_free(NULL, str);
|
||||
} else {
|
||||
if (hfinfo->display & BASE_ALLOW_ZERO) {
|
||||
label_fill(label_str, 0, hfinfo, "<none>");
|
||||
} else {
|
||||
label_fill(label_str, 0, hfinfo, "<MISSING>");
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
/* Four types of integers to take care of:
|
||||
|
|
|
@ -538,6 +538,7 @@ typedef enum {
|
|||
#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 */
|
||||
|
||||
/** BASE_ values that cause the field value to be displayed twice */
|
||||
#define IS_BASE_DUAL(b) ((b)==BASE_DEC_HEX||(b)==BASE_HEX_DEC)
|
||||
|
|
Loading…
Reference in New Issue