Wireshark mailing list archives
Re: Help needed on value translation of dissected bits
From: John Tapparo <jttdi () pobox com>
Date: Thu, 3 Dec 2009 15:52:45 -0500
Does defining it as
{ &hf_myproto_B,
{ "B Value", "myproto.b",
FT_UINT16, BASE_DEC, NULL, 0xff80, NULL, HFILL
}
}
And then using
proto_tree_add_item(tree, hf_myproto_B, tvb, o, 2, TRUE);
do what you want (basically telling it that the value is little_endian)?
On Wednesday 02 December 2009 11:55:55 Jarolin, Robert wrote:
Let me give an example:
Assume that you have 2 bytes to dissect that are formatted as follows:
- There are 2 values, A and B that are encoded into 2 Bytes
- Value A has a maximum size of 127 and is encoded using the lower 7
bits of Byte 1
- Value B has a maximum size of 511 and is encoded using all 8 bits in
Byte 2 along with bit 8 in Byte 1 representing the MSB for Value B
Normally, I would define the dissection in the hf structure as follows:
{ &hf_myproto_B,
{ "B Value", "myproto.b",
FT_UINT16, BASE_DEC, NULL, 0x80ff, NULL, HFILL
}
}
___________________________________________________________________________ Sent via: Wireshark-dev mailing list <wireshark-dev () wireshark org> Archives: http://www.wireshark.org/lists/wireshark-dev Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev mailto:wireshark-dev-request () wireshark org?subject=unsubscribe
Current thread:
- Help needed on value translation of dissected bits Jarolin, Robert (Dec 03)
- Re: Help needed on value translation of dissected bits Maynard, Chris (Dec 03)
- Re: Help needed on value translation of dissected bits John Tapparo (Dec 03)
- Re: Help needed on value translation of dissected bits Jaap Keuter (Dec 03)
