Ethereal-dev: Re: [ethereal-dev] Reading capture files outside of Ethereal

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

From: Guy Harris <gharris@xxxxxxxxxxxx>
Date: Thu, 25 Nov 1999 01:45:16 -0800
> I have a collection of capture files captured with different tools, and I
> need to be able to read them and edit them, so I am looking at a program
> that can use wiretap.
> 
> As far as I can see, I have to do the following sort of things:
> 
> 	wtap_open_offline
> 	while (more) {
> 
> 	   wtap_seek_read ...
> 
> 	   process the data (maybe write it ... )
> 
>        }

If this program does a single sequential pass through the file, the way
to do it is with a "wtap_loop()" loop, as "read_capture_file()" in
"file.c" does - the "process the data" part is done in a callback
function, a pointer to which is handed to "wtap_loop()".  See
"wtap_dispatch_cb()" for an example of such a callback function. 
"wtap_loop()" does the reading for you - your callback routine just gets
handed the information read in.