Ask Your Question
0

Access to previous frame

asked 2020-06-22 07:10:34 +0000

SimH gravatar image

updated 2020-06-22 07:11:29 +0000

Hello I wanted to know if there was a way to access the data of previous frame from the function static int dissect_custom_protocol(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree _U_, void *data _U_).

Ideally, I need tvbuff_t *tvb of the previous frame to extract information related to the current frame. To be able to use proto_tree_add_item(...) with the new tvb.

edit retag flag offensive close merge delete

Comments

Thanks to all I had not understood this mechanism, I will save the data in an external file.

SimH gravatar imageSimH ( 2020-06-22 09:29:39 +0000 )edit

2 Answers

Sort by ยป oldest newest most voted
0

answered 2020-06-22 09:07:41 +0000

Guy Harris gravatar image

If a dissector for frame N meeds information from frame M for that protocol, where M < N, the dissector should maintain that state in private data, or per-frame data. What data do you need from the earlier frame?

edit flag offensive delete link more
0

answered 2020-06-22 08:26:17 +0000

Anders gravatar image

The dissectors arwe only passed the content of the current packet. If any information from that packet is needed to dissect a following packet it must be saved in some way. Note that packets are only scanned in sequence on the first pas and may be re-read in any order.

edit flag offensive delete link more

Comments

okay, thank you. How can we re-read in any order ?

SimH gravatar imageSimH ( 2020-06-22 08:37:16 +0000 )edit

A dissector can't do a re read. Every time a packet is displayed in the UI it's information is re-read from file. Packets are not stored in memory only some state depending on the dissector.

Anders gravatar imageAnders ( 2020-06-22 09:02:21 +0000 )edit

It is Wireshark that re-reads in any order. What happens a load time is that the capture file is read sequentially once, then (for tshark only when -2 is given) again randomly for the packet to show. This means there is no concept of previous frame for a dissector. There is the current frame and the context build up during the initial sequential reading of the file. It is in this context you can store information collected from packets more to the start of the capture file. Look at conversation in README.dissector for how to handle this context.

Jaap gravatar imageJaap ( 2020-06-22 09:07:16 +0000 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2020-06-22 07:10:34 +0000

Seen: 1,090 times

Last updated: Jun 22 '20