2009/6/4 Stig Bjørlykke <s...@bjorlykke.org>: > On Thu, Jun 4, 2009 at 6:58 PM, Sam Roberts <vieuxt...@gmail.com> wrote: >> At least, I can't find any lua bindings for accessing bit fields, am I >> missing them? > > Wireshark has no bitwise operators implemented for Lua bindings yet, > so this is a correct observation. > > I don't think it should involve too much work implementing the most > used ones (and, or, xor, bitshifting) in the wireshark sources, but > if the MIT license is GPLv2 compatible I find no reason to not use it > as-is?
It's not a bad idea to have bit operations, and http://bitop.luajit.org/ is the best one around, but thinking about a more wiresharkish way of doing what I wanted to do... > Moving this thread to the developer list. When I add a field to the tree, I get to specify the mask, and it will mask and shift bits out and display them nicely, what I need is a way of accessing those bits, so I can act on them. If TvbRange_methods supported a :bitrange(pos, len) method, that would mask and shift out a bitrange, and return it as a number, that would be great. len could be optional, and default to 1, so: r = buffer(9,2) r:bitfield(1) -- value of bit 1 r:bitfield(7,2) -- value of bits {7,8} ... Cheers, Sam ___________________________________________________________________________ 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-requ...@wireshark.org?subject=unsubscribe