Hi,
I'm working on a protocol where I want to use proto_tree_add_bitmask for
a 64 Bit value.
You can see the structure in the attached screenshot.
This are my hf definitions (1st one is the header, the other ones are
the fields):
{ &hf_s7commp_data_returnvalue,
{ "Return value", "s7comm-plus.returnvalue", FT_UINT64, BASE_HEX,
NULL, 0x0,
NULL, HFILL }},
{ &hf_s7commp_data_retval_errorcode,
{ "Error code", "s7comm-plus.returnvalue.errorcode", FT_UINT64,
BASE_HEX, NULL, 0x000000000000ffff,
NULL, HFILL }},
{ &hf_s7commp_data_retval_omsline,
{ "OMS line", "s7comm-plus.returnvalue.omsline", FT_UINT64, BASE_DEC,
NULL, 0x00000000ffff0000,
NULL, HFILL }},
{ &hf_s7commp_data_retval_errorsource,
{ "Error source", "s7comm-plus.returnvalue.errorsource", FT_UINT64,
BASE_HEX, NULL, 0x000000ff00000000,
NULL, HFILL }},
{ &hf_s7commp_data_retval_genericerrorcode,
{ "Generic error code", "s7comm-plus.returnvalue.genericerrorcode",
FT_UINT64, BASE_HEX, NULL, 0x00007f0000000000,
NULL, HFILL }},
{ &hf_s7commp_data_retval_servererror,
{ "Server error", "s7comm-plus.returnvalue.servererror", FT_BOOLEAN,
64, NULL, 0x0000800000000000,
NULL, HFILL }},
{ &hf_s7commp_data_retval_debuginfo,
{ "Debug info", "s7comm-plus.returnvalue.debuginfo", FT_UINT64,
BASE_HEX, NULL, 0x3fff000000000000,
NULL, HFILL }},
{ &hf_s7commp_data_retval_errorextension,
{ "Error extension", "s7comm-plus.returnvalue.errorextension",
FT_BOOLEAN, 64, NULL, 0x4000000000000000,
NULL, HFILL }},
In general it works, but there are two problems:
1) It seems to be impossible to decode a value inside the bitmask as
signed integer
The "Error code" value should be 16 bit signed integer.
I've tried all combinations, but I seems that this is really not possible.
I always get a DISSECTOR_ASSERT_NOT_REACHED from proto_tree_add_uint64().
2) Using value strings in a 64 bit bitmask aren't possible
When I want to use a value_string for an entry inside the bitmask like
VALS(errorcode_names) for example, wireshark crashes when I select a column.
In the shown screenshot I've manually added the strings to the main item.
I could not simply split the bitmask into two 32 bit values, because the
protocol I'm working on uses variable length encoding.
Thus I'm decoding the value for myself, then calling
proto_tree_add_bitmask_value and passing my own value to the function.
I'm working under Windows 7 32 Bit, if this is a source of the problem.
Thanks in advance
--
Thomas
Attachment:
bitmask64bit.png
Description: PNG image