22b39cb3ee56b1c3c535610184cc7a0a9072de77
[ira/wip.git] / librpc / gen_ndr / cli_dssetup.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_dssetup.h"
8
9 struct rpccli_dssetup_DsRoleGetPrimaryDomainInformation_state {
10         struct dssetup_DsRoleGetPrimaryDomainInformation orig;
11         struct dssetup_DsRoleGetPrimaryDomainInformation 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_dssetup_DsRoleGetPrimaryDomainInformation_done(struct tevent_req *subreq);
17
18 struct tevent_req *rpccli_dssetup_DsRoleGetPrimaryDomainInformation_send(TALLOC_CTX *mem_ctx,
19                                                                          struct tevent_context *ev,
20                                                                          struct rpc_pipe_client *cli,
21                                                                          enum dssetup_DsRoleInfoLevel _level /* [in]  */,
22                                                                          union dssetup_DsRoleInfo *_info /* [out] [unique,switch_is(level)] */)
23 {
24         struct tevent_req *req;
25         struct rpccli_dssetup_DsRoleGetPrimaryDomainInformation_state *state;
26         struct tevent_req *subreq;
27
28         req = tevent_req_create(mem_ctx, &state,
29                                 struct rpccli_dssetup_DsRoleGetPrimaryDomainInformation_state);
30         if (req == NULL) {
31                 return NULL;
32         }
33         state->out_mem_ctx = NULL;
34         state->dispatch_recv = cli->dispatch_recv;
35
36         /* In parameters */
37         state->orig.in.level = _level;
38
39         /* Out parameters */
40         state->orig.out.info = _info;
41
42         /* Result */
43         ZERO_STRUCT(state->orig.out.result);
44
45         state->out_mem_ctx = talloc_named_const(state, 0,
46                              "rpccli_dssetup_DsRoleGetPrimaryDomainInformation_out_memory");
47         if (tevent_req_nomem(state->out_mem_ctx, req)) {
48                 return tevent_req_post(req, ev);
49         }
50
51         /* make a temporary copy, that we pass to the dispatch function */
52         state->tmp = state->orig;
53
54         subreq = cli->dispatch_send(state, ev, cli,
55                                     &ndr_table_dssetup,
56                                     NDR_DSSETUP_DSROLEGETPRIMARYDOMAININFORMATION,
57                                     &state->tmp);
58         if (tevent_req_nomem(subreq, req)) {
59                 return tevent_req_post(req, ev);
60         }
61         tevent_req_set_callback(subreq, rpccli_dssetup_DsRoleGetPrimaryDomainInformation_done, req);
62         return req;
63 }
64
65 static void rpccli_dssetup_DsRoleGetPrimaryDomainInformation_done(struct tevent_req *subreq)
66 {
67         struct tevent_req *req = tevent_req_callback_data(
68                 subreq, struct tevent_req);
69         struct rpccli_dssetup_DsRoleGetPrimaryDomainInformation_state *state = tevent_req_data(
70                 req, struct rpccli_dssetup_DsRoleGetPrimaryDomainInformation_state);
71         NTSTATUS status;
72         TALLOC_CTX *mem_ctx;
73
74         if (state->out_mem_ctx) {
75                 mem_ctx = state->out_mem_ctx;
76         } else {
77                 mem_ctx = state;
78         }
79
80         status = state->dispatch_recv(subreq, mem_ctx);
81         TALLOC_FREE(subreq);
82         if (!NT_STATUS_IS_OK(status)) {
83                 tevent_req_nterror(req, status);
84                 return;
85         }
86
87         /* Copy out parameters */
88         if (state->orig.out.info && state->tmp.out.info) {
89                 *state->orig.out.info = *state->tmp.out.info;
90         }
91
92         /* Copy result */
93         state->orig.out.result = state->tmp.out.result;
94
95         /* Reset temporary structure */
96         ZERO_STRUCT(state->tmp);
97
98         tevent_req_done(req);
99 }
100
101 NTSTATUS rpccli_dssetup_DsRoleGetPrimaryDomainInformation_recv(struct tevent_req *req,
102                                                                TALLOC_CTX *mem_ctx,
103                                                                WERROR *result)
104 {
105         struct rpccli_dssetup_DsRoleGetPrimaryDomainInformation_state *state = tevent_req_data(
106                 req, struct rpccli_dssetup_DsRoleGetPrimaryDomainInformation_state);
107         NTSTATUS status;
108
109         if (tevent_req_is_nterror(req, &status)) {
110                 tevent_req_received(req);
111                 return status;
112         }
113
114         /* Steal possbile out parameters to the callers context */
115         talloc_steal(mem_ctx, state->out_mem_ctx);
116
117         /* Return result */
118         *result = state->orig.out.result;
119
120         tevent_req_received(req);
121         return NT_STATUS_OK;
122 }
123
124 NTSTATUS rpccli_dssetup_DsRoleGetPrimaryDomainInformation(struct rpc_pipe_client *cli,
125                                                           TALLOC_CTX *mem_ctx,
126                                                           enum dssetup_DsRoleInfoLevel level /* [in]  */,
127                                                           union dssetup_DsRoleInfo *info /* [out] [unique,switch_is(level)] */,
128                                                           WERROR *werror)
129 {
130         struct dssetup_DsRoleGetPrimaryDomainInformation r;
131         NTSTATUS status;
132
133         /* In parameters */
134         r.in.level = level;
135
136         status = cli->dispatch(cli,
137                                 mem_ctx,
138                                 &ndr_table_dssetup,
139                                 NDR_DSSETUP_DSROLEGETPRIMARYDOMAININFORMATION,
140                                 &r);
141
142         if (!NT_STATUS_IS_OK(status)) {
143                 return status;
144         }
145
146         if (NT_STATUS_IS_ERR(status)) {
147                 return status;
148         }
149
150         /* Return variables */
151         if (info && r.out.info) {
152                 *info = *r.out.info;
153         }
154
155         /* Return result */
156         if (werror) {
157                 *werror = r.out.result;
158         }
159
160         return werror_to_ntstatus(r.out.result);
161 }
162
163 struct rpccli_dssetup_DsRoleDnsNameToFlatName_state {
164         struct dssetup_DsRoleDnsNameToFlatName orig;
165         struct dssetup_DsRoleDnsNameToFlatName tmp;
166         TALLOC_CTX *out_mem_ctx;
167         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
168 };
169
170 static void rpccli_dssetup_DsRoleDnsNameToFlatName_done(struct tevent_req *subreq);
171
172 struct tevent_req *rpccli_dssetup_DsRoleDnsNameToFlatName_send(TALLOC_CTX *mem_ctx,
173                                                                struct tevent_context *ev,
174                                                                struct rpc_pipe_client *cli)
175 {
176         struct tevent_req *req;
177         struct rpccli_dssetup_DsRoleDnsNameToFlatName_state *state;
178         struct tevent_req *subreq;
179
180         req = tevent_req_create(mem_ctx, &state,
181                                 struct rpccli_dssetup_DsRoleDnsNameToFlatName_state);
182         if (req == NULL) {
183                 return NULL;
184         }
185         state->out_mem_ctx = NULL;
186         state->dispatch_recv = cli->dispatch_recv;
187
188         /* In parameters */
189
190         /* Out parameters */
191
192         /* Result */
193         ZERO_STRUCT(state->orig.out.result);
194
195         /* make a temporary copy, that we pass to the dispatch function */
196         state->tmp = state->orig;
197
198         subreq = cli->dispatch_send(state, ev, cli,
199                                     &ndr_table_dssetup,
200                                     NDR_DSSETUP_DSROLEDNSNAMETOFLATNAME,
201                                     &state->tmp);
202         if (tevent_req_nomem(subreq, req)) {
203                 return tevent_req_post(req, ev);
204         }
205         tevent_req_set_callback(subreq, rpccli_dssetup_DsRoleDnsNameToFlatName_done, req);
206         return req;
207 }
208
209 static void rpccli_dssetup_DsRoleDnsNameToFlatName_done(struct tevent_req *subreq)
210 {
211         struct tevent_req *req = tevent_req_callback_data(
212                 subreq, struct tevent_req);
213         struct rpccli_dssetup_DsRoleDnsNameToFlatName_state *state = tevent_req_data(
214                 req, struct rpccli_dssetup_DsRoleDnsNameToFlatName_state);
215         NTSTATUS status;
216         TALLOC_CTX *mem_ctx;
217
218         if (state->out_mem_ctx) {
219                 mem_ctx = state->out_mem_ctx;
220         } else {
221                 mem_ctx = state;
222         }
223
224         status = state->dispatch_recv(subreq, mem_ctx);
225         TALLOC_FREE(subreq);
226         if (!NT_STATUS_IS_OK(status)) {
227                 tevent_req_nterror(req, status);
228                 return;
229         }
230
231         /* Copy out parameters */
232
233         /* Copy result */
234         state->orig.out.result = state->tmp.out.result;
235
236         /* Reset temporary structure */
237         ZERO_STRUCT(state->tmp);
238
239         tevent_req_done(req);
240 }
241
242 NTSTATUS rpccli_dssetup_DsRoleDnsNameToFlatName_recv(struct tevent_req *req,
243                                                      TALLOC_CTX *mem_ctx,
244                                                      WERROR *result)
245 {
246         struct rpccli_dssetup_DsRoleDnsNameToFlatName_state *state = tevent_req_data(
247                 req, struct rpccli_dssetup_DsRoleDnsNameToFlatName_state);
248         NTSTATUS status;
249
250         if (tevent_req_is_nterror(req, &status)) {
251                 tevent_req_received(req);
252                 return status;
253         }
254
255         /* Steal possbile out parameters to the callers context */
256         talloc_steal(mem_ctx, state->out_mem_ctx);
257
258         /* Return result */
259         *result = state->orig.out.result;
260
261         tevent_req_received(req);
262         return NT_STATUS_OK;
263 }
264
265 NTSTATUS rpccli_dssetup_DsRoleDnsNameToFlatName(struct rpc_pipe_client *cli,
266                                                 TALLOC_CTX *mem_ctx,
267                                                 WERROR *werror)
268 {
269         struct dssetup_DsRoleDnsNameToFlatName r;
270         NTSTATUS status;
271
272         /* In parameters */
273
274         status = cli->dispatch(cli,
275                                 mem_ctx,
276                                 &ndr_table_dssetup,
277                                 NDR_DSSETUP_DSROLEDNSNAMETOFLATNAME,
278                                 &r);
279
280         if (!NT_STATUS_IS_OK(status)) {
281                 return status;
282         }
283
284         if (NT_STATUS_IS_ERR(status)) {
285                 return status;
286         }
287
288         /* Return variables */
289
290         /* Return result */
291         if (werror) {
292                 *werror = r.out.result;
293         }
294
295         return werror_to_ntstatus(r.out.result);
296 }
297
298 struct rpccli_dssetup_DsRoleDcAsDc_state {
299         struct dssetup_DsRoleDcAsDc orig;
300         struct dssetup_DsRoleDcAsDc tmp;
301         TALLOC_CTX *out_mem_ctx;
302         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
303 };
304
305 static void rpccli_dssetup_DsRoleDcAsDc_done(struct tevent_req *subreq);
306
307 struct tevent_req *rpccli_dssetup_DsRoleDcAsDc_send(TALLOC_CTX *mem_ctx,
308                                                     struct tevent_context *ev,
309                                                     struct rpc_pipe_client *cli)
310 {
311         struct tevent_req *req;
312         struct rpccli_dssetup_DsRoleDcAsDc_state *state;
313         struct tevent_req *subreq;
314
315         req = tevent_req_create(mem_ctx, &state,
316                                 struct rpccli_dssetup_DsRoleDcAsDc_state);
317         if (req == NULL) {
318                 return NULL;
319         }
320         state->out_mem_ctx = NULL;
321         state->dispatch_recv = cli->dispatch_recv;
322
323         /* In parameters */
324
325         /* Out parameters */
326
327         /* Result */
328         ZERO_STRUCT(state->orig.out.result);
329
330         /* make a temporary copy, that we pass to the dispatch function */
331         state->tmp = state->orig;
332
333         subreq = cli->dispatch_send(state, ev, cli,
334                                     &ndr_table_dssetup,
335                                     NDR_DSSETUP_DSROLEDCASDC,
336                                     &state->tmp);
337         if (tevent_req_nomem(subreq, req)) {
338                 return tevent_req_post(req, ev);
339         }
340         tevent_req_set_callback(subreq, rpccli_dssetup_DsRoleDcAsDc_done, req);
341         return req;
342 }
343
344 static void rpccli_dssetup_DsRoleDcAsDc_done(struct tevent_req *subreq)
345 {
346         struct tevent_req *req = tevent_req_callback_data(
347                 subreq, struct tevent_req);
348         struct rpccli_dssetup_DsRoleDcAsDc_state *state = tevent_req_data(
349                 req, struct rpccli_dssetup_DsRoleDcAsDc_state);
350         NTSTATUS status;
351         TALLOC_CTX *mem_ctx;
352
353         if (state->out_mem_ctx) {
354                 mem_ctx = state->out_mem_ctx;
355         } else {
356                 mem_ctx = state;
357         }
358
359         status = state->dispatch_recv(subreq, mem_ctx);
360         TALLOC_FREE(subreq);
361         if (!NT_STATUS_IS_OK(status)) {
362                 tevent_req_nterror(req, status);
363                 return;
364         }
365
366         /* Copy out parameters */
367
368         /* Copy result */
369         state->orig.out.result = state->tmp.out.result;
370
371         /* Reset temporary structure */
372         ZERO_STRUCT(state->tmp);
373
374         tevent_req_done(req);
375 }
376
377 NTSTATUS rpccli_dssetup_DsRoleDcAsDc_recv(struct tevent_req *req,
378                                           TALLOC_CTX *mem_ctx,
379                                           WERROR *result)
380 {
381         struct rpccli_dssetup_DsRoleDcAsDc_state *state = tevent_req_data(
382                 req, struct rpccli_dssetup_DsRoleDcAsDc_state);
383         NTSTATUS status;
384
385         if (tevent_req_is_nterror(req, &status)) {
386                 tevent_req_received(req);
387                 return status;
388         }
389
390         /* Steal possbile out parameters to the callers context */
391         talloc_steal(mem_ctx, state->out_mem_ctx);
392
393         /* Return result */
394         *result = state->orig.out.result;
395
396         tevent_req_received(req);
397         return NT_STATUS_OK;
398 }
399
400 NTSTATUS rpccli_dssetup_DsRoleDcAsDc(struct rpc_pipe_client *cli,
401                                      TALLOC_CTX *mem_ctx,
402                                      WERROR *werror)
403 {
404         struct dssetup_DsRoleDcAsDc r;
405         NTSTATUS status;
406
407         /* In parameters */
408
409         status = cli->dispatch(cli,
410                                 mem_ctx,
411                                 &ndr_table_dssetup,
412                                 NDR_DSSETUP_DSROLEDCASDC,
413                                 &r);
414
415         if (!NT_STATUS_IS_OK(status)) {
416                 return status;
417         }
418
419         if (NT_STATUS_IS_ERR(status)) {
420                 return status;
421         }
422
423         /* Return variables */
424
425         /* Return result */
426         if (werror) {
427                 *werror = r.out.result;
428         }
429
430         return werror_to_ntstatus(r.out.result);
431 }
432
433 struct rpccli_dssetup_DsRoleDcAsReplica_state {
434         struct dssetup_DsRoleDcAsReplica orig;
435         struct dssetup_DsRoleDcAsReplica tmp;
436         TALLOC_CTX *out_mem_ctx;
437         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
438 };
439
440 static void rpccli_dssetup_DsRoleDcAsReplica_done(struct tevent_req *subreq);
441
442 struct tevent_req *rpccli_dssetup_DsRoleDcAsReplica_send(TALLOC_CTX *mem_ctx,
443                                                          struct tevent_context *ev,
444                                                          struct rpc_pipe_client *cli)
445 {
446         struct tevent_req *req;
447         struct rpccli_dssetup_DsRoleDcAsReplica_state *state;
448         struct tevent_req *subreq;
449
450         req = tevent_req_create(mem_ctx, &state,
451                                 struct rpccli_dssetup_DsRoleDcAsReplica_state);
452         if (req == NULL) {
453                 return NULL;
454         }
455         state->out_mem_ctx = NULL;
456         state->dispatch_recv = cli->dispatch_recv;
457
458         /* In parameters */
459
460         /* Out parameters */
461
462         /* Result */
463         ZERO_STRUCT(state->orig.out.result);
464
465         /* make a temporary copy, that we pass to the dispatch function */
466         state->tmp = state->orig;
467
468         subreq = cli->dispatch_send(state, ev, cli,
469                                     &ndr_table_dssetup,
470                                     NDR_DSSETUP_DSROLEDCASREPLICA,
471                                     &state->tmp);
472         if (tevent_req_nomem(subreq, req)) {
473                 return tevent_req_post(req, ev);
474         }
475         tevent_req_set_callback(subreq, rpccli_dssetup_DsRoleDcAsReplica_done, req);
476         return req;
477 }
478
479 static void rpccli_dssetup_DsRoleDcAsReplica_done(struct tevent_req *subreq)
480 {
481         struct tevent_req *req = tevent_req_callback_data(
482                 subreq, struct tevent_req);
483         struct rpccli_dssetup_DsRoleDcAsReplica_state *state = tevent_req_data(
484                 req, struct rpccli_dssetup_DsRoleDcAsReplica_state);
485         NTSTATUS status;
486         TALLOC_CTX *mem_ctx;
487
488         if (state->out_mem_ctx) {
489                 mem_ctx = state->out_mem_ctx;
490         } else {
491                 mem_ctx = state;
492         }
493
494         status = state->dispatch_recv(subreq, mem_ctx);
495         TALLOC_FREE(subreq);
496         if (!NT_STATUS_IS_OK(status)) {
497                 tevent_req_nterror(req, status);
498                 return;
499         }
500
501         /* Copy out parameters */
502
503         /* Copy result */
504         state->orig.out.result = state->tmp.out.result;
505
506         /* Reset temporary structure */
507         ZERO_STRUCT(state->tmp);
508
509         tevent_req_done(req);
510 }
511
512 NTSTATUS rpccli_dssetup_DsRoleDcAsReplica_recv(struct tevent_req *req,
513                                                TALLOC_CTX *mem_ctx,
514                                                WERROR *result)
515 {
516         struct rpccli_dssetup_DsRoleDcAsReplica_state *state = tevent_req_data(
517                 req, struct rpccli_dssetup_DsRoleDcAsReplica_state);
518         NTSTATUS status;
519
520         if (tevent_req_is_nterror(req, &status)) {
521                 tevent_req_received(req);
522                 return status;
523         }
524
525         /* Steal possbile out parameters to the callers context */
526         talloc_steal(mem_ctx, state->out_mem_ctx);
527
528         /* Return result */
529         *result = state->orig.out.result;
530
531         tevent_req_received(req);
532         return NT_STATUS_OK;
533 }
534
535 NTSTATUS rpccli_dssetup_DsRoleDcAsReplica(struct rpc_pipe_client *cli,
536                                           TALLOC_CTX *mem_ctx,
537                                           WERROR *werror)
538 {
539         struct dssetup_DsRoleDcAsReplica r;
540         NTSTATUS status;
541
542         /* In parameters */
543
544         status = cli->dispatch(cli,
545                                 mem_ctx,
546                                 &ndr_table_dssetup,
547                                 NDR_DSSETUP_DSROLEDCASREPLICA,
548                                 &r);
549
550         if (!NT_STATUS_IS_OK(status)) {
551                 return status;
552         }
553
554         if (NT_STATUS_IS_ERR(status)) {
555                 return status;
556         }
557
558         /* Return variables */
559
560         /* Return result */
561         if (werror) {
562                 *werror = r.out.result;
563         }
564
565         return werror_to_ntstatus(r.out.result);
566 }
567
568 struct rpccli_dssetup_DsRoleDemoteDc_state {
569         struct dssetup_DsRoleDemoteDc orig;
570         struct dssetup_DsRoleDemoteDc tmp;
571         TALLOC_CTX *out_mem_ctx;
572         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
573 };
574
575 static void rpccli_dssetup_DsRoleDemoteDc_done(struct tevent_req *subreq);
576
577 struct tevent_req *rpccli_dssetup_DsRoleDemoteDc_send(TALLOC_CTX *mem_ctx,
578                                                       struct tevent_context *ev,
579                                                       struct rpc_pipe_client *cli)
580 {
581         struct tevent_req *req;
582         struct rpccli_dssetup_DsRoleDemoteDc_state *state;
583         struct tevent_req *subreq;
584
585         req = tevent_req_create(mem_ctx, &state,
586                                 struct rpccli_dssetup_DsRoleDemoteDc_state);
587         if (req == NULL) {
588                 return NULL;
589         }
590         state->out_mem_ctx = NULL;
591         state->dispatch_recv = cli->dispatch_recv;
592
593         /* In parameters */
594
595         /* Out parameters */
596
597         /* Result */
598         ZERO_STRUCT(state->orig.out.result);
599
600         /* make a temporary copy, that we pass to the dispatch function */
601         state->tmp = state->orig;
602
603         subreq = cli->dispatch_send(state, ev, cli,
604                                     &ndr_table_dssetup,
605                                     NDR_DSSETUP_DSROLEDEMOTEDC,
606                                     &state->tmp);
607         if (tevent_req_nomem(subreq, req)) {
608                 return tevent_req_post(req, ev);
609         }
610         tevent_req_set_callback(subreq, rpccli_dssetup_DsRoleDemoteDc_done, req);
611         return req;
612 }
613
614 static void rpccli_dssetup_DsRoleDemoteDc_done(struct tevent_req *subreq)
615 {
616         struct tevent_req *req = tevent_req_callback_data(
617                 subreq, struct tevent_req);
618         struct rpccli_dssetup_DsRoleDemoteDc_state *state = tevent_req_data(
619                 req, struct rpccli_dssetup_DsRoleDemoteDc_state);
620         NTSTATUS status;
621         TALLOC_CTX *mem_ctx;
622
623         if (state->out_mem_ctx) {
624                 mem_ctx = state->out_mem_ctx;
625         } else {
626                 mem_ctx = state;
627         }
628
629         status = state->dispatch_recv(subreq, mem_ctx);
630         TALLOC_FREE(subreq);
631         if (!NT_STATUS_IS_OK(status)) {
632                 tevent_req_nterror(req, status);
633                 return;
634         }
635
636         /* Copy out parameters */
637
638         /* Copy result */
639         state->orig.out.result = state->tmp.out.result;
640
641         /* Reset temporary structure */
642         ZERO_STRUCT(state->tmp);
643
644         tevent_req_done(req);
645 }
646
647 NTSTATUS rpccli_dssetup_DsRoleDemoteDc_recv(struct tevent_req *req,
648                                             TALLOC_CTX *mem_ctx,
649                                             WERROR *result)
650 {
651         struct rpccli_dssetup_DsRoleDemoteDc_state *state = tevent_req_data(
652                 req, struct rpccli_dssetup_DsRoleDemoteDc_state);
653         NTSTATUS status;
654
655         if (tevent_req_is_nterror(req, &status)) {
656                 tevent_req_received(req);
657                 return status;
658         }
659
660         /* Steal possbile out parameters to the callers context */
661         talloc_steal(mem_ctx, state->out_mem_ctx);
662
663         /* Return result */
664         *result = state->orig.out.result;
665
666         tevent_req_received(req);
667         return NT_STATUS_OK;
668 }
669
670 NTSTATUS rpccli_dssetup_DsRoleDemoteDc(struct rpc_pipe_client *cli,
671                                        TALLOC_CTX *mem_ctx,
672                                        WERROR *werror)
673 {
674         struct dssetup_DsRoleDemoteDc r;
675         NTSTATUS status;
676
677         /* In parameters */
678
679         status = cli->dispatch(cli,
680                                 mem_ctx,
681                                 &ndr_table_dssetup,
682                                 NDR_DSSETUP_DSROLEDEMOTEDC,
683                                 &r);
684
685         if (!NT_STATUS_IS_OK(status)) {
686                 return status;
687         }
688
689         if (NT_STATUS_IS_ERR(status)) {
690                 return status;
691         }
692
693         /* Return variables */
694
695         /* Return result */
696         if (werror) {
697                 *werror = r.out.result;
698         }
699
700         return werror_to_ntstatus(r.out.result);
701 }
702
703 struct rpccli_dssetup_DsRoleGetDcOperationProgress_state {
704         struct dssetup_DsRoleGetDcOperationProgress orig;
705         struct dssetup_DsRoleGetDcOperationProgress tmp;
706         TALLOC_CTX *out_mem_ctx;
707         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
708 };
709
710 static void rpccli_dssetup_DsRoleGetDcOperationProgress_done(struct tevent_req *subreq);
711
712 struct tevent_req *rpccli_dssetup_DsRoleGetDcOperationProgress_send(TALLOC_CTX *mem_ctx,
713                                                                     struct tevent_context *ev,
714                                                                     struct rpc_pipe_client *cli)
715 {
716         struct tevent_req *req;
717         struct rpccli_dssetup_DsRoleGetDcOperationProgress_state *state;
718         struct tevent_req *subreq;
719
720         req = tevent_req_create(mem_ctx, &state,
721                                 struct rpccli_dssetup_DsRoleGetDcOperationProgress_state);
722         if (req == NULL) {
723                 return NULL;
724         }
725         state->out_mem_ctx = NULL;
726         state->dispatch_recv = cli->dispatch_recv;
727
728         /* In parameters */
729
730         /* Out parameters */
731
732         /* Result */
733         ZERO_STRUCT(state->orig.out.result);
734
735         /* make a temporary copy, that we pass to the dispatch function */
736         state->tmp = state->orig;
737
738         subreq = cli->dispatch_send(state, ev, cli,
739                                     &ndr_table_dssetup,
740                                     NDR_DSSETUP_DSROLEGETDCOPERATIONPROGRESS,
741                                     &state->tmp);
742         if (tevent_req_nomem(subreq, req)) {
743                 return tevent_req_post(req, ev);
744         }
745         tevent_req_set_callback(subreq, rpccli_dssetup_DsRoleGetDcOperationProgress_done, req);
746         return req;
747 }
748
749 static void rpccli_dssetup_DsRoleGetDcOperationProgress_done(struct tevent_req *subreq)
750 {
751         struct tevent_req *req = tevent_req_callback_data(
752                 subreq, struct tevent_req);
753         struct rpccli_dssetup_DsRoleGetDcOperationProgress_state *state = tevent_req_data(
754                 req, struct rpccli_dssetup_DsRoleGetDcOperationProgress_state);
755         NTSTATUS status;
756         TALLOC_CTX *mem_ctx;
757
758         if (state->out_mem_ctx) {
759                 mem_ctx = state->out_mem_ctx;
760         } else {
761                 mem_ctx = state;
762         }
763
764         status = state->dispatch_recv(subreq, mem_ctx);
765         TALLOC_FREE(subreq);
766         if (!NT_STATUS_IS_OK(status)) {
767                 tevent_req_nterror(req, status);
768                 return;
769         }
770
771         /* Copy out parameters */
772
773         /* Copy result */
774         state->orig.out.result = state->tmp.out.result;
775
776         /* Reset temporary structure */
777         ZERO_STRUCT(state->tmp);
778
779         tevent_req_done(req);
780 }
781
782 NTSTATUS rpccli_dssetup_DsRoleGetDcOperationProgress_recv(struct tevent_req *req,
783                                                           TALLOC_CTX *mem_ctx,
784                                                           WERROR *result)
785 {
786         struct rpccli_dssetup_DsRoleGetDcOperationProgress_state *state = tevent_req_data(
787                 req, struct rpccli_dssetup_DsRoleGetDcOperationProgress_state);
788         NTSTATUS status;
789
790         if (tevent_req_is_nterror(req, &status)) {
791                 tevent_req_received(req);
792                 return status;
793         }
794
795         /* Steal possbile out parameters to the callers context */
796         talloc_steal(mem_ctx, state->out_mem_ctx);
797
798         /* Return result */
799         *result = state->orig.out.result;
800
801         tevent_req_received(req);
802         return NT_STATUS_OK;
803 }
804
805 NTSTATUS rpccli_dssetup_DsRoleGetDcOperationProgress(struct rpc_pipe_client *cli,
806                                                      TALLOC_CTX *mem_ctx,
807                                                      WERROR *werror)
808 {
809         struct dssetup_DsRoleGetDcOperationProgress r;
810         NTSTATUS status;
811
812         /* In parameters */
813
814         status = cli->dispatch(cli,
815                                 mem_ctx,
816                                 &ndr_table_dssetup,
817                                 NDR_DSSETUP_DSROLEGETDCOPERATIONPROGRESS,
818                                 &r);
819
820         if (!NT_STATUS_IS_OK(status)) {
821                 return status;
822         }
823
824         if (NT_STATUS_IS_ERR(status)) {
825                 return status;
826         }
827
828         /* Return variables */
829
830         /* Return result */
831         if (werror) {
832                 *werror = r.out.result;
833         }
834
835         return werror_to_ntstatus(r.out.result);
836 }
837
838 struct rpccli_dssetup_DsRoleGetDcOperationResults_state {
839         struct dssetup_DsRoleGetDcOperationResults orig;
840         struct dssetup_DsRoleGetDcOperationResults tmp;
841         TALLOC_CTX *out_mem_ctx;
842         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
843 };
844
845 static void rpccli_dssetup_DsRoleGetDcOperationResults_done(struct tevent_req *subreq);
846
847 struct tevent_req *rpccli_dssetup_DsRoleGetDcOperationResults_send(TALLOC_CTX *mem_ctx,
848                                                                    struct tevent_context *ev,
849                                                                    struct rpc_pipe_client *cli)
850 {
851         struct tevent_req *req;
852         struct rpccli_dssetup_DsRoleGetDcOperationResults_state *state;
853         struct tevent_req *subreq;
854
855         req = tevent_req_create(mem_ctx, &state,
856                                 struct rpccli_dssetup_DsRoleGetDcOperationResults_state);
857         if (req == NULL) {
858                 return NULL;
859         }
860         state->out_mem_ctx = NULL;
861         state->dispatch_recv = cli->dispatch_recv;
862
863         /* In parameters */
864
865         /* Out parameters */
866
867         /* Result */
868         ZERO_STRUCT(state->orig.out.result);
869
870         /* make a temporary copy, that we pass to the dispatch function */
871         state->tmp = state->orig;
872
873         subreq = cli->dispatch_send(state, ev, cli,
874                                     &ndr_table_dssetup,
875                                     NDR_DSSETUP_DSROLEGETDCOPERATIONRESULTS,
876                                     &state->tmp);
877         if (tevent_req_nomem(subreq, req)) {
878                 return tevent_req_post(req, ev);
879         }
880         tevent_req_set_callback(subreq, rpccli_dssetup_DsRoleGetDcOperationResults_done, req);
881         return req;
882 }
883
884 static void rpccli_dssetup_DsRoleGetDcOperationResults_done(struct tevent_req *subreq)
885 {
886         struct tevent_req *req = tevent_req_callback_data(
887                 subreq, struct tevent_req);
888         struct rpccli_dssetup_DsRoleGetDcOperationResults_state *state = tevent_req_data(
889                 req, struct rpccli_dssetup_DsRoleGetDcOperationResults_state);
890         NTSTATUS status;
891         TALLOC_CTX *mem_ctx;
892
893         if (state->out_mem_ctx) {
894                 mem_ctx = state->out_mem_ctx;
895         } else {
896                 mem_ctx = state;
897         }
898
899         status = state->dispatch_recv(subreq, mem_ctx);
900         TALLOC_FREE(subreq);
901         if (!NT_STATUS_IS_OK(status)) {
902                 tevent_req_nterror(req, status);
903                 return;
904         }
905
906         /* Copy out parameters */
907
908         /* Copy result */
909         state->orig.out.result = state->tmp.out.result;
910
911         /* Reset temporary structure */
912         ZERO_STRUCT(state->tmp);
913
914         tevent_req_done(req);
915 }
916
917 NTSTATUS rpccli_dssetup_DsRoleGetDcOperationResults_recv(struct tevent_req *req,
918                                                          TALLOC_CTX *mem_ctx,
919                                                          WERROR *result)
920 {
921         struct rpccli_dssetup_DsRoleGetDcOperationResults_state *state = tevent_req_data(
922                 req, struct rpccli_dssetup_DsRoleGetDcOperationResults_state);
923         NTSTATUS status;
924
925         if (tevent_req_is_nterror(req, &status)) {
926                 tevent_req_received(req);
927                 return status;
928         }
929
930         /* Steal possbile out parameters to the callers context */
931         talloc_steal(mem_ctx, state->out_mem_ctx);
932
933         /* Return result */
934         *result = state->orig.out.result;
935
936         tevent_req_received(req);
937         return NT_STATUS_OK;
938 }
939
940 NTSTATUS rpccli_dssetup_DsRoleGetDcOperationResults(struct rpc_pipe_client *cli,
941                                                     TALLOC_CTX *mem_ctx,
942                                                     WERROR *werror)
943 {
944         struct dssetup_DsRoleGetDcOperationResults r;
945         NTSTATUS status;
946
947         /* In parameters */
948
949         status = cli->dispatch(cli,
950                                 mem_ctx,
951                                 &ndr_table_dssetup,
952                                 NDR_DSSETUP_DSROLEGETDCOPERATIONRESULTS,
953                                 &r);
954
955         if (!NT_STATUS_IS_OK(status)) {
956                 return status;
957         }
958
959         if (NT_STATUS_IS_ERR(status)) {
960                 return status;
961         }
962
963         /* Return variables */
964
965         /* Return result */
966         if (werror) {
967                 *werror = r.out.result;
968         }
969
970         return werror_to_ntstatus(r.out.result);
971 }
972
973 struct rpccli_dssetup_DsRoleCancel_state {
974         struct dssetup_DsRoleCancel orig;
975         struct dssetup_DsRoleCancel tmp;
976         TALLOC_CTX *out_mem_ctx;
977         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
978 };
979
980 static void rpccli_dssetup_DsRoleCancel_done(struct tevent_req *subreq);
981
982 struct tevent_req *rpccli_dssetup_DsRoleCancel_send(TALLOC_CTX *mem_ctx,
983                                                     struct tevent_context *ev,
984                                                     struct rpc_pipe_client *cli)
985 {
986         struct tevent_req *req;
987         struct rpccli_dssetup_DsRoleCancel_state *state;
988         struct tevent_req *subreq;
989
990         req = tevent_req_create(mem_ctx, &state,
991                                 struct rpccli_dssetup_DsRoleCancel_state);
992         if (req == NULL) {
993                 return NULL;
994         }
995         state->out_mem_ctx = NULL;
996         state->dispatch_recv = cli->dispatch_recv;
997
998         /* In parameters */
999
1000         /* Out parameters */
1001
1002         /* Result */
1003         ZERO_STRUCT(state->orig.out.result);
1004
1005         /* make a temporary copy, that we pass to the dispatch function */
1006         state->tmp = state->orig;
1007
1008         subreq = cli->dispatch_send(state, ev, cli,
1009                                     &ndr_table_dssetup,
1010                                     NDR_DSSETUP_DSROLECANCEL,
1011                                     &state->tmp);
1012         if (tevent_req_nomem(subreq, req)) {
1013                 return tevent_req_post(req, ev);
1014         }
1015         tevent_req_set_callback(subreq, rpccli_dssetup_DsRoleCancel_done, req);
1016         return req;
1017 }
1018
1019 static void rpccli_dssetup_DsRoleCancel_done(struct tevent_req *subreq)
1020 {
1021         struct tevent_req *req = tevent_req_callback_data(
1022                 subreq, struct tevent_req);
1023         struct rpccli_dssetup_DsRoleCancel_state *state = tevent_req_data(
1024                 req, struct rpccli_dssetup_DsRoleCancel_state);
1025         NTSTATUS status;
1026         TALLOC_CTX *mem_ctx;
1027
1028         if (state->out_mem_ctx) {
1029                 mem_ctx = state->out_mem_ctx;
1030         } else {
1031                 mem_ctx = state;
1032         }
1033
1034         status = state->dispatch_recv(subreq, mem_ctx);
1035         TALLOC_FREE(subreq);
1036         if (!NT_STATUS_IS_OK(status)) {
1037                 tevent_req_nterror(req, status);
1038                 return;
1039         }
1040
1041         /* Copy out parameters */
1042
1043         /* Copy result */
1044         state->orig.out.result = state->tmp.out.result;
1045
1046         /* Reset temporary structure */
1047         ZERO_STRUCT(state->tmp);
1048
1049         tevent_req_done(req);
1050 }
1051
1052 NTSTATUS rpccli_dssetup_DsRoleCancel_recv(struct tevent_req *req,
1053                                           TALLOC_CTX *mem_ctx,
1054                                           WERROR *result)
1055 {
1056         struct rpccli_dssetup_DsRoleCancel_state *state = tevent_req_data(
1057                 req, struct rpccli_dssetup_DsRoleCancel_state);
1058         NTSTATUS status;
1059
1060         if (tevent_req_is_nterror(req, &status)) {
1061                 tevent_req_received(req);
1062                 return status;
1063         }
1064
1065         /* Steal possbile out parameters to the callers context */
1066         talloc_steal(mem_ctx, state->out_mem_ctx);
1067
1068         /* Return result */
1069         *result = state->orig.out.result;
1070
1071         tevent_req_received(req);
1072         return NT_STATUS_OK;
1073 }
1074
1075 NTSTATUS rpccli_dssetup_DsRoleCancel(struct rpc_pipe_client *cli,
1076                                      TALLOC_CTX *mem_ctx,
1077                                      WERROR *werror)
1078 {
1079         struct dssetup_DsRoleCancel r;
1080         NTSTATUS status;
1081
1082         /* In parameters */
1083
1084         status = cli->dispatch(cli,
1085                                 mem_ctx,
1086                                 &ndr_table_dssetup,
1087                                 NDR_DSSETUP_DSROLECANCEL,
1088                                 &r);
1089
1090         if (!NT_STATUS_IS_OK(status)) {
1091                 return status;
1092         }
1093
1094         if (NT_STATUS_IS_ERR(status)) {
1095                 return status;
1096         }
1097
1098         /* Return variables */
1099
1100         /* Return result */
1101         if (werror) {
1102                 *werror = r.out.result;
1103         }
1104
1105         return werror_to_ntstatus(r.out.result);
1106 }
1107
1108 struct rpccli_dssetup_DsRoleServerSaveStateForUpgrade_state {
1109         struct dssetup_DsRoleServerSaveStateForUpgrade orig;
1110         struct dssetup_DsRoleServerSaveStateForUpgrade tmp;
1111         TALLOC_CTX *out_mem_ctx;
1112         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
1113 };
1114
1115 static void rpccli_dssetup_DsRoleServerSaveStateForUpgrade_done(struct tevent_req *subreq);
1116
1117 struct tevent_req *rpccli_dssetup_DsRoleServerSaveStateForUpgrade_send(TALLOC_CTX *mem_ctx,
1118                                                                        struct tevent_context *ev,
1119                                                                        struct rpc_pipe_client *cli)
1120 {
1121         struct tevent_req *req;
1122         struct rpccli_dssetup_DsRoleServerSaveStateForUpgrade_state *state;
1123         struct tevent_req *subreq;
1124
1125         req = tevent_req_create(mem_ctx, &state,
1126                                 struct rpccli_dssetup_DsRoleServerSaveStateForUpgrade_state);
1127         if (req == NULL) {
1128                 return NULL;
1129         }
1130         state->out_mem_ctx = NULL;
1131         state->dispatch_recv = cli->dispatch_recv;
1132
1133         /* In parameters */
1134
1135         /* Out parameters */
1136
1137         /* Result */
1138         ZERO_STRUCT(state->orig.out.result);
1139
1140         /* make a temporary copy, that we pass to the dispatch function */
1141         state->tmp = state->orig;
1142
1143         subreq = cli->dispatch_send(state, ev, cli,
1144                                     &ndr_table_dssetup,
1145                                     NDR_DSSETUP_DSROLESERVERSAVESTATEFORUPGRADE,
1146                                     &state->tmp);
1147         if (tevent_req_nomem(subreq, req)) {
1148                 return tevent_req_post(req, ev);
1149         }
1150         tevent_req_set_callback(subreq, rpccli_dssetup_DsRoleServerSaveStateForUpgrade_done, req);
1151         return req;
1152 }
1153
1154 static void rpccli_dssetup_DsRoleServerSaveStateForUpgrade_done(struct tevent_req *subreq)
1155 {
1156         struct tevent_req *req = tevent_req_callback_data(
1157                 subreq, struct tevent_req);
1158         struct rpccli_dssetup_DsRoleServerSaveStateForUpgrade_state *state = tevent_req_data(
1159                 req, struct rpccli_dssetup_DsRoleServerSaveStateForUpgrade_state);
1160         NTSTATUS status;
1161         TALLOC_CTX *mem_ctx;
1162
1163         if (state->out_mem_ctx) {
1164                 mem_ctx = state->out_mem_ctx;
1165         } else {
1166                 mem_ctx = state;
1167         }
1168
1169         status = state->dispatch_recv(subreq, mem_ctx);
1170         TALLOC_FREE(subreq);
1171         if (!NT_STATUS_IS_OK(status)) {
1172                 tevent_req_nterror(req, status);
1173                 return;
1174         }
1175
1176         /* Copy out parameters */
1177
1178         /* Copy result */
1179         state->orig.out.result = state->tmp.out.result;
1180
1181         /* Reset temporary structure */
1182         ZERO_STRUCT(state->tmp);
1183
1184         tevent_req_done(req);
1185 }
1186
1187 NTSTATUS rpccli_dssetup_DsRoleServerSaveStateForUpgrade_recv(struct tevent_req *req,
1188                                                              TALLOC_CTX *mem_ctx,
1189                                                              WERROR *result)
1190 {
1191         struct rpccli_dssetup_DsRoleServerSaveStateForUpgrade_state *state = tevent_req_data(
1192                 req, struct rpccli_dssetup_DsRoleServerSaveStateForUpgrade_state);
1193         NTSTATUS status;
1194
1195         if (tevent_req_is_nterror(req, &status)) {
1196                 tevent_req_received(req);
1197                 return status;
1198         }
1199
1200         /* Steal possbile out parameters to the callers context */
1201         talloc_steal(mem_ctx, state->out_mem_ctx);
1202
1203         /* Return result */
1204         *result = state->orig.out.result;
1205
1206         tevent_req_received(req);
1207         return NT_STATUS_OK;
1208 }
1209
1210 NTSTATUS rpccli_dssetup_DsRoleServerSaveStateForUpgrade(struct rpc_pipe_client *cli,
1211                                                         TALLOC_CTX *mem_ctx,
1212                                                         WERROR *werror)
1213 {
1214         struct dssetup_DsRoleServerSaveStateForUpgrade r;
1215         NTSTATUS status;
1216
1217         /* In parameters */
1218
1219         status = cli->dispatch(cli,
1220                                 mem_ctx,
1221                                 &ndr_table_dssetup,
1222                                 NDR_DSSETUP_DSROLESERVERSAVESTATEFORUPGRADE,
1223                                 &r);
1224
1225         if (!NT_STATUS_IS_OK(status)) {
1226                 return status;
1227         }
1228
1229         if (NT_STATUS_IS_ERR(status)) {
1230                 return status;
1231         }
1232
1233         /* Return variables */
1234
1235         /* Return result */
1236         if (werror) {
1237                 *werror = r.out.result;
1238         }
1239
1240         return werror_to_ntstatus(r.out.result);
1241 }
1242
1243 struct rpccli_dssetup_DsRoleUpgradeDownlevelServer_state {
1244         struct dssetup_DsRoleUpgradeDownlevelServer orig;
1245         struct dssetup_DsRoleUpgradeDownlevelServer tmp;
1246         TALLOC_CTX *out_mem_ctx;
1247         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
1248 };
1249
1250 static void rpccli_dssetup_DsRoleUpgradeDownlevelServer_done(struct tevent_req *subreq);
1251
1252 struct tevent_req *rpccli_dssetup_DsRoleUpgradeDownlevelServer_send(TALLOC_CTX *mem_ctx,
1253                                                                     struct tevent_context *ev,
1254                                                                     struct rpc_pipe_client *cli)
1255 {
1256         struct tevent_req *req;
1257         struct rpccli_dssetup_DsRoleUpgradeDownlevelServer_state *state;
1258         struct tevent_req *subreq;
1259
1260         req = tevent_req_create(mem_ctx, &state,
1261                                 struct rpccli_dssetup_DsRoleUpgradeDownlevelServer_state);
1262         if (req == NULL) {
1263                 return NULL;
1264         }
1265         state->out_mem_ctx = NULL;
1266         state->dispatch_recv = cli->dispatch_recv;
1267
1268         /* In parameters */
1269
1270         /* Out parameters */
1271
1272         /* Result */
1273         ZERO_STRUCT(state->orig.out.result);
1274
1275         /* make a temporary copy, that we pass to the dispatch function */
1276         state->tmp = state->orig;
1277
1278         subreq = cli->dispatch_send(state, ev, cli,
1279                                     &ndr_table_dssetup,
1280                                     NDR_DSSETUP_DSROLEUPGRADEDOWNLEVELSERVER,
1281                                     &state->tmp);
1282         if (tevent_req_nomem(subreq, req)) {
1283                 return tevent_req_post(req, ev);
1284         }
1285         tevent_req_set_callback(subreq, rpccli_dssetup_DsRoleUpgradeDownlevelServer_done, req);
1286         return req;
1287 }
1288
1289 static void rpccli_dssetup_DsRoleUpgradeDownlevelServer_done(struct tevent_req *subreq)
1290 {
1291         struct tevent_req *req = tevent_req_callback_data(
1292                 subreq, struct tevent_req);
1293         struct rpccli_dssetup_DsRoleUpgradeDownlevelServer_state *state = tevent_req_data(
1294                 req, struct rpccli_dssetup_DsRoleUpgradeDownlevelServer_state);
1295         NTSTATUS status;
1296         TALLOC_CTX *mem_ctx;
1297
1298         if (state->out_mem_ctx) {
1299                 mem_ctx = state->out_mem_ctx;
1300         } else {
1301                 mem_ctx = state;
1302         }
1303
1304         status = state->dispatch_recv(subreq, mem_ctx);
1305         TALLOC_FREE(subreq);
1306         if (!NT_STATUS_IS_OK(status)) {
1307                 tevent_req_nterror(req, status);
1308                 return;
1309         }
1310
1311         /* Copy out parameters */
1312
1313         /* Copy result */
1314         state->orig.out.result = state->tmp.out.result;
1315
1316         /* Reset temporary structure */
1317         ZERO_STRUCT(state->tmp);
1318
1319         tevent_req_done(req);
1320 }
1321
1322 NTSTATUS rpccli_dssetup_DsRoleUpgradeDownlevelServer_recv(struct tevent_req *req,
1323                                                           TALLOC_CTX *mem_ctx,
1324                                                           WERROR *result)
1325 {
1326         struct rpccli_dssetup_DsRoleUpgradeDownlevelServer_state *state = tevent_req_data(
1327                 req, struct rpccli_dssetup_DsRoleUpgradeDownlevelServer_state);
1328         NTSTATUS status;
1329
1330         if (tevent_req_is_nterror(req, &status)) {
1331                 tevent_req_received(req);
1332                 return status;
1333         }
1334
1335         /* Steal possbile out parameters to the callers context */
1336         talloc_steal(mem_ctx, state->out_mem_ctx);
1337
1338         /* Return result */
1339         *result = state->orig.out.result;
1340
1341         tevent_req_received(req);
1342         return NT_STATUS_OK;
1343 }
1344
1345 NTSTATUS rpccli_dssetup_DsRoleUpgradeDownlevelServer(struct rpc_pipe_client *cli,
1346                                                      TALLOC_CTX *mem_ctx,
1347                                                      WERROR *werror)
1348 {
1349         struct dssetup_DsRoleUpgradeDownlevelServer r;
1350         NTSTATUS status;
1351
1352         /* In parameters */
1353
1354         status = cli->dispatch(cli,
1355                                 mem_ctx,
1356                                 &ndr_table_dssetup,
1357                                 NDR_DSSETUP_DSROLEUPGRADEDOWNLEVELSERVER,
1358                                 &r);
1359
1360         if (!NT_STATUS_IS_OK(status)) {
1361                 return status;
1362         }
1363
1364         if (NT_STATUS_IS_ERR(status)) {
1365                 return status;
1366         }
1367
1368         /* Return variables */
1369
1370         /* Return result */
1371         if (werror) {
1372                 *werror = r.out.result;
1373         }
1374
1375         return werror_to_ntstatus(r.out.result);
1376 }
1377
1378 struct rpccli_dssetup_DsRoleAbortDownlevelServerUpgrade_state {
1379         struct dssetup_DsRoleAbortDownlevelServerUpgrade orig;
1380         struct dssetup_DsRoleAbortDownlevelServerUpgrade tmp;
1381         TALLOC_CTX *out_mem_ctx;
1382         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
1383 };
1384
1385 static void rpccli_dssetup_DsRoleAbortDownlevelServerUpgrade_done(struct tevent_req *subreq);
1386
1387 struct tevent_req *rpccli_dssetup_DsRoleAbortDownlevelServerUpgrade_send(TALLOC_CTX *mem_ctx,
1388                                                                          struct tevent_context *ev,
1389                                                                          struct rpc_pipe_client *cli)
1390 {
1391         struct tevent_req *req;
1392         struct rpccli_dssetup_DsRoleAbortDownlevelServerUpgrade_state *state;
1393         struct tevent_req *subreq;
1394
1395         req = tevent_req_create(mem_ctx, &state,
1396                                 struct rpccli_dssetup_DsRoleAbortDownlevelServerUpgrade_state);
1397         if (req == NULL) {
1398                 return NULL;
1399         }
1400         state->out_mem_ctx = NULL;
1401         state->dispatch_recv = cli->dispatch_recv;
1402
1403         /* In parameters */
1404
1405         /* Out parameters */
1406
1407         /* Result */
1408         ZERO_STRUCT(state->orig.out.result);
1409
1410         /* make a temporary copy, that we pass to the dispatch function */
1411         state->tmp = state->orig;
1412
1413         subreq = cli->dispatch_send(state, ev, cli,
1414                                     &ndr_table_dssetup,
1415                                     NDR_DSSETUP_DSROLEABORTDOWNLEVELSERVERUPGRADE,
1416                                     &state->tmp);
1417         if (tevent_req_nomem(subreq, req)) {
1418                 return tevent_req_post(req, ev);
1419         }
1420         tevent_req_set_callback(subreq, rpccli_dssetup_DsRoleAbortDownlevelServerUpgrade_done, req);
1421         return req;
1422 }
1423
1424 static void rpccli_dssetup_DsRoleAbortDownlevelServerUpgrade_done(struct tevent_req *subreq)
1425 {
1426         struct tevent_req *req = tevent_req_callback_data(
1427                 subreq, struct tevent_req);
1428         struct rpccli_dssetup_DsRoleAbortDownlevelServerUpgrade_state *state = tevent_req_data(
1429                 req, struct rpccli_dssetup_DsRoleAbortDownlevelServerUpgrade_state);
1430         NTSTATUS status;
1431         TALLOC_CTX *mem_ctx;
1432
1433         if (state->out_mem_ctx) {
1434                 mem_ctx = state->out_mem_ctx;
1435         } else {
1436                 mem_ctx = state;
1437         }
1438
1439         status = state->dispatch_recv(subreq, mem_ctx);
1440         TALLOC_FREE(subreq);
1441         if (!NT_STATUS_IS_OK(status)) {
1442                 tevent_req_nterror(req, status);
1443                 return;
1444         }
1445
1446         /* Copy out parameters */
1447
1448         /* Copy result */
1449         state->orig.out.result = state->tmp.out.result;
1450
1451         /* Reset temporary structure */
1452         ZERO_STRUCT(state->tmp);
1453
1454         tevent_req_done(req);
1455 }
1456
1457 NTSTATUS rpccli_dssetup_DsRoleAbortDownlevelServerUpgrade_recv(struct tevent_req *req,
1458                                                                TALLOC_CTX *mem_ctx,
1459                                                                WERROR *result)
1460 {
1461         struct rpccli_dssetup_DsRoleAbortDownlevelServerUpgrade_state *state = tevent_req_data(
1462                 req, struct rpccli_dssetup_DsRoleAbortDownlevelServerUpgrade_state);
1463         NTSTATUS status;
1464
1465         if (tevent_req_is_nterror(req, &status)) {
1466                 tevent_req_received(req);
1467                 return status;
1468         }
1469
1470         /* Steal possbile out parameters to the callers context */
1471         talloc_steal(mem_ctx, state->out_mem_ctx);
1472
1473         /* Return result */
1474         *result = state->orig.out.result;
1475
1476         tevent_req_received(req);
1477         return NT_STATUS_OK;
1478 }
1479
1480 NTSTATUS rpccli_dssetup_DsRoleAbortDownlevelServerUpgrade(struct rpc_pipe_client *cli,
1481                                                           TALLOC_CTX *mem_ctx,
1482                                                           WERROR *werror)
1483 {
1484         struct dssetup_DsRoleAbortDownlevelServerUpgrade r;
1485         NTSTATUS status;
1486
1487         /* In parameters */
1488
1489         status = cli->dispatch(cli,
1490                                 mem_ctx,
1491                                 &ndr_table_dssetup,
1492                                 NDR_DSSETUP_DSROLEABORTDOWNLEVELSERVERUPGRADE,
1493                                 &r);
1494
1495         if (!NT_STATUS_IS_OK(status)) {
1496                 return status;
1497         }
1498
1499         if (NT_STATUS_IS_ERR(status)) {
1500                 return status;
1501         }
1502
1503         /* Return variables */
1504
1505         /* Return result */
1506         if (werror) {
1507                 *werror = r.out.result;
1508         }
1509
1510         return werror_to_ntstatus(r.out.result);
1511 }
1512