Ethereal-dev: Re: [ethereal-dev] integrating a system with ethereal

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Gilbert Ramirez <gram@xxxxxxxxxx>
Date: Mon, 27 Sep 1999 14:05:57 -0500
On Mon, Sep 27, 1999 at 01:31:25PM -0500, Jim Yuill wrote:
> 
> 
> Any advice on this most appreciated, especially how to dump the packets to
> a file in tcpdump format.

For a very simple example, take a look at randpkt.c. If you have
ethereal-0.7.5, then there is a file in the top-level directory
called randpkt.c. The randpkt is not built by default, but you can
build it via 'make randpkt'. (Unfortunately, until I get the autoconf
stuff straightened out, it assumes that you built wiretap with zlib.
If that is not the case, you'll have to remove '-lz' from the link
line of randpkt in the Makefile).

Randpkt creates random packets and writes them to a file in libpcap
format. It uses the wiretap library's interface for writing files.
Right now the only output format that wiretap has is libpcap.

The documentation for randpkt is in doc/randpkt.txt.

So, you can link against libwiretap.a, or use the randpkt code to
understand what wiretap is doing, and emulate wiretap's behavior
in your code.

--gilbert