Wireshark-dev: [Wireshark-dev] Lua syntax question
Date: Thu, 19 Nov 2009 17:00:53 -0500
I'm creating a chained dissector in Lua, and all I want to do is strip the first N bytes off of the tvb and pass the remainder to another dissector.

I've been poring over the Lua section of the Wireshark manual, as well as the Wireshark-Lua wiki pages, but I can't find the exact syntax I need.  Everything I try gets an error of one type or another, I guess I'm not reading the API reference correctly.  Can someone tell me the correct syntax? 

Here's a simplified version of my dissector code:

  function chained.dissector( tvbuffer, pinfo, treeitem )
    -- first, create a new tvb that skips the first 50 bytes

    --    Each of these causes a Lua error:
    newtvb = Tvb( tvbuffer(50) )
    newtvb = Tvb.new( tvbuffer(50) )
    newtvb = Tvb.tvb( tvbuffer(50) )
    newtvb = Tvb( tvbuffer(50) )

    -- this doesn't work either!
    tvbrg = tvbuffer(50)
    newtvb = Tvb.new_real(tvbrg.bytes())

    -- then pass the data to the next dissector
    next_dissector:call( newtvb, pinfo, treeitem )

  end


Thanks!!
b.