netdb.h revision 1dc9e472e19acfe6dc7f41e429236e7eef7ceda1
11dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project/*-
21dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * Copyright (c) 1980, 1983, 1988, 1993
31dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project *	The Regents of the University of California.  All rights reserved.
41dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project *
51dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * Redistribution and use in source and binary forms, with or without
61dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * modification, are permitted provided that the following conditions
71dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * are met:
81dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * 1. Redistributions of source code must retain the above copyright
91dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project *    notice, this list of conditions and the following disclaimer.
101dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * 2. Redistributions in binary form must reproduce the above copyright
111dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project *    notice, this list of conditions and the following disclaimer in the
121dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project *    documentation and/or other materials provided with the distribution.
131dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * 3. All advertising materials mentioning features or use of this software
141dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project *    must display the following acknowledgement:
151dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project *	This product includes software developed by the University of
161dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project *	California, Berkeley and its contributors.
171dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * 4. Neither the name of the University nor the names of its contributors
181dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project *    may be used to endorse or promote products derived from this software
191dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project *    without specific prior written permission.
201dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project *
211dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
221dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
231dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
241dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
251dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
261dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
271dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
281dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
291dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
301dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
311dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * SUCH DAMAGE.
321dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project *
331dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * -
341dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * Portions Copyright (c) 1993 by Digital Equipment Corporation.
351dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project *
361dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * Permission to use, copy, modify, and distribute this software for any
371dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * purpose with or without fee is hereby granted, provided that the above
381dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * copyright notice and this permission notice appear in all copies, and that
391dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * the name of Digital Equipment Corporation not be used in advertising or
401dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * publicity pertaining to distribution of the document or software without
411dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * specific, written prior permission.
421dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project *
431dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
441dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
451dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * OF MERCHANTABILITY AND FITNESS.   IN NO EVENT SHALL DIGITAL EQUIPMENT
461dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
471dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
481dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
491dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
501dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * SOFTWARE.
511dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * -
521dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * --Copyright--
531dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project */
541dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project
551dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project/*
561dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project *      @(#)netdb.h	8.1 (Berkeley) 6/2/93
571dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project *      From: Id: netdb.h,v 8.9 1996/11/19 08:39:29 vixie Exp $
581dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * $FreeBSD: /repoman/r/ncvs/src/include/netdb.h,v 1.41 2006/04/15 16:20:26 ume Exp $
591dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project */
601dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project
611dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#ifndef _NETDB_H_
621dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define _NETDB_H_
631dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project
641dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#include <sys/cdefs.h>
651dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#include <sys/types.h>
661dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#include <sys/socket.h>
671dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project
681dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#ifndef _PATH_HEQUIV
691dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project# define	_PATH_HEQUIV	"/system/etc/hosts.equiv"
701dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#endif
711dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define	_PATH_HOSTS	"/system/etc/hosts"
721dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define	_PATH_NETWORKS	"/system/etc/networks"
731dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define	_PATH_PROTOCOLS	"/system/etc/protocols"
741dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define	_PATH_SERVICES	"/system/etc/services"
751dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project
761dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define  MAXHOSTNAMELEN  256
771dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project
781dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project/* BIONIC-BEGIN */
791dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define  h_errno   (*__get_h_errno())
801dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Projectextern int*  __get_h_errno(void);
811dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project/* BIONIC-END */
821dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project
831dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project/*
841dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * Structures returned by network data base library.  All addresses are
851dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * supplied in host order, and returned in network order (suitable for
861dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * use in system calls).
871dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project */
881dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Projectstruct hostent {
891dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project	char	*h_name;	/* official name of host */
901dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project	char	**h_aliases;	/* alias list */
911dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project	int	h_addrtype;	/* host address type */
921dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project	int	h_length;	/* length of address */
931dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project	char	**h_addr_list;	/* list of addresses from name server */
941dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define	h_addr	h_addr_list[0]	/* address, for backward compatibility */
951dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project};
961dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project
971dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Projectstruct netent {
981dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project	char		*n_name;	/* official name of net */
991dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project	char		**n_aliases;	/* alias list */
1001dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project	int		n_addrtype;	/* net address type */
1011dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project	uint32_t	n_net;		/* network # */
1021dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project};
1031dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project
1041dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Projectstruct servent {
1051dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project	char	*s_name;	/* official service name */
1061dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project	char	**s_aliases;	/* alias list */
1071dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project	int	s_port;		/* port # */
1081dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project	char	*s_proto;	/* protocol to use */
1091dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project};
1101dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project
1111dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Projectstruct protoent {
1121dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project	char	*p_name;	/* official protocol name */
1131dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project	char	**p_aliases;	/* alias list */
1141dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project	int	p_proto;	/* protocol # */
1151dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project};
1161dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project
1171dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Projectstruct addrinfo {
1181dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project	int	ai_flags;	/* AI_PASSIVE, AI_CANONNAME, AI_NUMERICHOST */
1191dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project	int	ai_family;	/* PF_xxx */
1201dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project	int	ai_socktype;	/* SOCK_xxx */
1211dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project	int	ai_protocol;	/* 0 or IPPROTO_xxx for IPv4 and IPv6 */
1221dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project	socklen_t ai_addrlen;	/* length of ai_addr */
1231dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project	char	*ai_canonname;	/* canonical name for hostname */
1241dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project	struct	sockaddr *ai_addr;	/* binary address */
1251dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project	struct	addrinfo *ai_next;	/* next structure in linked list */
1261dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project};
1271dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project
1281dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project/*
1291dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * Error return codes from gethostbyname() and gethostbyaddr()
1301dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * (left in h_errno).
1311dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project */
1321dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project
1331dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define	NETDB_INTERNAL	-1	/* see errno */
1341dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define	NETDB_SUCCESS	0	/* no problem */
1351dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define	HOST_NOT_FOUND	1 /* Authoritative Answer Host not found */
1361dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define	TRY_AGAIN	2 /* Non-Authoritative Host not found, or SERVERFAIL */
1371dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define	NO_RECOVERY	3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
1381dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define	NO_DATA		4 /* Valid name, no data record of requested type */
1391dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define	NO_ADDRESS	NO_DATA		/* no address, look for MX record */
1401dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project
1411dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project/*
1421dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * Error return codes from getaddrinfo()
1431dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project */
1441dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#if 0
1451dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project/* obsoleted */
1461dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define	EAI_ADDRFAMILY	 1	/* address family for hostname not supported */
1471dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#endif
1481dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define	EAI_AGAIN	 2	/* temporary failure in name resolution */
1491dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define	EAI_BADFLAGS	 3	/* invalid value for ai_flags */
1501dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define	EAI_FAIL	 4	/* non-recoverable failure in name resolution */
1511dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define	EAI_FAMILY	 5	/* ai_family not supported */
1521dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define	EAI_MEMORY	 6	/* memory allocation failure */
1531dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define	EAI_NODATA	 7	/* no address associated with hostname */
1541dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define	EAI_NONAME	 8	/* hostname nor servname provided, or not known */
1551dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define	EAI_SERVICE	 9	/* servname not supported for ai_socktype */
1561dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define	EAI_SOCKTYPE	10	/* ai_socktype not supported */
1571dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define	EAI_SYSTEM	11	/* system error returned in errno */
1581dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define	EAI_BADHINTS	12	/* invalid value for hints */
1591dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define	EAI_PROTOCOL	13	/* resolved protocol is unknown */
1601dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define	EAI_OVERFLOW	14	/* argument buffer overflow */
1611dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define	EAI_MAX		15
1621dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project
1631dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project/*
1641dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * Flag values for getaddrinfo()
1651dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project */
1661dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define	AI_PASSIVE	0x00000001 /* get address to use bind() */
1671dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define	AI_CANONNAME	0x00000002 /* fill ai_canonname */
1681dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define	AI_NUMERICHOST	0x00000004 /* prevent host name resolution */
1691dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define	AI_NUMERICSERV	0x00000008 /* prevent service name resolution */
1701dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project/* valid flags for addrinfo (not a standard def, apps should not use it) */
1711dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define AI_MASK \
1721dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project    (AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST | AI_NUMERICSERV | \
1731dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project    AI_ADDRCONFIG)
1741dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project
1751dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define	AI_ALL		0x00000100 /* IPv6 and IPv4-mapped (with AI_V4MAPPED) */
1761dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define	AI_V4MAPPED_CFG	0x00000200 /* accept IPv4-mapped if kernel supports */
1771dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define	AI_ADDRCONFIG	0x00000400 /* only if any address is assigned */
1781dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define	AI_V4MAPPED	0x00000800 /* accept IPv4-mapped IPv6 address */
1791dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project/* special recommended flags for getipnodebyname */
1801dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define	AI_DEFAULT	(AI_V4MAPPED_CFG | AI_ADDRCONFIG)
1811dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project
1821dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project/*
1831dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * Constants for getnameinfo()
1841dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project */
1851dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define	NI_MAXHOST	1025
1861dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define	NI_MAXSERV	32
1871dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project
1881dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project/*
1891dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * Flag values for getnameinfo()
1901dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project */
1911dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define	NI_NOFQDN	0x00000001
1921dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define	NI_NUMERICHOST	0x00000002
1931dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define	NI_NAMEREQD	0x00000004
1941dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define	NI_NUMERICSERV	0x00000008
1951dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define	NI_DGRAM	0x00000010
1961dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#if 0 /* obsolete */
1971dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define NI_WITHSCOPEID	0x00000020
1981dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#endif
1991dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project
2001dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project/*
2011dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * Scope delimit character
2021dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project */
2031dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define	SCOPE_DELIMITER	'%'
2041dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project
2051dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project__BEGIN_DECLS
2061dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Projectvoid endhostent(void);
2071dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Projectvoid endnetent(void);
2081dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Projectvoid endnetgrent(void);
2091dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Projectvoid endprotoent(void);
2101dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Projectvoid endservent(void);
2111dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Projectvoid freehostent(struct hostent *);
2121dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Projectstruct hostent	*gethostbyaddr(const char *, int, int);
2131dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Projectint gethostbyaddr_r(const char *, int, int, struct hostent *, char *, size_t, struct hostent **, int *);
2141dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Projectstruct hostent	*gethostbyname(const char *);
2151dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Projectint gethostbyname_r(const char *, struct hostent *, char *, size_t, struct hostent **, int *);
2161dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Projectstruct hostent	*gethostbyname2(const char *, int);
2171dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Projectint gethostbyname2_r(const char *, int, struct hostent *, char *, size_t, struct hostent **, int *);
2181dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Projectstruct hostent	*gethostent(void);
2191dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Projectint gethostent_r(struct hostent *, char *, size_t, struct hostent **, int *);
2201dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Projectstruct hostent	*getipnodebyaddr(const void *, size_t, int, int *);
2211dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Projectstruct hostent	*getipnodebyname(const char *, int, int, int *);
2221dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Projectstruct netent	*getnetbyaddr(uint32_t, int);
2231dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Projectint getnetbyaddr_r(uint32_t, int, struct netent *, char *, size_t, struct netent**, int *);
2241dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Projectstruct netent	*getnetbyname(const char *);
2251dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Projectint getnetbyname_r(const char *, struct netent *, char *, size_t, struct netent **, int *);
2261dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Projectstruct netent	*getnetent(void);
2271dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Projectint getnetent_r(struct netent *, char *, size_t, struct netent **, int *);
2281dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Projectint getnetgrent(char **, char **, char **);
2291dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Projectstruct protoent	*getprotobyname(const char *);
2301dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Projectint getprotobyname_r(const char *, struct protoent *, char *, size_t, struct protoent **);
2311dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Projectstruct protoent	*getprotobynumber(int);
2321dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Projectint getprotobynumber_r(int, struct protoent *, char *, size_t, struct protoent **);
2331dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Projectstruct protoent	*getprotoent(void);
2341dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Projectint getprotoent_r(struct protoent *, char *, size_t, struct protoent **);
2351dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Projectstruct servent	*getservbyname(const char *, const char *);
2361dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Projectstruct servent	*getservbyport(int, const char *);
2371dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Projectstruct servent	*getservent(void);
2381dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Projectvoid herror(const char *);
2391dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Projectconst char	*hstrerror(int);
2401dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Projectint innetgr(const char *, const char *, const char *, const char *);
2411dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Projectvoid sethostent(int);
2421dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Projectvoid setnetent(int);
2431dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Projectvoid setprotoent(int);
2441dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Projectint getaddrinfo(const char *, const char *, const struct addrinfo *, struct addrinfo **);
2451dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Projectint getnameinfo(const struct sockaddr *, socklen_t, char *, size_t, char *, size_t, int);
2461dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Projectvoid freeaddrinfo(struct addrinfo *);
2471dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Projectconst char	*gai_strerror(int);
2481dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Projectvoid setnetgrent(const char *);
2491dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Projectvoid setservent(int);
2501dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project
2511dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project__END_DECLS
2521dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project
2531dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#endif /* !_NETDB_H_ */
254