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

How do I tell that a new capture has been opened for Wireshark?

0

I am building a plugin for Wireshark, and I have several global variables that record and keep track of data from different packets. When a new capture is opened, I want to be able to clear these variables so the previous data isn't mixed up with the new data.

Is there a function or property in Wireshark that can alert me that a new capture file has been opened?

asked 22 Aug '14, 18:22

Frankie's gravatar image

Frankie
31115
accept rate: 0%


One Answer:

3

You can register a callback function thanks to the register_init_routine() function that will be called when opening a new capture (or applying a display filter). In your function, clear your data. You can see an example in packet-tcp.c.

answered 23 Aug '14, 03:32

Pascal%20Quantin's gravatar image

Pascal Quantin
5.5k1060
accept rate: 30%

Worked perfectly, thanks!

(25 Aug '14, 16:04) Frankie