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