Ethereal-dev: Re: [ethereal-dev] more real-time capture and full display

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

From: guy@xxxxxxxxxx (Guy Harris)
Date: Mon, 10 May 1999 12:29:43 -0700 (PDT)
> I'm not sure yet. I am trying to compile the latest code on sparc, but
> alignment.h defines macros only for i386. I'll have a little time today
> to work on alignment.h

Actually, we already have macros that do most if not all of what the
"G*" macros in "alignment.h" do, and the "P*" macros aren't used
(Ethereal is read-only :-)).

I.e., we have "pletohs()" and "pletohl()".

The following appeared to work when I tried it on a capture file I have.
Any votes on whether to

	1) go with this file (with any fixes required);

	2) replace the G* macros with direct calls to "pletoh*()" for
	   2-or-4-byte quantities and direct "&pd[offset]" references
	   for 1-byte quantities?

 /*
  * alignment.h, Copyright, 1998, Richard Sharpe, All Rights Reserved
  *
  * Please see the file COPYING in the top level for details of copying
  * this software. Use of this software is approved only under certain 
  * conditions.
  * 
  * This file implements the alignment macros for the Threaded SMB Server
  *
  * For the moment we assume Intel style architecture, but can support 
  * others.
  *
  * Modification History
  *
  * 16-Oct-1998, RJS, Initial Coding
  *
  */

#ifndef __ALIGNMENT_H
#define __ALIGNMENT_H

#define GBYTE(buf, pos)        (unsigned char)((char)buf[pos])
#define GSHORT(buf, pos)       pletohs(&buf[pos])
#define GSSHORT(buf, pos)      (signed)pletohs(&buf[pos])
#define GWORD(buf, pos)        pletohl(&buf[pos])

#endif