Hi,
I tried to use Lua to parse my protocol. I just get the buffer and change it
to different format in rule. I tried uint() or string() like this:

  datatree:add(buffer(offset, 2), "DHCP: " .. string.format("%04x",
buffer(offset, 2):uint()))

and it's ok. But when I tried to change the buffer to ip(in string format,
like"192.168.10.1"), I do this:

  datatree:add(buffer(offset, 4), "ip:   " .. string.format("%s",
buffer(offset, 4):ipv4()))

it does not work, and wrong msg was given: "bad argument #2 to 'format'
(string expected,got userdata)". I find the Lua API in wireshark, got
something like this:

10.4.8.4.8. tvbrange:ipv4()

Get an IPv4 Address from a TvbRange.
10.4.8.4.8.1. Returns

The IPv4 Address

so, I wonder whether I user the API in wrong way or it doesn't support to
show ip?

Thanks. Wireshark version: 1.1.1 (SVN Rev 26391)
___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <[email protected]>
Archives:    http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
             mailto:[email protected]?subject=unsubscribe

Reply via email to