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

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


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))
permanent link

answered 23 May '12, 06:35

helloworld's gravatar image

helloworld
3.1k42041
accept rate: 28%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×637
×431

question asked: 23 May '12, 05:19

question was seen: 5,662 times

last updated: 23 May '12, 06:37

p​o​w​e​r​e​d by O​S​Q​A