ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
July 17th, 2024 | 10:00am-11:55am SGT (UTC+8) | Online

Ethereal-dev: Re: [Ethereal-dev] Unnecessary checks to see if COL_PROTOCOL is being displayed

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: Thu, 18 Sep 2003 00:51:32 -0700
On Thu, Sep 18, 2003 at 12:16:21AM -0700, Richard Sharpe wrote:
> I was documenting some stuff on dissectors when I noticed that pretty much 
> all dissectors have this as the first statement in them:
> 
>         if (check_col(pinfo->cinfo, COL_PROTOCOL))
>                 col_set_str(pinfo->cinfo, COL_PROTOCOL, "POP");
> 
> However, if it is being called to build the protocol tree, should it 
> bother to update the summary pane, as that has most likely already been 
> done.

Yes, because, on the first pass through the packets, if you have a list
of color filters, or have a tap listener, it will be generating summary
pane column text *and* will be constructing the protocol tree; the same
is true if you have a display filter and are applying it.

The summary pane won't get updated if, for example, you've clicked on a
packet, because "check_col(pinfo->cinfo, COL_PROTOCOL)" will return
FALSE.