views:

57

answers:

1

Im trying to get a list of all protocol fields for a packet. I tried all_field_infos, but it returns userdata and i couldnt figure the metatable to use to read it. Does wireshark pass a protocol tree to a tap ? ( we accept (tvb,pinfo,tree) for dissectors so i figured that it might ) Is there some Proto.fields sorta property which returns all fields for a particular protocol ?

A: 

I haven't used Wireshark myself, but poking around in their user manual online produces this chapter that appears to document a list of methods and fields of a packet. There isn't a metamethod that allows a userdata to support pairs(), so the documentation is really all you get.

Alternatively, you can try calling getmetatable() on the userdata and listing its content. Of course, it might use __index() to hide the real methods somewhere else...

I think there has been some discussion of Wireshark on the Lua-L mailing list as well. Its archives might be helpful.

As a low priority resort, Wireshark is open source, so it must be possible to find the code that implements the interface to the Lua side of things...

RBerteig
Thanks for the reply . .i tried getmetable and pairs on the result, gave me the function addrs . . id rather know wht those functions are actaully accessingMy problem basically comes down to this - a userdata has some userdata.somethings - i need to figure out all the somethings before i can list all of them out, or perform any sort of manipulations
Abhay Rao
A `userdata` is Lua's way to hold an arbitrary block of data, along with a metatable describing what can be done with it from the Lua side. There is no obligation that you be able to do anything more with it than pass it back to something on the C side that has the `struct` definition available.
RBerteig