Ethereal-dev: Re: [Ethereal-dev] Changing tap code not to call "epan_dissect_run()" one more t
On Fri, Oct 11, 2002 at 07:55:49AM +0000, Pia Sahlberg wrote:
> I agree 100% that doing two dissections is bad and should be eliminated.
>
> However, I would prefer a different approach.
>
> I think it would be cleaner if the code was changed instead so that
> in file.c the display/color-filter handling itself would become
> tap extensions.
By "display handling" I assume you mean "adding packets to the display
in Ethereal and printing them in Tethereal", rather than "display filter
handling in Ethereal and read filter handling in Tethereal", as the code
in "file.c" and "tethereal.c" does a dissection in order to:
1) generate the columns for display in Ethereal;
2) generate the columns *or* a full protocol tree for printing
in Tethereal;
so either the tap code would have to take "create protocol tree" and
"protocol tree is visible" arguments and return the protocol tree rather
than destroying it, so that the "file.c" and "tethereal.c" code can get
the columns and/or protocol tree, or the code to generate the columns
for display and print the columns or protocol tree would have to be a
tap.
Also, note that the tap code should not generate a protocol tree if
there aren't any tap listeners; if we implement my suggestion, the tap
code shouldn't do *anything* if there are no tap listeners, and if we
implement your suggestion, it should generate a protocol tree only if
1) it's told to do so by its caller
or
2) there are taps.
> For example: display-filter could be changed to be a 10 line tap extension
> that just changes a global variable.
Unfortunately, I think it would *not* be cleaner if the code were
changed to add rather than remove global variables; we already have the
"l_pseudo_header", "l_buf", and "l_fdata" globals, and I'd rather get
rid of them than add additional global variables.