xref: /titanic_50/usr/src/head/netdb.h (revision 2f443e27e5988131d8b57bec58ee15f9227e0899)
17c478bd9Sstevel@tonic-gate /*
2ba3594baSGarrett D'Amore  * Copyright 2014 Garrett D'Amore <garrett@damore.org>
3ba3594baSGarrett D'Amore  *
4628b0c67SMark Fenwick  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
57c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
67c478bd9Sstevel@tonic-gate  */
77c478bd9Sstevel@tonic-gate 
87c478bd9Sstevel@tonic-gate /*	Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T	*/
97c478bd9Sstevel@tonic-gate /*	  All Rights Reserved  	*/
107c478bd9Sstevel@tonic-gate 
117c478bd9Sstevel@tonic-gate /*
127c478bd9Sstevel@tonic-gate  * BIND 4.9.3:
137c478bd9Sstevel@tonic-gate  *
147c478bd9Sstevel@tonic-gate  * Copyright (c) 1980, 1983, 1988, 1993
157c478bd9Sstevel@tonic-gate  *	The Regents of the University of California.  All rights reserved.
167c478bd9Sstevel@tonic-gate  *
177c478bd9Sstevel@tonic-gate  * Redistribution and use in source and binary forms, with or without
187c478bd9Sstevel@tonic-gate  * modification, are permitted provided that the following conditions
197c478bd9Sstevel@tonic-gate  * are met:
207c478bd9Sstevel@tonic-gate  * 1. Redistributions of source code must retain the above copyright
217c478bd9Sstevel@tonic-gate  *    notice, this list of conditions and the following disclaimer.
227c478bd9Sstevel@tonic-gate  * 2. Redistributions in binary form must reproduce the above copyright
237c478bd9Sstevel@tonic-gate  *    notice, this list of conditions and the following disclaimer in the
247c478bd9Sstevel@tonic-gate  *    documentation and/or other materials provided with the distribution.
257c478bd9Sstevel@tonic-gate  * 3. All advertising materials mentioning features or use of this software
267c478bd9Sstevel@tonic-gate  *    must display the following acknowledgement:
277c478bd9Sstevel@tonic-gate  *	This product includes software developed by the University of
287c478bd9Sstevel@tonic-gate  *	California, Berkeley and its contributors.
297c478bd9Sstevel@tonic-gate  * 4. Neither the name of the University nor the names of its contributors
307c478bd9Sstevel@tonic-gate  *    may be used to endorse or promote products derived from this software
317c478bd9Sstevel@tonic-gate  *    without specific prior written permission.
327c478bd9Sstevel@tonic-gate  *
337c478bd9Sstevel@tonic-gate  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
347c478bd9Sstevel@tonic-gate  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
357c478bd9Sstevel@tonic-gate  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
367c478bd9Sstevel@tonic-gate  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
377c478bd9Sstevel@tonic-gate  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
387c478bd9Sstevel@tonic-gate  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
397c478bd9Sstevel@tonic-gate  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
407c478bd9Sstevel@tonic-gate  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
417c478bd9Sstevel@tonic-gate  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
427c478bd9Sstevel@tonic-gate  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
437c478bd9Sstevel@tonic-gate  * SUCH DAMAGE.
447c478bd9Sstevel@tonic-gate  * -
457c478bd9Sstevel@tonic-gate  * Portions Copyright (c) 1993 by Digital Equipment Corporation.
467c478bd9Sstevel@tonic-gate  *
477c478bd9Sstevel@tonic-gate  * Permission to use, copy, modify, and distribute this software for any
487c478bd9Sstevel@tonic-gate  * purpose with or without fee is hereby granted, provided that the above
497c478bd9Sstevel@tonic-gate  * copyright notice and this permission notice appear in all copies, and that
507c478bd9Sstevel@tonic-gate  * the name of Digital Equipment Corporation not be used in advertising or
517c478bd9Sstevel@tonic-gate  * publicity pertaining to distribution of the document or software without
527c478bd9Sstevel@tonic-gate  * specific, written prior permission.
537c478bd9Sstevel@tonic-gate  *
547c478bd9Sstevel@tonic-gate  * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
557c478bd9Sstevel@tonic-gate  * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
567c478bd9Sstevel@tonic-gate  * OF MERCHANTABILITY AND FITNESS.   IN NO EVENT SHALL DIGITAL EQUIPMENT
577c478bd9Sstevel@tonic-gate  * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
587c478bd9Sstevel@tonic-gate  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
597c478bd9Sstevel@tonic-gate  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
607c478bd9Sstevel@tonic-gate  * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
617c478bd9Sstevel@tonic-gate  * SOFTWARE.
627c478bd9Sstevel@tonic-gate  * --Copyright--
637c478bd9Sstevel@tonic-gate  *
647c478bd9Sstevel@tonic-gate  * End BIND 4.9.3
657c478bd9Sstevel@tonic-gate  */
667c478bd9Sstevel@tonic-gate 
677c478bd9Sstevel@tonic-gate /*
687c478bd9Sstevel@tonic-gate  * Structures returned by network data base library.
697c478bd9Sstevel@tonic-gate  * All addresses are supplied in host order, and
707c478bd9Sstevel@tonic-gate  * returned in network order (suitable for use in system calls).
717c478bd9Sstevel@tonic-gate  */
727c478bd9Sstevel@tonic-gate 
737c478bd9Sstevel@tonic-gate #ifndef _NETDB_H
747c478bd9Sstevel@tonic-gate #define	_NETDB_H
757c478bd9Sstevel@tonic-gate 
767c478bd9Sstevel@tonic-gate #include <sys/types.h>
777c478bd9Sstevel@tonic-gate #include <netinet/in.h>
787c478bd9Sstevel@tonic-gate #if !defined(_XPG4_2) || defined(_XPG6) || defined(__EXTENSIONS__)
797c478bd9Sstevel@tonic-gate #include <sys/socket.h>
807c478bd9Sstevel@tonic-gate #endif /* !defined(_XPG4_2) || defined(_XPG6) || defined(__EXTENSIONS__) */
817c478bd9Sstevel@tonic-gate #include <sys/feature_tests.h>
827c478bd9Sstevel@tonic-gate 
837c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
847c478bd9Sstevel@tonic-gate extern "C" {
857c478bd9Sstevel@tonic-gate #endif
867c478bd9Sstevel@tonic-gate 
877c478bd9Sstevel@tonic-gate #define	_PATH_HEQUIV	"/etc/hosts.equiv"
887c478bd9Sstevel@tonic-gate #define	_PATH_HOSTS	"/etc/hosts"
897c478bd9Sstevel@tonic-gate #define	_PATH_IPNODES	"/etc/inet/ipnodes"
907c478bd9Sstevel@tonic-gate #define	_PATH_IPSECALGS	"/etc/inet/ipsecalgs"
917c478bd9Sstevel@tonic-gate #define	_PATH_NETMASKS	"/etc/netmasks"
927c478bd9Sstevel@tonic-gate #define	_PATH_NETWORKS	"/etc/networks"
937c478bd9Sstevel@tonic-gate #define	_PATH_PROTOCOLS	"/etc/protocols"
947c478bd9Sstevel@tonic-gate #define	_PATH_SERVICES	"/etc/services"
957c478bd9Sstevel@tonic-gate 
967c478bd9Sstevel@tonic-gate struct	hostent {
977c478bd9Sstevel@tonic-gate 	char	*h_name;	/* official name of host */
987c478bd9Sstevel@tonic-gate 	char	**h_aliases;	/* alias list */
997c478bd9Sstevel@tonic-gate 	int	h_addrtype;	/* host address type */
1007c478bd9Sstevel@tonic-gate 	int	h_length;	/* length of address */
1017c478bd9Sstevel@tonic-gate 	char	**h_addr_list;	/* list of addresses from name server */
1027c478bd9Sstevel@tonic-gate #define	h_addr	h_addr_list[0]	/* address, for backward compatiblity */
1037c478bd9Sstevel@tonic-gate };
1047c478bd9Sstevel@tonic-gate 
1057c478bd9Sstevel@tonic-gate 
1067c478bd9Sstevel@tonic-gate /*
1077c478bd9Sstevel@tonic-gate  * addrinfo introduced with IPv6 for Protocol-Independent Hostname
1087c478bd9Sstevel@tonic-gate  * and Service Name Translation.
1097c478bd9Sstevel@tonic-gate  */
1107c478bd9Sstevel@tonic-gate 
1117c478bd9Sstevel@tonic-gate #if !defined(_XPG4_2) || defined(_XPG6) || defined(__EXTENSIONS__)
1127c478bd9Sstevel@tonic-gate struct addrinfo {
1137c478bd9Sstevel@tonic-gate 	int ai_flags;		/* AI_PASSIVE, AI_CANONNAME, ... */
1147c478bd9Sstevel@tonic-gate 	int ai_family;		/* PF_xxx */
1157c478bd9Sstevel@tonic-gate 	int ai_socktype;	/* SOCK_xxx */
1167c478bd9Sstevel@tonic-gate 	int ai_protocol;	/* 0 or IPPROTO_xxx for IPv4 and IPv6 */
1177c478bd9Sstevel@tonic-gate #ifdef __sparcv9
1187c478bd9Sstevel@tonic-gate 	int _ai_pad;		/* for backwards compat with old size_t */
1197c478bd9Sstevel@tonic-gate #endif /* __sparcv9 */
1207c478bd9Sstevel@tonic-gate 	socklen_t ai_addrlen;
1217c478bd9Sstevel@tonic-gate 	char *ai_canonname;	/* canonical name for hostname */
1227c478bd9Sstevel@tonic-gate 	struct sockaddr *ai_addr;	/* binary address */
1237c478bd9Sstevel@tonic-gate 	struct addrinfo *ai_next;	/* next structure in linked list */
1247c478bd9Sstevel@tonic-gate };
1259525b14bSRao Shoaib 
126*2f443e27SRobert Mustacchi /*
127*2f443e27SRobert Mustacchi  * The flag 0x8000 is currently reserved for private use between libnsl and
128*2f443e27SRobert Mustacchi  * libsocket. See lib/libsocket/inet/getaddrinfo.c for more information.
129*2f443e27SRobert Mustacchi  */
1307c478bd9Sstevel@tonic-gate /* addrinfo flags */
1317c478bd9Sstevel@tonic-gate #define	AI_PASSIVE	0x0008	/* intended for bind() + listen() */
1327c478bd9Sstevel@tonic-gate #define	AI_CANONNAME	0x0010	/* return canonical version of host */
1337c478bd9Sstevel@tonic-gate #define	AI_NUMERICHOST	0x0020	/* use numeric node address string */
1347c478bd9Sstevel@tonic-gate #define	AI_NUMERICSERV	0x0040	/* servname is assumed numeric */
1357c478bd9Sstevel@tonic-gate 
1367c478bd9Sstevel@tonic-gate /* getipnodebyname() flags */
1377c478bd9Sstevel@tonic-gate #define	AI_V4MAPPED	0x0001	/* IPv4 mapped addresses if no IPv6 */
1387c478bd9Sstevel@tonic-gate #define	AI_ALL		0x0002	/* IPv6 and IPv4 mapped addresses */
1397c478bd9Sstevel@tonic-gate #define	AI_ADDRCONFIG	0x0004	/* AAAA or A records only if IPv6/IPv4 cnfg'd */
1407c478bd9Sstevel@tonic-gate 
1419525b14bSRao Shoaib 
1427c478bd9Sstevel@tonic-gate /*
1437c478bd9Sstevel@tonic-gate  * These were defined in RFC 2553 but not SUSv3
1447c478bd9Sstevel@tonic-gate  * or RFC 3493 which obsoleted 2553.
1457c478bd9Sstevel@tonic-gate  */
1467c478bd9Sstevel@tonic-gate #if !defined(_XPG6) || defined(__EXTENSIONS__)
1477c478bd9Sstevel@tonic-gate #define	AI_DEFAULT	(AI_V4MAPPED | AI_ADDRCONFIG)
1487c478bd9Sstevel@tonic-gate 
1497c478bd9Sstevel@tonic-gate /* addrinfo errors */
1507c478bd9Sstevel@tonic-gate #define	EAI_ADDRFAMILY	1	/* address family not supported */
1517c478bd9Sstevel@tonic-gate #define	EAI_NODATA	7	/* no address */
1527c478bd9Sstevel@tonic-gate #endif /* !defined(_XPG6) || defined(__EXTENSIONS__) */
1537c478bd9Sstevel@tonic-gate #define	EAI_AGAIN	2	/* DNS temporary failure */
1547c478bd9Sstevel@tonic-gate #define	EAI_BADFLAGS	3	/* invalid ai_flags */
1557c478bd9Sstevel@tonic-gate #define	EAI_FAIL	4	/* DNS non-recoverable failure */
1567c478bd9Sstevel@tonic-gate #define	EAI_FAMILY	5	/* ai_family not supported */
1577c478bd9Sstevel@tonic-gate #define	EAI_MEMORY	6	/* memory allocation failure */
1587c478bd9Sstevel@tonic-gate #define	EAI_NONAME	8	/* host/servname not known */
1597c478bd9Sstevel@tonic-gate #define	EAI_SERVICE	9	/* servname not supported for ai_socktype */
1607c478bd9Sstevel@tonic-gate #define	EAI_SOCKTYPE	10	/* ai_socktype not supported */
1617c478bd9Sstevel@tonic-gate #define	EAI_SYSTEM	11	/* system error in errno */
1627c478bd9Sstevel@tonic-gate #define	EAI_OVERFLOW	12	/* argument buffer overflow */
1639525b14bSRao Shoaib #define	EAI_PROTOCOL	13
1649525b14bSRao Shoaib #define	EAI_MAX		14
1657c478bd9Sstevel@tonic-gate 
1667c478bd9Sstevel@tonic-gate /* getnameinfo flags */
1677c478bd9Sstevel@tonic-gate #define	NI_NOFQDN	0x0001
1687c478bd9Sstevel@tonic-gate #define	NI_NUMERICHOST	0x0002	/* return numeric form of address */
1697c478bd9Sstevel@tonic-gate #define	NI_NAMEREQD	0x0004	/* request DNS name */
1707c478bd9Sstevel@tonic-gate #define	NI_NUMERICSERV	0x0008
1717c478bd9Sstevel@tonic-gate #define	NI_DGRAM	0x0010
1727c478bd9Sstevel@tonic-gate 
1737c478bd9Sstevel@tonic-gate #if !defined(_XPG6) || defined(__EXTENSIONS__)
1747c478bd9Sstevel@tonic-gate /* Not listed in any standards document */
1757c478bd9Sstevel@tonic-gate #define	NI_WITHSCOPEID  0x0020
1767c478bd9Sstevel@tonic-gate #define	NI_NUMERICSCOPE 0x0040
1777c478bd9Sstevel@tonic-gate 
1787c478bd9Sstevel@tonic-gate /* getnameinfo max sizes as defined in RFC 2553 obsoleted in RFC 3493 */
1797c478bd9Sstevel@tonic-gate #define	NI_MAXHOST	1025
1807c478bd9Sstevel@tonic-gate #define	NI_MAXSERV	32
1817c478bd9Sstevel@tonic-gate #endif /* !defined(_XPG6) || defined(__EXTENSIONS__) */
1827c478bd9Sstevel@tonic-gate #endif /* !defined(_XPG4_2) || defined(_XPG6) || defined(__EXTENSIONS__) */
1837c478bd9Sstevel@tonic-gate 
1847c478bd9Sstevel@tonic-gate /*
1859525b14bSRao Shoaib  * Scope delimit character
1869525b14bSRao Shoaib  */
1879525b14bSRao Shoaib #define	SCOPE_DELIMITER	'%'
1889525b14bSRao Shoaib 
1899525b14bSRao Shoaib 
1909525b14bSRao Shoaib /*
1917c478bd9Sstevel@tonic-gate  * Algorithm entry for /etc/inet/ipsecalgs which defines IPsec protocols
1927c478bd9Sstevel@tonic-gate  * and algorithms.
1937c478bd9Sstevel@tonic-gate  */
1947c478bd9Sstevel@tonic-gate #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
1957c478bd9Sstevel@tonic-gate typedef struct ipsecalgent {
1967c478bd9Sstevel@tonic-gate 	char **a_names;		/* algorithm names */
1977c478bd9Sstevel@tonic-gate 	int a_proto_num;	/* protocol number */
1987c478bd9Sstevel@tonic-gate 	int a_alg_num;		/* algorithm number */
1997c478bd9Sstevel@tonic-gate 	char *a_mech_name;	/* encryption framework mechanism name */
2007c478bd9Sstevel@tonic-gate 	int *a_block_sizes;	/* supported block sizes */
2017c478bd9Sstevel@tonic-gate 	int *a_key_sizes;	/* supported key sizes */
2027c478bd9Sstevel@tonic-gate 	int a_key_increment;	/* key size increment */
203628b0c67SMark Fenwick 	int *a_mech_params;	/* mechanism specific parameters */
204628b0c67SMark Fenwick 	int a_alg_flags;	/* algorithm flags */
2057c478bd9Sstevel@tonic-gate } ipsecalgent_t;
2067c478bd9Sstevel@tonic-gate 
2077c478bd9Sstevel@tonic-gate /* well-known IPsec protocol numbers */
2087c478bd9Sstevel@tonic-gate 
2097c478bd9Sstevel@tonic-gate #define	IPSEC_PROTO_AH		2
2107c478bd9Sstevel@tonic-gate #define	IPSEC_PROTO_ESP		3
2117c478bd9Sstevel@tonic-gate #endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
2127c478bd9Sstevel@tonic-gate 
2137c478bd9Sstevel@tonic-gate /*
2147c478bd9Sstevel@tonic-gate  * Assumption here is that a network number
2157c478bd9Sstevel@tonic-gate  * fits in 32 bits -- probably a poor one.
2167c478bd9Sstevel@tonic-gate  */
2177c478bd9Sstevel@tonic-gate struct	netent {
2187c478bd9Sstevel@tonic-gate 	char		*n_name;	/* official name of net */
2197c478bd9Sstevel@tonic-gate 	char		**n_aliases;	/* alias list */
2207c478bd9Sstevel@tonic-gate 	int		n_addrtype;	/* net address type */
2217c478bd9Sstevel@tonic-gate 	in_addr_t	n_net;		/* network # */
2227c478bd9Sstevel@tonic-gate };
2237c478bd9Sstevel@tonic-gate 
2247c478bd9Sstevel@tonic-gate struct	protoent {
2257c478bd9Sstevel@tonic-gate 	char	*p_name;	/* official protocol name */
2267c478bd9Sstevel@tonic-gate 	char	**p_aliases;	/* alias list */
2277c478bd9Sstevel@tonic-gate 	int	p_proto;	/* protocol # */
2287c478bd9Sstevel@tonic-gate };
2297c478bd9Sstevel@tonic-gate 
2307c478bd9Sstevel@tonic-gate struct	servent {
2317c478bd9Sstevel@tonic-gate 	char	*s_name;	/* official service name */
2327c478bd9Sstevel@tonic-gate 	char	**s_aliases;	/* alias list */
2337c478bd9Sstevel@tonic-gate 	int	s_port;		/* port # */
2347c478bd9Sstevel@tonic-gate 	char	*s_proto;	/* protocol to use */
2357c478bd9Sstevel@tonic-gate };
2367c478bd9Sstevel@tonic-gate 
2377c478bd9Sstevel@tonic-gate #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
2387c478bd9Sstevel@tonic-gate struct hostent	*gethostbyname_r
2397c478bd9Sstevel@tonic-gate 	(const char *, struct hostent *, char *, int, int *h_errnop);
2407c478bd9Sstevel@tonic-gate struct hostent	*gethostbyaddr_r
2417c478bd9Sstevel@tonic-gate 	(const char *, int, int, struct hostent *, char *, int, int *h_errnop);
2427c478bd9Sstevel@tonic-gate struct hostent	*getipnodebyname(const char *, int, int, int *);
2437c478bd9Sstevel@tonic-gate struct hostent	*getipnodebyaddr(const void *, size_t, int, int *);
2447c478bd9Sstevel@tonic-gate void		freehostent(struct hostent *);
2457c478bd9Sstevel@tonic-gate struct hostent	*gethostent_r(struct hostent *, char *, int, int *h_errnop);
2467c478bd9Sstevel@tonic-gate 
2477c478bd9Sstevel@tonic-gate struct servent	*getservbyname_r
2487c478bd9Sstevel@tonic-gate 	(const char *name, const char *, struct servent *, char *, int);
2497c478bd9Sstevel@tonic-gate struct servent	*getservbyport_r
2507c478bd9Sstevel@tonic-gate 	(int port, const char *, struct servent *, char *, int);
2517c478bd9Sstevel@tonic-gate struct servent	*getservent_r(struct	servent *, char *, int);
2527c478bd9Sstevel@tonic-gate 
2537c478bd9Sstevel@tonic-gate struct netent	*getnetbyname_r
2547c478bd9Sstevel@tonic-gate 	(const char *, struct netent *, char *, int);
2557c478bd9Sstevel@tonic-gate struct netent	*getnetbyaddr_r(long, int, struct netent *, char *, int);
2567c478bd9Sstevel@tonic-gate struct netent	*getnetent_r(struct netent *, char *, int);
2577c478bd9Sstevel@tonic-gate 
2587c478bd9Sstevel@tonic-gate struct protoent	*getprotobyname_r
2597c478bd9Sstevel@tonic-gate 	(const char *, struct protoent *, char *, int);
2607c478bd9Sstevel@tonic-gate struct protoent	*getprotobynumber_r
2617c478bd9Sstevel@tonic-gate 	(int, struct protoent *, char *, int);
2627c478bd9Sstevel@tonic-gate struct protoent	*getprotoent_r(struct protoent *, char *, int);
2637c478bd9Sstevel@tonic-gate 
2647c478bd9Sstevel@tonic-gate int getnetgrent_r(char **, char **, char **, char *, int);
2657c478bd9Sstevel@tonic-gate int innetgr(const char *, const char *, const char *, const char *);
2667c478bd9Sstevel@tonic-gate #endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
2677c478bd9Sstevel@tonic-gate 
2687c478bd9Sstevel@tonic-gate /* Old interfaces that return a pointer to a static area;  MT-unsafe */
2697c478bd9Sstevel@tonic-gate struct hostent	*gethostbyname(const char *);
2707c478bd9Sstevel@tonic-gate struct hostent	*gethostent(void);
2717c478bd9Sstevel@tonic-gate struct netent	*getnetbyaddr(in_addr_t, int);
2727c478bd9Sstevel@tonic-gate struct netent	*getnetbyname(const char *);
2737c478bd9Sstevel@tonic-gate struct netent	*getnetent(void);
2747c478bd9Sstevel@tonic-gate struct protoent	*getprotobyname(const char *);
2757c478bd9Sstevel@tonic-gate struct protoent	*getprotobynumber(int);
2767c478bd9Sstevel@tonic-gate struct protoent	*getprotoent(void);
2777c478bd9Sstevel@tonic-gate struct servent	*getservbyname(const char *, const char *);
2787c478bd9Sstevel@tonic-gate struct servent	*getservbyport(int, const char *);
2797c478bd9Sstevel@tonic-gate struct servent	*getservent(void);
2807c478bd9Sstevel@tonic-gate 
2817c478bd9Sstevel@tonic-gate /* gethostbyaddr() second argument is a size_t only in unix95/unix98 */
2827c478bd9Sstevel@tonic-gate #if !defined(_XPG4_2) || defined(_XPG6) || defined(__EXTENSIONS__)
2837c478bd9Sstevel@tonic-gate struct hostent	*gethostbyaddr(const void *, socklen_t, int);
2847c478bd9Sstevel@tonic-gate #else
2857c478bd9Sstevel@tonic-gate struct hostent	*gethostbyaddr(const void *, size_t, int);
2867c478bd9Sstevel@tonic-gate #endif /* !defined(_XPG4_2) || defined(_XPG6) || defined(__EXTENSIONS__) */
2877c478bd9Sstevel@tonic-gate 
2887c478bd9Sstevel@tonic-gate #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
2897c478bd9Sstevel@tonic-gate int endhostent(void);
2907c478bd9Sstevel@tonic-gate int endnetent(void);
2917c478bd9Sstevel@tonic-gate int endprotoent(void);
2927c478bd9Sstevel@tonic-gate int endservent(void);
2937c478bd9Sstevel@tonic-gate int sethostent(int);
2947c478bd9Sstevel@tonic-gate int setnetent(int);
2957c478bd9Sstevel@tonic-gate int setprotoent(int);
2967c478bd9Sstevel@tonic-gate int setservent(int);
2977c478bd9Sstevel@tonic-gate #else
2987c478bd9Sstevel@tonic-gate void endhostent(void);
2997c478bd9Sstevel@tonic-gate void endnetent(void);
3007c478bd9Sstevel@tonic-gate void endprotoent(void);
3017c478bd9Sstevel@tonic-gate void endservent(void);
3027c478bd9Sstevel@tonic-gate void sethostent(int);
3037c478bd9Sstevel@tonic-gate void setnetent(int);
3047c478bd9Sstevel@tonic-gate void setprotoent(int);
3057c478bd9Sstevel@tonic-gate void setservent(int);
3067c478bd9Sstevel@tonic-gate #endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
3077c478bd9Sstevel@tonic-gate 
3087c478bd9Sstevel@tonic-gate #if !defined(_XPG4_2) || defined(_XPG6) || defined(__EXTENSIONS__)
3097c478bd9Sstevel@tonic-gate 
3107c478bd9Sstevel@tonic-gate #ifdef	_XPG6
3117c478bd9Sstevel@tonic-gate #ifdef	__PRAGMA_REDEFINE_EXTNAME
3127c478bd9Sstevel@tonic-gate #pragma redefine_extname getaddrinfo __xnet_getaddrinfo
3137c478bd9Sstevel@tonic-gate #else	/* __PRAGMA_REDEFINE_EXTNAME */
3147c478bd9Sstevel@tonic-gate #define	getaddrinfo __xnet_getaddrinfo
3157c478bd9Sstevel@tonic-gate #endif	/* __PRAGMA_REDEFINE_EXTNAME */
3167c478bd9Sstevel@tonic-gate #endif	/* _XPG6 */
3177c478bd9Sstevel@tonic-gate 
3187c478bd9Sstevel@tonic-gate int		getaddrinfo(const char *_RESTRICT_KYWD,
3197c478bd9Sstevel@tonic-gate 			const char *_RESTRICT_KYWD,
3207c478bd9Sstevel@tonic-gate 			const struct addrinfo *_RESTRICT_KYWD,
3217c478bd9Sstevel@tonic-gate 			struct addrinfo **_RESTRICT_KYWD);
3227c478bd9Sstevel@tonic-gate void		freeaddrinfo(struct addrinfo *);
3237c478bd9Sstevel@tonic-gate const char	*gai_strerror(int);
3247c478bd9Sstevel@tonic-gate int		getnameinfo(const struct sockaddr *_RESTRICT_KYWD,
3257c478bd9Sstevel@tonic-gate 			socklen_t, char *_RESTRICT_KYWD, socklen_t,
3267c478bd9Sstevel@tonic-gate 			char *_RESTRICT_KYWD, socklen_t, int);
3277c478bd9Sstevel@tonic-gate #endif /* !defined(_XPG4_2) || defined(_XPG6) || defined(__EXTENSIONS__) */
3287c478bd9Sstevel@tonic-gate 
3297c478bd9Sstevel@tonic-gate #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
3307c478bd9Sstevel@tonic-gate int getnetgrent(char **, char **, char **);
3317c478bd9Sstevel@tonic-gate int setnetgrent(const char *);
3327c478bd9Sstevel@tonic-gate int endnetgrent(void);
3337c478bd9Sstevel@tonic-gate int rcmd(char **, unsigned short,
3347c478bd9Sstevel@tonic-gate 	const char *, const char *, const char *, int *);
3357c478bd9Sstevel@tonic-gate int rcmd_af(char **, unsigned short,
3367c478bd9Sstevel@tonic-gate 	const char *, const char *, const char *, int *, int);
3377c478bd9Sstevel@tonic-gate int rresvport_af(int *, int);
3387c478bd9Sstevel@tonic-gate int rresvport_addr(int *, struct sockaddr_storage *);
3397c478bd9Sstevel@tonic-gate int rexec(char **, unsigned short,
3407c478bd9Sstevel@tonic-gate 	const char *, const char *, const char *, int *);
3417c478bd9Sstevel@tonic-gate int rexec_af(char **, unsigned short,
3427c478bd9Sstevel@tonic-gate 	const char *, const char *, const char *, int *, int);
3437c478bd9Sstevel@tonic-gate int rresvport(int *);
3447c478bd9Sstevel@tonic-gate int ruserok(const char *, int, const char *, const char *);
3457c478bd9Sstevel@tonic-gate /* BIND */
3467c478bd9Sstevel@tonic-gate struct hostent	*gethostbyname2(const char *, int);
3477c478bd9Sstevel@tonic-gate void		herror(const char *);
3487c478bd9Sstevel@tonic-gate const char	*hstrerror(int);
3497c478bd9Sstevel@tonic-gate /* End BIND */
3507c478bd9Sstevel@tonic-gate 
3517c478bd9Sstevel@tonic-gate /* IPsec algorithm prototype definitions */
3527c478bd9Sstevel@tonic-gate struct ipsecalgent *getipsecalgbyname(const char *, int, int *);
3537c478bd9Sstevel@tonic-gate struct ipsecalgent *getipsecalgbynum(int, int, int *);
3547c478bd9Sstevel@tonic-gate int getipsecprotobyname(const char *doi_name);
3557c478bd9Sstevel@tonic-gate char *getipsecprotobynum(int doi_domain);
3567c478bd9Sstevel@tonic-gate void freeipsecalgent(struct ipsecalgent *ptr);
3577c478bd9Sstevel@tonic-gate /* END IPsec algorithm prototype definitions */
3587c478bd9Sstevel@tonic-gate 
3597c478bd9Sstevel@tonic-gate #endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
3607c478bd9Sstevel@tonic-gate 
3617c478bd9Sstevel@tonic-gate /*
3627c478bd9Sstevel@tonic-gate  * Error return codes from gethostbyname() and gethostbyaddr()
3637c478bd9Sstevel@tonic-gate  * (when using the resolver)
3647c478bd9Sstevel@tonic-gate  */
3657c478bd9Sstevel@tonic-gate 
3667c478bd9Sstevel@tonic-gate extern  int h_errno;
3677c478bd9Sstevel@tonic-gate 
3687c478bd9Sstevel@tonic-gate #ifdef	_REENTRANT
3697c478bd9Sstevel@tonic-gate extern int	*__h_errno(void);
3707c478bd9Sstevel@tonic-gate 
3717c478bd9Sstevel@tonic-gate /* Only #define h_errno if there is no conflict with other use */
3727c478bd9Sstevel@tonic-gate #ifdef	H_ERRNO_IS_FUNCTION
3737c478bd9Sstevel@tonic-gate #define	h_errno	(*__h_errno())
3747c478bd9Sstevel@tonic-gate #endif	/* NO_H_ERRNO_DEFINE */
3757c478bd9Sstevel@tonic-gate #endif	/* _REENTRANT */
3767c478bd9Sstevel@tonic-gate 
3779525b14bSRao Shoaib /*
3789525b14bSRao Shoaib  * Error return codes from gethostbyname() and gethostbyaddr()
3799525b14bSRao Shoaib  * (left in extern int h_errno).
3809525b14bSRao Shoaib  */
3817c478bd9Sstevel@tonic-gate #define	HOST_NOT_FOUND	1 /* Authoritive Answer Host not found */
3827c478bd9Sstevel@tonic-gate #define	TRY_AGAIN	2 /* Non-Authoritive Host not found, or SERVERFAIL */
3837c478bd9Sstevel@tonic-gate #define	NO_RECOVERY	3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
3847c478bd9Sstevel@tonic-gate #define	NO_DATA		4 /* Valid name, no data record of requested type */
3857c478bd9Sstevel@tonic-gate 
3867c478bd9Sstevel@tonic-gate #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
3877c478bd9Sstevel@tonic-gate #define	NO_ADDRESS	NO_DATA		/* no address, look for MX record */
3887c478bd9Sstevel@tonic-gate 
3897c478bd9Sstevel@tonic-gate /* BIND */
3907c478bd9Sstevel@tonic-gate #define	NETDB_INTERNAL	-1	/* see errno */
3917c478bd9Sstevel@tonic-gate #define	NETDB_SUCCESS	0	/* no problem */
3927c478bd9Sstevel@tonic-gate /* End BIND */
3937c478bd9Sstevel@tonic-gate 
3947c478bd9Sstevel@tonic-gate #define	MAXHOSTNAMELEN	256
3957c478bd9Sstevel@tonic-gate 
3967c478bd9Sstevel@tonic-gate #define	MAXALIASES	35
3977c478bd9Sstevel@tonic-gate #define	MAXADDRS	35
3987c478bd9Sstevel@tonic-gate #endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
3997c478bd9Sstevel@tonic-gate 
4007c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
4017c478bd9Sstevel@tonic-gate }
4027c478bd9Sstevel@tonic-gate #endif
4037c478bd9Sstevel@tonic-gate 
4047c478bd9Sstevel@tonic-gate #endif	/* _NETDB_H */
405