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