2 * Copyright (C) 2009 Internet Systems Consortium, Inc. ("ISC")
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
8 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
9 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
10 * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
11 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
12 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
13 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14 * PERFORMANCE OF THIS SOFTWARE.
17 /* $Id: netdb.h.in,v 1.3 2009/09/02 23:48:02 tbox Exp $ */
24 #include <stddef.h> /* Required on FreeBSD (and others?) for size_t. */
25 #include <netdb.h> /* Contractual provision. */
28 * Define if <netdb.h> does not declare struct addrinfo.
30 @ISC_IRS_NEEDADDRINFO@
32 #ifdef ISC_IRS_NEEDADDRINFO
34 int ai_flags; /* AI_PASSIVE, AI_CANONNAME */
35 int ai_family; /* PF_xxx */
36 int ai_socktype; /* SOCK_xxx */
37 int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */
38 size_t ai_addrlen; /* Length of ai_addr */
39 char *ai_canonname; /* Canonical name for hostname */
40 struct sockaddr *ai_addr; /* Binary address */
41 struct addrinfo *ai_next; /* Next structure in linked list */
46 * Undefine all #defines we are interested in as <netdb.h> may or may not have
51 * Error return codes from gethostbyname() and gethostbyaddr()
52 * (left in extern int h_errno).
63 #define NETDB_INTERNAL -1 /* see errno */
64 #define NETDB_SUCCESS 0 /* no problem */
65 #define HOST_NOT_FOUND 1 /* Authoritative Answer Host not found */
66 #define TRY_AGAIN 2 /* Non-Authoritive Host not found, or SERVERFAIL */
67 #define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
68 #define NO_DATA 4 /* Valid name, no data record of requested type */
69 #define NO_ADDRESS NO_DATA /* no address, look for MX record */
72 * Error return codes from getaddrinfo(). EAI_INSECUREDATA is our own extension
73 * and it's very unlikely to be already defined, but undef it just in case; it
74 * at least doesn't do any harm.
91 #undef EAI_INSECUREDATA
94 #define EAI_ADDRFAMILY 1 /* address family for hostname not supported */
95 #define EAI_AGAIN 2 /* temporary failure in name resolution */
96 #define EAI_BADFLAGS 3 /* invalid value for ai_flags */
97 #define EAI_FAIL 4 /* non-recoverable failure in name resolution */
98 #define EAI_FAMILY 5 /* ai_family not supported */
99 #define EAI_MEMORY 6 /* memory allocation failure */
100 #define EAI_NODATA 7 /* no address associated with hostname */
101 #define EAI_NONAME 8 /* hostname nor servname provided, or not known */
102 #define EAI_SERVICE 9 /* servname not supported for ai_socktype */
103 #define EAI_SOCKTYPE 10 /* ai_socktype not supported */
104 #define EAI_SYSTEM 11 /* system error returned in errno */
105 #define EAI_BADHINTS 12
106 #define EAI_PROTOCOL 13
107 #define EAI_OVERFLOW 14
108 #define EAI_INSECUREDATA 15
112 * Flag values for getaddrinfo()
116 #undef AI_NUMERICHOST
118 #define AI_PASSIVE 0x00000001
119 #define AI_CANONNAME 0x00000002
120 #define AI_NUMERICHOST 0x00000004
123 * Flag values for getipnodebyname()
130 #define AI_V4MAPPED 0x00000008
131 #define AI_ALL 0x00000010
132 #define AI_ADDRCONFIG 0x00000020
133 #define AI_DEFAULT (AI_V4MAPPED|AI_ADDRCONFIG)
136 * Constants for lwres_getnameinfo()
141 #define NI_MAXHOST 1025
142 #define NI_MAXSERV 32
145 * Flag values for lwres_getnameinfo()
148 #undef NI_NUMERICHOST
150 #undef NI_NUMERICSERV
152 #undef NI_NUMERICSCOPE
154 #define NI_NOFQDN 0x00000001
155 #define NI_NUMERICHOST 0x00000002
156 #define NI_NAMEREQD 0x00000004
157 #define NI_NUMERICSERV 0x00000008
158 #define NI_DGRAM 0x00000010
161 * Tell Emacs to use C mode on this file.
167 #endif /* IRS_NETDB_H */