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