idl: Use DRSUAPI_ATTID_ prefix instead of DRSUAPI_ATTRIBUTE_ for ATTID values
[sfrench/samba-autobuild/.git] / librpc / idl / drsuapi.idl
1 #include "idl_types.h"
2
3 import "security.idl", "misc.idl", "lsa.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         /* see MS-DRSR section 5.39 */
19         typedef [public,bitmap32bit] bitmap {
20                 DRSUAPI_DRS_ASYNC_OP                  = 0x00000001,
21                 DRSUAPI_DRS_GETCHG_CHECK              = 0x00000002,
22                 DRSUAPI_DRS_UPDATE_NOTIFICATION       = 0x00000002,
23                 DRSUAPI_DRS_ADD_REF                   = 0x00000004,
24                 DRSUAPI_DRS_SYNC_ALL                  = 0x00000008,
25                 DRSUAPI_DRS_DEL_REF                   = 0x00000008,
26                 DRSUAPI_DRS_WRIT_REP                  = 0x00000010,
27                 DRSUAPI_DRS_INIT_SYNC                 = 0x00000020,
28                 DRSUAPI_DRS_PER_SYNC                  = 0x00000040,
29                 DRSUAPI_DRS_MAIL_REP                  = 0x00000080,
30                 DRSUAPI_DRS_ASYNC_REP                 = 0x00000100,
31                 DRSUAPI_DRS_IGNORE_ERROR              = 0x00000100,
32                 DRSUAPI_DRS_TWOWAY_SYNC               = 0x00000200,
33                 DRSUAPI_DRS_CRITICAL_ONLY             = 0x00000400,
34                 DRSUAPI_DRS_GET_ANC                   = 0x00000800,
35                 DRSUAPI_DRS_GET_NC_SIZE               = 0x00001000,
36                 DRSUAPI_DRS_LOCAL_ONLY                = 0x00001000,
37                 DRSUAPI_DRS_NONGC_RO_REP              = 0x00002000,
38                 DRSUAPI_DRS_SYNC_BYNAME               = 0x00004000,
39                 DRSUAPI_DRS_REF_OK                    = 0x00004000,
40                 DRSUAPI_DRS_FULL_SYNC_NOW             = 0x00008000,
41                 DRSUAPI_DRS_NO_SOURCE                 = 0x00008000,
42                 DRSUAPI_DRS_FULL_SYNC_IN_PROGRESS     = 0x00010000,
43                 DRSUAPI_DRS_FULL_SYNC_PACKET          = 0x00020000,
44                 DRSUAPI_DRS_SYNC_REQUEUE              = 0x00040000,
45                 DRSUAPI_DRS_SYNC_URGENT               = 0x00080000,
46                 DRSUAPI_DRS_REF_GCSPN                 = 0x00100000,
47                 DRSUAPI_DRS_NO_DISCARD                = 0x00100000,
48                 DRSUAPI_DRS_NEVER_SYNCED              = 0x00200000,
49                 DRSUAPI_DRS_SPECIAL_SECRET_PROCESSING = 0x00400000,
50                 DRSUAPI_DRS_INIT_SYNC_NOW             = 0x00800000,
51                 DRSUAPI_DRS_PREEMPTED                 = 0x01000000,
52                 DRSUAPI_DRS_SYNC_FORCED               = 0x02000000,
53                 DRSUAPI_DRS_DISABLE_AUTO_SYNC         = 0x04000000,
54                 DRSUAPI_DRS_DISABLE_PERIODIC_SYNC     = 0x08000000,
55                 DRSUAPI_DRS_USE_COMPRESSION           = 0x10000000,
56                 DRSUAPI_DRS_NEVER_NOTIFY              = 0x20000000,
57                 DRSUAPI_DRS_SYNC_PAS                  = 0x40000000,
58                 DRSUAPI_DRS_GET_ALL_GROUP_MEMBERSHIP  = 0x80000000
59         } drsuapi_DrsOptions;
60
61         /*****************/
62         /* Function 0x00 */
63         typedef [bitmap32bit] bitmap {
64                 DRSUAPI_SUPPORTED_EXTENSION_BASE                        = 0x00000001,
65                 DRSUAPI_SUPPORTED_EXTENSION_ASYNC_REPLICATION           = 0x00000002,
66                 DRSUAPI_SUPPORTED_EXTENSION_REMOVEAPI                   = 0x00000004,
67                 DRSUAPI_SUPPORTED_EXTENSION_MOVEREQ_V2                  = 0x00000008,
68                 DRSUAPI_SUPPORTED_EXTENSION_GETCHG_COMPRESS             = 0x00000010,
69                 DRSUAPI_SUPPORTED_EXTENSION_DCINFO_V1                   = 0x00000020,
70                 DRSUAPI_SUPPORTED_EXTENSION_RESTORE_USN_OPTIMIZATION    = 0x00000040,
71                 DRSUAPI_SUPPORTED_EXTENSION_ADDENTRY                    = 0x00000080,
72                 DRSUAPI_SUPPORTED_EXTENSION_KCC_EXECUTE                 = 0x00000100,
73                 DRSUAPI_SUPPORTED_EXTENSION_ADDENTRY_V2                 = 0x00000200,
74                 DRSUAPI_SUPPORTED_EXTENSION_LINKED_VALUE_REPLICATION    = 0x00000400,
75                 DRSUAPI_SUPPORTED_EXTENSION_DCINFO_V2                   = 0x00000800,
76                 DRSUAPI_SUPPORTED_EXTENSION_INSTANCE_TYPE_NOT_REQ_ON_MOD= 0x00001000,
77                 DRSUAPI_SUPPORTED_EXTENSION_CRYPTO_BIND                 = 0x00002000,
78                 DRSUAPI_SUPPORTED_EXTENSION_GET_REPL_INFO               = 0x00004000,
79                 DRSUAPI_SUPPORTED_EXTENSION_STRONG_ENCRYPTION           = 0x00008000,
80                 DRSUAPI_SUPPORTED_EXTENSION_DCINFO_V01                  = 0x00010000,
81                 DRSUAPI_SUPPORTED_EXTENSION_TRANSITIVE_MEMBERSHIP       = 0x00020000,
82                 DRSUAPI_SUPPORTED_EXTENSION_ADD_SID_HISTORY             = 0x00040000,
83                 DRSUAPI_SUPPORTED_EXTENSION_POST_BETA3                  = 0x00080000,
84                 DRSUAPI_SUPPORTED_EXTENSION_GETCHGREQ_V5                = 0x00100000,
85                 DRSUAPI_SUPPORTED_EXTENSION_GET_MEMBERSHIPS2            = 0x00200000,
86                 DRSUAPI_SUPPORTED_EXTENSION_GETCHGREQ_V6                = 0x00400000,
87                 DRSUAPI_SUPPORTED_EXTENSION_NONDOMAIN_NCS               = 0x00800000,
88                 DRSUAPI_SUPPORTED_EXTENSION_GETCHGREQ_V8                = 0x01000000,
89                 DRSUAPI_SUPPORTED_EXTENSION_GETCHGREPLY_V5              = 0x02000000,
90                 DRSUAPI_SUPPORTED_EXTENSION_GETCHGREPLY_V6              = 0x04000000,
91                 /*
92                  * the following 3 have the same value
93                  * repadmin.exe /bind says that
94                  */
95                 DRSUAPI_SUPPORTED_EXTENSION_ADDENTRYREPLY_V3            = 0x08000000,
96                 DRSUAPI_SUPPORTED_EXTENSION_GETCHGREPLY_V7              = 0x08000000,
97                 DRSUAPI_SUPPORTED_EXTENSION_VERIFY_OBJECT               = 0x08000000,
98                 DRSUAPI_SUPPORTED_EXTENSION_XPRESS_COMPRESS             = 0x10000000,
99                 DRSUAPI_SUPPORTED_EXTENSION_GETCHGREQ_V10               = 0x20000000,
100                 DRSUAPI_SUPPORTED_EXTENSION_RESERVED_PART2              = 0x40000000,
101                 DRSUAPI_SUPPORTED_EXTENSION_RESERVED_PART3              = 0x80000000
102         } drsuapi_SupportedExtensions;
103
104         typedef [bitmap32bit] bitmap {
105                 DRSUAPI_SUPPORTED_EXTENSION_ADAM                        = 0x00000001,
106                 DRSUAPI_SUPPORTED_EXTENSION_LH_BETA2                    = 0x00000002,
107                 DRSUAPI_SUPPORTED_EXTENSION_RECYCLE_BIN                 = 0x00000004
108         } drsuapi_SupportedExtensionsExt;
109
110         /* this is used by w2k */
111         typedef struct {
112                 drsuapi_SupportedExtensions supported_extensions;
113                 GUID site_guid;
114                 uint32 pid;
115         } drsuapi_DsBindInfo24;
116
117         /* this is used by w2k3 */
118         typedef struct {
119                 drsuapi_SupportedExtensions supported_extensions;
120                 GUID site_guid;
121                 uint32 pid;
122                 uint32 repl_epoch;
123         } drsuapi_DsBindInfo28;
124
125         /* this is used by w2k8 */
126         typedef struct {
127                 drsuapi_SupportedExtensions supported_extensions;
128                 GUID site_guid;
129                 uint32 pid;
130                 uint32 repl_epoch;
131                 drsuapi_SupportedExtensionsExt supported_extensions_ext;
132                 GUID config_dn_guid;
133         } drsuapi_DsBindInfo48;
134
135         typedef struct {
136                 [flag(NDR_REMAINING)] DATA_BLOB info;
137         } drsuapi_DsBindInfoFallBack;
138
139         typedef [nodiscriminant] union {
140                 [case(24)][subcontext(4)] drsuapi_DsBindInfo24 info24;
141                 [case(28)][subcontext(4)] drsuapi_DsBindInfo28 info28;
142                 [case(48)][subcontext(4)] drsuapi_DsBindInfo48 info48;
143                 [default][subcontext(4)] drsuapi_DsBindInfoFallBack FallBack;
144         } drsuapi_DsBindInfo;
145
146         /* the drsuapi_DsBindInfoCtr was this before
147          * typedef [flag(NDR_PAHEX)] struct {
148          *      [range(1,10000)] uint32 length;
149          *      [size_is(length)] uint8 data[];
150          * } drsuapi_DsBindInfo;
151          *
152          * but we don't want the caller to manually decode this blob,
153          * so we're doing it here
154          */
155
156         typedef struct {
157                 [range(1,10000)] uint32 length;
158                 [switch_is(length)] drsuapi_DsBindInfo info;
159         } drsuapi_DsBindInfoCtr;
160
161         /* this is a magic guid you need to pass to DsBind to make drsuapi_DsWriteAccountSpn() work
162          *
163          * maybe the bind_guid could also be the invocation_id see drsuapi_DsReplicaConnection04
164          */
165         const char *DRSUAPI_DS_BIND_GUID = "e24d201a-4fd6-11d1-a3da-0000f875ae0d";
166         /*
167          * this magic guid are needed to fetch the whole tree with drsuapi_DsGetNCChanges()
168          * as administrator and this values are also used in the destination_dsa_guid field
169          * of drsuapi_DsGetNCChangesReq5/8 and the source_dsa_guid is zero.
170          */
171         const char *DRSUAPI_DS_BIND_GUID_W2K    = "6abec3d1-3054-41c8-a362-5a0c5b7d5d71";
172         const char *DRSUAPI_DS_BIND_GUID_W2K3   = "6afab99c-6e26-464a-975f-f58f105218bc";
173
174         [public] WERROR drsuapi_DsBind(
175                 [in,unique]         GUID *bind_guid,
176                 [in,out,unique]    drsuapi_DsBindInfoCtr *bind_info,
177                 [out]   policy_handle *bind_handle
178                 );
179
180         /*****************/
181         /* Function 0x01 */
182         WERROR drsuapi_DsUnbind(
183                 [in,out] policy_handle *bind_handle
184                 );
185
186         /*****************/
187         /* Function 0x02 */
188         typedef [public,gensize] struct {
189                 [value(ndr_size_drsuapi_DsReplicaObjectIdentifier(r, ndr->flags)-4)] uint32 __ndr_size;
190                 [value(ndr_size_dom_sid28(&sid, ndr->flags))]  uint32 __ndr_size_sid;
191                 GUID guid;
192                 dom_sid28 sid;
193                 [value(strlen_m(dn))] uint32 __ndr_size_dn;
194                 [charset(UTF16),size_is(__ndr_size_dn+1)] uint16 dn[];
195         } drsuapi_DsReplicaObjectIdentifier;
196
197         typedef struct {
198                 [ref] drsuapi_DsReplicaObjectIdentifier *naming_context;
199                 GUID source_dsa_guid;
200                 astring *source_dsa_dns; /* Source DSA dns_name in <guid>._msdcs.<domain_dns> form */
201                 drsuapi_DrsOptions options;
202         } drsuapi_DsReplicaSyncRequest1;
203
204         typedef [switch_type(uint32)] union {
205                 [case(1)] drsuapi_DsReplicaSyncRequest1 req1;
206         } drsuapi_DsReplicaSyncRequest;
207
208         WERROR drsuapi_DsReplicaSync(
209                 [in] policy_handle *bind_handle,
210                 [in] uint32 level,
211                 [in,switch_is(level)] drsuapi_DsReplicaSyncRequest *req
212                 );
213
214         /*****************/
215         /* Function 0x03 */
216         typedef [public] struct {
217                 hyper tmp_highest_usn; /* updated after each object update */
218                 hyper reserved_usn;
219                 hyper highest_usn; /* updated after a full replication cycle */
220         } drsuapi_DsReplicaHighWaterMark;
221
222         typedef [public] struct {
223                 GUID source_dsa_invocation_id; /* the 'invocationId' field of the CN=NTDS Settings object */
224                 hyper highest_usn;  /* updated after a full replication cycle */
225         } drsuapi_DsReplicaCursor;
226
227         typedef struct {
228                 [value(1)] uint32 version;
229                 [value(0)] uint32 reserved1;
230                 [range(0,0x100000)] uint32 count;
231                 [value(0)] uint32 reserved2;
232                 [size_is(count)] drsuapi_DsReplicaCursor cursors[];
233         } drsuapi_DsReplicaCursorCtrEx;
234
235         typedef [flag(NDR_PAHEX),v1_enum] enum {
236                 DRSUAPI_EXOP_NONE                               = 0x00000000,
237                 DRSUAPI_EXOP_FSMO_REQ_ROLE                      = 0x00000001,
238                 DRSUAPI_EXOP_FSMO_RID_ALLOC                     = 0x00000002,
239                 DRSUAPI_EXOP_FSMO_RID_REQ_ROLE                  = 0x00000003,
240                 DRSUAPI_EXOP_FSMO_REQ_PDC                       = 0x00000004,
241                 DRSUAPI_EXOP_FSMO_ABANDON_ROLE                  = 0x00000005,
242                 DRSUAPI_EXOP_REPL_OBJ                           = 0x00000006,
243                 DRSUAPI_EXOP_REPL_SECRET                        = 0x00000007
244         } drsuapi_DsExtendedOperation;
245
246         typedef [flag(NDR_PAHEX),v1_enum] enum {
247                 DRSUAPI_EXOP_ERR_NONE                           = 0x00000000,
248                 DRSUAPI_EXOP_ERR_SUCCESS                        = 0x00000001,
249                 DRSUAPI_EXOP_ERR_UNKNOWN_OP                     = 0x00000002,
250                 DRSUAPI_EXOP_ERR_FSMO_NOT_OWNER                 = 0x00000003,
251                 DRSUAPI_EXOP_ERR_UPDATE_ERR                     = 0x00000004,
252                 DRSUAPI_EXOP_ERR_EXCEPTION                      = 0x00000005,
253                 DRSUAPI_EXOP_ERR_UNKNOWN_CALLER                 = 0x00000006,
254                 DRSUAPI_EXOP_ERR_RID_ALLOC                      = 0x00000007,
255                 DRSUAPI_EXOP_ERR_FSMO_OWNER_DELETED             = 0x00000008,
256                 DRSUAPI_EXOP_ERR_FMSO_PENDING_OP                = 0x00000009,
257                 DRSUAPI_EXOP_ERR_MISMATCH                       = 0x0000000A,
258                 DRSUAPI_EXOP_ERR_COULDNT_CONTACT                = 0x0000000B,
259                 DRSUAPI_EXOP_ERR_FSMO_REFUSING_ROLES            = 0x0000000C,
260                 DRSUAPI_EXOP_ERR_DIR_ERROR                      = 0x0000000D,
261                 DRSUAPI_EXOP_ERR_FSMO_MISSING_SETTINGS          = 0x0000000E,
262                 DRSUAPI_EXOP_ERR_ACCESS_DENIED                  = 0x0000000F,
263                 DRSUAPI_EXOP_ERR_PARAM_ERROR                    = 0x00000010
264         } drsuapi_DsExtendedError;
265
266         typedef struct {
267                 GUID destination_dsa_guid;
268                 GUID source_dsa_invocation_id; /* the 'invocationId' field of the CN=NTDS Settings object */
269                 [ref] drsuapi_DsReplicaObjectIdentifier *naming_context;
270                 drsuapi_DsReplicaHighWaterMark highwatermark;
271                 drsuapi_DsReplicaCursorCtrEx *uptodateness_vector;
272                 drsuapi_DrsOptions replica_flags;
273                 uint32 max_object_count; /* w2k3 uses min(133,max(100,max_object_count)) */
274                 uint32 max_ndr_size; /* w2k3 seems to ignore this */
275                 drsuapi_DsExtendedOperation extended_op;
276                 hyper fsmo_info;
277         } drsuapi_DsGetNCChangesRequest5;
278
279         /*
280          * In DRSUAPI all attributes with syntax 2.5.5.2
281          * are identified by uint32 values
282          *
283          * the following table shows the mapping used between the two representations
284          * e.g. - objectClass 'nTDSDSA' has governsID: 1.2.840.113556.1.5.7000.47
285          *        and a UINT32-ID of '0x0017002F'.
286          *      - so the OID 1.2.840.113556.1.5.7000.47 is splitted into a
287          *        OID-prefix: 1.2.840.113556.1.5.7000
288          *        and a value: 47 => 0x2F
289          *      - the mapping table gives a UINT32-prefix: 0x00170000
290          *      - and the UINT32-ID is 0x0017002F = 0x00170000 | 0x2F
291          *
292          * This prefix mapping table is replied in the drsuapi_DsReplicaOIDMapping_Ctr
293          * array. The following are the default mappings of w2k3
294          *
295          * OID-prefix                   => UINT32-Id prefix
296          *
297          * 2.5.4.*                      => 0x00000000 (standard attributes RFC2256 core.schema)
298          * 2.5.6.*                      => 0x00010000 (standard object classes RFC2256 core.schema)
299          * 1.2.840.113556.1.2.*         => 0x00020000
300          * 1.2.840.113556.1.3.*         => 0x00030000
301          * 2.5.5.*                      => 0x00080000 (attributeSyntax OID's)
302          * 1.2.840.113556.1.4.*         => 0x00090000
303          * 1.2.840.113556.1.5.*         => 0x000A0000
304          * 2.16.840.1.113730.3.*        => 0x00140000
305          * 0.9.2342.19200300.100.1.*    => 0x00150000
306          * 2.16.840.1.113730.3.1.*      => 0x00160000
307          * 1.2.840.113556.1.5.7000.*    => 0x00170000
308          * 2.5.21.*                     => 0x00180000 (attrs for SubSchema)
309          * 2.5.18.*                     => 0x00190000 (createTimeStamp,modifyTimeStamp, SubSchema)
310          * 2.5.20.*                     => 0x001A0000
311          * 1.3.6.1.4.1.1466.101.119.*   => 0x001B0000 (dynamicObject, entryTTL)
312          * 2.16.840.1.113730.3.2.*      => 0x001C0000
313          * 1.3.6.1.4.1.250.1.*          => 0x001D0000
314          * 1.2.840.113549.1.9.*         => 0x001E0000 (unstructuredAddress,unstructuredName)
315          * 0.9.2342.19200300.100.4.*    => 0x001F0000
316          *
317          * Here's a list of used 'attributeSyntax' OID's
318          *
319          * 2.5.5.1      => Object(DS-DN) string
320          *                 struct drsuapi_DsObjectIdentifier3
321          *
322          * 2.5.5.2      => OID-string
323          *              => all values are represented as uint32 values in drsuapi
324          *              => governsID, attributeID and attributeSyntax returned as OID-Strings in LDAP
325          *              => mayContain, mustContain and all other attributes with 2.5.5.2 syntax
326          *                 are returned as attribute names
327          *
328          * 2.5.5.4      => String(Teletex) case-insensitive string with teletex charset
329          *
330          * 2.5.5.5      => String(IA5) case-sensitive string
331          *
332          * 2.5.5.6      => String(Numeric)
333          *              => eg. internationalISDNNumber
334          *
335          * 2.5.5.7      => Object(DN-Binary) B:<byte count>:<bytes>:<object DN>
336          *              => e.g. wellKnownObjects
337          *
338          * 2.5.5.8      => BOOL
339          *
340          * 2.5.5.9      => int32
341          *
342          * 2.5.5.10     => DATA_BLOB
343          *              => struct GUID
344          *
345          * 2.5.5.11     => LDAP timestring
346          *              => NTTIME_1sec
347          *
348          * 2.5.5.12     => String(Unicode) case-insensitive string
349          *              => 'standard strings'
350          *
351          * 2.5.5.13     => Object(Presentation-Address) string
352          *              => used in objectClass applicationEntity
353          *
354          * 2.5.5.14     => Object(DN-String) S:<char count>:<string>:<object DN>
355          *              => not used
356          *
357          * 2.5.5.15     => ntSecurityDescriptor
358          *
359          * 2.5.5.16     => int64
360          *
361          * 2.5.5.17     => dom_sid
362          */
363         typedef [noprint] struct {
364                 [range(0,10000)] uint32 length;
365                 [size_is(length)] uint8 *binary_oid; /* partial-binary-OID encoded with asn1_write_partial_OID_String() */
366         } drsuapi_DsReplicaOID;
367
368         typedef struct {
369                 uint32 id_prefix;
370                 drsuapi_DsReplicaOID oid;
371         } drsuapi_DsReplicaOIDMapping;
372
373         typedef [public] struct {
374                 [range(0,0x100000)] uint32 num_mappings;
375                 [size_is(num_mappings)] drsuapi_DsReplicaOIDMapping *mappings;
376         } drsuapi_DsReplicaOIDMapping_Ctr;
377
378         typedef [flag(NDR_PAHEX),v1_enum] enum {
379                 DRSUAPI_OBJECTCLASS_top                 = 0x00010000,
380                 DRSUAPI_OBJECTCLASS_classSchema         = 0x0003000d,
381                 DRSUAPI_OBJECTCLASS_attributeSchema     = 0x0003000e
382         } drsuapi_DsObjectClassId;
383
384         typedef [flag(NDR_PAHEX),v1_enum,public] enum {
385                 DRSUAPI_ATTID_objectClass                       = 0x00000000,
386                 DRSUAPI_ATTID_cn                                = 0x00000003,
387                 DRSUAPI_ATTID_ou                                = 0x0000000b,
388                 DRSUAPI_ATTID_description                       = 0x0000000d,
389                 DRSUAPI_ATTID_member                            = 0x0000001f,
390                 DRSUAPI_ATTID_instanceType                      = 0x00020001,
391                 DRSUAPI_ATTID_whenCreated                       = 0x00020002,
392                 DRSUAPI_ATTID_possSuperiors                     = 0x00020008,
393                 DRSUAPI_ATTID_displayName                       = 0x0002000d,
394                 DRSUAPI_ATTID_hasMasterNCs                      = 0x0002000e,
395                 DRSUAPI_ATTID_subClassOf                        = 0x00020015,
396                 DRSUAPI_ATTID_governsID                         = 0x00020016,
397                 DRSUAPI_ATTID_mustContain                       = 0x00020018,
398                 DRSUAPI_ATTID_mayContain                        = 0x00020019,
399                 DRSUAPI_ATTID_rDNAttId                          = 0x0002001A,
400                 DRSUAPI_ATTID_attributeID                       = 0x0002001e,
401                 DRSUAPI_ATTID_attributeSyntax                   = 0x00020020,
402                 DRSUAPI_ATTID_isSingleValued                    = 0x00020021,
403                 DRSUAPI_ATTID_rangeLower                        = 0x00020022,
404                 DRSUAPI_ATTID_rangeUpper                        = 0x00020023,
405                 DRSUAPI_ATTID_dMDLocation                       = 0x00020024,
406                 DRSUAPI_ATTID_isDeleted                         = 0x00020030,
407                 DRSUAPI_ATTID_objectVersion                     = 0x0002004c,
408                 DRSUAPI_ATTID_invocationId                      = 0x00020073,
409                 DRSUAPI_ATTID_showInAdvancedViewOnly            = 0x000200a9,
410                 DRSUAPI_ATTID_adminDisplayName                  = 0x000200c2,
411                 DRSUAPI_ATTID_adminDescription                  = 0x000200e2,
412                 DRSUAPI_ATTID_oMSyntax                          = 0x000200e7,
413                 DRSUAPI_ATTID_ntSecurityDescriptor              = 0x00020119,
414                 DRSUAPI_ATTID_searchFlags                       = 0x0002014e,
415                 DRSUAPI_ATTID_auxiliaryClass                    = 0x0002015f,
416                 DRSUAPI_ATTID_lDAPDisplayName                   = 0x000201cc,
417                 DRSUAPI_ATTID_name                              = 0x00090001,
418                 DRSUAPI_ATTID_userAccountControl                = 0x00090008,
419                 DRSUAPI_ATTID_codePage                          = 0x00090010,
420                 DRSUAPI_ATTID_countryCode                       = 0x00090019,
421                 DRSUAPI_ATTID_currentValue                      = 0x0009001b,
422                 DRSUAPI_ATTID_homeDirectory                     = 0x0009002c,
423                 DRSUAPI_ATTID_homeDrive                         = 0x0009002d,
424                 DRSUAPI_ATTID_dBCSPwd                           = 0x00090037,/* lmPwdHash */
425                 DRSUAPI_ATTID_scriptPath                        = 0x0009003e,
426                 DRSUAPI_ATTID_logonHours                        = 0x00090040,
427                 DRSUAPI_ATTID_userWorkstations                  = 0x00090056,
428                 DRSUAPI_ATTID_unicodePwd                        = 0x0009005a,/* ntPwdHash */
429                 DRSUAPI_ATTID_ntPwdHistory                      = 0x0009005e,
430                 DRSUAPI_ATTID_pwdLastSet                        = 0x00090060,
431                 DRSUAPI_ATTID_primaryGroupID                    = 0x00090062,
432                 DRSUAPI_ATTID_priorValue                        = 0x00090064,
433                 DRSUAPI_ATTID_supplementalCredentials           = 0x0009007d,
434                 DRSUAPI_ATTID_trustAuthIncoming                 = 0x00090081,
435                 DRSUAPI_ATTID_trustAuthOutgoing                 = 0x00090087,
436                 DRSUAPI_ATTID_profilePath                       = 0x0009008b,
437                 DRSUAPI_ATTID_objectSid                         = 0x00090092,
438                 DRSUAPI_ATTID_schemaIDGUID                      = 0x00090094,
439                 DRSUAPI_ATTID_comment                           = 0x0009009C,/* User-Comment */
440                 DRSUAPI_ATTID_accountExpires                    = 0x0009009f,
441                 DRSUAPI_ATTID_lmPwdHistory                      = 0x000900a0,
442                 DRSUAPI_ATTID_systemPossSuperiors               = 0x000900c3,
443                 DRSUAPI_ATTID_systemMayContain                  = 0x000900c4,
444                 DRSUAPI_ATTID_systemMustContain                 = 0x000900c5,
445                 DRSUAPI_ATTID_systemAuxiliaryClass              = 0x000900c6,
446                 DRSUAPI_ATTID_sAMAccountName                    = 0x000900dd,
447                 DRSUAPI_ATTID_sAMAccountType                    = 0x0009012e,
448                 DRSUAPI_ATTID_options                           = 0x00090133,
449                 DRSUAPI_ATTID_fSMORoleOwner                     = 0x00090171,
450                 DRSUAPI_ATTID_systemFlags                       = 0x00090177,
451                 DRSUAPI_ATTID_serverReference                   = 0x00090203,
452                 DRSUAPI_ATTID_serverReferenceBL                 = 0x00090204,
453                 DRSUAPI_ATTID_initialAuthIncoming               = 0x0009021b,
454                 DRSUAPI_ATTID_initialAuthOutgoing               = 0x0009021c,
455                 DRSUAPI_ATTID_wellKnownObjects                  = 0x0009026a,
456                 DRSUAPI_ATTID_dNSHostName                       = 0x0009026b,
457                 DRSUAPI_ATTID_isMemberOfPartialAttributeSet     = 0x0009027f,
458                 DRSUAPI_ATTID_userPrincipalName                 = 0x00090290,
459                 DRSUAPI_ATTID_groupType                         = 0x000902ee,
460                 DRSUAPI_ATTID_servicePrincipalName              = 0x00090303,
461                 DRSUAPI_ATTID_lastKnownParent                   = 0x0009030d,
462                 DRSUAPI_ATTID_objectCategory                    = 0x0009030e,
463                 DRSUAPI_ATTID_gPLink                            = 0x0009037b,
464                 DRSUAPI_ATTID_transportAddressAttribute         = 0x0009037f,
465                 DRSUAPI_ATTID_msDS_Behavior_Version             = 0x000905b3,
466                 DRSUAPI_ATTID_msDS_KeyVersionNumber             = 0x000906f6,
467                 DRSUAPI_ATTID_msDS_HasDomainNCs                 = 0x0009071c,
468                 DRSUAPI_ATTID_msDS_hasMasterNCs                 = 0x0009072c,
469                 DRSUAPI_ATTID_isRecycled                        = 0x0009080a,
470                 DRSUAPI_ATTID_NONE                              = 0xFFFFFFFF
471         } drsuapi_DsAttributeId;
472
473         typedef struct {
474                 [value(1)] uint32 version;
475                 [value(0)] uint32 reserved1;
476                 [range(1,0x100000)] uint32 num_attids;
477                 [size_is(num_attids)] drsuapi_DsAttributeId attids[];
478         } drsuapi_DsPartialAttributeSet;
479
480         typedef struct {
481                 GUID destination_dsa_guid;
482                 GUID source_dsa_invocation_id; /* the 'invocationId' field of the CN=NTDS Settings object */
483                 [ref] drsuapi_DsReplicaObjectIdentifier *naming_context;
484                 drsuapi_DsReplicaHighWaterMark highwatermark;
485                 drsuapi_DsReplicaCursorCtrEx *uptodateness_vector;
486                 drsuapi_DrsOptions replica_flags;
487                 uint32 max_object_count; /* w2k3 uses min(133,max(100,max_object_count)) */
488                 uint32 max_ndr_size; /* w2k3 seems to ignore this */
489                 drsuapi_DsExtendedOperation extended_op;
490                 hyper fsmo_info;
491                 drsuapi_DsPartialAttributeSet *partial_attribute_set;
492                 drsuapi_DsPartialAttributeSet *partial_attribute_set_ex;
493                 drsuapi_DsReplicaOIDMapping_Ctr mapping_ctr;
494         } drsuapi_DsGetNCChangesRequest8;
495
496         typedef struct {
497                 GUID destination_dsa_guid;
498                 GUID source_dsa_invocation_id; /* the 'invocationId' field of the CN=NTDS Settings object */
499                 [ref] drsuapi_DsReplicaObjectIdentifier *naming_context;
500                 drsuapi_DsReplicaHighWaterMark highwatermark;
501                 drsuapi_DsReplicaCursorCtrEx *uptodateness_vector;
502                 drsuapi_DrsOptions replica_flags;
503                 uint32 max_object_count; /* w2k3 uses min(133,max(100,max_object_count)) */
504                 uint32 max_ndr_size; /* w2k3 seems to ignore this */
505                 drsuapi_DsExtendedOperation extended_op;
506                 hyper fsmo_info;
507                 drsuapi_DsPartialAttributeSet *partial_attribute_set;
508                 drsuapi_DsPartialAttributeSet *partial_attribute_set_ex;
509                 drsuapi_DsReplicaOIDMapping_Ctr mapping_ctr;
510                 uint32 more_flags;
511         } drsuapi_DsGetNCChangesRequest10;
512
513         typedef [switch_type(uint32)] union {
514                 [case(5)] drsuapi_DsGetNCChangesRequest5 req5;
515                 [case(8)] drsuapi_DsGetNCChangesRequest8 req8;
516                 [case(10)] drsuapi_DsGetNCChangesRequest10 req10;
517         } drsuapi_DsGetNCChangesRequest;
518
519         typedef [public] struct {
520                 GUID source_dsa_invocation_id; /* the 'invocationId' field of the CN=NTDS Settings object */
521                 hyper highest_usn;  /* updated after a full replication cycle */
522                 NTTIME last_sync_success;
523         } drsuapi_DsReplicaCursor2;
524
525         typedef struct {
526                 [value(2)] uint32 version;
527                 [value(0)] uint32 reserved1;
528                 [range(0,0x100000)] uint32 count;
529                 [value(0)] uint32 reserved2;
530                 [size_is(count)] drsuapi_DsReplicaCursor2 cursors[];
531         } drsuapi_DsReplicaCursor2CtrEx;
532
533         /* Generic DATA_BLOB values */
534         typedef struct {
535                 [range(0,10485760),value(ndr_size_DATA_BLOB(0,blob,0))] uint32 __ndr_size;
536                 DATA_BLOB *blob;
537         } drsuapi_DsAttributeValue;
538
539         typedef struct {
540                 [range(0,10485760)] uint32 num_values;
541                 [size_is(num_values)] drsuapi_DsAttributeValue *values;
542         } drsuapi_DsAttributeValueCtr;
543
544         /* DN String values */
545         typedef [public,gensize] struct {
546                 [value(ndr_size_drsuapi_DsReplicaObjectIdentifier3(r, ndr->flags))] uint32 __ndr_size;
547                 [value(ndr_size_dom_sid28(&sid,ndr->flags))]  uint32 __ndr_size_sid;
548                 GUID guid;
549                 dom_sid28 sid;
550                 [value(strlen_m(dn))] uint32 __ndr_size_dn;
551                 [charset(UTF16)] uint16 dn[__ndr_size_dn+1];
552         } drsuapi_DsReplicaObjectIdentifier3;
553
554         typedef [public] struct {
555                 [value(ndr_size_drsuapi_DsReplicaObjectIdentifier3Binary_without_Binary(r, ndr->flags))] uint32 __ndr_size;
556                 [value(ndr_size_dom_sid28(&sid,ndr->flags))]  uint32 __ndr_size_sid;
557                 GUID guid;
558                 dom_sid28 sid;
559                 [value(strlen_m(dn))] uint32 __ndr_size_dn;
560                 [charset(UTF16)] uint16 dn[__ndr_size_dn+1];
561                 [value(binary.length + 4)] uint32 __ndr_size_binary;
562                 [flag(NDR_REMAINING)] DATA_BLOB binary;
563         } drsuapi_DsReplicaObjectIdentifier3Binary;
564
565         typedef [public,noprint] struct {
566                 drsuapi_DsAttributeId attid;
567                 drsuapi_DsAttributeValueCtr value_ctr;
568         } drsuapi_DsReplicaAttribute;
569
570         typedef struct {
571                 [range(0,1048576)] uint32 num_attributes;
572                 [size_is(num_attributes)]  drsuapi_DsReplicaAttribute *attributes;
573         } drsuapi_DsReplicaAttributeCtr;
574
575         typedef [public] bitmap {
576                 DRSUAPI_DS_REPLICA_OBJECT_FROM_MASTER   = 0x00000001,
577                 DRSUAPI_DS_REPLICA_OBJECT_DYNAMIC       = 0x00000002,
578                 DRSUAPI_DS_REPLICA_OBJECT_REMOTE_MODIFY = 0x00010000
579         } drsuapi_DsReplicaObjectFlags;
580
581         typedef [public] struct {
582                 drsuapi_DsReplicaObjectIdentifier *identifier;
583                 drsuapi_DsReplicaObjectFlags flags;
584                 drsuapi_DsReplicaAttributeCtr attribute_ctr;
585         } drsuapi_DsReplicaObject;
586
587         typedef struct {
588                 uint32 version;
589                 NTTIME_1sec originating_change_time;
590                 GUID originating_invocation_id;
591                 hyper originating_usn;
592         } drsuapi_DsReplicaMetaData;
593
594         typedef [public] struct {
595                 [range(0,1048576)] uint32 count;
596                 [size_is(count)] drsuapi_DsReplicaMetaData meta_data[];
597         } drsuapi_DsReplicaMetaDataCtr;
598
599         typedef [public,noprint] struct {
600                 drsuapi_DsReplicaObjectListItemEx *next_object;
601                 drsuapi_DsReplicaObject object;
602                 boolean32 is_nc_prefix;
603                 GUID *parent_object_guid;
604                 drsuapi_DsReplicaMetaDataCtr *meta_data_ctr;
605         } drsuapi_DsReplicaObjectListItemEx;
606
607         typedef [public,gensize] struct {
608                 GUID source_dsa_guid; /* the 'objectGUID' field of the CN=NTDS Settings object */
609                 GUID source_dsa_invocation_id; /* the 'invocationId' field of the CN=NTDS Settings object */
610                 drsuapi_DsReplicaObjectIdentifier *naming_context;
611                 drsuapi_DsReplicaHighWaterMark old_highwatermark;
612                 drsuapi_DsReplicaHighWaterMark new_highwatermark;
613                 drsuapi_DsReplicaCursorCtrEx *uptodateness_vector;
614                 drsuapi_DsReplicaOIDMapping_Ctr mapping_ctr;
615                 drsuapi_DsExtendedError extended_ret; /* w2k sends the nc_object_count value here */
616                 uint32 object_count;
617                 /* this +55 is sometimes +56, so I don't know where this comes from... --metze */
618                 [value(ndr_size_drsuapi_DsGetNCChangesCtr1(r,ndr->flags)+55)] uint32 __ndr_size;
619                 drsuapi_DsReplicaObjectListItemEx *first_object;
620                 boolean32 more_data;
621         } drsuapi_DsGetNCChangesCtr1;
622
623         /*
624          * if the DRSUAPI_DS_LINKED_ATTRIBUTE_FLAG_ACTIVE flag
625          * isn't there it means the value is deleted
626          */
627         typedef [public] bitmap {
628                 DRSUAPI_DS_LINKED_ATTRIBUTE_FLAG_ACTIVE = 0x00000001
629         } drsuapi_DsLinkedAttributeFlags;
630
631         typedef [public] struct {
632                 drsuapi_DsReplicaObjectIdentifier *identifier;
633                 drsuapi_DsAttributeId attid;
634                 drsuapi_DsAttributeValue value;
635                 drsuapi_DsLinkedAttributeFlags flags;
636                 NTTIME_1sec originating_add_time;
637                 drsuapi_DsReplicaMetaData meta_data;
638         } drsuapi_DsReplicaLinkedAttribute;
639
640         /* [MS-DRSR] section 4.1.10.2.11 DRS_MSG_GETCHGREPLY_V6 */
641         typedef [public,gensize] struct {
642                 GUID source_dsa_guid; /* the 'objectGUID' field of the CN=NTDS Settings object */
643                 GUID source_dsa_invocation_id; /* the 'invocationId' field of the CN=NTDS Settings object */
644                 drsuapi_DsReplicaObjectIdentifier *naming_context;
645                 drsuapi_DsReplicaHighWaterMark old_highwatermark;
646                 drsuapi_DsReplicaHighWaterMark new_highwatermark;
647                 drsuapi_DsReplicaCursor2CtrEx *uptodateness_vector;
648                 drsuapi_DsReplicaOIDMapping_Ctr mapping_ctr;
649                 drsuapi_DsExtendedError extended_ret;
650                 uint32 object_count;
651                 /* this +55 is sometimes +56, so I don't know where this comes from... --metze */
652                 [value(ndr_size_drsuapi_DsGetNCChangesCtr6(r,ndr->flags)+55)] uint32 __ndr_size;
653                 drsuapi_DsReplicaObjectListItemEx *first_object;
654                 boolean32 more_data;
655                 uint32 nc_object_count; /* estimated amount of objects in the whole NC */
656                 uint32 nc_linked_attributes_count;  /* estimated amount of linked values in the whole NC */
657                 [range(0,1048576)] uint32 linked_attributes_count;
658                 [size_is(linked_attributes_count)] drsuapi_DsReplicaLinkedAttribute *linked_attributes;
659                 WERROR drs_error;
660         } drsuapi_DsGetNCChangesCtr6;
661
662         typedef [public] struct {
663                 [subcontext(0xFFFFFC01)] drsuapi_DsGetNCChangesCtr1 ctr1;
664         } drsuapi_DsGetNCChangesCtr1TS;
665
666         typedef [public] struct {
667                 [subcontext(0xFFFFFC01)] drsuapi_DsGetNCChangesCtr6 ctr6;
668         } drsuapi_DsGetNCChangesCtr6TS;
669
670         typedef [nopush] struct {
671                 uint32 decompressed_length;
672                 uint32 compressed_length;
673                 [subcontext(4),subcontext_size(compressed_length),
674                  compression(NDR_COMPRESSION_MSZIP,compressed_length,decompressed_length)]
675                  drsuapi_DsGetNCChangesCtr1TS *ts;
676         } drsuapi_DsGetNCChangesMSZIPCtr1;
677
678         typedef [nopush] struct {
679                 uint32 decompressed_length;
680                 uint32 compressed_length;
681                 [subcontext(4),subcontext_size(compressed_length),
682                  compression(NDR_COMPRESSION_MSZIP,compressed_length,decompressed_length)]
683                  drsuapi_DsGetNCChangesCtr6TS *ts;
684         } drsuapi_DsGetNCChangesMSZIPCtr6;
685
686         typedef [nopush] struct {
687                 uint32 decompressed_length;
688                 uint32 compressed_length;
689                 [subcontext(4),subcontext_size(compressed_length),
690                  compression(NDR_COMPRESSION_XPRESS,compressed_length,decompressed_length)]
691                  drsuapi_DsGetNCChangesCtr1TS *ts;
692         } drsuapi_DsGetNCChangesXPRESSCtr1;
693
694         typedef [nopush] struct {
695                 uint32 decompressed_length;
696                 uint32 compressed_length;
697                 [subcontext(4),subcontext_size(compressed_length),
698                  compression(NDR_COMPRESSION_XPRESS,compressed_length,decompressed_length)]
699                  drsuapi_DsGetNCChangesCtr6TS *ts;
700         } drsuapi_DsGetNCChangesXPRESSCtr6;
701
702         typedef [enum16bit] enum {
703                 DRSUAPI_COMPRESSION_TYPE_MSZIP  = 2,
704                 DRSUAPI_COMPRESSION_TYPE_XPRESS = 3
705         } drsuapi_DsGetNCChangesCompressionType;
706
707         typedef [nodiscriminant,flag(NDR_PAHEX)] union {
708                 [case(1|(DRSUAPI_COMPRESSION_TYPE_MSZIP<<16))]  drsuapi_DsGetNCChangesMSZIPCtr1 mszip1;
709                 [case(6|(DRSUAPI_COMPRESSION_TYPE_MSZIP<<16))]  drsuapi_DsGetNCChangesMSZIPCtr6 mszip6;
710                 [case(1|(DRSUAPI_COMPRESSION_TYPE_XPRESS<<16))] drsuapi_DsGetNCChangesXPRESSCtr1 xpress1;
711                 [case(6|(DRSUAPI_COMPRESSION_TYPE_XPRESS<<16))] drsuapi_DsGetNCChangesXPRESSCtr6 xpress6;
712         } drsuapi_DsGetNCChangesCompressedCtr;
713
714         typedef struct {
715                 drsuapi_DsGetNCChangesMSZIPCtr1 mszip1;
716         } drsuapi_DsGetNCChangesCtr2;
717
718         typedef struct {
719                 [range(0,6)] uint32 level;
720                 [range(2,3)] drsuapi_DsGetNCChangesCompressionType type;
721                 [switch_is(level | (type<<16))] drsuapi_DsGetNCChangesCompressedCtr ctr;
722         } drsuapi_DsGetNCChangesCtr7;
723
724         typedef [switch_type(uint32)] union {
725                 [case(1)] drsuapi_DsGetNCChangesCtr1 ctr1;
726                 [case(2)] drsuapi_DsGetNCChangesCtr2 ctr2;
727                 [case(6)] drsuapi_DsGetNCChangesCtr6 ctr6;
728                 [case(7)] drsuapi_DsGetNCChangesCtr7 ctr7;
729         } drsuapi_DsGetNCChangesCtr;
730
731         WERROR drsuapi_DsGetNCChanges(
732                 [in] policy_handle *bind_handle,
733                 [in] uint32 level,
734                 [in,ref,switch_is(level)] drsuapi_DsGetNCChangesRequest *req,
735                 [out,ref] uint32 *level_out,
736                 [out,ref,switch_is(*level_out)] drsuapi_DsGetNCChangesCtr *ctr
737                 );
738
739         /*****************/
740         /* Function 0x04 */
741         /* [MS-DRSR] 4.1.26 */
742
743         typedef struct {
744                 [ref] drsuapi_DsReplicaObjectIdentifier *naming_context;
745                 [ref,charset(DOS),string] uint8 *dest_dsa_dns_name;
746                 GUID dest_dsa_guid;
747                 drsuapi_DrsOptions options;
748         } drsuapi_DsReplicaUpdateRefsRequest1;
749
750         typedef [switch_type(uint32)] union {
751                 [case(1)] drsuapi_DsReplicaUpdateRefsRequest1 req1;
752         } drsuapi_DsReplicaUpdateRefsRequest;
753
754         WERROR drsuapi_DsReplicaUpdateRefs(
755                 [in] policy_handle *bind_handle,
756                 [in] uint32 level,
757                 [in,switch_is(level)] drsuapi_DsReplicaUpdateRefsRequest req
758                 );
759
760         /*****************/
761         /* Function 0x05 */
762
763         typedef struct {
764                 [ref] drsuapi_DsReplicaObjectIdentifier *naming_context;
765                 [charset(UTF16),string] uint16 *source_dsa_address;
766                 uint8 schedule[84];
767                 drsuapi_DrsOptions options;
768         } drsuapi_DsReplicaAddRequest1;
769
770         typedef struct {
771                 [ref] drsuapi_DsReplicaObjectIdentifier *naming_context;
772                 drsuapi_DsReplicaObjectIdentifier *source_dsa_dn;
773                 drsuapi_DsReplicaObjectIdentifier *transport_dn;
774                 [charset(UTF16),string] uint16 *source_dsa_address;
775                 uint8 schedule[84];
776                 drsuapi_DrsOptions options;
777         } drsuapi_DsReplicaAddRequest2;
778
779         typedef [switch_type(uint32)] union {
780                 [case(1)] drsuapi_DsReplicaAddRequest1 req1;
781                 [case(2)] drsuapi_DsReplicaAddRequest2 req2;
782         } drsuapi_DsReplicaAddRequest;
783
784         WERROR drsuapi_DsReplicaAdd(
785                 [in] policy_handle *bind_handle,
786                 [in] uint32 level,
787                 [in,switch_is(level)] drsuapi_DsReplicaAddRequest req
788                 );
789                 
790
791         /*****************/
792         /* Function 0x06 */
793         typedef struct {
794                 [ref] drsuapi_DsReplicaObjectIdentifier *naming_context;
795                 [charset(UTF16),string] uint16 *source_dsa_address;
796                 drsuapi_DrsOptions options;
797         } drsuapi_DsReplicaDelRequest1;
798
799         typedef [switch_type(uint32)] union {
800                 [case(1)] drsuapi_DsReplicaDelRequest1 req1;
801         } drsuapi_DsReplicaDelRequest;
802
803         WERROR drsuapi_DsReplicaDel(
804                 [in] policy_handle *bind_handle,
805                 [in] uint32 level,
806                 [in,switch_is(level)] drsuapi_DsReplicaDelRequest req
807                 );
808
809         /*****************/
810         /* Function 0x07 */
811
812         typedef struct {
813                 [ref] drsuapi_DsReplicaObjectIdentifier *naming_context;
814                 GUID source_dra;
815                 [charset(UTF16),string] uint16 *source_dra_address;
816                 uint8 schedule[84];
817                 drsuapi_DrsOptions replica_flags;
818                 uint32 modify_fields;
819                 drsuapi_DrsOptions options;
820         } drsuapi_DsReplicaModRequest1;
821
822         typedef [switch_type(uint32)] union {
823                 [case(1)] drsuapi_DsReplicaModRequest1 req1;
824         } drsuapi_DsReplicaModRequest;
825
826         WERROR drsuapi_DsReplicaMod(
827                 [in] policy_handle *bind_handle,
828                 [in] uint32 level,
829                 [in,switch_is(level)] drsuapi_DsReplicaModRequest req
830                 );
831
832         /*****************/
833         /* Function 0x08 */
834         [todo] WERROR DRSUAPI_VERIFY_NAMES();
835
836         /*****************/
837         /* Function 0x09 */
838
839         /* how are type 4 and 7 different from 2 and 3 ? */
840         typedef [v1_enum] enum {
841                 DRSUAPI_DS_MEMBERSHIP_TYPE_UNIVERSAL_AND_DOMAIN_GROUPS = 1,
842                 DRSUAPI_DS_MEMBERSHIP_TYPE_DOMAIN_LOCAL_GROUPS  = 2,
843                 DRSUAPI_DS_MEMBERSHIP_TYPE_DOMAIN_GROUPS        = 3,
844                 DRSUAPI_DS_MEMBERSHIP_TYPE_DOMAIN_LOCAL_GROUPS2 = 4,
845                 DRSUAPI_DS_MEMBERSHIP_TYPE_UNIVERSAL_GROUPS     = 5,
846                 DRSUAPI_DS_MEMBERSHIP_TYPE_GROUPMEMBERS         = 6,
847                 DRSUAPI_DS_MEMBERSHIP_TYPE_DOMAIN_GROUPS2       = 7
848         } drsuapi_DsMembershipType;
849
850         typedef struct {
851                 NTSTATUS status;
852                 [range(0,10000)] uint32 num_memberships;
853                 [range(0,10000)] uint32 num_sids;
854                 [size_is(num_memberships)] drsuapi_DsReplicaObjectIdentifier **info_array;
855                 [size_is(num_memberships)] samr_GroupAttrs *group_attrs;
856                 [size_is(num_sids)] dom_sid28 **sids;
857         } drsuapi_DsGetMembershipsCtr1;
858
859         typedef [switch_type(uint32)] union {
860                 [case(1)] drsuapi_DsGetMembershipsCtr1 ctr1;
861         } drsuapi_DsGetMembershipsCtr;
862
863         const int DRSUAPI_DS_MEMBERSHIP_FLAG_GROUP_ATTR = 0x1;
864
865         typedef struct {
866                 [range(1,10000)] uint32 count;
867                 [size_is(count)] drsuapi_DsReplicaObjectIdentifier **info_array;
868                 uint32 flags;
869                 [range(1,7)] drsuapi_DsMembershipType type;
870                 drsuapi_DsReplicaObjectIdentifier *domain;
871         } drsuapi_DsGetMembershipsRequest1;
872
873         typedef [switch_type(uint32)] union {
874                 [case(1)] drsuapi_DsGetMembershipsRequest1 req1;
875         } drsuapi_DsGetMembershipsRequest;
876
877         WERROR drsuapi_DsGetMemberships(
878                 [in] policy_handle *bind_handle,
879                 [in] uint32 level,
880                 [in,ref] [switch_is(level)] drsuapi_DsGetMembershipsRequest *req,
881                 [out,ref] uint32 *level_out,
882                 [out,ref] [switch_is(*level_out)] drsuapi_DsGetMembershipsCtr *ctr
883                 );
884
885         /*****************/
886         /* Function 0x0a */
887         [todo] WERROR DRSUAPI_INTER_DOMAIN_MOVE();
888
889         /*****************/
890         /* Function 0x0b */
891         typedef [bitmap32bit] bitmap {
892                 DRSUAPI_NT4_CHANGELOG_GET_CHANGELOG             = 0x00000001,
893                 DRSUAPI_NT4_CHANGELOG_GET_SERIAL_NUMBERS        = 0x00000002
894         } drsuapi_DsGetNT4ChangeLogFlags;
895
896         typedef struct {
897                 drsuapi_DsGetNT4ChangeLogFlags flags;
898                 uint32 preferred_maximum_length;
899                 [range(0,0x00A00000)] uint32 restart_length;
900                 [size_is(restart_length)] uint8 *restart_data;
901         } drsuapi_DsGetNT4ChangeLogRequest1;
902
903         typedef [switch_type(uint32)] union {
904                 [case(1)] drsuapi_DsGetNT4ChangeLogRequest1 req1;
905         } drsuapi_DsGetNT4ChangeLogRequest;
906
907         typedef struct {
908                 [range(0,0x00A00000)] uint32 restart_length;
909                 [range(0,0x00A00000)] uint32 log_length;
910                 hyper sam_serial_number;
911                 NTTIME sam_creation_time;
912                 hyper builtin_serial_number;
913                 NTTIME builtin_creation_time;
914                 hyper lsa_serial_number;
915                 NTTIME lsa_creation_time;
916                 NTSTATUS status;
917                 [size_is(restart_length)] uint8 *restart_data;
918                 [size_is(log_length)] uint8 *log_data;
919         } drsuapi_DsGetNT4ChangeLogInfo1;
920
921         typedef [switch_type(uint32)] union {
922                 [case(1)] drsuapi_DsGetNT4ChangeLogInfo1 info1;
923         } drsuapi_DsGetNT4ChangeLogInfo;
924
925         WERROR drsuapi_DsGetNT4ChangeLog(
926                 [in] policy_handle *bind_handle,
927                 [in] uint32 level,
928                 [in,ref] [switch_is(level)] drsuapi_DsGetNT4ChangeLogRequest *req,
929                 [out,ref] uint32 *level_out,
930                 [out,ref] [switch_is(*level_out)] drsuapi_DsGetNT4ChangeLogInfo *info
931                 );
932
933         /*****************/
934         /* Function 0x0c */
935         typedef [v1_enum] enum {
936                 DRSUAPI_DS_NAME_STATUS_OK                       = 0,
937                 DRSUAPI_DS_NAME_STATUS_RESOLVE_ERROR            = 1,
938                 DRSUAPI_DS_NAME_STATUS_NOT_FOUND                = 2,
939                 DRSUAPI_DS_NAME_STATUS_NOT_UNIQUE               = 3,
940                 DRSUAPI_DS_NAME_STATUS_NO_MAPPING               = 4,
941                 DRSUAPI_DS_NAME_STATUS_DOMAIN_ONLY              = 5,
942                 DRSUAPI_DS_NAME_STATUS_NO_SYNTACTICAL_MAPPING   = 6,
943                 DRSUAPI_DS_NAME_STATUS_TRUST_REFERRAL           = 7
944         } drsuapi_DsNameStatus;
945
946         typedef [v1_enum] enum {
947                 DRSUAPI_DS_NAME_FLAG_NO_FLAGS                   = 0x0,
948                 DRSUAPI_DS_NAME_FLAG_SYNTACTICAL_ONLY           = 0x1,
949                 DRSUAPI_DS_NAME_FLAG_EVAL_AT_DC                 = 0x2,
950                 DRSUAPI_DS_NAME_FLAG_GCVERIFY                   = 0x4,
951                 DRSUAPI_DS_NAME_FLAG_TRUST_REFERRAL             = 0x8
952         } drsuapi_DsNameFlags;
953
954         typedef [v1_enum] enum {
955                 DRSUAPI_DS_NAME_FORMAT_UNKNOWN                  = 0x00000000,
956                 DRSUAPI_DS_NAME_FORMAT_FQDN_1779                = 0x00000001,
957                 DRSUAPI_DS_NAME_FORMAT_NT4_ACCOUNT              = 0x00000002,
958                 DRSUAPI_DS_NAME_FORMAT_DISPLAY                  = 0x00000003,
959                 DRSUAPI_DS_NAME_FORMAT_GUID                     = 0x00000006,
960                 DRSUAPI_DS_NAME_FORMAT_CANONICAL                = 0x00000007,
961                 DRSUAPI_DS_NAME_FORMAT_USER_PRINCIPAL           = 0x00000008,
962                 DRSUAPI_DS_NAME_FORMAT_CANONICAL_EX             = 0x00000009,
963                 DRSUAPI_DS_NAME_FORMAT_SERVICE_PRINCIPAL        = 0x0000000A,
964                 DRSUAPI_DS_NAME_FORMAT_SID_OR_SID_HISTORY       = 0x0000000B,
965                 DRSUAPI_DS_NAME_FORMAT_DNS_DOMAIN               = 0x0000000C,
966                 DRSUAPI_DS_NAME_FORMAT_UPN_AND_ALTSECID         = 0xFFFFFFEF,
967                 DRSUAPI_DS_NAME_FORMAT_NT4_ACCOUNT_NAME_SANS_DOMAIN_EX = 0xFFFFFFF0,
968                 DRSUAPI_DS_NAME_FORMAT_LIST_GLOBAL_CATALOG_SERVERS = 0xFFFFFFF1,
969                 DRSUAPI_DS_NAME_FORMAT_UPN_FOR_LOGON            = 0xFFFFFFF2,
970                 DRSUAPI_DS_NAME_FORMAT_LIST_SERVERS_WITH_DCS_IN_SITE = 0xFFFFFFF3,
971                 DRSUAPI_DS_NAME_FORMAT_STRING_SID_NAME          = 0xFFFFFFF4,
972                 DRSUAPI_DS_NAME_FORMAT_ALT_SECURITY_IDENTITIES_NAME = 0xFFFFFFF5,
973                 DRSUAPI_DS_NAME_FORMAT_LIST_NCS                 = 0xFFFFFFF6,
974                 DRSUAPI_DS_NAME_FORMAT_LIST_DOMAINS             = 0xFFFFFFF7,
975                 DRSUAPI_DS_NAME_FORMAT_MAP_SCHEMA_GUID          = 0xFFFFFFF8,
976                 DRSUAPI_DS_NAME_FORMAT_NT4_ACCOUNT_NAME_SANS_DOMAIN = 0xFFFFFFF9,
977                 DRSUAPI_DS_NAME_FORMAT_LIST_ROLES               = 0xFFFFFFFA,
978                 DRSUAPI_DS_NAME_FORMAT_LIST_INFO_FOR_SERVER     = 0xFFFFFFFB,
979                 DRSUAPI_DS_NAME_FORMAT_LIST_SERVERS_FOR_DOMAIN_IN_SITE = 0xFFFFFFFC,
980                 DRSUAPI_DS_NAME_FORMAT_LIST_DOMAINS_IN_SITE     = 0xFFFFFFFD,
981                 DRSUAPI_DS_NAME_FORMAT_LIST_SERVERS_IN_SITE     = 0xFFFFFFFE,
982                 DRSUAPI_DS_NAME_FORMAT_LIST_SITES               = 0xFFFFFFFF
983         } drsuapi_DsNameFormat;
984
985         typedef struct {
986                 [string,charset(UTF16)] uint16 *str;
987         } drsuapi_DsNameString;
988
989         typedef struct {
990                 uint32 codepage; /* 0x000004e4 - 1252 is german codepage*/
991                 uint32 language; /* 0x00000407 - german language ID*/
992                 drsuapi_DsNameFlags format_flags;
993                 drsuapi_DsNameFormat format_offered;
994                 drsuapi_DsNameFormat format_desired;
995                 [range(1,10000)] uint32 count;
996                 [size_is(count)] drsuapi_DsNameString *names;
997         } drsuapi_DsNameRequest1;
998
999         typedef [switch_type(uint32)] union {
1000                 [case(1)] drsuapi_DsNameRequest1 req1;
1001         } drsuapi_DsNameRequest;
1002
1003         typedef struct {
1004                 drsuapi_DsNameStatus status;
1005                 [charset(UTF16),string] uint16 *dns_domain_name;
1006                 [charset(UTF16),string] uint16 *result_name;
1007         } drsuapi_DsNameInfo1;
1008
1009         typedef struct {
1010                 uint32 count;
1011                 [size_is(count)] drsuapi_DsNameInfo1 *array;
1012         } drsuapi_DsNameCtr1;
1013
1014         typedef [switch_type(uint32)] union {
1015                 [case(1)] drsuapi_DsNameCtr1 *ctr1;
1016         } drsuapi_DsNameCtr;
1017
1018         WERROR drsuapi_DsCrackNames(
1019                 [in] policy_handle *bind_handle,
1020                 [in] uint32 level,
1021                 [in,ref,switch_is(level)] drsuapi_DsNameRequest *req,
1022                 [out,ref] uint32 *level_out,
1023                 [out,ref,switch_is(*level_out)] drsuapi_DsNameCtr *ctr
1024                 );
1025
1026         /*****************/
1027         /* Function 0x0d */
1028         typedef [v1_enum] enum {
1029                 DRSUAPI_DS_SPN_OPERATION_ADD    = 0,
1030                 DRSUAPI_DS_SPN_OPERATION_REPLACE= 1,
1031                 DRSUAPI_DS_SPN_OPERATION_DELETE = 2
1032         } drsuapi_DsSpnOperation;
1033
1034         typedef struct {
1035                 drsuapi_DsSpnOperation operation;
1036                 uint32 unknown1;
1037                 [charset(UTF16),string] uint16 *object_dn;
1038                 [range(0,10000)] uint32 count;
1039                 [size_is(count)] drsuapi_DsNameString *spn_names;
1040         } drsuapi_DsWriteAccountSpnRequest1;
1041
1042         typedef [switch_type(uint32)] union {
1043                 [case(1)] drsuapi_DsWriteAccountSpnRequest1 req1;
1044         } drsuapi_DsWriteAccountSpnRequest;
1045
1046         typedef struct {
1047                 WERROR status;
1048         } drsuapi_DsWriteAccountSpnResult1;
1049
1050         typedef [switch_type(uint32)] union {
1051                 [case(1)] drsuapi_DsWriteAccountSpnResult1 res1;
1052         } drsuapi_DsWriteAccountSpnResult;
1053
1054         WERROR drsuapi_DsWriteAccountSpn(
1055                 [in] policy_handle *bind_handle,
1056                 [in] uint32 level,
1057                 [in,ref,switch_is(level)] drsuapi_DsWriteAccountSpnRequest *req,
1058                 [out,ref] uint32 *level_out,
1059                 [out,ref,switch_is(*level_out)] drsuapi_DsWriteAccountSpnResult *res
1060                 );
1061
1062         /*****************/
1063         /* Function 0x0e */
1064         typedef struct {
1065                 [charset(UTF16),string] uint16 *server_dn;
1066                 [charset(UTF16),string] uint16 *domain_dn;
1067                 boolean32 commit;
1068         } drsuapi_DsRemoveDSServerRequest1;
1069
1070         typedef [switch_type(uint32)] union {
1071                 [case(1)] drsuapi_DsRemoveDSServerRequest1 req1;
1072         } drsuapi_DsRemoveDSServerRequest;
1073
1074         typedef struct {
1075                 boolean32 last_dc_in_domain;
1076         } drsuapi_DsRemoveDSServerResult1;
1077
1078         typedef [switch_type(uint32)] union {
1079                 [case(1)] drsuapi_DsRemoveDSServerResult1 res1;
1080         } drsuapi_DsRemoveDSServerResult;
1081
1082         WERROR drsuapi_DsRemoveDSServer(
1083                 [in] policy_handle *bind_handle,
1084                 [in] uint32 level,
1085                 [in,ref,switch_is(level)] drsuapi_DsRemoveDSServerRequest *req,
1086                 [out,ref] uint32 *level_out,
1087                 [out,ref,switch_is(*level_out)] drsuapi_DsRemoveDSServerResult *res
1088                 );
1089
1090         /*****************/
1091         /* Function 0x0f */
1092         [todo] WERROR DRSUAPI_REMOVE_DS_DOMAIN();
1093
1094         /*****************/
1095         /* Function 0x10 */
1096         typedef struct {
1097                 [charset(UTF16),string] uint16 *domain_name; /* netbios or dns */
1098                 int32 level; /* specifies the switch level for the request */
1099         } drsuapi_DsGetDCInfoRequest1;
1100
1101         typedef [switch_type(int32)] union {
1102                 [case(1)] drsuapi_DsGetDCInfoRequest1 req1;
1103         } drsuapi_DsGetDCInfoRequest;
1104
1105         typedef struct {
1106                 [charset(UTF16),string] uint16 *netbios_name;
1107                 [charset(UTF16),string] uint16 *dns_name;
1108                 [charset(UTF16),string] uint16 *site_name;
1109                 [charset(UTF16),string] uint16 *computer_dn;
1110                 [charset(UTF16),string] uint16 *server_dn;
1111                 uint32 is_pdc;
1112                 uint32 is_enabled;
1113         } drsuapi_DsGetDCInfo1;
1114
1115         typedef struct {
1116                 [range(0,10000)] uint32 count;
1117                 [size_is(count)] drsuapi_DsGetDCInfo1 *array;
1118         } drsuapi_DsGetDCInfoCtr1;
1119
1120         typedef struct {
1121                 [charset(UTF16),string] uint16 *netbios_name;
1122                 [charset(UTF16),string] uint16 *dns_name;
1123                 [charset(UTF16),string] uint16 *site_name;
1124                 [charset(UTF16),string] uint16 *site_dn;
1125                 [charset(UTF16),string] uint16 *computer_dn;
1126                 [charset(UTF16),string] uint16 *server_dn;
1127                 [charset(UTF16),string] uint16 *ntds_dn;
1128                 uint32 is_pdc;
1129                 uint32 is_enabled;
1130                 uint32 is_gc;
1131                 GUID site_guid;
1132                 GUID computer_guid;
1133                 GUID server_guid;
1134                 GUID ntds_guid;
1135         } drsuapi_DsGetDCInfo2;
1136
1137         typedef struct {
1138                 [range(0,10000)] uint32 count;
1139                 [size_is(count)] drsuapi_DsGetDCInfo2 *array;
1140         } drsuapi_DsGetDCInfoCtr2;
1141
1142         typedef struct {
1143                 [charset(UTF16),string] uint16 *netbios_name;
1144                 [charset(UTF16),string] uint16 *dns_name;
1145                 [charset(UTF16),string] uint16 *site_name;
1146                 [charset(UTF16),string] uint16 *site_dn;
1147                 [charset(UTF16),string] uint16 *computer_dn;
1148                 [charset(UTF16),string] uint16 *server_dn;
1149                 [charset(UTF16),string] uint16 *ntds_dn;
1150                 uint32 is_pdc;
1151                 uint32 is_enabled;
1152                 uint32 is_gc;
1153                 uint32 is_rodc;
1154                 GUID site_guid;
1155                 GUID computer_guid;
1156                 GUID server_guid;
1157                 GUID ntds_guid;
1158         } drsuapi_DsGetDCInfo3;
1159
1160         typedef struct {
1161                 [range(0,10000)] uint32 count;
1162                 [size_is(count)] drsuapi_DsGetDCInfo3 *array;
1163         } drsuapi_DsGetDCInfoCtr3;
1164
1165         /*
1166          * this represents an active connection to the
1167          * Directory System Agent (DSA)
1168          * this can be via LDAP or DRSUAPI
1169          */
1170         typedef struct {
1171                 [flag(NDR_BIG_ENDIAN)] ipv4address client_ip_address;
1172                 uint32 unknown2;
1173                 uint32 connection_time; /* in seconds */
1174                 uint32 unknown4;
1175                 uint32 unknown5;
1176                 uint32 unknown6;
1177                 /*
1178                  * client_account can be the following:
1179                  * "W2K3\Administrator"
1180                  * "Administrator@W2K3"
1181                  * "cn=Administrator,cn=Users,DC=w2k3,DC=vmnet1,DC=vm,DC=base"
1182                  * ""
1183                  * or NULL
1184                  */
1185                 [charset(UTF16),string] uint16 *client_account;
1186         } drsuapi_DsGetDCConnection01;
1187
1188         typedef struct {
1189                 [range(0,10000)] uint32 count;
1190                 [size_is(count)] drsuapi_DsGetDCConnection01 *array;
1191         } drsuapi_DsGetDCConnectionCtr01;
1192
1193         typedef [v1_enum] enum {
1194                 DRSUAPI_DC_INFO_CTR_1  = 1,
1195                 DRSUAPI_DC_INFO_CTR_2  = 2,
1196                 DRSUAPI_DC_INFO_CTR_3  = 3,
1197                 DRSUAPI_DC_CONNECTION_CTR_01 = -1
1198         } drsuapi_DsGetDCInfoCtrLevels;
1199
1200         typedef [switch_type(int32)] union {
1201                 [case(DRSUAPI_DC_INFO_CTR_1)]  drsuapi_DsGetDCInfoCtr1  ctr1;
1202                 [case(DRSUAPI_DC_INFO_CTR_2)]  drsuapi_DsGetDCInfoCtr2  ctr2;
1203                 [case(DRSUAPI_DC_INFO_CTR_3)]  drsuapi_DsGetDCInfoCtr3  ctr3;
1204                 [case(DRSUAPI_DC_CONNECTION_CTR_01)] drsuapi_DsGetDCConnectionCtr01 ctr01;
1205         } drsuapi_DsGetDCInfoCtr;
1206
1207         WERROR drsuapi_DsGetDomainControllerInfo(
1208                 [in] policy_handle *bind_handle,
1209                 [in] int32 level,
1210                 [in,ref,switch_is(level)] drsuapi_DsGetDCInfoRequest *req,
1211                 [out,ref] int32 *level_out,
1212                 [out,ref,switch_is(*level_out)] drsuapi_DsGetDCInfoCtr *ctr
1213                 );
1214
1215         /*****************/
1216         /* Function 0x11 */
1217         typedef [public,noprint] struct {
1218                 drsuapi_DsReplicaObjectListItem *next_object;
1219                 drsuapi_DsReplicaObject object;
1220         } drsuapi_DsReplicaObjectListItem;
1221
1222         /*
1223          * The DsAddEntry() call which creates a nTDSDSA object,
1224          * also adds a servicePrincipalName in the following form
1225          * to the computer account of the new domain controller
1226          * referenced by the "serverReferenece" attribute.
1227          *
1228          * E3514235-4B06-11D1-AB04-00C04FC2DCD2/<new-ntdsdsa-object-guid-as-string>/<domain-dns-name>
1229          *
1230          * also note that the "serverReference" isn't added to the new object!
1231          */
1232         const char *DRSUAPI_NTDSDSA_KRB5_SERVICE_GUID = "E3514235-4B06-11D1-AB04-00C04FC2DCD2";
1233
1234         /* Error codes to classify an error that occurs
1235          * during a search for, or the update of,
1236          * a directory object */
1237         typedef [v1_enum] enum {
1238                 DRSUAPI_DIRERR_OK         = 0,
1239                 DRSUAPI_DIRERR_ATTRIBUTE  = 1,
1240                 DRSUAPI_DIRERR_NAME       = 2,
1241                 DRSUAPI_DIRERR_REFERRAL   = 3,
1242                 DRSUAPI_DIRERR_SECURITY   = 4,
1243                 DRSUAPI_DIRERR_SERVICE    = 5,
1244                 DRSUAPI_DIRERR_UPDATE     = 6,
1245                 DRSUAPI_DIRERR_SYSTEM     = 7
1246         } drsuapi_DsAddEntry_DirErr;
1247
1248         /*
1249          * Ref: DRS_MSG_ADDENTRYREQ_V2, [MS-DRSR]: 4.1.1.1.3
1250          */
1251         typedef struct {
1252                 drsuapi_DsReplicaObjectListItem first_object;
1253         } drsuapi_DsAddEntryRequest2;
1254
1255         /* Buffer type is actually more
1256          * like a semi Flags
1257          * Ref: DRS_SecBuffer, [MS-DRSR]: 5.41 */
1258         typedef [v1_enum,noprint] enum {
1259                 DRSUAPI_SECBUFFER_EMPTY          = 0x00000000,
1260                 DRSUAPI_SECBUFFER_DATA           = 0x00000001,
1261                 DRSUAPI_SECBUFFER_TOKEN          = 0x00000002,
1262                 DRSUAPI_SECBUFFER_PKG_PARAMS     = 0x00000003,
1263                 DRSUAPI_SECBUFFER_MISSING        = 0x00000004,
1264                 DRSUAPI_SECBUFFER_EXTRA          = 0x00000005,
1265                 DRSUAPI_SECBUFFER_STREAM_TRAILER = 0x00000006,
1266                 DRSUAPI_SECBUFFER_STREAM_HEADER  = 0x00000007,
1267                 DRSUAPI_SECBUFFER_READONLY       = 0x80000000
1268         } drsuapi_SecBufferType;
1269
1270         typedef struct {
1271                 [range(0,10000)] uint32 buf_size;
1272                 drsuapi_SecBufferType buf_type;
1273                 [size_is(buf_size)] uint8 *buffer;
1274         } drsuapi_SecBuffer;
1275
1276         typedef struct {
1277                 [value(0)] uint32 version;
1278                 [range(0,10000)] uint32 buff_count;
1279                 [size_is(buff_count)] drsuapi_SecBuffer *buffers;
1280         } drsuapi_SecBufferDesc;
1281
1282         /*
1283          * Ref: DRS_MSG_ADDENTRYREQ_V3, [MS-DRSR]: 4.1.1.1.4
1284          */
1285         typedef struct {
1286                 drsuapi_DsReplicaObjectListItem first_object;
1287                 drsuapi_SecBufferDesc *client_creds;
1288         } drsuapi_DsAddEntryRequest3;
1289
1290         typedef [switch_type(uint32)] union {
1291                 [case(2)] drsuapi_DsAddEntryRequest2 req2;
1292                 [case(3)] drsuapi_DsAddEntryRequest3 req3;
1293         } drsuapi_DsAddEntryRequest;
1294
1295         /* Generic extended error info
1296          * commonly used in most places
1297          * where rich error info is returned */
1298         typedef struct {
1299                 uint32  dsid;           /* implementation-specific diagnostic code */
1300                 WERROR  extended_err;   /* 0, STATUS code, or Windows error code */
1301                 uint32  extended_data;  /* implementation-specific diagnostic code */
1302                 uint16  problem;        /* 0 or PROBLEM error code */
1303         } drsuapi_DsAddEntryErrorInfoX;
1304
1305         /* Attribute errors
1306          * Ref: ATRERR_DRS_WIRE_V1, [MS-DRSR]: 4.1.1.1.11 */
1307         typedef struct {
1308                 uint32  dsid;
1309                 WERROR  extended_err;
1310                 uint32  extended_data;
1311                 uint16  problem;
1312                 drsuapi_DsAttributeId attid;
1313                 boolean32 is_val_returned;
1314                 drsuapi_DsAttributeValue attr_val;
1315         } drsuapi_DsAddEntry_AttrErr_V1;
1316
1317         typedef [noprint] struct {
1318                 drsuapi_DsAddEntry_AttrErrListItem_V1 *next;
1319                 drsuapi_DsAddEntry_AttrErr_V1 err_data;
1320         } drsuapi_DsAddEntry_AttrErrListItem_V1;
1321
1322         typedef struct {
1323                 drsuapi_DsReplicaObjectIdentifier *id;
1324                 uint32 count;
1325                 drsuapi_DsAddEntry_AttrErrListItem_V1 first;
1326         } drsuapi_DsAddEntryErrorInfo_Attr_V1;
1327
1328         /* Name resolution error
1329          * Ref: NAMERR_DRS_WIRE_V1, [MS-DRSR]: 4.1.1.1.14 */
1330         typedef struct {
1331                 uint32  dsid;
1332                 WERROR  extended_err;
1333                 uint32  extended_data;
1334                 uint16  problem;
1335                 drsuapi_DsReplicaObjectIdentifier *id_matched; /* The best match for the supplied object identity */
1336         } drsuapi_DsAddEntryErrorInfo_Name_V1;
1337
1338         /* Referral error
1339          * Ref: REFERR_DRS_WIRE_V1, [MS-DRSR]: 4.1.1.1.15 */
1340         typedef struct {
1341                 [value(83)] uint8  name_res;    /* Must be 'S' */
1342                 [value(0)]  uint8  unused_pad;
1343                 [value(0)]  uint16 next_rdn;
1344         } drsuapi_NameResOp_V1;
1345
1346         typedef [enum16bit] enum {
1347                 DRSUAPI_CH_REFTYPE_SUPERIOR     = 0x0000, /* referral to a superior DC */
1348                 DRSUAPI_CH_REFTYPE_SUBORDINATE  = 0x0001, /* referral to a subordinate DC */
1349                 DRSUAPI_CH_REFTYPE_NSSR         = 0x0002, /* Not used */
1350                 DRSUAPI_CH_REFTYPE_CROSS        = 0x0003  /* A referral to an external crossRef object */
1351         } drsuapi_DsAddEntry_RefType;
1352
1353         typedef [enum8bit] enum {
1354                 DRSUAPI_SE_CHOICE_BASE_ONLY     = 0x00,
1355                 DRSUAPI_SE_CHOICE_IMMED_CHLDRN  = 0x01,
1356                 DRSUAPI_SE_CHOICE_WHOLE_SUBTREE = 0x02
1357         } drsuapi_DsAddEntry_ChoiceType;
1358
1359         /* list of network names of the DCs
1360          * to which the referral is directed */
1361         typedef struct  {
1362                 drsuapi_DsaAddressListItem_V1 *next;
1363                 lsa_String *address;
1364         } drsuapi_DsaAddressListItem_V1;
1365
1366         typedef struct {
1367                 drsuapi_DsReplicaObjectIdentifier *id_target; /* object to which the referral is directed */
1368                 drsuapi_NameResOp_V1 op_state;
1369                 [value(0)] uint16 rdn_alias;
1370                 [value(0)] uint16 rdn_internal;
1371                 drsuapi_DsAddEntry_RefType ref_type;
1372                 uint16 addr_list_count;
1373                 drsuapi_DsaAddressListItem_V1 *addr_list;
1374                 drsuapi_DsAddEntry_RefErrListItem_V1 *next;
1375                 boolean32 is_choice_set;
1376                 drsuapi_DsAddEntry_ChoiceType choice;
1377         } drsuapi_DsAddEntry_RefErrListItem_V1;
1378
1379         typedef struct {
1380                 uint32  dsid;
1381                 WERROR  extended_err;
1382                 uint32  extended_data;
1383                 drsuapi_DsAddEntry_RefErrListItem_V1 refer;
1384         } drsuapi_DsAddEntryErrorInfo_Referr_V1;
1385
1386         typedef [switch_type(uint32)] union {
1387                 [case(1)] drsuapi_DsAddEntryErrorInfo_Attr_V1   attr_err;
1388                 [case(2)] drsuapi_DsAddEntryErrorInfo_Name_V1   name_err;
1389                 [case(3)] drsuapi_DsAddEntryErrorInfo_Referr_V1 referral_err;
1390                 [case(4)] drsuapi_DsAddEntryErrorInfoX          security_err;
1391                 [case(5)] drsuapi_DsAddEntryErrorInfoX          service_err;
1392                 [case(6)] drsuapi_DsAddEntryErrorInfoX          update_err;
1393                 [case(7)] drsuapi_DsAddEntryErrorInfoX          system_err;
1394         } drsuapi_DsAddEntryErrorInfo;
1395
1396         typedef struct {
1397                 WERROR status;
1398                 drsuapi_DsAddEntry_DirErr dir_err;
1399                 [switch_is(dir_err)] drsuapi_DsAddEntryErrorInfo *info;
1400         } drsuapi_DsAddEntry_ErrData_V1;
1401
1402         typedef [switch_type(uint32)] union {
1403                 [case(1)] drsuapi_DsAddEntry_ErrData_V1 v1;
1404         } drsuapi_DsAddEntry_ErrData;
1405
1406         typedef struct {
1407                 GUID guid;
1408                 dom_sid28 sid;
1409         } drsuapi_DsReplicaObjectIdentifier2;
1410
1411         typedef struct {
1412                 drsuapi_DsReplicaObjectIdentifier *id;
1413                 drsuapi_DsAddEntry_DirErr dir_err;
1414                 uint32                    dsid;          /* implementation-specific diagnostic code */
1415                 WERROR                    extended_err;  /* 0, STATUS code, or Windows error code */
1416                 uint32                    extended_data; /* implementation-specific diagnostic code */
1417                 uint16                    problem;       /* 0 or PROBLEM error code */
1418                 [range(0,10000)] uint32 count;
1419                 [size_is(count)] drsuapi_DsReplicaObjectIdentifier2 *objects;
1420         } drsuapi_DsAddEntryCtr2;
1421
1422         typedef struct {
1423                 drsuapi_DsReplicaObjectIdentifier *id;
1424                 uint32 err_ver; /* Must be 1 */
1425                 [switch_is(err_ver)] drsuapi_DsAddEntry_ErrData *err_data;
1426                 [range(0,10000)] uint32 count;
1427                 [size_is(count)] drsuapi_DsReplicaObjectIdentifier2 *objects;
1428         } drsuapi_DsAddEntryCtr3;
1429
1430         typedef [switch_type(uint32)] union {
1431                 [case(2)] drsuapi_DsAddEntryCtr2 ctr2;
1432                 [case(3)] drsuapi_DsAddEntryCtr3 ctr3;
1433         } drsuapi_DsAddEntryCtr;
1434
1435         [public] WERROR drsuapi_DsAddEntry(
1436                 [in] policy_handle *bind_handle,
1437                 [in] uint32 level,
1438                 [in,ref,switch_is(level)] drsuapi_DsAddEntryRequest *req,
1439                 [out,ref] uint32 *level_out,
1440                 [out,ref,switch_is(*level_out)] drsuapi_DsAddEntryCtr *ctr
1441                 );
1442
1443         /*****************/
1444         /* Function 0x12 */
1445         typedef bitmap {
1446                 DRSUAPI_DS_EXECUTE_KCC_ASYNCHRONOUS_OPERATION   = 0x00000001,
1447                 DRSUAPI_DS_EXECUTE_KCC_DAMPED                   = 0x00000002
1448         } drsuapi_DsExecuteKCCFlags;
1449
1450         typedef struct {
1451                 uint32 taskID;
1452                 drsuapi_DsExecuteKCCFlags flags;
1453         } drsuapi_DsExecuteKCC1;
1454
1455         typedef [switch_type(uint32)] union {
1456                 [case(1)] drsuapi_DsExecuteKCC1 ctr1;
1457         } drsuapi_DsExecuteKCCRequest;
1458
1459         WERROR drsuapi_DsExecuteKCC(
1460                 [in] policy_handle *bind_handle,
1461                 [in] uint32 level,
1462                 [in, ref, switch_is(level)] drsuapi_DsExecuteKCCRequest *req
1463                 );
1464
1465         /*****************/
1466         /* Function 0x13 */
1467         typedef [v1_enum] enum {
1468                 DRSUAPI_DS_REPLICA_GET_INFO                             = 1,
1469                 DRSUAPI_DS_REPLICA_GET_INFO2                            = 2
1470         } drsuapi_DsReplicaGetInfoLevel;
1471
1472         typedef [v1_enum] enum {
1473                 DRSUAPI_DS_REPLICA_INFO_NEIGHBORS                       = 0,
1474                 DRSUAPI_DS_REPLICA_INFO_CURSORS                         = 1,
1475                 DRSUAPI_DS_REPLICA_INFO_OBJ_METADATA                    = 2,
1476                 DRSUAPI_DS_REPLICA_INFO_KCC_DSA_CONNECT_FAILURES        = 3,
1477                 DRSUAPI_DS_REPLICA_INFO_KCC_DSA_LINK_FAILURES           = 4,
1478                 DRSUAPI_DS_REPLICA_INFO_PENDING_OPS                     = 5,
1479                 DRSUAPI_DS_REPLICA_INFO_ATTRIBUTE_VALUE_METADATA        = 6,
1480                 DRSUAPI_DS_REPLICA_INFO_CURSORS2                        = 7,
1481                 DRSUAPI_DS_REPLICA_INFO_CURSORS3                        = 8,
1482                 DRSUAPI_DS_REPLICA_INFO_OBJ_METADATA2                   = 9,
1483                 DRSUAPI_DS_REPLICA_INFO_ATTRIBUTE_VALUE_METADATA2       = 10,
1484                 DRSUAPI_DS_REPLICA_INFO_REPSTO                          = -2,
1485                 DRSUAPI_DS_REPLICA_INFO_CLIENT_CONTEXTS                 = -4,
1486                 DRSUAPI_DS_REPLICA_INFO_UPTODATE_VECTOR_V1              = -5,
1487                 DRSUAPI_DS_REPLICA_INFO_SERVER_OUTGOING_CALLS           = -6
1488         } drsuapi_DsReplicaInfoType;
1489
1490         typedef struct {
1491                 drsuapi_DsReplicaInfoType info_type;
1492                 [charset(UTF16),string] uint16 *object_dn;
1493                 GUID source_dsa_guid;
1494         } drsuapi_DsReplicaGetInfoRequest1;
1495
1496         typedef struct {
1497                 drsuapi_DsReplicaInfoType info_type;
1498                 [charset(UTF16),string] uint16 *object_dn;
1499                 GUID source_dsa_guid;
1500                 uint32 flags;
1501                 [charset(UTF16),string] uint16 *attribute_name;
1502                 [charset(UTF16),string] uint16 *value_dn_str;
1503                 uint32 enumeration_context;
1504         } drsuapi_DsReplicaGetInfoRequest2;
1505
1506         typedef [switch_type(drsuapi_DsReplicaGetInfoLevel)] union {
1507                 [case(DRSUAPI_DS_REPLICA_GET_INFO)] drsuapi_DsReplicaGetInfoRequest1 req1;
1508                 [case(DRSUAPI_DS_REPLICA_GET_INFO2)] drsuapi_DsReplicaGetInfoRequest2 req2;
1509         } drsuapi_DsReplicaGetInfoRequest;
1510
1511         typedef struct {
1512                 [charset(UTF16),string] uint16 *naming_context_dn;
1513                 [charset(UTF16),string] uint16 *source_dsa_obj_dn;
1514                 [charset(UTF16),string] uint16 *source_dsa_address;
1515                 [charset(UTF16),string] uint16 *transport_obj_dn;
1516                 drsuapi_DrsOptions replica_flags;
1517                 uint32 reserved;
1518                 GUID naming_context_obj_guid;
1519                 GUID source_dsa_obj_guid;
1520                 GUID source_dsa_invocation_id;
1521                 GUID transport_obj_guid;
1522                 hyper tmp_highest_usn;
1523                 hyper highest_usn;
1524                 NTTIME last_success;
1525                 NTTIME last_attempt;
1526                 WERROR result_last_attempt;
1527                 uint32 consecutive_sync_failures;
1528         } drsuapi_DsReplicaNeighbour;
1529
1530         typedef struct {
1531                 uint32 count;
1532                 uint32 reserved;
1533                 [size_is(count)] drsuapi_DsReplicaNeighbour array[];
1534         } drsuapi_DsReplicaNeighbourCtr;
1535
1536         typedef struct {
1537                 uint32 count;
1538                 uint32 reserved;
1539                 [size_is(count)] drsuapi_DsReplicaCursor array[];
1540         } drsuapi_DsReplicaCursorCtr;
1541
1542         typedef struct {
1543                 [charset(UTF16),string] uint16 *attribute_name;
1544                 uint32 version;
1545                 NTTIME originating_change_time;
1546                 GUID originating_invocation_id;
1547                 hyper originating_usn;
1548                 hyper local_usn;
1549         } drsuapi_DsReplicaObjMetaData;
1550
1551         typedef struct {
1552                 uint32 count;
1553                 uint32 reserved;
1554                 [size_is(count)] drsuapi_DsReplicaObjMetaData array[];
1555         } drsuapi_DsReplicaObjMetaDataCtr;
1556
1557         typedef struct {
1558                 [charset(UTF16),string] uint16 *dsa_obj_dn;
1559                 GUID dsa_obj_guid;
1560                 NTTIME first_failure;
1561                 uint32 num_failures;
1562                 WERROR last_result;
1563         } drsuapi_DsReplicaKccDsaFailure;
1564
1565         typedef struct {
1566                 uint32 count;
1567                 uint32 reserved;
1568                 [size_is(count)] drsuapi_DsReplicaKccDsaFailure array[];
1569         } drsuapi_DsReplicaKccDsaFailuresCtr;
1570
1571         typedef enum {
1572                 DRSUAPI_DS_REPLICA_OP_TYPE_SYNC         = 0,
1573                 DRSUAPI_DS_REPLICA_OP_TYPE_ADD          = 1,
1574                 DRSUAPI_DS_REPLICA_OP_TYPE_DELETE       = 2,
1575                 DRSUAPI_DS_REPLICA_OP_TYPE_MODIFY       = 3,
1576                 DRSUAPI_DS_REPLICA_OP_TYPE_UPDATE_REFS  = 4
1577         } drsuapi_DsReplicaOpType;
1578
1579         typedef struct {
1580                 NTTIME operation_start;
1581                 uint32 serial_num; /* unique till reboot */
1582                 uint32 priority;
1583                 drsuapi_DsReplicaOpType operation_type;
1584                 drsuapi_DrsOptions options;
1585                 [charset(UTF16),string] uint16 *nc_dn;
1586                 [charset(UTF16),string] uint16 *remote_dsa_obj_dn;
1587                 [charset(UTF16),string] uint16 *remote_dsa_address;
1588                 GUID nc_obj_guid;
1589                 GUID remote_dsa_obj_guid;
1590         } drsuapi_DsReplicaOp;
1591
1592         typedef struct {
1593                 NTTIME time;
1594                 uint32 count;
1595                 [size_is(count)] drsuapi_DsReplicaOp array[];
1596         } drsuapi_DsReplicaOpCtr;
1597
1598         typedef struct {
1599                 [charset(UTF16),string] uint16 *attribute_name;
1600                 [charset(UTF16),string] uint16 *object_dn;
1601                 [value(ndr_size_DATA_BLOB(0,binary,0))] uint32 __ndr_size_binary;
1602                 DATA_BLOB *binary;
1603                 NTTIME deleted;
1604                 NTTIME created;
1605                 uint32 version;
1606                 NTTIME originating_change_time;
1607                 GUID originating_invocation_id;
1608                 hyper originating_usn;
1609                 hyper local_usn;
1610         } drsuapi_DsReplicaAttrValMetaData;
1611
1612         typedef struct {
1613                 uint32 count;
1614                 uint32 enumeration_context;
1615                 [size_is(count)] drsuapi_DsReplicaAttrValMetaData array[];
1616         } drsuapi_DsReplicaAttrValMetaDataCtr;
1617
1618         typedef struct {
1619                 uint32 count;
1620                 uint32 enumeration_context;
1621                 [size_is(count)] drsuapi_DsReplicaCursor2 array[];
1622         } drsuapi_DsReplicaCursor2Ctr;
1623
1624         typedef struct {
1625                 GUID source_dsa_invocation_id;
1626                 hyper highest_usn;
1627                 NTTIME last_sync_success;
1628                 [charset(UTF16),string] uint16 *source_dsa_obj_dn;
1629         } drsuapi_DsReplicaCursor3;
1630
1631         typedef struct {
1632                 uint32 count;
1633                 uint32 enumeration_context;
1634                 [size_is(count)] drsuapi_DsReplicaCursor3 array[];
1635         } drsuapi_DsReplicaCursor3Ctr;
1636
1637         typedef struct {
1638                 [charset(UTF16),string] uint16 *attribute_name;
1639                 uint32 version;
1640                 NTTIME originating_change_time;
1641                 GUID originating_invocation_id;
1642                 hyper originating_usn;
1643                 hyper local_usn;
1644                 [charset(UTF16),string] uint16 *originating_dsa_dn;
1645         } drsuapi_DsReplicaObjMetaData2;
1646
1647         typedef struct {
1648                 uint32 count;
1649                 uint32 enumeration_context;
1650                 [size_is(count)] drsuapi_DsReplicaObjMetaData2 array[];
1651         } drsuapi_DsReplicaObjMetaData2Ctr;
1652
1653         typedef struct {
1654                 [charset(UTF16),string] uint16 *attribute_name;
1655                 [charset(UTF16),string] uint16 *object_dn;
1656                 [value(ndr_size_DATA_BLOB(0,binary,0))] uint32 __ndr_size_binary;
1657                 DATA_BLOB *binary;
1658                 NTTIME deleted;
1659                 NTTIME created;
1660                 uint32 version;
1661                 NTTIME originating_change_time;
1662                 GUID originating_invocation_id;
1663                 hyper originating_usn;
1664                 hyper local_usn;
1665                 [charset(UTF16),string] uint16 *originating_dsa_dn;
1666         } drsuapi_DsReplicaAttrValMetaData2;
1667
1668         typedef struct {
1669                 uint32 count;
1670                 uint32 enumeration_context;
1671                 [size_is(count)] drsuapi_DsReplicaAttrValMetaData2 array[];
1672         } drsuapi_DsReplicaAttrValMetaData2Ctr;
1673
1674         typedef struct {
1675                 hyper u1; /* session number? */
1676                 uint32 u2;
1677                 uint32 u3;
1678                 GUID bind_guid;
1679                 NTTIME_1sec bind_time;
1680                 [flag(NDR_BIG_ENDIAN)] ipv4address client_ip_address;
1681                 uint32 u5; /* this is the same value the client used as pid in the DsBindInfoX struct */
1682         } drsuapi_DsReplicaConnection04;
1683
1684         typedef struct {
1685                 [range(0,10000)] uint32 count;
1686                 uint32 reserved;
1687                 [size_is(count)] drsuapi_DsReplicaConnection04 array[];
1688         } drsuapi_DsReplicaConnection04Ctr;
1689
1690         typedef struct {
1691                 [charset(UTF16),string] uint16 *str1;
1692                 uint32 u1;
1693                 uint32 u2;
1694                 uint32 u3;
1695                 uint32 u4;
1696                 uint32 u5;
1697                 hyper u6;
1698                 uint32 u7;
1699         } drsuapi_DsReplica06;
1700
1701         typedef struct {
1702                 [range(0,256)] uint32 count;
1703                 uint32 reserved;
1704                 [size_is(count)] drsuapi_DsReplica06 array[];
1705         } drsuapi_DsReplica06Ctr;
1706
1707         typedef [switch_type(drsuapi_DsReplicaInfoType)] union {
1708                 [case(DRSUAPI_DS_REPLICA_INFO_NEIGHBORS)] drsuapi_DsReplicaNeighbourCtr *neighbours;
1709                 [case(DRSUAPI_DS_REPLICA_INFO_CURSORS)] drsuapi_DsReplicaCursorCtr *cursors;
1710                 [case(DRSUAPI_DS_REPLICA_INFO_OBJ_METADATA)] drsuapi_DsReplicaObjMetaDataCtr *objmetadata;
1711                 [case(DRSUAPI_DS_REPLICA_INFO_KCC_DSA_CONNECT_FAILURES)] drsuapi_DsReplicaKccDsaFailuresCtr *connectfailures;
1712                 [case(DRSUAPI_DS_REPLICA_INFO_KCC_DSA_LINK_FAILURES)] drsuapi_DsReplicaKccDsaFailuresCtr *linkfailures;
1713                 [case(DRSUAPI_DS_REPLICA_INFO_PENDING_OPS)] drsuapi_DsReplicaOpCtr *pendingops;
1714                 [case(DRSUAPI_DS_REPLICA_INFO_ATTRIBUTE_VALUE_METADATA)] drsuapi_DsReplicaAttrValMetaDataCtr *attrvalmetadata;
1715                 [case(DRSUAPI_DS_REPLICA_INFO_CURSORS2)] drsuapi_DsReplicaCursor2Ctr *cursors2;
1716                 [case(DRSUAPI_DS_REPLICA_INFO_CURSORS3)] drsuapi_DsReplicaCursor3Ctr *cursors3;
1717                 [case(DRSUAPI_DS_REPLICA_INFO_OBJ_METADATA2)] drsuapi_DsReplicaObjMetaData2Ctr *objmetadata2;
1718                 [case(DRSUAPI_DS_REPLICA_INFO_ATTRIBUTE_VALUE_METADATA2)] drsuapi_DsReplicaAttrValMetaData2Ctr *attrvalmetadata2;
1719                 [case(DRSUAPI_DS_REPLICA_INFO_REPSTO)] drsuapi_DsReplicaNeighbourCtr *repsto;
1720                 [case(DRSUAPI_DS_REPLICA_INFO_CLIENT_CONTEXTS)] drsuapi_DsReplicaConnection04Ctr *clientctx;
1721                 [case(DRSUAPI_DS_REPLICA_INFO_UPTODATE_VECTOR_V1)] drsuapi_DsReplicaCursorCtrEx *udv1;
1722                 [case(DRSUAPI_DS_REPLICA_INFO_SERVER_OUTGOING_CALLS)] drsuapi_DsReplica06Ctr *srvoutgoingcalls;
1723         } drsuapi_DsReplicaInfo;
1724
1725         WERROR drsuapi_DsReplicaGetInfo(
1726                 [in] policy_handle *bind_handle,
1727                 [in] drsuapi_DsReplicaGetInfoLevel level,
1728                 [in,ref,switch_is(level)] drsuapi_DsReplicaGetInfoRequest *req,
1729                 [out,ref] drsuapi_DsReplicaInfoType *info_type,
1730                 [out,ref,switch_is(*info_type)] drsuapi_DsReplicaInfo *info
1731                 );
1732
1733         /*****************/
1734         /* Function 0x14 */
1735         [todo] WERROR DRSUAPI_ADD_SID_HISTORY();
1736
1737         /*****************/
1738         /* Function 0x15 */
1739
1740         typedef struct {
1741                 [range(0,10000)] uint32 num_entries;
1742                 [size_is(num_entries)] drsuapi_DsGetMembershipsCtr1 **ctrl_array;
1743         } drsuapi_DsGetMemberships2Ctr1;
1744
1745         typedef [switch_type(uint32)] union {
1746                 [case(1)] drsuapi_DsGetMembershipsCtr1 ctr1;
1747         } drsuapi_DsGetMemberships2Ctr;
1748
1749         typedef struct {
1750                 [range(1,10000)] uint32 num_req;
1751                 [size_is(num_req)] drsuapi_DsGetMembershipsRequest1 **req_array;
1752         } drsuapi_DsGetMemberships2Request1;
1753
1754         typedef [switch_type(uint32)] union {
1755                 [case(1)] drsuapi_DsGetMemberships2Request1 req1;
1756         } drsuapi_DsGetMemberships2Request;
1757
1758         WERROR drsuapi_DsGetMemberships2(
1759                 [in] policy_handle *bind_handle,
1760                 [in] uint32 level,
1761                 [in,ref] [switch_is(level)] drsuapi_DsGetMemberships2Request *req,
1762                 [out,ref] uint32 *level_out,
1763                 [out,ref] [switch_is(*level_out)] drsuapi_DsGetMemberships2Ctr *ctr
1764                 );
1765
1766         /*****************/
1767         /* Function 0x16 */
1768         [todo] WERROR DRSUAPI_REPLICA_VERIFY_OBJECTS();
1769
1770         /*****************/
1771         /* Function 0x17 */
1772         [todo] WERROR DRSUAPI_GET_OBJECT_EXISTENCE();
1773
1774         /*****************/
1775         /* Function 0x18 */
1776         typedef struct {
1777                 WERROR error_code;
1778                 uint32 site_cost;
1779         } drsuapi_DsSiteCostInfo;
1780
1781         typedef struct {
1782                 [range(0,10000)] uint32 num_info;
1783                 [size_is(num_info)] drsuapi_DsSiteCostInfo *info;
1784                 [value(0)] uint32 flags_reserved;
1785         } drsuapi_QuerySitesByCostCtr1;
1786
1787         typedef [switch_type(uint32)] union {
1788                 [case(1)] drsuapi_QuerySitesByCostCtr1 ctr1;
1789         } drsuapi_QuerySitesByCostCtr;
1790
1791         typedef struct {
1792                 [charset(UTF16),string] uint16 *site_from;
1793                 [range(1,10000)] uint32 num_req;
1794                 [size_is(num_req)] [charset(UTF16),string] uint16 **site_to;
1795                 uint32 flags;
1796         } drsuapi_QuerySitesByCostRequest1;
1797
1798         typedef [switch_type(uint32)] union {
1799                 [case(1)] drsuapi_QuerySitesByCostRequest1 req1;
1800         } drsuapi_QuerySitesByCostRequest;
1801
1802         WERROR drsuapi_QuerySitesByCost(
1803                 [in] policy_handle *bind_handle,
1804                 [in] uint32 level,
1805                 [in,ref] [switch_is(level)] drsuapi_QuerySitesByCostRequest *req,
1806                 [out,ref] uint32 *level_out,
1807                 [out,ref] [switch_is(*level_out)] drsuapi_QuerySitesByCostCtr *ctr
1808         );
1809 }