Ethereal-dev: [Ethereal-dev] Adding the "Decode as" functionality to tethereal

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Lionel Ains <lains@xxxxxxx>
Date: Thu, 22 May 2003 23:27:31 +0200
Hi all,

I've modified tethereal to add a functionality similar to the "Decode As" dialog on ethereal.
This consists of an additional switch '-d' on the command-line.
I would like to make it more user-friendly by showing the dissector names (i.e. rtp, mip...) used as the key in the hash table for dissectors corresponding to each protocol short names shown in the "Decode As" dialog (i.e. RTP, Mobile IP). So far, I've been able to get all handles for a specific table. For example, when working with "ip.proto", I use dissector_table_foreach_handle("ip.proto", func, user_data) from packet.c. This allows me to get each handles for every dissector for "ip.proto". This allows me to get the short name for each handle, but not the key within the hash.
Is there a way for me to extract the hash key from a dissector's handle?
This way, I can use the key rather than the short name to specify a dissector on the command-line.

Lionel