Wireshark-dev: [Wireshark-dev] Question for how to show the value of Length right in wireshark
Hi,All
I just start how to write a plugin for own protocal in wireshark
and meet a problem
Our protocal is based on ethernet and looks like this
| Length | Data | CRC |
The length field hold 2 bytes and stands for the length of the data,
eg, if value is 0x B6 01 , should means the value is 0x 01B6 (438
in decimal)
I code like followed
{ &hf_foo_length,
{ "foo Length", "foo.length",
FT_UINT16, BASE_DEC_HEX, NULL, 0x0,
"", HFILL }
},
{ &hf_foo_data,
{ "foo Data", "foo.data",
FT_UINT16, BASE_HEX, NULL, 0x0,
"", HFILL }},
{ &hf_rdc_crc,
{ "foo CRC", "foo.crc",
FT_UINT32, BASE_DEC, NULL, 0x0,
"", HFILL }
}
I can get the right value in dissect_foo( ) via the followed code.
data_length = tvb_get_letohs(tvb, offset);
But in the tree view,
1> It always should the Length value is 0xB601 (46593 in decimal)
2> can not show the data field rightly.
So,
1> How could I slove this problem?
2> How could I declare the data in the hf_register_info structure if
the data's length is changeable.
Thanks!!!