williamr@2
|
1 |
/*
|
williamr@2
|
2 |
* Copyright (c) 1983, 1993
|
williamr@2
|
3 |
* The Regents of the University of California. All rights reserved.
|
williamr@2
|
4 |
*
|
williamr@2
|
5 |
* Redistribution and use in source and binary forms, with or without
|
williamr@2
|
6 |
* modification, are permitted provided that the following conditions
|
williamr@2
|
7 |
* are met:
|
williamr@2
|
8 |
* 1. Redistributions of source code must retain the above copyright
|
williamr@2
|
9 |
* notice, this list of conditions and the following disclaimer.
|
williamr@2
|
10 |
* 2. Redistributions in binary form must reproduce the above copyright
|
williamr@2
|
11 |
* notice, this list of conditions and the following disclaimer in the
|
williamr@2
|
12 |
* documentation and/or other materials provided with the distribution.
|
williamr@2
|
13 |
* 4. Neither the name of the University nor the names of its contributors
|
williamr@2
|
14 |
* may be used to endorse or promote products derived from this software
|
williamr@2
|
15 |
* without specific prior written permission.
|
williamr@2
|
16 |
*
|
williamr@2
|
17 |
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
williamr@2
|
18 |
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
williamr@2
|
19 |
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
williamr@2
|
20 |
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
williamr@2
|
21 |
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
williamr@2
|
22 |
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
williamr@2
|
23 |
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
williamr@2
|
24 |
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
williamr@2
|
25 |
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
williamr@2
|
26 |
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
williamr@2
|
27 |
* SUCH DAMAGE.
|
williamr@2
|
28 |
* -
|
williamr@2
|
29 |
* Portions Copyright (c) 1993 by Digital Equipment Corporation.
|
williamr@2
|
30 |
* © Portions copyright (c) 2007 Symbian Software Ltd. All rights reserved.
|
williamr@2
|
31 |
* Permission to use, copy, modify, and distribute this software for any
|
williamr@2
|
32 |
* purpose with or without fee is hereby granted, provided that the above
|
williamr@2
|
33 |
* copyright notice and this permission notice appear in all copies, and that
|
williamr@2
|
34 |
* the name of Digital Equipment Corporation not be used in advertising or
|
williamr@2
|
35 |
* publicity pertaining to distribution of the document or software without
|
williamr@2
|
36 |
* specific, written prior permission.
|
williamr@2
|
37 |
*
|
williamr@2
|
38 |
* THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
|
williamr@2
|
39 |
* WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
|
williamr@2
|
40 |
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
|
williamr@2
|
41 |
* CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
|
williamr@2
|
42 |
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
|
williamr@2
|
43 |
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
williamr@2
|
44 |
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
williamr@2
|
45 |
* SOFTWARE.
|
williamr@2
|
46 |
*
|
williamr@2
|
47 |
* @(#)inet.h 8.1 (Berkeley) 6/2/93
|
williamr@2
|
48 |
* From: Id: inet.h,v 8.5 1997/01/29 08:48:09 vixie Exp $
|
williamr@2
|
49 |
* $FreeBSD: src/include/arpa/inet.h,v 1.25 2002/08/21 16:19:56 mike Exp $
|
williamr@2
|
50 |
*/
|
williamr@2
|
51 |
|
williamr@2
|
52 |
#ifndef _ARPA_INET_H_
|
williamr@2
|
53 |
#define _ARPA_INET_H_
|
williamr@2
|
54 |
|
williamr@2
|
55 |
/* External definitions for functions in inet(3), addr2ascii(3) */
|
williamr@2
|
56 |
|
williamr@2
|
57 |
#include <sys/cdefs.h>
|
williamr@2
|
58 |
#include <sys/_types.h>
|
williamr@2
|
59 |
|
williamr@2
|
60 |
/* Required for byteorder(3) functions. */
|
williamr@2
|
61 |
#include <machine/endian.h>
|
williamr@2
|
62 |
|
williamr@2
|
63 |
#ifdef __cplusplus
|
williamr@2
|
64 |
extern "C" {
|
williamr@2
|
65 |
#endif
|
williamr@2
|
66 |
#define INET_ADDRSTRLEN 16
|
williamr@2
|
67 |
#define INET6_ADDRSTRLEN 46
|
williamr@2
|
68 |
|
williamr@2
|
69 |
#ifndef _UINT16_T_DECLARED
|
williamr@2
|
70 |
typedef __uint16_t uint16_t;
|
williamr@2
|
71 |
#define _UINT16_T_DECLARED
|
williamr@2
|
72 |
#endif
|
williamr@2
|
73 |
|
williamr@2
|
74 |
#ifndef _UINT32_T_DECLARED
|
williamr@2
|
75 |
typedef __uint32_t uint32_t;
|
williamr@2
|
76 |
#define _UINT32_T_DECLARED
|
williamr@2
|
77 |
#endif
|
williamr@2
|
78 |
|
williamr@2
|
79 |
#ifndef _IN_ADDR_T_DECLARED
|
williamr@2
|
80 |
typedef uint32_t in_addr_t;
|
williamr@2
|
81 |
#define _IN_ADDR_T_DECLARED
|
williamr@2
|
82 |
#endif
|
williamr@2
|
83 |
|
williamr@2
|
84 |
#ifndef _IN_PORT_T_DECLARED
|
williamr@2
|
85 |
typedef uint16_t in_port_t;
|
williamr@2
|
86 |
#define _IN_PORT_T_DECLARED
|
williamr@2
|
87 |
#endif
|
williamr@2
|
88 |
|
williamr@2
|
89 |
#if __BSD_VISIBLE
|
williamr@2
|
90 |
#ifndef _SIZE_T_DECLARED
|
williamr@2
|
91 |
typedef __size_t size_t;
|
williamr@2
|
92 |
#define _SIZE_T_DECLARED
|
williamr@2
|
93 |
#endif
|
williamr@2
|
94 |
#endif
|
williamr@2
|
95 |
|
williamr@2
|
96 |
/*
|
williamr@2
|
97 |
* XXX socklen_t is used by a POSIX.1-2001 interface, but not required by
|
williamr@2
|
98 |
* POSIX.1-2001.
|
williamr@2
|
99 |
*/
|
williamr@2
|
100 |
#ifndef _SOCKLEN_T_DECLARED
|
williamr@2
|
101 |
typedef __socklen_t socklen_t;
|
williamr@2
|
102 |
#define _SOCKLEN_T_DECLARED
|
williamr@2
|
103 |
#endif
|
williamr@2
|
104 |
|
williamr@2
|
105 |
#ifndef _STRUCT_IN_ADDR_DECLARED
|
williamr@2
|
106 |
struct in_addr {
|
williamr@2
|
107 |
in_addr_t s_addr;
|
williamr@2
|
108 |
};
|
williamr@2
|
109 |
#define _STRUCT_IN_ADDR_DECLARED
|
williamr@2
|
110 |
#endif
|
williamr@2
|
111 |
#ifndef __DOXYGEN__
|
williamr@2
|
112 |
/* XXX all new diversions!! argh!! */
|
williamr@2
|
113 |
#if __BSD_VISIBLE
|
williamr@2
|
114 |
#define inet_addr __inet_addr
|
williamr@2
|
115 |
#define inet_aton __inet_aton
|
williamr@2
|
116 |
#define inet_lnaof __inet_lnaof
|
williamr@2
|
117 |
#define inet_makeaddr __inet_makeaddr
|
williamr@2
|
118 |
#define inet_neta __inet_neta
|
williamr@2
|
119 |
#define inet_netof __inet_netof
|
williamr@2
|
120 |
#define inet_network __inet_network
|
williamr@2
|
121 |
#define inet_net_ntop __inet_net_ntop
|
williamr@2
|
122 |
#define inet_net_pton __inet_net_pton
|
williamr@2
|
123 |
#define inet_ntoa __inet_ntoa
|
williamr@2
|
124 |
#define inet_pton __inet_pton
|
williamr@2
|
125 |
#define inet_ntop __inet_ntop
|
williamr@2
|
126 |
#define inet_nsap_addr __inet_nsap_addr
|
williamr@2
|
127 |
#define inet_nsap_ntoa __inet_nsap_ntoa
|
williamr@2
|
128 |
#endif /* __BSD_VISIBLE */
|
williamr@2
|
129 |
#endif //__DOXYGEN__
|
williamr@2
|
130 |
|
williamr@2
|
131 |
__BEGIN_DECLS
|
williamr@2
|
132 |
#if !defined (_BYTEORDER_PROTOTYPED) ||defined(__SYMBIAN32__)
|
williamr@2
|
133 |
#define _BYTEORDER_PROTOTYPED
|
williamr@2
|
134 |
IMPORT_C uint32_t htonl(uint32_t);
|
williamr@2
|
135 |
IMPORT_C uint16_t htons(uint16_t);
|
williamr@2
|
136 |
#ifdef __SYMBIAN32__
|
williamr@2
|
137 |
#define ntohl htonl
|
williamr@2
|
138 |
#define ntohs htons
|
williamr@2
|
139 |
#endif
|
williamr@2
|
140 |
#endif
|
williamr@2
|
141 |
|
williamr@2
|
142 |
IMPORT_C in_addr_t inet_addr(const char *);
|
williamr@2
|
143 |
IMPORT_C char *inet_ntoa(struct in_addr);
|
williamr@2
|
144 |
IMPORT_C const char *inet_ntop(int, const void * __restrict, char * __restrict,
|
williamr@2
|
145 |
socklen_t);
|
williamr@2
|
146 |
IMPORT_C int inet_pton(int, const char * __restrict, void * __restrict);
|
williamr@2
|
147 |
|
williamr@2
|
148 |
#if __BSD_VISIBLE
|
williamr@2
|
149 |
IMPORT_C int inet_aton(const char *, struct in_addr *);
|
williamr@2
|
150 |
|
williamr@2
|
151 |
#endif /* __BSD_VISIBLE */
|
williamr@2
|
152 |
__END_DECLS
|
williamr@2
|
153 |
|
williamr@2
|
154 |
#ifndef _BYTEORDER_FUNC_DEFINED
|
williamr@2
|
155 |
#define _BYTEORDER_FUNC_DEFINED
|
williamr@2
|
156 |
#define htonl(x) __htonl(x)
|
williamr@2
|
157 |
#define htons(x) __htons(x)
|
williamr@2
|
158 |
#define ntohl(x) __ntohl(x)
|
williamr@2
|
159 |
#define ntohs(x) __ntohs(x)
|
williamr@2
|
160 |
#endif
|
williamr@2
|
161 |
#ifdef __cplusplus
|
williamr@2
|
162 |
}
|
williamr@2
|
163 |
#endif
|
williamr@2
|
164 |
|
williamr@2
|
165 |
#endif /* !_ARPA_INET_H_ */
|