home *** CD-ROM | disk | FTP | other *** search
/ PC Extra Super CD 1998 January / PCPLUS131.iso / DJGPP / V2 / DJDEV201.ZIP / include / netinet / in.h < prev   
Encoding:
C/C++ Source or Header  |  1995-02-26  |  1020 b   |  47 lines

  1. /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
  2. #ifndef __dj_include_netinet_in_h_
  3. #define __dj_include_in_h_
  4.  
  5. #ifdef __cplusplus
  6. extern "C" {
  7. #endif
  8.  
  9. #ifndef __dj_ENFORCE_ANSI_FREESTANDING
  10.  
  11. #ifndef __STRICT_ANSI__
  12.  
  13. #ifndef _POSIX_SOURCE
  14.  
  15. unsigned long  htonl(unsigned long _val);
  16. unsigned long  ntohl(unsigned long _val);
  17. unsigned short htons(unsigned short _val);
  18. unsigned short ntohs(unsigned short _val);
  19.  
  20. #endif /* !_POSIX_SOURCE */
  21. #endif /* !__STRICT_ANSI__ */
  22. #endif /* !__dj_ENFORCE_ANSI_FREESTANDING */
  23.  
  24. #ifndef __dj_ENFORCE_FUNCTION_CALLS
  25.  
  26. extern __inline__ unsigned long
  27. htonl(unsigned long _val)
  28. {
  29.   return (_val << 24) | ((_val&0xff00) << 8) | ((_val&0xff0000) >> 8) | (_val >> 24);
  30. }
  31. #define ntohl(x) htonl(x)
  32.  
  33. extern __inline__ unsigned short
  34. htons(unsigned short _val)
  35. {
  36.   return (_val << 8) | (_val >> 8);
  37. }
  38. #define ntohs(x) htons(x)
  39.  
  40. #endif /* !__dj_ENFORCE_FUNCTION_CALLS */
  41.  
  42. #ifdef __cplusplus
  43. }
  44. #endif
  45.  
  46. #endif /* !__dj_include_in_h_ */
  47.