4 IDL structures for DNS operations
6 DNS is not traditionally encoded using IDL/NDR. This is a bit of an
7 experiment, and I may well switch us back to a more traditional
8 encoding if it doesn't work out
11 import
"misc.idl", "dnsp.idl";
13 helper
("librpc/ndr/ndr_dns.h"),
14 helpstring("DNS records"),
16 uuid("a047c001-5f22-40b0-9d52-7042c43f711a")
20 const int DNS_SERVICE_PORT
= 53;
21 const int DNS_MAX_LABELS
= 127;
22 const int DNS_MAX_DOMAIN_LENGTH
= 253;
23 const int DNS_MAX_LABEL_LENGTH
= 63;
25 typedef [public,bitmap16bit
] bitmap
{
27 DNS_FLAG_BROADCAST
= 0x0010,
28 DNS_FLAG_RECURSION_AVAIL
= 0x0080,
29 DNS_FLAG_RECURSION_DESIRED
= 0x0100,
30 DNS_FLAG_TRUNCATION
= 0x0200,
31 DNS_FLAG_AUTHORITATIVE
= 0x0400,
33 DNS_FLAG_REPLY
= 0x8000
36 /* the opcodes are in the operation field, masked with
38 typedef [public] enum {
39 DNS_OPCODE_QUERY
= (0x0<<11),
40 DNS_OPCODE_IQUERY
= (0x1<<11),
41 DNS_OPCODE_STATUS
= (0x2<<11),
42 DNS_OPCODE_UPDATE
= (0x5<<11),
43 DNS_OPCODE_RELEASE
= (0x6<<11),
44 DNS_OPCODE_WACK
= (0x7<<11),
45 DNS_OPCODE_REFRESH
= (0x8<<11),
46 DNS_OPCODE_REFRESH2
= (0x9<<11),
47 DNS_OPCODE_MULTI_HOME_REG
= (0xf<<11)
51 typedef [public] enum {
53 DNS_RCODE_FORMERR
= 0x01,
54 DNS_RCODE_SERVFAIL
= 0x02,
55 DNS_RCODE_NXDOMAIN
= 0x03,
56 DNS_RCODE_NOTIMP
= 0x04,
57 DNS_RCODE_REFUSED
= 0x05,
58 DNS_RCODE_YXDOMAIN
= 0x06,
59 DNS_RCODE_YXRRSET
= 0x07,
60 DNS_RCODE_NXRRSET
= 0x08,
61 DNS_RCODE_NOTAUTH
= 0x09,
62 DNS_RCODE_NOTZONE
= 0x0A,
63 DNS_RCODE_BADSIG
= 0x10,
64 DNS_RCODE_BADKEY
= 0x11,
65 DNS_RCODE_BADTIME
= 0x12,
66 DNS_RCODE_BADMODE
= 0x13,
67 DNS_RCODE_BADNAME
= 0x14,
68 DNS_RCODE_BADALG
= 0x15
71 typedef [public,enum16bit
] enum {
72 DNS_QCLASS_IN
= 0x0001,
73 DNS_QCLASS_NONE
= 0x00FE,
74 DNS_QCLASS_ANY
= 0x00FF
77 /* These vese values could have been merged with NBT_QTYPE values, but
78 DNS_QTYPE_SRV and NBT_QTYPE_STATUS have the same numeric value. */
79 typedef [public,enum16bit
] enum {
80 DNS_QTYPE_ZERO
= 0x0000,
82 DNS_QTYPE_NS
= 0x0002,
83 DNS_QTYPE_MD
= 0x0003,
84 DNS_QTYPE_MF
= 0x0004,
85 DNS_QTYPE_CNAME
= 0x0005,
86 DNS_QTYPE_SOA
= 0x0006,
87 DNS_QTYPE_MB
= 0x0007,
88 DNS_QTYPE_MG
= 0x0008,
89 DNS_QTYPE_MR
= 0x0009,
90 DNS_QTYPE_NULL
= 0x000A,
91 DNS_QTYPE_WKS
= 0x000B,
92 DNS_QTYPE_PTR
= 0x000C,
93 DNS_QTYPE_HINFO
= 0x000D,
94 DNS_QTYPE_MINFO
= 0x000E,
95 DNS_QTYPE_MX
= 0x000F,
96 DNS_QTYPE_TXT
= 0x0010,
97 DNS_QTYPE_RP
= 0x0011,
98 DNS_QTYPE_AFSDB
= 0x0012,
99 DNS_QTYPE_X25
= 0x0013,
100 DNS_QTYPE_ISDN
= 0x0014,
101 DNS_QTYPE_RT
= 0x0015,
102 DNS_QTYPE_SIG
= 0x0018,
103 DNS_QTYPE_KEY
= 0x0019,
104 DNS_QTYPE_AAAA
= 0x001C,
105 DNS_QTYPE_LOC
= 0x001D,
106 DNS_QTYPE_NXT
= 0x001E,
107 DNS_QTYPE_NETBIOS
= 0x0020,
108 DNS_QTYPE_SRV
= 0x0021,
109 DNS_QTYPE_ATMA
= 0x0022,
110 DNS_QTYPE_NAPTR
= 0x0023,
111 DNS_QTYPE_DNAME
= 0x0027,
112 DNS_QTYPE_OPT
= 0x0029,
113 DNS_QTYPE_DS
= 0x002B,
114 DNS_QTYPE_RRSIG
= 0x002E,
115 DNS_QTYPE_NSEC
= 0x002F,
116 DNS_QTYPE_DNSKEY
= 0x0030,
117 DNS_QTYPE_DHCID
= 0x0031,
118 DNS_QTYPE_TKEY
= 0x00F9,
119 DNS_QTYPE_TSIG
= 0x00FA,
120 DNS_QTYPE_AXFR
= 0x00FC,
121 DNS_QTYPE_MAILB
= 0x00FD,
122 DNS_QTYPE_MAILA
= 0x00FE,
123 DNS_QTYPE_ALL
= 0x00FF
126 typedef [public,enum16bit
] enum {
127 DNS_TKEY_MODE_NULL
= 0x0000,
128 DNS_TKEY_MODE_SERVER
= 0x0001,
129 DNS_TKEY_MODE_DH
= 0x0002,
130 DNS_TKEY_MODE_GSSAPI
= 0x0003,
131 DNS_TKEY_MODE_CLIENT
= 0x0004,
132 DNS_TKEY_MODE_DELETE
= 0x0005,
133 DNS_TKEY_MODE_LAST
= 0xFFFF
136 typedef [public] struct {
138 dns_qtype question_type
;
139 dns_qclass question_class
;
142 typedef [public] struct {
157 typedef [public] struct {
162 typedef [public,nopull
] struct {
163 dnsp_string_list txt
;
166 typedef [public] struct {
172 typedef [public] struct {
179 typedef [public] struct {
181 uint16 option_length
;
182 uint8 option_data
[option_length
];
185 typedef [flag
(NDR_NO_COMP
),public] struct {
186 dns_string algorithm
;
192 uint8 key_data
[key_size
];
194 uint8 other_data
[other_size
];
197 typedef [flag
(NDR_NO_COMP
),public] struct {
198 dns_string algorithm_name
;
199 uint16 time_prefix
; /* 0 until February 2106*/
207 uint8 other_data
[other_size
];
210 typedef [flag
(NDR_NO_COMP|NDR_NOALIGN|NDR_BIG_ENDIAN|NDR_PAHEX
),public] struct {
214 dns_string algorithm_name
;
215 uint16 time_prefix
; /* 0 until February 2106*/
220 uint8 other_data
[other_size
];
223 typedef [nodiscriminant
,public,flag
(NDR_NOALIGN
)] union {
224 [case(DNS_QTYPE_A
)] ipv4address ipv4_record
;
225 [case(DNS_QTYPE_NS
)] dns_string ns_record
;
226 [case(DNS_QTYPE_CNAME
)] dns_string cname_record
;
227 [case(DNS_QTYPE_SOA
)] dns_soa_record soa_record
;
228 [case(DNS_QTYPE_PTR
)] dns_string ptr_record
;
229 [case(DNS_QTYPE_HINFO
)] dnsp_hinfo hinfo_record
;
230 [case(DNS_QTYPE_MX
)] dns_mx_record mx_record
;
231 [case(DNS_QTYPE_TXT
)] dns_txt_record txt_record
;
232 [case(DNS_QTYPE_RP
)] dns_rp_record rp_record
;
233 [case(DNS_QTYPE_AAAA
)] ipv6address ipv6_record
;
234 [case(DNS_QTYPE_SRV
)] dns_srv_record srv_record
;
235 [case(DNS_QTYPE_OPT
)] dns_opt_record opt_record
;
236 [case(DNS_QTYPE_TSIG
)] dns_tsig_record tsig_record
;
237 [case(DNS_QTYPE_TKEY
)] dns_tkey_record tkey_record
;
241 typedef [flag
(LIBNDR_PRINT_ARRAY_HEX|NDR_NOALIGN
),nopush
,nopull
] struct {
246 uint16 length
; /* Should be set to either UINT16_MAX or 0 */
247 [switch_is(rr_type
)] dns_rdata rdata
;
248 DATA_BLOB unexpected
;
251 typedef [flag
(NDR_NOALIGN|NDR_BIG_ENDIAN|NDR_PAHEX
),public] struct {
253 dns_operation operation
;
258 dns_name_question questions
[qdcount
];
259 dns_res_rec answers
[ancount
];
260 dns_res_rec nsrecs
[nscount
];
261 dns_res_rec additional
[arcount
];
265 this is a convenience hook for ndrdump
267 [nopython
] void decode_dns_name_packet
(
268 [in] dns_name_packet packet