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