r3428: switched to using minimal includes for the auto-generated RPC code.
[metze/samba/wip.git] / source4 / librpc / idl / netlogon.idl
1 /*
2   netlogon interface
3   much of this was derived from the ethereal sources - thanks to everyone 
4   who contributed!
5 */
6
7 #include "idl_types.h"
8
9 [
10   uuid("12345678-1234-abcd-ef00-01234567cffb"),
11   version(1.0),
12   endpoint("ncacn_np:[\\pipe\\netlogon]","ncacn_ip_tcp:","ncalrpc:"),
13   pointer_default(unique),
14   depends(lsa,samr)
15 ]
16
17 interface netlogon
18 {
19         typedef [public] struct {
20                 [value(strlen_m(r->string)*2)]  uint16 size;
21                 [value(r->size)]                uint16 length;
22                 unistr_noterm *string;
23         } netr_String;
24         
25         /*****************/
26         /* Function 0x00 */
27
28         typedef struct {
29                 unistr *account_name;
30                 uint32 priv;
31                 uint32 auth_flags;
32                 uint32 logon_count;
33                 uint32 bad_pw_count;
34                 time_t last_logon;
35                 time_t last_logoff;
36                 time_t logoff_time;
37                 time_t kickoff_time;
38                 uint32 password_age;
39                 time_t pw_can_change;
40                 time_t pw_must_change;
41                 unistr *computer;
42                 unistr *domain;
43                 unistr *script_path;
44                 uint32 unknown;
45         } netr_UasInfo;
46
47         WERROR netr_LogonUasLogon(
48                 [in]   unistr *server_name,
49                 [in]   unistr account_name,
50                 [in]   unistr workstation,
51                 [out]  netr_UasInfo *info
52                 );
53
54
55         /*****************/
56         /* Function 0x01 */
57
58         typedef struct {
59                 uint32 duration;
60                 uint16 logon_count;
61         } netr_UasLogoffInfo;
62
63         WERROR netr_LogonUasLogoff(
64                 [in] unistr *server_name,
65                 [in] unistr account_name,
66                 [in] unistr workstation,
67                 [out] netr_UasLogoffInfo info
68                 );
69
70
71         /*****************/
72         /* Function 0x02 */
73
74         /* in netr_AcctLockStr size seems to be be 24, and rrenard thinks 
75            that the structure of the bindata looks like this:
76
77                 uint64 lockout_duration;
78                 uint64 reset_count;
79                 uint32 bad_attempt_lockout;
80                 uint32 dummy;   
81
82            but it doesn't look as though this structure is reflected at the
83            NDR level. Maybe it is left to the application to decode the bindata array.
84         */
85         typedef struct {
86                 uint16 size;
87                 uint16 length;
88                 [size_is(size/2),length_is(length/2)] uint16 *bindata;
89         } netr_AcctLockStr;
90
91         typedef struct {
92                 netr_String domain_name;
93                 uint32      parameter_control;
94                 uint32      logon_id_low;
95                 uint32      logon_id_high;
96                 netr_String account_name;
97                 netr_String workstation;
98         } netr_IdentityInfo;
99
100         typedef struct {
101                 netr_IdentityInfo identity_info;
102                 samr_Password lmpassword;
103                 samr_Password ntpassword;
104         } netr_PasswordInfo;
105
106         typedef [flag(NDR_PAHEX)] struct {
107                 uint16 length;
108                 [value(r->length)] uint16 size;
109                 [size_is(size),length_is(length)] uint8 *data;
110         } netr_ChallengeResponse;
111
112         typedef [flag(NDR_PAHEX)] struct {
113                 netr_IdentityInfo identity_info;
114                 uint8 challenge[8];
115                 netr_ChallengeResponse nt;
116                 netr_ChallengeResponse lm;
117         } netr_NetworkInfo;
118
119         typedef union {
120                 [case(1)] netr_PasswordInfo *password;
121                 [case(2)] netr_NetworkInfo  *network;
122                 [case(3)] netr_PasswordInfo *password;
123                 [case(5)] netr_PasswordInfo *password;
124                 [case(6)] netr_NetworkInfo  *network;
125         } netr_LogonLevel;
126
127         typedef [public] struct {
128                 uint32 rid;
129                 uint32 attributes;
130         } netr_GroupMembership;
131
132         typedef [public] struct {
133                 NTTIME last_logon;
134                 NTTIME last_logoff;
135                 NTTIME acct_expiry;
136                 NTTIME last_password_change;
137                 NTTIME allow_password_change;
138                 NTTIME force_password_change;
139                 netr_String account_name;
140                 netr_String full_name;
141                 netr_String logon_script;
142                 netr_String profile_path;
143                 netr_String home_directory;
144                 netr_String home_drive;
145                 uint16 logon_count;
146                 uint16 bad_password_count;
147                 uint32 rid;
148                 uint32 primary_gid;
149                 uint32 group_count;
150                 [size_is(group_count)] netr_GroupMembership *groupids;
151                 uint32 user_flags;
152                 netr_UserSessionKey key;
153                 netr_String logon_server;
154                 netr_String domain;
155                 dom_sid2 *domain_sid;
156                 netr_LMSessionKey LMSessKey;
157                 uint32 acct_flags;
158                 uint32 unknown[7];
159         } netr_SamBaseInfo;
160
161         typedef [public] struct {
162                 netr_SamBaseInfo base;
163         } netr_SamInfo2;
164
165         typedef [public] struct {
166                 dom_sid2 *sid;
167                 uint32 attribute;
168         } netr_SidAttr;
169
170         typedef [public] struct {
171                 netr_SamBaseInfo base;
172                 uint32 sidcount;
173                 [size_is(sidcount)] netr_SidAttr *sids;
174         } netr_SamInfo3;
175
176         typedef struct {
177                 netr_SamBaseInfo base;
178                 uint32 sidcount;
179                 [size_is(sidcount)] netr_SidAttr *sids;
180                 netr_String forest;
181                 netr_String principle;
182                 uint32 unknown4[20];
183         } netr_SamInfo6;
184
185         typedef struct {
186                 uint32 pac_size;
187                 [size_is(pac_size)] uint8 *pac;
188                 netr_String logon_domain;
189                 netr_String logon_server;
190                 netr_String principal_name;
191                 uint32 auth_size;
192                 [size_is(auth_size)] uint8 *auth;
193                 netr_UserSessionKey user_session_key;
194                 uint32 expansionroom[10];
195                 netr_String unknown1;
196                 netr_String unknown2;
197                 netr_String unknown3;
198                 netr_String unknown4;
199         } netr_PacInfo;
200
201         typedef union {
202                 [case(2)] netr_SamInfo2 *sam2;
203                 [case(3)] netr_SamInfo3 *sam3;
204                 [case(4)] netr_PacInfo  *pac;
205                 [case(5)] netr_PacInfo  *pac;
206                 [case(6)] netr_SamInfo6 *sam6;
207         } netr_Validation;
208
209         NTSTATUS netr_LogonSamLogon(
210                 [in] unistr *server_name,
211                 [in] unistr *workstation,
212                 [in] netr_Authenticator *credential,
213                 [in][out] netr_Authenticator *return_authenticator,
214                 [in]  uint16 logon_level,
215                 [in]  [switch_is(logon_level)] netr_LogonLevel logon,
216                 [in]  uint16 validation_level,
217                 [out] [switch_is(validation_level)] netr_Validation validation,
218                 [out] uint32 authoritative
219                 );
220
221
222         /*****************/
223         /* Function 0x03 */
224
225         NTSTATUS netr_LogonSamLogoff(
226                 [in] unistr *server_name,
227                 [in] unistr *computer_name,
228                 [in]      netr_Authenticator *credential,
229                 [in][out] netr_Authenticator *return_authenticator,
230                 [in] uint16 logon_level,
231                 [in] [switch_is(logon_level)] netr_LogonLevel logon
232                 );
233
234
235
236         /*****************/
237         /* Function 0x04 */
238
239         NTSTATUS netr_ServerReqChallenge(
240                 [in]         unistr *server_name,
241                 [in]         unistr computer_name,
242                 [in,out,ref] netr_Credential *credentials
243                 );
244
245
246         /*****************/
247         /* Function 0x05 */
248
249         /* secure channel types */
250         const int SEC_CHAN_WKSTA   = 2;
251         const int SEC_CHAN_DOMAIN  = 4;
252         const int SEC_CHAN_BDC     = 6;
253
254         NTSTATUS netr_ServerAuthenticate(
255                 [in]         unistr *server_name,
256                 [in]         unistr account_name,
257                 [in]         uint16 secure_channel_type,
258                 [in]         unistr computer_name,
259                 [in,out,ref] netr_Credential *credentials
260                 );
261
262
263         /*****************/
264         /* Function 0x06 */
265
266         NTSTATUS netr_ServerPasswordSet(
267                 [in]  unistr *server_name,
268                 [in]  unistr account_name,
269                 [in]  uint16 secure_channel_type,
270                 [in]  unistr computer_name,
271                 [in]  netr_Authenticator credential,
272                 [in]  samr_Password new_password,
273                 [out] netr_Authenticator return_authenticator
274                 );
275
276
277         /*****************/
278         /* Function 0x07 */
279
280         typedef struct {
281                 unistr *account_name;
282                 netr_String unknown1;
283                 netr_String unknown2;
284                 netr_String unknown3;
285                 netr_String unknown4;
286                 uint32 unknown5;
287                 uint32 unknown6;
288                 uint32 unknown7;
289                 uint32 unknown8;
290         } netr_DELTA_DELETE_USER;
291
292         typedef struct {
293                 bool8  SensitiveDataFlag;
294                 uint32 DataLength;
295                 [size_is(DataLength)] uint8 *SensitiveData;
296         } netr_USER_PRIVATE_INFO;
297
298         typedef struct {
299                 netr_String account_name;
300                 netr_String full_name;
301                 uint32 rid;
302                 uint32 primary_group;
303                 netr_String home_dir;
304                 netr_String home_drive;
305                 netr_String logon_script;
306                 netr_String description;
307                 netr_String workstations;
308                 NTTIME LastLogon;
309                 NTTIME LastLogoff;
310                 samr_LogonHours logon_hours;
311                 uint16 bad_pw_count;
312                 uint16 logon_count;
313                 NTTIME PwLastSet;
314                 NTTIME AccountExpires;
315                 uint32 AccountControl;
316                 samr_Password lmpw;
317                 samr_Password ntpw;
318                 bool8 NTPwPresent;
319                 bool8 LMPwPresent;
320                 bool8 PwExpired;
321                 netr_String UserComment;
322                 netr_String Parameters;
323                 uint16 CountryCode;
324                 uint16 CodePage;
325                 netr_USER_PRIVATE_INFO user_private_info;
326                 uint32 SecurityInformation;
327                 sec_desc_buf sdbuf;
328                 netr_String profile_path;
329                 netr_String unknown2;
330                 netr_String unknown3;
331                 netr_String unknown4;
332                 uint32 unknown5;
333                 uint32 unknown6;
334                 uint32 unknown7;
335                 uint32 unknown8;
336         } netr_DELTA_USER;
337
338         typedef struct {
339                 netr_String DomainName;
340                 netr_String OEMInfo;
341                 NTTIME forcedlogoff;
342                 uint16 min_password_len;
343                 uint16 password_history_len;
344                 uint64 password_must_change_time;
345                 uint64 password_can_change_time;
346                 uint64 sequence_num;
347                 NTTIME domain_create_time;
348                 uint32 SecurityInformation;
349                 sec_desc_buf sdbuf;
350                 netr_AcctLockStr account_lockout;
351                 netr_String unknown2;
352                 netr_String unknown3;
353                 netr_String unknown4;
354                 uint32 unknown5;
355                 uint32 unknown6;
356                 uint32 unknown7;
357                 uint32 unknown8;
358         } netr_DELTA_DOMAIN;
359
360         typedef struct {
361                 netr_String groupname;
362                 netr_GroupMembership group_membership;
363                 netr_String comment;
364                 uint32 SecurityInformation;
365                 sec_desc_buf sdbuf;
366                 netr_String unknown1;
367                 netr_String unknown2;
368                 netr_String unknown3;
369                 netr_String unknown4;
370                 uint32 unknown5;
371                 uint32 unknown6;
372                 uint32 unknown7;
373                 uint32 unknown8;
374         } netr_DELTA_GROUP;
375
376         typedef struct {
377                 netr_String OldName;
378                 netr_String NewName;
379                 netr_String unknown1;
380                 netr_String unknown2;
381                 netr_String unknown3;
382                 netr_String unknown4;
383                 uint32 unknown5;
384                 uint32 unknown6;
385                 uint32 unknown7;
386                 uint32 unknown8;
387         } netr_DELTA_RENAME;
388
389         typedef struct {
390                 [size_is(num_rids)] uint32 *rids;
391                 [size_is(num_rids)] uint32 *attribs;
392                 uint32 num_rids;
393                 uint32 unknown1;
394                 uint32 unknown2;
395                 uint32 unknown3;
396                 uint32 unknown4;
397         } netr_DELTA_GROUP_MEMBER;
398
399         typedef struct {
400                 netr_String alias_name;
401                 uint32 rid;
402                 uint32 SecurityInformation;
403                 sec_desc_buf sdbuf;
404                 netr_String unknown1;
405                 netr_String unknown2;
406                 netr_String unknown3;
407                 netr_String unknown4;
408                 uint32 unknown5;
409                 uint32 unknown6;
410                 uint32 unknown7;
411                 uint32 unknown8;
412         } netr_DELTA_ALIAS;
413
414         typedef struct {
415                 lsa_SidArray sids;
416                 uint32 unknown1;
417                 uint32 unknown2;
418                 uint32 unknown3;
419                 uint32 unknown4;
420         } netr_DELTA_ALIAS_MEMBER;
421
422         typedef struct {
423                 uint32 pagedpoollimit;
424                 uint32 nonpagedpoollimit;
425                 uint32 minimumworkingsetsize;
426                 uint32 maximumworkingsetsize;
427                 uint32 pagefilelimit;
428                 NTTIME timelimit;
429         } netr_QUOTA_LIMITS;
430
431         typedef struct {
432                 uint32 maxlogsize;
433                 NTTIME auditretentionperiod;
434                 bool8 auditingmode;
435                 uint32 maxauditeventcount;
436                 [size_is(maxauditeventcount+1)] uint32 *eventauditoptions;
437                 netr_String primarydomainname;
438                 dom_sid2 *sid;
439                 netr_QUOTA_LIMITS quota_limits;
440                 uint64 sequence_num;
441                 NTTIME db_create_time;
442                 uint32 SecurityInformation;
443                 sec_desc_buf sdbuf;
444                 netr_String unknown1;
445                 netr_String unknown2;
446                 netr_String unknown3;
447                 netr_String unknown4;
448                 uint32 unknown5;
449                 uint32 unknown6;
450                 uint32 unknown7;
451                 uint32 unknown8;
452         } netr_DELTA_POLICY;
453
454         typedef struct {
455                 netr_String DomainName;
456                 uint32 num_controllers;
457                 [size_is(num_controllers)] netr_String *controller_names;
458                 uint32 SecurityInformation;
459                 sec_desc_buf sdbuf;
460                 netr_String unknown1;
461                 netr_String unknown2;
462                 netr_String unknown3;
463                 netr_String unknown4;
464                 uint32 unknown5;
465                 uint32 unknown6;
466                 uint32 unknown7;
467                 uint32 unknown8;
468         } netr_DELTA_TRUSTED_DOMAINS;
469
470         typedef struct {
471                 uint16 unknown;
472         } netr_DELTA_DELETE_TRUST;
473
474         typedef struct {
475                 uint32 privilege_entries;
476                 uint32 privilege_control;
477                 [size_is(privilege_entries)] uint32 *privilege_attrib;
478                 [size_is(privilege_entries)] netr_String *privilege_name;
479                 netr_QUOTA_LIMITS quotalimits;
480                 uint32 system_flags;
481                 uint32 SecurityInformation;
482                 sec_desc_buf sdbuf;
483                 netr_String unknown1;
484                 netr_String unknown2;
485                 netr_String unknown3;
486                 netr_String unknown4;
487                 uint32 unknown5;
488                 uint32 unknown6;
489                 uint32 unknown7;
490                 uint32 unknown8;
491         } netr_DELTA_ACCOUNTS;
492
493         typedef struct {
494                 uint16 unknown;
495         } netr_DELTA_DELETE_ACCOUNT;
496
497         typedef struct {
498                 uint16 unknown;
499         } netr_DELTA_DELETE_SECRET;
500
501         typedef struct {
502                 uint32 len;
503                 uint32 maxlen;
504                 [size_is(maxlen)][length_is(len)] uint8 *cipher_data;
505         } netr_CIPHER_VALUE;
506
507         typedef struct {
508                 netr_CIPHER_VALUE current_cipher;
509                 NTTIME current_cipher_set_time;
510                 netr_CIPHER_VALUE old_cipher;
511                 NTTIME old_cipher_set_time;
512                 uint32 SecurityInformation;
513                 sec_desc_buf sdbuf;
514                 netr_String unknown1;
515                 netr_String unknown2;
516                 netr_String unknown3;
517                 netr_String unknown4;
518                 uint32 unknown5;
519                 uint32 unknown6;
520                 uint32 unknown7;
521                 uint32 unknown8;
522         } netr_DELTA_SECRET;
523
524         typedef enum {
525                 NETR_DELTA_DOMAIN           = 1,
526                 NETR_DELTA_GROUP            = 2,
527                 NETR_DELTA_DELETE_GROUP     = 3,
528                 NETR_DELTA_RENAME_GROUP     = 4,
529                 NETR_DELTA_USER             = 5,
530                 NETR_DELTA_DELETE_USER      = 6,
531                 NETR_DELTA_RENAME_USER      = 7,
532                 NETR_DELTA_GROUP_MEMBER     = 8,
533                 NETR_DELTA_ALIAS            = 9,
534                 NETR_DELTA_DELETE_ALIAS     = 10,
535                 NETR_DELTA_RENAME_ALIAS     = 11,
536                 NETR_DELTA_ALIAS_MEMBER     = 12,
537                 NETR_DELTA_POLICY           = 13,
538                 NETR_DELTA_TRUSTED_DOMAINS  = 14,
539                 NETR_DELTA_DELETE_TRUST     = 15,
540                 NETR_DELTA_ACCOUNTS         = 16,
541                 NETR_DELTA_DELETE_ACCOUNT   = 17,
542                 NETR_DELTA_SECRET           = 18,
543                 NETR_DELTA_DELETE_SECRET    = 19,
544                 NETR_DELTA_DELETE_GROUP2    = 20,
545                 NETR_DELTA_DELETE_USER2     = 21,
546                 NETR_DELTA_MODIFY_COUNT     = 22
547         } netr_DeltaEnum;
548
549         typedef union {
550                 [case(NETR_DELTA_DOMAIN)]          netr_DELTA_DOMAIN          *domain;
551                 [case(NETR_DELTA_GROUP)]           netr_DELTA_GROUP           *group;
552                 [case(NETR_DELTA_DELETE_GROUP)]    ; /* rid only */
553                 [case(NETR_DELTA_RENAME_GROUP)]    netr_DELTA_RENAME          *rename_group;
554                 [case(NETR_DELTA_USER)]            netr_DELTA_USER            *user;
555                 [case(NETR_DELTA_DELETE_USER)]     ; /* rid only */
556                 [case(NETR_DELTA_RENAME_USER)]     netr_DELTA_RENAME          *rename_user;
557                 [case(NETR_DELTA_GROUP_MEMBER)]    netr_DELTA_GROUP_MEMBER    *group_member;
558                 [case(NETR_DELTA_ALIAS)]           netr_DELTA_ALIAS           *alias;
559                 [case(NETR_DELTA_DELETE_ALIAS)]    ; /* rid only */
560                 [case(NETR_DELTA_RENAME_ALIAS)]    netr_DELTA_RENAME          *rename_alias;
561                 [case(NETR_DELTA_ALIAS_MEMBER)]    netr_DELTA_ALIAS_MEMBER    *alias_member;
562                 [case(NETR_DELTA_POLICY)]          netr_DELTA_POLICY          *policy;
563                 [case(NETR_DELTA_TRUSTED_DOMAINS)] netr_DELTA_TRUSTED_DOMAINS *trusted_domains;
564                 [case(NETR_DELTA_DELETE_TRUST)]    netr_DELTA_DELETE_TRUST    delete_trust;
565                 [case(NETR_DELTA_ACCOUNTS)]        netr_DELTA_ACCOUNTS        *accounts;
566                 [case(NETR_DELTA_DELETE_ACCOUNT)]  netr_DELTA_DELETE_ACCOUNT  delete_account;
567                 [case(NETR_DELTA_SECRET)]          netr_DELTA_SECRET          *secret;
568                 [case(NETR_DELTA_DELETE_SECRET)]   netr_DELTA_DELETE_SECRET   delete_secret;
569                 [case(NETR_DELTA_DELETE_GROUP2)]   netr_DELTA_DELETE_USER     *delete_group;
570                 [case(NETR_DELTA_DELETE_USER2)]    netr_DELTA_DELETE_USER     *delete_user;
571                 [case(NETR_DELTA_MODIFY_COUNT)]    uint64                     *modified_count;
572         } netr_DELTA_UNION;
573
574         typedef union {
575                 [case(NETR_DELTA_DOMAIN)]          uint32 rid;
576                 [case(NETR_DELTA_GROUP)]           uint32 rid;
577                 [case(NETR_DELTA_DELETE_GROUP)]    uint32 rid;
578                 [case(NETR_DELTA_RENAME_GROUP)]    uint32 rid;
579                 [case(NETR_DELTA_USER)]            uint32 rid;
580                 [case(NETR_DELTA_DELETE_USER)]     uint32 rid;
581                 [case(NETR_DELTA_RENAME_USER)]     uint32 rid;
582                 [case(NETR_DELTA_GROUP_MEMBER)]    uint32 rid;
583                 [case(NETR_DELTA_ALIAS)]           uint32 rid;
584                 [case(NETR_DELTA_DELETE_ALIAS)]    uint32 rid;
585                 [case(NETR_DELTA_RENAME_ALIAS)]    uint32 rid;
586                 [case(NETR_DELTA_ALIAS_MEMBER)]    uint32 rid;
587                 [case(NETR_DELTA_POLICY)]          dom_sid2 *sid;
588                 [case(NETR_DELTA_TRUSTED_DOMAINS)] dom_sid2 *sid;
589                 [case(NETR_DELTA_DELETE_TRUST)]    dom_sid2 *sid;
590                 [case(NETR_DELTA_ACCOUNTS)]        dom_sid2 *sid;
591                 [case(NETR_DELTA_DELETE_ACCOUNT)]  dom_sid2 *sid;
592                 [case(NETR_DELTA_SECRET)]          unistr *name;
593                 [case(NETR_DELTA_DELETE_SECRET)]   unistr *name;
594                 [case(NETR_DELTA_DELETE_GROUP2)]   uint32 rid;
595                 [case(NETR_DELTA_DELETE_USER2)]    uint32 rid;
596                 [case(NETR_DELTA_MODIFY_COUNT)]    ;
597         } netr_DELTA_ID_UNION;
598
599         typedef struct {
600                 uint16 delta_type;
601                 [switch_is(delta_type)] netr_DELTA_ID_UNION delta_id_union;
602                 [switch_is(delta_type)] netr_DELTA_UNION delta_union;
603         } netr_DELTA_ENUM;
604
605         typedef struct {
606                 uint32 num_deltas;
607                 [size_is(num_deltas)] netr_DELTA_ENUM *delta_enum;
608         } netr_DELTA_ENUM_ARRAY;
609
610
611         NTSTATUS netr_DatabaseDeltas(
612                 [in]      unistr logon_server,
613                 [in]      unistr computername,
614                 [in]      netr_Authenticator credential,
615                 [in,out]  netr_Authenticator return_authenticator,
616                 [in]      uint32 database_id,
617                 [in,out]  uint64 sequence_num,
618                 [in]      uint32 preferredmaximumlength,
619                 [out]     netr_DELTA_ENUM_ARRAY *delta_enum_array
620                 );
621
622
623         /*****************/
624         /* Function 0x08 */
625
626         NTSTATUS netr_DatabaseSync(
627                 [in]     unistr logon_server,
628                 [in]     unistr computername,
629                 [in]     netr_Authenticator credential,
630                 [in,out] netr_Authenticator return_authenticator,
631                 [in]     uint32 database_id,
632                 [in,out] uint32 sync_context,
633                 [in]     uint32 preferredmaximumlength,
634                 [out]    netr_DELTA_ENUM_ARRAY *delta_enum_array
635                 );
636
637
638         /*****************/
639         /* Function 0x09 */
640
641         /* w2k3 returns NT_STATUS_NOT_IMPLEMENTED for this call */
642
643         typedef [flag(NDR_PAHEX)] struct {
644                 uint8 computer_name[16];
645                 uint32 timecreated;
646                 uint32 serial_number;
647         } netr_UAS_INFO_0;
648
649         typedef struct {
650                 [flag(NDR_REMAINING)] DATA_BLOB blob;
651         } netr_AccountBuffer;
652
653         NTSTATUS netr_AccountDeltas(
654                 [in]     unistr *logon_server,
655                 [in]     unistr computername,
656                 [in]     netr_Authenticator credential,
657                 [in,out] netr_Authenticator return_authenticator,
658                 [in]     netr_UAS_INFO_0 uas,
659                 [in]     uint32 count,
660                 [in]     uint32 level,
661                 [in]     uint32 buffersize,
662                 [out,subcontext(4)] netr_AccountBuffer buffer,
663                 [out]    uint32 count_returned,
664                 [out]    uint32 total_entries,
665                 [out]    netr_UAS_INFO_0 recordid
666                 );
667
668
669         /*****************/
670         /* Function 0x0A */
671
672         NTSTATUS netr_AccountSync(
673                 [in]      unistr *logon_server,
674                 [in]      unistr computername,
675                 [in]      netr_Authenticator credential,
676                 [in,out]  netr_Authenticator return_authenticator,
677                 [in]      uint32 reference,
678                 [in]      uint32 level,
679                 [in]      uint32 buffersize,
680                 [out,subcontext(4)] netr_AccountBuffer buffer,
681                 [out]     uint32 count_returned,
682                 [out]     uint32 total_entries,
683                 [out]     uint32 next_reference,
684                 [in,out]  netr_UAS_INFO_0 recordid
685                 );
686
687
688         /*****************/
689         /* Function 0x0B */
690
691         NTSTATUS netr_GetDcName(
692                 [in]  unistr logon_server,
693                 [in]  unistr *domainname,
694                 [out] unistr *dcname
695                 );
696
697
698
699         /*****************/
700         /* Function 0x0C */
701
702         typedef struct {
703                 uint32 flags;
704                 uint32 pdc_connection_status;
705         } netr_NETLOGON_INFO_1;
706
707         typedef struct {
708                 uint32 flags;
709                 uint32 pdc_connection_status;
710                 unistr trusted_dc_name;
711                 uint32 tc_connection_status;
712         } netr_NETLOGON_INFO_2;
713
714         typedef struct {
715                 uint32 flags;
716                 uint32 logon_attempts;
717                 uint32 unknown1;
718                 uint32 unknown2;
719                 uint32 unknown3;
720                 uint32 unknown4;
721                 uint32 unknown5;
722         } netr_NETLOGON_INFO_3;
723
724         typedef union {
725                 [case(1)]  netr_NETLOGON_INFO_1 *info1;
726                 [case(2)]  netr_NETLOGON_INFO_2 *info2;
727                 [case(3)]  netr_NETLOGON_INFO_3 *info3;
728         } netr_CONTROL_QUERY_INFORMATION;
729
730         /* function_code values */
731         const int NETLOGON_CONTROL_REDISCOVER       = 5;
732         const int NETLOGON_CONTROL_TC_QUERY         = 6;
733         const int NETLOGON_CONTROL_TRANSPORT_NOTIFY = 7;
734         const int NETLOGON_CONTROL_SET_DBFLAG       = 65534;
735
736         WERROR netr_LogonControl(
737                 [in]   unistr *logon_server,
738                 [in]   uint32 function_code,
739                 [in]   uint32 level,
740                 [out,switch_is(level)]  netr_CONTROL_QUERY_INFORMATION info
741                 );
742
743
744         /*****************/
745         /* Function 0x0D */
746
747         WERROR netr_GetAnyDCName(
748                 [in]  unistr *logon_server,
749                 [in]  unistr *domainname,
750                 [out] unistr *dcname
751                 );
752
753
754         /*****************/
755         /* Function 0x0E */
756
757         typedef union {
758                 [case(NETLOGON_CONTROL_REDISCOVER)]        unistr *domain;
759                 [case(NETLOGON_CONTROL_TC_QUERY)]          unistr *domain;
760                 [case(NETLOGON_CONTROL_TRANSPORT_NOTIFY)]  unistr *domain;
761                 [case(NETLOGON_CONTROL_SET_DBFLAG)]        uint32 debug_level;
762         } netr_CONTROL_DATA_INFORMATION;
763
764         WERROR netr_LogonControl2(
765                 [in]    unistr *logon_server,
766                 [in]    uint32 function_code,
767                 [in]    uint32 level,
768                 [in][switch_is(function_code)] netr_CONTROL_DATA_INFORMATION  data,
769                 [out][switch_is(level)]        netr_CONTROL_QUERY_INFORMATION query
770                 );
771
772
773         /*****************/
774         /* Function 0x0F */
775
776         NTSTATUS netr_ServerAuthenticate2(
777                 [in]         unistr *server_name,
778                 [in]         unistr account_name,
779                 [in]         uint16 secure_channel_type,
780                 [in]         unistr computer_name,
781                 [in,out,ref] netr_Credential *credentials,
782                 [in,out,ref] uint32 *negotiate_flags
783                 );
784
785
786         /*****************/
787         /* Function 0x10 */
788
789         NTSTATUS netr_DatabaseSync2(
790                 [in]     unistr logon_server,
791                 [in]     unistr computername,
792                 [in]     netr_Authenticator credential,
793                 [in,out] netr_Authenticator return_authenticator,
794                 [in]     uint32 database_id,
795                 [in]     uint16 restart_state,
796                 [in,out] uint32 sync_context,
797                 [in]     uint32 preferredmaximumlength,
798                 [out]    netr_DELTA_ENUM_ARRAY *delta_enum_array
799                 );
800
801
802         /*****************/
803         /* Function 0x11 */
804
805         /* i'm not at all sure how this call works */
806
807         NTSTATUS netr_DatabaseRedo(
808                 [in]     unistr logon_server,
809                 [in]     unistr computername,
810                 [in]     netr_Authenticator credential,
811                 [in,out] netr_Authenticator return_authenticator,
812                 [in][size_is(change_log_entry_size)] uint8 *change_log_entry,
813                 [in]     uint32 change_log_entry_size,
814                 [out]    netr_DELTA_ENUM_ARRAY *delta_enum_array
815                 );
816
817
818         /*****************/
819         /* Function 0x12 */
820
821         WERROR netr_LogonControl2Ex(
822                 [in]   unistr *logon_server,
823                 [in]   uint32 function_code,
824                 [in]   uint32 level,
825                 [in][switch_is(function_code)] netr_CONTROL_DATA_INFORMATION  data,
826                 [out][switch_is(level)]        netr_CONTROL_QUERY_INFORMATION query
827                 );
828
829         /*****************/
830         /* Function 0x13 */
831         WERROR netr_NETRENUMERATETRUSTEDDOMAINS() ;
832
833         /*****************/
834         /* Function 0x14 */             
835         WERROR netr_DSRGETDCNAME() ;
836
837         /*****************/
838         /* Function 0x15 */
839         WERROR netr_NETRLOGONDUMMYROUTINE1();
840
841         /****************/
842         /* Function 0x16 */
843         WERROR netr_NETRLOGONSETSERVICEBITS();
844
845         /****************/
846         /* Function 0x17 */
847         WERROR netr_NETRLOGONGETTRUSTRID();
848
849         /****************/
850         /* Function 0x18 */
851         WERROR netr_NETRLOGONCOMPUTESERVERDIGEST();
852
853         /****************/
854         /* Function 0x19 */
855         WERROR netr_NETRLOGONCOMPUTECLIENTDIGEST();
856
857         /****************/
858         /* Function 0x1a */
859         NTSTATUS netr_ServerAuthenticate3(
860                 [in]         unistr *server_name,
861                 [in]         unistr account_name,
862                 [in]         uint16 secure_channel_type,
863                 [in]         unistr computer_name,
864                 [in,out,ref] netr_Credential *credentials,
865                 [in,out,ref] uint32 *negotiate_flags,
866                 [out,ref]    uint32 *rid
867                 );
868
869         /****************/
870         /* Function 0x1b */
871         WERROR netr_DSRGETDCNAMEX();
872
873         /****************/
874         /* Function 0x1c */
875         WERROR netr_DSRGETSITENAME();
876
877         /****************/
878         /* Function 0x1d */
879
880         typedef struct {
881                 uint32 length;
882                 [size_is(length)] uint8 *data;
883         } netr_Blob;
884
885         typedef [flag(NDR_PAHEX)] struct {
886                 uint16 length;
887                 uint16 size;
888                 [size_is(size/2),length_is(length/2)] uint16 *data;
889         } netr_BinaryString;
890
891         typedef struct {
892                 netr_Blob blob;
893                 unistr *workstation_domain;
894                 unistr *workstation_site;
895                 unistr *unknown1;
896                 unistr *unknown2;
897                 unistr *unknown3;
898                 unistr *unknown4;
899                 netr_BinaryString blob2;
900                 netr_String product;
901                 uint32 unknown5;
902                 unistr *unknown6;
903                 uint32 unknown7[6];
904         } netr_DomainQuery1;
905
906         typedef union {
907                 [case(1)] netr_DomainQuery1 *query1;
908                 [case(2)] netr_DomainQuery1 *query1;
909         } netr_DomainQuery;
910
911         typedef struct {
912                 netr_String domainname;
913                 netr_String fulldomainname;
914                 netr_String forest;
915                 GUID        guid;
916                 dom_sid2    *sid;
917                 netr_BinaryString unknown1[4];
918                 uint32      unknown[4];
919         } netr_DomainTrustInfo;
920
921         typedef struct {
922                 netr_DomainTrustInfo domaininfo;
923                 uint32 num_trusts;
924                 [size_is(num_trusts)] netr_DomainTrustInfo *trusts;
925                 uint32 unknown[14]; /* room for expansion? */
926         } netr_DomainInfo1;
927
928         typedef union {
929                 [case(1)] netr_DomainInfo1 *info1;
930                 [case(2)] netr_DomainInfo1 *info1;
931         } netr_DomainInfo;
932         
933         NTSTATUS netr_LogonGetDomainInfo(
934                 [in]         unistr server_name,
935                 [in]         unistr *computer_name,
936                 [in,out,ref] netr_Authenticator *credential,
937                 [in]         uint32 unknown1,
938                 [in]         uint32 i1[2],
939                 [in]         uint32 level,
940                 [in,switch_is(level)] netr_DomainQuery query,
941                 [out,switch_is(level)] netr_DomainInfo info
942                 );
943
944         /****************/
945         /* Function 0x1e */
946         WERROR netr_NETRSERVERPASSWORDSET2();
947
948         /****************/
949         /* Function 0x1f */
950         WERROR netr_NETRSERVERPASSWORDGET();
951
952         /****************/
953         /* Function 0x20 */
954         WERROR netr_NETRLOGONSENDTOSAM();
955
956         /****************/
957         /* Function 0x21 */
958         WERROR netr_DSRADDRESSTOSITENAMESW();
959
960         /****************/
961         /* Function 0x22 */
962         WERROR netr_DSRGETDCNAMEEX2();
963
964         /****************/
965         /* Function 0x23 */
966         WERROR netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN();
967
968         /****************/
969         /* Function 0x24 */
970         WERROR netr_NETRENUMERATETRUSTEDDOMAINSEX();
971
972         /****************/
973         /* Function 0x25 */
974         WERROR netr_DSRADDRESSTOSITENAMESEXW();
975
976         /****************/
977         /* Function 0x26 */
978         WERROR netr_DSRGETDCSITECOVERAGEW();
979
980         /****************/
981         /* Function 0x27 */
982         WERROR netr_NETRLOGONSAMLOGONEX();
983
984         /****************/
985         /* Function 0x28 */
986
987         const int NETR_TRUST_FLAG_IN_FOREST = 0x01;
988         const int NETR_TRUST_FLAG_OUTBOUND  = 0x02;
989         const int NETR_TRUST_FLAG_TREEROOT  = 0x04;
990         const int NETR_TRUST_FLAG_PRIMARY   = 0x08;
991         const int NETR_TRUST_FLAG_NATIVE    = 0x10;
992         const int NETR_TRUST_FLAG_INBOUND   = 0x20;
993
994         typedef struct {
995                 unistr *netbios_name;
996                 unistr *dns_name;
997                 uint32 trust_flags;
998                 uint32 parent_index;
999                 uint32 trust_type;
1000                 uint32 trust_attributes;
1001                 dom_sid2 *sid;
1002                 GUID   guid;
1003         } netr_DomainTrust;
1004
1005         WERROR netr_DsrEnumerateDomainTrusts(
1006                 [in]                 unistr           *server_name,
1007                 [in]                 uint32           trust_flags,
1008                 [out]                uint32           count,
1009                 [out,size_is(count)] netr_DomainTrust *trusts
1010                 );
1011
1012
1013         /****************/
1014         /* Function 0x29 */
1015         WERROR netr_DSRDEREGISTERDNSHOSTRECORDS();
1016
1017         /****************/
1018         /* Function 0x2a */
1019         WERROR netr_NETRSERVERTRUSTPASSWORDSGET();
1020
1021         /****************/
1022         /* Function 0x2b */
1023         WERROR netr_DSRGETFORESTTRUSTINFORMATION();
1024
1025         /****************/
1026         /* Function 0x2c */
1027         WERROR netr_NETRGETFORESTTRUSTINFORMATION();
1028
1029         /****************/
1030         /* Function 0x2d */
1031
1032         /* this is the ADS varient. I don't yet know what the "flags" are for */
1033         NTSTATUS netr_LogonSamLogonWithFlags(
1034                 [in] unistr *server_name,
1035                 [in] unistr *workstation,
1036                 [in] netr_Authenticator *credential,
1037                 [in][out] netr_Authenticator *return_authenticator,
1038                 [in]  uint16 logon_level,
1039                 [in]  [switch_is(logon_level)] netr_LogonLevel logon,
1040                 [in]  uint16 validation_level,
1041                 [out] [switch_is(validation_level)] netr_Validation validation,
1042                 [out] uint32 authoritative,
1043                 [in,out] uint32 flags
1044                 );
1045
1046         /****************/
1047         /* Function 0x2e */
1048         WERROR netr_NETRSERVERGETTRUSTINFO();
1049 }