[Gllug] endian.h

Andy Farnsworth farnsaw at stonedoor.com
Wed Feb 5 15:00:57 UTC 2003


Hey,
  I bounced this question off a Guru friend of mine on the NLUG
http:www.nlug.org mailing list and got this response:

Let me know how it works out.

Andy

-----Original Message-----
From: nlug-request at bounce.netcentral.net
[mailto:nlug-request at bounce.netcentral.net]On Behalf Of Timothy Ball
Sent: February 05 2003 15:40
To: NLUG ListServ
Subject: [nlug] Re: FW: [Gllug] endian.h


On Wed, Feb 05, 2003 at 11:17:56AM +0100, Andy Farnsworth wrote:
> -----Original Message-----
> From: gllug-admin at linux.co.uk [mailto:gllug-admin at linux.co.uk]On Behalf
> Of Mike Brodbelt
> Sent: February 05 2003 03:18
> To: gllug at linux.co.uk
> Subject: [Gllug] endian.h
>
>
> One of the source files makes use of functions like betoh32(),
> letoh32(), and also the 16bit variants of those. On OpenBSD, the
> function prototypes are in <machine/endian.h>, but, though Linux has an
> endian.h file, those functions aren't in it.
>
> What can I replace <machine/endian.h> with in order to get this to
> compile? Or is it a case of #ifdef'ing out those function calls, and
> replacing them with Linux equivalents?
>

Big Endian (aka network byte order)
Little Endian  (busted x86 byte order)

So betoh32 <-> ntohl && letoh32 <-> htonl

--snip--snip--snip--
#define betoh32(x) 	ntohl(x)
#define letoh32(x) 	htonl(x)
--snip--snip--snip--

--timball

--
	GPG key available on pgpkeys.mit.edu
pub  1024D/511FBD54 2001-07-23 Timothy Lu Hu Ball <timball at tux.org>
Key fingerprint = B579 29B0 F6C8 C7AA 3840  E053 FE02 BB97 511F BD54
--
Send all requests to:  nlug-request at linuxlists.org
 Put your command in the SUBJECT of the message:
   "subscribe" or "unsubscribe"
Quick unsubscribe:
<mailto:nlug-request at linuxlists.org?Subject=3Dunsubscribe>
Mailing list archives may be found at: <http://www.nlug.org/mail/>
**********************************************************************
This list is from your pals at NetCentral <http://www.netcentral.com/>



-----Original Message-----
From: gllug-admin at linux.co.uk [mailto:gllug-admin at linux.co.uk]On Behalf
Of Mike Brodbelt
Sent: February 05 2003 03:18
To: gllug at linux.co.uk
Subject: [Gllug] endian.h





I'm interested in porting a small OpenBSD program to Linux, but I'm
currently having grief getting parts of it to compile.

One of the source files makes use of functions like betoh32(),
letoh32(), and also the 16bit variants of those. On OpenBSD, the
function prototypes are in <machine/endian.h>, but, though Linux has an
endian.h file, those functions aren't in it.

What can I replace <machine/endian.h> with in order to get this to
compile? Or is it a case of #ifdef'ing out those function calls, and
replacing them with Linux equivalents?

TIA,

Mike.


--
Gllug mailing list  -  Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug


-- 
Gllug mailing list  -  Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug




More information about the GLLUG mailing list