source: Daodan/MinGW/include/windns.h@ 1163

Last change on this file since 1163 was 1046, checked in by alloc, 8 years ago

Daodan: Added Windows MinGW and build batch file

File size: 10.3 KB
Line 
1#ifndef _WINDNS_H
2#define _WINDNS_H
3#if __GNUC__ >= 3
4#pragma GCC system_header
5#endif
6
7#ifdef __cplusplus
8extern "C" {
9#endif
10
11#define DNS_QUERY_STANDARD 0x0
12#define DNS_QUERY_ACCEPT_TRUNCATED_RESPONSE 0x1
13#define DNS_QUERY_USE_TCP_ONLY 0x2
14#define DNS_QUERY_NO_RECURSION 0x4
15#define DNS_QUERY_BYPASS_CACHE 0x8
16#define DNS_QUERY_NO_WIRE_QUERY 0x10
17#define DNS_QUERY_NO_LOCAL_NAME 0x20
18#define DNS_QUERY_NO_HOSTS_FILE 0x40
19#define DNS_QUERY_NO_NETBT 0x80
20#define DNS_QUERY_TREAT_AS_FQDN 0x1000
21#define DNS_QUERY_WIRE_ONLY 0x100
22#define DNS_QUERY_RETURN_MESSAGE 0x200
23#define DNS_QUERY_DONT_RESET_TTL_VALUES 0x100000
24#define DNS_QUERY_RESERVED 0xff000000
25
26#define DNS_UPDATE_SECURITY_USE_DEFAULT 0x0
27#define DNS_UPDATE_SECURITY_OFF 0x10
28#define DNS_UPDATE_SECURITY_ON 0x20
29#define DNS_UPDATE_SECURITY_ONLY 0x100
30#define DNS_UPDATE_CACHE_SECURITY_CONTEXT 0x200
31#define DNS_UPDATE_TEST_USE_LOCAL_SYS_ACCT 0x400
32#define DNS_UPDATE_FORCE_SECURITY_NEGO 0x800
33#define DNS_UPDATE_RESERVED 0xffff0000
34
35#ifndef RC_INVOKE
36typedef DWORD IP4_ADDRESS;
37typedef DWORD DNS_STATUS;
38enum {
39 DNS_TYPE_A=1,
40 DNS_TYPE_NS,
41 DNS_TYPE_MD,
42 DNS_TYPE_MF,
43 DNS_TYPE_CNAME,
44 DNS_TYPE_SOA,
45 DNS_TYPE_MB,
46 DNS_TYPE_MG,
47 DNS_TYPE_MR,
48 DNS_TYPE_NULL,
49 DNS_TYPE_WKS,
50 DNS_TYPE_PTR,
51 DNS_TYPE_HINFO,
52 DNS_TYPE_MINFO,
53 DNS_TYPE_MX,
54 DNS_TYPE_TEXT,
55 DNS_TYPE_RP,
56 DNS_TYPE_AFSDB,
57 DNS_TYPE_X25,
58 DNS_TYPE_ISDN,
59 DNS_TYPE_RT,
60 DNS_TYPE_NSAP,
61 DNS_TYPE_NSAPPTR,
62 DNS_TYPE_SIG,
63 DNS_TYPE_KEY,
64 DNS_TYPE_PX,
65 DNS_TYPE_GPOS,
66 DNS_TYPE_AAAA,
67 DNS_TYPE_LOC,
68 DNS_TYPE_NXT,
69 DNS_TYPE_EID,
70 DNS_TYPE_NIMLOC,
71 DNS_TYPE_SRV,
72 DNS_TYPE_ATMA,
73 DNS_TYPE_NAPTR,
74 DNS_TYPE_KX,
75 DNS_TYPE_CERT,
76 DNS_TYPE_A6,
77 DNS_TYPE_DNAME,
78 DNS_TYPE_SINK,
79 DNS_TYPE_OPT,
80 DNS_TYPE_UINFO=100,
81 DNS_TYPE_UID,
82 DNS_TYPE_GID,
83 DNS_TYPE_UNSPEC,
84 DNS_TYPE_ADDRS=248,
85 DNS_TYPE_TKEY,
86 DNS_TYPE_TSIG,
87 DNS_TYPE_IXFR,
88 DNS_TYPE_AXFR,
89 DNS_TYPE_MAILB,
90 DNS_TYPE_MAILA,
91 DNS_TYPE_ALL,
92 DNS_TYPE_ANY=DNS_TYPE_ALL
93};
94typedef enum _DNS_CHARSET
95{
96 DnsCharSetUnknown,
97 DnsCharSetUnicode,
98 DnsCharSetUtf8,
99 DnsCharSetAnsi
100} DNS_CHARSET;
101typedef enum
102{
103 DnsConfigPrimaryDomainName_W,
104 DnsConfigPrimaryDomainName_A,
105 DnsConfigPrimaryDomainName_UTF8,
106 DnsConfigAdapterDomainName_W,
107 DnsConfigAdapterDomainName_A,
108 DnsConfigAdapterDomainName_UTF8,
109 DnsConfigDnsServerList,
110 DnsConfigSearchList,
111 DnsConfigAdapterInfo,
112 DnsConfigPrimaryHostNameRegistrationEnabled,
113 DnsConfigAdapterHostNameRegistrationEnabled,
114 DnsConfigAddressRegistrationMaxCount,
115 DnsConfigHostName_W,
116 DnsConfigHostName_A,
117 DnsConfigHostName_UTF8,
118 DnsConfigFullHostName_W,
119 DnsConfigFullHostName_A,
120 DnsConfigFullHostName_UTF8
121} DNS_CONFIG_TYPE;
122typedef enum
123{
124 DnsFreeFlat = 0,
125 DnsFreeRecordList,
126 DnsFreeParsedMessageFields
127} DNS_FREE_TYPE;
128typedef enum _DNS_NAME_FORMAT
129{
130 DnsNameDomain,
131 DnsNameDomainLabel,
132 DnsNameHostnameFull,
133 DnsNameHostnameLabel,
134 DnsNameWildcard,
135 DnsNameSrvRecord
136} DNS_NAME_FORMAT;
137typedef enum
138{
139 DnsSectionQuestion,
140 DnsSectionAnswer,
141 DnsSectionAuthority,
142 DnsSectionAdditional
143} DNS_SECTION;
144typedef struct _IP4_ARRAY {
145 DWORD AddrCount;
146 IP4_ADDRESS AddrArray[1];
147} IP4_ARRAY, *PIP4_ARRAY;
148typedef struct {
149 DWORD IP6Dword[4];
150} IP6_ADDRESS, *PIP6_ADDRESS, DNS_IP6_ADDRESS, *PDNS_IP6_ADDRESS;
151typedef struct _DNS_HEADER {
152 WORD Xid;
153 BYTE RecursionDesired;
154 BYTE Truncation;
155 BYTE Authoritative;
156 BYTE Opcode;
157 BYTE IsResponse;
158 BYTE ResponseCode;
159 BYTE Reserved;
160 BYTE RecursionAvailable;
161 WORD QuestionCount;
162 WORD AnswerCount;
163 WORD NameServerCount;
164 WORD AdditionalCount;
165} DNS_HEADER, *PDNS_HEADER;
166typedef struct _DNS_MESSAGE_BUFFER {
167 DNS_HEADER MessageHead;
168 CHAR MessageBody[1];
169} DNS_MESSAGE_BUFFER, *PDNS_MESSAGE_BUFFER;
170typedef struct _DnsRecordFlags {
171 DWORD Section :2;
172 DWORD Delete :1;
173 DWORD CharSet :2;
174 DWORD Unused :3;
175 DWORD Reserved :24;
176} DNS_RECORD_FLAGS;
177#define DNSREC_QUESTION 0
178#define DNSREC_ANSWER 1
179#define DNSREC_AUTHORITY 2
180#define DNSREC_ADDITIONAL 3
181typedef struct {
182 IP4_ADDRESS IpAddress;
183} DNS_A_DATA, *PDNS_A_DATA;
184typedef struct {
185 DNS_IP6_ADDRESS Ip6Address;
186} DNS_AAAA_DATA, *PDNS_AAAA_DATA;
187#define DNS_ATMA_MAX_ADDR_LENGTH 20
188typedef struct {
189 BYTE AddressType;
190 BYTE Address[DNS_ATMA_MAX_ADDR_LENGTH];
191} DNS_ATMA_DATA, *PDNS_ATMA_DATA;
192typedef struct {
193 WORD wFlags;
194 BYTE chProtocol;
195 BYTE chAlgorithm;
196 BYTE Key[1];
197} DNS_KEY_DATA, *PDNS_KEY_DATA;
198typedef struct {
199 WORD wVersion;
200 WORD wSize;
201 WORD wHorPrec;
202 WORD wVerPrec;
203 DWORD dwLatitude;
204 DWORD dwLongitude;
205 DWORD dwAltitude;
206} DNS_LOC_DATA, *PDNS_LOC_DATA;
207typedef struct {
208 LPTSTR pNameMailbox;
209 LPTSTR pNameErrorsMailbox;
210} DNS_MINFO_DATA, *PDNS_MINFO_DATA;
211typedef struct {
212 LPTSTR pNameExchange;
213 WORD wPreference;
214 WORD Pad;
215} DNS_MX_DATA, *PDNS_MX_DATA;
216typedef struct {
217 DWORD dwByteCount;
218 BYTE Data[1];
219} DNS_NULL_DATA, *PDNS_NULL_DATA;
220typedef struct {
221 LPTSTR pNameNext;
222 WORD wNumTypes;
223 WORD wTypes[1];
224} DNS_NXT_DATA, *PDNS_NXT_DATA;
225typedef struct {
226 LPTSTR pNameHost;
227} DNS_PTR_DATA, *PDNS_PTR_DATA;
228typedef struct {
229 LPTSTR pNameSigner;
230 WORD wTypeCovered;
231 BYTE chAlgorithm;
232 BYTE chLabelCount;
233 DWORD dwOriginalTtl;
234 DWORD dwExpiration;
235 DWORD dwTimeSigned;
236 WORD wKeyTag;
237 WORD Pad;
238 BYTE Signature[1];
239} DNS_SIG_DATA, *PDNS_SIG_DATA;
240typedef struct {
241 LPTSTR pNamePrimaryServer;
242 LPTSTR pNameAdministrator;
243 DWORD dwSerialNo;
244 DWORD dwRefresh;
245 DWORD dwRetry;
246 DWORD dwExpire;
247 DWORD dwDefaultTtl;
248} DNS_SOA_DATA, *PDNS_SOA_DATA;
249typedef struct {
250 LPTSTR pNameTarget;
251 WORD wPriority;
252 WORD wWeight;
253 WORD wPort;
254 WORD Pad;
255} DNS_SRV_DATA, *PDNS_SRV_DATA;
256typedef struct {
257 DWORD dwStringCount;
258 LPTSTR pStringArray[1];
259} DNS_TXT_DATA, *PDNS_TXT_DATA;
260typedef struct {
261 LPTSTR pNameAlgorithm;
262 PBYTE pAlgorithmPacket;
263 PBYTE pKey;
264 PBYTE pOtherData;
265 DWORD dwCreateTime;
266 DWORD dwExpireTime;
267 WORD wMode;
268 WORD wError;
269 WORD wKeyLength;
270 WORD wOtherLength;
271 UCHAR cAlgNameLength;
272 BOOL bPacketPointers;
273} DNS_TKEY_DATA, *PDNS_TKEY_DATA;
274typedef struct {
275 LPTSTR pNameAlgorithm;
276 PBYTE pAlgorithmPacket;
277 PBYTE pSignature;
278 PBYTE pOtherData;
279 LONGLONG i64CreateTime;
280 WORD wFudgeTime;
281 WORD wOriginalXid;
282 WORD wError;
283 WORD wSigLength;
284 WORD wOtherLength;
285 UCHAR cAlgNameLength;
286 BOOL bPacketPointers;
287} DNS_TSIG_DATA, *PDNS_TSIG_DATA;
288typedef struct {
289 DWORD dwMappingFlag;
290 DWORD dwLookupTimeout;
291 DWORD dwCacheTimeout;
292 DWORD cWinsServerCount;
293 IP4_ADDRESS WinsServers[1];
294} DNS_WINS_DATA, *PDNS_WINS_DATA;
295typedef struct {
296 DWORD dwMappingFlag;
297 DWORD dwLookupTimeout;
298 DWORD dwCacheTimeout;
299 LPTSTR pNameResultDomain;
300} DNS_WINSR_DATA, *PDNS_WINSR_DATA;
301typedef struct _DNS_WIRE_QUESTION {
302 WORD QuestionType;
303 WORD QuestionClass;
304} DNS_WIRE_QUESTION, *PDNS_WIRE_QUESTION;
305typedef struct _DNS_WIRE_RECORD {
306 WORD RecordType;
307 WORD RecordClass;
308 DWORD TimeToLive;
309 WORD DataLength;
310} DNS_WIRE_RECORD, *PDNS_WIRE_RECORD;
311typedef struct {
312 IP4_ADDRESS IpAddress;
313 UCHAR chProtocol;
314 BYTE BitMask[1];
315} DNS_WKS_DATA, *PDNS_WKS_DATA;
316typedef struct _DnsRecord {
317 struct _DnsRecord* pNext;
318 LPTSTR pName;
319 WORD wType;
320 WORD wDataLength;
321 union {
322 DWORD DW;
323 DNS_RECORD_FLAGS S;
324 } Flags;
325 DWORD dwTtl;
326 DWORD dwReserved;
327 union {
328 DNS_A_DATA A;
329 DNS_SOA_DATA SOA, Soa;
330 DNS_PTR_DATA PTR, Ptr, NS, Ns, CNAME, Cname, MB, Mb,
331 MD, Md, MF, Mf, MG, Mg, MR, Mr;
332 DNS_MINFO_DATA MINFO, Minfo, RP, Rp;
333 DNS_MX_DATA MX, Mx, AFSDB, Afsdb, RT, Rt;
334 DNS_TXT_DATA HINFO, Hinfo, ISDN, Isdn, TXT, Txt, X25;
335 DNS_NULL_DATA Null;
336 DNS_WKS_DATA WKS, Wks;
337 DNS_AAAA_DATA AAAA;
338 DNS_KEY_DATA KEY, Key;
339 DNS_SIG_DATA SIG, Sig;
340 DNS_ATMA_DATA ATMA, Atma;
341 DNS_NXT_DATA NXT, Nxt;
342 DNS_SRV_DATA SRV, Srv;
343 DNS_TKEY_DATA TKEY, Tkey;
344 DNS_TSIG_DATA TSIG, Tsig;
345 DNS_WINS_DATA WINS, Wins;
346 DNS_WINSR_DATA WINSR, WinsR, NBSTAT, Nbstat;
347 } Data;
348} DNS_RECORD, *PDNS_RECORD;
349typedef struct _DnsRRSet {
350 PDNS_RECORD pFirstRR;
351 PDNS_RECORD pLastRR;
352} DNS_RRSET, *PDNS_RRSET;
353
354DNS_STATUS WINAPI DnsAcquireContextHandle_A(DWORD,PVOID,HANDLE*);
355DNS_STATUS WINAPI DnsAcquireContextHandle_W(DWORD,PVOID,HANDLE*);
356DNS_STATUS WINAPI DnsExtractRecordsFromMessage_W(PDNS_MESSAGE_BUFFER,WORD,PDNS_RECORD*);
357DNS_STATUS WINAPI DnsExtractRecordsFromMessage_UTF8(PDNS_MESSAGE_BUFFER,WORD,PDNS_RECORD*);
358DNS_STATUS WINAPI DnsModifyRecordsInSet_A(PDNS_RECORD,PDNS_RECORD,DWORD,HANDLE,PIP4_ARRAY,PVOID);
359DNS_STATUS WINAPI DnsModifyRecordsInSet_W(PDNS_RECORD,PDNS_RECORD,DWORD,HANDLE,PIP4_ARRAY,PVOID);
360DNS_STATUS WINAPI DnsModifyRecordsInSet_UTF8(PDNS_RECORD,PDNS_RECORD,DWORD,HANDLE,PIP4_ARRAY,PVOID);
361BOOL WINAPI DnsNameCompare_A(LPSTR,LPSTR);
362BOOL WINAPI DnsNameCompare_W(LPWSTR,LPWSTR);
363DNS_STATUS WINAPI DnsQuery_A(PCSTR,WORD,DWORD,PIP4_ARRAY,PDNS_RECORD*,PVOID*);
364DNS_STATUS WINAPI DnsQuery_W(PCWSTR,WORD,DWORD,PIP4_ARRAY,PDNS_RECORD*,PVOID*);
365DNS_STATUS WINAPI DnsQuery_UTF8(PCSTR,WORD,DWORD,PIP4_ARRAY,PDNS_RECORD*,PVOID*);
366DNS_STATUS WINAPI DnsQueryConfig(DNS_CONFIG_TYPE,DWORD,PWSTR,PVOID,PVOID,PDWORD);
367BOOL WINAPI DnsRecordCompare(PDNS_RECORD,PDNS_RECORD);
368PDNS_RECORD WINAPI DnsRecordCopyEx(PDNS_RECORD,DNS_CHARSET,DNS_CHARSET);
369void WINAPI DnsRecordListFree(PDNS_RECORD,DNS_FREE_TYPE);
370BOOL WINAPI DnsRecordSetCompare(PDNS_RECORD,PDNS_RECORD,PDNS_RECORD*,PDNS_RECORD*);
371PDNS_RECORD WINAPI DnsRecordSetCopyEx(PDNS_RECORD,DNS_CHARSET,DNS_CHARSET);
372PDNS_RECORD WINAPI DnsRecordSetDetach(PDNS_RECORD);
373void WINAPI DnsReleaseContextHandle(HANDLE);
374DNS_STATUS WINAPI DnsReplaceRecordSetA(PDNS_RECORD,DWORD,HANDLE,PIP4_ARRAY,PVOID);
375DNS_STATUS WINAPI DnsReplaceRecordSetW(PDNS_RECORD,DWORD,HANDLE,PIP4_ARRAY,PVOID);
376DNS_STATUS WINAPI DnsReplaceRecordSetUTF8(PDNS_RECORD,DWORD,HANDLE,PIP4_ARRAY,PVOID);
377DNS_STATUS WINAPI DnsValidateName_A(LPCSTR,DNS_NAME_FORMAT);
378DNS_STATUS WINAPI DnsValidateName_W(LPCWSTR, DNS_NAME_FORMAT);
379DNS_STATUS WINAPI DnsValidateName_UTF8(LPCSTR,DNS_NAME_FORMAT);
380BOOL WINAPI DnsWriteQuestionToBuffer_W(PDNS_MESSAGE_BUFFER,LPDWORD,LPWSTR,WORD,WORD,BOOL);
381BOOL WINAPI DnsWriteQuestionToBuffer_UTF8(PDNS_MESSAGE_BUFFER,LPDWORD,LPSTR,WORD,WORD,BOOL);
382
383#ifdef UNICODE
384#define DnsAcquireContextHandle DnsAcquireContextHandle_W
385#define DnsModifyRecordsInSet DnsModifyRecordsInSet_W
386#define DnsNameCompare DnsNameCompare_W
387#define DnsQuery DnsQuery_W
388#define DnsReplaceRecordSet DnsReplaceRecordSetW
389#define DnsValidateName DnsValidateName_W
390#else
391#define DnsAcquireContextHandle DnsAcquireContextHandle_A
392#define DnsModifyRecordsInSet DnsModifyRecordsInSet_A
393#define DnsNameCompare DnsNameCompare_A
394#define DnsQuery DnsQuery_A
395#define DnsReplaceRecordSet DnsReplaceRecordSetA
396#define DnsValidateName DnsValidateName_A
397#endif
398
399#endif /* RC_INVOKED */
400
401#ifdef __cplusplus
402}
403#endif
404
405#endif /* _WINDNS_H */
Note: See TracBrowser for help on using the repository browser.