dns: auto-calculate the wDataLength field in DNS records
[idra/samba.git] / librpc / idl / dnsp.idl
1 #include "idl_types.h"
2
3 /*
4    IDL structures for DNSP structures
5
6    See [MS-DNSP].pdf in MCPP for details
7 */
8
9 import "misc.idl";
10
11 /*
12   note that this is not a real RPC interface. We are just using PIDL
13   to save us a lot of tedious hand parsing of the dnsRecord
14   attribute. The uuid is randomly generated.
15  */
16 [
17   uuid("bdd66e9e-d45f-4202-85c0-6132edc4f30a"),
18   version(0.0),
19   pointer_default(unique),
20   helper("../librpc/ndr/ndr_dnsp.h"),
21   helpstring("DNSP interfaces")
22 ]
23
24 interface dnsp
25 {
26         typedef enum {
27                 DNS_TYPE_ZERO  = 0x0,
28                 DNS_TYPE_A     = 0x1,
29                 DNS_TYPE_NS    = 0x2,
30                 DNS_TYPE_MD    = 0x3,
31                 DNS_TYPE_MF    = 0x4,
32                 DNS_TYPE_CNAME = 0x5,
33                 DNS_TYPE_SOA   = 0x6,
34                 DNS_TYPE_MB    = 0x7,
35                 DNS_TYPE_MG    = 0x8,
36                 DNS_TYPE_MR    = 0x9,
37                 DNS_TYPE_NULL  = 0xA,
38                 DNS_TYPE_WKS   = 0xB,
39                 DNS_TYPE_PTR   = 0xC,
40                 DNS_TYPE_HINFO = 0xD,
41                 DNS_TYPE_MINFO = 0xE,
42                 DNS_TYPE_MX    = 0xF,
43                 DNS_TYPE_TXT   = 0x10,
44                 DNS_TYPE_RP    = 0x11,
45                 DNS_TYPE_AFSDB = 0x12,
46                 DNS_TYPE_X25   = 0x13,
47                 DNS_TYPE_ISDN  = 0x14,
48                 DNS_TYPE_RT    = 0x15,
49                 DNS_TYPE_SIG   = 0x18,
50                 DNS_TYPE_KEY   = 0x19,
51                 DNS_TYPE_AAAA  = 0x1C,
52                 DNS_TYPE_LOC   = 0x1D,
53                 DNS_TYPE_NXT   = 0x1E,
54                 DNS_TYPE_SRV   = 0x21,
55                 DNS_TYPE_ATMA  = 0x22,
56                 DNS_TYPE_NAPTR = 0x23,
57                 DNS_TYPE_DNAME = 0x27,
58                 DNS_TYPE_DS    = 0x2B,
59                 DNS_TYPE_RRSIG = 0x2E,
60                 DNS_TYPE_NSEC  = 0x2F,
61                 DNS_TYPE_DNSKEY= 0x30,
62                 DNS_TYPE_DHCID = 0x31,
63                 DNS_TYPE_ALL   = 0xFF,
64                 DNS_TYPE_WINS  = 0xFF01,
65                 DNS_TYPE_WINSR = 0xFF02
66         } dns_record_type;
67
68         typedef [public] struct {
69                 uint32          serial;
70                 uint32          refresh;
71                 uint32          retry;
72                 uint32          expire;
73                 uint32          minimum;
74                 dnsp_name       mname;
75                 dnsp_name       rname;
76         } dnsp_soa;
77
78         typedef [public] struct {
79                 uint16          wPriority;
80                 dnsp_name       nameTarget;
81         } dnsp_mx;
82
83         typedef [public] struct {
84                 dnsp_string     cpu;
85                 dnsp_string     os;
86         } dnsp_hinfo;
87
88         typedef [public] struct {
89                 uint16          wPriority;
90                 uint16          wWeight;
91                 uint16          wPort;
92                 dnsp_name       nameTarget;
93         } dnsp_srv;
94
95         typedef [nodiscriminant,gensize] union {
96                 [case(DNS_TYPE_A)] [flag(NDR_BIG_ENDIAN)]   ipv4address ipv4;
97                 [case(DNS_TYPE_NS)]                         dnsp_name ns;
98                 [case(DNS_TYPE_CNAME)]                      dnsp_name cname;
99                 [case(DNS_TYPE_SOA)] [flag(NDR_BIG_ENDIAN)] dnsp_soa soa;
100                 [case(DNS_TYPE_MX)] [flag(NDR_BIG_ENDIAN)]  dnsp_mx mx;
101                 [case(DNS_TYPE_TXT)]                        dnsp_string txt;
102                 [case(DNS_TYPE_PTR)]                        dnsp_name ptr;
103                 [case(DNS_TYPE_HINFO)]                      dnsp_hinfo hinfo;
104                 [case(DNS_TYPE_AAAA)]                       ipv6address ipv6;
105                 [case(DNS_TYPE_SRV)] [flag(NDR_BIG_ENDIAN)] dnsp_srv srv;
106                 [default] [flag(NDR_REMAINING)] DATA_BLOB data;
107         } dnsRecordData;
108
109         /* this is the format for the dnsRecord attribute in the DNS
110            partitions in AD */
111         typedef [public] struct {
112                 [value(ndr_size_dnsRecordData(&data,wType,ndr->flags))] uint16 wDataLength;
113                 dns_record_type wType;
114                 uint32          dwFlags;
115                 uint32          dwSerial;
116                 [flag(NDR_BIG_ENDIAN)] uint32   dwTtlSeconds;
117                 uint32          dwTimeStamp;
118                 uint32          dwReserved;
119                 [switch_is(wType)] dnsRecordData data;
120         } dnsp_DnssrvRpcRecord;
121
122
123         /*
124           this is a convenience hook for ndrdump
125          */
126         void decode_DnssrvRpcRecord(
127                 [in] dnsp_DnssrvRpcRecord blob
128                 );
129 }