Ethereal-dev: Re: [Ethereal-dev] mergecap patch: dissimilar frame encapsulation types

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

From: Guy Harris <guy@xxxxxxxxxx>
Date: Fri, 13 Jul 2001 11:22:14 -0700 (PDT)
> Merging capture files with dissimilar frame encapsulation types (e.g.,
> one file came from an ethernet interface and the other from loopback)
> appears to be unuseful (i.e., Ethereal can't process all packets in the
> file and the frame encapsulation type is an attribute of the file and
> not the frame).  (Correct me if I'm wrong or if this is only true of
> pcap files).

In Wiretap, there's a frame type value both for the file and for
individual frames in a file.

If the file has the frame type WTAP_ENCAP_PER_PACKET, the file itself
doesn't have a frame type; only individual frames do.  Otherwise, all
frames have the same frame type as the file.

If all files to be merged have the same frame type, that should be
chosen as the output frame type.  Otherwise, WTAP_ENCAP_PER_PACKET
should be chosen as the output frame type.

If a particular capture file type (e.g, WTAP_FILE_PCAP, WTAP_FILE_SNOOP,
etc.) can's support a particular frame encapsulation type (either a
specific type, or WTAP_ENCAP_PER_PACKET), the attempt to open the
capture file for writing will fail, and a specific reason for the
failure will be returned through the "err" argument pointer.

As such, just changing the code so that WTAP_ENCAP_PER_PACKET is chosen
if not all files have the same frame encapsulation type should be
sufficient - if the output type can handle that, you win, otherwise
"wtap_dump_open()" will fail and mergecap will print the right error
message.