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