home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 4 / DATAFILE_PDCD4.iso / languages / netlib / !NetLib / sys / h / byteorder next >
Encoding:
Text File  |  1995-05-23  |  789 b   |  39 lines

  1. #ifndef __sys_byteorder_h
  2. #define __sys_byteorder_h
  3.  
  4. /* Freenet programmers library - sys/byteorder.h - 23/5/95 */
  5.  
  6. /*
  7.  * Byte order definitions
  8.  */
  9. #define LITTLE_ENDIAN 1234 /* Arcs, Vaxen, Motorola chips */
  10. #define BIG_ENDIAN    4321 /* Intel chips, Net byte order */
  11. #define PDP_ENDIAN    3412 /* DEC PDP machines */
  12.  
  13. /*
  14.  * Acorn machines use the ARM in little endian form
  15.  */
  16. #define BYTE_ORDER    LITTLE_ENDIAN
  17.  
  18. /*
  19.  * Convert a 32 bit word from host to net byte order
  20.  */
  21. extern u_long htonl(u_long);
  22.  
  23. /*
  24.  * Convert a 32 bit word from net to host byte order
  25.  */
  26. extern u_long ntohl(u_long);
  27.  
  28. /*
  29.  * Convert a 16 bit word from host to net byte order
  30.  */
  31. extern u_short htons(u_short);
  32.  
  33. /*
  34.  * Convert a 16 bit word from net to host byte order
  35.  */
  36. extern u_short ntohs(u_short);
  37.  
  38. #endif
  39.