r6781: -add some comments on how attributes and objectClasses are identified in DRSUAPI
[ira/wip.git] / source4 / 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         /*
286          * In DRSUAPI the objectClasses and attributes
287          * are identified by uint32 values, but in the schema
288          * they are identified by the governsID (objectClasses)
289          * and attributeID (attributes)
290          *
291          * the following table shows the mapping used between the two representations
292          * e.g. - objectClass 'nTDSDSA' has governsID: 1.2.840.113556.1.5.7000.47
293          *        and a UINT32-ID of '0x0017002F'.
294          *      - so the OID 1.2.840.113556.1.5.7000.47 is splitted into a
295          *        OID-prefix: 1.2.840.113556.1.5.7000
296          *        and a value: 47 => 0x2F
297          *      - the mapping table gives a UINT32-prefix: 0x00170000
298          *      - and the UINT32-ID is 0x0017002F = 0x00170000 | 0x2F
299          *
300          * OID-prefix                   => UINT32-Id prefix
301          *
302          * 2.5.4.*                      => 0x00000000 (standard attributes RFC2256 core.schema)
303          * 2.5.6.*                      => 0x00010000 (standard object classes RFC2256 core.schema)
304          * 1.2.840.113556.1.2.*         => 0x00020000
305          * 1.2.840.113556.1.3.*         => 0x00030000
306          * 1.2.840.113556.1.4.*         => 0x00090000
307          * 1.2.840.113556.1.5.*         => 0x000A0000
308          * 2.16.840.1.113730.3.*        => 0x00140000
309          * 0.9.2342.19200300.100.1.*    => 0x00150000
310          * 2.16.840.1.113730.3.1.*      => 0x00160000
311          * 1.2.840.113556.1.5.7000.*    => 0x00170000
312          * 2.5.20.*                     => 0x001A0000
313          * 2.16.840.1.113730.3.2.*      => 0x001C0000
314          * 1.3.6.1.4.1.250.1.*          => 0x001D0000
315          * 0.9.2342.19200300.100.4.*    => 0x001F0000
316          *
317          * 1.2.840.113549.1.9.*         (unstructuredAddress,unstructuredName)
318          * 1.3.6.1.4.1.1466.101.119.2   (dynamicObject)
319          * 1.3.6.1.4.1.1466.101.119.3   (entryTTL)
320          * 2.5.18.*                     (createTimeStamp,modifyTimeStamp, SubSchema)            
321          * 2.5.21.*                     (attrs for SubSchema)
322          *
323          * Here's a list of used 'attributeSyntax' OID's
324          *
325          * 2.5.5.1      => Object(DS-DN) string
326          *                 struct drsuapi_DsObjectIdentifier3
327          *
328          * 2.5.5.2      => OID-string
329          *              => mayContain, mustContain... also have this syntax but have string values
330          *
331          * 2.5.5.4      => String(Teletex) case-insensitive string with teletex charset
332          *
333          * 2.5.5.5      => String(IA5) case-sensitive string
334          *
335          * 2.5.5.6      => String(Numeric)
336          *              => eg. internationalISDNNumber
337          *
338          * 2.5.5.7      => Object(DN-Binary) B:<byte count>:<bytes>:<object DN>
339          *              => e.g. wellKnownObjects
340          *
341          * 2.5.5.8      => BOOL
342          *
343          * 2.5.5.9      => int32
344          *
345          * 2.5.5.10     => DATA_BLOB
346          *              => struct GUID
347          *
348          * 2.5.5.11     => LDAP timestring
349          *              => NTTIME_1sec
350          *
351          * 2.5.5.12     => String(Unicode) case-insensitive string
352          *              => 'standard strings'
353          *
354          * 2.5.5.13     => Object(Presentation-Address) string
355          *              => used in objectClass applicationEntity
356          *
357          * 2.5.5.14     => Object(DN-String) S:<char count>:<string>:<object DN>
358          *              => not used
359          *
360          * 2.5.5.15     => ntSecurityDescriptor
361          *
362          * 2.5.5.16     => int64
363          *
364          * 2.5.5.17     => dom_sid
365          */
366
367         typedef [v1_enum] enum {
368                 DRSUAPI_OBJECTCLASS_top                 = 0x00010000
369         } drsuapi_DsObjectClassId;
370
371         typedef [v1_enum,public] enum {
372                 DRSUAPI_ATTRIBUTE_objectClass           = 0x00000000,
373                 DRSUAPI_ATTRIBUTE_description           = 0x0000000d,
374                 DRSUAPI_ATTRIBUTE_invocationId          = 0x00020073,
375                 DRSUAPI_ATTRIBUTE_ntSecurityDescriptor  = 0x00020119,
376                 DRSUAPI_ATTRIBUTE_objectSid             = 0x00090092,
377                 DRSUAPI_ATTRIBUTE_objectCategory        = 0x0009030e
378         } drsuapi_DsAttributeId;
379
380         /* Generic DATA_BLOB values */
381         typedef struct {
382                 [range(0,10485760)] uint32 length;
383                 DATA_BLOB *data;
384         } drsuapi_DsAttributeValueDataBlob;
385
386         typedef struct {
387                 [range(0,10485760)] uint32 num_values;
388                 [size_is(num_values)] drsuapi_DsAttributeValueDataBlob *values[];
389         } drsuapi_DsAttributeValueCtrDataBlob;
390
391         /* objectClass values */
392         typedef struct {
393                 [range(0,10485760)] uint32 length;
394                 [subcontext(4)] drsuapi_DsObjectClassId *objectClassId;
395         } drsuapi_DsAttributeValueObjectClassId;
396
397         typedef struct {
398                 [range(0,10485760)] uint32 num_values;
399                 [size_is(num_values)] drsuapi_DsAttributeValueObjectClassId *values[];
400         } drsuapi_DsAttributeValueCtrObjectClassId;
401
402         /* uint32 values */
403         typedef struct {
404                 [range(0,10485760)] uint32 length;
405                 [subcontext(4)] uint32 *value;
406         } drsuapi_DsAttributeValueUINT32;
407
408         typedef struct {
409                 [range(0,10485760)] uint32 num_values;
410                 [size_is(num_values)] drsuapi_DsAttributeValueUINT32 *values[];
411         } drsuapi_DsAttributeValueCtrUINT32;
412
413         /* UnicodeString values */
414         typedef struct {
415                 [range(0,10485760)] uint32 length;
416                 [subcontext(4)] nstring *string;
417         } drsuapi_DsAttributeValueUnicodeString;
418
419         typedef struct {
420                 [range(0,10485760)] uint32 num_values;
421                 [size_is(num_values)] drsuapi_DsAttributeValueUnicodeString *values[];
422         } drsuapi_DsAttributeValueCtrUnicodeString;
423
424         /* DN String values */
425         typedef [gensize] struct {
426                 [value(ndr_size_drsuapi_DsReplicaObjectIdentifier3(r, ndr->flags)-4)] uint32 __ndr_size;
427                 [value(ndr_length_dom_sid(&r->sid))]  uint32 __ndr_size_sid;
428                 GUID guid;
429                 dom_sid28 sid;
430                 [flag(STR_SIZE4|STR_CHARLEN)] string dn;
431         } drsuapi_DsReplicaObjectIdentifier3;
432
433         typedef  struct {
434                 [range(0,10485760)] uint32 length;
435                 [subcontext(4)] drsuapi_DsReplicaObjectIdentifier3 *object;
436         } drsuapi_DsAttributeValueDNString;
437
438         typedef struct {
439                 [range(0,10485760)] uint32 num_values;
440                 [size_is(num_values)] drsuapi_DsAttributeValueDNString *values[];
441         } drsuapi_DsAttributeValueCtrDNString;
442
443         /* GUID values */
444         typedef struct {
445                 [range(0,10485760)] uint32 length;
446                 [subcontext(4)] GUID *guid;
447         } drsuapi_DsAttributeValueGUID;
448
449         typedef struct {
450                 [range(0,10485760)] uint32 num_values;
451                 [size_is(num_values)] drsuapi_DsAttributeValueGUID *values[];
452         } drsuapi_DsAttributeValueCtrGUID;
453
454         /* SID values */
455         typedef struct {
456                 [range(0,10485760)] uint32 length;
457                 [subcontext(4)] dom_sid *sid;
458         } drsuapi_DsAttributeValueSID;
459
460         typedef struct {
461                 [range(0,10485760)] uint32 num_values;
462                 [size_is(num_values)] drsuapi_DsAttributeValueSID *values[];
463         } drsuapi_DsAttributeValueCtrSID;
464
465         /* SecurityDescriptor values */
466         typedef struct {
467                 [range(0,10485760)] uint32 length;
468                 [subcontext(4)] security_descriptor *sd;
469         } drsuapi_DsAttributeValueSecurityDescriptor;
470
471         typedef struct {
472                 [range(0,10485760)] uint32 num_values;
473                 [size_is(num_values)] drsuapi_DsAttributeValueSecurityDescriptor *values[];
474         } drsuapi_DsAttributeValueCtrSecurityDescriptor;
475
476         /* NTTIME_1sec values */
477         typedef struct {
478                 [range(0,10485760)] uint32 length;
479                 [subcontext(4)] NTTIME_1sec *time;
480         } drsuapi_DsAttributeValueNTTIME_1sec;
481
482         typedef struct {
483                 [range(0,10485760)] uint32 num_values;
484                 [size_is(num_values)] drsuapi_DsAttributeValueNTTIME_1sec *values[];
485         } drsuapi_DsAttributeValueCtrNTTIME_1sec;
486
487         typedef [nodiscriminant] union {
488                 [case(DRSUAPI_ATTRIBUTE_objectClass)] drsuapi_DsAttributeValueCtrObjectClassId object_class_id;
489
490                 /* UINT32 */
491                 [case(0x00020001)] drsuapi_DsAttributeValueCtrUINT32 uint32;
492                 [case(0x0002004c)] drsuapi_DsAttributeValueCtrUINT32 uint32;
493                 [case(0x000200a9)] drsuapi_DsAttributeValueCtrUINT32 uint32;
494                 [case(0x00090177)] drsuapi_DsAttributeValueCtrUINT32 uint32;
495                 [case(0x000905b3)] drsuapi_DsAttributeValueCtrUINT32 uint32;
496
497                 /* GUID */
498                 [case(DRSUAPI_ATTRIBUTE_invocationId)] drsuapi_DsAttributeValueCtrGUID guid;
499
500                 /* SID */
501                 [case(DRSUAPI_ATTRIBUTE_objectSid)] drsuapi_DsAttributeValueCtrSID sid;
502
503                 /* SecurityDescriptor */
504                 [case(DRSUAPI_ATTRIBUTE_ntSecurityDescriptor)] drsuapi_DsAttributeValueCtrSecurityDescriptor security_descriptor;
505
506                 /* UnicodeString */
507                 [case(DRSUAPI_ATTRIBUTE_description)]           drsuapi_DsAttributeValueCtrUnicodeString unicode_string;
508                 [case(0x00090001)]                              drsuapi_DsAttributeValueCtrUnicodeString unicode_string;
509                 [case(0x000900dd)]                              drsuapi_DsAttributeValueCtrUnicodeString unicode_string;
510                 [case(0x0009037b)]                              drsuapi_DsAttributeValueCtrUnicodeString unicode_string;
511
512                 /* DN String */
513                 [case(DRSUAPI_ATTRIBUTE_objectCategory)]        drsuapi_DsAttributeValueCtrDNString dn_string;
514                 [case(0x0002000e)]                              drsuapi_DsAttributeValueCtrDNString dn_string;
515                 [case(0x00020024)]                              drsuapi_DsAttributeValueCtrDNString dn_string;
516                 [case(0x00090171)]                              drsuapi_DsAttributeValueCtrDNString dn_string;
517                 [case(0x0009071c)]                              drsuapi_DsAttributeValueCtrDNString dn_string;
518                 [case(0x0009072c)]                              drsuapi_DsAttributeValueCtrDNString dn_string;
519                 [case(0x0009026a)]                              drsuapi_DsAttributeValueCtrDNString dn_string;
520                 [case(0x00090203)]                              drsuapi_DsAttributeValueCtrDNString dn_string;
521
522                 /* NTTIME_1sec */
523                 [case(0x00020002)] drsuapi_DsAttributeValueCtrNTTIME_1sec nttime_1sec;
524
525                 /* the default is the DATA_BLOB */
526                 [default] drsuapi_DsAttributeValueCtrDataBlob data_blob;
527         } drsuapi_DsReplicaAttributeValueCtr;
528
529         typedef [flag(NDR_PAHEX)] struct {
530                 drsuapi_DsAttributeId attid;
531                 [switch_is(attid)] drsuapi_DsReplicaAttributeValueCtr value_ctr;
532         } drsuapi_DsReplicaAttribute;
533
534         typedef struct {
535                 [range(0,1048576)] uint32 num_attributes;
536                 [size_is(num_attributes)]  drsuapi_DsReplicaAttribute *attributes[];
537         } drsuapi_DsReplicaAttributeCtr;
538
539         typedef [public] struct {
540                 drsuapi_DsReplicaObjectIdentifier *identifier;
541                 uint32 unknown1;
542                 drsuapi_DsReplicaAttributeCtr attribute_ctr;
543         } drsuapi_DsReplicaObject;
544
545         typedef struct {
546                 uint32 version;
547                 NTTIME_1sec orginating_time;
548                 GUID orginating_invocation_id;
549                 hyper orginating_usn;
550         } drsuapi_DsReplicaMetaData;
551
552         typedef [public] struct {
553                 [range(0,1048576)] uint32 count;
554                 [size_is(count)] drsuapi_DsReplicaMetaData meta_data[];
555         } drsuapi_DsReplicaMetaDataCtr;
556
557         typedef [noprint] struct {
558                 drsuapi_DsReplicaObjectListItemEx *next_object;
559                 drsuapi_DsReplicaObject object;
560                 uint32 unknown1;
561                 GUID *parent_object_guid;
562                 drsuapi_DsReplicaMetaDataCtr *meta_data_ctr;
563         } drsuapi_DsReplicaObjectListItemEx;
564
565         typedef [gensize] struct {
566                 GUID guid1;
567                 GUID guid2;
568                 drsuapi_DsReplicaObjectIdentifier *naming_context;
569                 drsuapi_DsReplicaHighWaterMark old_highwatermark;
570                 drsuapi_DsReplicaHighWaterMark new_highwatermark;
571                 drsuapi_DsReplicaCoursorCtrEx *uptodateness_vector;
572                 drsuapi_DsGetNCChangesRequest_Ctr12 ctr12;
573                 uint32 unknown1;
574                 uint32 object_count;
575                 /* this +55 is sometimes +56, so I don't know where this comes from... --metze */
576                 [value(ndr_size_drsuapi_DsGetNCChangesCtr1(r,ndr->flags)+55)] uint32 __ndr_size;
577                 drsuapi_DsReplicaObjectListItemEx *first_object;
578                 uint32 unknown4;
579         } drsuapi_DsGetNCChangesCtr1;
580
581         typedef struct {
582                 uint32 decompressed_length;
583                 uint32 compressed_length;
584                 [subcontext(4),subcontext_size(r->compressed_length),compression(NDR_COMPRESSION_MSZIP,compressed_length,decompressed_length)] drsuapi_DsGetNCChangesCtr1 *ctr1;
585         } drsuapi_DsGetNCChangesCompressedInfo;
586
587         typedef struct {
588                 uint32 decompressed_length;
589                 uint32 compressed_length;
590                 [subcontext(4),subcontext_size(r->compressed_length),flag(NDR_REMAINING)] DATA_BLOB *decompressed;
591         } drsuapi_DsGetNCChangesCompressedInfo_Test;
592
593         typedef struct {
594                 drsuapi_DsGetNCChangesCompressedInfo info;
595         } drsuapi_DsGetNCChangesCtr2;
596
597         typedef struct {
598                 GUID guid1;
599                 GUID guid2;
600                 drsuapi_DsReplicaObjectIdentifier *naming_context;
601                 drsuapi_DsReplicaHighWaterMark old_highwatermark;
602                 drsuapi_DsReplicaHighWaterMark new_highwatermark;
603                 drsuapi_DsReplicaCoursor2CtrEx *uptodateness_vector;
604                 drsuapi_DsGetNCChangesRequest_Ctr12 ctr12;
605                 uint32 unknown1;
606                 uint32 unknown2;
607                 uint32 unknown3;
608                 drsuapi_DsReplicaObjectListItemEx *first_object;
609                 uint32 unknown4;
610                 uint32 unknown5;
611                 uint32 unknown6;
612                 uint32 len1;
613                 uint32 array_ptr1;
614                 uint32 unknown7;
615         } drsuapi_DsGetNCChangesCtr6;
616
617         typedef struct {
618                 uint32 unknown1;
619                 uint16 unknown2; /* enum */
620                 drsuapi_DsGetNCChangesCompressedInfo_Test info;
621         } drsuapi_DsGetNCChangesCtr7;
622
623         typedef [switch_type(int32)] union {
624                 [case(1)] drsuapi_DsGetNCChangesCtr1 ctr1;
625                 [case(2)] drsuapi_DsGetNCChangesCtr2 ctr2;
626                 [case(6)] drsuapi_DsGetNCChangesCtr6 ctr6;
627                 [case(7)] drsuapi_DsGetNCChangesCtr7 ctr7;
628         } drsuapi_DsGetNCChangesCtr;
629
630         WERROR drsuapi_DsGetNCChanges(
631                 [in,ref] policy_handle *bind_handle,
632                 [in,out] int32 level,
633                 [in,switch_is(level)] drsuapi_DsGetNCChangesRequest req,
634                 [out,switch_is(level)] drsuapi_DsGetNCChangesCtr ctr
635                 );
636
637         /*****************/
638         /* Function 0x04 */
639         typedef bitmap {
640                 DRSUAPI_DS_REPLICA_UPDATE_ASYNCHRONOUS_OPERATION        = 0x00000001,
641                 DRSUAPI_DS_REPLICA_UPDATE_WRITEABLE                     = 0x00000002,
642                 DRSUAPI_DS_REPLICA_UPDATE_ADD_REFERENCE                 = 0x00000004,
643                 DRSUAPI_DS_REPLICA_UPDATE_DELETE_REFERENCE              = 0x00000008,
644                 DRSUAPI_DS_REPLICA_UPDATE_0x00000010                    = 0x00000010
645         } drsuapi_DsReplicaUpdateRefsOptions;
646
647         typedef struct {
648                 [ref] drsuapi_DsReplicaObjectIdentifier *naming_context;
649                 [ref] ascstr *dest_dsa_dns_name;
650                 GUID dest_dsa_guid;
651                 drsuapi_DsReplicaUpdateRefsOptions options;
652         } drsuapi_DsReplicaUpdateRefsRequest1;
653
654         typedef [switch_type(int32)] union {
655                 [case(1)] drsuapi_DsReplicaUpdateRefsRequest1 req1;
656         } drsuapi_DsReplicaUpdateRefsRequest;
657
658         WERROR drsuapi_DsReplicaUpdateRefs(
659                 [in,ref] policy_handle *bind_handle,
660                 [in] int32 level,
661                 [in,switch_is(level)] drsuapi_DsReplicaUpdateRefsRequest req
662                 );
663
664         /*****************/
665         /* Function 0x05 */
666         typedef bitmap {
667                 DRSUAPI_DS_REPLICA_ADD_ASYNCHRONOUS_OPERATION   = 0x00000001,
668                 DRSUAPI_DS_REPLICA_ADD_WRITEABLE                = 0x00000002
669                 /* TODO ... */
670         } drsuapi_DsReplicaAddOptions;
671
672         WERROR DRSUAPI_REPLICA_ADD();
673
674         /*****************/
675         /* Function 0x06 */
676         typedef bitmap {
677                 DRSUAPI_DS_REPLICA_DELETE_ASYNCHRONOUS_OPERATION        = 0x00000001,
678                 DRSUAPI_DS_REPLICA_DELETE_WRITEABLE                     = 0x00000002
679                 /* TODO ... */
680         } drsuapi_DsReplicaDeleteOptions;
681
682         WERROR DRSUAPI_REPLICA_DEL();
683
684         /*****************/
685         /* Function 0x07 */
686         typedef bitmap {
687                 DRSUAPI_DS_REPLICA_MODIFY_ASYNCHRONOUS_OPERATION        = 0x00000001,
688                 DRSUAPI_DS_REPLICA_MODIFY_WRITEABLE                     = 0x00000002
689         } drsuapi_DsReplicaModifyOptions;
690
691         WERROR DRSUAPI_REPLICA_MODIFY();
692
693         /*****************/
694         /* Function 0x08 */
695         WERROR DRSUAPI_VERIFY_NAMES();
696
697         /*****************/
698         /* Function 0x09 */
699         WERROR DRSUAPI_GET_MEMBERSHIPS();
700
701         /*****************/
702         /* Function 0x0a */
703         WERROR DRSUAPI_INTER_DOMAIN_MOVE();
704
705         /*****************/
706         /* Function 0x0b */
707         WERROR DRSUAPI_GET_NT4_CHANGELOG();
708
709         /*****************/
710         /* Function 0x0c */
711         typedef [v1_enum] enum {
712                 DRSUAPI_DS_NAME_STATUS_OK                       = 0,
713                 DRSUAPI_DS_NAME_STATUS_RESOLVE_ERROR            = 1,
714                 DRSUAPI_DS_NAME_STATUS_NOT_FOUND                = 2,
715                 DRSUAPI_DS_NAME_STATUS_NOT_UNIQUE               = 3,
716                 DRSUAPI_DS_NAME_STATUS_NO_MAPPING               = 4,
717                 DRSUAPI_DS_NAME_STATUS_DOMAIN_ONLY              = 5,
718                 DRSUAPI_DS_NAME_STATUS_NO_SYNTACTICAL_MAPPING   = 6,
719                 DRSUAPI_DS_NAME_STATUS_TRUST_REFERRAL           = 7
720         } drsuapi_DsNameStatus;
721
722         typedef [v1_enum] enum {
723                 DRSUAPI_DS_NAME_FLAG_NO_FLAGS                   = 0x0,
724                 DRSUAPI_DS_NAME_FLAG_SYNTACTICAL_ONLY           = 0x1,
725                 DRSUAPI_DS_NAME_FLAG_EVAL_AT_DC                 = 0x2,
726                 DRSUAPI_DS_NAME_FLAG_GCVERIFY                   = 0x4,
727                 DRSUAPI_DS_NAME_FLAG_TRUST_REFERRAL             = 0x8
728         } drsuapi_DsNameFlags;
729
730         typedef [v1_enum] enum {
731                 DRSUAPI_DS_NAME_FORMAT_UKNOWN                   = 0,
732                 DRSUAPI_DS_NAME_FORMAT_FQDN_1779                = 1,
733                 DRSUAPI_DS_NAME_FORMAT_NT4_ACCOUNT              = 2,
734                 DRSUAPI_DS_NAME_FORMAT_DISPLAY                  = 3,
735                 DRSUAPI_DS_NAME_FORMAT_GUID                     = 6,
736                 DRSUAPI_DS_NAME_FORMAT_CANONICAL                = 7,
737                 DRSUAPI_DS_NAME_FORMAT_USER_PRINCIPAL           = 8,
738                 DRSUAPI_DS_NAME_FORMAT_CANONICAL_EX             = 9,
739                 DRSUAPI_DS_NAME_FORMAT_SERVICE_PRINCIPAL        = 10,
740                 DRSUAPI_DS_NAME_FORMAT_SID_OR_SID_HISTORY       = 11,
741                 DRSUAPI_DS_NAME_FORMAT_DNS_DOMAIN               = 12
742         } drsuapi_DsNameFormat;
743
744         typedef struct {
745                 unistr *str;
746         } drsuapi_DsNameString;
747
748         typedef struct {
749                 uint32 unknown1; /* 0x000004e4 */
750                 uint32 unknown2; /* 0x00000407 */
751                 drsuapi_DsNameFlags format_flags;
752                 drsuapi_DsNameFormat format_offered;
753                 drsuapi_DsNameFormat format_desired;
754                 [range(1,10000)] uint32 count;
755                 [size_is(count)] drsuapi_DsNameString *names[];
756         } drsuapi_DsNameRequest1;
757
758         typedef [switch_type(int32)] union {
759                 [case(1)] drsuapi_DsNameRequest1 req1;
760         } drsuapi_DsNameRequest;
761
762         typedef struct {
763                 drsuapi_DsNameStatus status;
764                 unistr *dns_domain_name;
765                 unistr *result_name;
766         } drsuapi_DsNameInfo1;
767
768         typedef struct {
769                 uint32 count;
770                 [size_is(count)] drsuapi_DsNameInfo1 *array[];
771         } drsuapi_DsNameCtr1;
772
773         typedef [switch_type(int32)] union {
774                 [case(1)] drsuapi_DsNameCtr1 *ctr1;
775         } drsuapi_DsNameCtr;
776
777         WERROR drsuapi_DsCrackNames(
778                 [in,ref] policy_handle *bind_handle,
779                 [in, out] int32 level,
780                 [in,switch_is(level)] drsuapi_DsNameRequest req,
781                 [out,switch_is(level)] drsuapi_DsNameCtr ctr
782                 );
783
784         /*****************/
785         /* Function 0x0d */
786         typedef [v1_enum] enum {
787                 DRSUAPI_DS_SPN_OPERATION_ADD    = 0,
788                 DRSUAPI_DS_SPN_OPERATION_REPLACE= 1,
789                 DRSUAPI_DS_SPN_OPERATION_DELETE = 2
790         } drsuapi_DsSpnOperation;
791
792         typedef struct {
793                 drsuapi_DsSpnOperation operation;
794                 uint32 unknown1;
795                 unistr *object_dn;
796                 [range(0,10000)] uint32 count;
797                 [size_is(count)] drsuapi_DsNameString *spn_names[];
798         } drsuapi_DsWriteAccountSpnRequest1;
799
800         typedef [switch_type(int32)] union {
801                 [case(1)] drsuapi_DsWriteAccountSpnRequest1 req1;
802         } drsuapi_DsWriteAccountSpnRequest;
803
804         typedef struct {
805                 WERROR status;
806         } drsuapi_DsWriteAccountSpnResult1;
807
808         typedef [switch_type(int32)] union {
809                 [case(1)] drsuapi_DsWriteAccountSpnResult1 res1;
810         } drsuapi_DsWriteAccountSpnResult;
811
812         WERROR drsuapi_DsWriteAccountSpn(
813                 [in,ref] policy_handle *bind_handle,
814                 [in, out] int32 level,
815                 [in,switch_is(level)] drsuapi_DsWriteAccountSpnRequest req,
816                 [out,switch_is(level)] drsuapi_DsWriteAccountSpnResult res
817                 );
818
819         /*****************/
820         /* Function 0x0e */
821         WERROR DRSUAPI_REMOVE_DS_SERVER();
822
823         /*****************/
824         /* Function 0x0f */
825         WERROR DRSUAPI_REMOVE_DS_DOMAIN();
826
827         /*****************/
828         /* Function 0x10 */
829         typedef struct {
830                 unistr *domain_name; /* netbios or dns */
831                 int32 level; /* specifies the switch level for the request */
832         } drsuapi_DsGetDCInfoRequest1;
833
834         typedef [switch_type(int32)] union {
835                 [case(1)] drsuapi_DsGetDCInfoRequest1 req1;
836         } drsuapi_DsGetDCInfoRequest;
837
838         typedef struct {
839                 unistr *netbios_name;
840                 unistr *dns_name;
841                 unistr *site_name;
842                 unistr *computer_dn;
843                 unistr *server_dn;
844                 uint32 is_pdc;
845                 uint32 is_enabled;
846         } drsuapi_DsGetDCInfo1;
847
848         typedef struct {
849                 [range(0,10000)] uint32 count;
850                 [size_is(count)] drsuapi_DsGetDCInfo1 *array[];
851         } drsuapi_DsGetDCInfoCtr1;
852
853         typedef struct {
854                 unistr *netbios_name;
855                 unistr *dns_name;
856                 unistr *site_name;
857                 unistr *site_dn;
858                 unistr *computer_dn;
859                 unistr *server_dn;
860                 unistr *ntds_dn;
861                 uint32 is_pdc;
862                 uint32 is_enabled;
863                 uint32 is_gc;
864                 GUID site_guid;
865                 GUID computer_guid;
866                 GUID server_guid;
867                 GUID ntds_guid;
868         } drsuapi_DsGetDCInfo2;
869
870         typedef struct {
871                 [range(0,10000)] uint32 count;
872                 [size_is(count)] drsuapi_DsGetDCInfo2 *array[];
873         } drsuapi_DsGetDCInfoCtr2;
874
875         typedef struct {
876                 uint32 unknown1;
877                 uint32 unknown2;
878                 uint32 unknown3;
879                 uint32 unknown4;
880                 uint32 unknown5;
881                 uint32 unknown6;
882                 unistr *server_nt4_account;
883         } drsuapi_DsGetDCInfo01;
884
885         typedef struct {
886                 [range(0,10000)] uint32 count;
887                 [size_is(count)] drsuapi_DsGetDCInfo01 *array[];
888         } drsuapi_DsGetDCInfoCtr01;
889
890         typedef [v1_enum] enum {
891                 DRSUAPI_DC_INFO_CTR_1  = 1,
892                 DRSUAPI_DC_INFO_CTR_2  = 2,
893                 DRSUAPI_DC_INFO_CTR_01 = -1
894         } drsuapi_DsGetDCInfoCtrLevels;
895
896         typedef [switch_type(int32)] union {
897                 [case(DRSUAPI_DC_INFO_CTR_1)]  drsuapi_DsGetDCInfoCtr1  ctr1;
898                 [case(DRSUAPI_DC_INFO_CTR_2)]  drsuapi_DsGetDCInfoCtr2  ctr2;
899                 [case(DRSUAPI_DC_INFO_CTR_01)] drsuapi_DsGetDCInfoCtr01 ctr01;
900         } drsuapi_DsGetDCInfoCtr;
901
902         WERROR drsuapi_DsGetDomainControllerInfo(
903                 [in,ref] policy_handle *bind_handle,
904                 [in, out] int32 level,
905                 [in,switch_is(level)] drsuapi_DsGetDCInfoRequest req,
906                 [out,switch_is(level)] drsuapi_DsGetDCInfoCtr ctr
907                 );
908
909         /*****************/
910         /* Function 0x11 */
911         typedef [noprint] struct {
912                 drsuapi_DsReplicaObjectListItem *next_object;
913                 drsuapi_DsReplicaObject object;
914         } drsuapi_DsReplicaObjectListItem;
915
916         typedef struct {
917                 drsuapi_DsReplicaObjectListItem first_object;
918         } drsuapi_DsAddEntryRequest2;
919
920         typedef [switch_type(int32)] union {
921                 [case(2)] drsuapi_DsAddEntryRequest2 req2;
922         } drsuapi_DsAddEntryRequest;
923
924         typedef struct {
925                 uint32 unknown1;
926                 uint32 unknown2;
927                 uint32 unknown3;
928         } drsuapi_DsAddEntryCtr3Info1;
929
930         typedef [switch_type(uint32)] union {
931                 [case(1)] drsuapi_DsAddEntryCtr3Info1 info1;
932         } drsuapi_DsAddEntryCtr3Info;
933
934         typedef struct {
935                 GUID guid;
936                 dom_sid28 sid;
937         } drsuapi_DsReplicaObjectIdentifier2;
938
939         typedef struct {
940                 drsuapi_DsReplicaObjectIdentifier *id;
941                 uint32 level;
942                 [switch_is(level)] drsuapi_DsAddEntryCtr3Info *info;
943                 [range(0,10000)] uint32 count;
944                 [size_is(count)] drsuapi_DsReplicaObjectIdentifier2 *objects[];
945         } drsuapi_DsAddEntryCtr3;
946
947         typedef [switch_type(int32)] union {
948                 [case(3)] drsuapi_DsAddEntryCtr3 ctr3;
949         } drsuapi_DsAddEntryCtr;
950
951         WERROR drsuapi_DsAddEntry(
952                 [in,ref] policy_handle *bind_handle,
953                 [in,out] int32 level,
954                 [in,switch_is(level)] drsuapi_DsAddEntryRequest req,
955                 [out,switch_is(level)] drsuapi_DsAddEntryCtr ctr
956                 );
957
958         /*****************/
959         /* Function 0x12 */
960         WERROR DRSUAPI_EXECUTE_KCC();
961
962         /*****************/
963         /* Function 0x13 */
964         typedef [v1_enum] enum {
965                 DRSUAPI_DS_REPLICA_GET_INFO                             = 1,
966                 DRSUAPI_DS_REPLICA_GET_INFO2                            = 2
967         } drsuapi_DsReplicaGetInfoLevel;
968
969         typedef [v1_enum] enum {
970                 DRSUAPI_DS_REPLICA_INFO_NEIGHBORS                       = 0,
971                 DRSUAPI_DS_REPLICA_INFO_CURSORS                         = 1,
972                 DRSUAPI_DS_REPLICA_INFO_OBJ_METADATA                    = 2,
973                 DRSUAPI_DS_REPLICA_INFO_KCC_DSA_CONNECT_FAILURES        = 3,
974                 DRSUAPI_DS_REPLICA_INFO_KCC_DSA_LINK_FAILURES           = 4,
975                 DRSUAPI_DS_REPLICA_INFO_PENDING_OPS                     = 5,
976                 DRSUAPI_DS_REPLICA_INFO_ATTRIBUTE_VALUE_METADATA        = 6,
977                 DRSUAPI_DS_REPLICA_INFO_CURSORS2                        = 7,
978                 DRSUAPI_DS_REPLICA_INFO_CURSORS3                        = 8,
979                 DRSUAPI_DS_REPLICA_INFO_OBJ_METADATA2                   = 9,
980                 DRSUAPI_DS_REPLICA_INFO_ATTRIBUTE_VALUE_METADATA2       = 10,
981                 DRSUAPI_DS_REPLICA_INFO_NEIGHBORS02                     = -2,
982                 DRSUAPI_DS_REPLICA_INFO_CONNECTIONS04                   = -4,
983                 DRSUAPI_DS_REPLICA_INFO_CURSURS05                       = -5,
984                 DRSUAPI_DS_REPLICA_INFO_06                              = -6
985         } drsuapi_DsReplicaInfoType;
986
987         typedef struct {
988                 drsuapi_DsReplicaInfoType info_type;
989                 unistr *object_dn;
990                 GUID guid1;
991         } drsuapi_DsReplicaGetInfoRequest1;
992
993         typedef struct {
994                 drsuapi_DsReplicaInfoType info_type;
995                 unistr *object_dn;
996                 GUID guid1;
997                 uint32 unknown1;
998                 unistr *string1;
999                 unistr *string2;
1000                 uint32 unknown2;
1001         } drsuapi_DsReplicaGetInfoRequest2;
1002
1003         typedef [switch_type(drsuapi_DsReplicaGetInfoLevel)] union {
1004                 [case(DRSUAPI_DS_REPLICA_GET_INFO)] drsuapi_DsReplicaGetInfoRequest1 req1;
1005                 [case(DRSUAPI_DS_REPLICA_GET_INFO2)] drsuapi_DsReplicaGetInfoRequest2 req2;
1006         } drsuapi_DsReplicaGetInfoRequest;
1007
1008         typedef struct {
1009                 unistr *naming_context_dn;
1010                 unistr *source_dsa_obj_dn;
1011                 unistr *source_dsa_address;
1012                 unistr *transport_obj_dn;
1013                 drsuapi_DsReplicaNeighbourFlags replica_flags;
1014                 uint32 reserved;
1015                 GUID naming_context_obj_guid;
1016                 GUID source_dsa_obj_guid;
1017                 GUID source_dsa_invocation_id;
1018                 GUID transport_obj_guid;
1019                 hyper tmp_highest_usn;
1020                 hyper highest_usn;
1021                 NTTIME last_success;
1022                 NTTIME last_attempt;
1023                 WERROR result_last_attempt;
1024                 uint32 consecutive_sync_failures;
1025         } drsuapi_DsReplicaNeighbour;
1026
1027         typedef struct {
1028                 uint32 count;
1029                 uint32 reserved;
1030                 [size_is(count)] drsuapi_DsReplicaNeighbour array[];
1031         } drsuapi_DsReplicaNeighbourCtr;
1032
1033         typedef struct {
1034                 uint32 count;
1035                 uint32 reserved;
1036                 [size_is(count)] drsuapi_DsReplicaCoursor array[];
1037         } drsuapi_DsReplicaCoursorCtr;
1038
1039         typedef struct {
1040                 unistr *attribute_name;
1041                 uint32 version;
1042                 NTTIME originating_last_changed;
1043                 GUID originating_dsa_invocation_id;
1044                 hyper originating_usn;
1045                 hyper local_usn;
1046         } drsuapi_DsReplicaObjMetaData;
1047
1048         typedef struct {
1049                 uint32 count;
1050                 uint32 reserved;
1051                 [size_is(count)] drsuapi_DsReplicaObjMetaData array[];
1052         } drsuapi_DsReplicaObjMetaDataCtr;
1053
1054         typedef struct {
1055                 unistr *dsa_obj_dn;
1056                 GUID dsa_obj_guid;
1057                 NTTIME first_failure;
1058                 uint32 num_failures;
1059                 WERROR last_result;
1060         } drsuapi_DsReplicaKccDsaFailure;
1061
1062         typedef struct {
1063                 uint32 count;
1064                 uint32 reserved;
1065                 [size_is(count)] drsuapi_DsReplicaKccDsaFailure array[];
1066         } drsuapi_DsReplicaKccDsaFailuresCtr;
1067
1068         typedef enum {
1069                 DRSUAPI_DS_REPLICA_OP_TYPE_SYNC         = 0,
1070                 DRSUAPI_DS_REPLICA_OP_TYPE_ADD          = 1,
1071                 DRSUAPI_DS_REPLICA_OP_TYPE_DELETE       = 2,
1072                 DRSUAPI_DS_REPLICA_OP_TYPE_MODIFY       = 3,
1073                 DRSUAPI_DS_REPLICA_OP_TYPE_UPDATE_REFS  = 4
1074         } drsuapi_DsReplicaOpType;
1075
1076         typedef [switch_type(drsuapi_DsReplicaOpType)] union {
1077                 [case(DRSUAPI_DS_REPLICA_OP_TYPE_SYNC)]         drsuapi_DsReplicaSyncOptions sync;
1078                 [case(DRSUAPI_DS_REPLICA_OP_TYPE_ADD)]          drsuapi_DsReplicaAddOptions add;
1079                 [case(DRSUAPI_DS_REPLICA_OP_TYPE_DELETE)]       drsuapi_DsReplicaDeleteOptions delete;
1080                 [case(DRSUAPI_DS_REPLICA_OP_TYPE_MODIFY)]       drsuapi_DsReplicaModifyOptions modify;
1081                 [case(DRSUAPI_DS_REPLICA_OP_TYPE_UPDATE_REFS)]  drsuapi_DsReplicaUpdateRefsOptions update_refs;
1082                 [default] uint32 unknown;
1083         } drsuapi_DsRplicaOpOptions;
1084
1085         typedef struct {
1086                 NTTIME operation_start;
1087                 uint32 serial_num; /* unique till reboot */
1088                 uint32 priority;
1089                 drsuapi_DsReplicaOpType operation_type;
1090                 [switch_is(operation_type)] drsuapi_DsRplicaOpOptions options;
1091                 unistr *nc_dn;
1092                 unistr *remote_dsa_obj_dn;
1093                 unistr *remote_dsa_address;
1094                 GUID nc_obj_guid;
1095                 GUID remote_dsa_obj_guid;
1096         } drsuapi_DsReplicaOp;
1097
1098         typedef struct {
1099                 NTTIME time;
1100                 uint32 count;
1101                 [size_is(count)] drsuapi_DsReplicaOp array[];
1102         } drsuapi_DsReplicaOpCtr;
1103
1104         typedef struct {
1105                 unistr *attribute_name;
1106                 unistr *object_dn;
1107                 uint32 value_length;
1108                 [size_is(value_length)] uint8 *value[];
1109                 NTTIME deleted;
1110                 NTTIME created;
1111                 uint32 version;
1112                 NTTIME originating_last_changed;
1113                 GUID originating_dsa_invocation_id;
1114                 hyper originating_usn;
1115                 hyper local_usn;
1116         } drsuapi_DsReplicaAttrValMetaData;
1117
1118         typedef struct {
1119                 uint32 count;
1120                 int32 enumeration_context;
1121                 [size_is(count)] drsuapi_DsReplicaAttrValMetaData array[];
1122         } drsuapi_DsReplicaAttrValMetaDataCtr;
1123
1124         typedef struct {
1125                 uint32 count;
1126                 int32 enumeration_context;
1127                 [size_is(count)] drsuapi_DsReplicaCoursor2 array[];
1128         } drsuapi_DsReplicaCoursor2Ctr;
1129
1130         typedef struct {
1131                 GUID source_dsa_invocation_id;
1132                 hyper highest_usn;
1133                 NTTIME last_sync_success;
1134                 unistr *source_dsa_obj_dn;
1135         } drsuapi_DsReplicaCoursor3;
1136
1137         typedef struct {
1138                 uint32 count;
1139                 int32 enumeration_context;
1140                 [size_is(count)] drsuapi_DsReplicaCoursor3 array[];
1141         } drsuapi_DsReplicaCoursor3Ctr;
1142
1143         typedef struct {
1144                 unistr *attribute_name;
1145                 uint32 version;
1146                 NTTIME originating_last_changed;
1147                 GUID originating_dsa_invocation_id;
1148                 hyper originating_usn;
1149                 hyper local_usn;
1150                 unistr *originating_dsa_obj_dn;
1151         } drsuapi_DsReplicaObjMetaData2;
1152
1153         typedef struct {
1154                 uint32 count;
1155                 int32 enumeration_context;
1156                 [size_is(count)] drsuapi_DsReplicaObjMetaData2 array[];
1157         } drsuapi_DsReplicaObjMetaData2Ctr;
1158
1159         typedef struct {
1160                 unistr *attribute_name;
1161                 unistr *object_dn;
1162                 uint32 value_length;
1163                 [size_is(value_length)] uint8 *value[];
1164                 NTTIME deleted;
1165                 NTTIME created;
1166                 uint32 version;
1167                 NTTIME originating_last_changed;
1168                 GUID originating_dsa_invocation_id;
1169                 hyper originating_usn;
1170                 hyper local_usn;
1171                 unistr *originating_dsa_obj_dn;
1172         } drsuapi_DsReplicaAttrValMetaData2;
1173
1174         typedef struct {
1175                 uint32 count;
1176                 int32 enumeration_context;
1177                 [size_is(count)] drsuapi_DsReplicaAttrValMetaData2 array[];
1178         } drsuapi_DsReplicaAttrValMetaData2Ctr;
1179
1180         typedef struct {
1181                 hyper u1; /* session number? */
1182                 uint32 u2;
1183                 uint32 u3;
1184                 GUID bind_guid;
1185                 NTTIME_1sec bind_time;
1186                 uint32 u4; /* flags? */
1187                 uint32 u5;
1188         } drsuapi_DsReplicaConnection04;
1189
1190         typedef struct {
1191                 [range(0,10000)] uint32 count;
1192                 uint32 reserved;
1193                 [size_is(count)] drsuapi_DsReplicaConnection04 array[];
1194         } drsuapi_DsReplicaConnection04Ctr;
1195
1196         typedef struct {
1197                 unistr *str1;
1198                 uint32 u1;
1199                 uint32 u2;
1200                 uint32 u3;
1201                 uint32 u4;
1202                 uint32 u5;
1203                 hyper u6;
1204                 uint32 u7;
1205         } drsuapi_DsReplica06;
1206
1207         typedef struct {
1208                 [range(0,256)] uint32 count;
1209                 uint32 reserved;
1210                 [size_is(count)] drsuapi_DsReplica06 array[];
1211         } drsuapi_DsReplica06Ctr;
1212
1213         typedef [switch_type(drsuapi_DsReplicaInfoType)] union {
1214                 [case(DRSUAPI_DS_REPLICA_INFO_NEIGHBORS)] drsuapi_DsReplicaNeighbourCtr *neighbours;
1215                 [case(DRSUAPI_DS_REPLICA_INFO_CURSORS)] drsuapi_DsReplicaCoursorCtr *coursors;
1216                 [case(DRSUAPI_DS_REPLICA_INFO_OBJ_METADATA)] drsuapi_DsReplicaObjMetaDataCtr *objmetadata;
1217                 [case(DRSUAPI_DS_REPLICA_INFO_KCC_DSA_CONNECT_FAILURES)] drsuapi_DsReplicaKccDsaFailuresCtr *connectfailures;
1218                 [case(DRSUAPI_DS_REPLICA_INFO_KCC_DSA_LINK_FAILURES)] drsuapi_DsReplicaKccDsaFailuresCtr *linkfailures;
1219                 [case(DRSUAPI_DS_REPLICA_INFO_PENDING_OPS)] drsuapi_DsReplicaOpCtr *pendingops;
1220                 [case(DRSUAPI_DS_REPLICA_INFO_ATTRIBUTE_VALUE_METADATA)] drsuapi_DsReplicaAttrValMetaDataCtr *attrvalmetadata;
1221                 [case(DRSUAPI_DS_REPLICA_INFO_CURSORS2)] drsuapi_DsReplicaCoursor2Ctr *coursors2;
1222                 [case(DRSUAPI_DS_REPLICA_INFO_CURSORS3)] drsuapi_DsReplicaCoursor3Ctr *coursors3;
1223                 [case(DRSUAPI_DS_REPLICA_INFO_OBJ_METADATA2)] drsuapi_DsReplicaObjMetaData2Ctr *objmetadata2;
1224                 [case(DRSUAPI_DS_REPLICA_INFO_ATTRIBUTE_VALUE_METADATA2)] drsuapi_DsReplicaAttrValMetaData2Ctr *attrvalmetadata2;
1225                 [case(DRSUAPI_DS_REPLICA_INFO_NEIGHBORS02)] drsuapi_DsReplicaNeighbourCtr *neighbours02;
1226                 [case(DRSUAPI_DS_REPLICA_INFO_CONNECTIONS04)] drsuapi_DsReplicaConnection04Ctr *connections04;
1227                 [case(DRSUAPI_DS_REPLICA_INFO_CURSURS05)] drsuapi_DsReplicaCoursorCtrEx *coursors05;
1228                 [case(DRSUAPI_DS_REPLICA_INFO_06)] drsuapi_DsReplica06Ctr *i06;
1229         } drsuapi_DsReplicaInfo;
1230
1231         WERROR drsuapi_DsReplicaGetInfo(
1232                 [in,ref] policy_handle *bind_handle,
1233                 [in] drsuapi_DsReplicaGetInfoLevel level,
1234                 [in,switch_is(level)] drsuapi_DsReplicaGetInfoRequest req,
1235                 [out] drsuapi_DsReplicaInfoType info_type,
1236                 [out,switch_is(info_type)] drsuapi_DsReplicaInfo info
1237                 );
1238
1239         /*****************/
1240         /* Function 0x14 */
1241         WERROR DRSUAPI_ADD_SID_HISTORY();
1242
1243         /*****************/
1244         /* Function 0x15 */
1245         WERROR DRSUAPI_GET_MEMBERSHIPS2();
1246
1247         /*****************/
1248         /* Function 0x16 */
1249         WERROR DRSUAPI_REPLICA_VERIFY_OBJECTS();
1250
1251         /*****************/
1252         /* Function 0x17 */
1253         WERROR DRSUAPI_GET_OBJECT_EXISTENCE();
1254
1255         /*****************/
1256         /* Function 0x18 */
1257         WERROR DRSUAPI_QUERY_SITES_BY_COST();
1258 }