wireshark-dev October 2010 archive
Main Archive Page > Month Archives  > wireshark-dev archives
wireshark-dev: Re: [Wireshark-dev] Wireshark lua (wslua) and bit

Re: [Wireshark-dev] Wireshark lua (wslua) and bit fields - how to do it?

From: Tony Trinh <tony19_at_nospam>
Date: Mon Oct 25 2010 - 20:53:02 GMT
To: wireshark-dev@wireshark.org

No problem.

I think I can better help you if you outlined the spec for the 64-bit field
and told me what exactly you wanted to do with it, but I'll try to help based
on what you've told me so far...

Currently, masking a uint64 does not work (at least I couldn't do it
on my machine).
You can only mask an int up to 32 bits. So, you would have to define
two 32-bit fields
and adjust the masks accordingly.

For your most recent example, you can do something like:

-- 24-bit integer in upper 32 bits of 64-bit flags
fields.shred_foo = ProtoField.uint32("shred.foo", "Foo field",
base.DEC, nil, 0x00FFFFFF)

-- read-only bit at bit 1 of 64-bit flags
fields.shred_rd = ProtoField.bool("shred.rd", "Read only", base.DEC, nil, 0x02)

[...]

local OFFSET_FLAGS = offset+8
local OFFSET_FLAGS_LSB = OFFSET_FLAGS+7

subtree:add(fields.shred_foo, buf(OFFSET_FLAGS, 4))
subtree:add(fields.shred_rd, buf(OFFSET_FLAGS_LSB, 1))
___________________________________________________________________________
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