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