source: Daodan/MSYS2/mingw32/i686-w64-mingw32/include/windns.h@ 1186

Last change on this file since 1186 was 1166, checked in by rossy, 3 years ago

Daodan: Replace MinGW build env with an up-to-date MSYS2 env

File size: 26.8 KB
Line 
1/**
2 * This file has no copyright assigned and is placed in the Public Domain.
3 * This file is part of the mingw-w64 runtime package.
4 * No warranty is given; refer to the file DISCLAIMER.PD within this package.
5 */
6#ifndef _WINDNS_INCLUDED_
7#define _WINDNS_INCLUDED_
8
9#include <_mingw_unicode.h>
10
11#ifdef __cplusplus
12extern "C" {
13#endif
14
15 __MINGW_EXTENSION typedef unsigned __int64 QWORD,*PQWORD;
16 typedef LONG DNS_STATUS,*PDNS_STATUS;
17 typedef DWORD IP4_ADDRESS,*PIP4_ADDRESS;
18
19#define SIZEOF_IP4_ADDRESS (4)
20#define IP4_ADDRESS_STRING_LENGTH (15)
21#define IP4_ADDRESS_STRING_BUFFER_LENGTH (16)
22
23 typedef struct _IP4_ARRAY {
24 DWORD AddrCount;
25 IP4_ADDRESS AddrArray[1];
26 } IP4_ARRAY,*PIP4_ARRAY;
27
28 typedef union {
29#ifdef _WIN64
30 QWORD IP6Qword[2];
31#endif
32 DWORD IP6Dword[4];
33 WORD IP6Word[8];
34 BYTE IP6Byte[16];
35#ifdef IN6_ADDR
36 IN6_ADDR In6;
37#endif
38 } IP6_ADDRESS,*PIP6_ADDRESS;
39
40#undef IP6_ADDRESS_STRING_LENGTH
41#define IP6_ADDRESS_STRING_LENGTH (47)
42#define IP6_ADDRESS_STRING_BUFFER_LENGTH (48)
43
44#define INLINE_WORD_FLIP(out,in) { WORD _in = (in); (out) = (_in << 8) | (_in >> 8); }
45#define INLINE_HTONS(out,in) INLINE_WORD_FLIP(out,in)
46#define INLINE_NTOHS(out,in) INLINE_WORD_FLIP(out,in)
47#define INLINE_DWORD_FLIP(out,in) { DWORD _in = (in); (out) = ((_in << 8) & 0x00ff0000) | (_in << 24) | ((_in >> 8) & 0x0000ff00) | (_in >> 24); }
48#define INLINE_NTOHL(out,in) INLINE_DWORD_FLIP(out,in)
49#define INLINE_HTONL(out,in) INLINE_DWORD_FLIP(out,in)
50#define INLINE_WRITE_FLIPPED_WORD(pout,in) INLINE_WORD_FLIP(*((UNALIGNED WORD *)(pout)),in)
51#define INLINE_WRITE_FLIPPED_DWORD(pout,in) INLINE_DWORD_FLIP(*((UNALIGNED DWORD *)(pout)),in)
52
53#define DNS_PORT_HOST_ORDER (0x0035)
54#define DNS_PORT_NET_ORDER (0x3500)
55#define DNS_RFC_MAX_UDP_PACKET_LENGTH (512)
56#define DNS_MAX_NAME_LENGTH (255)
57#define DNS_MAX_LABEL_LENGTH (63)
58#define DNS_MAX_NAME_BUFFER_LENGTH (256)
59#define DNS_MAX_LABEL_BUFFER_LENGTH (64)
60#define DNS_IP4_REVERSE_DOMAIN_STRING_A ("in-addr.arpa.")
61#define DNS_IP4_REVERSE_DOMAIN_STRING_W (L"in-addr.arpa.")
62#define DNS_MAX_IP4_REVERSE_NAME_LENGTH (IP4_ADDRESS_STRING_LENGTH+1+sizeof(DNS_IP4_REVERSE_DOMAIN_STRING_A))
63#define DNS_MAX_IP4_REVERSE_NAME_BUFFER_LENGTH (DNS_MAX_IP4_REVERSE_NAME_LENGTH + 1)
64#define DNS_IP6_REVERSE_DOMAIN_STRING_A ("ip6.arpa.")
65#define DNS_IP6_REVERSE_DOMAIN_STRING_W (L"ip6.arpa.")
66#define DNS_MAX_IP6_REVERSE_NAME_LENGTH (64+sizeof(DNS_IP6_REVERSE_DOMAIN_STRING_A))
67#define DNS_MAX_IP6_REVERSE_NAME_BUFFER_LENGTH (DNS_MAX_IP6_REVERSE_NAME_LENGTH + 1)
68#define DNS_MAX_REVERSE_NAME_LENGTH DNS_MAX_IP6_REVERSE_NAME_LENGTH
69#define DNS_MAX_REVERSE_NAME_BUFFER_LENGTH DNS_MAX_IP6_REVERSE_NAME_BUFFER_LENGTH
70
71#define DNS_IP4_REVERSE_DOMAIN_STRING __MINGW_NAME_UAW(DNS_IP4_REVERSE_DOMAIN_STRING)
72#define DNS_IP6_REVERSE_DOMAIN_STRING __MINGW_NAME_UAW(DNS_IP6_REVERSE_DOMAIN_STRING)
73
74#define DNS_MAX_TEXT_STRING_LENGTH (255)
75
76#pragma pack(1)
77
78 typedef struct _DNS_HEADER {
79 WORD Xid;
80 BYTE RecursionDesired : 1;
81 BYTE Truncation : 1;
82 BYTE Authoritative : 1;
83 BYTE Opcode : 4;
84 BYTE IsResponse : 1;
85 BYTE ResponseCode : 4;
86 BYTE Reserved : 3;
87 BYTE RecursionAvailable : 1;
88 WORD QuestionCount;
89 WORD AnswerCount;
90 WORD NameServerCount;
91 WORD AdditionalCount;
92 } DNS_HEADER,*PDNS_HEADER;
93
94#define DNS_HEADER_FLAGS(pHead) (*((PWORD)(pHead)+1))
95#define DNS_BYTE_FLIP_HEADER_COUNTS(pHeader) { PDNS_HEADER _head = (pHeader); INLINE_HTONS(_head->Xid,_head->Xid); INLINE_HTONS(_head->QuestionCount,_head->QuestionCount); INLINE_HTONS(_head->AnswerCount,_head->AnswerCount); INLINE_HTONS(_head->NameServerCount,_head->NameServerCount); INLINE_HTONS(_head->AdditionalCount,_head->AdditionalCount); }
96#define DNS_OFFSET_TO_QUESTION_NAME sizeof(DNS_HEADER)
97#define DNS_COMPRESSED_QUESTION_NAME (0xC00C)
98#define DNS_QUESTION_NAME_FROM_HEADER(_pHeader_) ((PCHAR)((PDNS_HEADER)(_pHeader_) + 1))
99#define DNS_ANSWER_FROM_QUESTION(_pQuestion_) ((PCHAR)((PDNS_QUESTION)(_pQuestion_) + 1))
100
101 typedef struct _DNS_WIRE_QUESTION {
102 WORD QuestionType;
103 WORD QuestionClass;
104 } DNS_WIRE_QUESTION,*PDNS_WIRE_QUESTION;
105
106 typedef struct _DNS_WIRE_RECORD {
107 WORD RecordType;
108 WORD RecordClass;
109 DWORD TimeToLive;
110 WORD DataLength;
111 } DNS_WIRE_RECORD,*PDNS_WIRE_RECORD;
112
113#pragma pack()
114
115#define DNS_OPCODE_QUERY 0
116#define DNS_OPCODE_IQUERY 1
117#define DNS_OPCODE_SERVER_STATUS 2
118#define DNS_OPCODE_UNKNOWN 3
119#define DNS_OPCODE_NOTIFY 4
120#define DNS_OPCODE_UPDATE 5
121
122#define DNS_RCODE_NOERROR 0
123#define DNS_RCODE_FORMERR 1
124#define DNS_RCODE_SERVFAIL 2
125#define DNS_RCODE_NXDOMAIN 3
126#define DNS_RCODE_NOTIMPL 4
127#define DNS_RCODE_REFUSED 5
128#define DNS_RCODE_YXDOMAIN 6
129#define DNS_RCODE_YXRRSET 7
130#define DNS_RCODE_NXRRSET 8
131#define DNS_RCODE_NOTAUTH 9
132#define DNS_RCODE_NOTZONE 10
133#define DNS_RCODE_MAX 15
134#define DNS_RCODE_BADVERS 16
135#define DNS_RCODE_BADSIG 16
136#define DNS_RCODE_BADKEY 17
137#define DNS_RCODE_BADTIME 18
138#define DNS_RCODE_NO_ERROR DNS_RCODE_NOERROR
139#define DNS_RCODE_FORMAT_ERROR DNS_RCODE_FORMERR
140#define DNS_RCODE_SERVER_FAILURE DNS_RCODE_SERVFAIL
141#define DNS_RCODE_NAME_ERROR DNS_RCODE_NXDOMAIN
142#define DNS_RCODE_NOT_IMPLEMENTED DNS_RCODE_NOTIMPL
143
144#define DNS_CLASS_INTERNET 0x0001
145#define DNS_CLASS_CSNET 0x0002
146#define DNS_CLASS_CHAOS 0x0003
147#define DNS_CLASS_HESIOD 0x0004
148#define DNS_CLASS_NONE 0x00fe
149#define DNS_CLASS_ALL 0x00ff
150#define DNS_CLASS_ANY 0x00ff
151
152#define DNS_RCLASS_INTERNET 0x0100
153#define DNS_RCLASS_CSNET 0x0200
154#define DNS_RCLASS_CHAOS 0x0300
155#define DNS_RCLASS_HESIOD 0x0400
156#define DNS_RCLASS_NONE 0xfe00
157#define DNS_RCLASS_ALL 0xff00
158#define DNS_RCLASS_ANY 0xff00
159
160#define DNS_TYPE_ZERO 0x0000
161#define DNS_TYPE_A 0x0001
162#define DNS_TYPE_NS 0x0002
163#define DNS_TYPE_MD 0x0003
164#define DNS_TYPE_MF 0x0004
165#define DNS_TYPE_CNAME 0x0005
166#define DNS_TYPE_SOA 0x0006
167#define DNS_TYPE_MB 0x0007
168#define DNS_TYPE_MG 0x0008
169#define DNS_TYPE_MR 0x0009
170#define DNS_TYPE_NULL 0x000a
171#define DNS_TYPE_WKS 0x000b
172#define DNS_TYPE_PTR 0x000c
173#define DNS_TYPE_HINFO 0x000d
174#define DNS_TYPE_MINFO 0x000e
175#define DNS_TYPE_MX 0x000f
176#define DNS_TYPE_TEXT 0x0010
177#define DNS_TYPE_RP 0x0011
178#define DNS_TYPE_AFSDB 0x0012
179#define DNS_TYPE_X25 0x0013
180#define DNS_TYPE_ISDN 0x0014
181#define DNS_TYPE_RT 0x0015
182#define DNS_TYPE_NSAP 0x0016
183#define DNS_TYPE_NSAPPTR 0x0017
184#define DNS_TYPE_SIG 0x0018
185#define DNS_TYPE_KEY 0x0019
186#define DNS_TYPE_PX 0x001a
187#define DNS_TYPE_GPOS 0x001b
188#define DNS_TYPE_AAAA 0x001c
189#define DNS_TYPE_LOC 0x001d
190#define DNS_TYPE_NXT 0x001e
191#define DNS_TYPE_EID 0x001f
192#define DNS_TYPE_NIMLOC 0x0020
193#define DNS_TYPE_SRV 0x0021
194#define DNS_TYPE_ATMA 0x0022
195#define DNS_TYPE_NAPTR 0x0023
196#define DNS_TYPE_KX 0x0024
197#define DNS_TYPE_CERT 0x0025
198#define DNS_TYPE_A6 0x0026
199#define DNS_TYPE_DNAME 0x0027
200#define DNS_TYPE_SINK 0x0028
201#define DNS_TYPE_OPT 0x0029
202#define DNS_TYPE_UINFO 0x0064
203#define DNS_TYPE_UID 0x0065
204#define DNS_TYPE_GID 0x0066
205#define DNS_TYPE_UNSPEC 0x0067
206#define DNS_TYPE_ADDRS 0x00f8
207#define DNS_TYPE_TKEY 0x00f9
208#define DNS_TYPE_TSIG 0x00fa
209#define DNS_TYPE_IXFR 0x00fb
210#define DNS_TYPE_AXFR 0x00fc
211#define DNS_TYPE_MAILB 0x00fd
212#define DNS_TYPE_MAILA 0x00fe
213#define DNS_TYPE_ALL 0x00ff
214#define DNS_TYPE_ANY 0x00ff
215#define DNS_TYPE_WINS 0xff01
216#define DNS_TYPE_WINSR 0xff02
217#define DNS_TYPE_NBSTAT (DNS_TYPE_WINSR)
218
219#define DNS_RTYPE_A 0x0100
220#define DNS_RTYPE_NS 0x0200
221#define DNS_RTYPE_MD 0x0300
222#define DNS_RTYPE_MF 0x0400
223#define DNS_RTYPE_CNAME 0x0500
224#define DNS_RTYPE_SOA 0x0600
225#define DNS_RTYPE_MB 0x0700
226#define DNS_RTYPE_MG 0x0800
227#define DNS_RTYPE_MR 0x0900
228#define DNS_RTYPE_NULL 0x0a00
229#define DNS_RTYPE_WKS 0x0b00
230#define DNS_RTYPE_PTR 0x0c00
231#define DNS_RTYPE_HINFO 0x0d00
232#define DNS_RTYPE_MINFO 0x0e00
233#define DNS_RTYPE_MX 0x0f00
234#define DNS_RTYPE_TEXT 0x1000
235#define DNS_RTYPE_RP 0x1100
236#define DNS_RTYPE_AFSDB 0x1200
237#define DNS_RTYPE_X25 0x1300
238#define DNS_RTYPE_ISDN 0x1400
239#define DNS_RTYPE_RT 0x1500
240#define DNS_RTYPE_NSAP 0x1600
241#define DNS_RTYPE_NSAPPTR 0x1700
242#define DNS_RTYPE_SIG 0x1800
243#define DNS_RTYPE_KEY 0x1900
244#define DNS_RTYPE_PX 0x1a00
245#define DNS_RTYPE_GPOS 0x1b00
246#define DNS_RTYPE_AAAA 0x1c00
247#define DNS_RTYPE_LOC 0x1d00
248#define DNS_RTYPE_NXT 0x1e00
249#define DNS_RTYPE_EID 0x1f00
250#define DNS_RTYPE_NIMLOC 0x2000
251#define DNS_RTYPE_SRV 0x2100
252#define DNS_RTYPE_ATMA 0x2200
253#define DNS_RTYPE_NAPTR 0x2300
254#define DNS_RTYPE_KX 0x2400
255#define DNS_RTYPE_CERT 0x2500
256#define DNS_RTYPE_A6 0x2600
257#define DNS_RTYPE_DNAME 0x2700
258#define DNS_RTYPE_SINK 0x2800
259#define DNS_RTYPE_OPT 0x2900
260#define DNS_RTYPE_UINFO 0x6400
261#define DNS_RTYPE_UID 0x6500
262#define DNS_RTYPE_GID 0x6600
263#define DNS_RTYPE_UNSPEC 0x6700
264#define DNS_RTYPE_TKEY 0xf900
265#define DNS_RTYPE_TSIG 0xfa00
266#define DNS_RTYPE_IXFR 0xfb00
267#define DNS_RTYPE_AXFR 0xfc00
268#define DNS_RTYPE_MAILB 0xfd00
269#define DNS_RTYPE_MAILA 0xfe00
270#define DNS_RTYPE_ALL 0xff00
271#define DNS_RTYPE_ANY 0xff00
272#define DNS_RTYPE_WINS 0x01ff
273#define DNS_RTYPE_WINSR 0x02ff
274
275#ifndef ATMA_E164
276#define DNS_ATMA_FORMAT_E164 1
277#define DNS_ATMA_FORMAT_AESA 2
278#define DNS_ATMA_MAX_ADDR_LENGTH (20)
279#else
280#define DNS_ATMA_FORMAT_E164 ATM_E164
281#define DNS_ATMA_FORMAT_AESA ATM_AESA
282#define DNS_ATMA_MAX_ADDR_LENGTH ATM_ADDR_SIZE
283#endif
284
285#define DNS_ATMA_AESA_ADDR_LENGTH (20)
286#define DNS_ATMA_MAX_RECORD_LENGTH (DNS_ATMA_MAX_ADDR_LENGTH+1)
287
288#define DNSSEC_ALGORITHM_RSAMD5 1
289#define DNSSEC_ALGORITHM_NULL 253
290#define DNSSEC_ALGORITHM_PRIVATE 254
291
292#define DNSSEC_PROTOCOL_NONE 0
293#define DNSSEC_PROTOCOL_TLS 1
294#define DNSSEC_PROTOCOL_EMAIL 2
295#define DNSSEC_PROTOCOL_DNSSEC 3
296#define DNSSEC_PROTOCOL_IPSEC 4
297
298#define DNSSEC_KEY_FLAG_NOAUTH 0x0001
299#define DNSSEC_KEY_FLAG_NOCONF 0x0002
300#define DNSSEC_KEY_FLAG_FLAG2 0x0004
301#define DNSSEC_KEY_FLAG_EXTEND 0x0008
302#define DNSSEC_KEY_FLAG_
303#define DNSSEC_KEY_FLAG_FLAG4 0x0010
304#define DNSSEC_KEY_FLAG_FLAG5 0x0020
305
306#define DNSSEC_KEY_FLAG_USER 0x0000
307#define DNSSEC_KEY_FLAG_ZONE 0x0040
308#define DNSSEC_KEY_FLAG_HOST 0x0080
309#define DNSSEC_KEY_FLAG_NTPE3 0x00c0
310
311#define DNSSEC_KEY_FLAG_FLAG8 0x0100
312#define DNSSEC_KEY_FLAG_FLAG9 0x0200
313#define DNSSEC_KEY_FLAG_FLAG10 0x0400
314#define DNSSEC_KEY_FLAG_FLAG11 0x0800
315
316#define DNSSEC_KEY_FLAG_SIG0 0x0000
317#define DNSSEC_KEY_FLAG_SIG1 0x1000
318#define DNSSEC_KEY_FLAG_SIG2 0x2000
319#define DNSSEC_KEY_FLAG_SIG3 0x3000
320#define DNSSEC_KEY_FLAG_SIG4 0x4000
321#define DNSSEC_KEY_FLAG_SIG5 0x5000
322#define DNSSEC_KEY_FLAG_SIG6 0x6000
323#define DNSSEC_KEY_FLAG_SIG7 0x7000
324#define DNSSEC_KEY_FLAG_SIG8 0x8000
325#define DNSSEC_KEY_FLAG_SIG9 0x9000
326#define DNSSEC_KEY_FLAG_SIG10 0xa000
327#define DNSSEC_KEY_FLAG_SIG11 0xb000
328#define DNSSEC_KEY_FLAG_SIG12 0xc000
329#define DNSSEC_KEY_FLAG_SIG13 0xd000
330#define DNSSEC_KEY_FLAG_SIG14 0xe000
331#define DNSSEC_KEY_FLAG_SIG15 0xf000
332
333#define DNS_TKEY_MODE_SERVER_ASSIGN 1
334#define DNS_TKEY_MODE_DIFFIE_HELLMAN 2
335#define DNS_TKEY_MODE_GSS 3
336#define DNS_TKEY_MODE_RESOLVER_ASSIGN 4
337
338#define DNS_WINS_FLAG_SCOPE (0x80000000)
339#define DNS_WINS_FLAG_LOCAL (0x00010000)
340
341#define IS_WORD_ALIGNED(p) (!((UINT_PTR)(p) & (UINT_PTR)1))
342#define IS_DWORD_ALIGNED(p) (!((UINT_PTR)(p) & (UINT_PTR)3))
343#define IS_QWORD_ALIGNED(p) (!((UINT_PTR)(p) & (UINT_PTR)7))
344
345 typedef enum {
346 DnsConfigPrimaryDomainName_W,DnsConfigPrimaryDomainName_A,DnsConfigPrimaryDomainName_UTF8,DnsConfigAdapterDomainName_W,
347 DnsConfigAdapterDomainName_A,DnsConfigAdapterDomainName_UTF8,DnsConfigDnsServerList,DnsConfigSearchList,
348 DnsConfigAdapterInfo,DnsConfigPrimaryHostNameRegistrationEnabled,DnsConfigAdapterHostNameRegistrationEnabled,DnsConfigAddressRegistrationMaxCount,
349 DnsConfigHostName_W,DnsConfigHostName_A,DnsConfigHostName_UTF8,DnsConfigFullHostName_W,DnsConfigFullHostName_A,DnsConfigFullHostName_UTF8
350 } DNS_CONFIG_TYPE;
351
352#define DNS_CONFIG_FLAG_ALLOC (0x00000001)
353
354 DNS_STATUS WINAPI DnsQueryConfig(DNS_CONFIG_TYPE Config,DWORD Flag,PWSTR pwsAdapterName,PVOID pReserved,PVOID pBuffer,PDWORD pBufferLength);
355
356 typedef struct {
357 IP4_ADDRESS IpAddress;
358 } DNS_A_DATA,*PDNS_A_DATA;
359
360 typedef struct {
361 PWSTR pNameHost;
362 } DNS_PTR_DATAW,*PDNS_PTR_DATAW;
363
364 typedef struct {
365 PSTR pNameHost;
366 } DNS_PTR_DATAA,*PDNS_PTR_DATAA;
367
368 typedef struct {
369 PWSTR pNamePrimaryServer;
370 PWSTR pNameAdministrator;
371 DWORD dwSerialNo;
372 DWORD dwRefresh;
373 DWORD dwRetry;
374 DWORD dwExpire;
375 DWORD dwDefaultTtl;
376 } DNS_SOA_DATAW,*PDNS_SOA_DATAW;
377
378 typedef struct {
379 PSTR pNamePrimaryServer;
380 PSTR pNameAdministrator;
381 DWORD dwSerialNo;
382 DWORD dwRefresh;
383 DWORD dwRetry;
384 DWORD dwExpire;
385 DWORD dwDefaultTtl;
386 } DNS_SOA_DATAA,*PDNS_SOA_DATAA;
387
388 typedef struct {
389 PWSTR pNameMailbox;
390 PWSTR pNameErrorsMailbox;
391 } DNS_MINFO_DATAW,*PDNS_MINFO_DATAW;
392
393 typedef struct {
394 PSTR pNameMailbox;
395 PSTR pNameErrorsMailbox;
396 } DNS_MINFO_DATAA,*PDNS_MINFO_DATAA;
397
398 typedef struct {
399 PWSTR pNameExchange;
400 WORD wPreference;
401 WORD Pad;
402 } DNS_MX_DATAW,*PDNS_MX_DATAW;
403
404 typedef struct {
405 PSTR pNameExchange;
406 WORD wPreference;
407 WORD Pad;
408 } DNS_MX_DATAA,*PDNS_MX_DATAA;
409
410 typedef struct {
411 DWORD dwStringCount;
412 PWSTR pStringArray[1];
413 } DNS_TXT_DATAW,*PDNS_TXT_DATAW;
414
415 typedef struct {
416 DWORD dwStringCount;
417 PSTR pStringArray[1];
418 } DNS_TXT_DATAA,*PDNS_TXT_DATAA;
419
420 typedef struct {
421 DWORD dwByteCount;
422 BYTE Data[1];
423 } DNS_NULL_DATA,*PDNS_NULL_DATA;
424
425 typedef struct {
426 IP4_ADDRESS IpAddress;
427 UCHAR chProtocol;
428 BYTE BitMask[1];
429 } DNS_WKS_DATA,*PDNS_WKS_DATA;
430
431 typedef struct {
432 IP6_ADDRESS Ip6Address;
433 } DNS_AAAA_DATA,*PDNS_AAAA_DATA;
434
435 typedef struct {
436 PWSTR pNameSigner;
437 WORD wTypeCovered;
438 BYTE chAlgorithm;
439 BYTE chLabelCount;
440 DWORD dwOriginalTtl;
441 DWORD dwExpiration;
442 DWORD dwTimeSigned;
443 WORD wKeyTag;
444 WORD Pad;
445 BYTE Signature[1];
446 } DNS_SIG_DATAW,*PDNS_SIG_DATAW;
447
448 typedef struct {
449 PSTR pNameSigner;
450 WORD wTypeCovered;
451 BYTE chAlgorithm;
452 BYTE chLabelCount;
453 DWORD dwOriginalTtl;
454 DWORD dwExpiration;
455 DWORD dwTimeSigned;
456 WORD wKeyTag;
457 WORD Pad;
458 BYTE Signature[1];
459 } DNS_SIG_DATAA,*PDNS_SIG_DATAA;
460
461 typedef struct {
462 WORD wFlags;
463 BYTE chProtocol;
464 BYTE chAlgorithm;
465 BYTE Key[1];
466 } DNS_KEY_DATA,*PDNS_KEY_DATA;
467
468 typedef struct {
469 WORD wVersion;
470 WORD wSize;
471 WORD wHorPrec;
472 WORD wVerPrec;
473 DWORD dwLatitude;
474 DWORD dwLongitude;
475 DWORD dwAltitude;
476 } DNS_LOC_DATA,*PDNS_LOC_DATA;
477
478 typedef struct {
479 PWSTR pNameNext;
480 WORD wNumTypes;
481 WORD wTypes[1];
482 } DNS_NXT_DATAW,*PDNS_NXT_DATAW;
483
484 typedef struct {
485 PSTR pNameNext;
486 WORD wNumTypes;
487 WORD wTypes[1];
488 } DNS_NXT_DATAA,*PDNS_NXT_DATAA;
489
490 typedef struct {
491 PWSTR pNameTarget;
492 WORD wPriority;
493 WORD wWeight;
494 WORD wPort;
495 WORD Pad;
496 } DNS_SRV_DATAW,*PDNS_SRV_DATAW;
497
498 typedef struct {
499 PSTR pNameTarget;
500 WORD wPriority;
501 WORD wWeight;
502 WORD wPort;
503 WORD Pad;
504 } DNS_SRV_DATAA,*PDNS_SRV_DATAA;
505
506 typedef struct {
507 BYTE AddressType;
508 BYTE Address[DNS_ATMA_MAX_ADDR_LENGTH ];
509 } DNS_ATMA_DATA,*PDNS_ATMA_DATA;
510
511 typedef struct {
512 PWSTR pNameAlgorithm;
513 PBYTE pAlgorithmPacket;
514 PBYTE pKey;
515 PBYTE pOtherData;
516 DWORD dwCreateTime;
517 DWORD dwExpireTime;
518 WORD wMode;
519 WORD wError;
520 WORD wKeyLength;
521 WORD wOtherLength;
522 UCHAR cAlgNameLength;
523 WINBOOL bPacketPointers;
524 } DNS_TKEY_DATAW,*PDNS_TKEY_DATAW;
525
526 typedef struct {
527 PSTR pNameAlgorithm;
528 PBYTE pAlgorithmPacket;
529 PBYTE pKey;
530 PBYTE pOtherData;
531 DWORD dwCreateTime;
532 DWORD dwExpireTime;
533 WORD wMode;
534 WORD wError;
535 WORD wKeyLength;
536 WORD wOtherLength;
537 UCHAR cAlgNameLength;
538 WINBOOL bPacketPointers;
539 } DNS_TKEY_DATAA,*PDNS_TKEY_DATAA;
540
541 typedef struct {
542 PWSTR pNameAlgorithm;
543 PBYTE pAlgorithmPacket;
544 PBYTE pSignature;
545 PBYTE pOtherData;
546 LONGLONG i64CreateTime;
547 WORD wFudgeTime;
548 WORD wOriginalXid;
549 WORD wError;
550 WORD wSigLength;
551 WORD wOtherLength;
552 UCHAR cAlgNameLength;
553 WINBOOL bPacketPointers;
554 } DNS_TSIG_DATAW,*PDNS_TSIG_DATAW;
555
556 typedef struct {
557 PSTR pNameAlgorithm;
558 PBYTE pAlgorithmPacket;
559 PBYTE pSignature;
560 PBYTE pOtherData;
561 LONGLONG i64CreateTime;
562 WORD wFudgeTime;
563 WORD wOriginalXid;
564 WORD wError;
565 WORD wSigLength;
566 WORD wOtherLength;
567 UCHAR cAlgNameLength;
568 WINBOOL bPacketPointers;
569 } DNS_TSIG_DATAA,*PDNS_TSIG_DATAA;
570
571 typedef struct {
572 DWORD dwMappingFlag;
573 DWORD dwLookupTimeout;
574 DWORD dwCacheTimeout;
575 DWORD cWinsServerCount;
576 IP4_ADDRESS WinsServers[1];
577 } DNS_WINS_DATA,*PDNS_WINS_DATA;
578
579 typedef struct {
580 DWORD dwMappingFlag;
581 DWORD dwLookupTimeout;
582 DWORD dwCacheTimeout;
583 PWSTR pNameResultDomain;
584 } DNS_WINSR_DATAW,*PDNS_WINSR_DATAW;
585
586 typedef struct {
587 DWORD dwMappingFlag;
588 DWORD dwLookupTimeout;
589 DWORD dwCacheTimeout;
590 PSTR pNameResultDomain;
591 } DNS_WINSR_DATAA,*PDNS_WINSR_DATAA;
592
593 __MINGW_TYPEDEF_AW(DNS_PTR_DATA)
594 __MINGW_TYPEDEF_AW(PDNS_PTR_DATA)
595 __MINGW_TYPEDEF_AW(DNS_SOA_DATA)
596 __MINGW_TYPEDEF_AW(PDNS_SOA_DATA)
597 __MINGW_TYPEDEF_AW(DNS_MINFO_DATA)
598 __MINGW_TYPEDEF_AW(PDNS_MINFO_DATA)
599 __MINGW_TYPEDEF_AW(DNS_MX_DATA)
600 __MINGW_TYPEDEF_AW(PDNS_MX_DATA)
601 __MINGW_TYPEDEF_AW(DNS_TXT_DATA)
602 __MINGW_TYPEDEF_AW(PDNS_TXT_DATA)
603 __MINGW_TYPEDEF_AW(DNS_SIG_DATA)
604 __MINGW_TYPEDEF_AW(PDNS_SIG_DATA)
605 __MINGW_TYPEDEF_AW(DNS_NXT_DATA)
606 __MINGW_TYPEDEF_AW(PDNS_NXT_DATA)
607 __MINGW_TYPEDEF_AW(DNS_SRV_DATA)
608 __MINGW_TYPEDEF_AW(PDNS_SRV_DATA)
609 __MINGW_TYPEDEF_AW(DNS_TKEY_DATA)
610 __MINGW_TYPEDEF_AW(PDNS_TKEY_DATA)
611 __MINGW_TYPEDEF_AW(DNS_TSIG_DATA)
612 __MINGW_TYPEDEF_AW(PDNS_TSIG_DATA)
613 __MINGW_TYPEDEF_AW(DNS_WINSR_DATA)
614 __MINGW_TYPEDEF_AW(PDNS_WINSR_DATA)
615
616#define DNS_TEXT_RECORD_LENGTH(StringCount) (FIELD_OFFSET(DNS_TXT_DATA,pStringArray) + ((StringCount) *sizeof(PCHAR)))
617#define DNS_NULL_RECORD_LENGTH(ByteCount) (FIELD_OFFSET(DNS_NULL_DATA,Data) + (ByteCount))
618#define DNS_WKS_RECORD_LENGTH(ByteCount) (FIELD_OFFSET(DNS_WKS_DATA,BitMask) + (ByteCount))
619#define DNS_WINS_RECORD_LENGTH(IpCount) (FIELD_OFFSET(DNS_WINS_DATA,WinsServers) + ((IpCount) *sizeof(IP4_ADDRESS)))
620
621 typedef struct _DnsRecordFlags {
622 DWORD Section : 2;
623 DWORD Delete : 1;
624 DWORD CharSet : 2;
625 DWORD Unused : 3;
626 DWORD Reserved : 24;
627 } DNS_RECORD_FLAGS;
628
629 typedef enum _DnsSection {
630 DnsSectionQuestion,DnsSectionAnswer,DnsSectionAuthority,DnsSectionAddtional
631 } DNS_SECTION;
632
633#define DnsSectionZone DnsSectionQuestion
634#define DnsSectionPrereq DnsSectionAnswer
635#define DnsSectionUpdate DnsSectionAuthority
636
637#define DNSREC_SECTION (0x00000003)
638#define DNSREC_QUESTION (0x00000000)
639#define DNSREC_ANSWER (0x00000001)
640#define DNSREC_AUTHORITY (0x00000002)
641#define DNSREC_ADDITIONAL (0x00000003)
642
643#define DNSREC_ZONE (0x00000000)
644#define DNSREC_PREREQ (0x00000001)
645#define DNSREC_UPDATE (0x00000002)
646
647#define DNSREC_DELETE (0x00000004)
648#define DNSREC_NOEXIST (0x00000004)
649
650 typedef struct _DnsRecordW {
651 struct _DnsRecordW *pNext;
652 PWSTR pName;
653 WORD wType;
654 WORD wDataLength;
655 union {
656 DWORD DW;
657 DNS_RECORD_FLAGS S;
658 } Flags;
659 DWORD dwTtl;
660 DWORD dwReserved;
661 union {
662 DNS_A_DATA A;
663 DNS_SOA_DATAW SOA,Soa;
664 DNS_PTR_DATAW PTR,Ptr,NS,Ns,CNAME,Cname,MB,Mb,MD,Md,MF,Mf,MG,Mg,MR,Mr;
665 DNS_MINFO_DATAW MINFO,Minfo,RP,Rp;
666 DNS_MX_DATAW MX,Mx,AFSDB,Afsdb,RT,Rt;
667 DNS_TXT_DATAW HINFO,Hinfo,ISDN,Isdn,TXT,Txt,X25;
668 DNS_NULL_DATA Null;
669 DNS_WKS_DATA WKS,Wks;
670 DNS_AAAA_DATA AAAA;
671 DNS_KEY_DATA KEY,Key;
672 DNS_SIG_DATAW SIG,Sig;
673 DNS_ATMA_DATA ATMA,Atma;
674 DNS_NXT_DATAW NXT,Nxt;
675 DNS_SRV_DATAW SRV,Srv;
676 DNS_TKEY_DATAW TKEY,Tkey;
677 DNS_TSIG_DATAW TSIG,Tsig;
678 DNS_WINS_DATA WINS,Wins;
679 DNS_WINSR_DATAW WINSR,WinsR,NBSTAT,Nbstat;
680 } Data;
681 } DNS_RECORDW,*PDNS_RECORDW;
682
683 typedef struct _DnsRecordA {
684 struct _DnsRecordA *pNext;
685 PSTR pName;
686 WORD wType;
687 WORD wDataLength;
688 union {
689 DWORD DW;
690 DNS_RECORD_FLAGS S;
691 } Flags;
692 DWORD dwTtl;
693 DWORD dwReserved;
694 union {
695 DNS_A_DATA A;
696 DNS_SOA_DATAA SOA,Soa;
697 DNS_PTR_DATAA PTR,Ptr,NS,Ns,CNAME,Cname,MB,Mb,MD,Md,MF,Mf,MG,Mg,MR,Mr;
698 DNS_MINFO_DATAA MINFO,Minfo,RP,Rp;
699 DNS_MX_DATAA MX,Mx,AFSDB,Afsdb,RT,Rt;
700 DNS_TXT_DATAA HINFO,Hinfo,ISDN,Isdn,TXT,Txt,X25;
701 DNS_NULL_DATA Null;
702 DNS_WKS_DATA WKS,Wks;
703 DNS_AAAA_DATA AAAA;
704 DNS_KEY_DATA KEY,Key;
705 DNS_SIG_DATAA SIG,Sig;
706 DNS_ATMA_DATA ATMA,Atma;
707 DNS_NXT_DATAA NXT,Nxt;
708 DNS_SRV_DATAA SRV,Srv;
709 DNS_TKEY_DATAA TKEY,Tkey;
710 DNS_TSIG_DATAA TSIG,Tsig;
711 DNS_WINS_DATA WINS,Wins;
712 DNS_WINSR_DATAA WINSR,WinsR,NBSTAT,Nbstat;
713 } Data;
714 } DNS_RECORDA,*PDNS_RECORDA;
715
716#ifdef UNICODE
717 typedef DNS_RECORDW DNS_RECORD, *PDNS_RECORD;
718#else
719 typedef DNS_RECORDA DNS_RECORD, *PDNS_RECORD;
720#endif
721
722#define DNS_RECORD_FIXED_SIZE FIELD_OFFSET(DNS_RECORD,Data)
723#define SIZEOF_DNS_RECORD_HEADER DNS_RECORD_FIXED_SIZE
724
725 typedef struct _DnsRRSet {
726 PDNS_RECORD pFirstRR;
727 PDNS_RECORD pLastRR;
728 } DNS_RRSET,*PDNS_RRSET;
729
730#define DNS_RRSET_INIT(rrset) { PDNS_RRSET _prrset = &(rrset); _prrset->pFirstRR = NULL; _prrset->pLastRR = (PDNS_RECORD) &_prrset->pFirstRR; }
731#define DNS_RRSET_ADD(rrset,pnewRR) { PDNS_RRSET _prrset = &(rrset); PDNS_RECORD _prrnew = (pnewRR); _prrset->pLastRR->pNext = _prrnew; _prrset->pLastRR = _prrnew; }
732#define DNS_RRSET_TERMINATE(rrset) { PDNS_RRSET _prrset = &(rrset); _prrset->pLastRR->pNext = NULL; }
733
734 typedef enum _DNS_CHARSET {
735 DnsCharSetUnknown,DnsCharSetUnicode,DnsCharSetUtf8,DnsCharSetAnsi
736 } DNS_CHARSET;
737
738 PDNS_RECORD WINAPI DnsRecordCopyEx(PDNS_RECORD pRecord,DNS_CHARSET CharSetIn,DNS_CHARSET CharSetOut);
739 PDNS_RECORD WINAPI DnsRecordSetCopyEx(PDNS_RECORD pRecordSet,DNS_CHARSET CharSetIn,DNS_CHARSET CharSetOut);
740
741#if defined(UNICODE)
742#define DnsRecordCopy(pRR) DnsRecordCopyEx((pRR),DnsCharSetUnicode,DnsCharSetUnicode)
743#define DnsRecordSetCopy(pRR) DnsRecordSetCopyEx((pRR),DnsCharSetUnicode,DnsCharSetUnicode)
744#else
745#define DnsRecordCopy(pRR) DnsRecordCopyEx((pRR),DnsCharSetAnsi,DnsCharSetAnsi)
746#define DnsRecordSetCopy(pRR) DnsRecordSetCopyEx((pRR),DnsCharSetAnsi,DnsCharSetAnsi)
747#endif
748
749 WINBOOL WINAPI DnsRecordCompare(PDNS_RECORD pRecord1,PDNS_RECORD pRecord2);
750 WINBOOL WINAPI DnsRecordSetCompare(PDNS_RECORD pRR1,PDNS_RECORD pRR2,PDNS_RECORD *ppDiff1,PDNS_RECORD *ppDiff2);
751 PDNS_RECORD DnsRecordSetDetach(PDNS_RECORD pRecordList);
752
753 typedef enum {
754 DnsFreeFlat = 0,DnsFreeRecordList,DnsFreeParsedMessageFields
755 } DNS_FREE_TYPE;
756
757 VOID WINAPI DnsFree(PVOID pData,DNS_FREE_TYPE FreeType);
758
759#define DnsFreeRecordListDeep DnsFreeRecordList
760
761#if(_WIN32_WINNT >= 0x0501)
762 #define DnsRecordListFree(p,t) DnsFree(p,DnsFreeRecordList)
763#else
764 VOID WINAPI DnsRecordListFree(PDNS_RECORD pRecordList,DNS_FREE_TYPE FreeType);
765#endif /* _WIN32_WINNT >= 0x0501 */
766
767#define DNS_QUERY_STANDARD 0x00000000
768#define DNS_QUERY_ACCEPT_TRUNCATED_RESPONSE 0x00000001
769#define DNS_QUERY_USE_TCP_ONLY 0x00000002
770#define DNS_QUERY_NO_RECURSION 0x00000004
771#define DNS_QUERY_BYPASS_CACHE 0x00000008
772#define DNS_QUERY_NO_WIRE_QUERY 0x00000010
773#define DNS_QUERY_NO_LOCAL_NAME 0x00000020
774#define DNS_QUERY_NO_HOSTS_FILE 0x00000040
775#define DNS_QUERY_NO_NETBT 0x00000080
776#define DNS_QUERY_WIRE_ONLY 0x00000100
777#define DNS_QUERY_RETURN_MESSAGE 0x00000200
778#define DNS_QUERY_MULTICAST_ONLY 0x00000400
779#define DNS_QUERY_NO_MULTICAST 0x00000800
780#define DNS_QUERY_TREAT_AS_FQDN 0x00001000
781#define DNS_QUERY_APPEND_MULTILABEL 0x00800000
782#define DNS_QUERY_DONT_RESET_TTL_VALUES 0x00100000
783#define DNS_QUERY_RESERVED 0xff000000
784#define DNS_QUERY_CACHE_ONLY DNS_QUERY_NO_WIRE_QUERY
785
786 DNS_STATUS WINAPI DnsQuery_A(PCSTR pszName,WORD wType,DWORD Options,PIP4_ARRAY aipServers,PDNS_RECORD *ppQueryResults,PVOID *pReserved);
787 DNS_STATUS WINAPI DnsQuery_UTF8(PCSTR pszName,WORD wType,DWORD Options,PIP4_ARRAY aipServers,PDNS_RECORDA *ppQueryResults,PVOID *pReserved);
788 DNS_STATUS WINAPI DnsQuery_W(PCWSTR pszName,WORD wType,DWORD Options,PIP4_ARRAY aipServers,PDNS_RECORD *ppQueryResults,PVOID *pReserved);
789
790#define DnsQuery __MINGW_NAME_UAW(DnsQuery)
791
792#define DNS_UPDATE_SECURITY_USE_DEFAULT 0x00000000
793#define DNS_UPDATE_SECURITY_OFF 0x00000010
794#define DNS_UPDATE_SECURITY_ON 0x00000020
795#define DNS_UPDATE_SECURITY_ONLY 0x00000100
796#define DNS_UPDATE_CACHE_SECURITY_CONTEXT 0x00000200
797#define DNS_UPDATE_TEST_USE_LOCAL_SYS_ACCT 0x00000400
798#define DNS_UPDATE_FORCE_SECURITY_NEGO 0x00000800
799#define DNS_UPDATE_TRY_ALL_MASTER_SERVERS 0x00001000
800#define DNS_UPDATE_SKIP_NO_UPDATE_ADAPTERS 0x00002000
801#define DNS_UPDATE_REMOTE_SERVER 0x00004000
802#define DNS_UPDATE_RESERVED 0xffff0000
803
804#define DnsAcquireContextHandle __MINGW_NAME_UAW(DnsAcquireContextHandle)
805#define DnsModifyRecordsInSet __MINGW_NAME_UAW(DnsModifyRecordsInSet)
806#define DnsReplaceRecordSet __MINGW_NAME_AW(DnsReplaceRecordSet)
807#define DnsValidateName(p,f) __MINGW_NAME_UAW(DnsValidateName)((p),(f))
808#define DnsNameCompare(n1,n2) __MINGW_NAME_UAW(DnsNameCompare)((n1),(n2))
809
810 DNS_STATUS WINAPI DnsAcquireContextHandle_W(DWORD CredentialFlags,PVOID pCredentials,PHANDLE pContextHandle);
811 DNS_STATUS WINAPI DnsAcquireContextHandle_A(DWORD CredentialFlags,PVOID pCredentials,PHANDLE pContextHandle);
812 VOID WINAPI DnsReleaseContextHandle(HANDLE hContext);
813 DNS_STATUS WINAPI DnsModifyRecordsInSet_W(PDNS_RECORD pAddRecords,PDNS_RECORD pDeleteRecords,DWORD Options,HANDLE hContext,PIP4_ARRAY pServerList,PVOID pReserved);
814 DNS_STATUS WINAPI DnsModifyRecordsInSet_A(PDNS_RECORD pAddRecords,PDNS_RECORD pDeleteRecords,DWORD Options,HANDLE hContext,PIP4_ARRAY pServerList,PVOID pReserved);
815 DNS_STATUS WINAPI DnsModifyRecordsInSet_UTF8(PDNS_RECORDA pAddRecords,PDNS_RECORDA pDeleteRecords,DWORD Options,HANDLE hContext,PIP4_ARRAY pServerList,PVOID pReserved);
816 DNS_STATUS WINAPI DnsReplaceRecordSetW(PDNS_RECORD pNewSet,DWORD Options,HANDLE hContext,PIP4_ARRAY pServerList,PVOID pReserved);
817 DNS_STATUS WINAPI DnsReplaceRecordSetA(PDNS_RECORD pNewSet,DWORD Options,HANDLE hContext,PIP4_ARRAY pServerList,PVOID pReserved);
818 DNS_STATUS WINAPI DnsReplaceRecordSetUTF8(PDNS_RECORDA pNewSet,DWORD Options,HANDLE hContext,PIP4_ARRAY pServerList,PVOID pReserved);
819
820 typedef enum _DNS_NAME_FORMAT {
821 DnsNameDomain,DnsNameDomainLabel,DnsNameHostnameFull,DnsNameHostnameLabel,DnsNameWildcard,DnsNameSrvRecord
822 } DNS_NAME_FORMAT;
823
824 DNS_STATUS DnsValidateName_UTF8(LPCSTR pszName,DNS_NAME_FORMAT Format);
825 DNS_STATUS DnsValidateName_W(LPCWSTR pwszName,DNS_NAME_FORMAT Format);
826 DNS_STATUS DnsValidateName_A(LPCSTR pszName,DNS_NAME_FORMAT Format);
827 WINBOOL WINAPI DnsNameCompare_A(LPSTR pName1,LPSTR pName2);
828 WINBOOL WINAPI DnsNameCompare_W(LPWSTR pName1,LPWSTR pName2);
829
830 typedef struct _DNS_MESSAGE_BUFFER {
831 DNS_HEADER MessageHead;
832 CHAR MessageBody[1];
833 } DNS_MESSAGE_BUFFER,*PDNS_MESSAGE_BUFFER;
834
835 WINBOOL WINAPI DnsWriteQuestionToBuffer_W(PDNS_MESSAGE_BUFFER pDnsBuffer,PDWORD pdwBufferSize,LPWSTR pszName,WORD wType,WORD Xid,WINBOOL fRecursionDesired);
836 WINBOOL WINAPI DnsWriteQuestionToBuffer_UTF8(PDNS_MESSAGE_BUFFER pDnsBuffer,LPDWORD pdwBufferSize,LPSTR pszName,WORD wType,WORD Xid,WINBOOL fRecursionDesired);
837 DNS_STATUS WINAPI DnsExtractRecordsFromMessage_W(PDNS_MESSAGE_BUFFER pDnsBuffer,WORD wMessageLength,PDNS_RECORD *ppRecord);
838 DNS_STATUS WINAPI DnsExtractRecordsFromMessage_UTF8(PDNS_MESSAGE_BUFFER pDnsBuffer,WORD wMessageLength,PDNS_RECORDA *ppRecord);
839
840#ifdef __cplusplus
841}
842#endif
843#endif
Note: See TracBrowser for help on using the repository browser.