Wireshark-dev: Re: [Wireshark-dev] custom columns in dissector

From: Jeff Morriss <jeff.morriss.ws@xxxxxxxxx>
Date: Wed, 09 Jun 2010 12:19:48 -0400
Andreas Schuler wrote:
hi,

is my question too dumb, my english too bad or is there no one that can
help me ?

How can i display a user defined text in a custom column ?

greets
Andreas


On Tue, Jun 01, 2010 at 10:27:28PM +0200, Andreas Schuler wrote:

i'm writing a dissector and want to use custom columns for displaying
some dynamic generated informations, but when i use
proto_tree_add_none_format() the column remains empty although in the
details the right values will be displayed. other proto_tree_add_...
works but only show the value that comes direct from packet-data, no
additional text etc.
Are you sure that FT_NONE is the appropriate field type to be using for
that?  To quote README.developer, "No field type.  Used for fields that
aren't given a value, and that can only be tested for presence or
absence..." - so there wouldn't be anything to be displayed in the
custom column.  What are the dynamic values you are displaying?

No, i'm not sure.
I want to show a piece of the packet-header in human readable,sortable
format.

i.e.:
Value   Column-Text
0	"[Ct]"
1	"[Ct]"
2	"[Nt]"
3	"[Nt]"
4	"[Qt]"
5	"[Escape]"
6	"[Mt]"
7	"[Mt]"

Thats shouldn't be difficult, but the value 7 is dependant on the packet
type either "[Mt]" or "[Pt]". So i can't use the normal
proto_tree_add_item and value_string contruct.

The background is, i want to clean some things in the DECT dissector
(packet_dect.c). There are many things to do, one of them is that all
infos from the packet only are written to COL_INFO since
Revision 28022
(http://anonsvn.wireshark.org/viewvc/trunk/epan/dissectors/packet-dect.c?r1=27904&r2=28022).
Now i want to write this infos to custom columns, not to any random chosen
COL_xxx fields like before.

The upper described example is the first thing that be showed in the
COL_INFO column and depends on
dect.AField.head.TA and dect.type (or COL_PROTOCOL == DECT RFP/DECT PP).

I think an FT_STRING(Z) field should work for this purpose: just build and add the string you want and add it to the protocol tree.