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