94ec5bf1bca585c05c2412023ab61a4c57e56733
[samba.git] / source / librpc / idl / drsuapi.idl
1 #include "idl_types.h"
2
3
4   uuid("e3514235-4b06-11d1-ab04-00c04fc2dcd2"),
5   version(4.0),
6   endpoint("ncacn_np:[\\pipe\\lsass]","ncacn_np:[\\pipe\\protected_storage]", "ncacn_ip_tcp:", "ncalrpc:"),
7   authservice("ldap"),
8   helpstring("Active Directory Replication"),
9   pointer_default(unique),
10   depends(security)
11
12 interface drsuapi
13 {
14         /*****************/
15         /* Function 0x00 */
16         typedef [bitmap32bit] bitmap {
17                 DRSUAPI_SUPPORTED_EXTENSION_BASE                        = 0x00000001,
18                 DRSUAPI_SUPPORTED_EXTENSION_ASYNC_REPLICATION           = 0x00000002,
19                 DRSUAPI_SUPPORTED_EXTENSION_REMOVEAPI                   = 0x00000004,
20                 DRSUAPI_SUPPORTED_EXTENSION_MOVEREQ_V2                  = 0x00000008,
21                 DRSUAPI_SUPPORTED_EXTENSION_GETCHG_COMPRESS             = 0x00000010,
22                 DRSUAPI_SUPPORTED_EXTENSION_DCINFO_V1                   = 0x00000020,
23                 DRSUAPI_SUPPORTED_EXTENSION_RESTORE_USN_OPTIMIZATION    = 0x00000040,
24                 DRSUAPI_SUPPORTED_EXTENSION_00000080                    = 0x00000080,
25                 DRSUAPI_SUPPORTED_EXTENSION_KCC_EXECUTE                 = 0x00000100,
26                 DRSUAPI_SUPPORTED_EXTENSION_ADDENTRY_V2                 = 0x00000200,
27                 DRSUAPI_SUPPORTED_EXTENSION_LINKED_VALUE_REPLICATION    = 0x00000400,
28                 DRSUAPI_SUPPORTED_EXTENSION_DCINFO_V2                   = 0x00000800,
29                 DRSUAPI_SUPPORTED_EXTENSION_INSTANCE_TYPE_NOT_REQ_ON_MOD= 0x00001000,
30                 DRSUAPI_SUPPORTED_EXTENSION_CRYPTO_BIND                 = 0x00002000,
31                 DRSUAPI_SUPPORTED_EXTENSION_GET_REPL_INFO               = 0x00004000,
32                 DRSUAPI_SUPPORTED_EXTENSION_STRONG_ENCRYPTION           = 0x00008000,
33                 DRSUAPI_SUPPORTED_EXTENSION_DCINFO_V01                  = 0x00010000,
34                 DRSUAPI_SUPPORTED_EXTENSION_TRANSITIVE_MEMBERSHIP       = 0x00020000,
35                 DRSUAPI_SUPPORTED_EXTENSION_ADD_SID_HISTORY             = 0x00040000,
36                 DRSUAPI_SUPPORTED_EXTENSION_POST_BETA3                  = 0x00080000,
37                 DRSUAPI_SUPPORTED_EXTENSION_00100000                    = 0x00100000,
38                 DRSUAPI_SUPPORTED_EXTENSION_GET_MEMBERSHIPS2            = 0x00200000,
39                 DRSUAPI_SUPPORTED_EXTENSION_GETCHGREQ_V6                = 0x00400000,
40                 DRSUAPI_SUPPORTED_EXTENSION_NONDOMAIN_NCS               = 0x00800000,
41                 DRSUAPI_SUPPORTED_EXTENSION_GETCHGREQ_V8                = 0x01000000,
42                 DRSUAPI_SUPPORTED_EXTENSION_GETCHGREPLY_V5              = 0x02000000,
43                 DRSUAPI_SUPPORTED_EXTENSION_GETCHGREPLY_V6              = 0x04000000,
44                 /*
45                  * the following 3 have the same value
46                  * repadmin.exe /bind says that
47                  */
48                 DRSUAPI_SUPPORTED_EXTENSION_ADDENTRYREPLY_V3            = 0x08000000,
49                 DRSUAPI_SUPPORTED_EXTENSION_GETCHGREPLY_V7              = 0x08000000,
50                 DRSUAPI_SUPPORTED_EXTENSION_VERIFY_OBJECT               = 0x08000000,
51                 DRSUAPI_SUPPORTED_EXTENSION_XPRESS_COMPRESS             = 0x10000000,
52                 DRSUAPI_SUPPORTED_EXTENSION_20000000                    = 0x20000000,
53                 DRSUAPI_SUPPORTED_EXTENSION_40000000                    = 0x40000000,
54                 DRSUAPI_SUPPORTED_EXTENSION_80000000                    = 0x80000000
55         } drsuapi_SupportedExtensions;
56
57         /* this is used by w2k */
58         typedef struct {
59                 drsuapi_SupportedExtensions supported_extensions;
60                 GUID site_guid;
61                 uint32 u1;
62         } drsuapi_DsBindInfo24;
63
64         /* this is used by w2k3 */
65         typedef struct {
66                 drsuapi_SupportedExtensions supported_extensions;
67                 GUID site_guid;
68                 uint32 u1;
69                 uint32 repl_epoch;
70         } drsuapi_DsBindInfo28;
71
72         typedef struct {
73                 [flag(NDR_REMAINING)] DATA_BLOB info;
74         } drsuapi_DsBindInfoFallBack;
75
76         typedef [nodiscriminant] union {
77                 [case(24)][subcontext(4)] drsuapi_DsBindInfo24 info24;
78                 [case(28)][subcontext(4)] drsuapi_DsBindInfo28 info28;
79                 [default][subcontext(4)] drsuapi_DsBindInfoFallBack FallBack;
80         } drsuapi_DsBindInfo;
81
82         /* the drsuapi_DsBindInfoCtr was this before
83          * typedef [flag(NDR_PAHEX)] struct {
84          *      [range(1,10000)] uint32 length;
85          *      [size_is(length)] uint8 data[];
86          * } drsuapi_DsBindInfo;
87          *
88          * but we don't want the caller to manually decode this blob,
89          * so we're doing it here
90          */
91
92         typedef struct {
93                 [range(1,10000)] uint32 length;
94                 [switch_is(length)] drsuapi_DsBindInfo info;
95         } drsuapi_DsBindInfoCtr;
96
97         /* this is a magic guid you need to pass to DsBind to make drsuapi_DsWriteAccountSpn() work
98          * 
99          * maybe the bind_guid could also be the invocation_id see drsuapi_DsReplicaConnection04
100          */
101         const string DRSUAPI_DS_BIND_GUID = "e24d201a-4fd6-11d1-a3da-0000f875ae0d";
102
103         WERROR drsuapi_DsBind(
104                 [in]        GUID *bind_guid,
105                 [in,out]    drsuapi_DsBindInfoCtr *bind_info,
106                 [out,ref]   policy_handle *bind_handle
107                 );
108
109         /*****************/
110         /* Function 0x01 */
111         WERROR drsuapi_DsUnbind(
112                 [in,out,ref] policy_handle *bind_handle
113                 );
114
115         /*****************/
116         /* Function 0x02 */
117         typedef [gensize] struct {
118                 [value(ndr_size_drsuapi_DsReplicaObjectIdentifier(r, ndr->flags)-4)] uint32 __ndr_size;
119                 /*[value(ndr_length_dom_sid(&r->sid))]*/  uint32 __ndr_size_sid;
120                 GUID guid;
121                 dom_sid28 sid;
122                 [flag(STR_SIZE4|STR_CHARLEN|STR_CONFORMANT)] string dn;
123         } drsuapi_DsReplicaObjectIdentifier;
124
125         typedef [public] bitmap {
126                 DRSUAPI_DS_REPLICA_SYNC_ASYNCHRONOUS_OPERATION  = 0x00000001,
127                 DRSUAPI_DS_REPLICA_SYNC_WRITEABLE               = 0x00000002,
128                 DRSUAPI_DS_REPLICA_SYNC_PERIODIC                = 0x00000004,
129                 DRSUAPI_DS_REPLICA_SYNC_INTERSITE_MESSAGING     = 0x00000008,
130                 DRSUAPI_DS_REPLICA_SYNC_ALL_SOURCES             = 0x00000010,
131                 DRSUAPI_DS_REPLICA_SYNC_FULL                    = 0x00000020,
132                 DRSUAPI_DS_REPLICA_SYNC_URGENT                  = 0x00000040,
133                 DRSUAPI_DS_REPLICA_SYNC_NO_DISCARD              = 0x00000080,
134                 DRSUAPI_DS_REPLICA_SYNC_FORCE                   = 0x00000100,
135                 DRSUAPI_DS_REPLICA_SYNC_ADD_REFERENCE           = 0x00000200,
136                 DRSUAPI_DS_REPLICA_SYNC_NEVER_COMPLETED         = 0x00000400,
137                 DRSUAPI_DS_REPLICA_SYNC_TWO_WAY                 = 0x00000800,
138                 DRSUAPI_DS_REPLICA_SYNC_NEVER_NOTIFY            = 0x00001000,
139                 DRSUAPI_DS_REPLICA_SYNC_INITIAL                 = 0x00002000,
140                 DRSUAPI_DS_REPLICA_SYNC_USE_COMPRESSION         = 0x00004000,
141                 DRSUAPI_DS_REPLICA_SYNC_ABANDONED               = 0x00008000,
142                 DRSUAPI_DS_REPLICA_SYNC_INITIAL_IN_PROGRESS     = 0x00010000,
143                 DRSUAPI_DS_REPLICA_SYNC_PARTIAL_ATTRIBUTE_SET   = 0x00020000,
144                 DRSUAPI_DS_REPLICA_SYNC_REQUEUE                 = 0x00040000,
145                 DRSUAPI_DS_REPLICA_SYNC_NOTIFICATION            = 0x00080000,
146                 DRSUAPI_DS_REPLICA_SYNC_ASYNCHRONOUS_REPLICA    = 0x00100000,
147                 DRSUAPI_DS_REPLICA_SYNC_CRITICAL                = 0x00200000,
148                 DRSUAPI_DS_REPLICA_SYNC_FULL_IN_PROGRESS        = 0x00400000,
149                 DRSUAPI_DS_REPLICA_SYNC_PREEMPTED               = 0x00800000
150         } drsuapi_DsReplicaSyncOptions;
151
152         typedef struct {
153                 drsuapi_DsReplicaObjectIdentifier *naming_context;
154                 GUID guid1;
155                 astring *string1;
156                 drsuapi_DsReplicaSyncOptions options;
157         } drsuapi_DsReplicaSyncRequest1;
158
159         typedef [switch_type(int32)] union {
160                 [case(1)] drsuapi_DsReplicaSyncRequest1 req1;
161         } drsuapi_DsReplicaSyncRequest;
162
163         WERROR drsuapi_DsReplicaSync(
164                 [in,ref] policy_handle *bind_handle,
165                 [in] int32 level,
166                 [in,switch_is(level)] drsuapi_DsReplicaSyncRequest req
167                 );
168
169         /*****************/
170         /* Function 0x03 */
171         typedef [public] struct {
172                 hyper tmp_highest_usn; /* updated after each object update */
173                 hyper reserved_usn;
174                 hyper highest_usn; /* updated after a full replication cycle */
175         } drsuapi_DsReplicaHighWaterMark;
176
177         typedef [public] struct {
178                 GUID source_dsa_invocation_id; /* the 'invocationId' field of the CN=NTDS Settings object */
179                 hyper highest_usn;  /* updated after a full replication cycle */
180         } drsuapi_DsReplicaCoursor;
181
182         typedef struct {
183                 uint32 u1;
184                 uint32 u2;
185                 [range(0,0x100000)] uint32 count;
186                 uint32 u3;
187                 [size_is(count)] drsuapi_DsReplicaCoursor coursors[];
188         } drsuapi_DsReplicaCoursorCtrEx;
189
190         typedef [public] bitmap {
191                 /* the _WRITEABLE flag seems to indicate a replication with all attributes,
192                  * and I'm currently always on error when it's set, but w2k and w2k3 uses it
193                  * in the dc join
194                  * --metze
195                  */
196                 DRSUAPI_DS_REPLICA_NEIGHBOUR_WRITEABLE                          = 0x00000010,
197                 DRSUAPI_DS_REPLICA_NEIGHBOUR_SYNC_ON_STARTUP                    = 0x00000020,
198                 DRSUAPI_DS_REPLICA_NEIGHBOUR_DO_SCHEDULED_SYNCS                 = 0x00000040,
199                 DRSUAPI_DS_REPLICA_NEIGHBOUR_USE_ASYNC_INTERSIDE_TRANSPORT      = 0x00000080,
200                 DRSUAPI_DS_REPLICA_NEIGHBOUR_TWO_WAY_SYNC                       = 0x00000200,
201                 DRSUAPI_DS_REPLICA_NEIGHBOUR_RETURN_OBJECT_PARENTS              = 0x00000800,
202                 DRSUAPI_DS_REPLICA_NEIGHBOUR_FULL_IN_PROGRESS                   = 0x00010000,
203                 DRSUAPI_DS_REPLICA_NEIGHBOUR_FULL_NEXT_PACKET                   = 0x00020000,
204                 DRSUAPI_DS_REPLICA_NEIGHBOUR_NEVER_SYNCED                       = 0x00200000,
205                 DRSUAPI_DS_REPLICA_NEIGHBOUR_PREEMPTED                          = 0x01000000,
206                 DRSUAPI_DS_REPLICA_NEIGHBOUR_IGNORE_CHANGE_NOTIFICATIONS        = 0x04000000,
207                 DRSUAPI_DS_REPLICA_NEIGHBOUR_DISABLE_SCHEDULED_SYNC             = 0x08000000,
208                 /* 
209                  * the following NOTE applies to DsGetNCChangesRequest5:
210                  *  - the data is only compressed when 10 or more objects are replicated
211                  *  - but there could also be a size limit of 35 KBytes or something like that
212                  *  - the reply is DsGetNCChangesCtr2
213                  *  - maybe the same applies to DsGetNCChangesRequest8...
214                  *
215                  *  --metze
216                  */
217                 DRSUAPI_DS_REPLICA_NEIGHBOUR_COMPRESS_CHANGES                   = 0x10000000,
218                 DRSUAPI_DS_REPLICA_NEIGHBOUR_NO_CHANGE_NOTIFICATIONS            = 0x20000000,
219                 DRSUAPI_DS_REPLICA_NEIGHBOUR_PARTIAL_ATTRIBUTE_SET              = 0x40000000
220         } drsuapi_DsReplicaNeighbourFlags;
221
222         typedef struct {
223                 GUID destination_dsa_guid;
224                 GUID source_dsa_guid;
225                 [ref] drsuapi_DsReplicaObjectIdentifier *naming_context;
226                 drsuapi_DsReplicaHighWaterMark highwatermark;
227                 drsuapi_DsReplicaCoursorCtrEx *uptodateness_vector;
228                 drsuapi_DsReplicaNeighbourFlags replica_flags;
229                 uint32 unknown2;
230                 uint32 unknown3;
231                 uint32 unknown4;
232                 hyper h1;
233         } drsuapi_DsGetNCChangesRequest5;
234
235         typedef [flag(NDR_PAHEX)] struct {
236                 [range(0,10000)] uint32 length;
237                 [size_is(length)] uint8 *byte_array[];
238         } drsuapi_DsGetNCChangesRequest_Ctr14;
239
240         typedef struct {
241                 uint32 unknown1;
242                 drsuapi_DsGetNCChangesRequest_Ctr14 data;
243         } drsuapi_DsGetNCChangesRequest_Ctr13;
244
245         typedef struct {
246                 [range(0,0x100000)] uint32 count;
247                 [size_is(count)] drsuapi_DsGetNCChangesRequest_Ctr13 *array[];
248         } drsuapi_DsGetNCChangesRequest_Ctr12;
249
250         typedef struct {
251                 GUID destination_dsa_guid;
252                 GUID source_dsa_guid;
253                 [ref] drsuapi_DsReplicaObjectIdentifier *naming_context;
254                 drsuapi_DsReplicaHighWaterMark highwatermark;
255                 drsuapi_DsReplicaCoursorCtrEx *uptodateness_vector;
256                 drsuapi_DsReplicaNeighbourFlags replica_flags;
257                 uint32 unknown2;
258                 uint32 unknown3;
259                 uint32 unknown4;
260                 hyper h1;
261                 uint32 unique_ptr1;
262                 uint32 unique_ptr2;
263                 drsuapi_DsGetNCChangesRequest_Ctr12 ctr12;
264         } drsuapi_DsGetNCChangesRequest8;
265
266         typedef [switch_type(int32)] union {
267                 [case(5)] drsuapi_DsGetNCChangesRequest5 req5;
268                 [case(8)] drsuapi_DsGetNCChangesRequest8 req8;
269         } drsuapi_DsGetNCChangesRequest;
270
271         typedef [public] struct {
272                 GUID source_dsa_invocation_id; /* the 'invocationId' field of the CN=NTDS Settings object */
273                 hyper highest_usn;  /* updated after a full replication cycle */
274                 NTTIME last_sync_success;
275         } drsuapi_DsReplicaCoursor2;
276
277         typedef struct {
278                 uint32 u1;
279                 uint32 u2;
280                 [range(0,0x100000)] uint32 count;
281                 uint32 u3;
282                 [size_is(count)] drsuapi_DsReplicaCoursor2 coursors[];
283         } drsuapi_DsReplicaCoursor2CtrEx;
284
285         typedef [v1_enum] enum {
286                 DRSUAPI_OBJECTCLASS_top         = 0x00010000,
287                 DRSUAPI_OBJECTCLASS_test        = 0x00000000
288         } drsuapi_DsObjectClassId;
289
290         typedef [v1_enum,public] enum {
291                 DRSUAPI_ATTRIBUTE_objectClass           = 0x00000000,
292                 DRSUAPI_ATTRIBUTE_description           = 0x0000000d,
293                 DRSUAPI_ATTRIBUTE_invocationId          = 0x00020073,
294                 DRSUAPI_ATTRIBUTE_ntSecurityDescriptor  = 0x00020119,
295                 DRSUAPI_ATTRIBUTE_objectSid             = 0x00090092,
296                 DRSUAPI_ATTRIBUTE_objectCategory        = 0x0009030e
297         } drsuapi_DsAttributeId;
298
299         /* Generic DATA_BLOB values */
300         typedef struct {
301                 [range(0,10485760)] uint32 length;
302                 DATA_BLOB *data;
303         } drsuapi_DsAttributeValueDataBlob;
304
305         typedef struct {
306                 [range(0,10485760)] uint32 num_values;
307                 [size_is(num_values)] drsuapi_DsAttributeValueDataBlob *values[];
308         } drsuapi_DsAttributeValueCtrDataBlob;
309
310         /* objectClass values */
311         typedef struct {
312                 [range(0,10485760)] uint32 length;
313                 [subcontext(4)] drsuapi_DsObjectClassId *objectClassId;
314         } drsuapi_DsAttributeValueObjectClassId;
315
316         typedef struct {
317                 [range(0,10485760)] uint32 num_values;
318                 [size_is(num_values)] drsuapi_DsAttributeValueObjectClassId *values[];
319         } drsuapi_DsAttributeValueCtrObjectClassId;
320
321         /* uint32 values */
322         typedef struct {
323                 [range(0,10485760)] uint32 length;
324                 [subcontext(4)] uint32 *value;
325         } drsuapi_DsAttributeValueUINT32;
326
327         typedef struct {
328                 [range(0,10485760)] uint32 num_values;
329                 [size_is(num_values)] drsuapi_DsAttributeValueUINT32 *values[];
330         } drsuapi_DsAttributeValueCtrUINT32;
331
332         /* UnicodeString values */
333         typedef struct {
334                 [range(0,10485760)] uint32 length;
335                 [subcontext(4)] nstring *string;
336         } drsuapi_DsAttributeValueUnicodeString;
337
338         typedef struct {
339                 [range(0,10485760)] uint32 num_values;
340                 [size_is(num_values)] drsuapi_DsAttributeValueUnicodeString *values[];
341         } drsuapi_DsAttributeValueCtrUnicodeString;
342
343         /* DN String values */
344         typedef [gensize] struct {
345                 [value(ndr_size_drsuapi_DsReplicaObjectIdentifier3(r, ndr->flags)-4)] uint32 __ndr_size;
346                 [value(ndr_length_dom_sid(&r->sid))]  uint32 __ndr_size_sid;
347                 GUID guid;
348                 dom_sid28 sid;
349                 [flag(STR_SIZE4|STR_CHARLEN)] string dn;
350         } drsuapi_DsReplicaObjectIdentifier3;
351
352         typedef  struct {
353                 [range(0,10485760)] uint32 length;
354                 [subcontext(4)] drsuapi_DsReplicaObjectIdentifier3 *object;
355         } drsuapi_DsAttributeValueDNString;
356
357         typedef struct {
358                 [range(0,10485760)] uint32 num_values;
359                 [size_is(num_values)] drsuapi_DsAttributeValueDNString *values[];
360         } drsuapi_DsAttributeValueCtrDNString;
361
362         /* GUID values */
363         typedef struct {
364                 [range(0,10485760)] uint32 length;
365                 [subcontext(4)] GUID *guid;
366         } drsuapi_DsAttributeValueGUID;
367
368         typedef struct {
369                 [range(0,10485760)] uint32 num_values;
370                 [size_is(num_values)] drsuapi_DsAttributeValueGUID *values[];
371         } drsuapi_DsAttributeValueCtrGUID;
372
373         /* SID values */
374         typedef struct {
375                 [range(0,10485760)] uint32 length;
376                 [subcontext(4)] dom_sid *sid;
377         } drsuapi_DsAttributeValueSID;
378
379         typedef struct {
380                 [range(0,10485760)] uint32 num_values;
381                 [size_is(num_values)] drsuapi_DsAttributeValueSID *values[];
382         } drsuapi_DsAttributeValueCtrSID;
383
384         /* SecurityDescriptor values */
385         typedef struct {
386                 [range(0,10485760)] uint32 length;
387                 [subcontext(4)] security_descriptor *sd;
388         } drsuapi_DsAttributeValueSecurityDescriptor;
389
390         typedef struct {
391                 [range(0,10485760)] uint32 num_values;
392                 [size_is(num_values)] drsuapi_DsAttributeValueSecurityDescriptor *values[];
393         } drsuapi_DsAttributeValueCtrSecurityDescriptor;
394
395         /* NTTIME_1sec values */
396         typedef struct {
397                 [range(0,10485760)] uint32 length;
398                 [subcontext(4)] NTTIME_1sec *time;
399         } drsuapi_DsAttributeValueNTTIME_1sec;
400
401         typedef struct {
402                 [range(0,10485760)] uint32 num_values;
403                 [size_is(num_values)] drsuapi_DsAttributeValueNTTIME_1sec *values[];
404         } drsuapi_DsAttributeValueCtrNTTIME_1sec;
405
406         typedef [nodiscriminant] union {
407                 [case(DRSUAPI_ATTRIBUTE_objectClass)] drsuapi_DsAttributeValueCtrObjectClassId object_class_id;
408
409                 /* UINT32 */
410                 [case(0x00020001)] drsuapi_DsAttributeValueCtrUINT32 uint32;
411                 [case(0x0002004c)] drsuapi_DsAttributeValueCtrUINT32 uint32;
412                 [case(0x000200a9)] drsuapi_DsAttributeValueCtrUINT32 uint32;
413                 [case(0x00090177)] drsuapi_DsAttributeValueCtrUINT32 uint32;
414                 [case(0x000905b3)] drsuapi_DsAttributeValueCtrUINT32 uint32;
415
416                 /* GUID */
417                 [case(DRSUAPI_ATTRIBUTE_invocationId)] drsuapi_DsAttributeValueCtrGUID guid;
418
419                 /* SID */
420                 [case(DRSUAPI_ATTRIBUTE_objectSid)] drsuapi_DsAttributeValueCtrSID sid;
421
422                 /* SecurityDescriptor */
423                 [case(DRSUAPI_ATTRIBUTE_ntSecurityDescriptor)] drsuapi_DsAttributeValueCtrSecurityDescriptor security_descriptor;
424
425                 /* UnicodeString */
426                 [case(DRSUAPI_ATTRIBUTE_description)]           drsuapi_DsAttributeValueCtrUnicodeString unicode_string;
427                 [case(0x00090001)]                              drsuapi_DsAttributeValueCtrUnicodeString unicode_string;
428                 [case(0x000900dd)]                              drsuapi_DsAttributeValueCtrUnicodeString unicode_string;
429                 [case(0x0009037b)]                              drsuapi_DsAttributeValueCtrUnicodeString unicode_string;
430
431                 /* DN String */
432                 [case(DRSUAPI_ATTRIBUTE_objectCategory)]        drsuapi_DsAttributeValueCtrDNString dn_string;
433                 [case(0x0002000e)]                              drsuapi_DsAttributeValueCtrDNString dn_string;
434                 [case(0x00020024)]                              drsuapi_DsAttributeValueCtrDNString dn_string;
435                 [case(0x00090171)]                              drsuapi_DsAttributeValueCtrDNString dn_string;
436                 [case(0x0009071c)]                              drsuapi_DsAttributeValueCtrDNString dn_string;
437                 [case(0x0009072c)]                              drsuapi_DsAttributeValueCtrDNString dn_string;
438                 [case(0x0009026a)]                              drsuapi_DsAttributeValueCtrDNString dn_string;
439                 [case(0x00090203)]                              drsuapi_DsAttributeValueCtrDNString dn_string;
440
441                 /* NTTIME_1sec */
442                 [case(0x00020002)] drsuapi_DsAttributeValueCtrNTTIME_1sec nttime_1sec;
443
444                 /* the default is the DATA_BLOB */
445                 [default] drsuapi_DsAttributeValueCtrDataBlob data_blob;
446         } drsuapi_DsReplicaAttributeValueCtr;
447
448         typedef [flag(NDR_PAHEX)] struct {
449                 drsuapi_DsAttributeId attid;
450                 [switch_is(attid)] drsuapi_DsReplicaAttributeValueCtr value_ctr;
451         } drsuapi_DsReplicaAttribute;
452
453         typedef struct {
454                 [range(0,1048576)] uint32 num_attributes;
455                 [size_is(num_attributes)]  drsuapi_DsReplicaAttribute *attributes[];
456         } drsuapi_DsReplicaAttributeCtr;
457
458         typedef [public] struct {
459                 drsuapi_DsReplicaObjectIdentifier *identifier;
460                 uint32 unknown1;
461                 drsuapi_DsReplicaAttributeCtr attribute_ctr;
462         } drsuapi_DsReplicaObject;
463
464         typedef struct {
465                 uint32 version;
466                 NTTIME_1sec orginating_time;
467                 GUID orginating_invocation_id;
468                 hyper orginating_usn;
469         } drsuapi_DsReplicaMetaData;
470
471         typedef [public] struct {
472                 [range(0,1048576)] uint32 count;
473                 [size_is(count)] drsuapi_DsReplicaMetaData meta_data[];
474         } drsuapi_DsReplicaMetaDataCtr;
475
476         typedef [noprint] struct {
477                 drsuapi_DsReplicaObjectListItemEx *next_object;
478                 drsuapi_DsReplicaObject object;
479                 uint32 unknown1;
480                 GUID *parent_object_guid;
481                 drsuapi_DsReplicaMetaDataCtr *meta_data_ctr;
482         } drsuapi_DsReplicaObjectListItemEx;
483
484         typedef [gensize] struct {
485                 GUID guid1;
486                 GUID guid2;
487                 drsuapi_DsReplicaObjectIdentifier *naming_context;
488                 drsuapi_DsReplicaHighWaterMark old_highwatermark;
489                 drsuapi_DsReplicaHighWaterMark new_highwatermark;
490                 drsuapi_DsReplicaCoursorCtrEx *uptodateness_vector;
491                 drsuapi_DsGetNCChangesRequest_Ctr12 ctr12;
492                 uint32 unknown1;
493                 uint32 object_count;
494                 /* this +55 is sometimes +56, so I don't know where this comes from... --metze */
495                 [value(ndr_size_drsuapi_DsGetNCChangesCtr1(r,ndr->flags)+55)] uint32 __ndr_size;
496                 drsuapi_DsReplicaObjectListItemEx *first_object;
497                 uint32 unknown4;
498         } drsuapi_DsGetNCChangesCtr1;
499
500         typedef struct {
501                 uint32 decompressed_length;
502                 uint32 compressed_length;
503                 [subcontext(4),subcontext_size(r->compressed_length),compression(NDR_COMPRESSION_MSZIP,compressed_length,decompressed_length)] drsuapi_DsGetNCChangesCtr1 *ctr1;
504         } drsuapi_DsGetNCChangesCompressedInfo;
505
506         typedef struct {
507                 uint32 decompressed_length;
508                 uint32 compressed_length;
509                 [subcontext(4),subcontext_size(r->compressed_length),flag(NDR_REMAINING)] DATA_BLOB *decompressed;
510         } drsuapi_DsGetNCChangesCompressedInfo_Test;
511
512         typedef struct {
513                 drsuapi_DsGetNCChangesCompressedInfo info;
514         } drsuapi_DsGetNCChangesCtr2;
515
516         typedef struct {
517                 GUID guid1;
518                 GUID guid2;
519                 drsuapi_DsReplicaObjectIdentifier *naming_context;
520                 drsuapi_DsReplicaHighWaterMark old_highwatermark;
521                 drsuapi_DsReplicaHighWaterMark new_highwatermark;
522                 drsuapi_DsReplicaCoursor2CtrEx *uptodateness_vector;
523                 drsuapi_DsGetNCChangesRequest_Ctr12 ctr12;
524                 uint32 unknown1;
525                 uint32 unknown2;
526                 uint32 unknown3;
527                 drsuapi_DsReplicaObjectListItemEx *first_object;
528                 uint32 unknown4;
529                 uint32 unknown5;
530                 uint32 unknown6;
531                 uint32 len1;
532                 uint32 array_ptr1;
533                 uint32 unknown7;
534         } drsuapi_DsGetNCChangesCtr6;
535
536         typedef struct {
537                 uint32 unknown1;
538                 uint16 unknown2; /* enum */
539                 drsuapi_DsGetNCChangesCompressedInfo_Test info;
540         } drsuapi_DsGetNCChangesCtr7;
541
542         typedef [switch_type(int32)] union {
543                 [case(1)] drsuapi_DsGetNCChangesCtr1 ctr1;
544                 [case(2)] drsuapi_DsGetNCChangesCtr2 ctr2;
545                 [case(6)] drsuapi_DsGetNCChangesCtr6 ctr6;
546                 [case(7)] drsuapi_DsGetNCChangesCtr7 ctr7;
547         } drsuapi_DsGetNCChangesCtr;
548
549         WERROR drsuapi_DsGetNCChanges(
550                 [in,ref] policy_handle *bind_handle,
551                 [in,out] int32 level,
552                 [in,switch_is(level)] drsuapi_DsGetNCChangesRequest req,
553                 [out,switch_is(level)] drsuapi_DsGetNCChangesCtr ctr
554                 );
555
556         /*****************/
557         /* Function 0x04 */
558         typedef bitmap {
559                 DRSUAPI_DS_REPLICA_UPDATE_ASYNCHRONOUS_OPERATION        = 0x00000001,
560                 DRSUAPI_DS_REPLICA_UPDATE_WRITEABLE                     = 0x00000002,
561                 DRSUAPI_DS_REPLICA_UPDATE_ADD_REFERENCE                 = 0x00000004,
562                 DRSUAPI_DS_REPLICA_UPDATE_DELETE_REFERENCE              = 0x00000008,
563                 DRSUAPI_DS_REPLICA_UPDATE_0x00000010                    = 0x00000010
564         } drsuapi_DsReplicaUpdateRefsOptions;
565
566         typedef struct {
567                 [ref] drsuapi_DsReplicaObjectIdentifier *naming_context;
568                 [ref] ascstr *dest_dsa_dns_name;
569                 GUID dest_dsa_guid;
570                 drsuapi_DsReplicaUpdateRefsOptions options;
571         } drsuapi_DsReplicaUpdateRefsRequest1;
572
573         typedef [switch_type(int32)] union {
574                 [case(1)] drsuapi_DsReplicaUpdateRefsRequest1 req1;
575         } drsuapi_DsReplicaUpdateRefsRequest;
576
577         WERROR drsuapi_DsReplicaUpdateRefs(
578                 [in,ref] policy_handle *bind_handle,
579                 [in] int32 level,
580                 [in,switch_is(level)] drsuapi_DsReplicaUpdateRefsRequest req
581                 );
582
583         /*****************/
584         /* Function 0x05 */
585         typedef bitmap {
586                 DRSUAPI_DS_REPLICA_ADD_ASYNCHRONOUS_OPERATION   = 0x00000001,
587                 DRSUAPI_DS_REPLICA_ADD_WRITEABLE                = 0x00000002
588                 /* TODO ... */
589         } drsuapi_DsReplicaAddOptions;
590
591         WERROR DRSUAPI_REPLICA_ADD();
592
593         /*****************/
594         /* Function 0x06 */
595         typedef bitmap {
596                 DRSUAPI_DS_REPLICA_DELETE_ASYNCHRONOUS_OPERATION        = 0x00000001,
597                 DRSUAPI_DS_REPLICA_DELETE_WRITEABLE                     = 0x00000002
598                 /* TODO ... */
599         } drsuapi_DsReplicaDeleteOptions;
600
601         WERROR DRSUAPI_REPLICA_DEL();
602
603         /*****************/
604         /* Function 0x07 */
605         typedef bitmap {
606                 DRSUAPI_DS_REPLICA_MODIFY_ASYNCHRONOUS_OPERATION        = 0x00000001,
607                 DRSUAPI_DS_REPLICA_MODIFY_WRITEABLE                     = 0x00000002
608         } drsuapi_DsReplicaModifyOptions;
609
610         WERROR DRSUAPI_REPLICA_MODIFY();
611
612         /*****************/
613         /* Function 0x08 */
614         WERROR DRSUAPI_VERIFY_NAMES();
615
616         /*****************/
617         /* Function 0x09 */
618         WERROR DRSUAPI_GET_MEMBERSHIPS();
619
620         /*****************/
621         /* Function 0x0a */
622         WERROR DRSUAPI_INTER_DOMAIN_MOVE();
623
624         /*****************/
625         /* Function 0x0b */
626         WERROR DRSUAPI_GET_NT4_CHANGELOG();
627
628         /*****************/
629         /* Function 0x0c */
630         typedef [v1_enum] enum {
631                 DRSUAPI_DS_NAME_STATUS_OK                       = 0,
632                 DRSUAPI_DS_NAME_STATUS_RESOLVE_ERROR            = 1,
633                 DRSUAPI_DS_NAME_STATUS_NOT_FOUND                = 2,
634                 DRSUAPI_DS_NAME_STATUS_NOT_UNIQUE               = 3,
635                 DRSUAPI_DS_NAME_STATUS_NO_MAPPING               = 4,
636                 DRSUAPI_DS_NAME_STATUS_DOMAIN_ONLY              = 5,
637                 DRSUAPI_DS_NAME_STATUS_NO_SYNTACTICAL_MAPPING   = 6,
638                 DRSUAPI_DS_NAME_STATUS_TRUST_REFERRAL           = 7
639         } drsuapi_DsNameStatus;
640
641         typedef [v1_enum] enum {
642                 DRSUAPI_DS_NAME_FLAG_NO_FLAGS                   = 0x0,
643                 DRSUAPI_DS_NAME_FLAG_SYNTACTICAL_ONLY           = 0x1,
644                 DRSUAPI_DS_NAME_FLAG_EVAL_AT_DC                 = 0x2,
645                 DRSUAPI_DS_NAME_FLAG_GCVERIFY                   = 0x4,
646                 DRSUAPI_DS_NAME_FLAG_TRUST_REFERRAL             = 0x8
647         } drsuapi_DsNameFlags;
648
649         typedef [v1_enum] enum {
650                 DRSUAPI_DS_NAME_FORMAT_UKNOWN                   = 0,
651                 DRSUAPI_DS_NAME_FORMAT_FQDN_1779                = 1,
652                 DRSUAPI_DS_NAME_FORMAT_NT4_ACCOUNT              = 2,
653                 DRSUAPI_DS_NAME_FORMAT_DISPLAY                  = 3,
654                 DRSUAPI_DS_NAME_FORMAT_GUID                     = 6,
655                 DRSUAPI_DS_NAME_FORMAT_CANONICAL                = 7,
656                 DRSUAPI_DS_NAME_FORMAT_USER_PRINCIPAL           = 8,
657                 DRSUAPI_DS_NAME_FORMAT_CANONICAL_EX             = 9,
658                 DRSUAPI_DS_NAME_FORMAT_SERVICE_PRINCIPAL        = 10,
659                 DRSUAPI_DS_NAME_FORMAT_SID_OR_SID_HISTORY       = 11,
660                 DRSUAPI_DS_NAME_FORMAT_DNS_DOMAIN               = 12
661         } drsuapi_DsNameFormat;
662
663         typedef struct {
664                 unistr *str;
665         } drsuapi_DsNameString;
666
667         typedef struct {
668                 uint32 unknown1; /* 0x000004e4 */
669                 uint32 unknown2; /* 0x00000407 */
670                 drsuapi_DsNameFlags format_flags;
671                 drsuapi_DsNameFormat format_offered;
672                 drsuapi_DsNameFormat format_desired;
673                 [range(1,10000)] uint32 count;
674                 [size_is(count)] drsuapi_DsNameString *names[];
675         } drsuapi_DsNameRequest1;
676
677         typedef [switch_type(int32)] union {
678                 [case(1)] drsuapi_DsNameRequest1 req1;
679         } drsuapi_DsNameRequest;
680
681         typedef struct {
682                 drsuapi_DsNameStatus status;
683                 unistr *dns_domain_name;
684                 unistr *result_name;
685         } drsuapi_DsNameInfo1;
686
687         typedef struct {
688                 uint32 count;
689                 [size_is(count)] drsuapi_DsNameInfo1 *array[];
690         } drsuapi_DsNameCtr1;
691
692         typedef [switch_type(int32)] union {
693                 [case(1)] drsuapi_DsNameCtr1 *ctr1;
694         } drsuapi_DsNameCtr;
695
696         WERROR drsuapi_DsCrackNames(
697                 [in,ref] policy_handle *bind_handle,
698                 [in, out] int32 level,
699                 [in,switch_is(level)] drsuapi_DsNameRequest req,
700                 [out,switch_is(level)] drsuapi_DsNameCtr ctr
701                 );
702
703         /*****************/
704         /* Function 0x0d */
705         typedef [v1_enum] enum {
706                 DRSUAPI_DS_SPN_OPERATION_ADD    = 0,
707                 DRSUAPI_DS_SPN_OPERATION_REPLACE= 1,
708                 DRSUAPI_DS_SPN_OPERATION_DELETE = 2
709         } drsuapi_DsSpnOperation;
710
711         typedef struct {
712                 drsuapi_DsSpnOperation operation;
713                 uint32 unknown1;
714                 unistr *object_dn;
715                 [range(0,10000)] uint32 count;
716                 [size_is(count)] drsuapi_DsNameString *spn_names[];
717         } drsuapi_DsWriteAccountSpnRequest1;
718
719         typedef [switch_type(int32)] union {
720                 [case(1)] drsuapi_DsWriteAccountSpnRequest1 req1;
721         } drsuapi_DsWriteAccountSpnRequest;
722
723         typedef struct {
724                 WERROR status;
725         } drsuapi_DsWriteAccountSpnResult1;
726
727         typedef [switch_type(int32)] union {
728                 [case(1)] drsuapi_DsWriteAccountSpnResult1 res1;
729         } drsuapi_DsWriteAccountSpnResult;
730
731         WERROR drsuapi_DsWriteAccountSpn(
732                 [in,ref] policy_handle *bind_handle,
733                 [in, out] int32 level,
734                 [in,switch_is(level)] drsuapi_DsWriteAccountSpnRequest req,
735                 [out,switch_is(level)] drsuapi_DsWriteAccountSpnResult res
736                 );
737
738         /*****************/
739         /* Function 0x0e */
740         WERROR DRSUAPI_REMOVE_DS_SERVER();
741
742         /*****************/
743         /* Function 0x0f */
744         WERROR DRSUAPI_REMOVE_DS_DOMAIN();
745
746         /*****************/
747         /* Function 0x10 */
748         typedef struct {
749                 unistr *domain_name; /* netbios or dns */
750                 int32 level; /* specifies the switch level for the request */
751         } drsuapi_DsGetDCInfoRequest1;
752
753         typedef [switch_type(int32)] union {
754                 [case(1)] drsuapi_DsGetDCInfoRequest1 req1;
755         } drsuapi_DsGetDCInfoRequest;
756
757         typedef struct {
758                 unistr *netbios_name;
759                 unistr *dns_name;
760                 unistr *site_name;
761                 unistr *computer_dn;
762                 unistr *server_dn;
763                 uint32 is_pdc;
764                 uint32 is_enabled;
765         } drsuapi_DsGetDCInfo1;
766
767         typedef struct {
768                 [range(0,10000)] uint32 count;
769                 [size_is(count)] drsuapi_DsGetDCInfo1 *array[];
770         } drsuapi_DsGetDCInfoCtr1;
771
772         typedef struct {
773                 unistr *netbios_name;
774                 unistr *dns_name;
775                 unistr *site_name;
776                 unistr *site_dn;
777                 unistr *computer_dn;
778                 unistr *server_dn;
779                 unistr *ntds_dn;
780                 uint32 is_pdc;
781                 uint32 is_enabled;
782                 uint32 is_gc;
783                 GUID site_guid;
784                 GUID computer_guid;
785                 GUID server_guid;
786                 GUID ntds_guid;
787         } drsuapi_DsGetDCInfo2;
788
789         typedef struct {
790                 [range(0,10000)] uint32 count;
791                 [size_is(count)] drsuapi_DsGetDCInfo2 *array[];
792         } drsuapi_DsGetDCInfoCtr2;
793
794         typedef struct {
795                 uint32 unknown1;
796                 uint32 unknown2;
797                 uint32 unknown3;
798                 uint32 unknown4;
799                 uint32 unknown5;
800                 uint32 unknown6;
801                 unistr *server_nt4_account;
802         } drsuapi_DsGetDCInfo01;
803
804         typedef struct {
805                 [range(0,10000)] uint32 count;
806                 [size_is(count)] drsuapi_DsGetDCInfo01 *array[];
807         } drsuapi_DsGetDCInfoCtr01;
808
809         typedef [v1_enum] enum {
810                 DRSUAPI_DC_INFO_CTR_1  = 1,
811                 DRSUAPI_DC_INFO_CTR_2  = 2,
812                 DRSUAPI_DC_INFO_CTR_01 = -1
813         } drsuapi_DsGetDCInfoCtrLevels;
814
815         typedef [switch_type(int32)] union {
816                 [case(DRSUAPI_DC_INFO_CTR_1)]  drsuapi_DsGetDCInfoCtr1  ctr1;
817                 [case(DRSUAPI_DC_INFO_CTR_2)]  drsuapi_DsGetDCInfoCtr2  ctr2;
818                 [case(DRSUAPI_DC_INFO_CTR_01)] drsuapi_DsGetDCInfoCtr01 ctr01;
819         } drsuapi_DsGetDCInfoCtr;
820
821         WERROR drsuapi_DsGetDomainControllerInfo(
822                 [in,ref] policy_handle *bind_handle,
823                 [in, out] int32 level,
824                 [in,switch_is(level)] drsuapi_DsGetDCInfoRequest req,
825                 [out,switch_is(level)] drsuapi_DsGetDCInfoCtr ctr
826                 );
827
828         /*****************/
829         /* Function 0x11 */
830         typedef [noprint] struct {
831                 drsuapi_DsReplicaObjectListItem *next_object;
832                 drsuapi_DsReplicaObject object;
833         } drsuapi_DsReplicaObjectListItem;
834
835         typedef struct {
836                 drsuapi_DsReplicaObjectListItem first_object;
837         } drsuapi_DsAddEntryRequest2;
838
839         typedef [switch_type(int32)] union {
840                 [case(2)] drsuapi_DsAddEntryRequest2 req2;
841         } drsuapi_DsAddEntryRequest;
842
843         typedef struct {
844                 uint32 unknown1;
845                 uint32 unknown2;
846                 uint32 unknown3;
847         } drsuapi_DsAddEntryCtr3Info1;
848
849         typedef [switch_type(uint32)] union {
850                 [case(1)] drsuapi_DsAddEntryCtr3Info1 info1;
851         } drsuapi_DsAddEntryCtr3Info;
852
853         typedef struct {
854                 GUID guid;
855                 dom_sid28 sid;
856         } drsuapi_DsReplicaObjectIdentifier2;
857
858         typedef struct {
859                 drsuapi_DsReplicaObjectIdentifier *id;
860                 uint32 level;
861                 [switch_is(level)] drsuapi_DsAddEntryCtr3Info *info;
862                 [range(0,10000)] uint32 count;
863                 [size_is(count)] drsuapi_DsReplicaObjectIdentifier2 *objects[];
864         } drsuapi_DsAddEntryCtr3;
865
866         typedef [switch_type(int32)] union {
867                 [case(3)] drsuapi_DsAddEntryCtr3 ctr3;
868         } drsuapi_DsAddEntryCtr;
869
870         WERROR drsuapi_DsAddEntry(
871                 [in,ref] policy_handle *bind_handle,
872                 [in,out] int32 level,
873                 [in,switch_is(level)] drsuapi_DsAddEntryRequest req,
874                 [out,switch_is(level)] drsuapi_DsAddEntryCtr ctr
875                 );
876
877         /*****************/
878         /* Function 0x12 */
879         WERROR DRSUAPI_EXECUTE_KCC();
880
881         /*****************/
882         /* Function 0x13 */
883         typedef [v1_enum] enum {
884                 DRSUAPI_DS_REPLICA_GET_INFO                             = 1,
885                 DRSUAPI_DS_REPLICA_GET_INFO2                            = 2
886         } drsuapi_DsReplicaGetInfoLevel;
887
888         typedef [v1_enum] enum {
889                 DRSUAPI_DS_REPLICA_INFO_NEIGHBORS                       = 0,
890                 DRSUAPI_DS_REPLICA_INFO_CURSORS                         = 1,
891                 DRSUAPI_DS_REPLICA_INFO_OBJ_METADATA                    = 2,
892                 DRSUAPI_DS_REPLICA_INFO_KCC_DSA_CONNECT_FAILURES        = 3,
893                 DRSUAPI_DS_REPLICA_INFO_KCC_DSA_LINK_FAILURES           = 4,
894                 DRSUAPI_DS_REPLICA_INFO_PENDING_OPS                     = 5,
895                 DRSUAPI_DS_REPLICA_INFO_ATTRIBUTE_VALUE_METADATA        = 6,
896                 DRSUAPI_DS_REPLICA_INFO_CURSORS2                        = 7,
897                 DRSUAPI_DS_REPLICA_INFO_CURSORS3                        = 8,
898                 DRSUAPI_DS_REPLICA_INFO_OBJ_METADATA2                   = 9,
899                 DRSUAPI_DS_REPLICA_INFO_ATTRIBUTE_VALUE_METADATA2       = 10,
900                 DRSUAPI_DS_REPLICA_INFO_NEIGHBORS02                     = -2,
901                 DRSUAPI_DS_REPLICA_INFO_CONNECTIONS04                   = -4,
902                 DRSUAPI_DS_REPLICA_INFO_CURSURS05                       = -5,
903                 DRSUAPI_DS_REPLICA_INFO_06                              = -6
904         } drsuapi_DsReplicaInfoType;
905
906         typedef struct {
907                 drsuapi_DsReplicaInfoType info_type;
908                 unistr *object_dn;
909                 GUID guid1;
910         } drsuapi_DsReplicaGetInfoRequest1;
911
912         typedef struct {
913                 drsuapi_DsReplicaInfoType info_type;
914                 unistr *object_dn;
915                 GUID guid1;
916                 uint32 unknown1;
917                 unistr *string1;
918                 unistr *string2;
919                 uint32 unknown2;
920         } drsuapi_DsReplicaGetInfoRequest2;
921
922         typedef [switch_type(drsuapi_DsReplicaGetInfoLevel)] union {
923                 [case(DRSUAPI_DS_REPLICA_GET_INFO)] drsuapi_DsReplicaGetInfoRequest1 req1;
924                 [case(DRSUAPI_DS_REPLICA_GET_INFO2)] drsuapi_DsReplicaGetInfoRequest2 req2;
925         } drsuapi_DsReplicaGetInfoRequest;
926
927         typedef struct {
928                 unistr *naming_context_dn;
929                 unistr *source_dsa_obj_dn;
930                 unistr *source_dsa_address;
931                 unistr *transport_obj_dn;
932                 drsuapi_DsReplicaNeighbourFlags replica_flags;
933                 uint32 reserved;
934                 GUID naming_context_obj_guid;
935                 GUID source_dsa_obj_guid;
936                 GUID source_dsa_invocation_id;
937                 GUID transport_obj_guid;
938                 hyper tmp_highest_usn;
939                 hyper highest_usn;
940                 NTTIME last_success;
941                 NTTIME last_attempt;
942                 WERROR result_last_attempt;
943                 uint32 consecutive_sync_failures;
944         } drsuapi_DsReplicaNeighbour;
945
946         typedef struct {
947                 uint32 count;
948                 uint32 reserved;
949                 [size_is(count)] drsuapi_DsReplicaNeighbour array[];
950         } drsuapi_DsReplicaNeighbourCtr;
951
952         typedef struct {
953                 uint32 count;
954                 uint32 reserved;
955                 [size_is(count)] drsuapi_DsReplicaCoursor array[];
956         } drsuapi_DsReplicaCoursorCtr;
957
958         typedef struct {
959                 unistr *attribute_name;
960                 uint32 version;
961                 NTTIME originating_last_changed;
962                 GUID originating_dsa_invocation_id;
963                 hyper originating_usn;
964                 hyper local_usn;
965         } drsuapi_DsReplicaObjMetaData;
966
967         typedef struct {
968                 uint32 count;
969                 uint32 reserved;
970                 [size_is(count)] drsuapi_DsReplicaObjMetaData array[];
971         } drsuapi_DsReplicaObjMetaDataCtr;
972
973         typedef struct {
974                 unistr *dsa_obj_dn;
975                 GUID dsa_obj_guid;
976                 NTTIME first_failure;
977                 uint32 num_failures;
978                 WERROR last_result;
979         } drsuapi_DsReplicaKccDsaFailure;
980
981         typedef struct {
982                 uint32 count;
983                 uint32 reserved;
984                 [size_is(count)] drsuapi_DsReplicaKccDsaFailure array[];
985         } drsuapi_DsReplicaKccDsaFailuresCtr;
986
987         typedef enum {
988                 DRSUAPI_DS_REPLICA_OP_TYPE_SYNC         = 0,
989                 DRSUAPI_DS_REPLICA_OP_TYPE_ADD          = 1,
990                 DRSUAPI_DS_REPLICA_OP_TYPE_DELETE       = 2,
991                 DRSUAPI_DS_REPLICA_OP_TYPE_MODIFY       = 3,
992                 DRSUAPI_DS_REPLICA_OP_TYPE_UPDATE_REFS  = 4
993         } drsuapi_DsReplicaOpType;
994
995         typedef [switch_type(drsuapi_DsReplicaOpType)] union {
996                 [case(DRSUAPI_DS_REPLICA_OP_TYPE_SYNC)]         drsuapi_DsReplicaSyncOptions sync;
997                 [case(DRSUAPI_DS_REPLICA_OP_TYPE_ADD)]          drsuapi_DsReplicaAddOptions add;
998                 [case(DRSUAPI_DS_REPLICA_OP_TYPE_DELETE)]       drsuapi_DsReplicaDeleteOptions delete;
999                 [case(DRSUAPI_DS_REPLICA_OP_TYPE_MODIFY)]       drsuapi_DsReplicaModifyOptions modify;
1000                 [case(DRSUAPI_DS_REPLICA_OP_TYPE_UPDATE_REFS)]  drsuapi_DsReplicaUpdateRefsOptions update_refs;
1001                 [default] uint32 unknown;
1002         } drsuapi_DsRplicaOpOptions;
1003
1004         typedef struct {
1005                 NTTIME operation_start;
1006                 uint32 serial_num; /* unique till reboot */
1007                 uint32 priority;
1008                 drsuapi_DsReplicaOpType operation_type;
1009                 [switch_is(operation_type)] drsuapi_DsRplicaOpOptions options;
1010                 unistr *nc_dn;
1011                 unistr *remote_dsa_obj_dn;
1012                 unistr *remote_dsa_address;
1013                 GUID nc_obj_guid;
1014                 GUID remote_dsa_obj_guid;
1015         } drsuapi_DsReplicaOp;
1016
1017         typedef struct {
1018                 NTTIME time;
1019                 uint32 count;
1020                 [size_is(count)] drsuapi_DsReplicaOp array[];
1021         } drsuapi_DsReplicaOpCtr;
1022
1023         typedef struct {
1024                 unistr *attribute_name;
1025                 unistr *object_dn;
1026                 uint32 value_length;
1027                 [size_is(value_length)] uint8 *value[];
1028                 NTTIME deleted;
1029                 NTTIME created;
1030                 uint32 version;
1031                 NTTIME originating_last_changed;
1032                 GUID originating_dsa_invocation_id;
1033                 hyper originating_usn;
1034                 hyper local_usn;
1035         } drsuapi_DsReplicaAttrValMetaData;
1036
1037         typedef struct {
1038                 uint32 count;
1039                 int32 enumeration_context;
1040                 [size_is(count)] drsuapi_DsReplicaAttrValMetaData array[];
1041         } drsuapi_DsReplicaAttrValMetaDataCtr;
1042
1043         typedef struct {
1044                 uint32 count;
1045                 int32 enumeration_context;
1046                 [size_is(count)] drsuapi_DsReplicaCoursor2 array[];
1047         } drsuapi_DsReplicaCoursor2Ctr;
1048
1049         typedef struct {
1050                 GUID source_dsa_invocation_id;
1051                 hyper highest_usn;
1052                 NTTIME last_sync_success;
1053                 unistr *source_dsa_obj_dn;
1054         } drsuapi_DsReplicaCoursor3;
1055
1056         typedef struct {
1057                 uint32 count;
1058                 int32 enumeration_context;
1059                 [size_is(count)] drsuapi_DsReplicaCoursor3 array[];
1060         } drsuapi_DsReplicaCoursor3Ctr;
1061
1062         typedef struct {
1063                 unistr *attribute_name;
1064                 uint32 version;
1065                 NTTIME originating_last_changed;
1066                 GUID originating_dsa_invocation_id;
1067                 hyper originating_usn;
1068                 hyper local_usn;
1069                 unistr *originating_dsa_obj_dn;
1070         } drsuapi_DsReplicaObjMetaData2;
1071
1072         typedef struct {
1073                 uint32 count;
1074                 int32 enumeration_context;
1075                 [size_is(count)] drsuapi_DsReplicaObjMetaData2 array[];
1076         } drsuapi_DsReplicaObjMetaData2Ctr;
1077
1078         typedef struct {
1079                 unistr *attribute_name;
1080                 unistr *object_dn;
1081                 uint32 value_length;
1082                 [size_is(value_length)] uint8 *value[];
1083                 NTTIME deleted;
1084                 NTTIME created;
1085                 uint32 version;
1086                 NTTIME originating_last_changed;
1087                 GUID originating_dsa_invocation_id;
1088                 hyper originating_usn;
1089                 hyper local_usn;
1090                 unistr *originating_dsa_obj_dn;
1091         } drsuapi_DsReplicaAttrValMetaData2;
1092
1093         typedef struct {
1094                 uint32 count;
1095                 int32 enumeration_context;
1096                 [size_is(count)] drsuapi_DsReplicaAttrValMetaData2 array[];
1097         } drsuapi_DsReplicaAttrValMetaData2Ctr;
1098
1099         typedef struct {
1100                 hyper u1; /* session number? */
1101                 uint32 u2;
1102                 uint32 u3;
1103                 GUID bind_guid;
1104                 NTTIME_1sec bind_time;
1105                 uint32 u4; /* flags? */
1106                 uint32 u5;
1107         } drsuapi_DsReplicaConnection04;
1108
1109         typedef struct {
1110                 [range(0,10000)] uint32 count;
1111                 uint32 reserved;
1112                 [size_is(count)] drsuapi_DsReplicaConnection04 array[];
1113         } drsuapi_DsReplicaConnection04Ctr;
1114
1115         typedef struct {
1116                 unistr *str1;
1117                 uint32 u1;
1118                 uint32 u2;
1119                 uint32 u3;
1120                 uint32 u4;
1121                 uint32 u5;
1122                 hyper u6;
1123                 uint32 u7;
1124         } drsuapi_DsReplica06;
1125
1126         typedef struct {
1127                 [range(0,256)] uint32 count;
1128                 uint32 reserved;
1129                 [size_is(count)] drsuapi_DsReplica06 array[];
1130         } drsuapi_DsReplica06Ctr;
1131
1132         typedef [switch_type(drsuapi_DsReplicaInfoType)] union {
1133                 [case(DRSUAPI_DS_REPLICA_INFO_NEIGHBORS)] drsuapi_DsReplicaNeighbourCtr *neighbours;
1134                 [case(DRSUAPI_DS_REPLICA_INFO_CURSORS)] drsuapi_DsReplicaCoursorCtr *coursors;
1135                 [case(DRSUAPI_DS_REPLICA_INFO_OBJ_METADATA)] drsuapi_DsReplicaObjMetaDataCtr *objmetadata;
1136                 [case(DRSUAPI_DS_REPLICA_INFO_KCC_DSA_CONNECT_FAILURES)] drsuapi_DsReplicaKccDsaFailuresCtr *connectfailures;
1137                 [case(DRSUAPI_DS_REPLICA_INFO_KCC_DSA_LINK_FAILURES)] drsuapi_DsReplicaKccDsaFailuresCtr *linkfailures;
1138                 [case(DRSUAPI_DS_REPLICA_INFO_PENDING_OPS)] drsuapi_DsReplicaOpCtr *pendingops;
1139                 [case(DRSUAPI_DS_REPLICA_INFO_ATTRIBUTE_VALUE_METADATA)] drsuapi_DsReplicaAttrValMetaDataCtr *attrvalmetadata;
1140                 [case(DRSUAPI_DS_REPLICA_INFO_CURSORS2)] drsuapi_DsReplicaCoursor2Ctr *coursors2;
1141                 [case(DRSUAPI_DS_REPLICA_INFO_CURSORS3)] drsuapi_DsReplicaCoursor3Ctr *coursors3;
1142                 [case(DRSUAPI_DS_REPLICA_INFO_OBJ_METADATA2)] drsuapi_DsReplicaObjMetaData2Ctr *objmetadata2;
1143                 [case(DRSUAPI_DS_REPLICA_INFO_ATTRIBUTE_VALUE_METADATA2)] drsuapi_DsReplicaAttrValMetaData2Ctr *attrvalmetadata2;
1144                 [case(DRSUAPI_DS_REPLICA_INFO_NEIGHBORS02)] drsuapi_DsReplicaNeighbourCtr *neighbours02;
1145                 [case(DRSUAPI_DS_REPLICA_INFO_CONNECTIONS04)] drsuapi_DsReplicaConnection04Ctr *connections04;
1146                 [case(DRSUAPI_DS_REPLICA_INFO_CURSURS05)] drsuapi_DsReplicaCoursorCtrEx *coursors05;
1147                 [case(DRSUAPI_DS_REPLICA_INFO_06)] drsuapi_DsReplica06Ctr *i06;
1148         } drsuapi_DsReplicaInfo;
1149
1150         WERROR drsuapi_DsReplicaGetInfo(
1151                 [in,ref] policy_handle *bind_handle,
1152                 [in] drsuapi_DsReplicaGetInfoLevel level,
1153                 [in,switch_is(level)] drsuapi_DsReplicaGetInfoRequest req,
1154                 [out] drsuapi_DsReplicaInfoType info_type,
1155                 [out,switch_is(info_type)] drsuapi_DsReplicaInfo info
1156                 );
1157
1158         /*****************/
1159         /* Function 0x14 */
1160         WERROR DRSUAPI_ADD_SID_HISTORY();
1161
1162         /*****************/
1163         /* Function 0x15 */
1164         WERROR DRSUAPI_GET_MEMBERSHIPS2();
1165
1166         /*****************/
1167         /* Function 0x16 */
1168         WERROR DRSUAPI_REPLICA_VERIFY_OBJECTS();
1169
1170         /*****************/
1171         /* Function 0x17 */
1172         WERROR DRSUAPI_GET_OBJECT_EXISTENCE();
1173
1174         /*****************/
1175         /* Function 0x18 */
1176         WERROR DRSUAPI_QUERY_SITES_BY_COST();
1177 }