Wireshark-dev: [Wireshark-dev] Dissector lifecycle and per-file data

From: Vincent Mallet <vmallet@xxxxxxxxx>
Date: Mon, 29 Mar 2021 09:23:51 -0700
I am hoping this is the right place to ask this question but if not please redirect me.

I am working on a custom C dissector and need to keep some data around for the lifetime of the current file. At the moment I allocate my structures using various wmem_ functions with a wmem_file_scope() scope and keep them in conversations with conversation_get_proto_data() and conversation_add_proto_data(). It works great for conversation-related data but is not ideal for file-related data. 

Is there a way for a dissector to know a new file is being worked on and it’s time to reinitialize data structures? Or is there an equivalent to conversation_get_proto_data() but for a file? 

Any pointer to the right docs or example would be appreciated. 

Thanks,

   Vince.