netdb.h revision 1.1.1.6 1 1.1.1.6 ghen /* $NetBSD: netdb.h,v 1.1.1.6 2007/03/30 19:48:20 ghen Exp $ */
2 1.1.1.6 ghen
3 1.1.1.4 christos /*
4 1.1.1.4 christos * ++Copyright++ 1980, 1983, 1988, 1993
5 1.1.1.4 christos * -
6 1.1.1.2 mrg * Copyright (c) 1980, 1983, 1988, 1993
7 1.1.1.2 mrg * The Regents of the University of California. All rights reserved.
8 1.1 cgd *
9 1.1 cgd * Redistribution and use in source and binary forms, with or without
10 1.1 cgd * modification, are permitted provided that the following conditions
11 1.1 cgd * are met:
12 1.1 cgd * 1. Redistributions of source code must retain the above copyright
13 1.1 cgd * notice, this list of conditions and the following disclaimer.
14 1.1 cgd * 2. Redistributions in binary form must reproduce the above copyright
15 1.1 cgd * notice, this list of conditions and the following disclaimer in the
16 1.1 cgd * documentation and/or other materials provided with the distribution.
17 1.1 cgd * 3. All advertising materials mentioning features or use of this software
18 1.1 cgd * must display the following acknowledgement:
19 1.1 cgd * This product includes software developed by the University of
20 1.1 cgd * California, Berkeley and its contributors.
21 1.1 cgd * 4. Neither the name of the University nor the names of its contributors
22 1.1 cgd * may be used to endorse or promote products derived from this software
23 1.1 cgd * without specific prior written permission.
24 1.1 cgd *
25 1.1 cgd * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
26 1.1 cgd * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 1.1 cgd * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28 1.1 cgd * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
29 1.1 cgd * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30 1.1 cgd * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31 1.1 cgd * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32 1.1 cgd * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33 1.1 cgd * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34 1.1 cgd * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 1.1 cgd * SUCH DAMAGE.
36 1.1.1.2 mrg * -
37 1.1.1.2 mrg * Portions Copyright (c) 1993 by Digital Equipment Corporation.
38 1.1.1.4 christos *
39 1.1.1.2 mrg * Permission to use, copy, modify, and distribute this software for any
40 1.1.1.2 mrg * purpose with or without fee is hereby granted, provided that the above
41 1.1.1.2 mrg * copyright notice and this permission notice appear in all copies, and that
42 1.1.1.2 mrg * the name of Digital Equipment Corporation not be used in advertising or
43 1.1.1.2 mrg * publicity pertaining to distribution of the document or software without
44 1.1.1.2 mrg * specific, written prior permission.
45 1.1.1.4 christos *
46 1.1.1.2 mrg * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
47 1.1.1.2 mrg * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
48 1.1.1.2 mrg * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
49 1.1.1.2 mrg * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
50 1.1.1.2 mrg * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
51 1.1.1.2 mrg * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
52 1.1.1.2 mrg * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
53 1.1.1.2 mrg * SOFTWARE.
54 1.1.1.2 mrg * -
55 1.1.1.4 christos * Portions Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
56 1.1.1.4 christos * All rights reserved.
57 1.1.1.4 christos *
58 1.1.1.4 christos * Redistribution and use in source and binary forms, with or without
59 1.1.1.4 christos * modification, are permitted provided that the following conditions
60 1.1.1.4 christos * are met:
61 1.1.1.4 christos * 1. Redistributions of source code must retain the above copyright
62 1.1.1.4 christos * notice, this list of conditions and the following disclaimer.
63 1.1.1.4 christos * 2. Redistributions in binary form must reproduce the above copyright
64 1.1.1.4 christos * notice, this list of conditions and the following disclaimer in the
65 1.1.1.4 christos * documentation and/or other materials provided with the distribution.
66 1.1.1.4 christos * 3. All advertising materials mentioning features or use of this software
67 1.1.1.4 christos * must display the following acknowledgement:
68 1.1.1.4 christos * This product includes software developed by WIDE Project and
69 1.1.1.4 christos * its contributors.
70 1.1.1.4 christos * 4. Neither the name of the project nor the names of its contributors
71 1.1.1.4 christos * may be used to endorse or promote products derived from this software
72 1.1.1.4 christos * without specific prior written permission.
73 1.1.1.4 christos *
74 1.1.1.4 christos * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
75 1.1.1.4 christos * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
76 1.1.1.4 christos * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
77 1.1.1.4 christos * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
78 1.1.1.4 christos * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
79 1.1.1.4 christos * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
80 1.1.1.4 christos * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
81 1.1.1.4 christos * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
82 1.1.1.4 christos * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
83 1.1.1.4 christos * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
84 1.1.1.4 christos * SUCH DAMAGE.
85 1.1.1.4 christos * -
86 1.1.1.2 mrg * --Copyright--
87 1.1.1.2 mrg */
88 1.1.1.2 mrg
89 1.1.1.4 christos /*
90 1.1.1.4 christos * @(#)netdb.h 8.1 (Berkeley) 6/2/93
91 1.1.1.6 ghen * Id: netdb.h,v 1.15.18.6 2006/10/02 01:23:09 marka Exp
92 1.1.1.4 christos */
93 1.1.1.4 christos
94 1.1 cgd #ifndef _NETDB_H_
95 1.1 cgd #define _NETDB_H_
96 1.1 cgd
97 1.1.1.4 christos #include <sys/param.h>
98 1.1.1.4 christos #include <sys/types.h>
99 1.1.1.4 christos #if (!defined(BSD)) || (BSD < 199306)
100 1.1.1.4 christos # include <sys/bitypes.h>
101 1.1.1.4 christos #endif
102 1.1.1.4 christos #include <sys/cdefs.h>
103 1.1.1.4 christos #include <sys/socket.h>
104 1.1.1.4 christos #include <netinet/in.h>
105 1.1.1.4 christos #include <stdio.h>
106 1.1.1.4 christos
107 1.1.1.4 christos #ifndef _PATH_HEQUIV
108 1.1.1.4 christos #define _PATH_HEQUIV "/etc/hosts.equiv"
109 1.1.1.4 christos #endif
110 1.1.1.4 christos #ifndef _PATH_HOSTS
111 1.1 cgd #define _PATH_HOSTS "/etc/hosts"
112 1.1.1.4 christos #endif
113 1.1.1.4 christos #ifndef _PATH_NETWORKS
114 1.1 cgd #define _PATH_NETWORKS "/etc/networks"
115 1.1.1.4 christos #endif
116 1.1.1.4 christos #ifndef _PATH_PROTOCOLS
117 1.1 cgd #define _PATH_PROTOCOLS "/etc/protocols"
118 1.1.1.4 christos #endif
119 1.1.1.4 christos #ifndef _PATH_SERVICES
120 1.1 cgd #define _PATH_SERVICES "/etc/services"
121 1.1.1.4 christos #endif
122 1.1.1.4 christos
123 1.1.1.4 christos #if (__GLIBC__ > 2 || __GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)
124 1.1.1.4 christos #define __h_errno __h_errno_location
125 1.1.1.4 christos #endif
126 1.1.1.4 christos __BEGIN_DECLS
127 1.1.1.4 christos extern int * __h_errno __P((void));
128 1.1.1.4 christos __END_DECLS
129 1.1.1.4 christos #if defined(_REENTRANT) || \
130 1.1.1.4 christos (__GLIBC__ > 2 || __GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)
131 1.1.1.4 christos #define h_errno (*__h_errno())
132 1.1.1.4 christos #else
133 1.1.1.4 christos extern int h_errno;
134 1.1.1.4 christos #endif
135 1.1 cgd
136 1.1.1.5 christos /*%
137 1.1 cgd * Structures returned by network data base library. All addresses are
138 1.1 cgd * supplied in host order, and returned in network order (suitable for
139 1.1 cgd * use in system calls).
140 1.1 cgd */
141 1.1 cgd struct hostent {
142 1.1.1.5 christos char *h_name; /*%< official name of host */
143 1.1.1.5 christos char **h_aliases; /*%< alias list */
144 1.1.1.5 christos int h_addrtype; /*%< host address type */
145 1.1.1.5 christos int h_length; /*%< length of address */
146 1.1.1.5 christos char **h_addr_list; /*%< list of addresses from name server */
147 1.1.1.5 christos #define h_addr h_addr_list[0] /*%< address, for backward compatiblity */
148 1.1 cgd };
149 1.1 cgd
150 1.1.1.5 christos /*%
151 1.1 cgd * Assumption here is that a network number
152 1.1.1.2 mrg * fits in an unsigned long -- probably a poor one.
153 1.1 cgd */
154 1.1 cgd struct netent {
155 1.1.1.5 christos char *n_name; /*%< official name of net */
156 1.1.1.5 christos char **n_aliases; /*%< alias list */
157 1.1.1.5 christos int n_addrtype; /*%< net address type */
158 1.1.1.5 christos unsigned long n_net; /*%< network # */
159 1.1 cgd };
160 1.1 cgd
161 1.1 cgd struct servent {
162 1.1.1.5 christos char *s_name; /*%< official service name */
163 1.1.1.5 christos char **s_aliases; /*%< alias list */
164 1.1.1.5 christos int s_port; /*%< port # */
165 1.1.1.5 christos char *s_proto; /*%< protocol to use */
166 1.1 cgd };
167 1.1 cgd
168 1.1 cgd struct protoent {
169 1.1.1.5 christos char *p_name; /*%< official protocol name */
170 1.1.1.5 christos char **p_aliases; /*%< alias list */
171 1.1.1.5 christos int p_proto; /*%< protocol # */
172 1.1 cgd };
173 1.1 cgd
174 1.1.1.4 christos struct addrinfo {
175 1.1.1.5 christos int ai_flags; /*%< AI_PASSIVE, AI_CANONNAME */
176 1.1.1.5 christos int ai_family; /*%< PF_xxx */
177 1.1.1.5 christos int ai_socktype; /*%< SOCK_xxx */
178 1.1.1.5 christos int ai_protocol; /*%< 0 or IPPROTO_xxx for IPv4 and IPv6 */
179 1.1.1.4 christos #if defined(sun) && defined(_SOCKLEN_T)
180 1.1.1.5 christos #ifdef __sparcv9
181 1.1.1.4 christos int _ai_pad;
182 1.1.1.4 christos #endif
183 1.1.1.4 christos socklen_t ai_addrlen;
184 1.1.1.4 christos #else
185 1.1.1.5 christos size_t ai_addrlen; /*%< length of ai_addr */
186 1.1.1.4 christos #endif
187 1.1.1.4 christos #ifdef __linux
188 1.1.1.5 christos struct sockaddr *ai_addr; /*%< binary address */
189 1.1.1.5 christos char *ai_canonname; /*%< canonical name for hostname */
190 1.1.1.4 christos #else
191 1.1.1.5 christos char *ai_canonname; /*%< canonical name for hostname */
192 1.1.1.5 christos struct sockaddr *ai_addr; /*%< binary address */
193 1.1.1.4 christos #endif
194 1.1.1.5 christos struct addrinfo *ai_next; /*%< next structure in linked list */
195 1.1.1.4 christos };
196 1.1.1.4 christos
197 1.1.1.5 christos /*%
198 1.1 cgd * Error return codes from gethostbyname() and gethostbyaddr()
199 1.1 cgd * (left in extern int h_errno).
200 1.1 cgd */
201 1.1 cgd
202 1.1.1.5 christos #define NETDB_INTERNAL -1 /*%< see errno */
203 1.1.1.5 christos #define NETDB_SUCCESS 0 /*%< no problem */
204 1.1.1.5 christos #define HOST_NOT_FOUND 1 /*%< Authoritative Answer Host not found */
205 1.1.1.5 christos #define TRY_AGAIN 2 /*%< Non-Authoritive Host not found, or SERVERFAIL */
206 1.1.1.5 christos #define NO_RECOVERY 3 /*%< Non recoverable errors, FORMERR, REFUSED, NOTIMP */
207 1.1.1.5 christos #define NO_DATA 4 /*%< Valid name, no data record of requested type */
208 1.1.1.5 christos #define NO_ADDRESS NO_DATA /*%< no address, look for MX record */
209 1.1.1.4 christos /*
210 1.1.1.4 christos * Error return codes from getaddrinfo()
211 1.1.1.4 christos */
212 1.1.1.5 christos #define EAI_ADDRFAMILY 1 /*%< address family for hostname not supported */
213 1.1.1.5 christos #define EAI_AGAIN 2 /*%< temporary failure in name resolution */
214 1.1.1.5 christos #define EAI_BADFLAGS 3 /*%< invalid value for ai_flags */
215 1.1.1.5 christos #define EAI_FAIL 4 /*%< non-recoverable failure in name resolution */
216 1.1.1.5 christos #define EAI_FAMILY 5 /*%< ai_family not supported */
217 1.1.1.5 christos #define EAI_MEMORY 6 /*%< memory allocation failure */
218 1.1.1.5 christos #define EAI_NODATA 7 /*%< no address associated with hostname */
219 1.1.1.5 christos #define EAI_NONAME 8 /*%< hostname nor servname provided, or not known */
220 1.1.1.5 christos #define EAI_SERVICE 9 /*%< servname not supported for ai_socktype */
221 1.1.1.5 christos #define EAI_SOCKTYPE 10 /*%< ai_socktype not supported */
222 1.1.1.5 christos #define EAI_SYSTEM 11 /*%< system error returned in errno */
223 1.1.1.4 christos #define EAI_BADHINTS 12
224 1.1.1.4 christos #define EAI_PROTOCOL 13
225 1.1.1.4 christos #define EAI_MAX 14
226 1.1.1.4 christos
227 1.1.1.5 christos /*%
228 1.1.1.4 christos * Flag values for getaddrinfo()
229 1.1.1.4 christos */
230 1.1.1.4 christos #define AI_PASSIVE 0x00000001
231 1.1.1.4 christos #define AI_CANONNAME 0x00000002
232 1.1.1.4 christos #define AI_NUMERICHOST 0x00000004
233 1.1.1.4 christos #define AI_MASK 0x00000007
234 1.1.1.4 christos
235 1.1.1.5 christos /*%
236 1.1.1.4 christos * Flag values for getipnodebyname()
237 1.1.1.4 christos */
238 1.1.1.4 christos #define AI_V4MAPPED 0x00000008
239 1.1.1.4 christos #define AI_ALL 0x00000010
240 1.1.1.4 christos #define AI_ADDRCONFIG 0x00000020
241 1.1.1.4 christos #define AI_DEFAULT (AI_V4MAPPED|AI_ADDRCONFIG)
242 1.1.1.4 christos
243 1.1.1.5 christos /*%
244 1.1.1.4 christos * Constants for getnameinfo()
245 1.1.1.4 christos */
246 1.1.1.4 christos #define NI_MAXHOST 1025
247 1.1.1.4 christos #define NI_MAXSERV 32
248 1.1.1.4 christos
249 1.1.1.5 christos /*%
250 1.1.1.4 christos * Flag values for getnameinfo()
251 1.1.1.4 christos */
252 1.1.1.4 christos #define NI_NOFQDN 0x00000001
253 1.1.1.4 christos #define NI_NUMERICHOST 0x00000002
254 1.1.1.4 christos #define NI_NAMEREQD 0x00000004
255 1.1.1.4 christos #define NI_NUMERICSERV 0x00000008
256 1.1.1.4 christos #define NI_DGRAM 0x00000010
257 1.1.1.4 christos #define NI_WITHSCOPEID 0x00000020
258 1.1.1.4 christos #define NI_NUMERICSCOPE 0x00000040
259 1.1.1.4 christos
260 1.1.1.5 christos /*%
261 1.1.1.4 christos * Scope delimit character
262 1.1.1.4 christos */
263 1.1.1.4 christos #define SCOPE_DELIMITER '%'
264 1.1.1.4 christos
265 1.1.1.4 christos
266 1.1.1.4 christos #ifdef _REENTRANT
267 1.1.1.4 christos #if defined (__hpux) || defined(__osf__) || defined(_AIX)
268 1.1.1.4 christos #define _MAXALIASES 35
269 1.1.1.4 christos #define _MAXLINELEN 1024
270 1.1.1.4 christos #define _MAXADDRS 35
271 1.1.1.4 christos #define _HOSTBUFSIZE (BUFSIZ + 1)
272 1.1.1.4 christos
273 1.1.1.4 christos struct hostent_data {
274 1.1.1.4 christos struct in_addr host_addr;
275 1.1.1.4 christos char *h_addr_ptrs[_MAXADDRS + 1];
276 1.1.1.4 christos char hostaddr[_MAXADDRS];
277 1.1.1.4 christos char hostbuf[_HOSTBUFSIZE];
278 1.1.1.4 christos char *host_aliases[_MAXALIASES];
279 1.1.1.4 christos char *host_addrs[2];
280 1.1.1.4 christos FILE *hostf;
281 1.1.1.4 christos #ifdef __osf__
282 1.1.1.4 christos int svc_gethostflag;
283 1.1.1.4 christos int svc_gethostbind;
284 1.1.1.4 christos #endif
285 1.1.1.4 christos #ifdef __hpux
286 1.1.1.4 christos short _nsw_src;
287 1.1.1.4 christos short _flags;
288 1.1.1.4 christos char *current;
289 1.1.1.4 christos int currentlen;
290 1.1.1.4 christos #endif
291 1.1.1.4 christos };
292 1.1.1.4 christos
293 1.1.1.4 christos struct netent_data {
294 1.1.1.4 christos FILE *net_fp;
295 1.1.1.5 christos #if defined(__osf__) || defined(_AIX)
296 1.1.1.4 christos char line[_MAXLINELEN];
297 1.1.1.4 christos #endif
298 1.1.1.4 christos #ifdef __hpux
299 1.1.1.4 christos char line[_MAXLINELEN+1];
300 1.1.1.4 christos #endif
301 1.1.1.4 christos char *net_aliases[_MAXALIASES];
302 1.1.1.4 christos #ifdef __osf__
303 1.1.1.4 christos int _net_stayopen;
304 1.1.1.4 christos int svc_getnetflag;
305 1.1.1.4 christos #endif
306 1.1.1.4 christos #ifdef __hpux
307 1.1.1.4 christos short _nsw_src;
308 1.1.1.4 christos short _flags;
309 1.1.1.4 christos char *current;
310 1.1.1.4 christos int currentlen;
311 1.1.1.4 christos #endif
312 1.1.1.5 christos #ifdef _AIX
313 1.1.1.5 christos int _net_stayopen;
314 1.1.1.5 christos char *current;
315 1.1.1.5 christos int currentlen;
316 1.1.1.5 christos void *_net_reserv1; /* reserved for future use */
317 1.1.1.5 christos void *_net_reserv2; /* reserved for future use */
318 1.1.1.5 christos #endif
319 1.1.1.4 christos };
320 1.1.1.4 christos
321 1.1.1.4 christos struct protoent_data {
322 1.1.1.4 christos FILE *proto_fp;
323 1.1.1.5 christos #ifdef _AIX
324 1.1.1.5 christos int _proto_stayopen;
325 1.1.1.5 christos char line[_MAXLINELEN];
326 1.1.1.5 christos #endif
327 1.1.1.4 christos #ifdef __osf__
328 1.1.1.4 christos char line[1024];
329 1.1.1.4 christos #endif
330 1.1.1.4 christos #ifdef __hpux
331 1.1.1.4 christos char line[_MAXLINELEN+1];
332 1.1.1.4 christos #endif
333 1.1.1.4 christos char *proto_aliases[_MAXALIASES];
334 1.1.1.4 christos #ifdef __osf__
335 1.1.1.4 christos int _proto_stayopen;
336 1.1.1.4 christos int svc_getprotoflag;
337 1.1.1.4 christos #endif
338 1.1.1.4 christos #ifdef __hpux
339 1.1.1.4 christos short _nsw_src;
340 1.1.1.4 christos short _flags;
341 1.1.1.4 christos char *current;
342 1.1.1.4 christos int currentlen;
343 1.1.1.4 christos #endif
344 1.1.1.5 christos #ifdef _AIX
345 1.1.1.5 christos int currentlen;
346 1.1.1.5 christos char *current;
347 1.1.1.5 christos void *_proto_reserv1; /* reserved for future use */
348 1.1.1.5 christos void *_proto_reserv2; /* reserved for future use */
349 1.1.1.5 christos #endif
350 1.1.1.4 christos };
351 1.1.1.3 perry
352 1.1.1.4 christos struct servent_data {
353 1.1.1.4 christos FILE *serv_fp;
354 1.1.1.5 christos #if defined(__osf__) || defined(_AIX)
355 1.1.1.4 christos char line[_MAXLINELEN];
356 1.1.1.4 christos #endif
357 1.1.1.4 christos #ifdef __hpux
358 1.1.1.4 christos char line[_MAXLINELEN+1];
359 1.1.1.4 christos #endif
360 1.1.1.4 christos char *serv_aliases[_MAXALIASES];
361 1.1.1.4 christos #ifdef __osf__
362 1.1.1.4 christos int _serv_stayopen;
363 1.1.1.4 christos int svc_getservflag;
364 1.1.1.4 christos #endif
365 1.1.1.4 christos #ifdef __hpux
366 1.1.1.4 christos short _nsw_src;
367 1.1.1.4 christos short _flags;
368 1.1.1.4 christos char *current;
369 1.1.1.4 christos int currentlen;
370 1.1.1.4 christos #endif
371 1.1.1.5 christos #ifdef _AIX
372 1.1.1.5 christos int _serv_stayopen;
373 1.1.1.5 christos char *current;
374 1.1.1.5 christos int currentlen;
375 1.1.1.5 christos void *_serv_reserv1; /* reserved for future use */
376 1.1.1.5 christos void *_serv_reserv2; /* reserved for future use */
377 1.1.1.5 christos #endif
378 1.1.1.4 christos };
379 1.1.1.4 christos #endif
380 1.1.1.4 christos #endif
381 1.1 cgd __BEGIN_DECLS
382 1.1 cgd void endhostent __P((void));
383 1.1 cgd void endnetent __P((void));
384 1.1 cgd void endprotoent __P((void));
385 1.1 cgd void endservent __P((void));
386 1.1.1.4 christos void freehostent __P((struct hostent *));
387 1.1 cgd struct hostent *gethostbyaddr __P((const char *, int, int));
388 1.1.1.2 mrg struct hostent *gethostbyname __P((const char *));
389 1.1.1.4 christos struct hostent *gethostbyname2 __P((const char *, int));
390 1.1.1.2 mrg struct hostent *gethostent __P((void));
391 1.1.1.4 christos struct hostent *getipnodebyaddr __P((const void *, size_t, int, int *));
392 1.1.1.4 christos struct hostent *getipnodebyname __P((const char *, int, int, int *));
393 1.1.1.4 christos struct netent *getnetbyaddr __P((unsigned long, int));
394 1.1 cgd struct netent *getnetbyname __P((const char *));
395 1.1 cgd struct netent *getnetent __P((void));
396 1.1 cgd struct protoent *getprotobyname __P((const char *));
397 1.1 cgd struct protoent *getprotobynumber __P((int));
398 1.1 cgd struct protoent *getprotoent __P((void));
399 1.1 cgd struct servent *getservbyname __P((const char *, const char *));
400 1.1 cgd struct servent *getservbyport __P((int, const char *));
401 1.1 cgd struct servent *getservent __P((void));
402 1.1 cgd void herror __P((const char *));
403 1.1.1.4 christos const char *hstrerror __P((int));
404 1.1 cgd void sethostent __P((int));
405 1.1 cgd /* void sethostfile __P((const char *)); */
406 1.1 cgd void setnetent __P((int));
407 1.1 cgd void setprotoent __P((int));
408 1.1 cgd void setservent __P((int));
409 1.1.1.4 christos int getaddrinfo __P((const char *, const char *,
410 1.1.1.4 christos const struct addrinfo *, struct addrinfo **));
411 1.1.1.4 christos int getnameinfo __P((const struct sockaddr *, size_t, char *,
412 1.1.1.4 christos size_t, char *, size_t, int));
413 1.1.1.4 christos void freeaddrinfo __P((struct addrinfo *));
414 1.1.1.4 christos const char *gai_strerror __P((int));
415 1.1.1.4 christos struct hostent *getipnodebyname __P((const char *, int, int, int *));
416 1.1.1.4 christos struct hostent *getipnodebyaddr __P((const void *, size_t, int, int *));
417 1.1.1.4 christos void freehostent __P((struct hostent *));
418 1.1.1.4 christos #ifdef __GLIBC__
419 1.1.1.4 christos int getnetgrent __P((/* const */ char **, /* const */ char **,
420 1.1.1.4 christos /* const */ char **));
421 1.1.1.4 christos void setnetgrent __P((const char *));
422 1.1.1.4 christos void endnetgrent __P((void));
423 1.1.1.4 christos int innetgr __P((const char *, const char *, const char *,
424 1.1.1.4 christos const char *));
425 1.1.1.4 christos #endif
426 1.1.1.4 christos
427 1.1.1.4 christos #ifdef _REENTRANT
428 1.1.1.4 christos #if defined(__hpux) || defined(__osf__) || defined(_AIX)
429 1.1.1.4 christos int gethostbyaddr_r __P((const char *, int, int, struct hostent *,
430 1.1.1.4 christos struct hostent_data *));
431 1.1.1.4 christos int gethostbyname_r __P((const char *, struct hostent *,
432 1.1.1.4 christos struct hostent_data *));
433 1.1.1.4 christos int gethostent_r __P((struct hostent *, struct hostent_data *));
434 1.1.1.4 christos #if defined(_AIX)
435 1.1.1.4 christos void sethostent_r __P((int, struct hostent_data *));
436 1.1.1.4 christos #else
437 1.1.1.4 christos int sethostent_r __P((int, struct hostent_data *));
438 1.1.1.4 christos #endif
439 1.1.1.4 christos #if defined(__hpux)
440 1.1.1.4 christos int endhostent_r __P((struct hostent_data *));
441 1.1.1.4 christos #else
442 1.1.1.4 christos void endhostent_r __P((struct hostent_data *));
443 1.1.1.4 christos #endif
444 1.1.1.4 christos
445 1.1.1.4 christos #if defined(__hpux) || defined(__osf__)
446 1.1.1.4 christos int getnetbyaddr_r __P((int, int,
447 1.1.1.4 christos struct netent *, struct netent_data *));
448 1.1.1.4 christos #else
449 1.1.1.4 christos int getnetbyaddr_r __P((long, int,
450 1.1.1.4 christos struct netent *, struct netent_data *));
451 1.1.1.4 christos #endif
452 1.1.1.4 christos int getnetbyname_r __P((const char *,
453 1.1.1.4 christos struct netent *, struct netent_data *));
454 1.1.1.4 christos int getnetent_r __P((struct netent *, struct netent_data *));
455 1.1.1.4 christos int setnetent_r __P((int, struct netent_data *));
456 1.1.1.4 christos #ifdef __hpux
457 1.1.1.4 christos int endnetent_r __P((struct netent_data *buffer));
458 1.1.1.4 christos #else
459 1.1.1.4 christos void endnetent_r __P((struct netent_data *buffer));
460 1.1.1.4 christos #endif
461 1.1.1.4 christos
462 1.1.1.4 christos int getprotobyname_r __P((const char *,
463 1.1.1.4 christos struct protoent *, struct protoent_data *));
464 1.1.1.4 christos int getprotobynumber_r __P((int,
465 1.1.1.4 christos struct protoent *, struct protoent_data *));
466 1.1.1.4 christos int getprotoent_r __P((struct protoent *, struct protoent_data *));
467 1.1.1.4 christos int setprotoent_r __P((int, struct protoent_data *));
468 1.1.1.4 christos #ifdef __hpux
469 1.1.1.4 christos int endprotoent_r __P((struct protoent_data *));
470 1.1.1.4 christos #else
471 1.1.1.4 christos void endprotoent_r __P((struct protoent_data *));
472 1.1.1.4 christos #endif
473 1.1.1.4 christos
474 1.1.1.4 christos int getservbyname_r __P((const char *, const char *,
475 1.1.1.4 christos struct servent *, struct servent_data *));
476 1.1.1.4 christos int getservbyport_r __P((int, const char *,
477 1.1.1.4 christos struct servent *, struct servent_data *));
478 1.1.1.4 christos int getservent_r __P((struct servent *, struct servent_data *));
479 1.1.1.4 christos int setservent_r __P((int, struct servent_data *));
480 1.1.1.4 christos #ifdef __hpux
481 1.1.1.4 christos int endservent_r __P((struct servent_data *));
482 1.1.1.4 christos #else
483 1.1.1.4 christos void endservent_r __P((struct servent_data *));
484 1.1.1.4 christos #endif
485 1.1.1.5 christos #ifdef _AIX
486 1.1.1.5 christos int setnetgrent_r __P((const char *, void **));
487 1.1.1.5 christos void endnetgrent_r __P((void **));
488 1.1.1.5 christos /*
489 1.1.1.5 christos * Note: AIX's netdb.h declares innetgr_r() as:
490 1.1.1.5 christos * int innetgr_r(char *, char *, char *, char *, struct innetgr_data *);
491 1.1.1.5 christos */
492 1.1.1.5 christos int innetgr_r __P((const char *, const char *, const char *,
493 1.1.1.5 christos const char *));
494 1.1.1.5 christos #endif
495 1.1.1.4 christos #else
496 1.1.1.4 christos /* defined(sun) || defined(bsdi) */
497 1.1.1.5 christos #if defined(__GLIBC__) || defined(__FreeBSD__) && (__FreeBSD_version + 0 >= 601103)
498 1.1.1.4 christos int gethostbyaddr_r __P((const char *, int, int, struct hostent *,
499 1.1.1.4 christos char *, size_t, struct hostent **, int *));
500 1.1.1.4 christos int gethostbyname_r __P((const char *, struct hostent *,
501 1.1.1.4 christos char *, size_t, struct hostent **, int *));
502 1.1.1.4 christos int gethostent_r __P((struct hostent *, char *, size_t,
503 1.1.1.4 christos struct hostent **, int *));
504 1.1.1.4 christos #else
505 1.1.1.4 christos struct hostent *gethostbyaddr_r __P((const char *, int, int, struct hostent *,
506 1.1.1.4 christos char *, int, int *));
507 1.1.1.4 christos struct hostent *gethostbyname_r __P((const char *, struct hostent *,
508 1.1.1.4 christos char *, int, int *));
509 1.1.1.4 christos struct hostent *gethostent_r __P((struct hostent *, char *, int, int *));
510 1.1.1.4 christos #endif
511 1.1.1.4 christos void sethostent_r __P((int));
512 1.1.1.4 christos void endhostent_r __P((void));
513 1.1.1.4 christos
514 1.1.1.5 christos #if defined(__GLIBC__) || defined(__FreeBSD__) && (__FreeBSD_version + 0 >= 601103)
515 1.1.1.4 christos int getnetbyname_r __P((const char *, struct netent *,
516 1.1.1.4 christos char *, size_t, struct netent **, int*));
517 1.1.1.4 christos int getnetbyaddr_r __P((unsigned long int, int, struct netent *,
518 1.1.1.4 christos char *, size_t, struct netent **, int*));
519 1.1.1.4 christos int getnetent_r __P((struct netent *, char *, size_t, struct netent **, int*));
520 1.1.1.4 christos #else
521 1.1.1.4 christos struct netent *getnetbyname_r __P((const char *, struct netent *,
522 1.1.1.4 christos char *, int));
523 1.1.1.4 christos struct netent *getnetbyaddr_r __P((long, int, struct netent *,
524 1.1.1.4 christos char *, int));
525 1.1.1.4 christos struct netent *getnetent_r __P((struct netent *, char *, int));
526 1.1.1.4 christos #endif
527 1.1.1.4 christos void setnetent_r __P((int));
528 1.1.1.4 christos void endnetent_r __P((void));
529 1.1.1.4 christos
530 1.1.1.5 christos #if defined(__GLIBC__) || defined(__FreeBSD__) && (__FreeBSD_version + 0 >= 601103)
531 1.1.1.4 christos int getprotobyname_r __P((const char *, struct protoent *, char *,
532 1.1.1.4 christos size_t, struct protoent **));
533 1.1.1.4 christos int getprotobynumber_r __P((int, struct protoent *, char *, size_t,
534 1.1.1.4 christos struct protoent **));
535 1.1.1.4 christos int getprotoent_r __P((struct protoent *, char *, size_t, struct protoent **));
536 1.1.1.4 christos #else
537 1.1.1.4 christos struct protoent *getprotobyname_r __P((const char *,
538 1.1.1.4 christos struct protoent *, char *, int));
539 1.1.1.4 christos struct protoent *getprotobynumber_r __P((int,
540 1.1.1.4 christos struct protoent *, char *, int));
541 1.1.1.4 christos struct protoent *getprotoent_r __P((struct protoent *, char *, int));
542 1.1.1.4 christos #endif
543 1.1.1.4 christos void setprotoent_r __P((int));
544 1.1.1.4 christos void endprotoent_r __P((void));
545 1.1.1.4 christos
546 1.1.1.5 christos #if defined(__GLIBC__) || defined(__FreeBSD__) && (__FreeBSD_version + 0 >= 601103)
547 1.1.1.4 christos int getservbyname_r __P((const char *name, const char *,
548 1.1.1.4 christos struct servent *, char *, size_t, struct servent **));
549 1.1.1.4 christos int getservbyport_r __P((int port, const char *,
550 1.1.1.4 christos struct servent *, char *, size_t, struct servent **));
551 1.1.1.4 christos int getservent_r __P((struct servent *, char *, size_t, struct servent **));
552 1.1.1.4 christos #else
553 1.1.1.4 christos struct servent *getservbyname_r __P((const char *name, const char *,
554 1.1.1.4 christos struct servent *, char *, int));
555 1.1.1.4 christos struct servent *getservbyport_r __P((int port, const char *,
556 1.1.1.4 christos struct servent *, char *, int));
557 1.1.1.4 christos struct servent *getservent_r __P((struct servent *, char *, int));
558 1.1.1.4 christos #endif
559 1.1.1.4 christos void setservent_r __P((int));
560 1.1.1.4 christos void endservent_r __P((void));
561 1.1.1.4 christos
562 1.1.1.4 christos #ifdef __GLIBC__
563 1.1.1.4 christos int getnetgrent_r __P((char **, char **, char **, char *, size_t));
564 1.1.1.4 christos #endif
565 1.1.1.4 christos
566 1.1.1.4 christos #endif
567 1.1.1.4 christos #endif
568 1.1 cgd __END_DECLS
569 1.1 cgd
570 1.1.1.4 christos /* This is nec'y to make this include file properly replace the sun version. */
571 1.1.1.4 christos #ifdef sun
572 1.1.1.4 christos #ifdef __GNU_LIBRARY__
573 1.1.1.4 christos #include <rpc/netdb.h>
574 1.1.1.4 christos #else
575 1.1.1.4 christos struct rpcent {
576 1.1.1.5 christos char *r_name; /*%< name of server for this rpc program */
577 1.1.1.5 christos char **r_aliases; /*%< alias list */
578 1.1.1.5 christos int r_number; /*%< rpc program number */
579 1.1.1.4 christos };
580 1.1.1.4 christos struct rpcent *getrpcbyname(), *getrpcbynumber(), *getrpcent();
581 1.1.1.4 christos #endif /* __GNU_LIBRARY__ */
582 1.1.1.4 christos #endif /* sun */
583 1.1 cgd #endif /* !_NETDB_H_ */
584 1.1.1.5 christos /*! \file */
585