Ethereal-dev: Re: [ethereal-dev] File Save Error - DOS Sniffer Format

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: Sat, 13 May 2000 18:45:59 -0700
On Sat, May 13, 2000 at 09:03:33PM +0100, Alan Harrison wrote:
> Thanks for the patch, I wont be able to try it until I'm next at work. I'm
> still a bit confused about how non-platform dependent code should be written
> and in what circumstances particular macros should be used.

Well, if you're converting from host byte order to a particular byte
order - which is what you'd be doing in Wiretap when writing out a file
where quantities are supposed to be in a particular byte order
(big-endian for "snoop" which was developed by the creator of the
big-endian SPARC architecture, little-endian for most if not all DOS or
Windows programs as DOS and Windows are supported only on little-endian
platforms), the macros to use are the ones that do that conversion, i.e.
"h"ost"to"{"n"etwork, meaning big-endian, or "l"ittle-"e"ndian}{"s"hort
or "l"ong}.

If you're converting in the other direction, it'd be the
"p{n,le}toh{s,l}" macros, as you're converting from "n"etwork
(big-endian) or "l"ittle-"e"ndian to "h"ost byte order.

> Also, I noticed your patch file didn't include a fix for the typo in
> wtap.h.

There isn't any reason to believe that causes any real problems; I
checked the fix for the typo into the source base, as the old code was
incorrect in any case, but didn't bother including it in the patch.