Prevent definition of HAVE_WINxxx_H symbols and avoid inclusion of Windows headers...
[platform/upstream/c-ares.git] / nameser.h
1 /* $Id$ */
2
3 #ifndef ARES_NAMESER_H
4 #define ARES_NAMESER_H
5
6 /* Windows-only header file provided by liren@vivisimo.com to make his Windows
7    port build */
8
9 #ifndef NETWARE
10 #ifndef __CYGWIN__
11 #include <windows.h>
12 #endif
13 #include <process.h> /* for the _getpid() proto */
14 #endif  /* !NETWARE */
15 #include <sys/types.h>
16
17 #ifndef NETWARE
18
19 #define MAXHOSTNAMELEN 256
20
21 #define EINPROGRESS WSAEINPROGRESS
22 #define EWOULDBLOCK WSAEWOULDBLOCK
23 #define EMSGSIZE     WSAEMSGSIZE
24 #define EAFNOSUPPORT WSAEAFNOSUPPORT
25
26 /* Structure for scatter/gather I/O.  */
27 struct iovec
28 {
29     void *iov_base;     /* Pointer to data.  */
30     size_t iov_len;     /* Length of data.  */
31 };
32
33 #define getpid() _getpid()
34
35 int ares_writev (SOCKET s, const struct iovec *vector, size_t count);
36 #define writev(s,vect,count)  ares_writev(s,vect,count)
37
38 struct timezone { int dummy; };
39
40 int ares_gettimeofday(struct timeval *tv, struct timezone *tz);
41 #define gettimeofday(tv,tz) ares_gettimeofday(tv,tz)
42
43 #endif  /* !NETWARE */
44
45 #define NS_CMPRSFLGS  0xc0
46 #define NS_IN6ADDRSZ  16
47 #define NS_INT16SZ    2
48 #define NS_INADDRSZ   4
49
50   /* Flag bits indicating name compression. */
51 #define INDIR_MASK    NS_CMPRSFLGS
52
53 typedef enum __ns_class {
54     ns_c_invalid = 0,       /* Cookie. */
55     ns_c_in = 1,            /* Internet. */
56     ns_c_2 = 2,             /* unallocated/unsupported. */
57     ns_c_chaos = 3,         /* MIT Chaos-net. */
58     ns_c_hs = 4,            /* MIT Hesiod. */
59     /* Query class values which do not appear in resource records */
60     ns_c_none = 254,        /* for prereq. sections in update requests */
61     ns_c_any = 255,         /* Wildcard match. */
62     ns_c_max = 65536
63 } ns_class;
64
65 #define C_IN           ns_c_in
66
67 typedef enum __ns_type {
68     ns_t_invalid = 0,       /* Cookie. */
69     ns_t_a = 1,             /* Host address. */
70     ns_t_ns = 2,            /* Authoritative server. */
71     ns_t_md = 3,            /* Mail destination. */
72     ns_t_mf = 4,            /* Mail forwarder. */
73     ns_t_cname = 5,         /* Canonical name. */
74     ns_t_soa = 6,           /* Start of authority zone. */
75     ns_t_mb = 7,            /* Mailbox domain name. */
76     ns_t_mg = 8,            /* Mail group member. */
77     ns_t_mr = 9,            /* Mail rename name. */
78     ns_t_null = 10,         /* Null resource record. */
79     ns_t_wks = 11,          /* Well known service. */
80     ns_t_ptr = 12,          /* Domain name pointer. */
81     ns_t_hinfo = 13,        /* Host information. */
82     ns_t_minfo = 14,        /* Mailbox information. */
83     ns_t_mx = 15,           /* Mail routing information. */
84     ns_t_txt = 16,          /* Text strings. */
85     ns_t_rp = 17,           /* Responsible person. */
86     ns_t_afsdb = 18,        /* AFS cell database. */
87     ns_t_x25 = 19,          /* X_25 calling address. */
88     ns_t_isdn = 20,         /* ISDN calling address. */
89     ns_t_rt = 21,           /* Router. */
90     ns_t_nsap = 22,         /* NSAP address. */
91     ns_t_nsap_ptr = 23,     /* Reverse NSAP lookup (deprecated). */
92     ns_t_sig = 24,          /* Security signature. */
93     ns_t_key = 25,          /* Security key. */
94     ns_t_px = 26,           /* X.400 mail mapping. */
95     ns_t_gpos = 27,         /* Geographical position (withdrawn). */
96     ns_t_aaaa = 28,         /* Ip6 Address. */
97     ns_t_loc = 29,          /* Location Information. */
98     ns_t_nxt = 30,          /* Next domain (security). */
99     ns_t_eid = 31,          /* Endpoint identifier. */
100     ns_t_nimloc = 32,       /* Nimrod Locator. */
101     ns_t_srv = 33,          /* Server Selection. */
102     ns_t_atma = 34,         /* ATM Address */
103     ns_t_naptr = 35,        /* Naming Authority PoinTeR */
104     ns_t_kx = 36,           /* Key Exchange */
105     ns_t_cert = 37,         /* Certification record */
106     ns_t_a6 = 38,           /* IPv6 address (deprecates AAAA) */
107     ns_t_dname = 39,        /* Non-terminal DNAME (for IPv6) */
108     ns_t_sink = 40,         /* Kitchen sink (experimentatl) */
109     ns_t_opt = 41,          /* EDNS0 option (meta-RR) */
110     ns_t_tsig = 250,        /* Transaction signature. */
111     ns_t_ixfr = 251,        /* Incremental zone transfer. */
112     ns_t_axfr = 252,        /* Transfer zone of authority. */
113     ns_t_mailb = 253,       /* Transfer mailbox records. */
114     ns_t_maila = 254,       /* Transfer mail agent records. */
115     ns_t_any = 255,         /* Wildcard match. */
116     ns_t_zxfr = 256,        /* BIND-specific, nonstandard. */
117     ns_t_max = 65536
118 } ns_type;
119
120 #define T_PTR          ns_t_ptr
121 #define T_A            ns_t_a
122
123
124 #define NS_DEFAULTPORT        53      /* For both TCP and UDP. */
125 #define NAMESERVER_PORT        NS_DEFAULTPORT
126
127 #define NS_HFIXEDSZ   12      /* #/bytes of fixed data in header */
128 #define HFIXEDSZ      NS_HFIXEDSZ
129
130 #define NS_QFIXEDSZ   4       /* #/bytes of fixed data in query */
131 #define QFIXEDSZ       NS_QFIXEDSZ
132
133 typedef enum __ns_opcode {
134     ns_o_query = 0,         /* Standard query. */
135     ns_o_iquery = 1,        /* Inverse query (deprecated/unsupported). */
136     ns_o_status = 2,        /* Name server status query (unsupported). */
137                                 /* Opcode 3 is undefined/reserved. */
138     ns_o_notify = 4,        /* Zone change notification. */
139     ns_o_update = 5,        /* Zone update message. */
140     ns_o_max = 6
141 } ns_opcode;
142
143 #define QUERY          ns_o_query
144
145 #define NS_MAXLABEL   63
146 #define MAXLABEL       NS_MAXLABEL
147
148 #define NS_RRFIXEDSZ  10      /* #/bytes of fixed data in r record */
149 #define RRFIXEDSZ      NS_RRFIXEDSZ
150
151 #define T_CNAME                ns_t_cname
152
153
154 #define NS_PACKETSZ   512     /* maximum packet size */
155 #define PACKETSZ       NS_PACKETSZ
156
157 typedef enum __ns_rcode {
158     ns_r_noerror = 0,       /* No error occurred. */
159     ns_r_formerr = 1,       /* Format error. */
160     ns_r_servfail = 2,      /* Server failure. */
161     ns_r_nxdomain = 3,      /* Name error. */
162     ns_r_notimpl = 4,       /* Unimplemented. */
163     ns_r_refused = 5,       /* Operation refused. */
164     /* these are for BIND_UPDATE */
165     ns_r_yxdomain = 6,      /* Name exists */
166     ns_r_yxrrset = 7,       /* RRset exists */
167     ns_r_nxrrset = 8,       /* RRset does not exist */
168     ns_r_notauth = 9,       /* Not authoritative for zone */
169     ns_r_notzone = 10,      /* Zone of record different from zone section */
170     ns_r_max = 11,
171     /* The following are TSIG extended errors */
172     ns_r_badsig = 16,
173     ns_r_badkey = 17,
174     ns_r_badtime = 18
175 } ns_rcode;
176
177 #define SERVFAIL        ns_r_servfail
178 #define NOTIMP          ns_r_notimpl
179 #define REFUSED         ns_r_refused
180 #undef NOERROR /* it seems this is already defined in winerror.h */
181 #define NOERROR         ns_r_noerror
182 #define FORMERR         ns_r_formerr
183 #define NXDOMAIN        ns_r_nxdomain
184
185 #define C_CHAOS         ns_c_chaos
186 #define C_HS            ns_c_hs
187 #define C_NONE          ns_c_none
188 #define C_ANY           ns_c_any
189
190 #define T_A             ns_t_a
191 #define T_NS            ns_t_ns
192 #define T_MD            ns_t_md
193 #define T_MF            ns_t_mf
194 #define T_CNAME         ns_t_cname
195 #define T_SOA           ns_t_soa
196 #define T_MB            ns_t_mb
197 #define T_MG            ns_t_mg
198 #define T_MR            ns_t_mr
199 #define T_NULL          ns_t_null
200 #define T_WKS           ns_t_wks
201 #define T_PTR           ns_t_ptr
202 #define T_HINFO         ns_t_hinfo
203 #define T_MINFO         ns_t_minfo
204 #define T_MX            ns_t_mx
205 #define T_TXT           ns_t_txt
206 #define T_RP            ns_t_rp
207 #define T_AFSDB         ns_t_afsdb
208 #define T_X25           ns_t_x25
209 #define T_ISDN          ns_t_isdn
210 #define T_RT            ns_t_rt
211 #define T_NSAP          ns_t_nsap
212 #define T_NSAP_PTR      ns_t_nsap_ptr
213 #define T_SIG           ns_t_sig
214 #define T_KEY           ns_t_key
215 #define T_PX            ns_t_px
216 #define T_GPOS          ns_t_gpos
217 #define T_AAAA          ns_t_aaaa
218 #define T_LOC           ns_t_loc
219 #define T_NXT           ns_t_nxt
220 #define T_EID           ns_t_eid
221 #define T_NIMLOC        ns_t_nimloc
222 #define T_SRV           ns_t_srv
223 #define T_ATMA          ns_t_atma
224 #define T_NAPTR         ns_t_naptr
225 #define T_TSIG          ns_t_tsig
226 #define T_IXFR          ns_t_ixfr
227 #define T_AXFR          ns_t_axfr
228 #define T_MAILB         ns_t_mailb
229 #define T_MAILA         ns_t_maila
230 #define T_ANY           ns_t_any
231
232 #endif /* ARES_NAMESER_H */