s3-libsmb: Remove use of cli_errstr()
[kai/samba.git] / librpc / idl / dns.idl
1 #include "idl_types.h"
2
3 /*
4    IDL structures for DNS operations
5
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
9 */
10
11 import "misc.idl";
12 [
13         helper("librpc/ndr/ndr_dns.h"),
14         helpstring("DNS records"),
15         version(0.0),
16         uuid("a047c001-5f22-40b0-9d52-7042c43f711a")
17 ]
18 interface dns
19 {
20         const int DNS_SERVICE_PORT       = 53;
21
22         typedef [public,bitmap16bit] bitmap {
23                 DNS_RCODE                   = 0x000F,
24                 DNS_FLAG_BROADCAST          = 0x0010,
25                 DNS_FLAG_RECURSION_AVAIL    = 0x0080,
26                 DNS_FLAG_RECURSION_DESIRED  = 0x0100,
27                 DNS_FLAG_TRUNCATION         = 0x0200,
28                 DNS_FLAG_AUTHORITATIVE      = 0x0400,
29                 DNS_OPCODE                  = 0x7800,
30                 DNS_FLAG_REPLY              = 0x8000
31         } dns_operation;
32
33         /* the opcodes are in the operation field, masked with
34            DNS_OPCODE */
35         typedef [public] enum {
36                 DNS_OPCODE_QUERY          =  (0x0<<11),
37                 DNS_OPCODE_IQUERY         =  (0x1<<11),
38                 DNS_OPCODE_STATUS         =  (0x2<<11),
39                 DNS_OPCODE_REGISTER       =  (0x5<<11),
40                 DNS_OPCODE_RELEASE        =  (0x6<<11),
41                 DNS_OPCODE_WACK           =  (0x7<<11),
42                 DNS_OPCODE_REFRESH        =  (0x8<<11),
43                 DNS_OPCODE_REFRESH2       =  (0x9<<11),
44                 DNS_OPCODE_MULTI_HOME_REG =  (0xf<<11)
45         } dns_opcode;
46
47         /* rcode values */
48         typedef [public] enum {
49                 DNS_RCODE_OK       = 0x0,
50                 DNS_RCODE_FORMERR  = 0x1,
51                 DNS_RCODE_SERVFAIL = 0x2,
52                 DNS_RCODE_NXDOMAIN = 0x3,
53                 DNS_RCODE_NOTIMP   = 0x4,
54                 DNS_RCODE_REFUSED  = 0x5,
55                 DNS_RCODE_YXDOMAIN = 0x6,
56                 DNS_RCODE_YXRRSET  = 0x7,
57                 DNS_RCODE_NXRRSET  = 0x8,
58                 DNS_RCODE_NOTAUTH  = 0x9,
59                 DNS_RCODE_NOTZONE  = 0xA
60         } dns_rcode;
61
62         typedef [public,enum16bit] enum {
63                 DNS_QCLASS_IP   = 0x0001,
64                 DNS_QCLASS_NONE = 0x00FE,
65                 DNS_QCLASS_ANY  = 0x00FF
66         } dns_qclass;
67
68         /* These vese values could have been merged with NBT_QTYPE values, but
69            DNS_QTYPE_SRV and NBT_QTYPE_STATUS have the same numeric value. */
70         typedef [public,enum16bit] enum {
71                 DNS_QTYPE_ZERO   = 0x0000,
72                 DNS_QTYPE_A      = 0x0001,
73                 DNS_QTYPE_NS     = 0x0002,
74                 DNS_QTYPE_MD     = 0x0003,
75                 DNS_QTYPE_MF     = 0x0004,
76                 DNS_QTYPE_CNAME  = 0x0005,
77                 DNS_QTYPE_SOA    = 0x0006,
78                 DNS_QTYPE_MB     = 0x0007,
79                 DNS_QTYPE_MG     = 0x0008,
80                 DNS_QTYPE_MR     = 0x0009,
81                 DNS_QTYPE_NULL   = 0x000A,
82                 DNS_QTYPE_WKS    = 0x000B,
83                 DNS_QTYPE_PTR    = 0x000C,
84                 DNS_QTYPE_HINFO  = 0x000D,
85                 DNS_QTYPE_MINFO  = 0x000E,
86                 DNS_QTYPE_MX     = 0x000F,
87                 DNS_QTYPE_TXT    = 0x0010,
88                 DNS_QTYPE_RP     = 0x0011,
89                 DNS_QTYPE_AFSDB  = 0x0012,
90                 DNS_QTYPE_X25    = 0x0013,
91                 DNS_QTYPE_ISDN   = 0x0014,
92                 DNS_QTYPE_RT     = 0x0015,
93                 DNS_QTYPE_SIG    = 0x0018,
94                 DNS_QTYPE_KEY    = 0x0019,
95                 DNS_QTYPE_AAAA   = 0x001C,
96                 DNS_QTYPE_LOC    = 0x001D,
97                 DNS_QTYPE_NXT    = 0x001E,
98                 DNS_QTYPE_NETBIOS= 0x0020,
99                 DNS_QTYPE_SRV    = 0x0021,
100                 DNS_QTYPE_ATMA   = 0x0022,
101                 DNS_QTYPE_NAPTR  = 0x0023,
102                 DNS_QTYPE_DNAME  = 0x0027,
103                 DNS_QTYPE_DS     = 0x002B,
104                 DNS_QTYPE_RRSIG  = 0x002E,
105                 DNS_QTYPE_NSEC   = 0x002F,
106                 DNS_QTYPE_DNSKEY = 0x0030,
107                 DNS_QTYPE_DHCID  = 0x0031,
108                 DNS_QTYPE_ALL    = 0x00FF,
109                 DNS_QTYPE_WINS   = 0xFF01,
110                 DNS_QTYPE_WINSR  = 0xFF02
111         } dns_qtype;
112
113         typedef [public] struct {
114                 dns_string name;
115                 dns_qtype  question_type;
116                 dns_qclass question_class;
117         } dns_name_question;
118
119         typedef [public] struct {
120                 uint16 length;
121                 uint8  data[length];
122         } dns_rdata_data;
123
124         typedef struct {
125                 dns_string mname;
126                 dns_string rname;
127                 uint32     serial;
128                 uint32     refresh;
129                 uint32     retry;
130                 uint32     expire;
131                 uint32     minimum;
132         } dns_soa_record;
133
134         typedef [public] struct {
135                 uint16     priority;
136                 uint16     weight;
137                 uint16     port;
138                 dns_string target;
139         } dns_srv_record;
140
141         typedef [public] struct {
142                 uint16     preference;
143                 dns_string exchange;
144         } dns_mx_record;
145
146         typedef [nodiscriminant,public,flag(NDR_NOALIGN)] union {
147                 [case(DNS_QTYPE_A)]     ipv4address      ipv4_record;
148                 [case(DNS_QTYPE_NS)]    dns_string       ns_record;
149                 [case(DNS_QTYPE_CNAME)] dns_string       cname_record;
150                 [case(DNS_QTYPE_SOA)]   dns_soa_record   soa_record;
151                 [case(DNS_QTYPE_PTR)]   dns_string       ptr_record;
152                 [case(DNS_QTYPE_MX)]    dns_mx_record    mx_record;
153                 [case(DNS_QTYPE_AAAA)]  ipv6address      ipv6_record;
154                 [case(DNS_QTYPE_SRV)]   dns_srv_record   srv_record;
155                 [default];
156         } dns_rdata;
157
158         typedef [flag(LIBNDR_PRINT_ARRAY_HEX|NDR_NOALIGN),nopush,nopull] struct {
159                 dns_string name;
160                 dns_qtype  rr_type;
161                 dns_qclass rr_class;
162                 uint32     ttl;
163                 uint16     length; /* Should be set to either UINT16_MAX or 0 */
164                 [switch_is(rr_type)] dns_rdata rdata;
165                 DATA_BLOB  unexpected;
166         } dns_res_rec;
167
168         typedef [flag(NDR_NOALIGN|NDR_BIG_ENDIAN|NDR_PAHEX),public] struct {
169                 uint16            id;
170                 dns_operation     operation;
171                 uint16            qdcount;
172                 uint16            ancount;
173                 uint16            nscount;
174                 uint16            arcount;
175                 dns_name_question questions[qdcount];
176                 dns_res_rec       answers[ancount];
177                 dns_res_rec       nsrecs[nscount];
178                 dns_res_rec       additional[arcount];
179         } dns_name_packet;
180
181         /*
182            this is a convenience hook for ndrdump
183         */
184         void decode_dns_name_packet(
185                                     [in] dns_name_packet packet
186                                    );
187 }