tcpdump mailing list archives

Re: libpcap pcap_dumper_t: feature request


From: Guy Harris <guy () alum mit edu>
Date: Mon, 3 Nov 2003 19:12:40 -0800


On Oct 23, 2003, at 3:50 PM, Craig Davison wrote:

Regarding the API change, pcap_dump_ex() vs. pcap_dump_file():

I'm casting my vote for pcap_dump_file() because not only does it allow
the developer to check for errors, it also allows flushing of the output
stream (through fflush).

So does the "pcap_dump_flush()" that Andrew Brown added and that's in the current CVS version.

"pcap_dump_file()" might still be useful for other purposes, as an "escape hatch" (e.g., to get the raw file descriptor for the file, by doing "fileno(pcap_dump_file(xxx))"); I'm still inclined to have a "pcap_dump_check()", or something such as that, in addition, which would return 0 on success and -1 on error, for example - it saves a little bit of work in the dumping code path, as "pcap_dump()" could itself check the return values of "fwrite()" rather than calling "ferror()".

"_ex" is OK, I guess, as a suffix, although it doesn't really tell you how "pcap_dump_ex()" differs from "pcap_dump()". "pcap_dump_check()" is perhaps a little better, but it's still a little vague.

-
This is the TCPDUMP workers list. It is archived at
http://www.tcpdump.org/lists/workers/index.html
To unsubscribe use mailto:tcpdump-workers-request () tcpdump org?body=unsubscribe


Current thread: