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