Jason House said:
> The FILE* could direct output to stdout (what is currently done) or to a
> normal file (a pure text feature that could work for both ethereal -z
> and tethereal -z) or to a *pipe* or other special method for passing
> data internally without using the harddrive.
Piping from a process to itself can be done, at least on UNIX - and I
think the Win32 APIs for creating unnamed pipes support that as well;
however, you have to be *very* careful, as you have to give the pipe
reader a chance to read pipe data at the same time that you're writing it.
In addition, turning a list of values into a line, and then parsing it
back into a list of values, seems a bit wasteful, *and* can be difficult
if the separator between values is also part of a value (e.g., a value
with a comma in a comma-separated list, or a value with a space in a
white-space-separated list); you could use escapes, but those make the
output look ugly if it's being sent to a person.
That also brings up the fact that text output intended for a human would
look different from text output intended for another program or script -
the former would have titles, column headings, etc. and would probably
line up the values neatly, while the latter might not need titles or
column headings and might even require the reader to *remove* them, and
might have comma-separated or tab-separated values rather than
neatly-lined-up values.
Therefore:
> Another approach would be for a tap draw routine to build a table using
> some kind of data structure and then call a display routine (that would
> be different depending on if it was linked to ethereal or tethereal)
...I'd prefer that approach.
The display routine for Tethereal might, based on a command-line flag,
write the table out as a neat human-readable table or as comma-separated
or tab-separated values.
The display routine for Ethereal might, based on what the tap specified as
a default format *and* possibly based also on what the user requests (to
override the default), show the values as a table or, if the table is
purely numeric, as a bar graph or line graph or skyline graph. It might
also allow the data to be saved to a file either in the human-readable
format or the machine-readable format of Tethereal.
Some "tables" might be summary tables that would be drawn as bar or pie
charts (e.g., protocol traffic volume statistics) or as traffic charts
(one of those graphs that Etherape or various commercial sniffers draw)
rather than as bar graphs or line graphs or skyline graphs.
It might also be useful to allow a frame number to be attached to a table
entry; if a table entry has a frame number, and that entry is somehow
"selected" in the GUI, Ethereal could go to that frame in the packet list,
if it's currently in that list (i.e., not filtered out).
(Removing GUI code from taps would also:
allow taps to be loaded as plugins either by Tethereal or Ethereal;
allow taps to do GUI stuff in versions of Ethereal for more than one GUI
toolkit, e.g. GTK+, Qt/KDE, Aqua, Windows, etc..)