Patrick Welche <prlw1@cam.ac.uk>
[netbsd-mini2440.git] / external / bsd / ntp / dist / lib / isc / win32 / netdb.h
blob48c8f946ee51aaf62af2a978349fe44af0698dea
1 /* $NetBSD$ */
3 /*
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 */
22 #ifndef NETDB_H
23 #define NETDB_H 1
25 #include <stddef.h>
26 #include <winsock2.h>
29 * Define if <netdb.h> does not declare struct addrinfo.
32 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
46 * defined them.
50 * Error return codes from gethostbyname() and gethostbyaddr()
51 * (left in extern int h_errno).
54 #undef NETDB_INTERNAL
55 #undef NETDB_SUCCESS
56 #undef HOST_NOT_FOUND
57 #undef TRY_AGAIN
58 #undef NO_RECOVERY
59 #undef NO_DATA
60 #undef NO_ADDRESS
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()
74 #undef EAI_ADDRFAMILY
75 #undef EAI_AGAIN
76 #undef EAI_BADFLAGS
77 #undef EAI_FAIL
78 #undef EAI_FAMILY
79 #undef EAI_MEMORY
80 #undef EAI_NODATA
81 #undef EAI_NONAME
82 #undef EAI_SERVICE
83 #undef EAI_SOCKTYPE
84 #undef EAI_SYSTEM
85 #undef EAI_BADHINTS
86 #undef EAI_PROTOCOL
87 #undef EAI_MAX
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
102 #define EAI_MAX 14
105 * Flag values for getaddrinfo()
107 #undef AI_PASSIVE
108 #undef AI_CANONNAME
109 #undef AI_NUMERICHOST
111 #define AI_PASSIVE 0x00000001
112 #define AI_CANONNAME 0x00000002
113 #define AI_NUMERICHOST 0x00000004
116 * Flag values for getipnodebyname()
118 #undef AI_V4MAPPED
119 #undef AI_ALL
120 #undef AI_ADDRCONFIG
121 #undef AI_DEFAULT
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()
131 #undef NI_MAXHOST
132 #undef NI_MAXSERV
134 #define NI_MAXHOST 1025
135 #define NI_MAXSERV 32
138 * Flag values for getnameinfo()
140 #undef NI_NOFQDN
141 #undef NI_NUMERICHOST
142 #undef NI_NAMEREQD
143 #undef NI_NUMERICSERV
144 #undef NI_DGRAM
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()
157 struct rdatainfo {
158 unsigned int rdi_length;
159 unsigned char *rdi_data;
162 struct rrsetinfo {
163 unsigned int rri_flags;
164 int rri_rdclass;
165 int rri_rdtype;
166 unsigned int rri_ttl;
167 unsigned int rri_nrdatas;
168 unsigned int rri_nsigs;
169 char *rri_name;
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
189 #endif /* NETDB_H */