PageRenderTime 444ms CodeModel.GetById 241ms app.highlight 2ms RepoModel.GetById 199ms app.codeStats 1ms

/gecko_api/include/prinet.h

http://firefox-mac-pdf.googlecode.com/
C++ Header | 122 lines | 35 code | 16 blank | 71 comment | 6 complexity | 7959679c65f8631dc92c6090371cc935 MD5 | raw file
  1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2/* ***** BEGIN LICENSE BLOCK *****
  3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  4 *
  5 * The contents of this file are subject to the Mozilla Public License Version
  6 * 1.1 (the "License"); you may not use this file except in compliance with
  7 * the License. You may obtain a copy of the License at
  8 * http://www.mozilla.org/MPL/
  9 *
 10 * Software distributed under the License is distributed on an "AS IS" basis,
 11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 12 * for the specific language governing rights and limitations under the
 13 * License.
 14 *
 15 * The Original Code is the Netscape Portable Runtime (NSPR).
 16 *
 17 * The Initial Developer of the Original Code is
 18 * Netscape Communications Corporation.
 19 * Portions created by the Initial Developer are Copyright (C) 1998-2000
 20 * the Initial Developer. All Rights Reserved.
 21 *
 22 * Contributor(s):
 23 *
 24 * Alternatively, the contents of this file may be used under the terms of
 25 * either the GNU General Public License Version 2 or later (the "GPL"), or
 26 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
 27 * in which case the provisions of the GPL or the LGPL are applicable instead
 28 * of those above. If you wish to allow use of your version of this file only
 29 * under the terms of either the GPL or the LGPL, and not to allow others to
 30 * use your version of this file under the terms of the MPL, indicate your
 31 * decision by deleting the provisions above and replace them with the notice
 32 * and other provisions required by the GPL or the LGPL. If you do not delete
 33 * the provisions above, a recipient may use your version of this file under
 34 * the terms of any one of the MPL, the GPL or the LGPL.
 35 *
 36 * ***** END LICENSE BLOCK ***** */
 37
 38/*
 39 * File:		prinet.h
 40 * Description:
 41 *     Header file used to find the system header files for socket support.
 42 *     This file serves the following purposes:
 43 *     - A cross-platform, "get-everything" socket header file.  On
 44 *       Unix, socket support is scattered in several header files,
 45 *       while Windows and Mac have a "get-everything" socket header
 46 *       file.
 47 *     - NSPR needs the following macro definitions and function
 48 *       prototype declarations from these header files:
 49 *           AF_INET
 50 *           INADDR_ANY, INADDR_LOOPBACK, INADDR_BROADCAST
 51 *           ntohl(), ntohs(), htonl(), ntons().
 52 *       NSPR does not define its own versions of these macros and
 53 *       functions.  It simply uses the native versions, which have
 54 *       the same names on all supported platforms.
 55 *     This file is intended to be included by nspr20 public header
 56 *     files, such as prio.h.  One should not include this file directly.
 57 */
 58
 59#ifndef prinet_h__
 60#define prinet_h__
 61
 62#if defined(XP_UNIX) || defined(XP_OS2) || defined(XP_BEOS)
 63#include <sys/types.h>
 64#include <sys/socket.h>		/* AF_INET */
 65#include <netinet/in.h>         /* INADDR_ANY, ..., ntohl(), ... */
 66#ifdef XP_OS2
 67#include <sys/ioctl.h>
 68#endif
 69#ifdef XP_UNIX
 70#ifdef AIX
 71/*
 72 * On AIX 4.3, the header <arpa/inet.h> refers to struct
 73 * ether_addr and struct sockaddr_dl that are not declared.
 74 * The following struct declarations eliminate the compiler
 75 * warnings.
 76 */
 77struct ether_addr;
 78struct sockaddr_dl;
 79#endif /* AIX */
 80#include <arpa/inet.h>
 81#endif /* XP_UNIX */
 82#include <netdb.h>
 83
 84#if defined(FREEBSD) || defined(BSDI) || defined(QNX)
 85#include <rpc/types.h> /* the only place that defines INADDR_LOOPBACK */
 86#endif
 87
 88/*
 89 * OS/2 hack.  For some reason INADDR_LOOPBACK is not defined in the
 90 * socket headers.
 91 */
 92#if defined(OS2) && !defined(INADDR_LOOPBACK)
 93#define INADDR_LOOPBACK 0x7f000001
 94#endif
 95
 96/*
 97 * Prototypes of ntohl() etc. are declared in <machine/endian.h>
 98 * on these platforms.
 99 */
100#if defined(BSDI) || defined(OSF1)
101#include <machine/endian.h>
102#endif
103
104#elif defined(WIN32)
105
106/* Do not include any system header files. */
107
108#elif defined(WIN16)
109
110#include <winsock.h>
111
112#elif defined(XP_MAC)
113
114#include "macsocket.h"
115
116#else
117
118#error Unknown platform
119
120#endif
121
122#endif /* prinet_h__ */