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