Ethereal-dev: Re: [ethereal-dev] How to handle compiler padding?

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: Mon, 6 Dec 1999 14:45:40 -0800 (PST)
> The functions pntohs|l are useful in this context,

Replace "useful in this context" with "necessary in most contexts" (and,
for some contexts, use "pletoh[sl]()" rather than "pntoh[sl]()"), as per
my previous mail.

> If you're lucky enough to have a structure where the multibyte
> primitives start on 32-bit boundaries (and you're running on a 32-bit
> machine) then you may be in luck.

...but not if

	1) the machine on which you're running Ethereal doesn't have the
	   same byte order as the one specified for your protocol;

	2) the stuff *before* it in the packet doesn't happen to be of
	   such as size as to cause stuff to be properly aligned.