andre@0: /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ andre@0: /* This Source Code Form is subject to the terms of the Mozilla Public andre@0: * License, v. 2.0. If a copy of the MPL was not distributed with this andre@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ andre@0: andre@0: /* andre@0: * File: prinet.h andre@0: * Description: andre@0: * Header file used to find the system header files for socket support[1]. andre@0: * This file serves the following purposes: andre@0: * - A cross-platform, "get-everything" socket header file. On andre@0: * Unix, socket support is scattered in several header files, andre@0: * while Windows has a "get-everything" socket header file[2]. andre@0: * - NSPR needs the following macro definitions and function andre@0: * prototype declarations from these header files: andre@0: * AF_INET andre@0: * INADDR_ANY, INADDR_LOOPBACK, INADDR_BROADCAST andre@0: * ntohl(), ntohs(), htonl(), ntons(). andre@0: * NSPR does not define its own versions of these macros and andre@0: * functions. It simply uses the native versions, which have andre@0: * the same names on all supported platforms. andre@0: * This file is intended to be included by NSPR public header andre@0: * files, such as prio.h. One should not include this file directly. andre@0: * andre@0: * Notes: andre@0: * 1. This file should have been an internal header. Please do not andre@0: * depend on it to pull in the system header files you need. andre@0: * 2. WARNING: This file is no longer cross-platform as it is a no-op andre@0: * for WIN32! See the comment in the WIN32 section for details. andre@0: */ andre@0: andre@0: #ifndef prinet_h__ andre@0: #define prinet_h__ andre@0: andre@0: #if defined(XP_UNIX) || defined(XP_OS2) || defined(XP_BEOS) andre@0: #include andre@0: #include /* AF_INET */ andre@0: #include /* INADDR_ANY, ..., ntohl(), ... */ andre@0: #ifdef XP_OS2 andre@0: #include andre@0: #endif andre@0: #ifdef XP_UNIX andre@0: #ifdef AIX andre@0: /* andre@0: * On AIX 4.3, the header refers to struct andre@0: * ether_addr and struct sockaddr_dl that are not declared. andre@0: * The following struct declarations eliminate the compiler andre@0: * warnings. andre@0: */ andre@0: struct ether_addr; andre@0: struct sockaddr_dl; andre@0: #endif /* AIX */ andre@0: #include andre@0: #endif /* XP_UNIX */ andre@0: #include andre@0: andre@0: #if defined(FREEBSD) || defined(BSDI) || defined(QNX) andre@0: #include /* the only place that defines INADDR_LOOPBACK */ andre@0: #endif andre@0: andre@0: /* andre@0: * OS/2 hack. For some reason INADDR_LOOPBACK is not defined in the andre@0: * socket headers. andre@0: */ andre@0: #if defined(OS2) && !defined(INADDR_LOOPBACK) andre@0: #define INADDR_LOOPBACK 0x7f000001 andre@0: #endif andre@0: andre@0: /* andre@0: * Prototypes of ntohl() etc. are declared in andre@0: * on these platforms. andre@0: */ andre@0: #if defined(BSDI) || defined(OSF1) andre@0: #include andre@0: #endif andre@0: andre@0: /* On Android, ntohl() etc. are declared in . */ andre@0: #ifdef __ANDROID__ andre@0: #include andre@0: #endif andre@0: andre@0: #elif defined(WIN32) andre@0: andre@0: /* andre@0: * Do not include any system header files. andre@0: * andre@0: * Originally we were including . It slowed down the andre@0: * compilation of files that included NSPR headers, so we removed andre@0: * the inclusion at customer's request, which created andre@0: * an unfortunate inconsistency with other platforms. andre@0: */ andre@0: andre@0: #else andre@0: andre@0: #error Unknown platform andre@0: andre@0: #endif andre@0: andre@0: #endif /* prinet_h__ */