s3: Do not reference ndr_table_<pipe> in the cli_ routines directly
[ira/wip.git] / librpc / gen_ndr / cli_drsuapi.c
1 /*
2  * Unix SMB/CIFS implementation.
3  * client auto-generated by pidl. DO NOT MODIFY!
4  */
5
6 #include "includes.h"
7 #include "../librpc/gen_ndr/cli_drsuapi.h"
8
9 struct rpccli_drsuapi_DsBind_state {
10         struct drsuapi_DsBind orig;
11         struct drsuapi_DsBind tmp;
12         TALLOC_CTX *out_mem_ctx;
13         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
14 };
15
16 static void rpccli_drsuapi_DsBind_done(struct tevent_req *subreq);
17
18 struct tevent_req *rpccli_drsuapi_DsBind_send(TALLOC_CTX *mem_ctx,
19                                               struct tevent_context *ev,
20                                               struct rpc_pipe_client *cli,
21                                               struct GUID *_bind_guid /* [in] [unique] */,
22                                               struct drsuapi_DsBindInfoCtr *_bind_info /* [in,out] [unique] */,
23                                               struct policy_handle *_bind_handle /* [out] [ref] */)
24 {
25         struct tevent_req *req;
26         struct rpccli_drsuapi_DsBind_state *state;
27         struct tevent_req *subreq;
28
29         req = tevent_req_create(mem_ctx, &state,
30                                 struct rpccli_drsuapi_DsBind_state);
31         if (req == NULL) {
32                 return NULL;
33         }
34         state->out_mem_ctx = NULL;
35         state->dispatch_recv = cli->dispatch_recv;
36
37         /* In parameters */
38         state->orig.in.bind_guid = _bind_guid;
39         state->orig.in.bind_info = _bind_info;
40
41         /* Out parameters */
42         state->orig.out.bind_info = _bind_info;
43         state->orig.out.bind_handle = _bind_handle;
44
45         /* Result */
46         ZERO_STRUCT(state->orig.out.result);
47
48         state->out_mem_ctx = talloc_named_const(state, 0,
49                              "rpccli_drsuapi_DsBind_out_memory");
50         if (tevent_req_nomem(state->out_mem_ctx, req)) {
51                 return tevent_req_post(req, ev);
52         }
53
54         /* make a temporary copy, that we pass to the dispatch function */
55         state->tmp = state->orig;
56
57         subreq = cli->dispatch_send(state, ev, cli,
58                                     NDR_DRSUAPI_UUID, NDR_DRSUAPI_VERSION,
59                                     NDR_DRSUAPI_DSBIND,
60                                     &state->tmp);
61         if (tevent_req_nomem(subreq, req)) {
62                 return tevent_req_post(req, ev);
63         }
64         tevent_req_set_callback(subreq, rpccli_drsuapi_DsBind_done, req);
65         return req;
66 }
67
68 static void rpccli_drsuapi_DsBind_done(struct tevent_req *subreq)
69 {
70         struct tevent_req *req = tevent_req_callback_data(
71                 subreq, struct tevent_req);
72         struct rpccli_drsuapi_DsBind_state *state = tevent_req_data(
73                 req, struct rpccli_drsuapi_DsBind_state);
74         NTSTATUS status;
75         TALLOC_CTX *mem_ctx;
76
77         if (state->out_mem_ctx) {
78                 mem_ctx = state->out_mem_ctx;
79         } else {
80                 mem_ctx = state;
81         }
82
83         status = state->dispatch_recv(subreq, mem_ctx);
84         TALLOC_FREE(subreq);
85         if (!NT_STATUS_IS_OK(status)) {
86                 tevent_req_nterror(req, status);
87                 return;
88         }
89
90         /* Copy out parameters */
91         if (state->orig.out.bind_info && state->tmp.out.bind_info) {
92                 *state->orig.out.bind_info = *state->tmp.out.bind_info;
93         }
94         *state->orig.out.bind_handle = *state->tmp.out.bind_handle;
95
96         /* Copy result */
97         state->orig.out.result = state->tmp.out.result;
98
99         /* Reset temporary structure */
100         ZERO_STRUCT(state->tmp);
101
102         tevent_req_done(req);
103 }
104
105 NTSTATUS rpccli_drsuapi_DsBind_recv(struct tevent_req *req,
106                                     TALLOC_CTX *mem_ctx,
107                                     WERROR *result)
108 {
109         struct rpccli_drsuapi_DsBind_state *state = tevent_req_data(
110                 req, struct rpccli_drsuapi_DsBind_state);
111         NTSTATUS status;
112
113         if (tevent_req_is_nterror(req, &status)) {
114                 tevent_req_received(req);
115                 return status;
116         }
117
118         /* Steal possbile out parameters to the callers context */
119         talloc_steal(mem_ctx, state->out_mem_ctx);
120
121         /* Return result */
122         *result = state->orig.out.result;
123
124         tevent_req_received(req);
125         return NT_STATUS_OK;
126 }
127
128 NTSTATUS rpccli_drsuapi_DsBind(struct rpc_pipe_client *cli,
129                                TALLOC_CTX *mem_ctx,
130                                struct GUID *bind_guid /* [in] [unique] */,
131                                struct drsuapi_DsBindInfoCtr *bind_info /* [in,out] [unique] */,
132                                struct policy_handle *bind_handle /* [out] [ref] */,
133                                WERROR *werror)
134 {
135         struct drsuapi_DsBind r;
136         NTSTATUS status;
137
138         /* In parameters */
139         r.in.bind_guid = bind_guid;
140         r.in.bind_info = bind_info;
141
142         status = cli->dispatch(cli,
143                                 mem_ctx,
144                                 NDR_DRSUAPI_UUID, NDR_DRSUAPI_VERSION,
145                                 NDR_DRSUAPI_DSBIND,
146                                 &r);
147
148         if (!NT_STATUS_IS_OK(status)) {
149                 return status;
150         }
151
152         if (NT_STATUS_IS_ERR(status)) {
153                 return status;
154         }
155
156         /* Return variables */
157         if (bind_info && r.out.bind_info) {
158                 *bind_info = *r.out.bind_info;
159         }
160         *bind_handle = *r.out.bind_handle;
161
162         /* Return result */
163         if (werror) {
164                 *werror = r.out.result;
165         }
166
167         return werror_to_ntstatus(r.out.result);
168 }
169
170 struct rpccli_drsuapi_DsUnbind_state {
171         struct drsuapi_DsUnbind orig;
172         struct drsuapi_DsUnbind tmp;
173         TALLOC_CTX *out_mem_ctx;
174         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
175 };
176
177 static void rpccli_drsuapi_DsUnbind_done(struct tevent_req *subreq);
178
179 struct tevent_req *rpccli_drsuapi_DsUnbind_send(TALLOC_CTX *mem_ctx,
180                                                 struct tevent_context *ev,
181                                                 struct rpc_pipe_client *cli,
182                                                 struct policy_handle *_bind_handle /* [in,out] [ref] */)
183 {
184         struct tevent_req *req;
185         struct rpccli_drsuapi_DsUnbind_state *state;
186         struct tevent_req *subreq;
187
188         req = tevent_req_create(mem_ctx, &state,
189                                 struct rpccli_drsuapi_DsUnbind_state);
190         if (req == NULL) {
191                 return NULL;
192         }
193         state->out_mem_ctx = NULL;
194         state->dispatch_recv = cli->dispatch_recv;
195
196         /* In parameters */
197         state->orig.in.bind_handle = _bind_handle;
198
199         /* Out parameters */
200         state->orig.out.bind_handle = _bind_handle;
201
202         /* Result */
203         ZERO_STRUCT(state->orig.out.result);
204
205         state->out_mem_ctx = talloc_named_const(state, 0,
206                              "rpccli_drsuapi_DsUnbind_out_memory");
207         if (tevent_req_nomem(state->out_mem_ctx, req)) {
208                 return tevent_req_post(req, ev);
209         }
210
211         /* make a temporary copy, that we pass to the dispatch function */
212         state->tmp = state->orig;
213
214         subreq = cli->dispatch_send(state, ev, cli,
215                                     NDR_DRSUAPI_UUID, NDR_DRSUAPI_VERSION,
216                                     NDR_DRSUAPI_DSUNBIND,
217                                     &state->tmp);
218         if (tevent_req_nomem(subreq, req)) {
219                 return tevent_req_post(req, ev);
220         }
221         tevent_req_set_callback(subreq, rpccli_drsuapi_DsUnbind_done, req);
222         return req;
223 }
224
225 static void rpccli_drsuapi_DsUnbind_done(struct tevent_req *subreq)
226 {
227         struct tevent_req *req = tevent_req_callback_data(
228                 subreq, struct tevent_req);
229         struct rpccli_drsuapi_DsUnbind_state *state = tevent_req_data(
230                 req, struct rpccli_drsuapi_DsUnbind_state);
231         NTSTATUS status;
232         TALLOC_CTX *mem_ctx;
233
234         if (state->out_mem_ctx) {
235                 mem_ctx = state->out_mem_ctx;
236         } else {
237                 mem_ctx = state;
238         }
239
240         status = state->dispatch_recv(subreq, mem_ctx);
241         TALLOC_FREE(subreq);
242         if (!NT_STATUS_IS_OK(status)) {
243                 tevent_req_nterror(req, status);
244                 return;
245         }
246
247         /* Copy out parameters */
248         *state->orig.out.bind_handle = *state->tmp.out.bind_handle;
249
250         /* Copy result */
251         state->orig.out.result = state->tmp.out.result;
252
253         /* Reset temporary structure */
254         ZERO_STRUCT(state->tmp);
255
256         tevent_req_done(req);
257 }
258
259 NTSTATUS rpccli_drsuapi_DsUnbind_recv(struct tevent_req *req,
260                                       TALLOC_CTX *mem_ctx,
261                                       WERROR *result)
262 {
263         struct rpccli_drsuapi_DsUnbind_state *state = tevent_req_data(
264                 req, struct rpccli_drsuapi_DsUnbind_state);
265         NTSTATUS status;
266
267         if (tevent_req_is_nterror(req, &status)) {
268                 tevent_req_received(req);
269                 return status;
270         }
271
272         /* Steal possbile out parameters to the callers context */
273         talloc_steal(mem_ctx, state->out_mem_ctx);
274
275         /* Return result */
276         *result = state->orig.out.result;
277
278         tevent_req_received(req);
279         return NT_STATUS_OK;
280 }
281
282 NTSTATUS rpccli_drsuapi_DsUnbind(struct rpc_pipe_client *cli,
283                                  TALLOC_CTX *mem_ctx,
284                                  struct policy_handle *bind_handle /* [in,out] [ref] */,
285                                  WERROR *werror)
286 {
287         struct drsuapi_DsUnbind r;
288         NTSTATUS status;
289
290         /* In parameters */
291         r.in.bind_handle = bind_handle;
292
293         status = cli->dispatch(cli,
294                                 mem_ctx,
295                                 NDR_DRSUAPI_UUID, NDR_DRSUAPI_VERSION,
296                                 NDR_DRSUAPI_DSUNBIND,
297                                 &r);
298
299         if (!NT_STATUS_IS_OK(status)) {
300                 return status;
301         }
302
303         if (NT_STATUS_IS_ERR(status)) {
304                 return status;
305         }
306
307         /* Return variables */
308         *bind_handle = *r.out.bind_handle;
309
310         /* Return result */
311         if (werror) {
312                 *werror = r.out.result;
313         }
314
315         return werror_to_ntstatus(r.out.result);
316 }
317
318 struct rpccli_drsuapi_DsReplicaSync_state {
319         struct drsuapi_DsReplicaSync orig;
320         struct drsuapi_DsReplicaSync tmp;
321         TALLOC_CTX *out_mem_ctx;
322         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
323 };
324
325 static void rpccli_drsuapi_DsReplicaSync_done(struct tevent_req *subreq);
326
327 struct tevent_req *rpccli_drsuapi_DsReplicaSync_send(TALLOC_CTX *mem_ctx,
328                                                      struct tevent_context *ev,
329                                                      struct rpc_pipe_client *cli,
330                                                      struct policy_handle *_bind_handle /* [in] [ref] */,
331                                                      int32_t _level /* [in]  */,
332                                                      union drsuapi_DsReplicaSyncRequest _req /* [in] [switch_is(level)] */)
333 {
334         struct tevent_req *req;
335         struct rpccli_drsuapi_DsReplicaSync_state *state;
336         struct tevent_req *subreq;
337
338         req = tevent_req_create(mem_ctx, &state,
339                                 struct rpccli_drsuapi_DsReplicaSync_state);
340         if (req == NULL) {
341                 return NULL;
342         }
343         state->out_mem_ctx = NULL;
344         state->dispatch_recv = cli->dispatch_recv;
345
346         /* In parameters */
347         state->orig.in.bind_handle = _bind_handle;
348         state->orig.in.level = _level;
349         state->orig.in.req = _req;
350
351         /* Out parameters */
352
353         /* Result */
354         ZERO_STRUCT(state->orig.out.result);
355
356         /* make a temporary copy, that we pass to the dispatch function */
357         state->tmp = state->orig;
358
359         subreq = cli->dispatch_send(state, ev, cli,
360                                     NDR_DRSUAPI_UUID, NDR_DRSUAPI_VERSION,
361                                     NDR_DRSUAPI_DSREPLICASYNC,
362                                     &state->tmp);
363         if (tevent_req_nomem(subreq, req)) {
364                 return tevent_req_post(req, ev);
365         }
366         tevent_req_set_callback(subreq, rpccli_drsuapi_DsReplicaSync_done, req);
367         return req;
368 }
369
370 static void rpccli_drsuapi_DsReplicaSync_done(struct tevent_req *subreq)
371 {
372         struct tevent_req *req = tevent_req_callback_data(
373                 subreq, struct tevent_req);
374         struct rpccli_drsuapi_DsReplicaSync_state *state = tevent_req_data(
375                 req, struct rpccli_drsuapi_DsReplicaSync_state);
376         NTSTATUS status;
377         TALLOC_CTX *mem_ctx;
378
379         if (state->out_mem_ctx) {
380                 mem_ctx = state->out_mem_ctx;
381         } else {
382                 mem_ctx = state;
383         }
384
385         status = state->dispatch_recv(subreq, mem_ctx);
386         TALLOC_FREE(subreq);
387         if (!NT_STATUS_IS_OK(status)) {
388                 tevent_req_nterror(req, status);
389                 return;
390         }
391
392         /* Copy out parameters */
393
394         /* Copy result */
395         state->orig.out.result = state->tmp.out.result;
396
397         /* Reset temporary structure */
398         ZERO_STRUCT(state->tmp);
399
400         tevent_req_done(req);
401 }
402
403 NTSTATUS rpccli_drsuapi_DsReplicaSync_recv(struct tevent_req *req,
404                                            TALLOC_CTX *mem_ctx,
405                                            WERROR *result)
406 {
407         struct rpccli_drsuapi_DsReplicaSync_state *state = tevent_req_data(
408                 req, struct rpccli_drsuapi_DsReplicaSync_state);
409         NTSTATUS status;
410
411         if (tevent_req_is_nterror(req, &status)) {
412                 tevent_req_received(req);
413                 return status;
414         }
415
416         /* Steal possbile out parameters to the callers context */
417         talloc_steal(mem_ctx, state->out_mem_ctx);
418
419         /* Return result */
420         *result = state->orig.out.result;
421
422         tevent_req_received(req);
423         return NT_STATUS_OK;
424 }
425
426 NTSTATUS rpccli_drsuapi_DsReplicaSync(struct rpc_pipe_client *cli,
427                                       TALLOC_CTX *mem_ctx,
428                                       struct policy_handle *bind_handle /* [in] [ref] */,
429                                       int32_t level /* [in]  */,
430                                       union drsuapi_DsReplicaSyncRequest req /* [in] [switch_is(level)] */,
431                                       WERROR *werror)
432 {
433         struct drsuapi_DsReplicaSync r;
434         NTSTATUS status;
435
436         /* In parameters */
437         r.in.bind_handle = bind_handle;
438         r.in.level = level;
439         r.in.req = req;
440
441         status = cli->dispatch(cli,
442                                 mem_ctx,
443                                 NDR_DRSUAPI_UUID, NDR_DRSUAPI_VERSION,
444                                 NDR_DRSUAPI_DSREPLICASYNC,
445                                 &r);
446
447         if (!NT_STATUS_IS_OK(status)) {
448                 return status;
449         }
450
451         if (NT_STATUS_IS_ERR(status)) {
452                 return status;
453         }
454
455         /* Return variables */
456
457         /* Return result */
458         if (werror) {
459                 *werror = r.out.result;
460         }
461
462         return werror_to_ntstatus(r.out.result);
463 }
464
465 struct rpccli_drsuapi_DsGetNCChanges_state {
466         struct drsuapi_DsGetNCChanges orig;
467         struct drsuapi_DsGetNCChanges tmp;
468         TALLOC_CTX *out_mem_ctx;
469         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
470 };
471
472 static void rpccli_drsuapi_DsGetNCChanges_done(struct tevent_req *subreq);
473
474 struct tevent_req *rpccli_drsuapi_DsGetNCChanges_send(TALLOC_CTX *mem_ctx,
475                                                       struct tevent_context *ev,
476                                                       struct rpc_pipe_client *cli,
477                                                       struct policy_handle *_bind_handle /* [in] [ref] */,
478                                                       int32_t _level /* [in]  */,
479                                                       union drsuapi_DsGetNCChangesRequest *_req /* [in] [ref,switch_is(level)] */,
480                                                       int32_t *_level_out /* [out] [ref] */,
481                                                       union drsuapi_DsGetNCChangesCtr *_ctr /* [out] [ref,switch_is(*level_out)] */)
482 {
483         struct tevent_req *req;
484         struct rpccli_drsuapi_DsGetNCChanges_state *state;
485         struct tevent_req *subreq;
486
487         req = tevent_req_create(mem_ctx, &state,
488                                 struct rpccli_drsuapi_DsGetNCChanges_state);
489         if (req == NULL) {
490                 return NULL;
491         }
492         state->out_mem_ctx = NULL;
493         state->dispatch_recv = cli->dispatch_recv;
494
495         /* In parameters */
496         state->orig.in.bind_handle = _bind_handle;
497         state->orig.in.level = _level;
498         state->orig.in.req = _req;
499
500         /* Out parameters */
501         state->orig.out.level_out = _level_out;
502         state->orig.out.ctr = _ctr;
503
504         /* Result */
505         ZERO_STRUCT(state->orig.out.result);
506
507         state->out_mem_ctx = talloc_named_const(state, 0,
508                              "rpccli_drsuapi_DsGetNCChanges_out_memory");
509         if (tevent_req_nomem(state->out_mem_ctx, req)) {
510                 return tevent_req_post(req, ev);
511         }
512
513         /* make a temporary copy, that we pass to the dispatch function */
514         state->tmp = state->orig;
515
516         subreq = cli->dispatch_send(state, ev, cli,
517                                     NDR_DRSUAPI_UUID, NDR_DRSUAPI_VERSION,
518                                     NDR_DRSUAPI_DSGETNCCHANGES,
519                                     &state->tmp);
520         if (tevent_req_nomem(subreq, req)) {
521                 return tevent_req_post(req, ev);
522         }
523         tevent_req_set_callback(subreq, rpccli_drsuapi_DsGetNCChanges_done, req);
524         return req;
525 }
526
527 static void rpccli_drsuapi_DsGetNCChanges_done(struct tevent_req *subreq)
528 {
529         struct tevent_req *req = tevent_req_callback_data(
530                 subreq, struct tevent_req);
531         struct rpccli_drsuapi_DsGetNCChanges_state *state = tevent_req_data(
532                 req, struct rpccli_drsuapi_DsGetNCChanges_state);
533         NTSTATUS status;
534         TALLOC_CTX *mem_ctx;
535
536         if (state->out_mem_ctx) {
537                 mem_ctx = state->out_mem_ctx;
538         } else {
539                 mem_ctx = state;
540         }
541
542         status = state->dispatch_recv(subreq, mem_ctx);
543         TALLOC_FREE(subreq);
544         if (!NT_STATUS_IS_OK(status)) {
545                 tevent_req_nterror(req, status);
546                 return;
547         }
548
549         /* Copy out parameters */
550         *state->orig.out.level_out = *state->tmp.out.level_out;
551         *state->orig.out.ctr = *state->tmp.out.ctr;
552
553         /* Copy result */
554         state->orig.out.result = state->tmp.out.result;
555
556         /* Reset temporary structure */
557         ZERO_STRUCT(state->tmp);
558
559         tevent_req_done(req);
560 }
561
562 NTSTATUS rpccli_drsuapi_DsGetNCChanges_recv(struct tevent_req *req,
563                                             TALLOC_CTX *mem_ctx,
564                                             WERROR *result)
565 {
566         struct rpccli_drsuapi_DsGetNCChanges_state *state = tevent_req_data(
567                 req, struct rpccli_drsuapi_DsGetNCChanges_state);
568         NTSTATUS status;
569
570         if (tevent_req_is_nterror(req, &status)) {
571                 tevent_req_received(req);
572                 return status;
573         }
574
575         /* Steal possbile out parameters to the callers context */
576         talloc_steal(mem_ctx, state->out_mem_ctx);
577
578         /* Return result */
579         *result = state->orig.out.result;
580
581         tevent_req_received(req);
582         return NT_STATUS_OK;
583 }
584
585 NTSTATUS rpccli_drsuapi_DsGetNCChanges(struct rpc_pipe_client *cli,
586                                        TALLOC_CTX *mem_ctx,
587                                        struct policy_handle *bind_handle /* [in] [ref] */,
588                                        int32_t level /* [in]  */,
589                                        union drsuapi_DsGetNCChangesRequest *req /* [in] [ref,switch_is(level)] */,
590                                        int32_t *level_out /* [out] [ref] */,
591                                        union drsuapi_DsGetNCChangesCtr *ctr /* [out] [ref,switch_is(*level_out)] */,
592                                        WERROR *werror)
593 {
594         struct drsuapi_DsGetNCChanges r;
595         NTSTATUS status;
596
597         /* In parameters */
598         r.in.bind_handle = bind_handle;
599         r.in.level = level;
600         r.in.req = req;
601
602         status = cli->dispatch(cli,
603                                 mem_ctx,
604                                 NDR_DRSUAPI_UUID, NDR_DRSUAPI_VERSION,
605                                 NDR_DRSUAPI_DSGETNCCHANGES,
606                                 &r);
607
608         if (!NT_STATUS_IS_OK(status)) {
609                 return status;
610         }
611
612         if (NT_STATUS_IS_ERR(status)) {
613                 return status;
614         }
615
616         /* Return variables */
617         *level_out = *r.out.level_out;
618         *ctr = *r.out.ctr;
619
620         /* Return result */
621         if (werror) {
622                 *werror = r.out.result;
623         }
624
625         return werror_to_ntstatus(r.out.result);
626 }
627
628 struct rpccli_drsuapi_DsReplicaUpdateRefs_state {
629         struct drsuapi_DsReplicaUpdateRefs orig;
630         struct drsuapi_DsReplicaUpdateRefs tmp;
631         TALLOC_CTX *out_mem_ctx;
632         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
633 };
634
635 static void rpccli_drsuapi_DsReplicaUpdateRefs_done(struct tevent_req *subreq);
636
637 struct tevent_req *rpccli_drsuapi_DsReplicaUpdateRefs_send(TALLOC_CTX *mem_ctx,
638                                                            struct tevent_context *ev,
639                                                            struct rpc_pipe_client *cli,
640                                                            struct policy_handle *_bind_handle /* [in] [ref] */,
641                                                            int32_t _level /* [in]  */,
642                                                            union drsuapi_DsReplicaUpdateRefsRequest _req /* [in] [switch_is(level)] */)
643 {
644         struct tevent_req *req;
645         struct rpccli_drsuapi_DsReplicaUpdateRefs_state *state;
646         struct tevent_req *subreq;
647
648         req = tevent_req_create(mem_ctx, &state,
649                                 struct rpccli_drsuapi_DsReplicaUpdateRefs_state);
650         if (req == NULL) {
651                 return NULL;
652         }
653         state->out_mem_ctx = NULL;
654         state->dispatch_recv = cli->dispatch_recv;
655
656         /* In parameters */
657         state->orig.in.bind_handle = _bind_handle;
658         state->orig.in.level = _level;
659         state->orig.in.req = _req;
660
661         /* Out parameters */
662
663         /* Result */
664         ZERO_STRUCT(state->orig.out.result);
665
666         /* make a temporary copy, that we pass to the dispatch function */
667         state->tmp = state->orig;
668
669         subreq = cli->dispatch_send(state, ev, cli,
670                                     NDR_DRSUAPI_UUID, NDR_DRSUAPI_VERSION,
671                                     NDR_DRSUAPI_DSREPLICAUPDATEREFS,
672                                     &state->tmp);
673         if (tevent_req_nomem(subreq, req)) {
674                 return tevent_req_post(req, ev);
675         }
676         tevent_req_set_callback(subreq, rpccli_drsuapi_DsReplicaUpdateRefs_done, req);
677         return req;
678 }
679
680 static void rpccli_drsuapi_DsReplicaUpdateRefs_done(struct tevent_req *subreq)
681 {
682         struct tevent_req *req = tevent_req_callback_data(
683                 subreq, struct tevent_req);
684         struct rpccli_drsuapi_DsReplicaUpdateRefs_state *state = tevent_req_data(
685                 req, struct rpccli_drsuapi_DsReplicaUpdateRefs_state);
686         NTSTATUS status;
687         TALLOC_CTX *mem_ctx;
688
689         if (state->out_mem_ctx) {
690                 mem_ctx = state->out_mem_ctx;
691         } else {
692                 mem_ctx = state;
693         }
694
695         status = state->dispatch_recv(subreq, mem_ctx);
696         TALLOC_FREE(subreq);
697         if (!NT_STATUS_IS_OK(status)) {
698                 tevent_req_nterror(req, status);
699                 return;
700         }
701
702         /* Copy out parameters */
703
704         /* Copy result */
705         state->orig.out.result = state->tmp.out.result;
706
707         /* Reset temporary structure */
708         ZERO_STRUCT(state->tmp);
709
710         tevent_req_done(req);
711 }
712
713 NTSTATUS rpccli_drsuapi_DsReplicaUpdateRefs_recv(struct tevent_req *req,
714                                                  TALLOC_CTX *mem_ctx,
715                                                  WERROR *result)
716 {
717         struct rpccli_drsuapi_DsReplicaUpdateRefs_state *state = tevent_req_data(
718                 req, struct rpccli_drsuapi_DsReplicaUpdateRefs_state);
719         NTSTATUS status;
720
721         if (tevent_req_is_nterror(req, &status)) {
722                 tevent_req_received(req);
723                 return status;
724         }
725
726         /* Steal possbile out parameters to the callers context */
727         talloc_steal(mem_ctx, state->out_mem_ctx);
728
729         /* Return result */
730         *result = state->orig.out.result;
731
732         tevent_req_received(req);
733         return NT_STATUS_OK;
734 }
735
736 NTSTATUS rpccli_drsuapi_DsReplicaUpdateRefs(struct rpc_pipe_client *cli,
737                                             TALLOC_CTX *mem_ctx,
738                                             struct policy_handle *bind_handle /* [in] [ref] */,
739                                             int32_t level /* [in]  */,
740                                             union drsuapi_DsReplicaUpdateRefsRequest req /* [in] [switch_is(level)] */,
741                                             WERROR *werror)
742 {
743         struct drsuapi_DsReplicaUpdateRefs r;
744         NTSTATUS status;
745
746         /* In parameters */
747         r.in.bind_handle = bind_handle;
748         r.in.level = level;
749         r.in.req = req;
750
751         status = cli->dispatch(cli,
752                                 mem_ctx,
753                                 NDR_DRSUAPI_UUID, NDR_DRSUAPI_VERSION,
754                                 NDR_DRSUAPI_DSREPLICAUPDATEREFS,
755                                 &r);
756
757         if (!NT_STATUS_IS_OK(status)) {
758                 return status;
759         }
760
761         if (NT_STATUS_IS_ERR(status)) {
762                 return status;
763         }
764
765         /* Return variables */
766
767         /* Return result */
768         if (werror) {
769                 *werror = r.out.result;
770         }
771
772         return werror_to_ntstatus(r.out.result);
773 }
774
775 struct rpccli_drsuapi_DsReplicaAdd_state {
776         struct drsuapi_DsReplicaAdd orig;
777         struct drsuapi_DsReplicaAdd tmp;
778         TALLOC_CTX *out_mem_ctx;
779         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
780 };
781
782 static void rpccli_drsuapi_DsReplicaAdd_done(struct tevent_req *subreq);
783
784 struct tevent_req *rpccli_drsuapi_DsReplicaAdd_send(TALLOC_CTX *mem_ctx,
785                                                     struct tevent_context *ev,
786                                                     struct rpc_pipe_client *cli,
787                                                     struct policy_handle *_bind_handle /* [in] [ref] */,
788                                                     int32_t _level /* [in]  */,
789                                                     union drsuapi_DsReplicaAddRequest _req /* [in] [switch_is(level)] */)
790 {
791         struct tevent_req *req;
792         struct rpccli_drsuapi_DsReplicaAdd_state *state;
793         struct tevent_req *subreq;
794
795         req = tevent_req_create(mem_ctx, &state,
796                                 struct rpccli_drsuapi_DsReplicaAdd_state);
797         if (req == NULL) {
798                 return NULL;
799         }
800         state->out_mem_ctx = NULL;
801         state->dispatch_recv = cli->dispatch_recv;
802
803         /* In parameters */
804         state->orig.in.bind_handle = _bind_handle;
805         state->orig.in.level = _level;
806         state->orig.in.req = _req;
807
808         /* Out parameters */
809
810         /* Result */
811         ZERO_STRUCT(state->orig.out.result);
812
813         /* make a temporary copy, that we pass to the dispatch function */
814         state->tmp = state->orig;
815
816         subreq = cli->dispatch_send(state, ev, cli,
817                                     NDR_DRSUAPI_UUID, NDR_DRSUAPI_VERSION,
818                                     NDR_DRSUAPI_DSREPLICAADD,
819                                     &state->tmp);
820         if (tevent_req_nomem(subreq, req)) {
821                 return tevent_req_post(req, ev);
822         }
823         tevent_req_set_callback(subreq, rpccli_drsuapi_DsReplicaAdd_done, req);
824         return req;
825 }
826
827 static void rpccli_drsuapi_DsReplicaAdd_done(struct tevent_req *subreq)
828 {
829         struct tevent_req *req = tevent_req_callback_data(
830                 subreq, struct tevent_req);
831         struct rpccli_drsuapi_DsReplicaAdd_state *state = tevent_req_data(
832                 req, struct rpccli_drsuapi_DsReplicaAdd_state);
833         NTSTATUS status;
834         TALLOC_CTX *mem_ctx;
835
836         if (state->out_mem_ctx) {
837                 mem_ctx = state->out_mem_ctx;
838         } else {
839                 mem_ctx = state;
840         }
841
842         status = state->dispatch_recv(subreq, mem_ctx);
843         TALLOC_FREE(subreq);
844         if (!NT_STATUS_IS_OK(status)) {
845                 tevent_req_nterror(req, status);
846                 return;
847         }
848
849         /* Copy out parameters */
850
851         /* Copy result */
852         state->orig.out.result = state->tmp.out.result;
853
854         /* Reset temporary structure */
855         ZERO_STRUCT(state->tmp);
856
857         tevent_req_done(req);
858 }
859
860 NTSTATUS rpccli_drsuapi_DsReplicaAdd_recv(struct tevent_req *req,
861                                           TALLOC_CTX *mem_ctx,
862                                           WERROR *result)
863 {
864         struct rpccli_drsuapi_DsReplicaAdd_state *state = tevent_req_data(
865                 req, struct rpccli_drsuapi_DsReplicaAdd_state);
866         NTSTATUS status;
867
868         if (tevent_req_is_nterror(req, &status)) {
869                 tevent_req_received(req);
870                 return status;
871         }
872
873         /* Steal possbile out parameters to the callers context */
874         talloc_steal(mem_ctx, state->out_mem_ctx);
875
876         /* Return result */
877         *result = state->orig.out.result;
878
879         tevent_req_received(req);
880         return NT_STATUS_OK;
881 }
882
883 NTSTATUS rpccli_drsuapi_DsReplicaAdd(struct rpc_pipe_client *cli,
884                                      TALLOC_CTX *mem_ctx,
885                                      struct policy_handle *bind_handle /* [in] [ref] */,
886                                      int32_t level /* [in]  */,
887                                      union drsuapi_DsReplicaAddRequest req /* [in] [switch_is(level)] */,
888                                      WERROR *werror)
889 {
890         struct drsuapi_DsReplicaAdd r;
891         NTSTATUS status;
892
893         /* In parameters */
894         r.in.bind_handle = bind_handle;
895         r.in.level = level;
896         r.in.req = req;
897
898         status = cli->dispatch(cli,
899                                 mem_ctx,
900                                 NDR_DRSUAPI_UUID, NDR_DRSUAPI_VERSION,
901                                 NDR_DRSUAPI_DSREPLICAADD,
902                                 &r);
903
904         if (!NT_STATUS_IS_OK(status)) {
905                 return status;
906         }
907
908         if (NT_STATUS_IS_ERR(status)) {
909                 return status;
910         }
911
912         /* Return variables */
913
914         /* Return result */
915         if (werror) {
916                 *werror = r.out.result;
917         }
918
919         return werror_to_ntstatus(r.out.result);
920 }
921
922 struct rpccli_drsuapi_DsReplicaDel_state {
923         struct drsuapi_DsReplicaDel orig;
924         struct drsuapi_DsReplicaDel tmp;
925         TALLOC_CTX *out_mem_ctx;
926         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
927 };
928
929 static void rpccli_drsuapi_DsReplicaDel_done(struct tevent_req *subreq);
930
931 struct tevent_req *rpccli_drsuapi_DsReplicaDel_send(TALLOC_CTX *mem_ctx,
932                                                     struct tevent_context *ev,
933                                                     struct rpc_pipe_client *cli,
934                                                     struct policy_handle *_bind_handle /* [in] [ref] */,
935                                                     int32_t _level /* [in]  */,
936                                                     union drsuapi_DsReplicaDelRequest _req /* [in] [switch_is(level)] */)
937 {
938         struct tevent_req *req;
939         struct rpccli_drsuapi_DsReplicaDel_state *state;
940         struct tevent_req *subreq;
941
942         req = tevent_req_create(mem_ctx, &state,
943                                 struct rpccli_drsuapi_DsReplicaDel_state);
944         if (req == NULL) {
945                 return NULL;
946         }
947         state->out_mem_ctx = NULL;
948         state->dispatch_recv = cli->dispatch_recv;
949
950         /* In parameters */
951         state->orig.in.bind_handle = _bind_handle;
952         state->orig.in.level = _level;
953         state->orig.in.req = _req;
954
955         /* Out parameters */
956
957         /* Result */
958         ZERO_STRUCT(state->orig.out.result);
959
960         /* make a temporary copy, that we pass to the dispatch function */
961         state->tmp = state->orig;
962
963         subreq = cli->dispatch_send(state, ev, cli,
964                                     NDR_DRSUAPI_UUID, NDR_DRSUAPI_VERSION,
965                                     NDR_DRSUAPI_DSREPLICADEL,
966                                     &state->tmp);
967         if (tevent_req_nomem(subreq, req)) {
968                 return tevent_req_post(req, ev);
969         }
970         tevent_req_set_callback(subreq, rpccli_drsuapi_DsReplicaDel_done, req);
971         return req;
972 }
973
974 static void rpccli_drsuapi_DsReplicaDel_done(struct tevent_req *subreq)
975 {
976         struct tevent_req *req = tevent_req_callback_data(
977                 subreq, struct tevent_req);
978         struct rpccli_drsuapi_DsReplicaDel_state *state = tevent_req_data(
979                 req, struct rpccli_drsuapi_DsReplicaDel_state);
980         NTSTATUS status;
981         TALLOC_CTX *mem_ctx;
982
983         if (state->out_mem_ctx) {
984                 mem_ctx = state->out_mem_ctx;
985         } else {
986                 mem_ctx = state;
987         }
988
989         status = state->dispatch_recv(subreq, mem_ctx);
990         TALLOC_FREE(subreq);
991         if (!NT_STATUS_IS_OK(status)) {
992                 tevent_req_nterror(req, status);
993                 return;
994         }
995
996         /* Copy out parameters */
997
998         /* Copy result */
999         state->orig.out.result = state->tmp.out.result;
1000
1001         /* Reset temporary structure */
1002         ZERO_STRUCT(state->tmp);
1003
1004         tevent_req_done(req);
1005 }
1006
1007 NTSTATUS rpccli_drsuapi_DsReplicaDel_recv(struct tevent_req *req,
1008                                           TALLOC_CTX *mem_ctx,
1009                                           WERROR *result)
1010 {
1011         struct rpccli_drsuapi_DsReplicaDel_state *state = tevent_req_data(
1012                 req, struct rpccli_drsuapi_DsReplicaDel_state);
1013         NTSTATUS status;
1014
1015         if (tevent_req_is_nterror(req, &status)) {
1016                 tevent_req_received(req);
1017                 return status;
1018         }
1019
1020         /* Steal possbile out parameters to the callers context */
1021         talloc_steal(mem_ctx, state->out_mem_ctx);
1022
1023         /* Return result */
1024         *result = state->orig.out.result;
1025
1026         tevent_req_received(req);
1027         return NT_STATUS_OK;
1028 }
1029
1030 NTSTATUS rpccli_drsuapi_DsReplicaDel(struct rpc_pipe_client *cli,
1031                                      TALLOC_CTX *mem_ctx,
1032                                      struct policy_handle *bind_handle /* [in] [ref] */,
1033                                      int32_t level /* [in]  */,
1034                                      union drsuapi_DsReplicaDelRequest req /* [in] [switch_is(level)] */,
1035                                      WERROR *werror)
1036 {
1037         struct drsuapi_DsReplicaDel r;
1038         NTSTATUS status;
1039
1040         /* In parameters */
1041         r.in.bind_handle = bind_handle;
1042         r.in.level = level;
1043         r.in.req = req;
1044
1045         status = cli->dispatch(cli,
1046                                 mem_ctx,
1047                                 NDR_DRSUAPI_UUID, NDR_DRSUAPI_VERSION,
1048                                 NDR_DRSUAPI_DSREPLICADEL,
1049                                 &r);
1050
1051         if (!NT_STATUS_IS_OK(status)) {
1052                 return status;
1053         }
1054
1055         if (NT_STATUS_IS_ERR(status)) {
1056                 return status;
1057         }
1058
1059         /* Return variables */
1060
1061         /* Return result */
1062         if (werror) {
1063                 *werror = r.out.result;
1064         }
1065
1066         return werror_to_ntstatus(r.out.result);
1067 }
1068
1069 struct rpccli_drsuapi_DsReplicaMod_state {
1070         struct drsuapi_DsReplicaMod orig;
1071         struct drsuapi_DsReplicaMod tmp;
1072         TALLOC_CTX *out_mem_ctx;
1073         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
1074 };
1075
1076 static void rpccli_drsuapi_DsReplicaMod_done(struct tevent_req *subreq);
1077
1078 struct tevent_req *rpccli_drsuapi_DsReplicaMod_send(TALLOC_CTX *mem_ctx,
1079                                                     struct tevent_context *ev,
1080                                                     struct rpc_pipe_client *cli,
1081                                                     struct policy_handle *_bind_handle /* [in] [ref] */,
1082                                                     int32_t _level /* [in]  */,
1083                                                     union drsuapi_DsReplicaModRequest _req /* [in] [switch_is(level)] */)
1084 {
1085         struct tevent_req *req;
1086         struct rpccli_drsuapi_DsReplicaMod_state *state;
1087         struct tevent_req *subreq;
1088
1089         req = tevent_req_create(mem_ctx, &state,
1090                                 struct rpccli_drsuapi_DsReplicaMod_state);
1091         if (req == NULL) {
1092                 return NULL;
1093         }
1094         state->out_mem_ctx = NULL;
1095         state->dispatch_recv = cli->dispatch_recv;
1096
1097         /* In parameters */
1098         state->orig.in.bind_handle = _bind_handle;
1099         state->orig.in.level = _level;
1100         state->orig.in.req = _req;
1101
1102         /* Out parameters */
1103
1104         /* Result */
1105         ZERO_STRUCT(state->orig.out.result);
1106
1107         /* make a temporary copy, that we pass to the dispatch function */
1108         state->tmp = state->orig;
1109
1110         subreq = cli->dispatch_send(state, ev, cli,
1111                                     NDR_DRSUAPI_UUID, NDR_DRSUAPI_VERSION,
1112                                     NDR_DRSUAPI_DSREPLICAMOD,
1113                                     &state->tmp);
1114         if (tevent_req_nomem(subreq, req)) {
1115                 return tevent_req_post(req, ev);
1116         }
1117         tevent_req_set_callback(subreq, rpccli_drsuapi_DsReplicaMod_done, req);
1118         return req;
1119 }
1120
1121 static void rpccli_drsuapi_DsReplicaMod_done(struct tevent_req *subreq)
1122 {
1123         struct tevent_req *req = tevent_req_callback_data(
1124                 subreq, struct tevent_req);
1125         struct rpccli_drsuapi_DsReplicaMod_state *state = tevent_req_data(
1126                 req, struct rpccli_drsuapi_DsReplicaMod_state);
1127         NTSTATUS status;
1128         TALLOC_CTX *mem_ctx;
1129
1130         if (state->out_mem_ctx) {
1131                 mem_ctx = state->out_mem_ctx;
1132         } else {
1133                 mem_ctx = state;
1134         }
1135
1136         status = state->dispatch_recv(subreq, mem_ctx);
1137         TALLOC_FREE(subreq);
1138         if (!NT_STATUS_IS_OK(status)) {
1139                 tevent_req_nterror(req, status);
1140                 return;
1141         }
1142
1143         /* Copy out parameters */
1144
1145         /* Copy result */
1146         state->orig.out.result = state->tmp.out.result;
1147
1148         /* Reset temporary structure */
1149         ZERO_STRUCT(state->tmp);
1150
1151         tevent_req_done(req);
1152 }
1153
1154 NTSTATUS rpccli_drsuapi_DsReplicaMod_recv(struct tevent_req *req,
1155                                           TALLOC_CTX *mem_ctx,
1156                                           WERROR *result)
1157 {
1158         struct rpccli_drsuapi_DsReplicaMod_state *state = tevent_req_data(
1159                 req, struct rpccli_drsuapi_DsReplicaMod_state);
1160         NTSTATUS status;
1161
1162         if (tevent_req_is_nterror(req, &status)) {
1163                 tevent_req_received(req);
1164                 return status;
1165         }
1166
1167         /* Steal possbile out parameters to the callers context */
1168         talloc_steal(mem_ctx, state->out_mem_ctx);
1169
1170         /* Return result */
1171         *result = state->orig.out.result;
1172
1173         tevent_req_received(req);
1174         return NT_STATUS_OK;
1175 }
1176
1177 NTSTATUS rpccli_drsuapi_DsReplicaMod(struct rpc_pipe_client *cli,
1178                                      TALLOC_CTX *mem_ctx,
1179                                      struct policy_handle *bind_handle /* [in] [ref] */,
1180                                      int32_t level /* [in]  */,
1181                                      union drsuapi_DsReplicaModRequest req /* [in] [switch_is(level)] */,
1182                                      WERROR *werror)
1183 {
1184         struct drsuapi_DsReplicaMod r;
1185         NTSTATUS status;
1186
1187         /* In parameters */
1188         r.in.bind_handle = bind_handle;
1189         r.in.level = level;
1190         r.in.req = req;
1191
1192         status = cli->dispatch(cli,
1193                                 mem_ctx,
1194                                 NDR_DRSUAPI_UUID, NDR_DRSUAPI_VERSION,
1195                                 NDR_DRSUAPI_DSREPLICAMOD,
1196                                 &r);
1197
1198         if (!NT_STATUS_IS_OK(status)) {
1199                 return status;
1200         }
1201
1202         if (NT_STATUS_IS_ERR(status)) {
1203                 return status;
1204         }
1205
1206         /* Return variables */
1207
1208         /* Return result */
1209         if (werror) {
1210                 *werror = r.out.result;
1211         }
1212
1213         return werror_to_ntstatus(r.out.result);
1214 }
1215
1216 struct rpccli_DRSUAPI_VERIFY_NAMES_state {
1217         struct DRSUAPI_VERIFY_NAMES orig;
1218         struct DRSUAPI_VERIFY_NAMES tmp;
1219         TALLOC_CTX *out_mem_ctx;
1220         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
1221 };
1222
1223 static void rpccli_DRSUAPI_VERIFY_NAMES_done(struct tevent_req *subreq);
1224
1225 struct tevent_req *rpccli_DRSUAPI_VERIFY_NAMES_send(TALLOC_CTX *mem_ctx,
1226                                                     struct tevent_context *ev,
1227                                                     struct rpc_pipe_client *cli)
1228 {
1229         struct tevent_req *req;
1230         struct rpccli_DRSUAPI_VERIFY_NAMES_state *state;
1231         struct tevent_req *subreq;
1232
1233         req = tevent_req_create(mem_ctx, &state,
1234                                 struct rpccli_DRSUAPI_VERIFY_NAMES_state);
1235         if (req == NULL) {
1236                 return NULL;
1237         }
1238         state->out_mem_ctx = NULL;
1239         state->dispatch_recv = cli->dispatch_recv;
1240
1241         /* In parameters */
1242
1243         /* Out parameters */
1244
1245         /* Result */
1246         ZERO_STRUCT(state->orig.out.result);
1247
1248         /* make a temporary copy, that we pass to the dispatch function */
1249         state->tmp = state->orig;
1250
1251         subreq = cli->dispatch_send(state, ev, cli,
1252                                     NDR_DRSUAPI_UUID, NDR_DRSUAPI_VERSION,
1253                                     NDR_DRSUAPI_VERIFY_NAMES,
1254                                     &state->tmp);
1255         if (tevent_req_nomem(subreq, req)) {
1256                 return tevent_req_post(req, ev);
1257         }
1258         tevent_req_set_callback(subreq, rpccli_DRSUAPI_VERIFY_NAMES_done, req);
1259         return req;
1260 }
1261
1262 static void rpccli_DRSUAPI_VERIFY_NAMES_done(struct tevent_req *subreq)
1263 {
1264         struct tevent_req *req = tevent_req_callback_data(
1265                 subreq, struct tevent_req);
1266         struct rpccli_DRSUAPI_VERIFY_NAMES_state *state = tevent_req_data(
1267                 req, struct rpccli_DRSUAPI_VERIFY_NAMES_state);
1268         NTSTATUS status;
1269         TALLOC_CTX *mem_ctx;
1270
1271         if (state->out_mem_ctx) {
1272                 mem_ctx = state->out_mem_ctx;
1273         } else {
1274                 mem_ctx = state;
1275         }
1276
1277         status = state->dispatch_recv(subreq, mem_ctx);
1278         TALLOC_FREE(subreq);
1279         if (!NT_STATUS_IS_OK(status)) {
1280                 tevent_req_nterror(req, status);
1281                 return;
1282         }
1283
1284         /* Copy out parameters */
1285
1286         /* Copy result */
1287         state->orig.out.result = state->tmp.out.result;
1288
1289         /* Reset temporary structure */
1290         ZERO_STRUCT(state->tmp);
1291
1292         tevent_req_done(req);
1293 }
1294
1295 NTSTATUS rpccli_DRSUAPI_VERIFY_NAMES_recv(struct tevent_req *req,
1296                                           TALLOC_CTX *mem_ctx,
1297                                           WERROR *result)
1298 {
1299         struct rpccli_DRSUAPI_VERIFY_NAMES_state *state = tevent_req_data(
1300                 req, struct rpccli_DRSUAPI_VERIFY_NAMES_state);
1301         NTSTATUS status;
1302
1303         if (tevent_req_is_nterror(req, &status)) {
1304                 tevent_req_received(req);
1305                 return status;
1306         }
1307
1308         /* Steal possbile out parameters to the callers context */
1309         talloc_steal(mem_ctx, state->out_mem_ctx);
1310
1311         /* Return result */
1312         *result = state->orig.out.result;
1313
1314         tevent_req_received(req);
1315         return NT_STATUS_OK;
1316 }
1317
1318 NTSTATUS rpccli_DRSUAPI_VERIFY_NAMES(struct rpc_pipe_client *cli,
1319                                      TALLOC_CTX *mem_ctx,
1320                                      WERROR *werror)
1321 {
1322         struct DRSUAPI_VERIFY_NAMES r;
1323         NTSTATUS status;
1324
1325         /* In parameters */
1326
1327         status = cli->dispatch(cli,
1328                                 mem_ctx,
1329                                 NDR_DRSUAPI_UUID, NDR_DRSUAPI_VERSION,
1330                                 NDR_DRSUAPI_VERIFY_NAMES,
1331                                 &r);
1332
1333         if (!NT_STATUS_IS_OK(status)) {
1334                 return status;
1335         }
1336
1337         if (NT_STATUS_IS_ERR(status)) {
1338                 return status;
1339         }
1340
1341         /* Return variables */
1342
1343         /* Return result */
1344         if (werror) {
1345                 *werror = r.out.result;
1346         }
1347
1348         return werror_to_ntstatus(r.out.result);
1349 }
1350
1351 struct rpccli_drsuapi_DsGetMemberships_state {
1352         struct drsuapi_DsGetMemberships orig;
1353         struct drsuapi_DsGetMemberships tmp;
1354         TALLOC_CTX *out_mem_ctx;
1355         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
1356 };
1357
1358 static void rpccli_drsuapi_DsGetMemberships_done(struct tevent_req *subreq);
1359
1360 struct tevent_req *rpccli_drsuapi_DsGetMemberships_send(TALLOC_CTX *mem_ctx,
1361                                                         struct tevent_context *ev,
1362                                                         struct rpc_pipe_client *cli,
1363                                                         struct policy_handle *_bind_handle /* [in] [ref] */,
1364                                                         int32_t _level /* [in]  */,
1365                                                         union drsuapi_DsGetMembershipsRequest *_req /* [in] [ref,switch_is(level)] */,
1366                                                         int32_t *_level_out /* [out] [ref] */,
1367                                                         union drsuapi_DsGetMembershipsCtr *_ctr /* [out] [ref,switch_is(*level_out)] */)
1368 {
1369         struct tevent_req *req;
1370         struct rpccli_drsuapi_DsGetMemberships_state *state;
1371         struct tevent_req *subreq;
1372
1373         req = tevent_req_create(mem_ctx, &state,
1374                                 struct rpccli_drsuapi_DsGetMemberships_state);
1375         if (req == NULL) {
1376                 return NULL;
1377         }
1378         state->out_mem_ctx = NULL;
1379         state->dispatch_recv = cli->dispatch_recv;
1380
1381         /* In parameters */
1382         state->orig.in.bind_handle = _bind_handle;
1383         state->orig.in.level = _level;
1384         state->orig.in.req = _req;
1385
1386         /* Out parameters */
1387         state->orig.out.level_out = _level_out;
1388         state->orig.out.ctr = _ctr;
1389
1390         /* Result */
1391         ZERO_STRUCT(state->orig.out.result);
1392
1393         state->out_mem_ctx = talloc_named_const(state, 0,
1394                              "rpccli_drsuapi_DsGetMemberships_out_memory");
1395         if (tevent_req_nomem(state->out_mem_ctx, req)) {
1396                 return tevent_req_post(req, ev);
1397         }
1398
1399         /* make a temporary copy, that we pass to the dispatch function */
1400         state->tmp = state->orig;
1401
1402         subreq = cli->dispatch_send(state, ev, cli,
1403                                     NDR_DRSUAPI_UUID, NDR_DRSUAPI_VERSION,
1404                                     NDR_DRSUAPI_DSGETMEMBERSHIPS,
1405                                     &state->tmp);
1406         if (tevent_req_nomem(subreq, req)) {
1407                 return tevent_req_post(req, ev);
1408         }
1409         tevent_req_set_callback(subreq, rpccli_drsuapi_DsGetMemberships_done, req);
1410         return req;
1411 }
1412
1413 static void rpccli_drsuapi_DsGetMemberships_done(struct tevent_req *subreq)
1414 {
1415         struct tevent_req *req = tevent_req_callback_data(
1416                 subreq, struct tevent_req);
1417         struct rpccli_drsuapi_DsGetMemberships_state *state = tevent_req_data(
1418                 req, struct rpccli_drsuapi_DsGetMemberships_state);
1419         NTSTATUS status;
1420         TALLOC_CTX *mem_ctx;
1421
1422         if (state->out_mem_ctx) {
1423                 mem_ctx = state->out_mem_ctx;
1424         } else {
1425                 mem_ctx = state;
1426         }
1427
1428         status = state->dispatch_recv(subreq, mem_ctx);
1429         TALLOC_FREE(subreq);
1430         if (!NT_STATUS_IS_OK(status)) {
1431                 tevent_req_nterror(req, status);
1432                 return;
1433         }
1434
1435         /* Copy out parameters */
1436         *state->orig.out.level_out = *state->tmp.out.level_out;
1437         *state->orig.out.ctr = *state->tmp.out.ctr;
1438
1439         /* Copy result */
1440         state->orig.out.result = state->tmp.out.result;
1441
1442         /* Reset temporary structure */
1443         ZERO_STRUCT(state->tmp);
1444
1445         tevent_req_done(req);
1446 }
1447
1448 NTSTATUS rpccli_drsuapi_DsGetMemberships_recv(struct tevent_req *req,
1449                                               TALLOC_CTX *mem_ctx,
1450                                               WERROR *result)
1451 {
1452         struct rpccli_drsuapi_DsGetMemberships_state *state = tevent_req_data(
1453                 req, struct rpccli_drsuapi_DsGetMemberships_state);
1454         NTSTATUS status;
1455
1456         if (tevent_req_is_nterror(req, &status)) {
1457                 tevent_req_received(req);
1458                 return status;
1459         }
1460
1461         /* Steal possbile out parameters to the callers context */
1462         talloc_steal(mem_ctx, state->out_mem_ctx);
1463
1464         /* Return result */
1465         *result = state->orig.out.result;
1466
1467         tevent_req_received(req);
1468         return NT_STATUS_OK;
1469 }
1470
1471 NTSTATUS rpccli_drsuapi_DsGetMemberships(struct rpc_pipe_client *cli,
1472                                          TALLOC_CTX *mem_ctx,
1473                                          struct policy_handle *bind_handle /* [in] [ref] */,
1474                                          int32_t level /* [in]  */,
1475                                          union drsuapi_DsGetMembershipsRequest *req /* [in] [ref,switch_is(level)] */,
1476                                          int32_t *level_out /* [out] [ref] */,
1477                                          union drsuapi_DsGetMembershipsCtr *ctr /* [out] [ref,switch_is(*level_out)] */,
1478                                          WERROR *werror)
1479 {
1480         struct drsuapi_DsGetMemberships r;
1481         NTSTATUS status;
1482
1483         /* In parameters */
1484         r.in.bind_handle = bind_handle;
1485         r.in.level = level;
1486         r.in.req = req;
1487
1488         status = cli->dispatch(cli,
1489                                 mem_ctx,
1490                                 NDR_DRSUAPI_UUID, NDR_DRSUAPI_VERSION,
1491                                 NDR_DRSUAPI_DSGETMEMBERSHIPS,
1492                                 &r);
1493
1494         if (!NT_STATUS_IS_OK(status)) {
1495                 return status;
1496         }
1497
1498         if (NT_STATUS_IS_ERR(status)) {
1499                 return status;
1500         }
1501
1502         /* Return variables */
1503         *level_out = *r.out.level_out;
1504         *ctr = *r.out.ctr;
1505
1506         /* Return result */
1507         if (werror) {
1508                 *werror = r.out.result;
1509         }
1510
1511         return werror_to_ntstatus(r.out.result);
1512 }
1513
1514 struct rpccli_DRSUAPI_INTER_DOMAIN_MOVE_state {
1515         struct DRSUAPI_INTER_DOMAIN_MOVE orig;
1516         struct DRSUAPI_INTER_DOMAIN_MOVE tmp;
1517         TALLOC_CTX *out_mem_ctx;
1518         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
1519 };
1520
1521 static void rpccli_DRSUAPI_INTER_DOMAIN_MOVE_done(struct tevent_req *subreq);
1522
1523 struct tevent_req *rpccli_DRSUAPI_INTER_DOMAIN_MOVE_send(TALLOC_CTX *mem_ctx,
1524                                                          struct tevent_context *ev,
1525                                                          struct rpc_pipe_client *cli)
1526 {
1527         struct tevent_req *req;
1528         struct rpccli_DRSUAPI_INTER_DOMAIN_MOVE_state *state;
1529         struct tevent_req *subreq;
1530
1531         req = tevent_req_create(mem_ctx, &state,
1532                                 struct rpccli_DRSUAPI_INTER_DOMAIN_MOVE_state);
1533         if (req == NULL) {
1534                 return NULL;
1535         }
1536         state->out_mem_ctx = NULL;
1537         state->dispatch_recv = cli->dispatch_recv;
1538
1539         /* In parameters */
1540
1541         /* Out parameters */
1542
1543         /* Result */
1544         ZERO_STRUCT(state->orig.out.result);
1545
1546         /* make a temporary copy, that we pass to the dispatch function */
1547         state->tmp = state->orig;
1548
1549         subreq = cli->dispatch_send(state, ev, cli,
1550                                     NDR_DRSUAPI_UUID, NDR_DRSUAPI_VERSION,
1551                                     NDR_DRSUAPI_INTER_DOMAIN_MOVE,
1552                                     &state->tmp);
1553         if (tevent_req_nomem(subreq, req)) {
1554                 return tevent_req_post(req, ev);
1555         }
1556         tevent_req_set_callback(subreq, rpccli_DRSUAPI_INTER_DOMAIN_MOVE_done, req);
1557         return req;
1558 }
1559
1560 static void rpccli_DRSUAPI_INTER_DOMAIN_MOVE_done(struct tevent_req *subreq)
1561 {
1562         struct tevent_req *req = tevent_req_callback_data(
1563                 subreq, struct tevent_req);
1564         struct rpccli_DRSUAPI_INTER_DOMAIN_MOVE_state *state = tevent_req_data(
1565                 req, struct rpccli_DRSUAPI_INTER_DOMAIN_MOVE_state);
1566         NTSTATUS status;
1567         TALLOC_CTX *mem_ctx;
1568
1569         if (state->out_mem_ctx) {
1570                 mem_ctx = state->out_mem_ctx;
1571         } else {
1572                 mem_ctx = state;
1573         }
1574
1575         status = state->dispatch_recv(subreq, mem_ctx);
1576         TALLOC_FREE(subreq);
1577         if (!NT_STATUS_IS_OK(status)) {
1578                 tevent_req_nterror(req, status);
1579                 return;
1580         }
1581
1582         /* Copy out parameters */
1583
1584         /* Copy result */
1585         state->orig.out.result = state->tmp.out.result;
1586
1587         /* Reset temporary structure */
1588         ZERO_STRUCT(state->tmp);
1589
1590         tevent_req_done(req);
1591 }
1592
1593 NTSTATUS rpccli_DRSUAPI_INTER_DOMAIN_MOVE_recv(struct tevent_req *req,
1594                                                TALLOC_CTX *mem_ctx,
1595                                                WERROR *result)
1596 {
1597         struct rpccli_DRSUAPI_INTER_DOMAIN_MOVE_state *state = tevent_req_data(
1598                 req, struct rpccli_DRSUAPI_INTER_DOMAIN_MOVE_state);
1599         NTSTATUS status;
1600
1601         if (tevent_req_is_nterror(req, &status)) {
1602                 tevent_req_received(req);
1603                 return status;
1604         }
1605
1606         /* Steal possbile out parameters to the callers context */
1607         talloc_steal(mem_ctx, state->out_mem_ctx);
1608
1609         /* Return result */
1610         *result = state->orig.out.result;
1611
1612         tevent_req_received(req);
1613         return NT_STATUS_OK;
1614 }
1615
1616 NTSTATUS rpccli_DRSUAPI_INTER_DOMAIN_MOVE(struct rpc_pipe_client *cli,
1617                                           TALLOC_CTX *mem_ctx,
1618                                           WERROR *werror)
1619 {
1620         struct DRSUAPI_INTER_DOMAIN_MOVE r;
1621         NTSTATUS status;
1622
1623         /* In parameters */
1624
1625         status = cli->dispatch(cli,
1626                                 mem_ctx,
1627                                 NDR_DRSUAPI_UUID, NDR_DRSUAPI_VERSION,
1628                                 NDR_DRSUAPI_INTER_DOMAIN_MOVE,
1629                                 &r);
1630
1631         if (!NT_STATUS_IS_OK(status)) {
1632                 return status;
1633         }
1634
1635         if (NT_STATUS_IS_ERR(status)) {
1636                 return status;
1637         }
1638
1639         /* Return variables */
1640
1641         /* Return result */
1642         if (werror) {
1643                 *werror = r.out.result;
1644         }
1645
1646         return werror_to_ntstatus(r.out.result);
1647 }
1648
1649 struct rpccli_drsuapi_DsGetNT4ChangeLog_state {
1650         struct drsuapi_DsGetNT4ChangeLog orig;
1651         struct drsuapi_DsGetNT4ChangeLog tmp;
1652         TALLOC_CTX *out_mem_ctx;
1653         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
1654 };
1655
1656 static void rpccli_drsuapi_DsGetNT4ChangeLog_done(struct tevent_req *subreq);
1657
1658 struct tevent_req *rpccli_drsuapi_DsGetNT4ChangeLog_send(TALLOC_CTX *mem_ctx,
1659                                                          struct tevent_context *ev,
1660                                                          struct rpc_pipe_client *cli,
1661                                                          struct policy_handle *_bind_handle /* [in] [ref] */,
1662                                                          uint32_t _level /* [in]  */,
1663                                                          union drsuapi_DsGetNT4ChangeLogRequest *_req /* [in] [ref,switch_is(level)] */,
1664                                                          uint32_t *_level_out /* [out] [ref] */,
1665                                                          union drsuapi_DsGetNT4ChangeLogInfo *_info /* [out] [ref,switch_is(*level_out)] */)
1666 {
1667         struct tevent_req *req;
1668         struct rpccli_drsuapi_DsGetNT4ChangeLog_state *state;
1669         struct tevent_req *subreq;
1670
1671         req = tevent_req_create(mem_ctx, &state,
1672                                 struct rpccli_drsuapi_DsGetNT4ChangeLog_state);
1673         if (req == NULL) {
1674                 return NULL;
1675         }
1676         state->out_mem_ctx = NULL;
1677         state->dispatch_recv = cli->dispatch_recv;
1678
1679         /* In parameters */
1680         state->orig.in.bind_handle = _bind_handle;
1681         state->orig.in.level = _level;
1682         state->orig.in.req = _req;
1683
1684         /* Out parameters */
1685         state->orig.out.level_out = _level_out;
1686         state->orig.out.info = _info;
1687
1688         /* Result */
1689         ZERO_STRUCT(state->orig.out.result);
1690
1691         state->out_mem_ctx = talloc_named_const(state, 0,
1692                              "rpccli_drsuapi_DsGetNT4ChangeLog_out_memory");
1693         if (tevent_req_nomem(state->out_mem_ctx, req)) {
1694                 return tevent_req_post(req, ev);
1695         }
1696
1697         /* make a temporary copy, that we pass to the dispatch function */
1698         state->tmp = state->orig;
1699
1700         subreq = cli->dispatch_send(state, ev, cli,
1701                                     NDR_DRSUAPI_UUID, NDR_DRSUAPI_VERSION,
1702                                     NDR_DRSUAPI_DSGETNT4CHANGELOG,
1703                                     &state->tmp);
1704         if (tevent_req_nomem(subreq, req)) {
1705                 return tevent_req_post(req, ev);
1706         }
1707         tevent_req_set_callback(subreq, rpccli_drsuapi_DsGetNT4ChangeLog_done, req);
1708         return req;
1709 }
1710
1711 static void rpccli_drsuapi_DsGetNT4ChangeLog_done(struct tevent_req *subreq)
1712 {
1713         struct tevent_req *req = tevent_req_callback_data(
1714                 subreq, struct tevent_req);
1715         struct rpccli_drsuapi_DsGetNT4ChangeLog_state *state = tevent_req_data(
1716                 req, struct rpccli_drsuapi_DsGetNT4ChangeLog_state);
1717         NTSTATUS status;
1718         TALLOC_CTX *mem_ctx;
1719
1720         if (state->out_mem_ctx) {
1721                 mem_ctx = state->out_mem_ctx;
1722         } else {
1723                 mem_ctx = state;
1724         }
1725
1726         status = state->dispatch_recv(subreq, mem_ctx);
1727         TALLOC_FREE(subreq);
1728         if (!NT_STATUS_IS_OK(status)) {
1729                 tevent_req_nterror(req, status);
1730                 return;
1731         }
1732
1733         /* Copy out parameters */
1734         *state->orig.out.level_out = *state->tmp.out.level_out;
1735         *state->orig.out.info = *state->tmp.out.info;
1736
1737         /* Copy result */
1738         state->orig.out.result = state->tmp.out.result;
1739
1740         /* Reset temporary structure */
1741         ZERO_STRUCT(state->tmp);
1742
1743         tevent_req_done(req);
1744 }
1745
1746 NTSTATUS rpccli_drsuapi_DsGetNT4ChangeLog_recv(struct tevent_req *req,
1747                                                TALLOC_CTX *mem_ctx,
1748                                                WERROR *result)
1749 {
1750         struct rpccli_drsuapi_DsGetNT4ChangeLog_state *state = tevent_req_data(
1751                 req, struct rpccli_drsuapi_DsGetNT4ChangeLog_state);
1752         NTSTATUS status;
1753
1754         if (tevent_req_is_nterror(req, &status)) {
1755                 tevent_req_received(req);
1756                 return status;
1757         }
1758
1759         /* Steal possbile out parameters to the callers context */
1760         talloc_steal(mem_ctx, state->out_mem_ctx);
1761
1762         /* Return result */
1763         *result = state->orig.out.result;
1764
1765         tevent_req_received(req);
1766         return NT_STATUS_OK;
1767 }
1768
1769 NTSTATUS rpccli_drsuapi_DsGetNT4ChangeLog(struct rpc_pipe_client *cli,
1770                                           TALLOC_CTX *mem_ctx,
1771                                           struct policy_handle *bind_handle /* [in] [ref] */,
1772                                           uint32_t level /* [in]  */,
1773                                           union drsuapi_DsGetNT4ChangeLogRequest *req /* [in] [ref,switch_is(level)] */,
1774                                           uint32_t *level_out /* [out] [ref] */,
1775                                           union drsuapi_DsGetNT4ChangeLogInfo *info /* [out] [ref,switch_is(*level_out)] */,
1776                                           WERROR *werror)
1777 {
1778         struct drsuapi_DsGetNT4ChangeLog r;
1779         NTSTATUS status;
1780
1781         /* In parameters */
1782         r.in.bind_handle = bind_handle;
1783         r.in.level = level;
1784         r.in.req = req;
1785
1786         status = cli->dispatch(cli,
1787                                 mem_ctx,
1788                                 NDR_DRSUAPI_UUID, NDR_DRSUAPI_VERSION,
1789                                 NDR_DRSUAPI_DSGETNT4CHANGELOG,
1790                                 &r);
1791
1792         if (!NT_STATUS_IS_OK(status)) {
1793                 return status;
1794         }
1795
1796         if (NT_STATUS_IS_ERR(status)) {
1797                 return status;
1798         }
1799
1800         /* Return variables */
1801         *level_out = *r.out.level_out;
1802         *info = *r.out.info;
1803
1804         /* Return result */
1805         if (werror) {
1806                 *werror = r.out.result;
1807         }
1808
1809         return werror_to_ntstatus(r.out.result);
1810 }
1811
1812 struct rpccli_drsuapi_DsCrackNames_state {
1813         struct drsuapi_DsCrackNames orig;
1814         struct drsuapi_DsCrackNames tmp;
1815         TALLOC_CTX *out_mem_ctx;
1816         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
1817 };
1818
1819 static void rpccli_drsuapi_DsCrackNames_done(struct tevent_req *subreq);
1820
1821 struct tevent_req *rpccli_drsuapi_DsCrackNames_send(TALLOC_CTX *mem_ctx,
1822                                                     struct tevent_context *ev,
1823                                                     struct rpc_pipe_client *cli,
1824                                                     struct policy_handle *_bind_handle /* [in] [ref] */,
1825                                                     int32_t _level /* [in]  */,
1826                                                     union drsuapi_DsNameRequest *_req /* [in] [ref,switch_is(level)] */,
1827                                                     int32_t *_level_out /* [out] [ref] */,
1828                                                     union drsuapi_DsNameCtr *_ctr /* [out] [ref,switch_is(*level_out)] */)
1829 {
1830         struct tevent_req *req;
1831         struct rpccli_drsuapi_DsCrackNames_state *state;
1832         struct tevent_req *subreq;
1833
1834         req = tevent_req_create(mem_ctx, &state,
1835                                 struct rpccli_drsuapi_DsCrackNames_state);
1836         if (req == NULL) {
1837                 return NULL;
1838         }
1839         state->out_mem_ctx = NULL;
1840         state->dispatch_recv = cli->dispatch_recv;
1841
1842         /* In parameters */
1843         state->orig.in.bind_handle = _bind_handle;
1844         state->orig.in.level = _level;
1845         state->orig.in.req = _req;
1846
1847         /* Out parameters */
1848         state->orig.out.level_out = _level_out;
1849         state->orig.out.ctr = _ctr;
1850
1851         /* Result */
1852         ZERO_STRUCT(state->orig.out.result);
1853
1854         state->out_mem_ctx = talloc_named_const(state, 0,
1855                              "rpccli_drsuapi_DsCrackNames_out_memory");
1856         if (tevent_req_nomem(state->out_mem_ctx, req)) {
1857                 return tevent_req_post(req, ev);
1858         }
1859
1860         /* make a temporary copy, that we pass to the dispatch function */
1861         state->tmp = state->orig;
1862
1863         subreq = cli->dispatch_send(state, ev, cli,
1864                                     NDR_DRSUAPI_UUID, NDR_DRSUAPI_VERSION,
1865                                     NDR_DRSUAPI_DSCRACKNAMES,
1866                                     &state->tmp);
1867         if (tevent_req_nomem(subreq, req)) {
1868                 return tevent_req_post(req, ev);
1869         }
1870         tevent_req_set_callback(subreq, rpccli_drsuapi_DsCrackNames_done, req);
1871         return req;
1872 }
1873
1874 static void rpccli_drsuapi_DsCrackNames_done(struct tevent_req *subreq)
1875 {
1876         struct tevent_req *req = tevent_req_callback_data(
1877                 subreq, struct tevent_req);
1878         struct rpccli_drsuapi_DsCrackNames_state *state = tevent_req_data(
1879                 req, struct rpccli_drsuapi_DsCrackNames_state);
1880         NTSTATUS status;
1881         TALLOC_CTX *mem_ctx;
1882
1883         if (state->out_mem_ctx) {
1884                 mem_ctx = state->out_mem_ctx;
1885         } else {
1886                 mem_ctx = state;
1887         }
1888
1889         status = state->dispatch_recv(subreq, mem_ctx);
1890         TALLOC_FREE(subreq);
1891         if (!NT_STATUS_IS_OK(status)) {
1892                 tevent_req_nterror(req, status);
1893                 return;
1894         }
1895
1896         /* Copy out parameters */
1897         *state->orig.out.level_out = *state->tmp.out.level_out;
1898         *state->orig.out.ctr = *state->tmp.out.ctr;
1899
1900         /* Copy result */
1901         state->orig.out.result = state->tmp.out.result;
1902
1903         /* Reset temporary structure */
1904         ZERO_STRUCT(state->tmp);
1905
1906         tevent_req_done(req);
1907 }
1908
1909 NTSTATUS rpccli_drsuapi_DsCrackNames_recv(struct tevent_req *req,
1910                                           TALLOC_CTX *mem_ctx,
1911                                           WERROR *result)
1912 {
1913         struct rpccli_drsuapi_DsCrackNames_state *state = tevent_req_data(
1914                 req, struct rpccli_drsuapi_DsCrackNames_state);
1915         NTSTATUS status;
1916
1917         if (tevent_req_is_nterror(req, &status)) {
1918                 tevent_req_received(req);
1919                 return status;
1920         }
1921
1922         /* Steal possbile out parameters to the callers context */
1923         talloc_steal(mem_ctx, state->out_mem_ctx);
1924
1925         /* Return result */
1926         *result = state->orig.out.result;
1927
1928         tevent_req_received(req);
1929         return NT_STATUS_OK;
1930 }
1931
1932 NTSTATUS rpccli_drsuapi_DsCrackNames(struct rpc_pipe_client *cli,
1933                                      TALLOC_CTX *mem_ctx,
1934                                      struct policy_handle *bind_handle /* [in] [ref] */,
1935                                      int32_t level /* [in]  */,
1936                                      union drsuapi_DsNameRequest *req /* [in] [ref,switch_is(level)] */,
1937                                      int32_t *level_out /* [out] [ref] */,
1938                                      union drsuapi_DsNameCtr *ctr /* [out] [ref,switch_is(*level_out)] */,
1939                                      WERROR *werror)
1940 {
1941         struct drsuapi_DsCrackNames r;
1942         NTSTATUS status;
1943
1944         /* In parameters */
1945         r.in.bind_handle = bind_handle;
1946         r.in.level = level;
1947         r.in.req = req;
1948
1949         status = cli->dispatch(cli,
1950                                 mem_ctx,
1951                                 NDR_DRSUAPI_UUID, NDR_DRSUAPI_VERSION,
1952                                 NDR_DRSUAPI_DSCRACKNAMES,
1953                                 &r);
1954
1955         if (!NT_STATUS_IS_OK(status)) {
1956                 return status;
1957         }
1958
1959         if (NT_STATUS_IS_ERR(status)) {
1960                 return status;
1961         }
1962
1963         /* Return variables */
1964         *level_out = *r.out.level_out;
1965         *ctr = *r.out.ctr;
1966
1967         /* Return result */
1968         if (werror) {
1969                 *werror = r.out.result;
1970         }
1971
1972         return werror_to_ntstatus(r.out.result);
1973 }
1974
1975 struct rpccli_drsuapi_DsWriteAccountSpn_state {
1976         struct drsuapi_DsWriteAccountSpn orig;
1977         struct drsuapi_DsWriteAccountSpn tmp;
1978         TALLOC_CTX *out_mem_ctx;
1979         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
1980 };
1981
1982 static void rpccli_drsuapi_DsWriteAccountSpn_done(struct tevent_req *subreq);
1983
1984 struct tevent_req *rpccli_drsuapi_DsWriteAccountSpn_send(TALLOC_CTX *mem_ctx,
1985                                                          struct tevent_context *ev,
1986                                                          struct rpc_pipe_client *cli,
1987                                                          struct policy_handle *_bind_handle /* [in] [ref] */,
1988                                                          int32_t _level /* [in]  */,
1989                                                          union drsuapi_DsWriteAccountSpnRequest *_req /* [in] [ref,switch_is(level)] */,
1990                                                          int32_t *_level_out /* [out] [ref] */,
1991                                                          union drsuapi_DsWriteAccountSpnResult *_res /* [out] [ref,switch_is(*level_out)] */)
1992 {
1993         struct tevent_req *req;
1994         struct rpccli_drsuapi_DsWriteAccountSpn_state *state;
1995         struct tevent_req *subreq;
1996
1997         req = tevent_req_create(mem_ctx, &state,
1998                                 struct rpccli_drsuapi_DsWriteAccountSpn_state);
1999         if (req == NULL) {
2000                 return NULL;
2001         }
2002         state->out_mem_ctx = NULL;
2003         state->dispatch_recv = cli->dispatch_recv;
2004
2005         /* In parameters */
2006         state->orig.in.bind_handle = _bind_handle;
2007         state->orig.in.level = _level;
2008         state->orig.in.req = _req;
2009
2010         /* Out parameters */
2011         state->orig.out.level_out = _level_out;
2012         state->orig.out.res = _res;
2013
2014         /* Result */
2015         ZERO_STRUCT(state->orig.out.result);
2016
2017         state->out_mem_ctx = talloc_named_const(state, 0,
2018                              "rpccli_drsuapi_DsWriteAccountSpn_out_memory");
2019         if (tevent_req_nomem(state->out_mem_ctx, req)) {
2020                 return tevent_req_post(req, ev);
2021         }
2022
2023         /* make a temporary copy, that we pass to the dispatch function */
2024         state->tmp = state->orig;
2025
2026         subreq = cli->dispatch_send(state, ev, cli,
2027                                     NDR_DRSUAPI_UUID, NDR_DRSUAPI_VERSION,
2028                                     NDR_DRSUAPI_DSWRITEACCOUNTSPN,
2029                                     &state->tmp);
2030         if (tevent_req_nomem(subreq, req)) {
2031                 return tevent_req_post(req, ev);
2032         }
2033         tevent_req_set_callback(subreq, rpccli_drsuapi_DsWriteAccountSpn_done, req);
2034         return req;
2035 }
2036
2037 static void rpccli_drsuapi_DsWriteAccountSpn_done(struct tevent_req *subreq)
2038 {
2039         struct tevent_req *req = tevent_req_callback_data(
2040                 subreq, struct tevent_req);
2041         struct rpccli_drsuapi_DsWriteAccountSpn_state *state = tevent_req_data(
2042                 req, struct rpccli_drsuapi_DsWriteAccountSpn_state);
2043         NTSTATUS status;
2044         TALLOC_CTX *mem_ctx;
2045
2046         if (state->out_mem_ctx) {
2047                 mem_ctx = state->out_mem_ctx;
2048         } else {
2049                 mem_ctx = state;
2050         }
2051
2052         status = state->dispatch_recv(subreq, mem_ctx);
2053         TALLOC_FREE(subreq);
2054         if (!NT_STATUS_IS_OK(status)) {
2055                 tevent_req_nterror(req, status);
2056                 return;
2057         }
2058
2059         /* Copy out parameters */
2060         *state->orig.out.level_out = *state->tmp.out.level_out;
2061         *state->orig.out.res = *state->tmp.out.res;
2062
2063         /* Copy result */
2064         state->orig.out.result = state->tmp.out.result;
2065
2066         /* Reset temporary structure */
2067         ZERO_STRUCT(state->tmp);
2068
2069         tevent_req_done(req);
2070 }
2071
2072 NTSTATUS rpccli_drsuapi_DsWriteAccountSpn_recv(struct tevent_req *req,
2073                                                TALLOC_CTX *mem_ctx,
2074                                                WERROR *result)
2075 {
2076         struct rpccli_drsuapi_DsWriteAccountSpn_state *state = tevent_req_data(
2077                 req, struct rpccli_drsuapi_DsWriteAccountSpn_state);
2078         NTSTATUS status;
2079
2080         if (tevent_req_is_nterror(req, &status)) {
2081                 tevent_req_received(req);
2082                 return status;
2083         }
2084
2085         /* Steal possbile out parameters to the callers context */
2086         talloc_steal(mem_ctx, state->out_mem_ctx);
2087
2088         /* Return result */
2089         *result = state->orig.out.result;
2090
2091         tevent_req_received(req);
2092         return NT_STATUS_OK;
2093 }
2094
2095 NTSTATUS rpccli_drsuapi_DsWriteAccountSpn(struct rpc_pipe_client *cli,
2096                                           TALLOC_CTX *mem_ctx,
2097                                           struct policy_handle *bind_handle /* [in] [ref] */,
2098                                           int32_t level /* [in]  */,
2099                                           union drsuapi_DsWriteAccountSpnRequest *req /* [in] [ref,switch_is(level)] */,
2100                                           int32_t *level_out /* [out] [ref] */,
2101                                           union drsuapi_DsWriteAccountSpnResult *res /* [out] [ref,switch_is(*level_out)] */,
2102                                           WERROR *werror)
2103 {
2104         struct drsuapi_DsWriteAccountSpn r;
2105         NTSTATUS status;
2106
2107         /* In parameters */
2108         r.in.bind_handle = bind_handle;
2109         r.in.level = level;
2110         r.in.req = req;
2111
2112         status = cli->dispatch(cli,
2113                                 mem_ctx,
2114                                 NDR_DRSUAPI_UUID, NDR_DRSUAPI_VERSION,
2115                                 NDR_DRSUAPI_DSWRITEACCOUNTSPN,
2116                                 &r);
2117
2118         if (!NT_STATUS_IS_OK(status)) {
2119                 return status;
2120         }
2121
2122         if (NT_STATUS_IS_ERR(status)) {
2123                 return status;
2124         }
2125
2126         /* Return variables */
2127         *level_out = *r.out.level_out;
2128         *res = *r.out.res;
2129
2130         /* Return result */
2131         if (werror) {
2132                 *werror = r.out.result;
2133         }
2134
2135         return werror_to_ntstatus(r.out.result);
2136 }
2137
2138 struct rpccli_drsuapi_DsRemoveDSServer_state {
2139         struct drsuapi_DsRemoveDSServer orig;
2140         struct drsuapi_DsRemoveDSServer tmp;
2141         TALLOC_CTX *out_mem_ctx;
2142         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
2143 };
2144
2145 static void rpccli_drsuapi_DsRemoveDSServer_done(struct tevent_req *subreq);
2146
2147 struct tevent_req *rpccli_drsuapi_DsRemoveDSServer_send(TALLOC_CTX *mem_ctx,
2148                                                         struct tevent_context *ev,
2149                                                         struct rpc_pipe_client *cli,
2150                                                         struct policy_handle *_bind_handle /* [in] [ref] */,
2151                                                         int32_t _level /* [in]  */,
2152                                                         union drsuapi_DsRemoveDSServerRequest *_req /* [in] [ref,switch_is(level)] */,
2153                                                         int32_t *_level_out /* [out] [ref] */,
2154                                                         union drsuapi_DsRemoveDSServerResult *_res /* [out] [ref,switch_is(*level_out)] */)
2155 {
2156         struct tevent_req *req;
2157         struct rpccli_drsuapi_DsRemoveDSServer_state *state;
2158         struct tevent_req *subreq;
2159
2160         req = tevent_req_create(mem_ctx, &state,
2161                                 struct rpccli_drsuapi_DsRemoveDSServer_state);
2162         if (req == NULL) {
2163                 return NULL;
2164         }
2165         state->out_mem_ctx = NULL;
2166         state->dispatch_recv = cli->dispatch_recv;
2167
2168         /* In parameters */
2169         state->orig.in.bind_handle = _bind_handle;
2170         state->orig.in.level = _level;
2171         state->orig.in.req = _req;
2172
2173         /* Out parameters */
2174         state->orig.out.level_out = _level_out;
2175         state->orig.out.res = _res;
2176
2177         /* Result */
2178         ZERO_STRUCT(state->orig.out.result);
2179
2180         state->out_mem_ctx = talloc_named_const(state, 0,
2181                              "rpccli_drsuapi_DsRemoveDSServer_out_memory");
2182         if (tevent_req_nomem(state->out_mem_ctx, req)) {
2183                 return tevent_req_post(req, ev);
2184         }
2185
2186         /* make a temporary copy, that we pass to the dispatch function */
2187         state->tmp = state->orig;
2188
2189         subreq = cli->dispatch_send(state, ev, cli,
2190                                     NDR_DRSUAPI_UUID, NDR_DRSUAPI_VERSION,
2191                                     NDR_DRSUAPI_DSREMOVEDSSERVER,
2192                                     &state->tmp);
2193         if (tevent_req_nomem(subreq, req)) {
2194                 return tevent_req_post(req, ev);
2195         }
2196         tevent_req_set_callback(subreq, rpccli_drsuapi_DsRemoveDSServer_done, req);
2197         return req;
2198 }
2199
2200 static void rpccli_drsuapi_DsRemoveDSServer_done(struct tevent_req *subreq)
2201 {
2202         struct tevent_req *req = tevent_req_callback_data(
2203                 subreq, struct tevent_req);
2204         struct rpccli_drsuapi_DsRemoveDSServer_state *state = tevent_req_data(
2205                 req, struct rpccli_drsuapi_DsRemoveDSServer_state);
2206         NTSTATUS status;
2207         TALLOC_CTX *mem_ctx;
2208
2209         if (state->out_mem_ctx) {
2210                 mem_ctx = state->out_mem_ctx;
2211         } else {
2212                 mem_ctx = state;
2213         }
2214
2215         status = state->dispatch_recv(subreq, mem_ctx);
2216         TALLOC_FREE(subreq);
2217         if (!NT_STATUS_IS_OK(status)) {
2218                 tevent_req_nterror(req, status);
2219                 return;
2220         }
2221
2222         /* Copy out parameters */
2223         *state->orig.out.level_out = *state->tmp.out.level_out;
2224         *state->orig.out.res = *state->tmp.out.res;
2225
2226         /* Copy result */
2227         state->orig.out.result = state->tmp.out.result;
2228
2229         /* Reset temporary structure */
2230         ZERO_STRUCT(state->tmp);
2231
2232         tevent_req_done(req);
2233 }
2234
2235 NTSTATUS rpccli_drsuapi_DsRemoveDSServer_recv(struct tevent_req *req,
2236                                               TALLOC_CTX *mem_ctx,
2237                                               WERROR *result)
2238 {
2239         struct rpccli_drsuapi_DsRemoveDSServer_state *state = tevent_req_data(
2240                 req, struct rpccli_drsuapi_DsRemoveDSServer_state);
2241         NTSTATUS status;
2242
2243         if (tevent_req_is_nterror(req, &status)) {
2244                 tevent_req_received(req);
2245                 return status;
2246         }
2247
2248         /* Steal possbile out parameters to the callers context */
2249         talloc_steal(mem_ctx, state->out_mem_ctx);
2250
2251         /* Return result */
2252         *result = state->orig.out.result;
2253
2254         tevent_req_received(req);
2255         return NT_STATUS_OK;
2256 }
2257
2258 NTSTATUS rpccli_drsuapi_DsRemoveDSServer(struct rpc_pipe_client *cli,
2259                                          TALLOC_CTX *mem_ctx,
2260                                          struct policy_handle *bind_handle /* [in] [ref] */,
2261                                          int32_t level /* [in]  */,
2262                                          union drsuapi_DsRemoveDSServerRequest *req /* [in] [ref,switch_is(level)] */,
2263                                          int32_t *level_out /* [out] [ref] */,
2264                                          union drsuapi_DsRemoveDSServerResult *res /* [out] [ref,switch_is(*level_out)] */,
2265                                          WERROR *werror)
2266 {
2267         struct drsuapi_DsRemoveDSServer r;
2268         NTSTATUS status;
2269
2270         /* In parameters */
2271         r.in.bind_handle = bind_handle;
2272         r.in.level = level;
2273         r.in.req = req;
2274
2275         status = cli->dispatch(cli,
2276                                 mem_ctx,
2277                                 NDR_DRSUAPI_UUID, NDR_DRSUAPI_VERSION,
2278                                 NDR_DRSUAPI_DSREMOVEDSSERVER,
2279                                 &r);
2280
2281         if (!NT_STATUS_IS_OK(status)) {
2282                 return status;
2283         }
2284
2285         if (NT_STATUS_IS_ERR(status)) {
2286                 return status;
2287         }
2288
2289         /* Return variables */
2290         *level_out = *r.out.level_out;
2291         *res = *r.out.res;
2292
2293         /* Return result */
2294         if (werror) {
2295                 *werror = r.out.result;
2296         }
2297
2298         return werror_to_ntstatus(r.out.result);
2299 }
2300
2301 struct rpccli_DRSUAPI_REMOVE_DS_DOMAIN_state {
2302         struct DRSUAPI_REMOVE_DS_DOMAIN orig;
2303         struct DRSUAPI_REMOVE_DS_DOMAIN tmp;
2304         TALLOC_CTX *out_mem_ctx;
2305         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
2306 };
2307
2308 static void rpccli_DRSUAPI_REMOVE_DS_DOMAIN_done(struct tevent_req *subreq);
2309
2310 struct tevent_req *rpccli_DRSUAPI_REMOVE_DS_DOMAIN_send(TALLOC_CTX *mem_ctx,
2311                                                         struct tevent_context *ev,
2312                                                         struct rpc_pipe_client *cli)
2313 {
2314         struct tevent_req *req;
2315         struct rpccli_DRSUAPI_REMOVE_DS_DOMAIN_state *state;
2316         struct tevent_req *subreq;
2317
2318         req = tevent_req_create(mem_ctx, &state,
2319                                 struct rpccli_DRSUAPI_REMOVE_DS_DOMAIN_state);
2320         if (req == NULL) {
2321                 return NULL;
2322         }
2323         state->out_mem_ctx = NULL;
2324         state->dispatch_recv = cli->dispatch_recv;
2325
2326         /* In parameters */
2327
2328         /* Out parameters */
2329
2330         /* Result */
2331         ZERO_STRUCT(state->orig.out.result);
2332
2333         /* make a temporary copy, that we pass to the dispatch function */
2334         state->tmp = state->orig;
2335
2336         subreq = cli->dispatch_send(state, ev, cli,
2337                                     NDR_DRSUAPI_UUID, NDR_DRSUAPI_VERSION,
2338                                     NDR_DRSUAPI_REMOVE_DS_DOMAIN,
2339                                     &state->tmp);
2340         if (tevent_req_nomem(subreq, req)) {
2341                 return tevent_req_post(req, ev);
2342         }
2343         tevent_req_set_callback(subreq, rpccli_DRSUAPI_REMOVE_DS_DOMAIN_done, req);
2344         return req;
2345 }
2346
2347 static void rpccli_DRSUAPI_REMOVE_DS_DOMAIN_done(struct tevent_req *subreq)
2348 {
2349         struct tevent_req *req = tevent_req_callback_data(
2350                 subreq, struct tevent_req);
2351         struct rpccli_DRSUAPI_REMOVE_DS_DOMAIN_state *state = tevent_req_data(
2352                 req, struct rpccli_DRSUAPI_REMOVE_DS_DOMAIN_state);
2353         NTSTATUS status;
2354         TALLOC_CTX *mem_ctx;
2355
2356         if (state->out_mem_ctx) {
2357                 mem_ctx = state->out_mem_ctx;
2358         } else {
2359                 mem_ctx = state;
2360         }
2361
2362         status = state->dispatch_recv(subreq, mem_ctx);
2363         TALLOC_FREE(subreq);
2364         if (!NT_STATUS_IS_OK(status)) {
2365                 tevent_req_nterror(req, status);
2366                 return;
2367         }
2368
2369         /* Copy out parameters */
2370
2371         /* Copy result */
2372         state->orig.out.result = state->tmp.out.result;
2373
2374         /* Reset temporary structure */
2375         ZERO_STRUCT(state->tmp);
2376
2377         tevent_req_done(req);
2378 }
2379
2380 NTSTATUS rpccli_DRSUAPI_REMOVE_DS_DOMAIN_recv(struct tevent_req *req,
2381                                               TALLOC_CTX *mem_ctx,
2382                                               WERROR *result)
2383 {
2384         struct rpccli_DRSUAPI_REMOVE_DS_DOMAIN_state *state = tevent_req_data(
2385                 req, struct rpccli_DRSUAPI_REMOVE_DS_DOMAIN_state);
2386         NTSTATUS status;
2387
2388         if (tevent_req_is_nterror(req, &status)) {
2389                 tevent_req_received(req);
2390                 return status;
2391         }
2392
2393         /* Steal possbile out parameters to the callers context */
2394         talloc_steal(mem_ctx, state->out_mem_ctx);
2395
2396         /* Return result */
2397         *result = state->orig.out.result;
2398
2399         tevent_req_received(req);
2400         return NT_STATUS_OK;
2401 }
2402
2403 NTSTATUS rpccli_DRSUAPI_REMOVE_DS_DOMAIN(struct rpc_pipe_client *cli,
2404                                          TALLOC_CTX *mem_ctx,
2405                                          WERROR *werror)
2406 {
2407         struct DRSUAPI_REMOVE_DS_DOMAIN r;
2408         NTSTATUS status;
2409
2410         /* In parameters */
2411
2412         status = cli->dispatch(cli,
2413                                 mem_ctx,
2414                                 NDR_DRSUAPI_UUID, NDR_DRSUAPI_VERSION,
2415                                 NDR_DRSUAPI_REMOVE_DS_DOMAIN,
2416                                 &r);
2417
2418         if (!NT_STATUS_IS_OK(status)) {
2419                 return status;
2420         }
2421
2422         if (NT_STATUS_IS_ERR(status)) {
2423                 return status;
2424         }
2425
2426         /* Return variables */
2427
2428         /* Return result */
2429         if (werror) {
2430                 *werror = r.out.result;
2431         }
2432
2433         return werror_to_ntstatus(r.out.result);
2434 }
2435
2436 struct rpccli_drsuapi_DsGetDomainControllerInfo_state {
2437         struct drsuapi_DsGetDomainControllerInfo orig;
2438         struct drsuapi_DsGetDomainControllerInfo tmp;
2439         TALLOC_CTX *out_mem_ctx;
2440         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
2441 };
2442
2443 static void rpccli_drsuapi_DsGetDomainControllerInfo_done(struct tevent_req *subreq);
2444
2445 struct tevent_req *rpccli_drsuapi_DsGetDomainControllerInfo_send(TALLOC_CTX *mem_ctx,
2446                                                                  struct tevent_context *ev,
2447                                                                  struct rpc_pipe_client *cli,
2448                                                                  struct policy_handle *_bind_handle /* [in] [ref] */,
2449                                                                  int32_t _level /* [in]  */,
2450                                                                  union drsuapi_DsGetDCInfoRequest *_req /* [in] [ref,switch_is(level)] */,
2451                                                                  int32_t *_level_out /* [out] [ref] */,
2452                                                                  union drsuapi_DsGetDCInfoCtr *_ctr /* [out] [ref,switch_is(*level_out)] */)
2453 {
2454         struct tevent_req *req;
2455         struct rpccli_drsuapi_DsGetDomainControllerInfo_state *state;
2456         struct tevent_req *subreq;
2457
2458         req = tevent_req_create(mem_ctx, &state,
2459                                 struct rpccli_drsuapi_DsGetDomainControllerInfo_state);
2460         if (req == NULL) {
2461                 return NULL;
2462         }
2463         state->out_mem_ctx = NULL;
2464         state->dispatch_recv = cli->dispatch_recv;
2465
2466         /* In parameters */
2467         state->orig.in.bind_handle = _bind_handle;
2468         state->orig.in.level = _level;
2469         state->orig.in.req = _req;
2470
2471         /* Out parameters */
2472         state->orig.out.level_out = _level_out;
2473         state->orig.out.ctr = _ctr;
2474
2475         /* Result */
2476         ZERO_STRUCT(state->orig.out.result);
2477
2478         state->out_mem_ctx = talloc_named_const(state, 0,
2479                              "rpccli_drsuapi_DsGetDomainControllerInfo_out_memory");
2480         if (tevent_req_nomem(state->out_mem_ctx, req)) {
2481                 return tevent_req_post(req, ev);
2482         }
2483
2484         /* make a temporary copy, that we pass to the dispatch function */
2485         state->tmp = state->orig;
2486
2487         subreq = cli->dispatch_send(state, ev, cli,
2488                                     NDR_DRSUAPI_UUID, NDR_DRSUAPI_VERSION,
2489                                     NDR_DRSUAPI_DSGETDOMAINCONTROLLERINFO,
2490                                     &state->tmp);
2491         if (tevent_req_nomem(subreq, req)) {
2492                 return tevent_req_post(req, ev);
2493         }
2494         tevent_req_set_callback(subreq, rpccli_drsuapi_DsGetDomainControllerInfo_done, req);
2495         return req;
2496 }
2497
2498 static void rpccli_drsuapi_DsGetDomainControllerInfo_done(struct tevent_req *subreq)
2499 {
2500         struct tevent_req *req = tevent_req_callback_data(
2501                 subreq, struct tevent_req);
2502         struct rpccli_drsuapi_DsGetDomainControllerInfo_state *state = tevent_req_data(
2503                 req, struct rpccli_drsuapi_DsGetDomainControllerInfo_state);
2504         NTSTATUS status;
2505         TALLOC_CTX *mem_ctx;
2506
2507         if (state->out_mem_ctx) {
2508                 mem_ctx = state->out_mem_ctx;
2509         } else {
2510                 mem_ctx = state;
2511         }
2512
2513         status = state->dispatch_recv(subreq, mem_ctx);
2514         TALLOC_FREE(subreq);
2515         if (!NT_STATUS_IS_OK(status)) {
2516                 tevent_req_nterror(req, status);
2517                 return;
2518         }
2519
2520         /* Copy out parameters */
2521         *state->orig.out.level_out = *state->tmp.out.level_out;
2522         *state->orig.out.ctr = *state->tmp.out.ctr;
2523
2524         /* Copy result */
2525         state->orig.out.result = state->tmp.out.result;
2526
2527         /* Reset temporary structure */
2528         ZERO_STRUCT(state->tmp);
2529
2530         tevent_req_done(req);
2531 }
2532
2533 NTSTATUS rpccli_drsuapi_DsGetDomainControllerInfo_recv(struct tevent_req *req,
2534                                                        TALLOC_CTX *mem_ctx,
2535                                                        WERROR *result)
2536 {
2537         struct rpccli_drsuapi_DsGetDomainControllerInfo_state *state = tevent_req_data(
2538                 req, struct rpccli_drsuapi_DsGetDomainControllerInfo_state);
2539         NTSTATUS status;
2540
2541         if (tevent_req_is_nterror(req, &status)) {
2542                 tevent_req_received(req);
2543                 return status;
2544         }
2545
2546         /* Steal possbile out parameters to the callers context */
2547         talloc_steal(mem_ctx, state->out_mem_ctx);
2548
2549         /* Return result */
2550         *result = state->orig.out.result;
2551
2552         tevent_req_received(req);
2553         return NT_STATUS_OK;
2554 }
2555
2556 NTSTATUS rpccli_drsuapi_DsGetDomainControllerInfo(struct rpc_pipe_client *cli,
2557                                                   TALLOC_CTX *mem_ctx,
2558                                                   struct policy_handle *bind_handle /* [in] [ref] */,
2559                                                   int32_t level /* [in]  */,
2560                                                   union drsuapi_DsGetDCInfoRequest *req /* [in] [ref,switch_is(level)] */,
2561                                                   int32_t *level_out /* [out] [ref] */,
2562                                                   union drsuapi_DsGetDCInfoCtr *ctr /* [out] [ref,switch_is(*level_out)] */,
2563                                                   WERROR *werror)
2564 {
2565         struct drsuapi_DsGetDomainControllerInfo r;
2566         NTSTATUS status;
2567
2568         /* In parameters */
2569         r.in.bind_handle = bind_handle;
2570         r.in.level = level;
2571         r.in.req = req;
2572
2573         status = cli->dispatch(cli,
2574                                 mem_ctx,
2575                                 NDR_DRSUAPI_UUID, NDR_DRSUAPI_VERSION,
2576                                 NDR_DRSUAPI_DSGETDOMAINCONTROLLERINFO,
2577                                 &r);
2578
2579         if (!NT_STATUS_IS_OK(status)) {
2580                 return status;
2581         }
2582
2583         if (NT_STATUS_IS_ERR(status)) {
2584                 return status;
2585         }
2586
2587         /* Return variables */
2588         *level_out = *r.out.level_out;
2589         *ctr = *r.out.ctr;
2590
2591         /* Return result */
2592         if (werror) {
2593                 *werror = r.out.result;
2594         }
2595
2596         return werror_to_ntstatus(r.out.result);
2597 }
2598
2599 struct rpccli_drsuapi_DsAddEntry_state {
2600         struct drsuapi_DsAddEntry orig;
2601         struct drsuapi_DsAddEntry tmp;
2602         TALLOC_CTX *out_mem_ctx;
2603         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
2604 };
2605
2606 static void rpccli_drsuapi_DsAddEntry_done(struct tevent_req *subreq);
2607
2608 struct tevent_req *rpccli_drsuapi_DsAddEntry_send(TALLOC_CTX *mem_ctx,
2609                                                   struct tevent_context *ev,
2610                                                   struct rpc_pipe_client *cli,
2611                                                   struct policy_handle *_bind_handle /* [in] [ref] */,
2612                                                   int32_t _level /* [in]  */,
2613                                                   union drsuapi_DsAddEntryRequest *_req /* [in] [ref,switch_is(level)] */,
2614                                                   int32_t *_level_out /* [out] [ref] */,
2615                                                   union drsuapi_DsAddEntryCtr *_ctr /* [out] [ref,switch_is(*level_out)] */)
2616 {
2617         struct tevent_req *req;
2618         struct rpccli_drsuapi_DsAddEntry_state *state;
2619         struct tevent_req *subreq;
2620
2621         req = tevent_req_create(mem_ctx, &state,
2622                                 struct rpccli_drsuapi_DsAddEntry_state);
2623         if (req == NULL) {
2624                 return NULL;
2625         }
2626         state->out_mem_ctx = NULL;
2627         state->dispatch_recv = cli->dispatch_recv;
2628
2629         /* In parameters */
2630         state->orig.in.bind_handle = _bind_handle;
2631         state->orig.in.level = _level;
2632         state->orig.in.req = _req;
2633
2634         /* Out parameters */
2635         state->orig.out.level_out = _level_out;
2636         state->orig.out.ctr = _ctr;
2637
2638         /* Result */
2639         ZERO_STRUCT(state->orig.out.result);
2640
2641         state->out_mem_ctx = talloc_named_const(state, 0,
2642                              "rpccli_drsuapi_DsAddEntry_out_memory");
2643         if (tevent_req_nomem(state->out_mem_ctx, req)) {
2644                 return tevent_req_post(req, ev);
2645         }
2646
2647         /* make a temporary copy, that we pass to the dispatch function */
2648         state->tmp = state->orig;
2649
2650         subreq = cli->dispatch_send(state, ev, cli,
2651                                     NDR_DRSUAPI_UUID, NDR_DRSUAPI_VERSION,
2652                                     NDR_DRSUAPI_DSADDENTRY,
2653                                     &state->tmp);
2654         if (tevent_req_nomem(subreq, req)) {
2655                 return tevent_req_post(req, ev);
2656         }
2657         tevent_req_set_callback(subreq, rpccli_drsuapi_DsAddEntry_done, req);
2658         return req;
2659 }
2660
2661 static void rpccli_drsuapi_DsAddEntry_done(struct tevent_req *subreq)
2662 {
2663         struct tevent_req *req = tevent_req_callback_data(
2664                 subreq, struct tevent_req);
2665         struct rpccli_drsuapi_DsAddEntry_state *state = tevent_req_data(
2666                 req, struct rpccli_drsuapi_DsAddEntry_state);
2667         NTSTATUS status;
2668         TALLOC_CTX *mem_ctx;
2669
2670         if (state->out_mem_ctx) {
2671                 mem_ctx = state->out_mem_ctx;
2672         } else {
2673                 mem_ctx = state;
2674         }
2675
2676         status = state->dispatch_recv(subreq, mem_ctx);
2677         TALLOC_FREE(subreq);
2678         if (!NT_STATUS_IS_OK(status)) {
2679                 tevent_req_nterror(req, status);
2680                 return;
2681         }
2682
2683         /* Copy out parameters */
2684         *state->orig.out.level_out = *state->tmp.out.level_out;
2685         *state->orig.out.ctr = *state->tmp.out.ctr;
2686
2687         /* Copy result */
2688         state->orig.out.result = state->tmp.out.result;
2689
2690         /* Reset temporary structure */
2691         ZERO_STRUCT(state->tmp);
2692
2693         tevent_req_done(req);
2694 }
2695
2696 NTSTATUS rpccli_drsuapi_DsAddEntry_recv(struct tevent_req *req,
2697                                         TALLOC_CTX *mem_ctx,
2698                                         WERROR *result)
2699 {
2700         struct rpccli_drsuapi_DsAddEntry_state *state = tevent_req_data(
2701                 req, struct rpccli_drsuapi_DsAddEntry_state);
2702         NTSTATUS status;
2703
2704         if (tevent_req_is_nterror(req, &status)) {
2705                 tevent_req_received(req);
2706                 return status;
2707         }
2708
2709         /* Steal possbile out parameters to the callers context */
2710         talloc_steal(mem_ctx, state->out_mem_ctx);
2711
2712         /* Return result */
2713         *result = state->orig.out.result;
2714
2715         tevent_req_received(req);
2716         return NT_STATUS_OK;
2717 }
2718
2719 NTSTATUS rpccli_drsuapi_DsAddEntry(struct rpc_pipe_client *cli,
2720                                    TALLOC_CTX *mem_ctx,
2721                                    struct policy_handle *bind_handle /* [in] [ref] */,
2722                                    int32_t level /* [in]  */,
2723                                    union drsuapi_DsAddEntryRequest *req /* [in] [ref,switch_is(level)] */,
2724                                    int32_t *level_out /* [out] [ref] */,
2725                                    union drsuapi_DsAddEntryCtr *ctr /* [out] [ref,switch_is(*level_out)] */,
2726                                    WERROR *werror)
2727 {
2728         struct drsuapi_DsAddEntry r;
2729         NTSTATUS status;
2730
2731         /* In parameters */
2732         r.in.bind_handle = bind_handle;
2733         r.in.level = level;
2734         r.in.req = req;
2735
2736         status = cli->dispatch(cli,
2737                                 mem_ctx,
2738                                 NDR_DRSUAPI_UUID, NDR_DRSUAPI_VERSION,
2739                                 NDR_DRSUAPI_DSADDENTRY,
2740                                 &r);
2741
2742         if (!NT_STATUS_IS_OK(status)) {
2743                 return status;
2744         }
2745
2746         if (NT_STATUS_IS_ERR(status)) {
2747                 return status;
2748         }
2749
2750         /* Return variables */
2751         *level_out = *r.out.level_out;
2752         *ctr = *r.out.ctr;
2753
2754         /* Return result */
2755         if (werror) {
2756                 *werror = r.out.result;
2757         }
2758
2759         return werror_to_ntstatus(r.out.result);
2760 }
2761
2762 struct rpccli_drsuapi_DsExecuteKCC_state {
2763         struct drsuapi_DsExecuteKCC orig;
2764         struct drsuapi_DsExecuteKCC tmp;
2765         TALLOC_CTX *out_mem_ctx;
2766         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
2767 };
2768
2769 static void rpccli_drsuapi_DsExecuteKCC_done(struct tevent_req *subreq);
2770
2771 struct tevent_req *rpccli_drsuapi_DsExecuteKCC_send(TALLOC_CTX *mem_ctx,
2772                                                     struct tevent_context *ev,
2773                                                     struct rpc_pipe_client *cli,
2774                                                     struct policy_handle *_bind_handle /* [in] [ref] */,
2775                                                     uint32_t _level /* [in]  */,
2776                                                     union drsuapi_DsExecuteKCCRequest *_req /* [in] [ref,switch_is(level)] */)
2777 {
2778         struct tevent_req *req;
2779         struct rpccli_drsuapi_DsExecuteKCC_state *state;
2780         struct tevent_req *subreq;
2781
2782         req = tevent_req_create(mem_ctx, &state,
2783                                 struct rpccli_drsuapi_DsExecuteKCC_state);
2784         if (req == NULL) {
2785                 return NULL;
2786         }
2787         state->out_mem_ctx = NULL;
2788         state->dispatch_recv = cli->dispatch_recv;
2789
2790         /* In parameters */
2791         state->orig.in.bind_handle = _bind_handle;
2792         state->orig.in.level = _level;
2793         state->orig.in.req = _req;
2794
2795         /* Out parameters */
2796
2797         /* Result */
2798         ZERO_STRUCT(state->orig.out.result);
2799
2800         /* make a temporary copy, that we pass to the dispatch function */
2801         state->tmp = state->orig;
2802
2803         subreq = cli->dispatch_send(state, ev, cli,
2804                                     NDR_DRSUAPI_UUID, NDR_DRSUAPI_VERSION,
2805                                     NDR_DRSUAPI_DSEXECUTEKCC,
2806                                     &state->tmp);
2807         if (tevent_req_nomem(subreq, req)) {
2808                 return tevent_req_post(req, ev);
2809         }
2810         tevent_req_set_callback(subreq, rpccli_drsuapi_DsExecuteKCC_done, req);
2811         return req;
2812 }
2813
2814 static void rpccli_drsuapi_DsExecuteKCC_done(struct tevent_req *subreq)
2815 {
2816         struct tevent_req *req = tevent_req_callback_data(
2817                 subreq, struct tevent_req);
2818         struct rpccli_drsuapi_DsExecuteKCC_state *state = tevent_req_data(
2819                 req, struct rpccli_drsuapi_DsExecuteKCC_state);
2820         NTSTATUS status;
2821         TALLOC_CTX *mem_ctx;
2822
2823         if (state->out_mem_ctx) {
2824                 mem_ctx = state->out_mem_ctx;
2825         } else {
2826                 mem_ctx = state;
2827         }
2828
2829         status = state->dispatch_recv(subreq, mem_ctx);
2830         TALLOC_FREE(subreq);
2831         if (!NT_STATUS_IS_OK(status)) {
2832                 tevent_req_nterror(req, status);
2833                 return;
2834         }
2835
2836         /* Copy out parameters */
2837
2838         /* Copy result */
2839         state->orig.out.result = state->tmp.out.result;
2840
2841         /* Reset temporary structure */
2842         ZERO_STRUCT(state->tmp);
2843
2844         tevent_req_done(req);
2845 }
2846
2847 NTSTATUS rpccli_drsuapi_DsExecuteKCC_recv(struct tevent_req *req,
2848                                           TALLOC_CTX *mem_ctx,
2849                                           WERROR *result)
2850 {
2851         struct rpccli_drsuapi_DsExecuteKCC_state *state = tevent_req_data(
2852                 req, struct rpccli_drsuapi_DsExecuteKCC_state);
2853         NTSTATUS status;
2854
2855         if (tevent_req_is_nterror(req, &status)) {
2856                 tevent_req_received(req);
2857                 return status;
2858         }
2859
2860         /* Steal possbile out parameters to the callers context */
2861         talloc_steal(mem_ctx, state->out_mem_ctx);
2862
2863         /* Return result */
2864         *result = state->orig.out.result;
2865
2866         tevent_req_received(req);
2867         return NT_STATUS_OK;
2868 }
2869
2870 NTSTATUS rpccli_drsuapi_DsExecuteKCC(struct rpc_pipe_client *cli,
2871                                      TALLOC_CTX *mem_ctx,
2872                                      struct policy_handle *bind_handle /* [in] [ref] */,
2873                                      uint32_t level /* [in]  */,
2874                                      union drsuapi_DsExecuteKCCRequest *req /* [in] [ref,switch_is(level)] */,
2875                                      WERROR *werror)
2876 {
2877         struct drsuapi_DsExecuteKCC r;
2878         NTSTATUS status;
2879
2880         /* In parameters */
2881         r.in.bind_handle = bind_handle;
2882         r.in.level = level;
2883         r.in.req = req;
2884
2885         status = cli->dispatch(cli,
2886                                 mem_ctx,
2887                                 NDR_DRSUAPI_UUID, NDR_DRSUAPI_VERSION,
2888                                 NDR_DRSUAPI_DSEXECUTEKCC,
2889                                 &r);
2890
2891         if (!NT_STATUS_IS_OK(status)) {
2892                 return status;
2893         }
2894
2895         if (NT_STATUS_IS_ERR(status)) {
2896                 return status;
2897         }
2898
2899         /* Return variables */
2900
2901         /* Return result */
2902         if (werror) {
2903                 *werror = r.out.result;
2904         }
2905
2906         return werror_to_ntstatus(r.out.result);
2907 }
2908
2909 struct rpccli_drsuapi_DsReplicaGetInfo_state {
2910         struct drsuapi_DsReplicaGetInfo orig;
2911         struct drsuapi_DsReplicaGetInfo tmp;
2912         TALLOC_CTX *out_mem_ctx;
2913         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
2914 };
2915
2916 static void rpccli_drsuapi_DsReplicaGetInfo_done(struct tevent_req *subreq);
2917
2918 struct tevent_req *rpccli_drsuapi_DsReplicaGetInfo_send(TALLOC_CTX *mem_ctx,
2919                                                         struct tevent_context *ev,
2920                                                         struct rpc_pipe_client *cli,
2921                                                         struct policy_handle *_bind_handle /* [in] [ref] */,
2922                                                         enum drsuapi_DsReplicaGetInfoLevel _level /* [in]  */,
2923                                                         union drsuapi_DsReplicaGetInfoRequest *_req /* [in] [ref,switch_is(level)] */,
2924                                                         enum drsuapi_DsReplicaInfoType *_info_type /* [out] [ref] */,
2925                                                         union drsuapi_DsReplicaInfo *_info /* [out] [ref,switch_is(*info_type)] */)
2926 {
2927         struct tevent_req *req;
2928         struct rpccli_drsuapi_DsReplicaGetInfo_state *state;
2929         struct tevent_req *subreq;
2930
2931         req = tevent_req_create(mem_ctx, &state,
2932                                 struct rpccli_drsuapi_DsReplicaGetInfo_state);
2933         if (req == NULL) {
2934                 return NULL;
2935         }
2936         state->out_mem_ctx = NULL;
2937         state->dispatch_recv = cli->dispatch_recv;
2938
2939         /* In parameters */
2940         state->orig.in.bind_handle = _bind_handle;
2941         state->orig.in.level = _level;
2942         state->orig.in.req = _req;
2943
2944         /* Out parameters */
2945         state->orig.out.info_type = _info_type;
2946         state->orig.out.info = _info;
2947
2948         /* Result */
2949         ZERO_STRUCT(state->orig.out.result);
2950
2951         state->out_mem_ctx = talloc_named_const(state, 0,
2952                              "rpccli_drsuapi_DsReplicaGetInfo_out_memory");
2953         if (tevent_req_nomem(state->out_mem_ctx, req)) {
2954                 return tevent_req_post(req, ev);
2955         }
2956
2957         /* make a temporary copy, that we pass to the dispatch function */
2958         state->tmp = state->orig;
2959
2960         subreq = cli->dispatch_send(state, ev, cli,
2961                                     NDR_DRSUAPI_UUID, NDR_DRSUAPI_VERSION,
2962                                     NDR_DRSUAPI_DSREPLICAGETINFO,
2963                                     &state->tmp);
2964         if (tevent_req_nomem(subreq, req)) {
2965                 return tevent_req_post(req, ev);
2966         }
2967         tevent_req_set_callback(subreq, rpccli_drsuapi_DsReplicaGetInfo_done, req);
2968         return req;
2969 }
2970
2971 static void rpccli_drsuapi_DsReplicaGetInfo_done(struct tevent_req *subreq)
2972 {
2973         struct tevent_req *req = tevent_req_callback_data(
2974                 subreq, struct tevent_req);
2975         struct rpccli_drsuapi_DsReplicaGetInfo_state *state = tevent_req_data(
2976                 req, struct rpccli_drsuapi_DsReplicaGetInfo_state);
2977         NTSTATUS status;
2978         TALLOC_CTX *mem_ctx;
2979
2980         if (state->out_mem_ctx) {
2981                 mem_ctx = state->out_mem_ctx;
2982         } else {
2983                 mem_ctx = state;
2984         }
2985
2986         status = state->dispatch_recv(subreq, mem_ctx);
2987         TALLOC_FREE(subreq);
2988         if (!NT_STATUS_IS_OK(status)) {
2989                 tevent_req_nterror(req, status);
2990                 return;
2991         }
2992
2993         /* Copy out parameters */
2994         *state->orig.out.info_type = *state->tmp.out.info_type;
2995         *state->orig.out.info = *state->tmp.out.info;
2996
2997         /* Copy result */
2998         state->orig.out.result = state->tmp.out.result;
2999
3000         /* Reset temporary structure */
3001         ZERO_STRUCT(state->tmp);
3002
3003         tevent_req_done(req);
3004 }
3005
3006 NTSTATUS rpccli_drsuapi_DsReplicaGetInfo_recv(struct tevent_req *req,
3007                                               TALLOC_CTX *mem_ctx,
3008                                               WERROR *result)
3009 {
3010         struct rpccli_drsuapi_DsReplicaGetInfo_state *state = tevent_req_data(
3011                 req, struct rpccli_drsuapi_DsReplicaGetInfo_state);
3012         NTSTATUS status;
3013
3014         if (tevent_req_is_nterror(req, &status)) {
3015                 tevent_req_received(req);
3016                 return status;
3017         }
3018
3019         /* Steal possbile out parameters to the callers context */
3020         talloc_steal(mem_ctx, state->out_mem_ctx);
3021
3022         /* Return result */
3023         *result = state->orig.out.result;
3024
3025         tevent_req_received(req);
3026         return NT_STATUS_OK;
3027 }
3028
3029 NTSTATUS rpccli_drsuapi_DsReplicaGetInfo(struct rpc_pipe_client *cli,
3030                                          TALLOC_CTX *mem_ctx,
3031                                          struct policy_handle *bind_handle /* [in] [ref] */,
3032                                          enum drsuapi_DsReplicaGetInfoLevel level /* [in]  */,
3033                                          union drsuapi_DsReplicaGetInfoRequest *req /* [in] [ref,switch_is(level)] */,
3034                                          enum drsuapi_DsReplicaInfoType *info_type /* [out] [ref] */,
3035                                          union drsuapi_DsReplicaInfo *info /* [out] [ref,switch_is(*info_type)] */,
3036                                          WERROR *werror)
3037 {
3038         struct drsuapi_DsReplicaGetInfo r;
3039         NTSTATUS status;
3040
3041         /* In parameters */
3042         r.in.bind_handle = bind_handle;
3043         r.in.level = level;
3044         r.in.req = req;
3045
3046         status = cli->dispatch(cli,
3047                                 mem_ctx,
3048                                 NDR_DRSUAPI_UUID, NDR_DRSUAPI_VERSION,
3049                                 NDR_DRSUAPI_DSREPLICAGETINFO,
3050                                 &r);
3051
3052         if (!NT_STATUS_IS_OK(status)) {
3053                 return status;
3054         }
3055
3056         if (NT_STATUS_IS_ERR(status)) {
3057                 return status;
3058         }
3059
3060         /* Return variables */
3061         *info_type = *r.out.info_type;
3062         *info = *r.out.info;
3063
3064         /* Return result */
3065         if (werror) {
3066                 *werror = r.out.result;
3067         }
3068
3069         return werror_to_ntstatus(r.out.result);
3070 }
3071
3072 struct rpccli_DRSUAPI_ADD_SID_HISTORY_state {
3073         struct DRSUAPI_ADD_SID_HISTORY orig;
3074         struct DRSUAPI_ADD_SID_HISTORY tmp;
3075         TALLOC_CTX *out_mem_ctx;
3076         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
3077 };
3078
3079 static void rpccli_DRSUAPI_ADD_SID_HISTORY_done(struct tevent_req *subreq);
3080
3081 struct tevent_req *rpccli_DRSUAPI_ADD_SID_HISTORY_send(TALLOC_CTX *mem_ctx,
3082                                                        struct tevent_context *ev,
3083                                                        struct rpc_pipe_client *cli)
3084 {
3085         struct tevent_req *req;
3086         struct rpccli_DRSUAPI_ADD_SID_HISTORY_state *state;
3087         struct tevent_req *subreq;
3088
3089         req = tevent_req_create(mem_ctx, &state,
3090                                 struct rpccli_DRSUAPI_ADD_SID_HISTORY_state);
3091         if (req == NULL) {
3092                 return NULL;
3093         }
3094         state->out_mem_ctx = NULL;
3095         state->dispatch_recv = cli->dispatch_recv;
3096
3097         /* In parameters */
3098
3099         /* Out parameters */
3100
3101         /* Result */
3102         ZERO_STRUCT(state->orig.out.result);
3103
3104         /* make a temporary copy, that we pass to the dispatch function */
3105         state->tmp = state->orig;
3106
3107         subreq = cli->dispatch_send(state, ev, cli,
3108                                     NDR_DRSUAPI_UUID, NDR_DRSUAPI_VERSION,
3109                                     NDR_DRSUAPI_ADD_SID_HISTORY,
3110                                     &state->tmp);
3111         if (tevent_req_nomem(subreq, req)) {
3112                 return tevent_req_post(req, ev);
3113         }
3114         tevent_req_set_callback(subreq, rpccli_DRSUAPI_ADD_SID_HISTORY_done, req);
3115         return req;
3116 }
3117
3118 static void rpccli_DRSUAPI_ADD_SID_HISTORY_done(struct tevent_req *subreq)
3119 {
3120         struct tevent_req *req = tevent_req_callback_data(
3121                 subreq, struct tevent_req);
3122         struct rpccli_DRSUAPI_ADD_SID_HISTORY_state *state = tevent_req_data(
3123                 req, struct rpccli_DRSUAPI_ADD_SID_HISTORY_state);
3124         NTSTATUS status;
3125         TALLOC_CTX *mem_ctx;
3126
3127         if (state->out_mem_ctx) {
3128                 mem_ctx = state->out_mem_ctx;
3129         } else {
3130                 mem_ctx = state;
3131         }
3132
3133         status = state->dispatch_recv(subreq, mem_ctx);
3134         TALLOC_FREE(subreq);
3135         if (!NT_STATUS_IS_OK(status)) {
3136                 tevent_req_nterror(req, status);
3137                 return;
3138         }
3139
3140         /* Copy out parameters */
3141
3142         /* Copy result */
3143         state->orig.out.result = state->tmp.out.result;
3144
3145         /* Reset temporary structure */
3146         ZERO_STRUCT(state->tmp);
3147
3148         tevent_req_done(req);
3149 }
3150
3151 NTSTATUS rpccli_DRSUAPI_ADD_SID_HISTORY_recv(struct tevent_req *req,
3152                                              TALLOC_CTX *mem_ctx,
3153                                              WERROR *result)
3154 {
3155         struct rpccli_DRSUAPI_ADD_SID_HISTORY_state *state = tevent_req_data(
3156                 req, struct rpccli_DRSUAPI_ADD_SID_HISTORY_state);
3157         NTSTATUS status;
3158
3159         if (tevent_req_is_nterror(req, &status)) {
3160                 tevent_req_received(req);
3161                 return status;
3162         }
3163
3164         /* Steal possbile out parameters to the callers context */
3165         talloc_steal(mem_ctx, state->out_mem_ctx);
3166
3167         /* Return result */
3168         *result = state->orig.out.result;
3169
3170         tevent_req_received(req);
3171         return NT_STATUS_OK;
3172 }
3173
3174 NTSTATUS rpccli_DRSUAPI_ADD_SID_HISTORY(struct rpc_pipe_client *cli,
3175                                         TALLOC_CTX *mem_ctx,
3176                                         WERROR *werror)
3177 {
3178         struct DRSUAPI_ADD_SID_HISTORY r;
3179         NTSTATUS status;
3180
3181         /* In parameters */
3182
3183         status = cli->dispatch(cli,
3184                                 mem_ctx,
3185                                 NDR_DRSUAPI_UUID, NDR_DRSUAPI_VERSION,
3186                                 NDR_DRSUAPI_ADD_SID_HISTORY,
3187                                 &r);
3188
3189         if (!NT_STATUS_IS_OK(status)) {
3190                 return status;
3191         }
3192
3193         if (NT_STATUS_IS_ERR(status)) {
3194                 return status;
3195         }
3196
3197         /* Return variables */
3198
3199         /* Return result */
3200         if (werror) {
3201                 *werror = r.out.result;
3202         }
3203
3204         return werror_to_ntstatus(r.out.result);
3205 }
3206
3207 struct rpccli_drsuapi_DsGetMemberships2_state {
3208         struct drsuapi_DsGetMemberships2 orig;
3209         struct drsuapi_DsGetMemberships2 tmp;
3210         TALLOC_CTX *out_mem_ctx;
3211         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
3212 };
3213
3214 static void rpccli_drsuapi_DsGetMemberships2_done(struct tevent_req *subreq);
3215
3216 struct tevent_req *rpccli_drsuapi_DsGetMemberships2_send(TALLOC_CTX *mem_ctx,
3217                                                          struct tevent_context *ev,
3218                                                          struct rpc_pipe_client *cli,
3219                                                          struct policy_handle *_bind_handle /* [in] [ref] */,
3220                                                          int32_t _level /* [in]  */,
3221                                                          union drsuapi_DsGetMemberships2Request *_req /* [in] [ref,switch_is(level)] */,
3222                                                          int32_t *_level_out /* [out] [ref] */,
3223                                                          union drsuapi_DsGetMemberships2Ctr *_ctr /* [out] [ref,switch_is(*level_out)] */)
3224 {
3225         struct tevent_req *req;
3226         struct rpccli_drsuapi_DsGetMemberships2_state *state;
3227         struct tevent_req *subreq;
3228
3229         req = tevent_req_create(mem_ctx, &state,
3230                                 struct rpccli_drsuapi_DsGetMemberships2_state);
3231     &n