ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
April 17th, 2024 | 14:30-16:00 SGT (UTC+8) | Online

Wireshark-dev: [Wireshark-dev] displaying TLV parameters - proto_tree_add_item_hidden for type

Date: Wed, 8 Oct 2008 17:02:29 +0200
Hi,
 
I've submitted a new dissector for Simulcrypt protocol and it contains TLV parameters (still fixing bugs).
 
I have a loop navigating through TLV parameters.
 
For each parameter I initally had:
 
proto_tree_add_item_hidden( simulcrypt_message_tree, hf_simulcrypt_parameter_type, tvb, offset, 2, FALSE );
 
(the benefit is being to search for simulcrypt.parameter_type)
 
And then I have a switch according to parameter type and use e.g.:
 
simulcrypt_item=proto_tree_add_item( simulcrypt_message_tree, hf_simulcrypt_ecm_channel_id, tvb, offset-plen,plen,FALSE);
proto_item_append_text(simulcrypt_item, ", Length %d (bytes), Type 0x%04x", plen,ptype); /* add length + type info to parameter */
 
This gave me one line per parameter being displayed (value, length, type):
 
ECM Channel ID: 0, Length 2 (bytes), Type 0x000e
 
Now before uploading a patch, I saw that the _hidden functions had been made obsolete, so I removed the _hidden, but it has the
side effect of displaying an extra line per parameter, before the actual item being added:
 
Parameter Type: ECM_CHANNEL_ID (0x000e)                                    <- this was originally hidden from display
ECM Channel ID: 0, Length 2 (bytes), Type 0x000e
 
As I have several parameters it is much less readable than when I had the _hidden part!
 
What do you recommend as a solution?
Leave it as it is i.e. Parameter type on one length, then actual parameter value below?
Or is there an easy fix (other than not adding the parameter type each time, losing the ability to search for simulcrypt.parameter_type)?
 
Thanks for your advice,
 
David