Remove the 'accoc_group_id' check in the RPC server.
[kai/samba.git] / source4 / librpc / idl / drsuapi.idl
1 #include "idl_types.h"
2
3 import "security.idl", "misc.idl", "samr.idl";
4
5
6   uuid("e3514235-4b06-11d1-ab04-00c04fc2dcd2"),
7   version(4.0),
8   endpoint("ncacn_np:[\\pipe\\lsass]","ncacn_np:[\\pipe\\protected_storage]", "ncacn_ip_tcp:", "ncalrpc:"),
9   authservice("ldap"),
10   helpstring("Active Directory Replication"),
11   helper("librpc/ndr/ndr_drsuapi.h"),
12   pointer_default(unique)
13 ]
14 interface drsuapi
15 {
16         typedef bitmap samr_GroupAttrs samr_GroupAttrs;
17
18         /*****************/
19         /* Function 0x00 */
20         typedef [bitmap32bit] bitmap {
21                 DRSUAPI_SUPPORTED_EXTENSION_BASE                        = 0x00000001,
22                 DRSUAPI_SUPPORTED_EXTENSION_ASYNC_REPLICATION           = 0x00000002,
23                 DRSUAPI_SUPPORTED_EXTENSION_REMOVEAPI                   = 0x00000004,
24                 DRSUAPI_SUPPORTED_EXTENSION_MOVEREQ_V2                  = 0x00000008,
25                 DRSUAPI_SUPPORTED_EXTENSION_GETCHG_COMPRESS             = 0x00000010,
26                 DRSUAPI_SUPPORTED_EXTENSION_DCINFO_V1                   = 0x00000020,
27                 DRSUAPI_SUPPORTED_EXTENSION_RESTORE_USN_OPTIMIZATION    = 0x00000040,
28                 DRSUAPI_SUPPORTED_EXTENSION_00000080                    = 0x00000080,
29                 DRSUAPI_SUPPORTED_EXTENSION_KCC_EXECUTE                 = 0x00000100,
30                 DRSUAPI_SUPPORTED_EXTENSION_ADDENTRY_V2                 = 0x00000200,
31                 DRSUAPI_SUPPORTED_EXTENSION_LINKED_VALUE_REPLICATION    = 0x00000400,
32                 DRSUAPI_SUPPORTED_EXTENSION_DCINFO_V2                   = 0x00000800,
33                 DRSUAPI_SUPPORTED_EXTENSION_INSTANCE_TYPE_NOT_REQ_ON_MOD= 0x00001000,
34                 DRSUAPI_SUPPORTED_EXTENSION_CRYPTO_BIND                 = 0x00002000,
35                 DRSUAPI_SUPPORTED_EXTENSION_GET_REPL_INFO               = 0x00004000,
36                 DRSUAPI_SUPPORTED_EXTENSION_STRONG_ENCRYPTION           = 0x00008000,
37                 DRSUAPI_SUPPORTED_EXTENSION_DCINFO_V01                  = 0x00010000,
38                 DRSUAPI_SUPPORTED_EXTENSION_TRANSITIVE_MEMBERSHIP       = 0x00020000,
39                 DRSUAPI_SUPPORTED_EXTENSION_ADD_SID_HISTORY             = 0x00040000,
40                 DRSUAPI_SUPPORTED_EXTENSION_POST_BETA3                  = 0x00080000,
41                 DRSUAPI_SUPPORTED_EXTENSION_00100000                    = 0x00100000,
42                 DRSUAPI_SUPPORTED_EXTENSION_GET_MEMBERSHIPS2            = 0x00200000,
43                 DRSUAPI_SUPPORTED_EXTENSION_GETCHGREQ_V6                = 0x00400000,
44                 DRSUAPI_SUPPORTED_EXTENSION_NONDOMAIN_NCS               = 0x00800000,
45                 DRSUAPI_SUPPORTED_EXTENSION_GETCHGREQ_V8                = 0x01000000,
46                 DRSUAPI_SUPPORTED_EXTENSION_GETCHGREPLY_V5              = 0x02000000,
47                 DRSUAPI_SUPPORTED_EXTENSION_GETCHGREPLY_V6              = 0x04000000,
48                 /*
49                  * the following 3 have the same value
50                  * repadmin.exe /bind says that
51                  */
52                 DRSUAPI_SUPPORTED_EXTENSION_ADDENTRYREPLY_V3            = 0x08000000,
53                 DRSUAPI_SUPPORTED_EXTENSION_GETCHGREPLY_V7              = 0x08000000,
54                 DRSUAPI_SUPPORTED_EXTENSION_VERIFY_OBJECT               = 0x08000000,
55                 DRSUAPI_SUPPORTED_EXTENSION_XPRESS_COMPRESS             = 0x10000000,
56                 DRSUAPI_SUPPORTED_EXTENSION_20000000                    = 0x20000000,
57                 DRSUAPI_SUPPORTED_EXTENSION_40000000                    = 0x40000000,
58                 DRSUAPI_SUPPORTED_EXTENSION_80000000                    = 0x80000000
59         } drsuapi_SupportedExtensions;
60
61         /* this is used by w2k */
62         typedef struct {
63                 drsuapi_SupportedExtensions supported_extensions;
64                 GUID site_guid;
65                 uint32 u1;
66         } drsuapi_DsBindInfo24;
67
68         /* this is used by w2k3 */
69         typedef struct {
70                 drsuapi_SupportedExtensions supported_extensions;
71                 GUID site_guid;
72                 uint32 u1;
73                 uint32 repl_epoch;
74         } drsuapi_DsBindInfo28;
75
76         typedef struct {
77                 [flag(NDR_REMAINING)] DATA_BLOB info;
78         } drsuapi_DsBindInfoFallBack;
79
80         typedef [nodiscriminant] union {
81                 [case(24)][subcontext(4)] drsuapi_DsBindInfo24 info24;
82                 [case(28)][subcontext(4)] drsuapi_DsBindInfo28 info28;
83                 [default][subcontext(4)] drsuapi_DsBindInfoFallBack FallBack;
84         } drsuapi_DsBindInfo;
85
86         /* the drsuapi_DsBindInfoCtr was this before
87          * typedef [flag(NDR_PAHEX)] struct {
88          *      [range(1,10000)] uint32 length;
89          *      [size_is(length)] uint8 data[];
90          * } drsuapi_DsBindInfo;
91          *
92          * but we don't want the caller to manually decode this blob,
93          * so we're doing it here
94          */
95
96         typedef struct {
97                 [range(1,10000)] uint32 length;
98                 [switch_is(length)] drsuapi_DsBindInfo info;
99         } drsuapi_DsBindInfoCtr;
100
101         /* this is a magic guid you need to pass to DsBind to make drsuapi_DsWriteAccountSpn() work
102          * 
103          * maybe the bind_guid could also be the invocation_id see drsuapi_DsReplicaConnection04
104          */
105         const char *DRSUAPI_DS_BIND_GUID = "e24d201a-4fd6-11d1-a3da-0000f875ae0d";
106         /* 
107          * this magic guid are needed to fetch the whole tree with drsuapi_DsGetNCChanges()
108          * as administrator and this values are also used in the destination_dsa_guid field
109          * of drsuapi_DsGetNCChangesReq5/8 and the source_dsa_guid is zero.
110          */
111         const char *DRSUAPI_DS_BIND_GUID_W2K    = "6abec3d1-3054-41c8-a362-5a0c5b7d5d71";
112         const char *DRSUAPI_DS_BIND_GUID_W2K3   = "6afab99c-6e26-464a-975f-f58f105218bc";
113
114         [public] WERROR drsuapi_DsBind(
115                 [in,unique]         GUID *bind_guid,
116                 [in,out,unique]    drsuapi_DsBindInfoCtr *bind_info,
117                 [out]   policy_handle *bind_handle
118                 );
119
120         /*****************/
121         /* Function 0x01 */
122         WERROR drsuapi_DsUnbind(
123                 [in,out] policy_handle *bind_handle
124                 );
125
126         /*****************/
127         /* Function 0x02 */
128         typedef [public,gensize] struct {
129                 [value(ndr_size_drsuapi_DsReplicaObjectIdentifier(r, ndr->flags)-4)] uint32 __ndr_size;
130                 [value(ndr_size_dom_sid28(&sid, ndr->flags))]  uint32 __ndr_size_sid;
131                 GUID guid;
132                 dom_sid28 sid;
133                 [value(strlen_m(dn))] uint32 __ndr_size_dn;
134                 [charset(UTF16),size_is(__ndr_size_dn+1)] uint16 dn[];
135         } drsuapi_DsReplicaObjectIdentifier;
136
137         typedef [public] bitmap {
138                 DRSUAPI_DS_REPLICA_SYNC_ASYNCHRONOUS_OPERATION  = 0x00000001,
139                 DRSUAPI_DS_REPLICA_SYNC_WRITEABLE               = 0x00000002,
140                 DRSUAPI_DS_REPLICA_SYNC_PERIODIC                = 0x00000004,
141                 DRSUAPI_DS_REPLICA_SYNC_INTERSITE_MESSAGING     = 0x00000008,
142                 DRSUAPI_DS_REPLICA_SYNC_ALL_SOURCES             = 0x00000010,
143                 DRSUAPI_DS_REPLICA_SYNC_FULL                    = 0x00000020,
144                 DRSUAPI_DS_REPLICA_SYNC_URGENT                  = 0x00000040,
145                 DRSUAPI_DS_REPLICA_SYNC_NO_DISCARD              = 0x00000080,
146                 DRSUAPI_DS_REPLICA_SYNC_FORCE                   = 0x00000100,
147                 DRSUAPI_DS_REPLICA_SYNC_ADD_REFERENCE           = 0x00000200,
148                 DRSUAPI_DS_REPLICA_SYNC_NEVER_COMPLETED         = 0x00000400,
149                 DRSUAPI_DS_REPLICA_SYNC_TWO_WAY                 = 0x00000800,
150                 DRSUAPI_DS_REPLICA_SYNC_NEVER_NOTIFY            = 0x00001000,
151                 DRSUAPI_DS_REPLICA_SYNC_INITIAL                 = 0x00002000,
152                 DRSUAPI_DS_REPLICA_SYNC_USE_COMPRESSION         = 0x00004000,
153                 DRSUAPI_DS_REPLICA_SYNC_ABANDONED               = 0x00008000,
154                 DRSUAPI_DS_REPLICA_SYNC_INITIAL_IN_PROGRESS     = 0x00010000,
155                 DRSUAPI_DS_REPLICA_SYNC_PARTIAL_ATTRIBUTE_SET   = 0x00020000,
156                 DRSUAPI_DS_REPLICA_SYNC_REQUEUE                 = 0x00040000,
157                 DRSUAPI_DS_REPLICA_SYNC_NOTIFICATION            = 0x00080000,
158                 DRSUAPI_DS_REPLICA_SYNC_ASYNCHRONOUS_REPLICA    = 0x00100000,
159                 DRSUAPI_DS_REPLICA_SYNC_CRITICAL                = 0x00200000,
160                 DRSUAPI_DS_REPLICA_SYNC_FULL_IN_PROGRESS        = 0x00400000,
161                 DRSUAPI_DS_REPLICA_SYNC_PREEMPTED               = 0x00800000
162         } drsuapi_DsReplicaSyncOptions;
163
164         typedef struct {
165                 drsuapi_DsReplicaObjectIdentifier *naming_context;
166                 GUID source_dsa_guid;
167                 astring *other_info; /* I assume this is related to the repsFromTo1OtherInfo dns_name */
168                 drsuapi_DsReplicaSyncOptions options;
169         } drsuapi_DsReplicaSyncRequest1;
170
171         typedef [switch_type(int32)] union {
172                 [case(1)] drsuapi_DsReplicaSyncRequest1 req1;
173         } drsuapi_DsReplicaSyncRequest;
174
175         WERROR drsuapi_DsReplicaSync(
176                 [in] policy_handle *bind_handle,
177                 [in] int32 level,
178                 [in,switch_is(level)] drsuapi_DsReplicaSyncRequest req
179                 );
180
181         /*****************/
182         /* Function 0x03 */
183         typedef [public] struct {
184                 hyper tmp_highest_usn; /* updated after each object update */
185                 hyper reserved_usn;
186                 hyper highest_usn; /* updated after a full replication cycle */
187         } drsuapi_DsReplicaHighWaterMark;
188
189         typedef [public] struct {
190                 GUID source_dsa_invocation_id; /* the 'invocationId' field of the CN=NTDS Settings object */
191                 hyper highest_usn;  /* updated after a full replication cycle */
192         } drsuapi_DsReplicaCursor;
193
194         typedef struct {
195                 [value(1)] uint32 version;
196                 [value(0)] uint32 reserved1;
197                 [range(0,0x100000)] uint32 count;
198                 [value(0)] uint32 reserved2;
199                 [size_is(count)] drsuapi_DsReplicaCursor cursors[];
200         } drsuapi_DsReplicaCursorCtrEx;
201
202         typedef [public] bitmap {
203                 /* the _WRITEABLE flag indicates a replication with all attributes
204                  *
205                  * --metze
206                  */
207                 DRSUAPI_DS_REPLICA_NEIGHBOUR_WRITEABLE                          = 0x00000010,
208                 DRSUAPI_DS_REPLICA_NEIGHBOUR_SYNC_ON_STARTUP                    = 0x00000020,
209                 DRSUAPI_DS_REPLICA_NEIGHBOUR_DO_SCHEDULED_SYNCS                 = 0x00000040,
210                 DRSUAPI_DS_REPLICA_NEIGHBOUR_USE_ASYNC_INTERSIDE_TRANSPORT      = 0x00000080,
211                 DRSUAPI_DS_REPLICA_NEIGHBOUR_TWO_WAY_SYNC                       = 0x00000200,
212                 DRSUAPI_DS_REPLICA_NEIGHBOUR_RETURN_OBJECT_PARENTS              = 0x00000800,
213                 DRSUAPI_DS_REPLICA_NEIGHBOUR_FULL_IN_PROGRESS                   = 0x00001000, /* was 0x00010000, */
214                 DRSUAPI_DS_REPLICA_NEIGHBOUR_FULL_NEXT_PACKET                   = 0x00002000, /* was 0x00020000, */
215                 DRSUAPI_DS_REPLICA_NEIGHBOUR_NEVER_SYNCED                       = 0x00200000,
216                 DRSUAPI_DS_REPLICA_NEIGHBOUR_PREEMPTED                          = 0x01000000,
217                 DRSUAPI_DS_REPLICA_NEIGHBOUR_IGNORE_CHANGE_NOTIFICATIONS        = 0x04000000,
218                 DRSUAPI_DS_REPLICA_NEIGHBOUR_DISABLE_SCHEDULED_SYNC             = 0x08000000,
219                 /* 
220                  * the following NOTE applies to DsGetNCChangesRequest5:
221                  *  - the data is only compressed when 10 or more objects are replicated
222                  *  - but there could also be a size limit of 35 KBytes or something like that
223                  *  - the reply is DsGetNCChangesCtr2
224                  *  - maybe the same applies to DsGetNCChangesRequest8...
225                  *
226                  *  --metze
227                  */
228                 DRSUAPI_DS_REPLICA_NEIGHBOUR_COMPRESS_CHANGES                   = 0x10000000,
229                 DRSUAPI_DS_REPLICA_NEIGHBOUR_NO_CHANGE_NOTIFICATIONS            = 0x20000000,
230                 DRSUAPI_DS_REPLICA_NEIGHBOUR_PARTIAL_ATTRIBUTE_SET              = 0x40000000
231         } drsuapi_DsReplicaNeighbourFlags;
232
233         typedef [flag(NDR_PAHEX),v1_enum] enum {
234                 DRSUAPI_EXOP_NONE                               = 0x00000000,
235                 DRSUAPI_EXOP_FSMO_REQ_ROLE                      = 0x00000001,
236                 DRSUAPI_EXOP_FSMO_RID_ALLOC                     = 0x00000002,
237                 DRSUAPI_EXOP_FSMO_RID_REQ_ROLE                  = 0x00000003,
238                 DRSUAPI_EXOP_FSMO_REQ_PDC                       = 0x00000004,
239                 DRSUAPI_EXOP_FSMO_ABANDON_ROLE                  = 0x00000005,
240                 DRSUAPI_EXOP_REPL_OBJ                           = 0x00000006,
241                 DRSUAPI_EXOP_REPL_SECRET                        = 0x00000007
242         } drsuapi_DsExtendedOperation;
243
244         typedef [flag(NDR_PAHEX),v1_enum] enum {
245                 DRSUAPI_EXOP_ERR_NONE                           = 0x00000000,
246                 DRSUAPI_EXOP_ERR_SUCCESS                        = 0x00000001,
247                 DRSUAPI_EXOP_ERR_UNKNOWN_OP                     = 0x00000002,
248                 DRSUAPI_EXOP_ERR_FSMO_NOT_OWNER                 = 0x00000003,
249                 DRSUAPI_EXOP_ERR_UPDATE_ERR                     = 0x00000004,
250                 DRSUAPI_EXOP_ERR_EXCEPTION                      = 0x00000005,
251                 DRSUAPI_EXOP_ERR_UNKNOWN_CALLER                 = 0x00000006,
252                 DRSUAPI_EXOP_ERR_RID_ALLOC                      = 0x00000007,
253                 DRSUAPI_EXOP_ERR_FSMO_OWNER_DELETED             = 0x00000008,
254                 DRSUAPI_EXOP_ERR_FMSO_PENDING_OP                = 0x00000009,
255                 DRSUAPI_EXOP_ERR_MISMATCH                       = 0x0000000A,
256                 DRSUAPI_EXOP_ERR_COULDNT_CONTACT                = 0x0000000B,
257                 DRSUAPI_EXOP_ERR_FSMO_REFUSING_ROLES            = 0x0000000C,
258                 DRSUAPI_EXOP_ERR_DIR_ERROR                      = 0x0000000D,
259                 DRSUAPI_EXOP_ERR_FSMO_MISSING_SETTINGS          = 0x0000000E,
260                 DRSUAPI_EXOP_ERR_ACCESS_DENIED                  = 0x0000000F,
261                 DRSUAPI_EXOP_ERR_PARAM_ERROR                    = 0x00000010
262         } drsuapi_DsExtendedError;
263
264         typedef struct {
265                 GUID destination_dsa_guid;
266                 GUID source_dsa_invocation_id; /* the 'invocationId' field of the CN=NTDS Settings object */
267                 [ref] drsuapi_DsReplicaObjectIdentifier *naming_context;
268                 drsuapi_DsReplicaHighWaterMark highwatermark;
269                 drsuapi_DsReplicaCursorCtrEx *uptodateness_vector;
270                 drsuapi_DsReplicaNeighbourFlags replica_flags;
271                 uint32 max_object_count; /* w2k3 uses min(133,max(100,max_object_count)) */
272                 uint32 max_ndr_size; /* w2k3 seems to ignore this */
273                 drsuapi_DsExtendedOperation extended_op;
274                 hyper fsmo_info;
275         } drsuapi_DsGetNCChangesRequest5;
276
277         /*
278          * In DRSUAPI all attributes with syntax 2.5.5.2
279          * are identified by uint32 values
280          *
281          * the following table shows the mapping used between the two representations
282          * e.g. - objectClass 'nTDSDSA' has governsID: 1.2.840.113556.1.5.7000.47
283          *        and a UINT32-ID of '0x0017002F'.
284          *      - so the OID 1.2.840.113556.1.5.7000.47 is splitted into a
285          *        OID-prefix: 1.2.840.113556.1.5.7000
286          *        and a value: 47 => 0x2F
287          *      - the mapping table gives a UINT32-prefix: 0x00170000
288          *      - and the UINT32-ID is 0x0017002F = 0x00170000 | 0x2F
289          *
290          * This prefix mapping table is replied in the drsuapi_DsReplicaOIDMapping_Ctr
291          * array. The following are the default mappings of w2k3
292          *
293          * OID-prefix                   => UINT32-Id prefix
294          *
295          * 2.5.4.*                      => 0x00000000 (standard attributes RFC2256 core.schema)
296          * 2.5.6.*                      => 0x00010000 (standard object classes RFC2256 core.schema)
297          * 1.2.840.113556.1.2.*         => 0x00020000
298          * 1.2.840.113556.1.3.*         => 0x00030000
299          * 2.5.5.*                      => 0x00080000 (attributeSyntax OID's)
300          * 1.2.840.113556.1.4.*         => 0x00090000
301          * 1.2.840.113556.1.5.*         => 0x000A0000
302          * 2.16.840.1.113730.3.*        => 0x00140000
303          * 0.9.2342.19200300.100.1.*    => 0x00150000
304          * 2.16.840.1.113730.3.1.*      => 0x00160000
305          * 1.2.840.113556.1.5.7000.*    => 0x00170000
306          * 2.5.21.*                     => 0x00180000 (attrs for SubSchema)
307          * 2.5.18.*                     => 0x00190000 (createTimeStamp,modifyTimeStamp, SubSchema)
308          * 2.5.20.*                     => 0x001A0000
309          * 1.3.6.1.4.1.1466.101.119.*   => 0x001B0000 (dynamicObject, entryTTL)
310          * 2.16.840.1.113730.3.2.*      => 0x001C0000
311          * 1.3.6.1.4.1.250.1.*          => 0x001D0000
312          * 1.2.840.113549.1.9.*         => 0x001E0000 (unstructuredAddress,unstructuredName)
313          * 0.9.2342.19200300.100.4.*    => 0x001F0000
314          *
315          * Here's a list of used 'attributeSyntax' OID's
316          *
317          * 2.5.5.1      => Object(DS-DN) string
318          *                 struct drsuapi_DsObjectIdentifier3
319          *
320          * 2.5.5.2      => OID-string
321          *              => all values are represented as uint32 values in drsuapi
322          *              => governsID, attributeID and attributeSyntax returned as OID-Strings in LDAP
323          *              => mayContain, mustContain and all other attributes with 2.5.5.2 syntax
324          *                 are returned as attribute names
325          *
326          * 2.5.5.4      => String(Teletex) case-insensitive string with teletex charset
327          *
328          * 2.5.5.5      => String(IA5) case-sensitive string
329          *
330          * 2.5.5.6      => String(Numeric)
331          *              => eg. internationalISDNNumber
332          *
333          * 2.5.5.7      => Object(DN-Binary) B:<byte count>:<bytes>:<object DN>
334          *              => e.g. wellKnownObjects
335          *
336          * 2.5.5.8      => BOOL
337          *
338          * 2.5.5.9      => int32
339          *
340          * 2.5.5.10     => DATA_BLOB
341          *              => struct GUID
342          *
343          * 2.5.5.11     => LDAP timestring
344          *              => NTTIME_1sec
345          *
346          * 2.5.5.12     => String(Unicode) case-insensitive string
347          *              => 'standard strings'
348          *
349          * 2.5.5.13     => Object(Presentation-Address) string
350          *              => used in objectClass applicationEntity
351          *
352          * 2.5.5.14     => Object(DN-String) S:<char count>:<string>:<object DN>
353          *              => not used
354          *
355          * 2.5.5.15     => ntSecurityDescriptor
356          *
357          * 2.5.5.16     => int64
358          *
359          * 2.5.5.17     => dom_sid
360          */
361         typedef [nopush,nopull] struct {
362                 [range(0,10000),value(ndr_size_drsuapi_DsReplicaOID_oid(oid, 0))] uint32 __ndr_size;
363                 [size_is(__ndr_size),charset(DOS)] uint8 *oid; /* it's encoded with asn1_write_OID_String() */
364         } drsuapi_DsReplicaOID;
365
366         typedef struct {
367                 uint32 id_prefix;
368                 drsuapi_DsReplicaOID oid;
369         } drsuapi_DsReplicaOIDMapping;
370
371         typedef [public] struct {
372                 [range(0,0x100000)] uint32 num_mappings;
373                 [size_is(num_mappings)] drsuapi_DsReplicaOIDMapping *mappings;
374         } drsuapi_DsReplicaOIDMapping_Ctr;
375
376         typedef [flag(NDR_PAHEX),v1_enum] enum {
377                 DRSUAPI_OBJECTCLASS_top                 = 0x00010000,
378                 DRSUAPI_OBJECTCLASS_classSchema         = 0x0003000d,
379                 DRSUAPI_OBJECTCLASS_attributeSchema     = 0x0003000e
380         } drsuapi_DsObjectClassId;
381
382         typedef [flag(NDR_PAHEX),v1_enum,public] enum {
383                 DRSUAPI_ATTRIBUTE_objectClass                   = 0x00000000,
384                 DRSUAPI_ATTRIBUTE_description                   = 0x0000000d,
385                 DRSUAPI_ATTRIBUTE_member                        = 0x0000001f,
386                 DRSUAPI_ATTRIBUTE_instanceType                  = 0x00020001,
387                 DRSUAPI_ATTRIBUTE_whenCreated                   = 0x00020002,
388                 DRSUAPI_ATTRIBUTE_hasMasterNCs                  = 0x0002000e,
389                 DRSUAPI_ATTRIBUTE_governsID                     = 0x00020016,
390                 DRSUAPI_ATTRIBUTE_attributeID                   = 0x0002001e,
391                 DRSUAPI_ATTRIBUTE_attributeSyntax               = 0x00020020,
392                 DRSUAPI_ATTRIBUTE_isSingleValued                = 0x00020021,
393                 DRSUAPI_ATTRIBUTE_rangeLower                    = 0x00020022,
394                 DRSUAPI_ATTRIBUTE_rangeUpper                    = 0x00020023,
395                 DRSUAPI_ATTRIBUTE_dMDLocation                   = 0x00020024,
396                 DRSUAPI_ATTRIBUTE_objectVersion                 = 0x0002004c,
397                 DRSUAPI_ATTRIBUTE_invocationId                  = 0x00020073,
398                 DRSUAPI_ATTRIBUTE_showInAdvancedViewOnly        = 0x000200a9,
399                 DRSUAPI_ATTRIBUTE_adminDisplayName              = 0x000200c2,
400                 DRSUAPI_ATTRIBUTE_adminDescription              = 0x000200e2,
401                 DRSUAPI_ATTRIBUTE_oMSyntax                      = 0x000200e7,
402                 DRSUAPI_ATTRIBUTE_ntSecurityDescriptor          = 0x00020119,
403                 DRSUAPI_ATTRIBUTE_searchFlags                   = 0x0002014e,
404                 DRSUAPI_ATTRIBUTE_lDAPDisplayName               = 0x000201cc,
405                 DRSUAPI_ATTRIBUTE_name                          = 0x00090001,
406                 DRSUAPI_ATTRIBUTE_currentValue                  = 0x0009001b,
407                 DRSUAPI_ATTRIBUTE_objectSid                     = 0x00090092,
408                 DRSUAPI_ATTRIBUTE_schemaIDGUID                  = 0x00090094,
409                 DRSUAPI_ATTRIBUTE_dBCSPwd                       = 0x00090037,/* lmPwdHash */
410                 DRSUAPI_ATTRIBUTE_unicodePwd                    = 0x0009005a,/* ntPwdHash */
411                 DRSUAPI_ATTRIBUTE_ntPwdHistory                  = 0x0009005e,
412                 DRSUAPI_ATTRIBUTE_priorValue                    = 0x00090064,
413                 DRSUAPI_ATTRIBUTE_supplementalCredentials       = 0x0009007d,
414                 DRSUAPI_ATTRIBUTE_trustAuthIncoming             = 0x00090081,
415                 DRSUAPI_ATTRIBUTE_trustAuthOutgoing             = 0x00090087,
416                 DRSUAPI_ATTRIBUTE_lmPwdHistory                  = 0x000900a0,
417                 DRSUAPI_ATTRIBUTE_sAMAccountName                = 0x000900dd,
418                 DRSUAPI_ATTRIBUTE_fSMORoleOwner                 = 0x00090171,
419                 DRSUAPI_ATTRIBUTE_systemFlags                   = 0x00090177,
420                 DRSUAPI_ATTRIBUTE_serverReference               = 0x00090203,
421                 DRSUAPI_ATTRIBUTE_serverReferenceBL             = 0x00090204,
422                 DRSUAPI_ATTRIBUTE_initialAuthIncoming           = 0x0009021b,
423                 DRSUAPI_ATTRIBUTE_initialAuthOutgoing           = 0x0009021c,
424                 DRSUAPI_ATTRIBUTE_wellKnownObjects              = 0x0009026a,
425                 DRSUAPI_ATTRIBUTE_isMemberOfPartialAttributeSet = 0x0009027f,
426                 DRSUAPI_ATTRIBUTE_objectCategory                = 0x0009030e,
427                 DRSUAPI_ATTRIBUTE_gPLink                        = 0x0009037b,
428                 DRSUAPI_ATTRIBUTE_msDS_Behavior_Version         = 0x000905b3,
429                 DRSUAPI_ATTRIBUTE_msDS_KeyVersionNumber         = 0x000906f6,           
430                 DRSUAPI_ATTRIBUTE_msDS_HasDomainNCs             = 0x0009071c,
431                 DRSUAPI_ATTRIBUTE_msDS_hasMasterNCs             = 0x0009072c
432         } drsuapi_DsAttributeId;
433
434         typedef struct {
435                 [value(1)] uint32 version;
436                 [value(0)] uint32 reserved1;
437                 [range(1,0x100000)] uint32 num_attids;
438                 [size_is(num_attids)] drsuapi_DsAttributeId attids[];
439         } drsuapi_DsPartialAttributeSet;
440
441         typedef struct {
442                 GUID destination_dsa_guid;
443                 GUID source_dsa_invocation_id; /* the 'invocationId' field of the CN=NTDS Settings object */
444                 [ref] drsuapi_DsReplicaObjectIdentifier *naming_context;
445                 drsuapi_DsReplicaHighWaterMark highwatermark;
446                 drsuapi_DsReplicaCursorCtrEx *uptodateness_vector;
447                 drsuapi_DsReplicaNeighbourFlags replica_flags;
448                 uint32 max_object_count; /* w2k3 uses min(133,max(100,max_object_count)) */
449                 uint32 max_ndr_size; /* w2k3 seems to ignore this */
450                 drsuapi_DsExtendedOperation extended_op;
451                 hyper fsmo_info;
452                 drsuapi_DsPartialAttributeSet *partial_attribute_set;
453                 drsuapi_DsPartialAttributeSet *partial_attribute_set_ex;
454                 drsuapi_DsReplicaOIDMapping_Ctr mapping_ctr;
455         } drsuapi_DsGetNCChangesRequest8;
456
457         typedef [switch_type(int32)] union {
458                 [case(5)] drsuapi_DsGetNCChangesRequest5 req5;
459                 [case(8)] drsuapi_DsGetNCChangesRequest8 req8;
460         } drsuapi_DsGetNCChangesRequest;
461
462         typedef [public] struct {
463                 GUID source_dsa_invocation_id; /* the 'invocationId' field of the CN=NTDS Settings object */
464                 hyper highest_usn;  /* updated after a full replication cycle */
465                 NTTIME last_sync_success;
466         } drsuapi_DsReplicaCursor2;
467
468         typedef struct {
469                 [value(2)] uint32 version;
470                 [value(0)] uint32 reserved1;
471                 [range(0,0x100000)] uint32 count;
472                 [value(0)] uint32 reserved2;
473                 [size_is(count)] drsuapi_DsReplicaCursor2 cursors[];
474         } drsuapi_DsReplicaCursor2CtrEx;
475
476         /* Generic DATA_BLOB values */
477         typedef struct {
478                 [range(0,10485760),value(ndr_size_DATA_BLOB(0,blob,0))] uint32 __ndr_size;
479                 DATA_BLOB *blob;
480         } drsuapi_DsAttributeValue;
481
482         typedef struct {
483                 [range(0,10485760)] uint32 num_values;
484                 [size_is(num_values)] drsuapi_DsAttributeValue *values;
485         } drsuapi_DsAttributeValueCtr;
486
487         /* DN String values */
488         typedef [public,gensize] struct {
489                 [value(ndr_size_drsuapi_DsReplicaObjectIdentifier3(r, ndr->flags))] uint32 __ndr_size;
490                 [value(ndr_size_dom_sid28(&sid,ndr->flags))]  uint32 __ndr_size_sid;
491                 GUID guid;
492                 dom_sid28 sid;
493                 [value(strlen_m(dn))] uint32 __ndr_size_dn;
494                 [charset(UTF16)] uint16 dn[__ndr_size_dn+1];
495         } drsuapi_DsReplicaObjectIdentifier3;
496
497         typedef [public,gensize] struct {
498                 [value(ndr_size_drsuapi_DsReplicaObjectIdentifier3Binary(r, ndr->flags))] uint32 __ndr_size;
499                 [value(ndr_size_dom_sid28(&sid,ndr->flags))]  uint32 __ndr_size_sid;
500                 GUID guid;
501                 dom_sid28 sid;
502                 [value(strlen_m(dn))] uint32 __ndr_size_dn;
503                 [charset(UTF16)] uint16 dn[__ndr_size_dn+1];
504                 [value(binary.length + 4)] uint32 __ndr_size_binary;
505                 [flag(NDR_REMAINING)] DATA_BLOB binary;
506         } drsuapi_DsReplicaObjectIdentifier3Binary;
507
508         typedef [public] struct {
509                 drsuapi_DsAttributeId attid;
510                 drsuapi_DsAttributeValueCtr value_ctr;
511         } drsuapi_DsReplicaAttribute;
512
513         typedef struct {
514                 [range(0,1048576)] uint32 num_attributes;
515                 [size_is(num_attributes)]  drsuapi_DsReplicaAttribute *attributes;
516         } drsuapi_DsReplicaAttributeCtr;
517
518         typedef [public] bitmap {
519                 DRSUAPI_DS_REPLICA_OBJECT_FROM_MASTER   = 0x00000001,
520                 DRSUAPI_DS_REPLICA_OBJECT_DYNAMIC       = 0x00000002,
521                 DRSUAPI_DS_REPLICA_OBJECT_REMOTE_MODIFY = 0x00010000
522         } drsuapi_DsReplicaObjectFlags;
523
524         typedef [public] struct {
525                 drsuapi_DsReplicaObjectIdentifier *identifier;
526                 drsuapi_DsReplicaObjectFlags flags;
527                 drsuapi_DsReplicaAttributeCtr attribute_ctr;
528         } drsuapi_DsReplicaObject;
529
530         typedef struct {
531                 uint32 version;
532                 NTTIME_1sec originating_change_time;
533                 GUID originating_invocation_id;
534                 hyper originating_usn;
535         } drsuapi_DsReplicaMetaData;
536
537         typedef [public] struct {
538                 [range(0,1048576)] uint32 count;
539                 [size_is(count)] drsuapi_DsReplicaMetaData meta_data[];
540         } drsuapi_DsReplicaMetaDataCtr;
541
542         typedef [public,noprint] struct {
543                 drsuapi_DsReplicaObjectListItemEx *next_object;
544                 drsuapi_DsReplicaObject object;
545                 boolean32 is_nc_prefix;
546                 GUID *parent_object_guid;
547                 drsuapi_DsReplicaMetaDataCtr *meta_data_ctr;
548         } drsuapi_DsReplicaObjectListItemEx;
549
550         typedef [public,gensize] struct {
551                 GUID source_dsa_guid; /* the 'objectGUID' field of the CN=NTDS Settings object */
552                 GUID source_dsa_invocation_id; /* the 'invocationId' field of the CN=NTDS Settings object */
553                 drsuapi_DsReplicaObjectIdentifier *naming_context;
554                 drsuapi_DsReplicaHighWaterMark old_highwatermark;
555                 drsuapi_DsReplicaHighWaterMark new_highwatermark;
556                 drsuapi_DsReplicaCursorCtrEx *uptodateness_vector;
557                 drsuapi_DsReplicaOIDMapping_Ctr mapping_ctr;
558                 drsuapi_DsExtendedError extended_ret; /* w2k sends the nc_object_count value here */
559                 uint32 object_count;
560                 /* this +55 is sometimes +56, so I don't know where this comes from... --metze */
561                 [value(ndr_size_drsuapi_DsGetNCChangesCtr1(r,ndr->flags)+55)] uint32 __ndr_size;
562                 drsuapi_DsReplicaObjectListItemEx *first_object;
563                 boolean32 more_data;
564         } drsuapi_DsGetNCChangesCtr1;
565
566         /*
567          * if the DRSUAPI_DS_LINKED_ATTRIBUTE_FLAG_ACTIVE flag
568          * isn't there it means the value is deleted
569          */
570         typedef [public] bitmap {
571                 DRSUAPI_DS_LINKED_ATTRIBUTE_FLAG_ACTIVE = 0x00000001
572         } drsuapi_DsLinkedAttributeFlags;
573
574         typedef [public] struct {
575                 drsuapi_DsReplicaObjectIdentifier *identifier;
576                 drsuapi_DsAttributeId attid;
577                 drsuapi_DsAttributeValue value;
578                 drsuapi_DsLinkedAttributeFlags flags;
579                 NTTIME_1sec originating_add_time;
580                 drsuapi_DsReplicaMetaData meta_data;
581         } drsuapi_DsReplicaLinkedAttribute;
582
583         typedef [public,gensize] struct {
584                 GUID source_dsa_guid; /* the 'objectGUID' field of the CN=NTDS Settings object */
585                 GUID source_dsa_invocation_id; /* the 'invocationId' field of the CN=NTDS Settings object */
586                 drsuapi_DsReplicaObjectIdentifier *naming_context;
587                 drsuapi_DsReplicaHighWaterMark old_highwatermark;
588                 drsuapi_DsReplicaHighWaterMark new_highwatermark;
589                 drsuapi_DsReplicaCursor2CtrEx *uptodateness_vector;
590                 drsuapi_DsReplicaOIDMapping_Ctr mapping_ctr;
591                 drsuapi_DsExtendedError extended_ret;
592                 uint32 object_count;
593                 /* this +55 is sometimes +56, so I don't know where this comes from... --metze */
594                 [value(ndr_size_drsuapi_DsGetNCChangesCtr6(r,ndr->flags)+55)] uint32 __ndr_size;
595                 drsuapi_DsReplicaObjectListItemEx *first_object;
596                 boolean32 more_data;
597                 uint32 nc_object_count; /* estimated amount of objects in the whole NC */
598                 uint32 nc_linked_attributes_count;  /* estimated amount of linked values in the whole NC */
599                 [range(0,1048576)] uint32 linked_attributes_count;
600                 [size_is(linked_attributes_count)] drsuapi_DsReplicaLinkedAttribute *linked_attributes;
601                 WERROR drs_error;
602         } drsuapi_DsGetNCChangesCtr6;
603
604         typedef struct {
605                 uint32 decompressed_length;
606                 uint32 compressed_length;
607                 [subcontext(4),subcontext_size(compressed_length),
608                  compression(NDR_COMPRESSION_MSZIP,compressed_length,decompressed_length)]
609                  drsuapi_DsGetNCChangesCtr1 *ctr1;
610         } drsuapi_DsGetNCChangesMSZIPCtr1;
611
612         typedef struct {
613                 uint32 decompressed_length;
614                 uint32 compressed_length;
615                 [subcontext(4),subcontext_size(compressed_length),
616                  compression(NDR_COMPRESSION_MSZIP,compressed_length,decompressed_length)]
617                  drsuapi_DsGetNCChangesCtr6 *ctr6;
618         } drsuapi_DsGetNCChangesMSZIPCtr6;
619
620         typedef struct {
621                 uint32 decompressed_length;
622                 uint32 compressed_length;
623                 [subcontext(4),subcontext_size(compressed_length),
624                  compression(NDR_COMPRESSION_XPRESS,compressed_length,decompressed_length)]
625                  drsuapi_DsGetNCChangesCtr1 *ctr1;
626         } drsuapi_DsGetNCChangesXPRESSCtr1;
627
628         typedef struct {
629                 uint32 decompressed_length;
630                 uint32 compressed_length;
631                 [subcontext(4),subcontext_size(compressed_length),
632                  compression(NDR_COMPRESSION_XPRESS,compressed_length,decompressed_length)]
633                  drsuapi_DsGetNCChangesCtr6 *ctr6;
634         } drsuapi_DsGetNCChangesXPRESSCtr6;
635
636         typedef [enum16bit] enum {
637                 DRSUAPI_COMPRESSION_TYPE_MSZIP  = 2,
638                 DRSUAPI_COMPRESSION_TYPE_XPRESS = 3
639         } drsuapi_DsGetNCChangesCompressionType;
640
641         typedef [nodiscriminant,flag(NDR_PAHEX)] union {
642                 [case(1|(DRSUAPI_COMPRESSION_TYPE_MSZIP<<16))]  drsuapi_DsGetNCChangesMSZIPCtr1 mszip1;
643                 [case(6|(DRSUAPI_COMPRESSION_TYPE_MSZIP<<16))]  drsuapi_DsGetNCChangesMSZIPCtr6 mszip6;
644                 [case(1|(DRSUAPI_COMPRESSION_TYPE_XPRESS<<16))] drsuapi_DsGetNCChangesXPRESSCtr1 xpress1;
645                 [case(6|(DRSUAPI_COMPRESSION_TYPE_XPRESS<<16))] drsuapi_DsGetNCChangesXPRESSCtr6 xpress6;
646         } drsuapi_DsGetNCChangesCompressedCtr;
647
648         typedef struct {
649                 /* 
650                  * this is a bit ugly, as the compression depends on the flags
651                  * in the DsBind(), but only w2k uses DsGetNCChangesReq5
652                  * and will get DsGetNCChangesCtr2 replies, and w2k only knowns
653                  * about MSZIP and level 1 replies
654                  */
655                 [switch_is(1|(DRSUAPI_COMPRESSION_TYPE_MSZIP<<16))] drsuapi_DsGetNCChangesCompressedCtr ctr;
656         } drsuapi_DsGetNCChangesCtr2;
657
658         typedef struct {
659                 [range(0,6)] int32 level;
660                 [range(2,3)] drsuapi_DsGetNCChangesCompressionType type;
661                 [switch_is(level | (type<<16))] drsuapi_DsGetNCChangesCompressedCtr ctr;
662         } drsuapi_DsGetNCChangesCtr7;
663
664         typedef [switch_type(int32)] union {
665                 [case(1)] drsuapi_DsGetNCChangesCtr1 ctr1;
666                 [case(2)] drsuapi_DsGetNCChangesCtr2 ctr2;
667                 [case(6)] drsuapi_DsGetNCChangesCtr6 ctr6;
668                 [case(7)] drsuapi_DsGetNCChangesCtr7 ctr7;
669         } drsuapi_DsGetNCChangesCtr;
670
671         WERROR drsuapi_DsGetNCChanges(
672                 [in] policy_handle *bind_handle,
673                 [in,out,ref] int32 *level,
674                 [in,switch_is(*level)] drsuapi_DsGetNCChangesRequest req,
675                 [out,switch_is(*level)] drsuapi_DsGetNCChangesCtr ctr
676                 );
677
678         /*****************/
679         /* Function 0x04 */
680         typedef bitmap {
681                 DRSUAPI_DS_REPLICA_UPDATE_ASYNCHRONOUS_OPERATION        = 0x00000001,
682                 DRSUAPI_DS_REPLICA_UPDATE_WRITEABLE                     = 0x00000002,
683                 DRSUAPI_DS_REPLICA_UPDATE_ADD_REFERENCE                 = 0x00000004,
684                 DRSUAPI_DS_REPLICA_UPDATE_DELETE_REFERENCE              = 0x00000008,
685                 DRSUAPI_DS_REPLICA_UPDATE_0x00000010                    = 0x00000010
686         } drsuapi_DsReplicaUpdateRefsOptions;
687
688         typedef struct {
689                 [ref] drsuapi_DsReplicaObjectIdentifier *naming_context;
690                 [ref,charset(DOS),string] uint8 *dest_dsa_dns_name;
691                 GUID dest_dsa_guid;
692                 drsuapi_DsReplicaUpdateRefsOptions options;
693         } drsuapi_DsReplicaUpdateRefsRequest1;
694
695         typedef [switch_type(int32)] union {
696                 [case(1)] drsuapi_DsReplicaUpdateRefsRequest1 req1;
697         } drsuapi_DsReplicaUpdateRefsRequest;
698
699         WERROR drsuapi_DsReplicaUpdateRefs(
700                 [in] policy_handle *bind_handle,
701                 [in] int32 level,
702                 [in,switch_is(level)] drsuapi_DsReplicaUpdateRefsRequest req
703                 );
704
705         /*****************/
706         /* Function 0x05 */
707         typedef bitmap {
708                 DRSUAPI_DS_REPLICA_ADD_ASYNCHRONOUS_OPERATION   = 0x00000001,
709                 DRSUAPI_DS_REPLICA_ADD_WRITEABLE                = 0x00000002
710                 /* TODO ... */
711         } drsuapi_DsReplicaAddOptions;
712
713         [todo] WERROR DRSUAPI_REPLICA_ADD();
714
715         /*****************/
716         /* Function 0x06 */
717         typedef bitmap {
718                 DRSUAPI_DS_REPLICA_DELETE_ASYNCHRONOUS_OPERATION        = 0x00000001,
719                 DRSUAPI_DS_REPLICA_DELETE_WRITEABLE                     = 0x00000002
720                 /* TODO ... */
721         } drsuapi_DsReplicaDeleteOptions;
722
723         [todo] WERROR DRSUAPI_REPLICA_DEL();
724
725         /*****************/
726         /* Function 0x07 */
727         typedef bitmap {
728                 DRSUAPI_DS_REPLICA_MODIFY_ASYNCHRONOUS_OPERATION        = 0x00000001,
729                 DRSUAPI_DS_REPLICA_MODIFY_WRITEABLE                     = 0x00000002
730         } drsuapi_DsReplicaModifyOptions;
731
732         [todo] WERROR DRSUAPI_REPLICA_MODIFY();
733
734         /*****************/
735         /* Function 0x08 */
736         [todo] WERROR DRSUAPI_VERIFY_NAMES();
737
738         /*****************/
739         /* Function 0x09 */
740
741         /* how are type 4 and 7 different from 2 and 3 ? */
742         typedef [v1_enum] enum {
743                 DRSUAPI_DS_MEMBERSHIP_TYPE_UNIVERSAL_AND_DOMAIN_GROUPS = 1,
744                 DRSUAPI_DS_MEMBERSHIP_TYPE_DOMAIN_LOCAL_GROUPS  = 2,
745                 DRSUAPI_DS_MEMBERSHIP_TYPE_DOMAIN_GROUPS        = 3,
746                 DRSUAPI_DS_MEMBERSHIP_TYPE_DOMAIN_LOCAL_GROUPS2 = 4,
747                 DRSUAPI_DS_MEMBERSHIP_TYPE_UNIVERSAL_GROUPS     = 5,
748                 DRSUAPI_DS_MEMBERSHIP_TYPE_GROUPMEMBERS         = 6,
749                 DRSUAPI_DS_MEMBERSHIP_TYPE_DOMAIN_GROUPS2       = 7
750         } drsuapi_DsMembershipType;
751
752         typedef struct {
753                 NTSTATUS status;
754                 [range(0,10000)] uint32 num_memberships;
755                 [range(0,10000)] uint32 num_sids;
756                 [size_is(num_memberships)] drsuapi_DsReplicaObjectIdentifier **info_array;
757                 [size_is(num_memberships)] samr_GroupAttrs *group_attrs;
758                 [size_is(num_sids)] dom_sid28 **sids;
759         } drsuapi_DsGetMembershipsCtr1;
760
761         typedef [switch_type(int32)] union {
762                 [case(1)] drsuapi_DsGetMembershipsCtr1 ctr1;
763         } drsuapi_DsGetMembershipsCtr;
764
765         const int DRSUAPI_DS_MEMBERSHIP_FLAG_GROUP_ATTR = 0x1;
766
767         typedef struct {
768                 [range(1,10000)] uint32 count;
769                 [size_is(count)] drsuapi_DsReplicaObjectIdentifier **info_array;
770                 uint32 flags;
771                 drsuapi_DsMembershipType type;
772                 drsuapi_DsReplicaObjectIdentifier *domain;
773         } drsuapi_DsGetMembershipsRequest1;
774
775         typedef [switch_type(int32)] union {
776                 [case(1)] drsuapi_DsGetMembershipsRequest1 req1;
777         } drsuapi_DsGetMembershipsRequest;
778
779         [todo] WERROR drsuapi_DsGetMemberships(
780                 [in] policy_handle *bind_handle,
781                 [in,out] int32 level,
782                 [in] [switch_is(level)] drsuapi_DsGetMembershipsRequest req,
783                 [out] [switch_is(level)] drsuapi_DsGetMembershipsCtr ctr
784                 );
785
786         /*****************/
787         /* Function 0x0a */
788         [todo] WERROR DRSUAPI_INTER_DOMAIN_MOVE();
789
790         /*****************/
791         /* Function 0x0b */
792         typedef struct {
793                 uint32 unknown1;
794                 uint32 unknown2;
795                 [range(0,0x00A00000)] uint32 length;
796                 [size_is(length)] uint8 *data;
797         } drsuapi_DsGetNT4ChangeLogRequest1;
798
799         typedef [switch_type(uint32)] union {
800                 [case(1)] drsuapi_DsGetNT4ChangeLogRequest1 req1;
801         } drsuapi_DsGetNT4ChangeLogRequest;
802
803         typedef struct {
804                 [range(0,0x00A00000)] uint32 length1;
805                 [range(0,0x00A00000)] uint32 length2;
806                 hyper unknown1;
807                 NTTIME time2;
808                 hyper unknown3;
809                 NTTIME time4;
810                 hyper unknown5;
811                 NTTIME time6;
812                 NTSTATUS status;
813                 [size_is(length1)] uint8 *data1;
814                 [size_is(length2)] uint8 *data2;
815         } drsuapi_DsGetNT4ChangeLogInfo1;
816
817         typedef [switch_type(uint32)] union {
818                 [case(1)] drsuapi_DsGetNT4ChangeLogInfo1 info1;
819         } drsuapi_DsGetNT4ChangeLogInfo;
820
821         [todo] WERROR drsuapi_DsGetNT4ChangeLog(
822                 [in] policy_handle *bind_handle,
823                 [in,out] uint32 level,
824                 [in] [switch_is(level)] drsuapi_DsGetNT4ChangeLogRequest req,
825                 [out] [switch_is(level)] drsuapi_DsGetNT4ChangeLogInfo info
826                 );
827
828         /*****************/
829         /* Function 0x0c */
830         typedef [v1_enum] enum {
831                 DRSUAPI_DS_NAME_STATUS_OK                       = 0,
832                 DRSUAPI_DS_NAME_STATUS_RESOLVE_ERROR            = 1,
833                 DRSUAPI_DS_NAME_STATUS_NOT_FOUND                = 2,
834                 DRSUAPI_DS_NAME_STATUS_NOT_UNIQUE               = 3,
835                 DRSUAPI_DS_NAME_STATUS_NO_MAPPING               = 4,
836                 DRSUAPI_DS_NAME_STATUS_DOMAIN_ONLY              = 5,
837                 DRSUAPI_DS_NAME_STATUS_NO_SYNTACTICAL_MAPPING   = 6,
838                 DRSUAPI_DS_NAME_STATUS_TRUST_REFERRAL           = 7
839         } drsuapi_DsNameStatus;
840
841         typedef [v1_enum] enum {
842                 DRSUAPI_DS_NAME_FLAG_NO_FLAGS                   = 0x0,
843                 DRSUAPI_DS_NAME_FLAG_SYNTACTICAL_ONLY           = 0x1,
844                 DRSUAPI_DS_NAME_FLAG_EVAL_AT_DC                 = 0x2,
845                 DRSUAPI_DS_NAME_FLAG_GCVERIFY                   = 0x4,
846                 DRSUAPI_DS_NAME_FLAG_TRUST_REFERRAL             = 0x8
847         } drsuapi_DsNameFlags;
848
849         typedef [v1_enum] enum {
850                 DRSUAPI_DS_NAME_FORMAT_UKNOWN                   = 0,
851                 DRSUAPI_DS_NAME_FORMAT_FQDN_1779                = 1,
852                 DRSUAPI_DS_NAME_FORMAT_NT4_ACCOUNT              = 2,
853                 DRSUAPI_DS_NAME_FORMAT_DISPLAY                  = 3,
854                 DRSUAPI_DS_NAME_FORMAT_GUID                     = 6,
855                 DRSUAPI_DS_NAME_FORMAT_CANONICAL                = 7,
856                 DRSUAPI_DS_NAME_FORMAT_USER_PRINCIPAL           = 8,
857                 DRSUAPI_DS_NAME_FORMAT_CANONICAL_EX             = 9,
858                 DRSUAPI_DS_NAME_FORMAT_SERVICE_PRINCIPAL        = 10,
859                 DRSUAPI_DS_NAME_FORMAT_SID_OR_SID_HISTORY       = 11,
860                 DRSUAPI_DS_NAME_FORMAT_DNS_DOMAIN               = 12
861         } drsuapi_DsNameFormat;
862
863         typedef struct {
864                 [string,charset(UTF16)] uint16 *str;
865         } drsuapi_DsNameString;
866
867         typedef struct {
868                 uint32 codepage; /* 0x000004e4 - 1252 is german codepage*/
869                 uint32 language; /* 0x00000407 - german language ID*/
870                 drsuapi_DsNameFlags format_flags;
871                 drsuapi_DsNameFormat format_offered;
872                 drsuapi_DsNameFormat format_desired;
873                 [range(1,10000)] uint32 count;
874                 [size_is(count)] drsuapi_DsNameString *names;
875         } drsuapi_DsNameRequest1;
876
877         typedef [switch_type(int32)] union {
878                 [case(1)] drsuapi_DsNameRequest1 req1;
879         } drsuapi_DsNameRequest;
880
881         typedef struct {
882                 drsuapi_DsNameStatus status;
883                 [charset(UTF16),string] uint16 *dns_domain_name;
884                 [charset(UTF16),string] uint16 *result_name;
885         } drsuapi_DsNameInfo1;
886
887         typedef struct {
888                 uint32 count;
889                 [size_is(count)] drsuapi_DsNameInfo1 *array;
890         } drsuapi_DsNameCtr1;
891
892         typedef [switch_type(int32)] union {
893                 [case(1)] drsuapi_DsNameCtr1 *ctr1;
894         } drsuapi_DsNameCtr;
895
896         WERROR drsuapi_DsCrackNames(
897                 [in] policy_handle *bind_handle,
898                 [in, out] int32 level,
899                 [in,switch_is(level)] drsuapi_DsNameRequest req,
900                 [out,switch_is(level)] drsuapi_DsNameCtr ctr
901                 );
902
903         /*****************/
904         /* Function 0x0d */
905         typedef [v1_enum] enum {
906                 DRSUAPI_DS_SPN_OPERATION_ADD    = 0,
907                 DRSUAPI_DS_SPN_OPERATION_REPLACE= 1,
908                 DRSUAPI_DS_SPN_OPERATION_DELETE = 2
909         } drsuapi_DsSpnOperation;
910
911         typedef struct {
912                 drsuapi_DsSpnOperation operation;
913                 uint32 unknown1;
914                 [charset(UTF16),string] uint16 *object_dn;
915                 [range(0,10000)] uint32 count;
916                 [size_is(count)] drsuapi_DsNameString *spn_names;
917         } drsuapi_DsWriteAccountSpnRequest1;
918
919         typedef [switch_type(int32)] union {
920                 [case(1)] drsuapi_DsWriteAccountSpnRequest1 req1;
921         } drsuapi_DsWriteAccountSpnRequest;
922
923         typedef struct {
924                 WERROR status;
925         } drsuapi_DsWriteAccountSpnResult1;
926
927         typedef [switch_type(int32)] union {
928                 [case(1)] drsuapi_DsWriteAccountSpnResult1 res1;
929         } drsuapi_DsWriteAccountSpnResult;
930
931         WERROR drsuapi_DsWriteAccountSpn(
932                 [in] policy_handle *bind_handle,
933                 [in,out] int32 level,
934                 [in,switch_is(level)] drsuapi_DsWriteAccountSpnRequest req,
935                 [out,switch_is(level)] drsuapi_DsWriteAccountSpnResult res
936                 );
937
938         /*****************/
939         /* Function 0x0e */
940         typedef struct {
941                 [charset(UTF16),string] uint16 *server_dn;
942                 [charset(UTF16),string] uint16 *domain_dn;
943                 uint32 unknown; /* 0x000000001 */
944         } drsuapi_DsRemoveDSServerRequest1;
945
946         typedef [switch_type(int32)] union {
947                 [case(1)] drsuapi_DsRemoveDSServerRequest1 req1;
948         } drsuapi_DsRemoveDSServerRequest;
949
950         typedef struct {
951                 WERROR status;
952         } drsuapi_DsRemoveDSServerResult1;
953
954         typedef [switch_type(int32)] union {
955                 [case(1)] drsuapi_DsRemoveDSServerResult1 res1;
956         } drsuapi_DsRemoveDSServerResult;
957
958         WERROR drsuapi_DsRemoveDSServer(
959                 [in] policy_handle *bind_handle,
960                 [in,out] int32 level,
961                 [in,switch_is(level)] drsuapi_DsRemoveDSServerRequest req,
962                 [out,switch_is(level)] drsuapi_DsRemoveDSServerResult res
963                 );
964
965         /*****************/
966         /* Function 0x0f */
967         [todo] WERROR DRSUAPI_REMOVE_DS_DOMAIN();
968
969         /*****************/
970         /* Function 0x10 */
971         typedef struct {
972                 [charset(UTF16),string] uint16 *domain_name; /* netbios or dns */
973                 int32 level; /* specifies the switch level for the request */
974         } drsuapi_DsGetDCInfoRequest1;
975
976         typedef [switch_type(int32)] union {
977                 [case(1)] drsuapi_DsGetDCInfoRequest1 req1;
978         } drsuapi_DsGetDCInfoRequest;
979
980         typedef struct {
981                 [charset(UTF16),string] uint16 *netbios_name;
982                 [charset(UTF16),string] uint16 *dns_name;
983                 [charset(UTF16),string] uint16 *site_name;
984                 [charset(UTF16),string] uint16 *computer_dn;
985                 [charset(UTF16),string] uint16 *server_dn;
986                 uint32 is_pdc;
987                 uint32 is_enabled;
988         } drsuapi_DsGetDCInfo1;
989
990         typedef struct {
991                 [range(0,10000)] uint32 count;
992                 [size_is(count)] drsuapi_DsGetDCInfo1 *array;
993         } drsuapi_DsGetDCInfoCtr1;
994
995         typedef struct {
996                 [charset(UTF16),string] uint16 *netbios_name;
997                 [charset(UTF16),string] uint16 *dns_name;
998                 [charset(UTF16),string] uint16 *site_name;
999                 [charset(UTF16),string] uint16 *site_dn;
1000                 [charset(UTF16),string] uint16 *computer_dn;
1001                 [charset(UTF16),string] uint16 *server_dn;
1002                 [charset(UTF16),string] uint16 *ntds_dn;
1003                 uint32 is_pdc;
1004                 uint32 is_enabled;
1005                 uint32 is_gc;
1006                 GUID site_guid;
1007                 GUID computer_guid;
1008                 GUID server_guid;
1009                 GUID ntds_guid;
1010         } drsuapi_DsGetDCInfo2;
1011
1012         typedef struct {
1013                 [range(0,10000)] uint32 count;
1014                 [size_is(count)] drsuapi_DsGetDCInfo2 *array;
1015         } drsuapi_DsGetDCInfoCtr2;
1016
1017         /*
1018          * this represents an active connection to the
1019          * Directory System Agent (DSA)
1020          * this can be via LDAP or DRSUAPI
1021          */
1022         typedef struct {
1023                 [flag(NDR_BIG_ENDIAN)] ipv4address client_ip_address;
1024                 uint32 unknown2;
1025                 uint32 connection_time; /* in seconds */
1026                 uint32 unknown4;
1027                 uint32 unknown5;
1028                 uint32 unknown6;
1029                 /*
1030                  * client_account can be the following:
1031                  * "W2K3\Administrator"
1032                  * "Administrator@W2K3"
1033                  * "cn=Administrator,cn=Users,DC=w2k3,DC=vmnet1,DC=vm,DC=base"
1034                  * ""
1035                  * or NULL
1036                  */
1037                 [charset(UTF16),string] uint16 *client_account;
1038         } drsuapi_DsGetDCConnection01;
1039
1040         typedef struct {
1041                 [range(0,10000)] uint32 count;
1042                 [size_is(count)] drsuapi_DsGetDCConnection01 *array;
1043         } drsuapi_DsGetDCConnectionCtr01;
1044
1045         typedef [v1_enum] enum {
1046                 DRSUAPI_DC_INFO_CTR_1  = 1,
1047                 DRSUAPI_DC_INFO_CTR_2  = 2,
1048                 DRSUAPI_DC_CONNECTION_CTR_01 = -1
1049         } drsuapi_DsGetDCInfoCtrLevels;
1050
1051         typedef [switch_type(int32)] union {
1052                 [case(DRSUAPI_DC_INFO_CTR_1)]  drsuapi_DsGetDCInfoCtr1  ctr1;
1053                 [case(DRSUAPI_DC_INFO_CTR_2)]  drsuapi_DsGetDCInfoCtr2  ctr2;
1054                 [case(DRSUAPI_DC_CONNECTION_CTR_01)] drsuapi_DsGetDCConnectionCtr01 ctr01;
1055         } drsuapi_DsGetDCInfoCtr;
1056
1057         WERROR drsuapi_DsGetDomainControllerInfo(
1058                 [in] policy_handle *bind_handle,
1059                 [in] int32 level,
1060                 [in,switch_is(level)] drsuapi_DsGetDCInfoRequest req,
1061                 [out] int32 level_out,
1062                 [out,switch_is(level_out)] drsuapi_DsGetDCInfoCtr ctr
1063                 );
1064
1065         /*****************/
1066         /* Function 0x11 */
1067         typedef [public,noprint] struct {
1068                 drsuapi_DsReplicaObjectListItem *next_object;
1069                 drsuapi_DsReplicaObject object;
1070         } drsuapi_DsReplicaObjectListItem;
1071
1072         /*
1073          * The DsAddEntry() call which creates a nTDSDSA object,
1074          * also adds a servicePrincipalName in the following form
1075          * to the computer account of the new domain controller
1076          * referenced by the "serverReferenece" attribute.
1077          *
1078          * E3514235-4B06-11D1-AB04-00C04FC2DCD2/<new-ntdsdsa-object-guid-as-string>/<domain-dns-name>
1079          *
1080          * also note that the "serverReference" isn't added to the new object!
1081          */
1082         const char *DRSUAPI_NTDSDSA_KRB5_SERVICE_GUID = "E3514235-4B06-11D1-AB04-00C04FC2DCD2";
1083
1084         /*
1085          * please note the the current idl
1086          * for DsAddEntry does only parse 
1087          * what I saw between 2 w2k3 boxes
1088          * in my dssync experiments I got some other replies
1089          * so all I want to say is that this is very incomplete yet...
1090          * --metze
1091          */
1092         typedef struct {
1093                 drsuapi_DsReplicaObjectListItem first_object;
1094         } drsuapi_DsAddEntryRequest2;
1095
1096         typedef [switch_type(int32)] union {
1097                 [case(2)] drsuapi_DsAddEntryRequest2 req2;
1098         } drsuapi_DsAddEntryRequest;
1099
1100         typedef struct {
1101                 uint32 unknown1;
1102                 WERROR status;
1103                 uint32 unknown2;
1104                 uint16 unknown3;
1105         } drsuapi_DsAddEntryErrorInfoX;
1106
1107         typedef struct {
1108                 [range(0,10485760)] uint32 size;
1109                 [size_is(size)] uint8 *data;
1110         } drsuapi_DsAddEntryExtraErrorBuffer;
1111
1112         typedef struct {
1113                 drsuapi_DsAddEntryErrorInfoX error;
1114                 drsuapi_DsAttributeId attid;
1115                 uint32 unknown2;
1116                 drsuapi_DsAddEntryExtraErrorBuffer buffer;
1117         } drsuapi_DsAddEntryExtraError1;
1118
1119         typedef /*[noprint]*/ struct {
1120                 drsuapi_DsAddEntryErrorListItem1 *next;
1121                 drsuapi_DsAddEntryExtraError1 error;
1122         } drsuapi_DsAddEntryErrorListItem1;
1123
1124         typedef struct {
1125                 drsuapi_DsReplicaObjectIdentifier *id;
1126                 WERROR status;
1127                 drsuapi_DsAddEntryErrorListItem1 first;
1128         } drsuapi_DsAddEntryErrorInfo1;
1129
1130         typedef [switch_type(uint32)] union {
1131                 [case(1)] drsuapi_DsAddEntryErrorInfo1 error1;
1132 /*              [case(2)] drsuapi_DsAddEntryErrorInfo2 error2;
1133                 [case(3)] drsuapi_DsAddEntryErrorInfo3 error3;
1134 */              [case(4)] drsuapi_DsAddEntryErrorInfoX errorX;
1135                 [case(5)] drsuapi_DsAddEntryErrorInfoX errorX;
1136                 [case(6)] drsuapi_DsAddEntryErrorInfoX errorX;
1137                 [case(7)] drsuapi_DsAddEntryErrorInfoX errorX;
1138         } drsuapi_DsAddEntryErrorInfo;
1139
1140         typedef struct {
1141                 WERROR status;
1142                 uint32 level;
1143                 [switch_is(level)] drsuapi_DsAddEntryErrorInfo *info;
1144         } drsuapi_DsAddEntryError1;
1145
1146         typedef [switch_type(uint32)] union {
1147                 [case(1)] drsuapi_DsAddEntryError1 info1;
1148         } drsuapi_DsAddEntryError;
1149
1150         typedef struct {
1151                 GUID guid;
1152                 dom_sid28 sid;
1153         } drsuapi_DsReplicaObjectIdentifier2;
1154
1155         typedef struct {
1156                 drsuapi_DsReplicaObjectIdentifier *id;
1157                 uint32 unknown1;
1158                 drsuapi_DsAddEntryErrorInfoX error;
1159                 [range(0,10000)] uint32 count;
1160                 [size_is(count)] drsuapi_DsReplicaObjectIdentifier2 *objects;
1161         } drsuapi_DsAddEntryCtr2;
1162
1163         typedef struct {
1164                 drsuapi_DsReplicaObjectIdentifier *id;
1165                 uint32 level;
1166                 [switch_is(level)] drsuapi_DsAddEntryError *error;
1167                 [range(0,10000)] uint32 count;
1168                 [size_is(count)] drsuapi_DsReplicaObjectIdentifier2 *objects;
1169         } drsuapi_DsAddEntryCtr3;
1170
1171         typedef [switch_type(int32)] union {
1172                 [case(2)] drsuapi_DsAddEntryCtr2 ctr2;
1173                 [case(3)] drsuapi_DsAddEntryCtr3 ctr3;
1174         } drsuapi_DsAddEntryCtr;
1175
1176         [public] WERROR drsuapi_DsAddEntry(
1177                 [in] policy_handle *bind_handle,
1178                 [in,out] int32 level,
1179                 [in,switch_is(level)] drsuapi_DsAddEntryRequest req,
1180                 [out,switch_is(level)] drsuapi_DsAddEntryCtr ctr
1181                 );
1182
1183         /*****************/
1184         /* Function 0x12 */
1185         [todo] WERROR DRSUAPI_EXECUTE_KCC();
1186
1187         /*****************/
1188         /* Function 0x13 */
1189         typedef [v1_enum] enum {
1190                 DRSUAPI_DS_REPLICA_GET_INFO                             = 1,
1191                 DRSUAPI_DS_REPLICA_GET_INFO2                            = 2
1192         } drsuapi_DsReplicaGetInfoLevel;
1193
1194         typedef [v1_enum] enum {
1195                 DRSUAPI_DS_REPLICA_INFO_NEIGHBORS                       = 0,
1196                 DRSUAPI_DS_REPLICA_INFO_CURSORS                         = 1,
1197                 DRSUAPI_DS_REPLICA_INFO_OBJ_METADATA                    = 2,
1198                 DRSUAPI_DS_REPLICA_INFO_KCC_DSA_CONNECT_FAILURES        = 3,
1199                 DRSUAPI_DS_REPLICA_INFO_KCC_DSA_LINK_FAILURES           = 4,
1200                 DRSUAPI_DS_REPLICA_INFO_PENDING_OPS                     = 5,
1201                 DRSUAPI_DS_REPLICA_INFO_ATTRIBUTE_VALUE_METADATA        = 6,
1202                 DRSUAPI_DS_REPLICA_INFO_CURSORS2                        = 7,
1203                 DRSUAPI_DS_REPLICA_INFO_CURSORS3                        = 8,
1204                 DRSUAPI_DS_REPLICA_INFO_OBJ_METADATA2                   = 9,
1205                 DRSUAPI_DS_REPLICA_INFO_ATTRIBUTE_VALUE_METADATA2       = 10,
1206                 DRSUAPI_DS_REPLICA_INFO_NEIGHBORS02                     = -2,
1207                 DRSUAPI_DS_REPLICA_INFO_CONNECTIONS04                   = -4,
1208                 DRSUAPI_DS_REPLICA_INFO_CURSORS05                       = -5,
1209                 DRSUAPI_DS_REPLICA_INFO_06                              = -6
1210         } drsuapi_DsReplicaInfoType;
1211
1212         typedef struct {
1213                 drsuapi_DsReplicaInfoType info_type;
1214                 [charset(UTF16),string] uint16 *object_dn;
1215                 GUID guid1;
1216         } drsuapi_DsReplicaGetInfoRequest1;
1217
1218         typedef struct {
1219                 drsuapi_DsReplicaInfoType info_type;
1220                 [charset(UTF16),string] uint16 *object_dn;
1221                 GUID guid1;
1222                 uint32 unknown1;
1223                 [charset(UTF16),string] uint16 *string1;
1224                 [charset(UTF16),string] uint16 *string2;
1225                 uint32 unknown2;
1226         } drsuapi_DsReplicaGetInfoRequest2;
1227
1228         typedef [switch_type(drsuapi_DsReplicaGetInfoLevel)] union {
1229                 [case(DRSUAPI_DS_REPLICA_GET_INFO)] drsuapi_DsReplicaGetInfoRequest1 req1;
1230                 [case(DRSUAPI_DS_REPLICA_GET_INFO2)] drsuapi_DsReplicaGetInfoRequest2 req2;
1231         } drsuapi_DsReplicaGetInfoRequest;
1232
1233         typedef struct {
1234                 [charset(UTF16),string] uint16 *naming_context_dn;
1235                 [charset(UTF16),string] uint16 *source_dsa_obj_dn;
1236                 [charset(UTF16),string] uint16 *source_dsa_address;
1237                 [charset(UTF16),string] uint16 *transport_obj_dn;
1238                 drsuapi_DsReplicaNeighbourFlags replica_flags;
1239                 uint32 reserved;
1240                 GUID naming_context_obj_guid;
1241                 GUID source_dsa_obj_guid;
1242                 GUID source_dsa_invocation_id;
1243                 GUID transport_obj_guid;
1244                 hyper tmp_highest_usn;
1245                 hyper highest_usn;
1246                 NTTIME last_success;
1247                 NTTIME last_attempt;
1248                 WERROR result_last_attempt;
1249                 uint32 consecutive_sync_failures;
1250         } drsuapi_DsReplicaNeighbour;
1251
1252         typedef struct {
1253                 uint32 count;
1254                 uint32 reserved;
1255                 [size_is(count)] drsuapi_DsReplicaNeighbour array[];
1256         } drsuapi_DsReplicaNeighbourCtr;
1257
1258         typedef struct {
1259                 uint32 count;
1260                 uint32 reserved;
1261                 [size_is(count)] drsuapi_DsReplicaCursor array[];
1262         } drsuapi_DsReplicaCursorCtr;
1263
1264         typedef struct {
1265                 [charset(UTF16),string] uint16 *attribute_name;
1266                 uint32 version;
1267                 NTTIME originating_change_time;
1268                 GUID originating_invocation_id;
1269                 hyper originating_usn;
1270                 hyper local_usn;
1271         } drsuapi_DsReplicaObjMetaData;
1272
1273         typedef struct {
1274                 uint32 count;
1275                 uint32 reserved;
1276                 [size_is(count)] drsuapi_DsReplicaObjMetaData array[];
1277         } drsuapi_DsReplicaObjMetaDataCtr;
1278
1279         typedef struct {
1280                 [charset(UTF16),string] uint16 *dsa_obj_dn;
1281                 GUID dsa_obj_guid;
1282                 NTTIME first_failure;
1283                 uint32 num_failures;
1284                 WERROR last_result;
1285         } drsuapi_DsReplicaKccDsaFailure;
1286
1287         typedef struct {
1288                 uint32 count;
1289                 uint32 reserved;
1290                 [size_is(count)] drsuapi_DsReplicaKccDsaFailure array[];
1291         } drsuapi_DsReplicaKccDsaFailuresCtr;
1292
1293         typedef enum {
1294                 DRSUAPI_DS_REPLICA_OP_TYPE_SYNC         = 0,
1295                 DRSUAPI_DS_REPLICA_OP_TYPE_ADD          = 1,
1296                 DRSUAPI_DS_REPLICA_OP_TYPE_DELETE       = 2,
1297                 DRSUAPI_DS_REPLICA_OP_TYPE_MODIFY       = 3,
1298                 DRSUAPI_DS_REPLICA_OP_TYPE_UPDATE_REFS  = 4
1299         } drsuapi_DsReplicaOpType;
1300
1301         typedef [switch_type(drsuapi_DsReplicaOpType)] union {
1302                 [case(DRSUAPI_DS_REPLICA_OP_TYPE_SYNC)]         drsuapi_DsReplicaSyncOptions sync;
1303                 [case(DRSUAPI_DS_REPLICA_OP_TYPE_ADD)]          drsuapi_DsReplicaAddOptions add;
1304                 [case(DRSUAPI_DS_REPLICA_OP_TYPE_DELETE)]       drsuapi_DsReplicaDeleteOptions delete;
1305                 [case(DRSUAPI_DS_REPLICA_OP_TYPE_MODIFY)]       drsuapi_DsReplicaModifyOptions modify;
1306                 [case(DRSUAPI_DS_REPLICA_OP_TYPE_UPDATE_REFS)]  drsuapi_DsReplicaUpdateRefsOptions update_refs;
1307                 [default] uint32 unknown;
1308         } drsuapi_DsRplicaOpOptions;
1309
1310         typedef struct {
1311                 NTTIME operation_start;
1312                 uint32 serial_num; /* unique till reboot */
1313                 uint32 priority;
1314                 drsuapi_DsReplicaOpType operation_type;
1315                 [switch_is(operation_type)] drsuapi_DsRplicaOpOptions options;
1316                 [charset(UTF16),string] uint16 *nc_dn;
1317                 [charset(UTF16),string] uint16 *remote_dsa_obj_dn;
1318                 [charset(UTF16),string] uint16 *remote_dsa_address;
1319                 GUID nc_obj_guid;
1320                 GUID remote_dsa_obj_guid;
1321         } drsuapi_DsReplicaOp;
1322
1323         typedef struct {
1324                 NTTIME time;
1325                 uint32 count;
1326                 [size_is(count)] drsuapi_DsReplicaOp array[];
1327         } drsuapi_DsReplicaOpCtr;
1328
1329         typedef struct {
1330                 [charset(UTF16),string] uint16 *attribute_name;
1331                 [charset(UTF16),string] uint16 *object_dn;
1332                 [value(ndr_size_DATA_BLOB(0,binary,0))] uint32 __ndr_size_binary;
1333                 DATA_BLOB *binary;
1334                 NTTIME deleted;
1335                 NTTIME created;
1336                 uint32 version;
1337                 NTTIME originating_change_time;
1338                 GUID originating_invocation_id;
1339                 hyper originating_usn;
1340                 hyper local_usn;
1341         } drsuapi_DsReplicaAttrValMetaData;
1342
1343         typedef struct {
1344                 uint32 count;
1345                 int32 enumeration_context;
1346                 [size_is(count)] drsuapi_DsReplicaAttrValMetaData array[];
1347         } drsuapi_DsReplicaAttrValMetaDataCtr;
1348
1349         typedef struct {
1350                 uint32 count;
1351                 int32 enumeration_context;
1352                 [size_is(count)] drsuapi_DsReplicaCursor2 array[];
1353         } drsuapi_DsReplicaCursor2Ctr;
1354
1355         typedef struct {
1356                 GUID source_dsa_invocation_id;
1357                 hyper highest_usn;
1358                 NTTIME last_sync_success;
1359                 [charset(UTF16),string] uint16 *source_dsa_obj_dn;
1360         } drsuapi_DsReplicaCursor3;
1361
1362         typedef struct {
1363                 uint32 count;
1364                 int32 enumeration_context;
1365                 [size_is(count)] drsuapi_DsReplicaCursor3 array[];
1366         } drsuapi_DsReplicaCursor3Ctr;
1367
1368         typedef struct {
1369                 [charset(UTF16),string] uint16 *attribute_name;
1370                 uint32 version;
1371                 NTTIME originating_change_time;
1372                 GUID originating_invocation_id;
1373                 hyper originating_usn;
1374                 hyper local_usn;
1375                 [charset(UTF16),string] uint16 *originating_dsa_dn;
1376         } drsuapi_DsReplicaObjMetaData2;
1377
1378         typedef struct {
1379                 uint32 count;
1380                 int32 enumeration_context;
1381                 [size_is(count)] drsuapi_DsReplicaObjMetaData2 array[];
1382         } drsuapi_DsReplicaObjMetaData2Ctr;
1383
1384         typedef struct {
1385                 [charset(UTF16),string] uint16 *attribute_name;
1386                 [charset(UTF16),string] uint16 *object_dn;
1387                 [value(ndr_size_DATA_BLOB(0,binary,0))] uint32 __ndr_size_binary;
1388                 DATA_BLOB *binary;
1389                 NTTIME deleted;
1390                 NTTIME created;
1391                 uint32 version;
1392                 NTTIME originating_change_time;
1393                 GUID originating_invocation_id;
1394                 hyper originating_usn;
1395                 hyper local_usn;
1396                 [charset(UTF16),string] uint16 *originating_dsa_dn;
1397         } drsuapi_DsReplicaAttrValMetaData2;
1398
1399         typedef struct {
1400                 uint32 count;
1401                 int32 enumeration_context;
1402                 [size_is(count)] drsuapi_DsReplicaAttrValMetaData2 array[];
1403         } drsuapi_DsReplicaAttrValMetaData2Ctr;
1404
1405         typedef struct {
1406                 hyper u1; /* session number? */
1407                 uint32 u2;
1408                 uint32 u3;
1409                 GUID bind_guid;
1410                 NTTIME_1sec bind_time;
1411                 [flag(NDR_BIG_ENDIAN)] ipv4address client_ip_address;
1412                 uint32 u5; /* this is the same value the client used as u1 in the DsBindInfoX struct */
1413         } drsuapi_DsReplicaConnection04;
1414
1415         typedef struct {
1416                 [range(0,10000)] uint32 count;
1417                 uint32 reserved;
1418                 [size_is(count)] drsuapi_DsReplicaConnection04 array[];
1419         } drsuapi_DsReplicaConnection04Ctr;
1420
1421         typedef struct {
1422                 [charset(UTF16),string] uint16 *str1;
1423                 uint32 u1;
1424                 uint32 u2;
1425                 uint32 u3;
1426                 uint32 u4;
1427                 uint32 u5;
1428                 hyper u6;
1429                 uint32 u7;
1430         } drsuapi_DsReplica06;
1431
1432         typedef struct {
1433                 [range(0,256)] uint32 count;
1434                 uint32 reserved;
1435                 [size_is(count)] drsuapi_DsReplica06 array[];
1436         } drsuapi_DsReplica06Ctr;
1437
1438         typedef [switch_type(drsuapi_DsReplicaInfoType)] union {
1439                 [case(DRSUAPI_DS_REPLICA_INFO_NEIGHBORS)] drsuapi_DsReplicaNeighbourCtr *neighbours;
1440                 [case(DRSUAPI_DS_REPLICA_INFO_CURSORS)] drsuapi_DsReplicaCursorCtr *cursors;
1441                 [case(DRSUAPI_DS_REPLICA_INFO_OBJ_METADATA)] drsuapi_DsReplicaObjMetaDataCtr *objmetadata;
1442                 [case(DRSUAPI_DS_REPLICA_INFO_KCC_DSA_CONNECT_FAILURES)] drsuapi_DsReplicaKccDsaFailuresCtr *connectfailures;
1443                 [case(DRSUAPI_DS_REPLICA_INFO_KCC_DSA_LINK_FAILURES)] drsuapi_DsReplicaKccDsaFailuresCtr *linkfailures;
1444                 [case(DRSUAPI_DS_REPLICA_INFO_PENDING_OPS)] drsuapi_DsReplicaOpCtr *pendingops;
1445                 [case(DRSUAPI_DS_REPLICA_INFO_ATTRIBUTE_VALUE_METADATA)] drsuapi_DsReplicaAttrValMetaDataCtr *attrvalmetadata;
1446                 [case(DRSUAPI_DS_REPLICA_INFO_CURSORS2)] drsuapi_DsReplicaCursor2Ctr *cursors2;
1447                 [case(DRSUAPI_DS_REPLICA_INFO_CURSORS3)] drsuapi_DsReplicaCursor3Ctr *cursors3;
1448                 [case(DRSUAPI_DS_REPLICA_INFO_OBJ_METADATA2)] drsuapi_DsReplicaObjMetaData2Ctr *objmetadata2;
1449                 [case(DRSUAPI_DS_REPLICA_INFO_ATTRIBUTE_VALUE_METADATA2)] drsuapi_DsReplicaAttrValMetaData2Ctr *attrvalmetadata2;
1450                 [case(DRSUAPI_DS_REPLICA_INFO_NEIGHBORS02)] drsuapi_DsReplicaNeighbourCtr *neighbours02;
1451                 [case(DRSUAPI_DS_REPLICA_INFO_CONNECTIONS04)] drsuapi_DsReplicaConnection04Ctr *connections04;
1452                 [case(DRSUAPI_DS_REPLICA_INFO_CURSORS05)] drsuapi_DsReplicaCursorCtrEx *cursors05;
1453                 [case(DRSUAPI_DS_REPLICA_INFO_06)] drsuapi_DsReplica06Ctr *i06;
1454         } drsuapi_DsReplicaInfo;
1455
1456         WERROR drsuapi_DsReplicaGetInfo(
1457                 [in] policy_handle *bind_handle,
1458                 [in] drsuapi_DsReplicaGetInfoLevel level,
1459                 [in,switch_is(level)] drsuapi_DsReplicaGetInfoRequest req,
1460                 [out] drsuapi_DsReplicaInfoType info_type,
1461                 [out,switch_is(info_type)] drsuapi_DsReplicaInfo info
1462                 );
1463
1464         /*****************/
1465         /* Function 0x14 */
1466         [todo] WERROR DRSUAPI_ADD_SID_HISTORY();
1467
1468         /*****************/
1469         /* Function 0x15 */
1470
1471         typedef struct {
1472                 [range(0,10000)] uint32 num_entries;
1473                 [size_is(num_entries)] drsuapi_DsGetMembershipsCtr1 **ctrl_array;
1474         } drsuapi_DsGetMemberships2Ctr1;
1475
1476         typedef [switch_type(int32)] union {
1477                 [case(1)] drsuapi_DsGetMembershipsCtr1 ctr1;
1478         } drsuapi_DsGetMemberships2Ctr;
1479
1480         typedef struct {
1481                 [range(1,10000)] uint32 num_req;
1482                 [size_is(num_req)] drsuapi_DsGetMembershipsRequest1 **req_array;
1483         } drsuapi_DsGetMemberships2Request1;
1484
1485         typedef [switch_type(int32)] union {
1486                 [case(1)] drsuapi_DsGetMemberships2Request1 req1;
1487         } drsuapi_DsGetMemberships2Request;
1488
1489         WERROR drsuapi_DsGetMemberships2(
1490                 [in] policy_handle *bind_handle,
1491                 [in,out] int32 level,
1492                 [in] [switch_is(level)] drsuapi_DsGetMemberships2Request req,
1493                 [out] [switch_is(level)] drsuapi_DsGetMemberships2Ctr ctr
1494                 );
1495
1496
1497         /*****************/
1498         /* Function 0x16 */
1499         [todo] WERROR DRSUAPI_REPLICA_VERIFY_OBJECTS();
1500
1501         /*****************/
1502         /* Function 0x17 */
1503         [todo] WERROR DRSUAPI_GET_OBJECT_EXISTENCE();
1504
1505         /*****************/
1506         /* Function 0x18 */
1507         typedef struct {
1508                 WERROR error_code;
1509                 uint32 site_cost;
1510         } drsuapi_DsSiteCostInfo;
1511
1512         typedef struct {
1513                 [range(0,10000)] uint32 num_info;
1514                 [size_is(num_info)] drsuapi_DsSiteCostInfo *info;
1515                 uint32 unknown;
1516         } drsuapi_QuerySitesByCostCtr1;
1517
1518         typedef [switch_type(int32)] union {
1519                 [case(1)] drsuapi_QuerySitesByCostCtr1 ctr1;
1520         } drsuapi_QuerySitesByCostCtr;
1521
1522         typedef struct {
1523                 [charset(UTF16),string] uint16 *site_from;
1524                 [range(1,10000)] uint32 num_req;
1525                 [size_is(num_req)] [charset(UTF16),string] uint16 **site_to;
1526                 uint32 flags;
1527         } drsuapi_QuerySitesByCostRequest1;
1528
1529         typedef [switch_type(int32)] union {
1530                 [case(1)] drsuapi_QuerySitesByCostRequest1 req1;
1531         } drsuapi_QuerySitesByCostRequest;
1532
1533         WERROR drsuapi_QuerySitesByCost(
1534                 [in] policy_handle *bind_handle,
1535                 [in] int32 level,
1536                 [in] [switch_is(level)] drsuapi_QuerySitesByCostRequest req,
1537                 [out] int32 level_out,
1538                 [out] [switch_is(level_out)] drsuapi_QuerySitesByCostCtr ctr
1539         );
1540 }