Ethereal-dev: Re: [Ethereal-dev] capture.c: seperate the mix of GTK and GUI independant things

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, 13 Nov 2003 11:46:12 -0800

On Nov 13, 2003, at 9:16 AM, Ulf Lamping wrote:

The stuff in the file "capture.c" is currently a mix of the "capturing engine" and the GTK things involved with it.

Currently capture.c consists of three "main topics":
-generic capturing things (wiretap, pcap, ...)
-capture info GTK dialog (the one displayed when the capture is in progress)
-GTK specifics (some of the pipe handling, ...)

IMHO it would be nice to seperate the generic capturing things (leave it in the "capture.c" file) and put the GTK specific things into the gtk dir.

Note that, currently, if you're not doing an "Update list of packets in real time" capture, the capture loop also has to do GUI stuff, so Ethereal can see packets and respond to user input in the same loop. As such, the capture loop would, at least in part, be GTK+-specific, although it might be possible to have the main capture loop call a routine in the GTK+-specific code.

If the Ethereal main loop worked by adding the file descriptor for the pcap_t on UNIX, or the handle for it on Windows, to the list of objects the GTK+ main loop should select on, that could perhaps be cleaned up somewhat, although that wouldn't work on

1) older versions of WinPcap (there's a problem where "pcap_getevent()" was returning bogus information on NT - "NT" including NT 5.x);

2) FreeBSD 4.5, I think (a workaround for a problem with BPF and "select()" won't, I think, work on 4.5).

Another possibility would be to run the low-level capturing in a subprocess all the time, and have the UI code just select from a pipe from the subprocess, although I'm not certain you can do that on Windows OT (95, 98, Me).