netdb.h revision 1.1.1.4 1 1.1.1.4 christos /* $NetBSD: netdb.h,v 1.1.1.4 2004/11/07 01:33:17 christos Exp $ */
2 1.1.1.4 christos
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.4 christos * Id: netdb.h,v 1.12.2.1.4.4 2004/03/16 02:19:19 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 cgd /*
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 cgd char *h_name; /* official name of host */
143 1.1 cgd char **h_aliases; /* alias list */
144 1.1 cgd int h_addrtype; /* host address type */
145 1.1 cgd int h_length; /* length of address */
146 1.1 cgd char **h_addr_list; /* list of addresses from name server */
147 1.1 cgd #define h_addr h_addr_list[0] /* address, for backward compatiblity */
148 1.1 cgd };
149 1.1 cgd
150 1.1 cgd /*
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 cgd char *n_name; /* official name of net */
156 1.1 cgd char **n_aliases; /* alias list */
157 1.1 cgd int n_addrtype; /* net address type */
158 1.1 cgd unsigned long n_net; /* network # */
159 1.1 cgd };
160 1.1 cgd
161 1.1 cgd struct servent {
162 1.1 cgd char *s_name; /* official service name */
163 1.1 cgd char **s_aliases; /* alias list */
164 1.1 cgd int s_port; /* port # */
165 1.1 cgd char *s_proto; /* protocol to use */
166 1.1 cgd };
167 1.1 cgd
168 1.1 cgd struct protoent {
169 1.1 cgd char *p_name; /* official protocol name */
170 1.1 cgd char **p_aliases; /* alias list */
171 1.1 cgd int p_proto; /* protocol # */
172 1.1 cgd };
173 1.1 cgd
174 1.1.1.4 christos struct addrinfo {
175 1.1.1.4 christos int ai_flags; /* AI_PASSIVE, AI_CANONNAME */
176 1.1.1.4 christos int ai_family; /* PF_xxx */
177 1.1.1.4 christos int ai_socktype; /* SOCK_xxx */
178 1.1.1.4 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.4 christos #ifdef __sparc9
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.4 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.4 christos struct sockaddr *ai_addr; /* binary address */
189 1.1.1.4 christos char *ai_canonname; /* canonical name for hostname */
190 1.1.1.4 christos #else
191 1.1.1.4 christos char *ai_canonname; /* canonical name for hostname */
192 1.1.1.4 christos struct sockaddr *ai_addr; /* binary address */
193 1.1.1.4 christos #endif
194 1.1.1.4 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 cgd /*
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.4 christos #define NETDB_INTERNAL -1 /* see errno */
203 1.1.1.4 christos #define NETDB_SUCCESS 0 /* no problem */
204 1.1 cgd #define HOST_NOT_FOUND 1 /* Authoritative Answer Host not found */
205 1.1 cgd #define TRY_AGAIN 2 /* Non-Authoritive Host not found, or SERVERFAIL */
206 1.1 cgd #define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
207 1.1 cgd #define NO_DATA 4 /* Valid name, no data record of requested type */
208 1.1 cgd #define NO_ADDRESS NO_DATA /* no address, look for MX record */
209 1.1 cgd
210 1.1.1.4 christos /*
211 1.1.1.4 christos * Error return codes from getaddrinfo()
212 1.1.1.4 christos */
213 1.1.1.4 christos #define EAI_ADDRFAMILY 1 /* address family for hostname not supported */
214 1.1.1.4 christos #define EAI_AGAIN 2 /* temporary failure in name resolution */
215 1.1.1.4 christos #define EAI_BADFLAGS 3 /* invalid value for ai_flags */
216 1.1.1.4 christos #define EAI_FAIL 4 /* non-recoverable failure in name resolution */
217 1.1.1.4 christos #define EAI_FAMILY 5 /* ai_family not supported */
218 1.1.1.4 christos #define EAI_MEMORY 6 /* memory allocation failure */
219 1.1.1.4 christos #define EAI_NODATA 7 /* no address associated with hostname */
220 1.1.1.4 christos #define EAI_NONAME 8 /* hostname nor servname provided, or not known */
221 1.1.1.4 christos #define EAI_SERVICE 9 /* servname not supported for ai_socktype */
222 1.1.1.4 christos #define EAI_SOCKTYPE 10 /* ai_socktype not supported */
223 1.1.1.4 christos #define EAI_SYSTEM 11 /* system error returned in errno */
224 1.1.1.4 christos #define EAI_BADHINTS 12
225 1.1.1.4 christos #define EAI_PROTOCOL 13
226 1.1.1.4 christos #define EAI_MAX 14
227 1.1.1.4 christos
228 1.1.1.4 christos /*
229 1.1.1.4 christos * Flag values for getaddrinfo()
230 1.1.1.4 christos */
231 1.1.1.4 christos #define AI_PASSIVE 0x00000001
232 1.1.1.4 christos #define AI_CANONNAME 0x00000002
233 1.1.1.4 christos #define AI_NUMERICHOST 0x00000004
234 1.1.1.4 christos #define AI_MASK 0x00000007
235 1.1.1.4 christos
236 1.1.1.4 christos /*
237 1.1.1.4 christos * Flag values for getipnodebyname()
238 1.1.1.4 christos */
239 1.1.1.4 christos #define AI_V4MAPPED 0x00000008
240 1.1.1.4 christos #define AI_ALL 0x00000010
241 1.1.1.4 christos #define AI_ADDRCONFIG 0x00000020
242 1.1.1.4 christos #define AI_DEFAULT (AI_V4MAPPED|AI_ADDRCONFIG)
243 1.1.1.4 christos
244 1.1.1.4 christos /*
245 1.1.1.4 christos * Constants for getnameinfo()
246 1.1.1.4 christos */
247 1.1.1.4 christos #define NI_MAXHOST 1025
248 1.1.1.4 christos #define NI_MAXSERV 32
249 1.1.1.4 christos
250 1.1.1.4 christos /*
251 1.1.1.4 christos * Flag values for getnameinfo()
252 1.1.1.4 christos */
253 1.1.1.4 christos #define NI_NOFQDN 0x00000001
254 1.1.1.4 christos #define NI_NUMERICHOST 0x00000002
255 1.1.1.4 christos #define NI_NAMEREQD 0x00000004
256 1.1.1.4 christos #define NI_NUMERICSERV 0x00000008
257 1.1.1.4 christos #define NI_DGRAM 0x00000010
258 1.1.1.4 christos #define NI_WITHSCOPEID 0x00000020
259 1.1.1.4 christos #define NI_NUMERICSCOPE 0x00000040
260 1.1.1.4 christos
261 1.1.1.4 christos /*
262 1.1.1.4 christos * Scope delimit character
263 1.1.1.4 christos */
264 1.1.1.4 christos #define SCOPE_DELIMITER '%'
265 1.1.1.4 christos
266 1.1.1.4 christos
267 1.1.1.4 christos #ifdef _REENTRANT
268 1.1.1.4 christos #if defined (__hpux) || defined(__osf__) || defined(_AIX)
269 1.1.1.4 christos #define _MAXALIASES 35
270 1.1.1.4 christos #define _MAXLINELEN 1024
271 1.1.1.4 christos #define _MAXADDRS 35
272 1.1.1.4 christos #define _HOSTBUFSIZE (BUFSIZ + 1)
273 1.1.1.4 christos
274 1.1.1.4 christos struct hostent_data {
275 1.1.1.4 christos struct in_addr host_addr;
276 1.1.1.4 christos char *h_addr_ptrs[_MAXADDRS + 1];
277 1.1.1.4 christos char hostaddr[_MAXADDRS];
278 1.1.1.4 christos char hostbuf[_HOSTBUFSIZE];
279 1.1.1.4 christos char *host_aliases[_MAXALIASES];
280 1.1.1.4 christos char *host_addrs[2];
281 1.1.1.4 christos FILE *hostf;
282 1.1.1.4 christos #ifdef __osf__
283 1.1.1.4 christos int svc_gethostflag;
284 1.1.1.4 christos int svc_gethostbind;
285 1.1.1.4 christos #endif
286 1.1.1.4 christos #ifdef __hpux
287 1.1.1.4 christos short _nsw_src;
288 1.1.1.4 christos short _flags;
289 1.1.1.4 christos char *current;
290 1.1.1.4 christos int currentlen;
291 1.1.1.4 christos #endif
292 1.1.1.4 christos };
293 1.1.1.4 christos
294 1.1.1.4 christos struct netent_data {
295 1.1.1.4 christos FILE *net_fp;
296 1.1.1.4 christos #ifdef __osf__
297 1.1.1.4 christos char line[_MAXLINELEN];
298 1.1.1.4 christos #endif
299 1.1.1.4 christos #ifdef __hpux
300 1.1.1.4 christos char line[_MAXLINELEN+1];
301 1.1.1.4 christos #endif
302 1.1.1.4 christos char *net_aliases[_MAXALIASES];
303 1.1.1.4 christos #ifdef __osf__
304 1.1.1.4 christos int _net_stayopen;
305 1.1.1.4 christos int svc_getnetflag;
306 1.1.1.4 christos #endif
307 1.1.1.4 christos #ifdef __hpux
308 1.1.1.4 christos short _nsw_src;
309 1.1.1.4 christos short _flags;
310 1.1.1.4 christos char *current;
311 1.1.1.4 christos int currentlen;
312 1.1.1.4 christos #endif
313 1.1.1.4 christos };
314 1.1.1.4 christos
315 1.1.1.4 christos struct protoent_data {
316 1.1.1.4 christos FILE *proto_fp;
317 1.1.1.4 christos #ifdef __osf__
318 1.1.1.4 christos char line[1024];
319 1.1.1.4 christos #endif
320 1.1.1.4 christos #ifdef __hpux
321 1.1.1.4 christos char line[_MAXLINELEN+1];
322 1.1.1.4 christos #endif
323 1.1.1.4 christos char *proto_aliases[_MAXALIASES];
324 1.1.1.4 christos #ifdef __osf__
325 1.1.1.4 christos int _proto_stayopen;
326 1.1.1.4 christos int svc_getprotoflag;
327 1.1.1.4 christos #endif
328 1.1.1.4 christos #ifdef __hpux
329 1.1.1.4 christos short _nsw_src;
330 1.1.1.4 christos short _flags;
331 1.1.1.4 christos char *current;
332 1.1.1.4 christos int currentlen;
333 1.1.1.4 christos #endif
334 1.1.1.4 christos };
335 1.1.1.3 perry
336 1.1.1.4 christos struct servent_data {
337 1.1.1.4 christos FILE *serv_fp;
338 1.1.1.4 christos #ifdef __osf__
339 1.1.1.4 christos char line[_MAXLINELEN];
340 1.1.1.4 christos #endif
341 1.1.1.4 christos #ifdef __hpux
342 1.1.1.4 christos char line[_MAXLINELEN+1];
343 1.1.1.4 christos #endif
344 1.1.1.4 christos char *serv_aliases[_MAXALIASES];
345 1.1.1.4 christos #ifdef __osf__
346 1.1.1.4 christos int _serv_stayopen;
347 1.1.1.4 christos int svc_getservflag;
348 1.1.1.4 christos #endif
349 1.1.1.4 christos #ifdef __hpux
350 1.1.1.4 christos short _nsw_src;
351 1.1.1.4 christos short _flags;
352 1.1.1.4 christos char *current;
353 1.1.1.4 christos int currentlen;
354 1.1.1.4 christos #endif
355 1.1.1.4 christos };
356 1.1.1.4 christos #endif
357 1.1.1.4 christos #endif
358 1.1 cgd __BEGIN_DECLS
359 1.1 cgd void endhostent __P((void));
360 1.1 cgd void endnetent __P((void));
361 1.1 cgd void endprotoent __P((void));
362 1.1 cgd void endservent __P((void));
363 1.1.1.4 christos void freehostent __P((struct hostent *));
364 1.1 cgd struct hostent *gethostbyaddr __P((const char *, int, int));
365 1.1.1.2 mrg struct hostent *gethostbyname __P((const char *));
366 1.1.1.4 christos struct hostent *gethostbyname2 __P((const char *, int));
367 1.1.1.2 mrg struct hostent *gethostent __P((void));
368 1.1.1.4 christos struct hostent *getipnodebyaddr __P((const void *, size_t, int, int *));
369 1.1.1.4 christos struct hostent *getipnodebyname __P((const char *, int, int, int *));
370 1.1.1.4 christos struct netent *getnetbyaddr __P((unsigned long, int));
371 1.1 cgd struct netent *getnetbyname __P((const char *));
372 1.1 cgd struct netent *getnetent __P((void));
373 1.1 cgd struct protoent *getprotobyname __P((const char *));
374 1.1 cgd struct protoent *getprotobynumber __P((int));
375 1.1 cgd struct protoent *getprotoent __P((void));
376 1.1 cgd struct servent *getservbyname __P((const char *, const char *));
377 1.1 cgd struct servent *getservbyport __P((int, const char *));
378 1.1 cgd struct servent *getservent __P((void));
379 1.1 cgd void herror __P((const char *));
380 1.1.1.4 christos const char *hstrerror __P((int));
381 1.1 cgd void sethostent __P((int));
382 1.1 cgd /* void sethostfile __P((const char *)); */
383 1.1 cgd void setnetent __P((int));
384 1.1 cgd void setprotoent __P((int));
385 1.1 cgd void setservent __P((int));
386 1.1.1.4 christos int getaddrinfo __P((const char *, const char *,
387 1.1.1.4 christos const struct addrinfo *, struct addrinfo **));
388 1.1.1.4 christos int getnameinfo __P((const struct sockaddr *, size_t, char *,
389 1.1.1.4 christos size_t, char *, size_t, int));
390 1.1.1.4 christos void freeaddrinfo __P((struct addrinfo *));
391 1.1.1.4 christos const char *gai_strerror __P((int));
392 1.1.1.4 christos struct hostent *getipnodebyname __P((const char *, int, int, int *));
393 1.1.1.4 christos struct hostent *getipnodebyaddr __P((const void *, size_t, int, int *));
394 1.1.1.4 christos void freehostent __P((struct hostent *));
395 1.1.1.4 christos #ifdef __GLIBC__
396 1.1.1.4 christos int getnetgrent __P((/* const */ char **, /* const */ char **,
397 1.1.1.4 christos /* const */ char **));
398 1.1.1.4 christos void setnetgrent __P((const char *));
399 1.1.1.4 christos void endnetgrent __P((void));
400 1.1.1.4 christos int innetgr __P((const char *, const char *, const char *,
401 1.1.1.4 christos const char *));
402 1.1.1.4 christos #endif
403 1.1.1.4 christos
404 1.1.1.4 christos #ifdef _REENTRANT
405 1.1.1.4 christos #if defined(__hpux) || defined(__osf__) || defined(_AIX)
406 1.1.1.4 christos int gethostbyaddr_r __P((const char *, int, int, struct hostent *,
407 1.1.1.4 christos struct hostent_data *));
408 1.1.1.4 christos int gethostbyname_r __P((const char *, struct hostent *,
409 1.1.1.4 christos struct hostent_data *));
410 1.1.1.4 christos int gethostent_r __P((struct hostent *, struct hostent_data *));
411 1.1.1.4 christos #if defined(_AIX)
412 1.1.1.4 christos void sethostent_r __P((int, struct hostent_data *));
413 1.1.1.4 christos #else
414 1.1.1.4 christos int sethostent_r __P((int, struct hostent_data *));
415 1.1.1.4 christos #endif
416 1.1.1.4 christos #if defined(__hpux)
417 1.1.1.4 christos int endhostent_r __P((struct hostent_data *));
418 1.1.1.4 christos #else
419 1.1.1.4 christos void endhostent_r __P((struct hostent_data *));
420 1.1.1.4 christos #endif
421 1.1.1.4 christos
422 1.1.1.4 christos #if defined(__hpux) || defined(__osf__)
423 1.1.1.4 christos int getnetbyaddr_r __P((int, int,
424 1.1.1.4 christos struct netent *, struct netent_data *));
425 1.1.1.4 christos #else
426 1.1.1.4 christos int getnetbyaddr_r __P((long, int,
427 1.1.1.4 christos struct netent *, struct netent_data *));
428 1.1.1.4 christos #endif
429 1.1.1.4 christos int getnetbyname_r __P((const char *,
430 1.1.1.4 christos struct netent *, struct netent_data *));
431 1.1.1.4 christos int getnetent_r __P((struct netent *, struct netent_data *));
432 1.1.1.4 christos int setnetent_r __P((int, struct netent_data *));
433 1.1.1.4 christos #ifdef __hpux
434 1.1.1.4 christos int endnetent_r __P((struct netent_data *buffer));
435 1.1.1.4 christos #else
436 1.1.1.4 christos void endnetent_r __P((struct netent_data *buffer));
437 1.1.1.4 christos #endif
438 1.1.1.4 christos
439 1.1.1.4 christos int getprotobyname_r __P((const char *,
440 1.1.1.4 christos struct protoent *, struct protoent_data *));
441 1.1.1.4 christos int getprotobynumber_r __P((int,
442 1.1.1.4 christos struct protoent *, struct protoent_data *));
443 1.1.1.4 christos int getprotoent_r __P((struct protoent *, struct protoent_data *));
444 1.1.1.4 christos int setprotoent_r __P((int, struct protoent_data *));
445 1.1.1.4 christos #ifdef __hpux
446 1.1.1.4 christos int endprotoent_r __P((struct protoent_data *));
447 1.1.1.4 christos #else
448 1.1.1.4 christos void endprotoent_r __P((struct protoent_data *));
449 1.1.1.4 christos #endif
450 1.1.1.4 christos
451 1.1.1.4 christos int getservbyname_r __P((const char *, const char *,
452 1.1.1.4 christos struct servent *, struct servent_data *));
453 1.1.1.4 christos int getservbyport_r __P((int, const char *,
454 1.1.1.4 christos struct servent *, struct servent_data *));
455 1.1.1.4 christos int getservent_r __P((struct servent *, struct servent_data *));
456 1.1.1.4 christos int setservent_r __P((int, struct servent_data *));
457 1.1.1.4 christos #ifdef __hpux
458 1.1.1.4 christos int endservent_r __P((struct servent_data *));
459 1.1.1.4 christos #else
460 1.1.1.4 christos void endservent_r __P((struct servent_data *));
461 1.1.1.4 christos #endif
462 1.1.1.4 christos #else
463 1.1.1.4 christos /* defined(sun) || defined(bsdi) */
464 1.1.1.4 christos #ifdef __GLIBC__
465 1.1.1.4 christos int gethostbyaddr_r __P((const char *, int, int, struct hostent *,
466 1.1.1.4 christos char *, size_t, struct hostent **, int *));
467 1.1.1.4 christos int gethostbyname_r __P((const char *, struct hostent *,
468 1.1.1.4 christos char *, size_t, struct hostent **, int *));
469 1.1.1.4 christos int gethostent_r __P((struct hostent *, char *, size_t,
470 1.1.1.4 christos struct hostent **, int *));
471 1.1.1.4 christos #else
472 1.1.1.4 christos struct hostent *gethostbyaddr_r __P((const char *, int, int, struct hostent *,
473 1.1.1.4 christos char *, int, int *));
474 1.1.1.4 christos struct hostent *gethostbyname_r __P((const char *, struct hostent *,
475 1.1.1.4 christos char *, int, int *));
476 1.1.1.4 christos struct hostent *gethostent_r __P((struct hostent *, char *, int, int *));
477 1.1.1.4 christos #endif
478 1.1.1.4 christos void sethostent_r __P((int));
479 1.1.1.4 christos void endhostent_r __P((void));
480 1.1.1.4 christos
481 1.1.1.4 christos #ifdef __GLIBC__
482 1.1.1.4 christos int getnetbyname_r __P((const char *, struct netent *,
483 1.1.1.4 christos char *, size_t, struct netent **, int*));
484 1.1.1.4 christos int getnetbyaddr_r __P((unsigned long int, int, struct netent *,
485 1.1.1.4 christos char *, size_t, struct netent **, int*));
486 1.1.1.4 christos int getnetent_r __P((struct netent *, char *, size_t, struct netent **, int*));
487 1.1.1.4 christos #else
488 1.1.1.4 christos struct netent *getnetbyname_r __P((const char *, struct netent *,
489 1.1.1.4 christos char *, int));
490 1.1.1.4 christos struct netent *getnetbyaddr_r __P((long, int, struct netent *,
491 1.1.1.4 christos char *, int));
492 1.1.1.4 christos struct netent *getnetent_r __P((struct netent *, char *, int));
493 1.1.1.4 christos #endif
494 1.1.1.4 christos void setnetent_r __P((int));
495 1.1.1.4 christos void endnetent_r __P((void));
496 1.1.1.4 christos
497 1.1.1.4 christos #ifdef __GLIBC__
498 1.1.1.4 christos int getprotobyname_r __P((const char *, struct protoent *, char *,
499 1.1.1.4 christos size_t, struct protoent **));
500 1.1.1.4 christos int getprotobynumber_r __P((int, struct protoent *, char *, size_t,
501 1.1.1.4 christos struct protoent **));
502 1.1.1.4 christos int getprotoent_r __P((struct protoent *, char *, size_t, struct protoent **));
503 1.1.1.4 christos #else
504 1.1.1.4 christos struct protoent *getprotobyname_r __P((const char *,
505 1.1.1.4 christos struct protoent *, char *, int));
506 1.1.1.4 christos struct protoent *getprotobynumber_r __P((int,
507 1.1.1.4 christos struct protoent *, char *, int));
508 1.1.1.4 christos struct protoent *getprotoent_r __P((struct protoent *, char *, int));
509 1.1.1.4 christos #endif
510 1.1.1.4 christos void setprotoent_r __P((int));
511 1.1.1.4 christos void endprotoent_r __P((void));
512 1.1.1.4 christos
513 1.1.1.4 christos #ifdef __GLIBC__
514 1.1.1.4 christos int getservbyname_r __P((const char *name, const char *,
515 1.1.1.4 christos struct servent *, char *, size_t, struct servent **));
516 1.1.1.4 christos int getservbyport_r __P((int port, const char *,
517 1.1.1.4 christos struct servent *, char *, size_t, struct servent **));
518 1.1.1.4 christos int getservent_r __P((struct servent *, char *, size_t, struct servent **));
519 1.1.1.4 christos #else
520 1.1.1.4 christos struct servent *getservbyname_r __P((const char *name, const char *,
521 1.1.1.4 christos struct servent *, char *, int));
522 1.1.1.4 christos struct servent *getservbyport_r __P((int port, const char *,
523 1.1.1.4 christos struct servent *, char *, int));
524 1.1.1.4 christos struct servent *getservent_r __P((struct servent *, char *, int));
525 1.1.1.4 christos #endif
526 1.1.1.4 christos void setservent_r __P((int));
527 1.1.1.4 christos void endservent_r __P((void));
528 1.1.1.4 christos
529 1.1.1.4 christos #ifdef __GLIBC__
530 1.1.1.4 christos int getnetgrent_r __P((char **, char **, char **, char *, size_t));
531 1.1.1.4 christos #endif
532 1.1.1.4 christos
533 1.1.1.4 christos #endif
534 1.1.1.4 christos #endif
535 1.1 cgd __END_DECLS
536 1.1 cgd
537 1.1.1.4 christos /* This is nec'y to make this include file properly replace the sun version. */
538 1.1.1.4 christos #ifdef sun
539 1.1.1.4 christos #ifdef __GNU_LIBRARY__
540 1.1.1.4 christos #include <rpc/netdb.h>
541 1.1.1.4 christos #else
542 1.1.1.4 christos struct rpcent {
543 1.1.1.4 christos char *r_name; /* name of server for this rpc program */
544 1.1.1.4 christos char **r_aliases; /* alias list */
545 1.1.1.4 christos int r_number; /* rpc program number */
546 1.1.1.4 christos };
547 1.1.1.4 christos struct rpcent *getrpcbyname(), *getrpcbynumber(), *getrpcent();
548 1.1.1.4 christos #endif /* __GNU_LIBRARY__ */
549 1.1.1.4 christos #endif /* sun */
550 1.1.1.4 christos
551 1.1 cgd #endif /* !_NETDB_H_ */
552