This is a static archive of our old Q&A Site. Please post any new questions and answers at ask.wireshark.org.

how to add IP address to TreeItem in Lua?

0

How can I add an IP address to a TreeItem?

I'm using the following Lua:

sourceIpAddr = ProtoField.uint32("asc_sccp.sourceIpAddr", "sourceIpAddr", base.HEX)
subtree:add (sourceIpAddr, buffer(72,4))

As a result, I see:

sourceIpAddr: 0

But I would like to see:

sourceIpAddr: 0.0.0.0

How can I get this result?

asked 23 May '12, 05:19

Olga's gravatar image

Olga
1224
accept rate: 0%

edited 23 May '12, 06:37

helloworld's gravatar image

helloworld
3.1k42041


One Answer:

2

ProtoField supports several field types other than uint32, including IPv4 and IPv6. Try ProtoField.ipv4():

sourceIpAddr = ProtoField.ipv4("asc_sccp.sourceIpAddr", "sourceIpAddr")
subtree:add(sourceIpAddr, buffer(72,4))

answered 23 May '12, 06:35

helloworld's gravatar image

helloworld
3.1k42041
accept rate: 28%