Home | History | Annotate | Line # | Download | only in include
netdb.h revision 1.41
      1  1.41  christos /*	$NetBSD: netdb.h,v 1.41 2004/05/25 13:55:48 christos Exp $	*/
      2  1.12    itojun 
      3  1.12    itojun /*
      4   1.6       mrg  * Copyright (c) 1980, 1983, 1988, 1993
      5   1.6       mrg  *	The Regents of the University of California.  All rights reserved.
      6   1.1       cgd  *
      7   1.1       cgd  * Redistribution and use in source and binary forms, with or without
      8   1.1       cgd  * modification, are permitted provided that the following conditions
      9   1.1       cgd  * are met:
     10   1.1       cgd  * 1. Redistributions of source code must retain the above copyright
     11   1.1       cgd  *    notice, this list of conditions and the following disclaimer.
     12   1.1       cgd  * 2. Redistributions in binary form must reproduce the above copyright
     13   1.1       cgd  *    notice, this list of conditions and the following disclaimer in the
     14   1.1       cgd  *    documentation and/or other materials provided with the distribution.
     15  1.31       agc  * 3. Neither the name of the University nor the names of its contributors
     16   1.1       cgd  *    may be used to endorse or promote products derived from this software
     17   1.1       cgd  *    without specific prior written permission.
     18   1.1       cgd  *
     19   1.1       cgd  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     20   1.1       cgd  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     21   1.1       cgd  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     22   1.1       cgd  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     23   1.1       cgd  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     24   1.1       cgd  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     25   1.1       cgd  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     26   1.1       cgd  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     27   1.1       cgd  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     28   1.1       cgd  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     29   1.1       cgd  * SUCH DAMAGE.
     30   1.6       mrg  * -
     31   1.6       mrg  * Portions Copyright (c) 1993 by Digital Equipment Corporation.
     32  1.39  christos  *
     33   1.6       mrg  * Permission to use, copy, modify, and distribute this software for any
     34   1.6       mrg  * purpose with or without fee is hereby granted, provided that the above
     35   1.6       mrg  * copyright notice and this permission notice appear in all copies, and that
     36   1.6       mrg  * the name of Digital Equipment Corporation not be used in advertising or
     37   1.6       mrg  * publicity pertaining to distribution of the document or software without
     38   1.6       mrg  * specific, written prior permission.
     39  1.39  christos  *
     40   1.6       mrg  * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
     41   1.6       mrg  * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
     42   1.6       mrg  * OF MERCHANTABILITY AND FITNESS.   IN NO EVENT SHALL DIGITAL EQUIPMENT
     43   1.6       mrg  * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
     44   1.6       mrg  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
     45   1.6       mrg  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
     46   1.6       mrg  * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
     47   1.6       mrg  * SOFTWARE.
     48   1.6       mrg  * -
     49  1.39  christos  * Portions Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
     50  1.39  christos  * All rights reserved.
     51  1.39  christos  *
     52  1.39  christos  * Redistribution and use in source and binary forms, with or without
     53  1.39  christos  * modification, are permitted provided that the following conditions
     54  1.39  christos  * are met:
     55  1.39  christos  * 1. Redistributions of source code must retain the above copyright
     56  1.39  christos  *    notice, this list of conditions and the following disclaimer.
     57  1.39  christos  * 2. Redistributions in binary form must reproduce the above copyright
     58  1.39  christos  *    notice, this list of conditions and the following disclaimer in the
     59  1.39  christos  *    documentation and/or other materials provided with the distribution.
     60  1.39  christos  * 3. All advertising materials mentioning features or use of this software
     61  1.39  christos  *    must display the following acknowledgement:
     62  1.39  christos  *    This product includes software developed by WIDE Project and
     63  1.39  christos  *    its contributors.
     64  1.39  christos  * 4. Neither the name of the project nor the names of its contributors
     65  1.39  christos  *    may be used to endorse or promote products derived from this software
     66  1.39  christos  *    without specific prior written permission.
     67  1.39  christos  *
     68  1.39  christos  * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
     69  1.39  christos  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     70  1.39  christos  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     71  1.39  christos  * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
     72  1.39  christos  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     73  1.39  christos  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     74  1.39  christos  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     75  1.39  christos  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     76  1.39  christos  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     77  1.39  christos  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     78  1.39  christos  * SUCH DAMAGE.
     79  1.39  christos  * -
     80   1.6       mrg  * --Copyright--
     81   1.6       mrg  */
     82   1.6       mrg 
     83  1.39  christos /*
     84  1.39  christos  *      @(#)netdb.h	8.1 (Berkeley) 6/2/93
     85  1.39  christos  *	Id: netdb.h,v 1.12.2.1.4.4 2004/03/16 02:19:19 marka Exp
     86  1.39  christos  */
     87  1.39  christos 
     88   1.1       cgd #ifndef _NETDB_H_
     89  1.39  christos #define	_NETDB_H_
     90   1.1       cgd 
     91  1.13    kleink #include <machine/ansi.h>
     92  1.37    kleink #include <machine/endian_machdep.h>
     93  1.23    kleink #include <sys/ansi.h>
     94   1.6       mrg #include <sys/cdefs.h>
     95  1.29     bjh21 #include <sys/featuretest.h>
     96  1.13    kleink #include <inttypes.h>
     97  1.23    kleink /*
     98  1.23    kleink  * Data types
     99  1.23    kleink  */
    100  1.23    kleink #ifndef socklen_t
    101  1.23    kleink typedef __socklen_t	socklen_t;
    102  1.39  christos #define	socklen_t	__socklen_t
    103  1.23    kleink #endif
    104  1.23    kleink 
    105  1.13    kleink #ifdef  _BSD_SIZE_T_
    106  1.13    kleink typedef _BSD_SIZE_T_	size_t;
    107  1.13    kleink #undef  _BSD_SIZE_T_
    108  1.13    kleink #endif
    109  1.11    kleink 
    110  1.29     bjh21 #if defined(_NETBSD_SOURCE)
    111  1.39  christos #ifndef _PATH_HEQUIV
    112   1.1       cgd #define	_PATH_HEQUIV	"/etc/hosts.equiv"
    113  1.39  christos #endif
    114  1.39  christos #ifndef _PATH_HOSTS
    115   1.1       cgd #define	_PATH_HOSTS	"/etc/hosts"
    116  1.39  christos #endif
    117  1.39  christos #ifndef _PATH_NETWORKS
    118   1.1       cgd #define	_PATH_NETWORKS	"/etc/networks"
    119  1.39  christos #endif
    120  1.39  christos #ifndef _PATH_PROTOCOLS
    121   1.1       cgd #define	_PATH_PROTOCOLS	"/etc/protocols"
    122  1.39  christos #endif
    123  1.39  christos #ifndef _PATH_SERVICES
    124   1.1       cgd #define	_PATH_SERVICES	"/etc/services"
    125  1.11    kleink #endif
    126  1.39  christos #endif
    127   1.1       cgd 
    128  1.39  christos __BEGIN_DECLS
    129   1.6       mrg extern int h_errno;
    130  1.39  christos __END_DECLS
    131   1.6       mrg 
    132   1.1       cgd /*
    133   1.1       cgd  * Structures returned by network data base library.  All addresses are
    134   1.1       cgd  * supplied in host order, and returned in network order (suitable for
    135   1.1       cgd  * use in system calls).
    136   1.1       cgd  */
    137   1.1       cgd struct	hostent {
    138   1.1       cgd 	char	*h_name;	/* official name of host */
    139   1.1       cgd 	char	**h_aliases;	/* alias list */
    140   1.1       cgd 	int	h_addrtype;	/* host address type */
    141   1.1       cgd 	int	h_length;	/* length of address */
    142   1.1       cgd 	char	**h_addr_list;	/* list of addresses from name server */
    143  1.39  christos #define	h_addr	h_addr_list[0]	/* address, for backward compatiblity */
    144   1.1       cgd };
    145   1.1       cgd 
    146   1.1       cgd /*
    147   1.1       cgd  * Assumption here is that a network number
    148   1.6       mrg  * fits in an unsigned long -- probably a poor one.
    149   1.1       cgd  */
    150   1.1       cgd struct	netent {
    151   1.1       cgd 	char		*n_name;	/* official name of net */
    152   1.1       cgd 	char		**n_aliases;	/* alias list */
    153   1.1       cgd 	int		n_addrtype;	/* net address type */
    154  1.37    kleink #if (defined(__sparc__) && defined(_LP64)) || \
    155  1.37    kleink     (defined(__sh__) && defined(_LP64) && (_BYTE_ORDER == _BIG_ENDIAN))
    156  1.37    kleink 	int		__n_pad0;	/* ABI compatibility */
    157  1.37    kleink #endif
    158  1.37    kleink 	uint32_t	n_net;		/* network # */
    159  1.37    kleink #if defined(__alpha__) || (defined(__i386__) && defined(_LP64)) || \
    160  1.37    kleink     (defined(__sh__) && defined(_LP64) && (_BYTE_ORDER == _LITTLE_ENDIAN))
    161  1.37    kleink 	int		__n_pad0;	/* ABI compatibility */
    162  1.37    kleink #endif
    163   1.1       cgd };
    164   1.1       cgd 
    165   1.1       cgd struct	servent {
    166   1.1       cgd 	char	*s_name;	/* official service name */
    167   1.1       cgd 	char	**s_aliases;	/* alias list */
    168   1.1       cgd 	int	s_port;		/* port # */
    169   1.1       cgd 	char	*s_proto;	/* protocol to use */
    170   1.1       cgd };
    171   1.1       cgd 
    172   1.1       cgd struct	protoent {
    173   1.1       cgd 	char	*p_name;	/* official protocol name */
    174   1.1       cgd 	char	**p_aliases;	/* alias list */
    175   1.1       cgd 	int	p_proto;	/* protocol # */
    176   1.1       cgd };
    177   1.1       cgd 
    178  1.23    kleink /*
    179  1.23    kleink  * Note: ai_addrlen used to be a size_t, per RFC 2553.
    180  1.23    kleink  * In XNS5.2, and subsequently in POSIX-2001 and
    181  1.23    kleink  * draft-ietf-ipngwg-rfc2553bis-02.txt it was changed to a socklen_t.
    182  1.23    kleink  * To accomodate for this while preserving binary compatibility with the
    183  1.23    kleink  * old interface, we prepend or append 32 bits of padding, depending on
    184  1.23    kleink  * the (LP64) architecture's endianness.
    185  1.23    kleink  *
    186  1.23    kleink  * This should be deleted the next time the libc major number is
    187  1.23    kleink  * incremented.
    188  1.23    kleink  */
    189  1.30     bjh21 #if (_POSIX_C_SOURCE - 0) >= 200112L || (_XOPEN_SOURCE - 0) >= 520 || \
    190  1.30     bjh21     defined(_NETBSD_SOURCE)
    191  1.12    itojun struct addrinfo {
    192  1.36    itojun 	int	ai_flags;	/* AI_xxx */
    193  1.12    itojun 	int	ai_family;	/* PF_xxx */
    194  1.12    itojun 	int	ai_socktype;	/* SOCK_xxx */
    195  1.12    itojun 	int	ai_protocol;	/* 0 or IPPROTO_xxx for IPv4 and IPv6 */
    196  1.38    kleink #if defined(__sparc__) && defined(_LP64)
    197  1.38    kleink 	int	__ai_pad0;	/* ABI compatibility */
    198  1.23    kleink #endif
    199  1.23    kleink 	socklen_t ai_addrlen;	/* length of ai_addr */
    200  1.23    kleink #if defined(__alpha__) || (defined(__i386__) && defined(_LP64))
    201  1.38    kleink 	int	__ai_pad0;	/* ABI compatbility */
    202  1.23    kleink #endif
    203  1.12    itojun 	char	*ai_canonname;	/* canonical name for hostname */
    204  1.12    itojun 	struct sockaddr *ai_addr;	/* binary address */
    205  1.12    itojun 	struct addrinfo *ai_next;	/* next structure in linked list */
    206  1.12    itojun };
    207  1.13    kleink #endif
    208  1.12    itojun 
    209   1.1       cgd /*
    210   1.1       cgd  * Error return codes from gethostbyname() and gethostbyaddr()
    211   1.1       cgd  * (left in extern int h_errno).
    212   1.1       cgd  */
    213   1.5       jtc 
    214  1.29     bjh21 #if defined(_NETBSD_SOURCE)
    215   1.6       mrg #define	NETDB_INTERNAL	-1	/* see errno */
    216   1.6       mrg #define	NETDB_SUCCESS	0	/* no problem */
    217  1.11    kleink #endif
    218   1.1       cgd #define	HOST_NOT_FOUND	1 /* Authoritative Answer Host not found */
    219  1.39  christos #define	TRY_AGAIN	2 /* Non-Authoritive Host not found, or SERVERFAIL */
    220   1.1       cgd #define	NO_RECOVERY	3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
    221   1.1       cgd #define	NO_DATA		4 /* Valid name, no data record of requested type */
    222  1.29     bjh21 #if defined(_NETBSD_SOURCE)
    223   1.1       cgd #define	NO_ADDRESS	NO_DATA		/* no address, look for MX record */
    224  1.11    kleink #endif
    225   1.1       cgd 
    226  1.12    itojun /*
    227  1.12    itojun  * Error return codes from getaddrinfo()
    228  1.12    itojun  */
    229  1.30     bjh21 #if (_POSIX_C_SOURCE - 0) >= 200112L || (_XOPEN_SOURCE - 0) >= 520 || \
    230  1.30     bjh21     defined(_NETBSD_SOURCE)
    231  1.12    itojun #define	EAI_ADDRFAMILY	 1	/* address family for hostname not supported */
    232  1.12    itojun #define	EAI_AGAIN	 2	/* temporary failure in name resolution */
    233  1.12    itojun #define	EAI_BADFLAGS	 3	/* invalid value for ai_flags */
    234  1.12    itojun #define	EAI_FAIL	 4	/* non-recoverable failure in name resolution */
    235  1.12    itojun #define	EAI_FAMILY	 5	/* ai_family not supported */
    236  1.12    itojun #define	EAI_MEMORY	 6	/* memory allocation failure */
    237  1.12    itojun #define	EAI_NODATA	 7	/* no address associated with hostname */
    238  1.12    itojun #define	EAI_NONAME	 8	/* hostname nor servname provided, or not known */
    239  1.12    itojun #define	EAI_SERVICE	 9	/* servname not supported for ai_socktype */
    240  1.12    itojun #define	EAI_SOCKTYPE	10	/* ai_socktype not supported */
    241  1.12    itojun #define	EAI_SYSTEM	11	/* system error returned in errno */
    242  1.20     lukem #define	EAI_BADHINTS	12
    243  1.20     lukem #define	EAI_PROTOCOL	13
    244  1.20     lukem #define	EAI_MAX		14
    245  1.30     bjh21 #endif /* _POSIX_C_SOURCE >= 200112 || _XOPEN_SOURCE >= 520 || _NETBSD_SOURCE */
    246  1.12    itojun 
    247  1.12    itojun /*
    248  1.12    itojun  * Flag values for getaddrinfo()
    249  1.12    itojun  */
    250  1.30     bjh21 #if (_POSIX_C_SOURCE - 0) >= 200112L || (_XOPEN_SOURCE - 0) >= 520 || \
    251  1.30     bjh21     defined(_NETBSD_SOURCE)
    252  1.12    itojun #define	AI_PASSIVE	0x00000001 /* get address to use bind() */
    253  1.12    itojun #define	AI_CANONNAME	0x00000002 /* fill ai_canonname */
    254  1.35    itojun #define	AI_NUMERICHOST	0x00000004 /* prevent host name resolution */
    255  1.35    itojun #define	AI_NUMERICSERV	0x00000008 /* prevent service name resolution */
    256  1.35    itojun /* valid flags for addrinfo (not a standard def, apps should not use it) */
    257  1.35    itojun #define	AI_MASK	\
    258  1.35    itojun     (AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST | AI_NUMERICSERV)
    259  1.39  christos 
    260  1.41  christos #ifdef notyet
    261  1.39  christos /*
    262  1.39  christos  * Flag values for getipnodebyname()
    263  1.39  christos  */
    264  1.39  christos #define	AI_V4MAPPED	0x00000008
    265  1.39  christos #define	AI_ALL		0x00000010
    266  1.39  christos #define	AI_ADDRCONFIG	0x00000020
    267  1.39  christos #define	AI_DEFAULT	(AI_V4MAPPED|AI_ADDRCONFIG)
    268  1.13    kleink #endif
    269  1.41  christos #endif
    270  1.12    itojun 
    271  1.30     bjh21 #if (_POSIX_C_SOURCE - 0) >= 200112L || (_XOPEN_SOURCE - 0) >= 520 || \
    272  1.30     bjh21     defined(_NETBSD_SOURCE)
    273  1.12    itojun /*
    274  1.12    itojun  * Constants for getnameinfo()
    275  1.12    itojun  */
    276  1.29     bjh21 #if defined(_NETBSD_SOURCE)
    277  1.12    itojun #define	NI_MAXHOST	1025
    278  1.12    itojun #define	NI_MAXSERV	32
    279  1.22    kleink #endif
    280  1.12    itojun 
    281  1.12    itojun /*
    282  1.12    itojun  * Flag values for getnameinfo()
    283  1.12    itojun  */
    284  1.12    itojun #define	NI_NOFQDN	0x00000001
    285  1.12    itojun #define	NI_NUMERICHOST	0x00000002
    286  1.12    itojun #define	NI_NAMEREQD	0x00000004
    287  1.12    itojun #define	NI_NUMERICSERV	0x00000008
    288  1.12    itojun #define	NI_DGRAM	0x00000010
    289  1.29     bjh21 #if defined(_NETBSD_SOURCE)
    290  1.39  christos #define	NI_WITHSCOPEID	0x00000020
    291  1.22    kleink #endif
    292  1.39  christos #define	NI_NUMERICSCOPE	0x00000040
    293  1.14    itojun 
    294  1.14    itojun /*
    295  1.14    itojun  * Scope delimit character
    296  1.14    itojun  */
    297  1.29     bjh21 #if defined(_NETBSD_SOURCE)
    298  1.39  christos #define	SCOPE_DELIMITER	'%'
    299  1.22    kleink #endif
    300  1.30     bjh21 #endif /* (_POSIX_C_SOURCE - 0) >= 200112L || ... */
    301  1.18    itojun 
    302   1.1       cgd __BEGIN_DECLS
    303   1.1       cgd void		endhostent __P((void));
    304   1.1       cgd void		endnetent __P((void));
    305   1.1       cgd void		endprotoent __P((void));
    306   1.1       cgd void		endservent __P((void));
    307  1.30     bjh21 #if (_XOPEN_SOURCE - 0) >= 500 && (_XOPEN_SOURCE - 0) < 600 || \
    308  1.30     bjh21     defined(_NETBSD_SOURCE)
    309  1.12    itojun void		freehostent __P((struct hostent *));
    310  1.13    kleink #endif
    311  1.21    kleink struct hostent	*gethostbyaddr __P((const char *, socklen_t, int));
    312   1.3   deraadt struct hostent	*gethostbyname __P((const char *));
    313  1.29     bjh21 #if defined(_NETBSD_SOURCE)
    314   1.6       mrg struct hostent	*gethostbyname2 __P((const char *, int));
    315  1.11    kleink #endif
    316   1.3   deraadt struct hostent	*gethostent __P((void));
    317  1.30     bjh21 #if (_XOPEN_SOURCE - 0) >= 520 && (_XOPEN_SOURCE - 0) < 600 || \
    318  1.30     bjh21     defined(_NETBSD_SOURCE)
    319  1.15    itojun #if 0 /* we do not ship these */
    320  1.12    itojun struct hostent	*getipnodebyaddr __P((const void *, size_t, int, int *));
    321  1.12    itojun struct hostent	*getipnodebyname __P((const char *, int, int, int *));
    322  1.15    itojun #endif
    323  1.13    kleink #endif
    324  1.37    kleink struct netent	*getnetbyaddr __P((uint32_t, int));
    325   1.1       cgd struct netent	*getnetbyname __P((const char *));
    326   1.1       cgd struct netent	*getnetent __P((void));
    327   1.1       cgd struct protoent	*getprotobyname __P((const char *));
    328   1.1       cgd struct protoent	*getprotobynumber __P((int));
    329   1.1       cgd struct protoent	*getprotoent __P((void));
    330   1.1       cgd struct servent	*getservbyname __P((const char *, const char *));
    331   1.1       cgd struct servent	*getservbyport __P((int, const char *));
    332   1.1       cgd struct servent	*getservent __P((void));
    333  1.29     bjh21 #if defined(_NETBSD_SOURCE)
    334   1.1       cgd void		herror __P((const char *));
    335   1.6       mrg const char	*hstrerror __P((int));
    336  1.11    kleink #endif
    337   1.1       cgd void		sethostent __P((int));
    338  1.29     bjh21 #if defined(_NETBSD_SOURCE)
    339   1.1       cgd /* void		sethostfile __P((const char *)); */
    340  1.11    kleink #endif
    341   1.1       cgd void		setnetent __P((int));
    342   1.1       cgd void		setprotoent __P((int));
    343  1.30     bjh21 #if (_POSIX_C_SOURCE - 0) >= 200112L || (_XOPEN_SOURCE - 0) >= 520 || \
    344  1.30     bjh21     defined(_NETBSD_SOURCE)
    345  1.39  christos void		setservent __P((int));
    346  1.12    itojun int		getaddrinfo __P((const char *, const char *,
    347  1.12    itojun 				 const struct addrinfo *, struct addrinfo **));
    348  1.18    itojun int		getnameinfo __P((const struct sockaddr *, socklen_t, char *,
    349  1.26    kleink 				 socklen_t, char *, socklen_t, int));
    350  1.12    itojun void		freeaddrinfo __P((struct addrinfo *));
    351  1.39  christos const char	*gai_strerror __P((int));
    352  1.13    kleink #endif
    353   1.1       cgd void		setservent __P((int));
    354  1.32  christos 
    355  1.34  christos #if defined(_NETBSD_SOURCE) && defined(_LIBC)
    356  1.32  christos 
    357  1.32  christos struct protoent_data {
    358  1.32  christos         FILE *fp;
    359  1.32  christos 	struct protoent proto;
    360  1.32  christos 	char **aliases;
    361  1.32  christos 	size_t maxaliases;
    362  1.32  christos 	int stayopen;
    363  1.33  christos 	char *line;
    364  1.33  christos 	void *dummy;
    365  1.32  christos };
    366  1.32  christos 
    367  1.32  christos struct protoent	*getprotoent_r __P((struct protoent *, struct protoent_data *));
    368  1.32  christos struct protoent	*getprotobyname_r __P((const char *,
    369  1.32  christos     struct protoent *, struct protoent_data *));
    370  1.32  christos struct protoent	*getprotobynumber_r __P((int,
    371  1.32  christos     struct protoent *, struct protoent_data *));
    372  1.32  christos void setprotoent_r __P((int, struct protoent_data *));
    373  1.32  christos void endprotoent_r __P((struct protoent_data *));
    374  1.32  christos 
    375  1.32  christos struct servent_data {
    376  1.32  christos         FILE *fp;
    377  1.32  christos 	struct servent serv;
    378  1.32  christos 	char **aliases;
    379  1.32  christos 	size_t maxaliases;
    380  1.32  christos 	int stayopen;
    381  1.33  christos 	char *line;
    382  1.33  christos 	void *dummy;
    383  1.32  christos };
    384  1.32  christos 
    385  1.32  christos struct servent	*getservent_r __P((struct servent *, struct servent_data *));
    386  1.32  christos struct servent	*getservbyname_r __P((const char *, const char *,
    387  1.32  christos     struct servent *, struct servent_data *));
    388  1.32  christos struct servent	*getservbyport_r __P((int, const char *,
    389  1.32  christos     struct servent *, struct servent_data *));
    390  1.32  christos void setservent_r __P((int, struct servent_data *));
    391  1.32  christos void endservent_r __P((struct servent_data *));
    392  1.32  christos 
    393  1.34  christos #endif /* _NETBSD_SOURCE && _LIBC */
    394   1.1       cgd __END_DECLS
    395   1.1       cgd 
    396   1.1       cgd #endif /* !_NETDB_H_ */
    397