1*84d9c625SLionel Sambuc /* $NetBSD: netdb.h,v 1.69 2013/08/19 07:18:42 christos Exp $ */ 22fe8fb19SBen Gras 3dc23e18cSPhilip Homburg /* 42fe8fb19SBen Gras * ++Copyright++ 1980, 1983, 1988, 1993 52fe8fb19SBen Gras * - 62fe8fb19SBen Gras * Copyright (c) 1980, 1983, 1988, 1993 72fe8fb19SBen Gras * The Regents of the University of California. All rights reserved. 82fe8fb19SBen Gras * 92fe8fb19SBen Gras * Redistribution and use in source and binary forms, with or without 102fe8fb19SBen Gras * modification, are permitted provided that the following conditions 112fe8fb19SBen Gras * are met: 122fe8fb19SBen Gras * 1. Redistributions of source code must retain the above copyright 132fe8fb19SBen Gras * notice, this list of conditions and the following disclaimer. 142fe8fb19SBen Gras * 2. Redistributions in binary form must reproduce the above copyright 152fe8fb19SBen Gras * notice, this list of conditions and the following disclaimer in the 162fe8fb19SBen Gras * documentation and/or other materials provided with the distribution. 172fe8fb19SBen Gras * 3. Neither the name of the University nor the names of its contributors 182fe8fb19SBen Gras * may be used to endorse or promote products derived from this software 192fe8fb19SBen Gras * without specific prior written permission. 202fe8fb19SBen Gras * 212fe8fb19SBen Gras * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 222fe8fb19SBen Gras * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 232fe8fb19SBen Gras * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 242fe8fb19SBen Gras * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 252fe8fb19SBen Gras * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 262fe8fb19SBen Gras * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 272fe8fb19SBen Gras * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 282fe8fb19SBen Gras * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 292fe8fb19SBen Gras * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 302fe8fb19SBen Gras * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 312fe8fb19SBen Gras * SUCH DAMAGE. 322fe8fb19SBen Gras * - 332fe8fb19SBen Gras * Portions Copyright (c) 1993 by Digital Equipment Corporation. 342fe8fb19SBen Gras * 352fe8fb19SBen Gras * Permission to use, copy, modify, and distribute this software for any 362fe8fb19SBen Gras * purpose with or without fee is hereby granted, provided that the above 372fe8fb19SBen Gras * copyright notice and this permission notice appear in all copies, and that 382fe8fb19SBen Gras * the name of Digital Equipment Corporation not be used in advertising or 392fe8fb19SBen Gras * publicity pertaining to distribution of the document or software without 402fe8fb19SBen Gras * specific, written prior permission. 412fe8fb19SBen Gras * 422fe8fb19SBen Gras * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL 432fe8fb19SBen Gras * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES 442fe8fb19SBen Gras * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT 452fe8fb19SBen Gras * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL 462fe8fb19SBen Gras * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR 472fe8fb19SBen Gras * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS 482fe8fb19SBen Gras * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS 492fe8fb19SBen Gras * SOFTWARE. 502fe8fb19SBen Gras * - 512fe8fb19SBen Gras * Portions Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. 522fe8fb19SBen Gras * All rights reserved. 532fe8fb19SBen Gras * 542fe8fb19SBen Gras * Redistribution and use in source and binary forms, with or without 552fe8fb19SBen Gras * modification, are permitted provided that the following conditions 562fe8fb19SBen Gras * are met: 572fe8fb19SBen Gras * 1. Redistributions of source code must retain the above copyright 582fe8fb19SBen Gras * notice, this list of conditions and the following disclaimer. 592fe8fb19SBen Gras * 2. Redistributions in binary form must reproduce the above copyright 602fe8fb19SBen Gras * notice, this list of conditions and the following disclaimer in the 612fe8fb19SBen Gras * documentation and/or other materials provided with the distribution. 622fe8fb19SBen Gras * 3. All advertising materials mentioning features or use of this software 632fe8fb19SBen Gras * must display the following acknowledgement: 642fe8fb19SBen Gras * This product includes software developed by WIDE Project and 652fe8fb19SBen Gras * its contributors. 662fe8fb19SBen Gras * 4. Neither the name of the project nor the names of its contributors 672fe8fb19SBen Gras * may be used to endorse or promote products derived from this software 682fe8fb19SBen Gras * without specific prior written permission. 692fe8fb19SBen Gras * 702fe8fb19SBen Gras * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND 712fe8fb19SBen Gras * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 722fe8fb19SBen Gras * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 732fe8fb19SBen Gras * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE 742fe8fb19SBen Gras * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 752fe8fb19SBen Gras * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 762fe8fb19SBen Gras * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 772fe8fb19SBen Gras * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 782fe8fb19SBen Gras * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 792fe8fb19SBen Gras * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 802fe8fb19SBen Gras * SUCH DAMAGE. 812fe8fb19SBen Gras * - 822fe8fb19SBen Gras * --Copyright-- 83dc23e18cSPhilip Homburg */ 84dc23e18cSPhilip Homburg 852fe8fb19SBen Gras /* 862fe8fb19SBen Gras * @(#)netdb.h 8.1 (Berkeley) 6/2/93 872fe8fb19SBen Gras * Id: netdb.h,v 1.22 2008/02/28 05:34:17 marka Exp 882fe8fb19SBen Gras */ 892fe8fb19SBen Gras 902fe8fb19SBen Gras #ifndef _NETDB_H_ 912fe8fb19SBen Gras #define _NETDB_H_ 922fe8fb19SBen Gras 93*84d9c625SLionel Sambuc #include <sys/cdefs.h> 942fe8fb19SBen Gras #include <machine/endian_machdep.h> 952fe8fb19SBen Gras #include <sys/ansi.h> 962fe8fb19SBen Gras #include <sys/featuretest.h> 972fe8fb19SBen Gras #include <inttypes.h> 982fe8fb19SBen Gras /* 992fe8fb19SBen Gras * Data types 1002fe8fb19SBen Gras */ 1012fe8fb19SBen Gras #ifndef socklen_t 1022fe8fb19SBen Gras typedef __socklen_t socklen_t; 1032fe8fb19SBen Gras #define socklen_t __socklen_t 1042fe8fb19SBen Gras #endif 1052fe8fb19SBen Gras 1062fe8fb19SBen Gras #ifdef _BSD_SIZE_T_ 1072fe8fb19SBen Gras typedef _BSD_SIZE_T_ size_t; 1082fe8fb19SBen Gras #undef _BSD_SIZE_T_ 1092fe8fb19SBen Gras #endif 1102fe8fb19SBen Gras 1112fe8fb19SBen Gras #if defined(_NETBSD_SOURCE) 1122fe8fb19SBen Gras #ifndef _PATH_HEQUIV 1132fe8fb19SBen Gras #define _PATH_HEQUIV "/etc/hosts.equiv" 1142fe8fb19SBen Gras #endif 1152fe8fb19SBen Gras #ifndef _PATH_HOSTS 1162fe8fb19SBen Gras #define _PATH_HOSTS "/etc/hosts" 1172fe8fb19SBen Gras #endif 1182fe8fb19SBen Gras #ifndef _PATH_NETWORKS 1192fe8fb19SBen Gras #define _PATH_NETWORKS "/etc/networks" 1202fe8fb19SBen Gras #endif 1212fe8fb19SBen Gras #ifndef _PATH_PROTOCOLS 1222fe8fb19SBen Gras #define _PATH_PROTOCOLS "/etc/protocols" 1232fe8fb19SBen Gras #endif 1242fe8fb19SBen Gras #ifndef _PATH_SERVICES 1252fe8fb19SBen Gras #define _PATH_SERVICES "/etc/services" 1262fe8fb19SBen Gras #endif 1272fe8fb19SBen Gras #ifndef _PATH_SERVICES_CDB 1282fe8fb19SBen Gras #define _PATH_SERVICES_CDB "/var/db/services.cdb" 1292fe8fb19SBen Gras #endif 1302fe8fb19SBen Gras #ifndef _PATH_SERVICES_DB 1312fe8fb19SBen Gras #define _PATH_SERVICES_DB "/var/db/services.db" 1322fe8fb19SBen Gras #endif 1332fe8fb19SBen Gras #endif 1342fe8fb19SBen Gras 1352fe8fb19SBen Gras __BEGIN_DECLS 1362fe8fb19SBen Gras extern int h_errno; 1372fe8fb19SBen Gras extern int * __h_errno(void); 1382fe8fb19SBen Gras #ifdef _REENTRANT 1392fe8fb19SBen Gras #define h_errno (*__h_errno()) 1402fe8fb19SBen Gras #endif 1412fe8fb19SBen Gras __END_DECLS 1422fe8fb19SBen Gras 1432fe8fb19SBen Gras /*% 1442fe8fb19SBen Gras * Structures returned by network data base library. All addresses are 1452fe8fb19SBen Gras * supplied in host order, and returned in network order (suitable for 1462fe8fb19SBen Gras * use in system calls). 1472fe8fb19SBen Gras */ 1482fe8fb19SBen Gras struct hostent { 1492fe8fb19SBen Gras char *h_name; /*%< official name of host */ 1502fe8fb19SBen Gras char **h_aliases; /*%< alias list */ 1512fe8fb19SBen Gras int h_addrtype; /*%< host address type */ 1522fe8fb19SBen Gras int h_length; /*%< length of address */ 1532fe8fb19SBen Gras char **h_addr_list; /*%< list of addresses from name server */ 1542fe8fb19SBen Gras #define h_addr h_addr_list[0] /*%< address, for backward compatiblity */ 1552fe8fb19SBen Gras }; 1562fe8fb19SBen Gras 1572fe8fb19SBen Gras /*% 1582fe8fb19SBen Gras * Assumption here is that a network number 1592fe8fb19SBen Gras * fits in an unsigned long -- probably a poor one. 1602fe8fb19SBen Gras */ 1612fe8fb19SBen Gras struct netent { 1622fe8fb19SBen Gras char *n_name; /*%< official name of net */ 1632fe8fb19SBen Gras char **n_aliases; /*%< alias list */ 1642fe8fb19SBen Gras int n_addrtype; /*%< net address type */ 1652fe8fb19SBen Gras #if (defined(__sparc__) && defined(_LP64)) || \ 1662fe8fb19SBen Gras (defined(__sh__) && defined(_LP64) && (_BYTE_ORDER == _BIG_ENDIAN)) 1672fe8fb19SBen Gras int __n_pad0; /* ABI compatibility */ 1682fe8fb19SBen Gras #endif 1692fe8fb19SBen Gras uint32_t n_net; /*%< network # */ 1702fe8fb19SBen Gras #if defined(__alpha__) || (defined(__i386__) && defined(_LP64)) || \ 1712fe8fb19SBen Gras (defined(__sh__) && defined(_LP64) && (_BYTE_ORDER == _LITTLE_ENDIAN)) 1722fe8fb19SBen Gras int __n_pad0; /* ABI compatibility */ 1732fe8fb19SBen Gras #endif 1742fe8fb19SBen Gras }; 1752fe8fb19SBen Gras 1762fe8fb19SBen Gras struct servent { 1772fe8fb19SBen Gras char *s_name; /*%< official service name */ 1782fe8fb19SBen Gras char **s_aliases; /*%< alias list */ 1792fe8fb19SBen Gras int s_port; /*%< port # */ 1802fe8fb19SBen Gras char *s_proto; /*%< protocol to use */ 1812fe8fb19SBen Gras }; 1822fe8fb19SBen Gras 1832fe8fb19SBen Gras struct protoent { 1842fe8fb19SBen Gras char *p_name; /*%< official protocol name */ 1852fe8fb19SBen Gras char **p_aliases; /*%< alias list */ 1862fe8fb19SBen Gras int p_proto; /*%< protocol # */ 1872fe8fb19SBen Gras }; 1882fe8fb19SBen Gras 1892fe8fb19SBen Gras /* 1902fe8fb19SBen Gras * Note: ai_addrlen used to be a size_t, per RFC 2553. 1912fe8fb19SBen Gras * In XNS5.2, and subsequently in POSIX-2001 and 1922fe8fb19SBen Gras * draft-ietf-ipngwg-rfc2553bis-02.txt it was changed to a socklen_t. 1932fe8fb19SBen Gras * To accommodate for this while preserving binary compatibility with the 1942fe8fb19SBen Gras * old interface, we prepend or append 32 bits of padding, depending on 1952fe8fb19SBen Gras * the (LP64) architecture's endianness. 1962fe8fb19SBen Gras * 1972fe8fb19SBen Gras * This should be deleted the next time the libc major number is 1982fe8fb19SBen Gras * incremented. 1992fe8fb19SBen Gras */ 2002fe8fb19SBen Gras #if (_POSIX_C_SOURCE - 0) >= 200112L || (_XOPEN_SOURCE - 0) >= 520 || \ 2012fe8fb19SBen Gras defined(_NETBSD_SOURCE) 2022fe8fb19SBen Gras struct addrinfo { 2032fe8fb19SBen Gras int ai_flags; /*%< AI_PASSIVE, AI_CANONNAME */ 2042fe8fb19SBen Gras int ai_family; /*%< PF_xxx */ 2052fe8fb19SBen Gras int ai_socktype; /*%< SOCK_xxx */ 2062fe8fb19SBen Gras int ai_protocol; /*%< 0 or IPPROTO_xxx for IPv4 and IPv6 */ 2072fe8fb19SBen Gras #if defined(__sparc__) && defined(_LP64) 2082fe8fb19SBen Gras int __ai_pad0; /* ABI compatibility */ 2092fe8fb19SBen Gras #endif 2102fe8fb19SBen Gras socklen_t ai_addrlen; /*%< length of ai_addr */ 2112fe8fb19SBen Gras #if defined(__alpha__) || (defined(__i386__) && defined(_LP64)) 2122fe8fb19SBen Gras int __ai_pad0; /* ABI compatibility */ 2132fe8fb19SBen Gras #endif 2142fe8fb19SBen Gras char *ai_canonname; /*%< canonical name for hostname */ 2152fe8fb19SBen Gras struct sockaddr *ai_addr; /*%< binary address */ 2162fe8fb19SBen Gras struct addrinfo *ai_next; /*%< next structure in linked list */ 2172fe8fb19SBen Gras }; 2182fe8fb19SBen Gras #endif 2192fe8fb19SBen Gras 2202fe8fb19SBen Gras /*% 2212fe8fb19SBen Gras * Error return codes from gethostbyname() and gethostbyaddr() 2222fe8fb19SBen Gras * (left in extern int h_errno). 2232fe8fb19SBen Gras */ 2242fe8fb19SBen Gras 2252fe8fb19SBen Gras #if defined(_NETBSD_SOURCE) 2262fe8fb19SBen Gras #define NETDB_INTERNAL -1 /*%< see errno */ 2272fe8fb19SBen Gras #define NETDB_SUCCESS 0 /*%< no problem */ 2282fe8fb19SBen Gras #endif 2292fe8fb19SBen Gras #define NO_ADDRESS NO_DATA /* no address, look for MX record */ 2302fe8fb19SBen Gras #define HOST_NOT_FOUND 1 /*%< Authoritative Answer Host not found */ 2312fe8fb19SBen Gras #define TRY_AGAIN 2 /*%< Non-Authoritive Host not found, or SERVERFAIL */ 2322fe8fb19SBen Gras #define NO_RECOVERY 3 /*%< Non recoverable errors, FORMERR, REFUSED, NOTIMP */ 2332fe8fb19SBen Gras #define NO_DATA 4 /*%< Valid name, no data record of requested type */ 2342fe8fb19SBen Gras #if defined(_NETBSD_SOURCE) 2352fe8fb19SBen Gras #define NO_ADDRESS NO_DATA /*%< no address, look for MX record */ 2362fe8fb19SBen Gras #endif 2372fe8fb19SBen Gras 2382fe8fb19SBen Gras /* 2392fe8fb19SBen Gras * Error return codes from getaddrinfo() 2402fe8fb19SBen Gras */ 2412fe8fb19SBen Gras #if (_POSIX_C_SOURCE - 0) >= 200112L || (_XOPEN_SOURCE - 0) >= 520 || \ 2422fe8fb19SBen Gras defined(_NETBSD_SOURCE) 2432fe8fb19SBen Gras #define EAI_ADDRFAMILY 1 /*%< address family for hostname not supported */ 2442fe8fb19SBen Gras #define EAI_AGAIN 2 /*%< temporary failure in name resolution */ 2452fe8fb19SBen Gras #define EAI_BADFLAGS 3 /*%< invalid value for ai_flags */ 2462fe8fb19SBen Gras #define EAI_FAIL 4 /*%< non-recoverable failure in name resolution */ 2472fe8fb19SBen Gras #define EAI_FAMILY 5 /*%< ai_family not supported */ 2482fe8fb19SBen Gras #define EAI_MEMORY 6 /*%< memory allocation failure */ 2492fe8fb19SBen Gras #define EAI_NODATA 7 /*%< no address associated with hostname */ 2502fe8fb19SBen Gras #define EAI_NONAME 8 /*%< hostname nor servname provided, or not known */ 2512fe8fb19SBen Gras #define EAI_SERVICE 9 /*%< servname not supported for ai_socktype */ 2522fe8fb19SBen Gras #define EAI_SOCKTYPE 10 /*%< ai_socktype not supported */ 2532fe8fb19SBen Gras #define EAI_SYSTEM 11 /*%< system error returned in errno */ 2542fe8fb19SBen Gras #define EAI_BADHINTS 12 /* invalid value for hints */ 2552fe8fb19SBen Gras #define EAI_PROTOCOL 13 /* resolved protocol is unknown */ 2562fe8fb19SBen Gras #define EAI_OVERFLOW 14 /* argument buffer overflow */ 2572fe8fb19SBen Gras #define EAI_MAX 15 2582fe8fb19SBen Gras #endif /* _POSIX_C_SOURCE >= 200112 || _XOPEN_SOURCE >= 520 || _NETBSD_SOURCE */ 2592fe8fb19SBen Gras 2602fe8fb19SBen Gras /*% 2612fe8fb19SBen Gras * Flag values for getaddrinfo() 2622fe8fb19SBen Gras */ 2632fe8fb19SBen Gras #if (_POSIX_C_SOURCE - 0) >= 200112L || (_XOPEN_SOURCE - 0) >= 520 || \ 2642fe8fb19SBen Gras defined(_NETBSD_SOURCE) 2652fe8fb19SBen Gras #define AI_PASSIVE 0x00000001 /* get address to use bind() */ 2662fe8fb19SBen Gras #define AI_CANONNAME 0x00000002 /* fill ai_canonname */ 2672fe8fb19SBen Gras #define AI_NUMERICHOST 0x00000004 /* prevent host name resolution */ 2682fe8fb19SBen Gras #define AI_NUMERICSERV 0x00000008 /* prevent service name resolution */ 269*84d9c625SLionel Sambuc #define AI_ADDRCONFIG 0x00000400 /* only if any address is assigned */ 2702fe8fb19SBen Gras /* valid flags for addrinfo (not a standard def, apps should not use it) */ 271*84d9c625SLionel Sambuc #ifdef _NETBSD_SOURCE 272*84d9c625SLionel Sambuc #define AI_SRV 0x00000800 /* do _srv lookups */ 273*84d9c625SLionel Sambuc #define AI_MASK \ 274*84d9c625SLionel Sambuc (AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST | AI_NUMERICSERV | \ 275*84d9c625SLionel Sambuc AI_ADDRCONFIG | AI_SRV) 276*84d9c625SLionel Sambuc #else 2772fe8fb19SBen Gras #define AI_MASK \ 278f14fb602SLionel Sambuc (AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST | AI_NUMERICSERV | \ 279f14fb602SLionel Sambuc AI_ADDRCONFIG) 280*84d9c625SLionel Sambuc #endif 2812fe8fb19SBen Gras #endif 2822fe8fb19SBen Gras 2832fe8fb19SBen Gras #if (_POSIX_C_SOURCE - 0) >= 200112L || (_XOPEN_SOURCE - 0) >= 520 || \ 2842fe8fb19SBen Gras defined(_NETBSD_SOURCE) 2852fe8fb19SBen Gras /*% 2862fe8fb19SBen Gras * Constants for getnameinfo() 2872fe8fb19SBen Gras */ 2882fe8fb19SBen Gras #if defined(_NETBSD_SOURCE) 2892fe8fb19SBen Gras #define NI_MAXHOST 1025 2902fe8fb19SBen Gras #define NI_MAXSERV 32 2912fe8fb19SBen Gras #endif 2922fe8fb19SBen Gras 2932fe8fb19SBen Gras /*% 2942fe8fb19SBen Gras * Flag values for getnameinfo() 2952fe8fb19SBen Gras */ 2962fe8fb19SBen Gras #define NI_NOFQDN 0x00000001 2972fe8fb19SBen Gras #define NI_NUMERICHOST 0x00000002 2982fe8fb19SBen Gras #define NI_NAMEREQD 0x00000004 2992fe8fb19SBen Gras #define NI_NUMERICSERV 0x00000008 3002fe8fb19SBen Gras #define NI_DGRAM 0x00000010 3012fe8fb19SBen Gras #define NI_WITHSCOPEID 0x00000020 3022fe8fb19SBen Gras #define NI_NUMERICSCOPE 0x00000040 3032fe8fb19SBen Gras 3042fe8fb19SBen Gras /*% 3052fe8fb19SBen Gras * Scope delimit character 3062fe8fb19SBen Gras */ 3072fe8fb19SBen Gras #if defined(_NETBSD_SOURCE) 3082fe8fb19SBen Gras #define SCOPE_DELIMITER '%' 3092fe8fb19SBen Gras #endif 3102fe8fb19SBen Gras #endif /* (_POSIX_C_SOURCE - 0) >= 200112L || ... */ 3112fe8fb19SBen Gras 3122fe8fb19SBen Gras __BEGIN_DECLS 3132fe8fb19SBen Gras void endhostent(void); 3142fe8fb19SBen Gras void endnetent(void); 3152fe8fb19SBen Gras void endprotoent(void); 3162fe8fb19SBen Gras void endservent(void); 3172fe8fb19SBen Gras #if (_XOPEN_SOURCE - 0) >= 520 && (_XOPEN_SOURCE - 0) < 600 || \ 3182fe8fb19SBen Gras defined(_NETBSD_SOURCE) 3192fe8fb19SBen Gras #if 0 /* we do not ship this */ 3202fe8fb19SBen Gras void freehostent(struct hostent *); 3212fe8fb19SBen Gras #endif 3222fe8fb19SBen Gras #endif 323*84d9c625SLionel Sambuc struct hostent *gethostbyaddr(const void *, socklen_t, int); 3242fe8fb19SBen Gras struct hostent *gethostbyname(const char *); 3252fe8fb19SBen Gras #if defined(_NETBSD_SOURCE) 3262fe8fb19SBen Gras struct hostent *gethostbyname2(const char *, int); 3272fe8fb19SBen Gras #endif 3282fe8fb19SBen Gras struct hostent *gethostent(void); 3292fe8fb19SBen Gras struct netent *getnetbyaddr(uint32_t, int); 3302fe8fb19SBen Gras struct netent *getnetbyname(const char *); 3312fe8fb19SBen Gras struct netent *getnetent(void); 3322fe8fb19SBen Gras struct protoent *getprotobyname(const char *); 3332fe8fb19SBen Gras struct protoent *getprotobynumber(int); 3342fe8fb19SBen Gras struct protoent *getprotoent(void); 3352fe8fb19SBen Gras struct servent *getservbyname(const char *, const char *); 3362fe8fb19SBen Gras struct servent *getservbyport(int, const char *); 3372fe8fb19SBen Gras struct servent *getservent(void); 3382fe8fb19SBen Gras #if defined(_NETBSD_SOURCE) 3392fe8fb19SBen Gras void herror(const char *); 3402fe8fb19SBen Gras const char *hstrerror(int); 3412fe8fb19SBen Gras #endif 3422fe8fb19SBen Gras void sethostent(int); 3432fe8fb19SBen Gras #if defined(_NETBSD_SOURCE) 3442fe8fb19SBen Gras /* void sethostfile(const char *); */ 3452fe8fb19SBen Gras #endif 3462fe8fb19SBen Gras void setnetent(int); 3472fe8fb19SBen Gras void setprotoent(int); 3482fe8fb19SBen Gras void setservent(int); 3492fe8fb19SBen Gras #if (_POSIX_C_SOURCE - 0) >= 200112L || (_XOPEN_SOURCE - 0) >= 520 || \ 3502fe8fb19SBen Gras defined(_NETBSD_SOURCE) 3512fe8fb19SBen Gras int getaddrinfo(const char * __restrict, const char * __restrict, 3522fe8fb19SBen Gras const struct addrinfo * __restrict, 3532fe8fb19SBen Gras struct addrinfo ** __restrict); 3542fe8fb19SBen Gras int getnameinfo(const struct sockaddr * __restrict, socklen_t, 3552fe8fb19SBen Gras char * __restrict, socklen_t, 3562fe8fb19SBen Gras char * __restrict, socklen_t, int); 3572fe8fb19SBen Gras struct addrinfo *allocaddrinfo(socklen_t); 3582fe8fb19SBen Gras void freeaddrinfo(struct addrinfo *); 3592fe8fb19SBen Gras const char *gai_strerror(int); 3602fe8fb19SBen Gras #endif 3612fe8fb19SBen Gras __END_DECLS 3622fe8fb19SBen Gras 3632fe8fb19SBen Gras #endif /* !_NETDB_H_ */ 364