Wireshark-dev: Re: [Wireshark-dev] How to collect information from various packets during disse

Date: Thu, 24 Sep 2009 08:04:47 -0400
Since Wireshark includes glib, you can take advantage of glib's hash table API to store your ID/string mapping in a hash table.  If the table is global to your dissector code, then each time your dissector is run it will have access to the whole table and can look up the strings as needed.

To make the hash table global to your dissector, simply declare it at the top of your dissector source file, below the #includes but above the C functions. Make sure you create the hash table in your init code, and add the 'insert' and 'lookup' calls in your dissect function(s).

The Glib hash table API is described here:
http://library.gnome.org/devel/glib/stable/glib-Hash-Tables.html