Ethereal-dev: Re: [Ethereal-dev] Address columns

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, 19 Jun 2003 12:34:13 -0700

On Thursday, June 19, 2003, at 12:16PM, Shaun Jackman wrote:

Why is COL_INFO set using col_add_fstr, but address columns (like
COL_DEF_SRC) set using SET_ADDRESS(&pinfo->...)?

Because, currently, the columns are set for all packets when the capture is read in, and that's expensive; setting the address is cheaper, and, by setting the address in the dissectors and then setting the column based on the address, it only sets the text once, rather than once per dissector.

Note also that SET_ADDRESS isn't setting the column, it's setting the address; setting the address also makes it available to dissectors called later, and there are many dissectors that make use of that.

I have a higher level protocol (sits above UDP) that has its own
addressing scheme. I wanted to modify the address column to display more useful information. After trying col_add_fstr on COL_DEF_SRC and meeting
with failure, I started looking through the source. It looks like it
can't be done without defining a new AT_* type. This is a simple
in-house plugin that currently builds without modifying the Ethereal
source. I'd like to keep it that way. Can this be done any other way?

Set the address to an AT_NONE address (which means the column won't be set from the address), and then set the column with one of the "col_add" routines.

Note, though, that you should do this *after* your dissector uses the addresses in the pinfo structure (or save the old value and use that), and that if you do this, any dissectors you call won't have access to the addresses.