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