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: Tamás Regős <Tamas.Regos_at_nospam>
Date: Fri Oct 22 2010 - 05:05:42 GMT
To: "dlynes@pv-labs.com" <dlynes@pv-labs.com>, Developer support list for Wireshark <wireshark-dev@wireshark.org>


Try ByteArray.tvb(hexba,"hex") instead of Tvb.new_real(hexba, "hex")
Tvb.new_real does not exists.


From: wireshark-dev-bounces@wireshark.org [mailto:wireshark-dev-bounces@wireshark.org] On Behalf Of Daniel Lynes
Sent: Friday, 22 October 2010 4:46 AM
To: wireshark-dev@wireshark.org
Subject: [Wireshark-dev] Wireshark lua (wslua) and bit fields - how to do it?

I'm trying to output some bit values in my wireshark dissector decode. However, I want to be able to filter based on those bit values.

I can't seem to use the LUA bitop library to do it, because lua complains that the result is not a uservalue.

I've got the following code:

                        for shred = 1, num_shreds
                                subtree:add("----- NV Storage Shred " .. shred .. " -----")
                                subtree:add(fields.shred_id, buffer(offset, 8))
                                subtree:add(fields.shred_flags, buffer(offset+8, 8))
                                local flags=tonumber(tostring(buffer(offset+8,8):uint64()))
                                local hex=tostring(bit.tohex(bit.band(flags,0x02)))
                                subtree:add("----- NV Storage hex flags: " .. hex)
                                local hexba=ByteArray.new(hex)
                          -- The following line complains about a nil uservalue
                                local rdonly=Tvb.new_real(hexba, "hex")
                          -- The following line complains about the value being a number instead of a uservalue
                                subtree:add(fields.shred_rd, bit.band(flags, 0x02))

Does anyone happen to have any clues as to what I'm doing wrong? Fwiw, I'm using 1.2.0 (1.3, 1.4, and 1.5 all have video corruption issues, and 1.0 has issues with 64-bit integers).


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