inet.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 1983, 1993
00003  *      The Regents of the University of California.  All rights reserved.
00004  *
00005  * Redistribution and use in source and binary forms, with or without
00006  * modification, are permitted provided that the following conditions
00007  * are met:
00008  * 1. Redistributions of source code must retain the above copyright
00009  *    notice, this list of conditions and the following disclaimer.
00010  * 2. Redistributions in binary form must reproduce the above copyright
00011  *    notice, this list of conditions and the following disclaimer in the
00012  *    documentation and/or other materials provided with the distribution.
00013  * 3. All advertising materials mentioning features or use of this software
00014  *    must display the following acknowledgement:
00015  *      This product includes software developed by the University of
00016  *      California, Berkeley and its contributors.
00017  * 4. Neither the name of the University nor the names of its contributors
00018  *    may be used to endorse or promote products derived from this software
00019  *    without specific prior written permission.
00020  *
00021  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
00022  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00023  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00024  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
00025  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00026  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
00027  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00028  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00029  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
00030  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00031  * SUCH DAMAGE.
00032  * -
00033  * Portions Copyright (c) 1993 by Digital Equipment Corporation.
00034 * © Portions copyright (c) 2007 Symbian Software Ltd. All rights reserved.
00035  * Permission to use, copy, modify, and distribute this software for any
00036  * purpose with or without fee is hereby granted, provided that the above
00037  * copyright notice and this permission notice appear in all copies, and that
00038  * the name of Digital Equipment Corporation not be used in advertising or
00039  * publicity pertaining to distribution of the document or software without
00040  * specific, written prior permission.
00041  * 
00042  * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
00043  * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
00044  * OF MERCHANTABILITY AND FITNESS.   IN NO EVENT SHALL DIGITAL EQUIPMENT
00045  * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
00046  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
00047  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
00048  * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
00049  * SOFTWARE.
00050  *
00051  *      @(#)inet.h      8.1 (Berkeley) 6/2/93
00052  *      From: Id: inet.h,v 8.5 1997/01/29 08:48:09 vixie Exp $
00053  * $FreeBSD: src/include/arpa/inet.h,v 1.25 2002/08/21 16:19:56 mike Exp $
00054  */
00055 
00056 #ifndef _ARPA_INET_H_
00057 #define _ARPA_INET_H_
00058 
00059 /* External definitions for functions in inet(3), addr2ascii(3) */
00060 
00061 #include <sys/cdefs.h>
00062 #include <sys/_types.h>
00063 
00064 /* Required for byteorder(3) functions. */
00065 #include <machine/endian.h>
00066 
00067 #ifdef __cplusplus
00068 extern "C" {
00069 #endif
00070 #define INET_ADDRSTRLEN         16
00071 #define INET6_ADDRSTRLEN        46
00072 
00073 #ifndef _UINT16_T_DECLARED
00074 typedef __uint16_t      uint16_t;
00075 #define _UINT16_T_DECLARED
00076 #endif
00077 
00078 #ifndef _UINT32_T_DECLARED
00079 typedef __uint32_t      uint32_t;
00080 #define _UINT32_T_DECLARED
00081 #endif
00082 
00083 #ifndef _IN_ADDR_T_DECLARED
00084 typedef uint32_t        in_addr_t;
00085 #define _IN_ADDR_T_DECLARED
00086 #endif
00087 
00088 #ifndef _IN_PORT_T_DECLARED
00089 typedef uint16_t        in_port_t;
00090 #define _IN_PORT_T_DECLARED
00091 #endif
00092 
00093 #if __BSD_VISIBLE
00094 #ifndef _SIZE_T_DECLARED
00095 typedef __size_t        size_t;
00096 #define _SIZE_T_DECLARED
00097 #endif
00098 #endif
00099 
00100 /*
00101  * XXX socklen_t is used by a POSIX.1-2001 interface, but not required by
00102  * POSIX.1-2001.
00103  */
00104 #ifndef _SOCKLEN_T_DECLARED
00105 typedef __socklen_t     socklen_t;
00106 #define _SOCKLEN_T_DECLARED
00107 #endif
00108 
00109 #ifndef _STRUCT_IN_ADDR_DECLARED
00110 struct in_addr {
00111         in_addr_t s_addr;
00112 };
00113 #define _STRUCT_IN_ADDR_DECLARED
00114 #endif
00115 
00116 /* XXX all new diversions!! argh!! */
00117 #if __BSD_VISIBLE
00118 #define inet_addr       __inet_addr
00119 #define inet_aton       __inet_aton
00120 #define inet_lnaof      __inet_lnaof
00121 #define inet_makeaddr   __inet_makeaddr
00122 #define inet_neta       __inet_neta
00123 #define inet_netof      __inet_netof
00124 #define inet_network    __inet_network
00125 #define inet_net_ntop   __inet_net_ntop
00126 #define inet_net_pton   __inet_net_pton
00127 #define inet_ntoa       __inet_ntoa
00128 #define inet_pton       __inet_pton
00129 #define inet_ntop       __inet_ntop
00130 #define inet_nsap_addr  __inet_nsap_addr
00131 #define inet_nsap_ntoa  __inet_nsap_ntoa
00132 #endif /* __BSD_VISIBLE */
00133 
00134 __BEGIN_DECLS
00135 #if  !defined (_BYTEORDER_PROTOTYPED) ||defined(__SYMBIAN32__)
00136 #define _BYTEORDER_PROTOTYPED
00137 IMPORT_C uint32_t               htonl(uint32_t);
00138 IMPORT_C uint16_t        htons(uint16_t);
00139 #ifdef __SYMBIAN32__
00140 #define ntohl htonl
00141 #define ntohs htons
00142 #endif
00143 #endif
00144 
00145 IMPORT_C in_addr_t       inet_addr(const char *);
00146 IMPORT_C char           *inet_ntoa(struct in_addr);
00147 IMPORT_C const char     *inet_ntop(int, const void * __restrict, char * __restrict,
00148                     socklen_t);
00149 IMPORT_C int inet_pton(int, const char * __restrict, void * __restrict);
00150 
00151 #if __BSD_VISIBLE
00152 IMPORT_C int    inet_aton(const char *, struct in_addr *);
00153 
00154 #endif /* __BSD_VISIBLE */
00155 __END_DECLS
00156 
00157 #ifndef _BYTEORDER_FUNC_DEFINED
00158 #define _BYTEORDER_FUNC_DEFINED
00159 #define htonl(x)        __htonl(x)
00160 #define htons(x)        __htons(x)
00161 #define ntohl(x)        __ntohl(x)
00162 #define ntohs(x)        __ntohs(x)
00163 #endif
00164 #ifdef __cplusplus
00165 }
00166 #endif
00167 
00168 #endif /* !_ARPA_INET_H_ */

Copyright © Nokia Corporation 2001-2008
Back to top