r5672: Use switch_type() and the token storage mechanism for unions:
[samba.git] / source4 / librpc / idl / drsuapi.idl
1 #include "idl_types.h"
2
3
4   uuid("e3514235-4b06-11d1-ab04-00c04fc2dcd2"),
5   version(4.0),
6   endpoint("ncacn_np:[\\pipe\\lsass]","ncacn_np:[\\pipe\\protected_storage]", "ncacn_ip_tcp:", "ncalrpc:"),
7   helpstring("Active Directory Replication"),
8   pointer_default(unique)
9
10 interface drsuapi
11 {
12         /*****************/
13         /* Function 0x00 */
14         typedef [bitmap32bit] bitmap {
15                 DRSUAPI_SUPPORTED_EXTENSION_BASE                        = 0x00000001,
16                 DRSUAPI_SUPPORTED_EXTENSION_ASYNC_REPLICATION           = 0x00000002,
17                 DRSUAPI_SUPPORTED_EXTENSION_REMOVEAPI                   = 0x00000004,
18                 DRSUAPI_SUPPORTED_EXTENSION_MOVEREQ_V2                  = 0x00000008,
19                 DRSUAPI_SUPPORTED_EXTENSION_GETCHG_COMPRESS             = 0x00000010,
20                 DRSUAPI_SUPPORTED_EXTENSION_DCINFO_V1                   = 0x00000020,
21                 DRSUAPI_SUPPORTED_EXTENSION_RESTORE_USN_OPTIMIZATION    = 0x00000040,
22                 DRSUAPI_SUPPORTED_EXTENSION_00000080                    = 0x00000080,
23                 DRSUAPI_SUPPORTED_EXTENSION_KCC_EXECUTE                 = 0x00000100,
24                 DRSUAPI_SUPPORTED_EXTENSION_ADDENTRY_V2                 = 0x00000200,
25                 DRSUAPI_SUPPORTED_EXTENSION_LINKED_VALUE_REPLICATION    = 0x00000400,
26                 DRSUAPI_SUPPORTED_EXTENSION_DCINFO_V2                   = 0x00000800,
27                 DRSUAPI_SUPPORTED_EXTENSION_INSTANCE_TYPE_NOT_REQ_ON_MOD= 0x00001000,
28                 DRSUAPI_SUPPORTED_EXTENSION_CRYPTO_BIND                 = 0x00002000,
29                 DRSUAPI_SUPPORTED_EXTENSION_GET_REPL_INFO               = 0x00004000,
30                 DRSUAPI_SUPPORTED_EXTENSION_STRONG_ENCRYPTION           = 0x00008000,
31                 DRSUAPI_SUPPORTED_EXTENSION_DCINFO_V01                  = 0x00010000,
32                 DRSUAPI_SUPPORTED_EXTENSION_TRANSITIVE_MEMBERSHIP       = 0x00020000,
33                 DRSUAPI_SUPPORTED_EXTENSION_ADD_SID_HISTORY             = 0x00040000,
34                 DRSUAPI_SUPPORTED_EXTENSION_POST_BETA3                  = 0x00080000,
35                 DRSUAPI_SUPPORTED_EXTENSION_00100000                    = 0x00100000,
36                 DRSUAPI_SUPPORTED_EXTENSION_GET_MEMBERSHIPS2            = 0x00200000,
37                 DRSUAPI_SUPPORTED_EXTENSION_GETCHGREQ_V6                = 0x00400000,
38                 DRSUAPI_SUPPORTED_EXTENSION_NONDOMAIN_NCS               = 0x00800000,
39                 DRSUAPI_SUPPORTED_EXTENSION_GETCHGREQ_V8                = 0x01000000,
40                 DRSUAPI_SUPPORTED_EXTENSION_GETCHGREPLY_V5              = 0x02000000,
41                 DRSUAPI_SUPPORTED_EXTENSION_GETCHGREPLY_V6              = 0x04000000,
42                 /*
43                  * the following 3 have the same value
44                  * repadmin.exe /bind says that
45                  */
46                 DRSUAPI_SUPPORTED_EXTENSION_ADDENTRYREPLY_V3            = 0x08000000,
47                 DRSUAPI_SUPPORTED_EXTENSION_GETCHGREPLY_V7              = 0x08000000,
48                 DRSUAPI_SUPPORTED_EXTENSION_VERIFY_OBJECT               = 0x08000000,
49                 DRSUAPI_SUPPORTED_EXTENSION_XPRESS_COMPRESS             = 0x10000000,
50                 DRSUAPI_SUPPORTED_EXTENSION_20000000                    = 0x20000000,
51                 DRSUAPI_SUPPORTED_EXTENSION_40000000                    = 0x40000000,
52                 DRSUAPI_SUPPORTED_EXTENSION_80000000                    = 0x80000000
53         } drsuapi_SupportedExtensions;
54
55         /* this is used by w2k */
56         typedef struct {
57                 drsuapi_SupportedExtensions supported_extensions;
58                 GUID site_guid;
59                 uint32 u1;
60         } drsuapi_DsBindInfo24;
61
62         /* this is used by w2k3 */
63         typedef struct {
64                 drsuapi_SupportedExtensions supported_extensions;
65                 GUID site_guid;
66                 uint32 u1;
67                 uint32 repl_epoch;
68         } drsuapi_DsBindInfo28;
69
70         typedef struct {
71                 [flag(NDR_REMAINING)] DATA_BLOB info;
72         } drsuapi_DsBindInfoFallBack;
73
74         typedef [nodiscriminant] union {
75                 [case(24)][subcontext(4)] drsuapi_DsBindInfo24 info24;
76                 [case(28)][subcontext(4)] drsuapi_DsBindInfo28 info28;
77                 [default][subcontext(4)] drsuapi_DsBindInfoFallBack FallBack;
78         } drsuapi_DsBindInfo;
79
80         /* the drsuapi_DsBindInfoCtr was this before
81          * typedef [flag(NDR_PAHEX)] struct {
82          *      [range(1,10000)] uint32 length;
83          *      [size_is(length)] uint8 data[];
84          * } drsuapi_DsBindInfo;
85          *
86          * but we don't want the caller to manually decode this blob,
87          * so we're doing it here
88          */
89
90         typedef struct {
91                 [range(1,10000)] uint32 length;
92                 [switch_is(length)] drsuapi_DsBindInfo info;
93         } drsuapi_DsBindInfoCtr;
94
95         /* this is a magic guid you need to pass to DsBind to make drsuapi_DsWriteAccountSpn() work
96          * 
97          * maybe the bind_guid could also be the invocation_id see drsuapi_DsReplicaConnection04
98          */
99         const string DRSUAPI_DS_BIND_GUID = "e24d201a-4fd6-11d1-a3da-0000f875ae0d";
100
101         WERROR drsuapi_DsBind(
102                 [in]        GUID *bind_guid,
103                 [in,out]    drsuapi_DsBindInfoCtr *bind_info,
104                 [out,ref]   policy_handle *bind_handle
105                 );
106
107         /*****************/
108         /* Function 0x01 */
109         WERROR drsuapi_DsUnbind(
110                 [in,out,ref] policy_handle *bind_handle
111                 );
112
113         /*****************/
114         /* Function 0x02 */
115         typedef [flag(NDR_PAHEX)] struct {
116                 uint32 unknown1;
117                 uint32 unknown2;
118                 GUID guid1;
119                 uint8 unknown3[28];
120                 [flag(STR_SIZE4|STR_CHARLEN|STR_CONFORMANT)] string nc_dn;
121         } drsuapi_DsReplicaSyncRequest1Info;
122
123         typedef struct {
124                 drsuapi_DsReplicaSyncRequest1Info *info;
125                 GUID guid1;
126                 astring *string1;
127                 uint32 unknown1;
128         } drsuapi_DsReplicaSyncRequest1;
129
130         typedef [switch_type(int32)] union {
131                 [case(1)] drsuapi_DsReplicaSyncRequest1 req1;
132         } drsuapi_DsReplicaSyncRequest;
133
134         WERROR drsuapi_DsReplicaSync(
135                 [in,ref] policy_handle *bind_handle,
136                 [in] int32 level,
137                 [in,switch_is(level)] drsuapi_DsReplicaSyncRequest req
138                 );
139
140         /*****************/
141         /* Function 0x03 */
142         WERROR DRSUAPI_GET_NC_CHANGES();
143
144         /*****************/
145         /* Function 0x04 */
146         WERROR DRSUAPI_UPDATE_REFS();
147
148         /*****************/
149         /* Function 0x05 */
150         WERROR DRSUAPI_REPLICA_ADD();
151
152         /*****************/
153         /* Function 0x06 */
154         WERROR DRSUAPI_REPLICA_DEL();
155
156         /*****************/
157         /* Function 0x07 */
158         WERROR DRSUAPI_REPLICA_MODIFY();
159
160         /*****************/
161         /* Function 0x08 */
162         WERROR DRSUAPI_VERIFY_NAMES();
163
164         /*****************/
165         /* Function 0x09 */
166         WERROR DRSUAPI_GET_MEMBERSHIPS();
167
168         /*****************/
169         /* Function 0x0a */
170         WERROR DRSUAPI_INTER_DOMAIN_MOVE();
171
172         /*****************/
173         /* Function 0x0b */
174         WERROR DRSUAPI_GET_NT4_CHANGELOG();
175
176         /*****************/
177         /* Function 0x0c */
178         typedef [v1_enum] enum {
179                 DRSUAPI_DS_NAME_STATUS_OK                       = 0,
180                 DRSUAPI_DS_NAME_STATUS_RESOLVE_ERROR            = 1,
181                 DRSUAPI_DS_NAME_STATUS_NOT_FOUND                = 2,
182                 DRSUAPI_DS_NAME_STATUS_NOT_UNIQUE               = 3,
183                 DRSUAPI_DS_NAME_STATUS_NO_MAPPING               = 4,
184                 DRSUAPI_DS_NAME_STATUS_DOMAIN_ONLY              = 5,
185                 DRSUAPI_DS_NAME_STATUS_NO_SYNTACTICAL_MAPPING   = 6,
186                 DRSUAPI_DS_NAME_STATUS_TRUST_REFERRAL           = 7
187         } drsuapi_DsNameStatus;
188
189         typedef [v1_enum] enum {
190                 DRSUAPI_DS_NAME_FLAG_NO_FLAGS                   = 0x0,
191                 DRSUAPI_DS_NAME_FLAG_SYNTACTICAL_ONLY           = 0x1,
192                 DRSUAPI_DS_NAME_FLAG_EVAL_AT_DC                 = 0x2,
193                 DRSUAPI_DS_NAME_FLAG_GCVERIFY                   = 0x4,
194                 DRSUAPI_DS_NAME_FLAG_TRUST_REFERRAL             = 0x8
195         } drsuapi_DsNameFlags;
196
197         typedef [v1_enum] enum {
198                 DRSUAPI_DS_NAME_FORMAT_UKNOWN                   = 0,
199                 DRSUAPI_DS_NAME_FORMAT_FQDN_1779                = 1,
200                 DRSUAPI_DS_NAME_FORMAT_NT4_ACCOUNT              = 2,
201                 DRSUAPI_DS_NAME_FORMAT_DISPLAY                  = 3,
202                 DRSUAPI_DS_NAME_FORMAT_GUID                     = 6,
203                 DRSUAPI_DS_NAME_FORMAT_CANONICAL                = 7,
204                 DRSUAPI_DS_NAME_FORMAT_USER_PRINCIPAL           = 8,
205                 DRSUAPI_DS_NAME_FORMAT_CANONICAL_EX             = 9,
206                 DRSUAPI_DS_NAME_FORMAT_SERVICE_PRINCIPAL        = 10,
207                 DRSUAPI_DS_NAME_FORMAT_SID_OR_SID_HISTORY       = 11,
208                 DRSUAPI_DS_NAME_FORMAT_DNS_DOMAIN               = 12
209         } drsuapi_DsNameFormat;
210
211         typedef struct {
212                 unistr *str;
213         } drsuapi_DsNameString;
214
215         typedef struct {
216                 uint32 unknown1; /* 0x000004e4 */
217                 uint32 unknown2; /* 0x00000407 */
218                 drsuapi_DsNameFlags format_flags;
219                 drsuapi_DsNameFormat format_offered;
220                 drsuapi_DsNameFormat format_desired;
221                 [range(1,10000)] uint32 count;
222                 [size_is(count)] drsuapi_DsNameString *names[];
223         } drsuapi_DsNameRequest1;
224
225         typedef [switch_type(int32)] union {
226                 [case(1)] drsuapi_DsNameRequest1 req1;
227         } drsuapi_DsNameRequest;
228
229         typedef struct {
230                 drsuapi_DsNameStatus status;
231                 unistr *dns_domain_name;
232                 unistr *result_name;
233         } drsuapi_DsNameInfo1;
234
235         typedef struct {
236                 uint32 count;
237                 [size_is(count)] drsuapi_DsNameInfo1 *array[];
238         } drsuapi_DsNameCtr1;
239
240         typedef [switch_type(int32)] union {
241                 [case(1)] drsuapi_DsNameCtr1 *ctr1;
242         } drsuapi_DsNameCtr;
243
244         WERROR drsuapi_DsCrackNames(
245                 [in,ref] policy_handle *bind_handle,
246                 [in, out] int32 level,
247                 [in,switch_is(level)] drsuapi_DsNameRequest req,
248                 [out,switch_is(level)] drsuapi_DsNameCtr ctr
249                 );
250
251         /*****************/
252         /* Function 0x0d */
253         typedef [v1_enum] enum {
254                 DRSUAPI_DS_SPN_OPERATION_ADD    = 0,
255                 DRSUAPI_DS_SPN_OPERATION_REPLACE= 1,
256                 DRSUAPI_DS_SPN_OPERATION_DELETE = 2
257         } drsuapi_DsSpnOperation;
258
259         typedef struct {
260                 drsuapi_DsSpnOperation operation;
261                 uint32 unknown1;
262                 unistr *object_dn;
263                 [range(0,10000)] uint32 count;
264                 [size_is(count)] drsuapi_DsNameString *spn_names[];
265         } drsuapi_DsWriteAccountSpnRequest1;
266
267         typedef [switch_type(int32)] union {
268                 [case(1)] drsuapi_DsWriteAccountSpnRequest1 req1;
269         } drsuapi_DsWriteAccountSpnRequest;
270
271         typedef struct {
272                 WERROR status;
273         } drsuapi_DsWriteAccountSpnResult1;
274
275         typedef [switch_type(int32)] union {
276                 [case(1)] drsuapi_DsWriteAccountSpnResult1 res1;
277         } drsuapi_DsWriteAccountSpnResult;
278
279         WERROR drsuapi_DsWriteAccountSpn(
280                 [in,ref] policy_handle *bind_handle,
281                 [in, out] int32 level,
282                 [in,switch_is(level)] drsuapi_DsWriteAccountSpnRequest req,
283                 [out,switch_is(level)] drsuapi_DsWriteAccountSpnResult res
284                 );
285
286         /*****************/
287         /* Function 0x0e */
288         WERROR DRSUAPI_REMOVE_DS_SERVER();
289
290         /*****************/
291         /* Function 0x0f */
292         WERROR DRSUAPI_REMOVE_DS_DOMAIN();
293
294         /*****************/
295         /* Function 0x10 */
296         typedef struct {
297                 unistr *domain_name; /* netbios or dns */
298                 int32 level; /* specifies the switch level for the request */
299         } drsuapi_DsGetDCInfoRequest1;
300
301         typedef [switch_type(int32)] union {
302                 [case(1)] drsuapi_DsGetDCInfoRequest1 req1;
303         } drsuapi_DsGetDCInfoRequest;
304
305         typedef struct {
306                 unistr *netbios_name;
307                 unistr *dns_name;
308                 unistr *site_name;
309                 unistr *computer_dn;
310                 unistr *server_dn;
311                 uint32 is_pdc;
312                 uint32 is_enabled;
313         } drsuapi_DsGetDCInfo1;
314
315         typedef struct {
316                 [range(0,10000)] uint32 count;
317                 [size_is(count)] drsuapi_DsGetDCInfo1 *array[];
318         } drsuapi_DsGetDCInfoCtr1;
319
320         typedef struct {
321                 unistr *netbios_name;
322                 unistr *dns_name;
323                 unistr *site_name;
324                 unistr *site_dn;
325                 unistr *computer_dn;
326                 unistr *server_dn;
327                 unistr *ntds_dn;
328                 uint32 is_pdc;
329                 uint32 is_enabled;
330                 uint32 is_gc;
331                 GUID site_guid;
332                 GUID computer_guid;
333                 GUID server_guid;
334                 GUID ntds_guid;
335         } drsuapi_DsGetDCInfo2;
336
337         typedef struct {
338                 [range(0,10000)] uint32 count;
339                 [size_is(count)] drsuapi_DsGetDCInfo2 *array[];
340         } drsuapi_DsGetDCInfoCtr2;
341
342         typedef struct {
343                 uint32 unknown1;
344                 uint32 unknown2;
345                 uint32 unknown3;
346                 uint32 unknown4;
347                 uint32 unknown5;
348                 uint32 unknown6;
349                 unistr *server_nt4_account;
350         } drsuapi_DsGetDCInfo01;
351
352         typedef struct {
353                 [range(0,10000)] uint32 count;
354                 [size_is(count)] drsuapi_DsGetDCInfo01 *array[];
355         } drsuapi_DsGetDCInfoCtr01;
356
357         typedef [switch_type(int32)] union {
358                 [case(1)] drsuapi_DsGetDCInfoCtr1 ctr1;
359                 [case(2)] drsuapi_DsGetDCInfoCtr2 ctr2;
360                 [case(-1)] drsuapi_DsGetDCInfoCtr01 ctr01;
361         } drsuapi_DsGetDCInfoCtr;
362
363         WERROR drsuapi_DsGetDomainControllerInfo(
364                 [in,ref] policy_handle *bind_handle,
365                 [in, out] int32 level,
366                 [in,switch_is(level)] drsuapi_DsGetDCInfoRequest req,
367                 [out,switch_is(level)] drsuapi_DsGetDCInfoCtr ctr
368                 );
369
370         /*****************/
371         /* Function 0x11 */
372         WERROR DRSUAPI_ADD_ENTRY();
373
374         /*****************/
375         /* Function 0x12 */
376         WERROR DRSUAPI_EXECUTE_KCC();
377
378         /*****************/
379         /* Function 0x13 */
380         typedef [v1_enum] enum {
381                 DRSUAPI_DS_REPLICA_GET_INFO                             = 1,
382                 DRSUAPI_DS_REPLICA_GET_INFO2                            = 2
383         } drsuapi_DsReplicaGetInfoLevel;
384
385         typedef [v1_enum] enum {
386                 DRSUAPI_DS_REPLICA_INFO_NEIGHBORS                       = 0,
387                 DRSUAPI_DS_REPLICA_INFO_CURSORS                         = 1,
388                 DRSUAPI_DS_REPLICA_INFO_OBJ_METADATA                    = 2,
389                 DRSUAPI_DS_REPLICA_INFO_KCC_DSA_CONNECT_FAILURES        = 3,
390                 DRSUAPI_DS_REPLICA_INFO_KCC_DSA_LINK_FAILURES           = 4,
391                 DRSUAPI_DS_REPLICA_INFO_PENDING_OPS                     = 5,
392                 DRSUAPI_DS_REPLICA_INFO_ATTRIBUTE_VALUE_METADATA        = 6,
393                 DRSUAPI_DS_REPLICA_INFO_CURSORS2                        = 7,
394                 DRSUAPI_DS_REPLICA_INFO_CURSORS3                        = 8,
395                 DRSUAPI_DS_REPLICA_INFO_OBJ_METADATA2                   = 9,
396                 DRSUAPI_DS_REPLICA_INFO_ATTRIBUTE_VALUE_METADATA2       = 10,
397                 DRSUAPI_DS_REPLICA_INFO_NEIGHBORS02                     = -2,
398                 DRSUAPI_DS_REPLICA_INFO_CONNECTIONS04                   = -4,
399                 DRSUAPI_DS_REPLICA_INFO_CURSURS05                       = -5,
400                 DRSUAPI_DS_REPLICA_INFO_06                              = -6
401         } drsuapi_DsReplicaInfoType;
402
403         typedef struct {
404                 drsuapi_DsReplicaInfoType info_type;
405                 unistr *object_dn;
406                 GUID guid1;
407         } drsuapi_DsReplicaGetInfoRequest1;
408
409         typedef struct {
410                 drsuapi_DsReplicaInfoType info_type;
411                 unistr *object_dn;
412                 GUID guid1;
413                 uint32 unknown1;
414                 unistr *string1;
415                 unistr *string2;
416                 uint32 unknown2;
417         } drsuapi_DsReplicaGetInfoRequest2;
418
419         typedef [switch_type(drsuapi_DsReplicaGetInfoLevel)] union {
420                 [case(DRSUAPI_DS_REPLICA_GET_INFO)] drsuapi_DsReplicaGetInfoRequest1 req1;
421                 [case(DRSUAPI_DS_REPLICA_GET_INFO2)] drsuapi_DsReplicaGetInfoRequest2 req2;
422         } drsuapi_DsReplicaGetInfoRequest;
423
424         typedef struct {
425                 unistr *naming_context_dn;
426                 unistr *source_dsa_obj_dn;
427                 unistr *source_dsa_address;
428                 unistr *transport_obj_dn;
429                 uint32 replica_flags;
430                 uint32 reserved;
431                 GUID naming_context_obj_guid;
432                 GUID source_dsa_obj_guid;
433                 GUID source_dsa_invocation_id;
434                 GUID transport_obj_guid;
435                 hyper tmp_highest_usn;
436                 hyper highest_usn;
437                 NTTIME last_success;
438                 NTTIME last_attempt;
439                 WERROR result_last_attempt;
440                 uint32 consecutive_sync_failures;
441         } drsuapi_DsReplicaNeighbour;
442
443         typedef struct {
444                 uint32 count;
445                 uint32 reserved;
446                 [size_is(count)] drsuapi_DsReplicaNeighbour array[];
447         } drsuapi_DsReplicaNeighbourCtr;
448
449         typedef struct {
450                 GUID source_dsa_invocation_id;
451                 hyper highest_usn;
452         } drsuapi_DsReplicaCoursor;
453
454         typedef struct {
455                 uint32 count;
456                 uint32 reserved;
457                 [size_is(count)] drsuapi_DsReplicaCoursor array[];
458         } drsuapi_DsReplicaCoursorCtr;
459
460         typedef struct {
461                 unistr *attribute_name;
462                 uint32 version;
463                 NTTIME originating_last_changed;
464                 GUID originating_dsa_invocation_id;
465                 hyper originating_usn;
466                 hyper local_usn;
467         } drsuapi_DsReplicaObjMetaData;
468
469         typedef struct {
470                 uint32 count;
471                 uint32 reserved;
472                 [size_is(count)] drsuapi_DsReplicaObjMetaData array[];
473         } drsuapi_DsReplicaObjMetaDataCtr;
474
475         typedef struct {
476                 unistr *dsa_obj_dn;
477                 GUID dsa_obj_guid;
478                 NTTIME first_failure;
479                 uint32 num_failures;
480                 WERROR last_result;
481         } drsuapi_DsReplicaKccDsaFailure;
482
483         typedef struct {
484                 uint32 count;
485                 uint32 reserved;
486                 [size_is(count)] drsuapi_DsReplicaKccDsaFailure array[];
487         } drsuapi_DsReplicaKccDsaFailuresCtr;
488
489         typedef struct {
490                 NTTIME operation_start;
491                 uint32 serial_num; /* unique till reboot */
492                 uint32 priority;
493                 uint16 operation_type;
494                 uint32 options_flags;
495                 unistr *nc_dn;
496                 unistr *remote_dsa_obj_dn;
497                 unistr *remote_dsa_address;
498                 GUID nc_obj_guid;
499                 GUID remote_dsa_obj_guid;
500         } drsuapi_DsReplicaOp;
501
502         typedef struct {
503                 NTTIME time;
504                 uint32 count;
505                 [size_is(count)] drsuapi_DsReplicaOp array[];
506         } drsuapi_DsReplicaOpCtr;
507
508         typedef struct {
509                 unistr *attribute_name;
510                 unistr *object_dn;
511                 uint32 value_length;
512                 [size_is(value_length)] uint8 *value[];
513                 NTTIME deleted;
514                 NTTIME created;
515                 uint32 version;
516                 NTTIME originating_last_changed;
517                 GUID originating_dsa_invocation_id;
518                 hyper originating_usn;
519                 hyper local_usn;
520         } drsuapi_DsReplicaAttrValMetaData;
521
522         typedef struct {
523                 uint32 count;
524                 int32 enumeration_context;
525                 [size_is(count)] drsuapi_DsReplicaAttrValMetaData array[];
526         } drsuapi_DsReplicaAttrValMetaDataCtr;
527
528         typedef struct {
529                 GUID source_dsa_invocation_id;
530                 hyper highest_usn;
531                 NTTIME last_sync_success;
532         } drsuapi_DsReplicaCoursor2;
533
534         typedef struct {
535                 uint32 count;
536                 int32 enumeration_context;
537                 [size_is(count)] drsuapi_DsReplicaCoursor2 array[];
538         } drsuapi_DsReplicaCoursor2Ctr;
539
540         typedef struct {
541                 GUID source_dsa_invocation_id;
542                 hyper highest_usn;
543                 NTTIME last_sync_success;
544                 unistr *source_dsa_obj_dn;
545         } drsuapi_DsReplicaCoursor3;
546
547         typedef struct {
548                 uint32 count;
549                 int32 enumeration_context;
550                 [size_is(count)] drsuapi_DsReplicaCoursor3 array[];
551         } drsuapi_DsReplicaCoursor3Ctr;
552
553         typedef struct {
554                 unistr *attribute_name;
555                 uint32 version;
556                 NTTIME originating_last_changed;
557                 GUID originating_dsa_invocation_id;
558                 hyper originating_usn;
559                 hyper local_usn;
560                 unistr *originating_dsa_obj_dn;
561         } drsuapi_DsReplicaObjMetaData2;
562
563         typedef struct {
564                 uint32 count;
565                 int32 enumeration_context;
566                 [size_is(count)] drsuapi_DsReplicaObjMetaData2 array[];
567         } drsuapi_DsReplicaObjMetaData2Ctr;
568
569         typedef struct {
570                 unistr *attribute_name;
571                 unistr *object_dn;
572                 uint32 value_length;
573                 [size_is(value_length)] uint8 *value[];
574                 NTTIME deleted;
575                 NTTIME created;
576                 uint32 version;
577                 NTTIME originating_last_changed;
578                 GUID originating_dsa_invocation_id;
579                 hyper originating_usn;
580                 hyper local_usn;
581                 unistr *originating_dsa_obj_dn;
582         } drsuapi_DsReplicaAttrValMetaData2;
583
584         typedef struct {
585                 uint32 count;
586                 int32 enumeration_context;
587                 [size_is(count)] drsuapi_DsReplicaAttrValMetaData2 array[];
588         } drsuapi_DsReplicaAttrValMetaData2Ctr;
589
590         typedef struct {
591                 hyper u1; /* session number? */
592                 uint32 u2;
593                 uint32 u3;
594                 GUID bind_guid;
595                 NTTIME_1sec bind_time;
596                 uint32 u4; /* flags? */
597                 uint32 u5;
598         } drsuapi_DsReplicaConnection04;
599
600         typedef struct {
601                 [range(0,10000)] uint32 count;
602                 uint32 reserved;
603                 [size_is(count)] drsuapi_DsReplicaConnection04 array[];
604         } drsuapi_DsReplicaConnection04Ctr;
605
606         typedef struct {
607                 uint32 u1;
608                 uint32 u2;
609                 [range(0,0x100000)] uint32 count;
610                 uint32 u3;
611                 [size_is(count)] drsuapi_DsReplicaCoursor array[];
612         } drsuapi_DsReplicaCoursor05Ctr;
613
614         typedef struct {
615                 unistr *str1;
616                 uint32 u1;
617                 uint32 u2;
618                 uint32 u3;
619                 uint32 u4;
620                 uint32 u5;
621                 hyper u6;
622                 uint32 u7;
623         } drsuapi_DsReplica06;
624
625         typedef struct {
626                 [range(0,256)] uint32 count;
627                 uint32 reserved;
628                 [size_is(count)] drsuapi_DsReplica06 array[];
629         } drsuapi_DsReplica06Ctr;
630
631         typedef [switch_type(drsuapi_DsReplicaInfoType)] union {
632                 [case(DRSUAPI_DS_REPLICA_INFO_NEIGHBORS)] drsuapi_DsReplicaNeighbourCtr *neighbours;
633                 [case(DRSUAPI_DS_REPLICA_INFO_CURSORS)] drsuapi_DsReplicaCoursorCtr *coursors;
634                 [case(DRSUAPI_DS_REPLICA_INFO_OBJ_METADATA)] drsuapi_DsReplicaObjMetaDataCtr *objmetadata;
635                 [case(DRSUAPI_DS_REPLICA_INFO_KCC_DSA_CONNECT_FAILURES)] drsuapi_DsReplicaKccDsaFailuresCtr *connectfailures;
636                 [case(DRSUAPI_DS_REPLICA_INFO_KCC_DSA_LINK_FAILURES)] drsuapi_DsReplicaKccDsaFailuresCtr *linkfailures;
637                 [case(DRSUAPI_DS_REPLICA_INFO_PENDING_OPS)] drsuapi_DsReplicaOpCtr *pendingops;
638                 [case(DRSUAPI_DS_REPLICA_INFO_ATTRIBUTE_VALUE_METADATA)] drsuapi_DsReplicaAttrValMetaDataCtr *attrvalmetadata;
639                 [case(DRSUAPI_DS_REPLICA_INFO_CURSORS2)] drsuapi_DsReplicaCoursor2Ctr *coursors2;
640                 [case(DRSUAPI_DS_REPLICA_INFO_CURSORS3)] drsuapi_DsReplicaCoursor3Ctr *coursors3;
641                 [case(DRSUAPI_DS_REPLICA_INFO_OBJ_METADATA2)] drsuapi_DsReplicaObjMetaData2Ctr *objmetadata2;
642                 [case(DRSUAPI_DS_REPLICA_INFO_ATTRIBUTE_VALUE_METADATA2)] drsuapi_DsReplicaAttrValMetaData2Ctr *attrvalmetadata2;
643                 [case(DRSUAPI_DS_REPLICA_INFO_NEIGHBORS02)] drsuapi_DsReplicaNeighbourCtr *neighbours02;
644                 [case(DRSUAPI_DS_REPLICA_INFO_CONNECTIONS04)] drsuapi_DsReplicaConnection04Ctr *connections04;
645                 [case(DRSUAPI_DS_REPLICA_INFO_CURSURS05)] drsuapi_DsReplicaCoursor05Ctr *coursors05;
646                 [case(DRSUAPI_DS_REPLICA_INFO_06)] drsuapi_DsReplica06Ctr *i06;
647         } drsuapi_DsReplicaInfo;
648
649         WERROR drsuapi_DsReplicaGetInfo(
650                 [in,ref] policy_handle *bind_handle,
651                 [in] drsuapi_DsReplicaGetInfoLevel level,
652                 [in,switch_is(level)] drsuapi_DsReplicaGetInfoRequest req,
653                 [out] drsuapi_DsReplicaInfoType info_type,
654                 [out,switch_is(info_type)] drsuapi_DsReplicaInfo info
655                 );
656
657         /*****************/
658         /* Function 0x14 */
659         WERROR DRSUAPI_ADD_SID_HISTORY();
660
661         /*****************/
662         /* Function 0x15 */
663         WERROR DRSUAPI_GET_MEMBERSHIPS2();
664
665         /*****************/
666         /* Function 0x16 */
667         WERROR DRSUAPI_REPLICA_VERIFY_OBJECTS();
668
669         /*****************/
670         /* Function 0x17 */
671         WERROR DRSUAPI_GET_OBJECT_EXISTENCE();
672
673         /*****************/
674         /* Function 0x18 */
675         WERROR DRSUAPI_QUERY_SITES_BY_COST();
676 }