Back to index

lightning-sunbird  0.9+nobinonly
prinet.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is the Netscape Portable Runtime (NSPR).
00016  *
00017  * The Initial Developer of the Original Code is
00018  * Netscape Communications Corporation.
00019  * Portions created by the Initial Developer are Copyright (C) 1998-2000
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *
00024  * Alternatively, the contents of this file may be used under the terms of
00025  * either the GNU General Public License Version 2 or later (the "GPL"), or
00026  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00027  * in which case the provisions of the GPL or the LGPL are applicable instead
00028  * of those above. If you wish to allow use of your version of this file only
00029  * under the terms of either the GPL or the LGPL, and not to allow others to
00030  * use your version of this file under the terms of the MPL, indicate your
00031  * decision by deleting the provisions above and replace them with the notice
00032  * and other provisions required by the GPL or the LGPL. If you do not delete
00033  * the provisions above, a recipient may use your version of this file under
00034  * the terms of any one of the MPL, the GPL or the LGPL.
00035  *
00036  * ***** END LICENSE BLOCK ***** */
00037 
00038 /*
00039  * File:             prinet.h
00040  * Description:
00041  *     Header file used to find the system header files for socket support.
00042  *     This file serves the following purposes:
00043  *     - A cross-platform, "get-everything" socket header file.  On
00044  *       Unix, socket support is scattered in several header files,
00045  *       while Windows and Mac have a "get-everything" socket header
00046  *       file.
00047  *     - NSPR needs the following macro definitions and function
00048  *       prototype declarations from these header files:
00049  *           AF_INET
00050  *           INADDR_ANY, INADDR_LOOPBACK, INADDR_BROADCAST
00051  *           ntohl(), ntohs(), htonl(), ntons().
00052  *       NSPR does not define its own versions of these macros and
00053  *       functions.  It simply uses the native versions, which have
00054  *       the same names on all supported platforms.
00055  *     This file is intended to be included by nspr20 public header
00056  *     files, such as prio.h.  One should not include this file directly.
00057  */
00058 
00059 #ifndef prinet_h__
00060 #define prinet_h__
00061 
00062 #if defined(XP_UNIX) || defined(XP_OS2) || defined(XP_BEOS)
00063 #include <sys/types.h>
00064 #include <sys/socket.h>            /* AF_INET */
00065 #include <netinet/in.h>         /* INADDR_ANY, ..., ntohl(), ... */
00066 #ifdef XP_OS2
00067 #include <sys/ioctl.h>
00068 #endif
00069 #ifdef XP_UNIX
00070 #ifdef AIX
00071 /*
00072  * On AIX 4.3, the header <arpa/inet.h> refers to struct
00073  * ether_addr and struct sockaddr_dl that are not declared.
00074  * The following struct declarations eliminate the compiler
00075  * warnings.
00076  */
00077 struct ether_addr;
00078 struct sockaddr_dl;
00079 #endif /* AIX */
00080 #include <arpa/inet.h>
00081 #endif /* XP_UNIX */
00082 #include <netdb.h>
00083 
00084 #if defined(FREEBSD) || defined(BSDI) || defined(QNX)
00085 #include <rpc/types.h> /* the only place that defines INADDR_LOOPBACK */
00086 #endif
00087 
00088 /*
00089  * OS/2 hack.  For some reason INADDR_LOOPBACK is not defined in the
00090  * socket headers.
00091  */
00092 #if defined(OS2) && !defined(INADDR_LOOPBACK)
00093 #define INADDR_LOOPBACK 0x7f000001
00094 #endif
00095 
00096 /*
00097  * Prototypes of ntohl() etc. are declared in <machine/endian.h>
00098  * on these platforms.
00099  */
00100 #if defined(BSDI) || defined(OSF1)
00101 #include <machine/endian.h>
00102 #endif
00103 
00104 #elif defined(WIN32)
00105 
00106 /* Do not include any system header files. */
00107 
00108 #elif defined(WIN16)
00109 
00110 #include <winsock.h>
00111 
00112 #elif defined(XP_MAC)
00113 
00114 #include "macsocket.h"
00115 
00116 #else
00117 
00118 #error Unknown platform
00119 
00120 #endif
00121 
00122 #endif /* prinet_h__ */