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

and one more question, how to access the data beyon tvb. Such as I add a dissector in udp port 2222, but I need to access the data in network layer in the dissector, how to do this in Lua, or I have to use c to do this?

Best regards

asked 09 Oct '16, 04:00

cmqy's gravatar image

accept rate: 0%

If you are interested in things like the destination address, have a look at fields like pinfo.net_src or pinfo.src. You can find more of such fields at the pinfo reference.

To access individual fields, first specify the individual packet somewhere in your packet and retrieve it like this:

local myproto = Proto("myproto", "My Protocol")
local ttl_field ="ip.ttl")
function myproto.dissect(tvb, pinfo, tree)
    local ttl = ttl_field()
    -- now "ttl" contains a FieldInfo instance

For the available properties of the FieldInfo class instance, see the FieldInfo reference. You are likely interested in the value and range fields.

In other cases, you can just access the contents of the tvb directly.

permanent link

answered 16 Oct '16, 13:50

Lekensteyn's gravatar image

accept rate: 30%

Your answer
toggle preview

Follow this question

By Email:

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



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "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:


question asked: 09 Oct '16, 04:00

question was seen: 2,894 times

last updated: 16 Oct '16, 13:50

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