Wireshark

  • Riverbed Technology
  • WinPcap
the world's foremost network protocol analyzer
  • Wireshark
    • About
    • Download
    • Blog
  • Get Help
    • Ask a Question
    • FAQs
    • Documentation
    • Mailing Lists
    • Online Tools
    • Wiki
    • Bug Tracker
  • Develop
    • Get Involved
    • Developer's Guide
    • Browse the Code
    • Latest Builds

Wireshark-users: [Wireshark-users] bit operations are missing from lua bindings?

Date Index Thread Index Other Months All Mailing Lists
Date Prev Date Next Thread Prev Thread Next


From: Sam Roberts <vieuxtech@xxxxxxxxx>
Date: Thu, 4 Jun 2009 09:58:06 -0700

At least, I can't find any lua bindings for accessing bit fields, am I
missing them?

I need to access them in my dissector, because bit flags determine the
length of the following fields in the header.

Currently, I'm using a pure lua implementation, but I'd suggest that
if wireshark has internal APIs for bit fields that they are made
available to lua, or that bitop be bundled into wireshark (I believe
it's license to be GPL-compatible). I can provide patches that
preregister bit.* so require/dynamic module loading is not necessary.

bitop:

  http://bitop.luajit.org/

Thanks,
Sam


Pure lua:

local floor = math.floor
local function bxor (a,b)
    local r = 0
    for i = 0, 31 do
        local x = a / 2 + b / 2
        if x ~= floor (x) then
            r = r + 2^i
        end
        a = floor (a / 2)
        b = floor (b / 2)
    end
    return r
end
local function band (a,b) return ((a+b) - bxor(a,b))/2 end

  • Follow-Ups:
    • Re: [Wireshark-users] bit operations are missing from lua bindings?
      • From: Stig Bjørlykke
  • Prev by Date: Re: [Wireshark-users] [patch] error in ProtoField lua code prevents mask being specified with valuestring table
  • Next by Date: [Wireshark-users] [HELP] How to send bytes to wireshark on runtime
  • Previous by thread: Re: [Wireshark-users] Help from Wireshark developers needed
  • Next by thread: Re: [Wireshark-users] bit operations are missing from lua bindings?
  • Index(es):
    • Date
    • Thread

Wireshark and the "fin" logo are registered trademarks of the Wireshark Foundation