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