forked from osmocom/wireshark
Allow BASE_NONE (with strings conversion) for integral values again.
This mostly reverts SVN rev 43412 (3fa645481f
)
with the addition of documenting that FT_*INT*'s with BASE_NONE and a
FIELDCONVERT tells the Wireshark core that the field's numeric value is
meaningless and should not be shown to the user.
Use BASE_NONE again with the expert info group and severity fields. This
(finally) resolves the complaint from:
https://www.wireshark.org/lists/wireshark-dev/201206/msg00188.html
(yes, this mail's been sitting in my "todo" pile since then! <sigh>)
Change-Id: I1c6dd2864e7a2e959c97c409f277853af74a8d93
Reviewed-on: https://code.wireshark.org/review/16518
Petri-Dish: Jeff Morriss <jeff.morriss.ws@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
This commit is contained in:
parent
83174a2079
commit
29a98d1c7f
|
@ -112,11 +112,18 @@ FIELDTYPE FT_NONE, FT_BOOLEAN, FT_UINT8, FT_UINT16, FT_UINT24,
|
|||
FT_IPv6, FT_IPXNET, FT_FRAMENUM, FT_PROTOCOL, FT_GUID, FT_OID,
|
||||
FT_REL_OID, FT_AX25, FT_VINES, FT_SYSTEM_ID, FT_FC, FT_FCWWN
|
||||
FIELDDISPLAY --For FT_UINT{8,16,24,32,40,48,56,64} and
|
||||
FT_INT{8,16,24,32,40,48,56,64):
|
||||
FT_INT{8,16,24,32,40,48,56,64):
|
||||
|
||||
BASE_DEC, BASE_HEX, BASE_OCT, BASE_DEC_HEX, BASE_HEX_DEC,
|
||||
or BASE_CUSTOM, possibly ORed with BASE_RANGE_STRING,
|
||||
BASE_EXT_STRING or BASE_VAL64_STRING
|
||||
BASE_CUSTOM, or BASE_NONE, possibly ORed with
|
||||
BASE_RANGE_STRING, BASE_EXT_STRING or BASE_VAL64_STRING.
|
||||
|
||||
BASE_NONE may be used with a non-NULL FIELDCONVERT when the
|
||||
numeric value of the field itself is not of significance to
|
||||
the user (for example, the number is a generated field).
|
||||
When this is the case the numeric value is not shown to the
|
||||
user in the protocol decode nor is it used when preparing
|
||||
filters for the field in question.
|
||||
|
||||
--For FT_UINT16:
|
||||
|
||||
|
|
|
@ -205,10 +205,10 @@ expert_packet_init(void)
|
|||
{ "Message", "_ws.expert.message", FT_STRING, BASE_NONE, NULL, 0, "Wireshark expert information", HFILL }
|
||||
},
|
||||
{ &hf_expert_group,
|
||||
{ "Group", "_ws.expert.group", FT_UINT32, BASE_HEX, VALS(expert_group_vals), 0, "Wireshark expert group", HFILL }
|
||||
{ "Group", "_ws.expert.group", FT_UINT32, BASE_NONE, VALS(expert_group_vals), 0, "Wireshark expert group", HFILL }
|
||||
},
|
||||
{ &hf_expert_severity,
|
||||
{ "Severity level", "_ws.expert.severity", FT_UINT32, BASE_HEX, VALS(expert_severity_vals), 0, "Wireshark expert severity level", HFILL }
|
||||
{ "Severity level", "_ws.expert.severity", FT_UINT32, BASE_NONE, VALS(expert_severity_vals), 0, "Wireshark expert severity level", HFILL }
|
||||
}
|
||||
};
|
||||
static gint *ett[] = {
|
||||
|
|
18
epan/proto.c
18
epan/proto.c
|
@ -6526,12 +6526,16 @@ tmp_fld_check_assert(header_field_info *hfinfo)
|
|||
wmem_free(NULL, tmp_str);
|
||||
break;
|
||||
}
|
||||
|
||||
/* Require integral types (other than frame number,
|
||||
* which is always displayed in decimal) to have a
|
||||
* number base.
|
||||
* If there is a strings value then this base is not
|
||||
* normally used except when constructing a display
|
||||
* filter for a value not found in the strings lookup.
|
||||
*
|
||||
* If the display value is BASE_NONE and there is a
|
||||
* strings conversion then the dissector writer is
|
||||
* telling us that the field's numerical value is
|
||||
* meaningless; we'll avoid showing the value to the
|
||||
* user.
|
||||
*/
|
||||
switch (hfinfo->display & FIELD_DISPLAY_E_MASK) {
|
||||
case BASE_DEC:
|
||||
|
@ -6541,6 +6545,14 @@ tmp_fld_check_assert(header_field_info *hfinfo)
|
|||
case BASE_HEX_DEC:
|
||||
case BASE_CUSTOM: /* hfinfo_numeric_value_format() treats this as decimal */
|
||||
break;
|
||||
case BASE_NONE:
|
||||
if (hfinfo->strings == NULL)
|
||||
g_error("Field '%s' (%s) is an integral value (%s)"
|
||||
" but is being displayed as BASE_NONE but"
|
||||
" without a strings conversion",
|
||||
hfinfo->name, hfinfo->abbrev,
|
||||
ftype_name(hfinfo->type));
|
||||
break;
|
||||
default:
|
||||
tmp_str = val_to_str_wmem(NULL, hfinfo->display, hf_display, "(Unknown: 0x%x)");
|
||||
g_error("Field '%s' (%s) is an integral value (%s)"
|
||||
|
|
Loading…
Reference in New Issue