home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / nspr30-e.zip / nspr30-e / include / prinet.h < prev    next >
C/C++ Source or Header  |  1998-07-21  |  3KB  |  94 lines

  1. /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /*
  3.  * The contents of this file are subject to the Netscape Public License
  4.  * Version 1.0 (the "NPL"); you may not use this file except in
  5.  * compliance with the NPL.  You may obtain a copy of the NPL at
  6.  * http://www.mozilla.org/NPL/
  7.  * 
  8.  * Software distributed under the NPL is distributed on an "AS IS" basis,
  9.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
  10.  * for the specific language governing rights and limitations under the
  11.  * NPL.
  12.  * 
  13.  * The Initial Developer of this code under the NPL is Netscape
  14.  * Communications Corporation.  Portions created by Netscape are
  15.  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  16.  * Reserved.
  17.  */
  18.  
  19. /*
  20.  * File:        prinet.h
  21.  * Description:
  22.  *     Header file used to find the system header files for socket support.
  23.  *     This file serves the following purposes:
  24.  *     - A cross-platform, "get-everything" socket header file.  On
  25.  *       Unix, socket support is scattered in several header files,
  26.  *       while Windows and Mac have a "get-everything" socket header
  27.  *       file.
  28.  *     - NSPR needs the following macro definitions and function
  29.  *       prototype declarations from these header files:
  30.  *           AF_INET
  31.  *           INADDR_ANY, INADDR_LOOPBACK, INADDR_BROADCAST
  32.  *           ntohl(), ntohs(), htonl(), ntons().
  33.  *       NSPR does not define its own versions of these macros and
  34.  *       functions.  It simply uses the native versions, which have
  35.  *       the same names on all supported platforms.
  36.  *     This file is intended to be included by nspr20 public header
  37.  *     files, such as prio.h.  One should not include this file directly.
  38.  */
  39.  
  40. #ifndef prinet_h__
  41. #define prinet_h__
  42.  
  43. #if defined(XP_UNIX) || defined(XP_OS2)
  44.  
  45. #include <sys/types.h>
  46. #include <sys/socket.h>        /* AF_INET */
  47. #include <netinet/in.h>         /* INADDR_ANY, ..., ntohl(), ... */
  48. #ifdef XP_OS2
  49. #include <sys/ioctl.h>
  50. #else
  51. #include <arpa/inet.h>
  52. #endif
  53. #include <netdb.h>
  54.  
  55. #if defined(FREEBSD) || defined(BSDI)
  56. #include <rpc/types.h> /* the only place that defines INADDR_LOOPBACK */
  57. #endif
  58.  
  59. /*
  60.  * OS/2 hack.  For some reason INADDR_LOOPBACK is not defined in the
  61.  * socket headers.
  62.  */
  63. #if defined(OS2) && !defined(INADDR_LOOPBACK)
  64. #define INADDR_LOOPBACK gethostid()
  65. #endif
  66.  
  67. /*
  68.  * Prototypes of ntohl() etc. are declared in <machine/endian.h>
  69.  * on these platforms.
  70.  */
  71. #if defined(BSDI) || defined(OSF1)
  72. #include <machine/endian.h>
  73. #endif
  74.  
  75. #elif defined(WIN32)
  76.  
  77. /* Do not include any system header files. */
  78.  
  79. #elif defined(WIN16)
  80.  
  81. #include <winsock.h>
  82.  
  83. #elif defined(XP_MAC)
  84.  
  85. #include "macsocket.h"
  86.  
  87. #else
  88.  
  89. #error Unknown platform
  90.  
  91. #endif
  92.  
  93. #endif /* prinet_h__ */
  94.