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

I am writing a Lua dissector for a protocol on top of the TCP protocol. It needs to store the acknowledgment number of request packets, in order to determine which is the corresponding response packet.

For example I can get the packet number with pinfo.number, is there any similar way I can access the acknowledgement number?

asked 07 May '12, 03:20

Ville's gravatar image

Ville
1112
accept rate: 0%

edited 07 May '12, 03:55

What protocol are you dissecting?

(07 May '12, 03:37) helloworld

A special protocol on top of the TCP protocol.

(07 May '12, 03:56) Ville

You can define the desired fields with Field.new() and then use the field definitions in the dissector function.

-- define the fields
tcp_srcp_f = Field.new("tcp.srcport")
tcp_dstp_f = Field.new("tcp.dstport")
tcp_ack_f = Field.new("tcp.ack")
tcp_seq_f = Field.new("tcp.seq")

function tcp_test_proto.dissector(buffer,pinfo,tree)
-- use the fields in the dissector
local sport = tcp_srcp_f()
local dport = tcp_dstp_f()
local ack = tcp_ack_f()
local seq = tcp_seq_f()
...
end

Regards
Kurt

permanent link

answered 07 May '12, 06:57

Kurt%20Knochner's gravatar image

Kurt Knochner ♦
24.8k1039237
accept rate: 15%

edited 07 May '12, 06:58

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:

×752
×637
×431
×12
×3

question asked: 07 May '12, 03:20

question was seen: 4,344 times

last updated: 07 May '12, 06:58

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