4 * Copyright (C) 2004, 2006, 2007, 2009 Internet Systems Consortium, Inc. ("ISC")
5 * Copyright (C) 2000, 2001 Internet Software Consortium.
7 * Permission to use, copy, modify, and/or distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above
9 * copyright notice and this permission notice appear in all copies.
11 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
12 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
13 * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
14 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
15 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
16 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17 * PERFORMANCE OF THIS SOFTWARE.
20 /* Id: netdb.h,v 1.7.332.2 2009/01/18 23:47:41 tbox Exp */
29 * Define if <netdb.h> does not declare struct addrinfo.
33 int ai_flags
; /* AI_PASSIVE, AI_CANONNAME */
34 int ai_family
; /* PF_xxx */
35 int ai_socktype
; /* SOCK_xxx */
36 int ai_protocol
; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */
37 size_t ai_addrlen
; /* Length of ai_addr */
38 char *ai_canonname
; /* Canonical name for hostname */
39 struct sockaddr
*ai_addr
; /* Binary address */
40 struct addrinfo
*ai_next
; /* Next structure in linked list */
45 * Undefine all \#defines we are interested in as <netdb.h> may or may not have
50 * Error return codes from gethostbyname() and gethostbyaddr()
51 * (left in extern int h_errno).
62 #define NETDB_INTERNAL -1 /* see errno */
63 #define NETDB_SUCCESS 0 /* no problem */
64 #define HOST_NOT_FOUND 1 /* Authoritative Answer Host not found */
65 #define TRY_AGAIN 2 /* Non-Authoritative Host not found, or SERVERFAIL */
66 #define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
67 #define NO_DATA 4 /* Valid name, no data record of requested type */
68 #define NO_ADDRESS NO_DATA /* no address, look for MX record */
71 * Error return codes from getaddrinfo()
89 #define EAI_ADDRFAMILY 1 /* address family for hostname not supported */
90 #define EAI_AGAIN 2 /* temporary failure in name resolution */
91 #define EAI_BADFLAGS 3 /* invalid value for ai_flags */
92 #define EAI_FAIL 4 /* non-recoverable failure in name resolution */
93 #define EAI_FAMILY 5 /* ai_family not supported */
94 #define EAI_MEMORY 6 /* memory allocation failure */
95 #define EAI_NODATA 7 /* no address associated with hostname */
96 #define EAI_NONAME 8 /* hostname nor servname provided, or not known */
97 #define EAI_SERVICE 9 /* servname not supported for ai_socktype */
98 #define EAI_SOCKTYPE 10 /* ai_socktype not supported */
99 #define EAI_SYSTEM 11 /* system error returned in errno */
100 #define EAI_BADHINTS 12
101 #define EAI_PROTOCOL 13
105 * Flag values for getaddrinfo()
109 #undef AI_NUMERICHOST
111 #define AI_PASSIVE 0x00000001
112 #define AI_CANONNAME 0x00000002
113 #define AI_NUMERICHOST 0x00000004
116 * Flag values for getipnodebyname()
123 #define AI_V4MAPPED 0x00000008
124 #define AI_ALL 0x00000010
125 #define AI_ADDRCONFIG 0x00000020
126 #define AI_DEFAULT (AI_V4MAPPED|AI_ADDRCONFIG)
129 * Constants for getnameinfo()
134 #define NI_MAXHOST 1025
135 #define NI_MAXSERV 32
138 * Flag values for getnameinfo()
141 #undef NI_NUMERICHOST
143 #undef NI_NUMERICSERV
145 #undef NI_NUMERICSCOPE
147 #define NI_NOFQDN 0x00000001
148 #define NI_NUMERICHOST 0x00000002
149 #define NI_NAMEREQD 0x00000004
150 #define NI_NUMERICSERV 0x00000008
151 #define NI_DGRAM 0x00000010
152 #define NI_NUMERICSCOPE 0x00000020 /*2553bis-00*/
155 * Structures for getrrsetbyname()
158 unsigned int rdi_length
;
159 unsigned char *rdi_data
;
163 unsigned int rri_flags
;
166 unsigned int rri_ttl
;
167 unsigned int rri_nrdatas
;
168 unsigned int rri_nsigs
;
170 struct rdatainfo
*rri_rdatas
;
171 struct rdatainfo
*rri_sigs
;
175 * Flags for getrrsetbyname()
177 #define RRSET_VALIDATED 0x00000001
178 /* Set was dnssec validated */
181 * Return codes for getrrsetbyname()
183 #define ERRSET_SUCCESS 0
184 #define ERRSET_NOMEMORY 1
185 #define ERRSET_FAIL 2
186 #define ERRSET_INVAL 3