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