On Tue, Oct 02, 2001 at 11:11:48AM -0700, Guy Harris wrote:
> By the way, is there some compelling reason why "dump_and_trunc()", and
> the routines it uses, are in a separate file, rather than being in
> "tcpdump.c"?

I don't know of any, so I moved them to "tcpdump.c"...

> And shouldn't "dump_and_trunc()" just call "pcap_dump()" to write the
> record to the capture file, rather than copying the code in
> "pcap_dump()"?

...and changed it to just call "pcap_dump()"...

> Also, "dump_and_trunc()", when rotating over to the next capture file,
> closes the currently-open output file and opens a new one, but doesn't
> tell its caller (or other routines up the call tree) about it.  This
> might happen to work, as the same "FILE" structure might get reused, but
> it still looks unsafe.  Perhaps the result of the original
> "pcap_dump_open()" should be given static storage duration (and static
> storage class if we move "dump_and_trunc()" to "tcpdump.c"), and
> "dump_and_trunc()" should store the result of "pcap_dump_open()" there.

...and, instead, made the first argument to "dump_and_trunc()" a pointer
to a structure containing

        a pointer to the dump file name;

        a pointer to the "pcap_t" from which we're reading packets;

        a pointer to the "pcap_dumper_t" to which we're writing packets;

and had it update the last of those fields when it rotates capture
files.
-
This is the TCPDUMP workers list. It is archived at
http://www.tcpdump.org/lists/workers/index.html
To unsubscribe use mailto:[EMAIL PROTECTED]?body=unsubscribe

Reply via email to