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