Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Ethereal-dev: Re: [Ethereal-dev] cinfo null when tree is not. How to update COL_INFO?

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

From: Guy Harris <guy@xxxxxxxxxxxx>
Date: Wed, 23 Jul 2003 10:59:58 -0700
On Wed, Jul 23, 2003 at 10:49:20AM -0500, Andy Howell wrote:
>     In my dissector, I am trying to set COL_INFO using:
> 
>       if(tree)
>             if (check_col(pinfo->cinfo, COL_INFO))
>                 col_set_str(pinfo->cinfo, COL_INFO, "This is my  message");
> 
> pinfo->cinfo is always null, so I can't set the column.
> Do I need to save cinfo when the dissector is called with tree = NULL?

You need to call "check_col()", and set the column if it returns true,
regardless of whether "tree" is null or not.  A dissector can be called
when columns are to be filled in regardless of whether a protocol tree
is to be built or not, and a dissector can be called when a protocol
tree is to be built regardless of whether columns are to be filled in or
not.