s3: Do not reference ndr_table_<pipe> in the cli_ routines directly
[Samba/fernandojvsilva.git] / librpc / gen_ndr / srv_echo.c
blob83005ff297f1aea700d56f414180af5e1074b0f4
1 /*
2 * Unix SMB/CIFS implementation.
3 * server auto-generated by pidl. DO NOT MODIFY!
4 */
6 #include "includes.h"
7 #include "../librpc/gen_ndr/srv_echo.h"
9 static bool api_echo_AddOne(pipes_struct *p)
11 const struct ndr_interface_call *call;
12 struct ndr_pull *pull;
13 struct ndr_push *push;
14 enum ndr_err_code ndr_err;
15 DATA_BLOB blob;
16 struct echo_AddOne *r;
18 call = &ndr_table_rpcecho.calls[NDR_ECHO_ADDONE];
20 r = talloc(talloc_tos(), struct echo_AddOne);
21 if (r == NULL) {
22 return false;
25 if (!prs_data_blob(&p->in_data.data, &blob, r)) {
26 talloc_free(r);
27 return false;
30 pull = ndr_pull_init_blob(&blob, r, NULL);
31 if (pull == NULL) {
32 talloc_free(r);
33 return false;
36 pull->flags |= LIBNDR_FLAG_REF_ALLOC;
37 ndr_err = call->ndr_pull(pull, NDR_IN, r);
38 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
39 talloc_free(r);
40 return false;
43 if (DEBUGLEVEL >= 10) {
44 NDR_PRINT_IN_DEBUG(echo_AddOne, r);
47 ZERO_STRUCT(r->out);
48 r->out.out_data = talloc_zero(r, uint32_t);
49 if (r->out.out_data == NULL) {
50 talloc_free(r);
51 return false;
54 _echo_AddOne(p, r);
56 if (p->rng_fault_state) {
57 talloc_free(r);
58 /* Return true here, srv_pipe_hnd.c will take care */
59 return true;
62 if (DEBUGLEVEL >= 10) {
63 NDR_PRINT_OUT_DEBUG(echo_AddOne, r);
66 push = ndr_push_init_ctx(r, NULL);
67 if (push == NULL) {
68 talloc_free(r);
69 return false;
72 ndr_err = call->ndr_push(push, NDR_OUT, r);
73 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
74 talloc_free(r);
75 return false;
78 blob = ndr_push_blob(push);
79 if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
80 talloc_free(r);
81 return false;
84 talloc_free(r);
86 return true;
89 static bool api_echo_EchoData(pipes_struct *p)
91 const struct ndr_interface_call *call;
92 struct ndr_pull *pull;
93 struct ndr_push *push;
94 enum ndr_err_code ndr_err;
95 DATA_BLOB blob;
96 struct echo_EchoData *r;
98 call = &ndr_table_rpcecho.calls[NDR_ECHO_ECHODATA];
100 r = talloc(talloc_tos(), struct echo_EchoData);
101 if (r == NULL) {
102 return false;
105 if (!prs_data_blob(&p->in_data.data, &blob, r)) {
106 talloc_free(r);
107 return false;
110 pull = ndr_pull_init_blob(&blob, r, NULL);
111 if (pull == NULL) {
112 talloc_free(r);
113 return false;
116 pull->flags |= LIBNDR_FLAG_REF_ALLOC;
117 ndr_err = call->ndr_pull(pull, NDR_IN, r);
118 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
119 talloc_free(r);
120 return false;
123 if (DEBUGLEVEL >= 10) {
124 NDR_PRINT_IN_DEBUG(echo_EchoData, r);
127 ZERO_STRUCT(r->out);
128 r->out.out_data = talloc_zero_array(r, uint8_t, r->in.len);
129 if (r->out.out_data == NULL) {
130 talloc_free(r);
131 return false;
134 _echo_EchoData(p, r);
136 if (p->rng_fault_state) {
137 talloc_free(r);
138 /* Return true here, srv_pipe_hnd.c will take care */
139 return true;
142 if (DEBUGLEVEL >= 10) {
143 NDR_PRINT_OUT_DEBUG(echo_EchoData, r);
146 push = ndr_push_init_ctx(r, NULL);
147 if (push == NULL) {
148 talloc_free(r);
149 return false;
152 ndr_err = call->ndr_push(push, NDR_OUT, r);
153 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
154 talloc_free(r);
155 return false;
158 blob = ndr_push_blob(push);
159 if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
160 talloc_free(r);
161 return false;
164 talloc_free(r);
166 return true;
169 static bool api_echo_SinkData(pipes_struct *p)
171 const struct ndr_interface_call *call;
172 struct ndr_pull *pull;
173 struct ndr_push *push;
174 enum ndr_err_code ndr_err;
175 DATA_BLOB blob;
176 struct echo_SinkData *r;
178 call = &ndr_table_rpcecho.calls[NDR_ECHO_SINKDATA];
180 r = talloc(talloc_tos(), struct echo_SinkData);
181 if (r == NULL) {
182 return false;
185 if (!prs_data_blob(&p->in_data.data, &blob, r)) {
186 talloc_free(r);
187 return false;
190 pull = ndr_pull_init_blob(&blob, r, NULL);
191 if (pull == NULL) {
192 talloc_free(r);
193 return false;
196 pull->flags |= LIBNDR_FLAG_REF_ALLOC;
197 ndr_err = call->ndr_pull(pull, NDR_IN, r);
198 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
199 talloc_free(r);
200 return false;
203 if (DEBUGLEVEL >= 10) {
204 NDR_PRINT_IN_DEBUG(echo_SinkData, r);
207 _echo_SinkData(p, r);
209 if (p->rng_fault_state) {
210 talloc_free(r);
211 /* Return true here, srv_pipe_hnd.c will take care */
212 return true;
215 if (DEBUGLEVEL >= 10) {
216 NDR_PRINT_OUT_DEBUG(echo_SinkData, r);
219 push = ndr_push_init_ctx(r, NULL);
220 if (push == NULL) {
221 talloc_free(r);
222 return false;
225 ndr_err = call->ndr_push(push, NDR_OUT, r);
226 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
227 talloc_free(r);
228 return false;
231 blob = ndr_push_blob(push);
232 if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
233 talloc_free(r);
234 return false;
237 talloc_free(r);
239 return true;
242 static bool api_echo_SourceData(pipes_struct *p)
244 const struct ndr_interface_call *call;
245 struct ndr_pull *pull;
246 struct ndr_push *push;
247 enum ndr_err_code ndr_err;
248 DATA_BLOB blob;
249 struct echo_SourceData *r;
251 call = &ndr_table_rpcecho.calls[NDR_ECHO_SOURCEDATA];
253 r = talloc(talloc_tos(), struct echo_SourceData);
254 if (r == NULL) {
255 return false;
258 if (!prs_data_blob(&p->in_data.data, &blob, r)) {
259 talloc_free(r);
260 return false;
263 pull = ndr_pull_init_blob(&blob, r, NULL);
264 if (pull == NULL) {
265 talloc_free(r);
266 return false;
269 pull->flags |= LIBNDR_FLAG_REF_ALLOC;
270 ndr_err = call->ndr_pull(pull, NDR_IN, r);
271 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
272 talloc_free(r);
273 return false;
276 if (DEBUGLEVEL >= 10) {
277 NDR_PRINT_IN_DEBUG(echo_SourceData, r);
280 ZERO_STRUCT(r->out);
281 r->out.data = talloc_zero_array(r, uint8_t, r->in.len);
282 if (r->out.data == NULL) {
283 talloc_free(r);
284 return false;
287 _echo_SourceData(p, r);
289 if (p->rng_fault_state) {
290 talloc_free(r);
291 /* Return true here, srv_pipe_hnd.c will take care */
292 return true;
295 if (DEBUGLEVEL >= 10) {
296 NDR_PRINT_OUT_DEBUG(echo_SourceData, r);
299 push = ndr_push_init_ctx(r, NULL);
300 if (push == NULL) {
301 talloc_free(r);
302 return false;
305 ndr_err = call->ndr_push(push, NDR_OUT, r);
306 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
307 talloc_free(r);
308 return false;
311 blob = ndr_push_blob(push);
312 if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
313 talloc_free(r);
314 return false;
317 talloc_free(r);
319 return true;
322 static bool api_echo_TestCall(pipes_struct *p)
324 const struct ndr_interface_call *call;
325 struct ndr_pull *pull;
326 struct ndr_push *push;
327 enum ndr_err_code ndr_err;
328 DATA_BLOB blob;
329 struct echo_TestCall *r;
331 call = &ndr_table_rpcecho.calls[NDR_ECHO_TESTCALL];
333 r = talloc(talloc_tos(), struct echo_TestCall);
334 if (r == NULL) {
335 return false;
338 if (!prs_data_blob(&p->in_data.data, &blob, r)) {
339 talloc_free(r);
340 return false;
343 pull = ndr_pull_init_blob(&blob, r, NULL);
344 if (pull == NULL) {
345 talloc_free(r);
346 return false;
349 pull->flags |= LIBNDR_FLAG_REF_ALLOC;
350 ndr_err = call->ndr_pull(pull, NDR_IN, r);
351 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
352 talloc_free(r);
353 return false;
356 if (DEBUGLEVEL >= 10) {
357 NDR_PRINT_IN_DEBUG(echo_TestCall, r);
360 ZERO_STRUCT(r->out);
361 r->out.s2 = talloc_zero(r, const char *);
362 if (r->out.s2 == NULL) {
363 talloc_free(r);
364 return false;
367 _echo_TestCall(p, r);
369 if (p->rng_fault_state) {
370 talloc_free(r);
371 /* Return true here, srv_pipe_hnd.c will take care */
372 return true;
375 if (DEBUGLEVEL >= 10) {
376 NDR_PRINT_OUT_DEBUG(echo_TestCall, r);
379 push = ndr_push_init_ctx(r, NULL);
380 if (push == NULL) {
381 talloc_free(r);
382 return false;
385 ndr_err = call->ndr_push(push, NDR_OUT, r);
386 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
387 talloc_free(r);
388 return false;
391 blob = ndr_push_blob(push);
392 if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
393 talloc_free(r);
394 return false;
397 talloc_free(r);
399 return true;
402 static bool api_echo_TestCall2(pipes_struct *p)
404 const struct ndr_interface_call *call;
405 struct ndr_pull *pull;
406 struct ndr_push *push;
407 enum ndr_err_code ndr_err;
408 DATA_BLOB blob;
409 struct echo_TestCall2 *r;
411 call = &ndr_table_rpcecho.calls[NDR_ECHO_TESTCALL2];
413 r = talloc(talloc_tos(), struct echo_TestCall2);
414 if (r == NULL) {
415 return false;
418 if (!prs_data_blob(&p->in_data.data, &blob, r)) {
419 talloc_free(r);
420 return false;
423 pull = ndr_pull_init_blob(&blob, r, NULL);
424 if (pull == NULL) {
425 talloc_free(r);
426 return false;
429 pull->flags |= LIBNDR_FLAG_REF_ALLOC;
430 ndr_err = call->ndr_pull(pull, NDR_IN, r);
431 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
432 talloc_free(r);
433 return false;
436 if (DEBUGLEVEL >= 10) {
437 NDR_PRINT_IN_DEBUG(echo_TestCall2, r);
440 ZERO_STRUCT(r->out);
441 r->out.info = talloc_zero(r, union echo_Info);
442 if (r->out.info == NULL) {
443 talloc_free(r);
444 return false;
447 r->out.result = _echo_TestCall2(p, r);
449 if (p->rng_fault_state) {
450 talloc_free(r);
451 /* Return true here, srv_pipe_hnd.c will take care */
452 return true;
455 if (DEBUGLEVEL >= 10) {
456 NDR_PRINT_OUT_DEBUG(echo_TestCall2, r);
459 push = ndr_push_init_ctx(r, NULL);
460 if (push == NULL) {
461 talloc_free(r);
462 return false;
465 ndr_err = call->ndr_push(push, NDR_OUT, r);
466 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
467 talloc_free(r);
468 return false;
471 blob = ndr_push_blob(push);
472 if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
473 talloc_free(r);
474 return false;
477 talloc_free(r);
479 return true;
482 static bool api_echo_TestSleep(pipes_struct *p)
484 const struct ndr_interface_call *call;
485 struct ndr_pull *pull;
486 struct ndr_push *push;
487 enum ndr_err_code ndr_err;
488 DATA_BLOB blob;
489 struct echo_TestSleep *r;
491 call = &ndr_table_rpcecho.calls[NDR_ECHO_TESTSLEEP];
493 r = talloc(talloc_tos(), struct echo_TestSleep);
494 if (r == NULL) {
495 return false;
498 if (!prs_data_blob(&p->in_data.data, &blob, r)) {
499 talloc_free(r);
500 return false;
503 pull = ndr_pull_init_blob(&blob, r, NULL);
504 if (pull == NULL) {
505 talloc_free(r);
506 return false;
509 pull->flags |= LIBNDR_FLAG_REF_ALLOC;
510 ndr_err = call->ndr_pull(pull, NDR_IN, r);
511 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
512 talloc_free(r);
513 return false;
516 if (DEBUGLEVEL >= 10) {
517 NDR_PRINT_IN_DEBUG(echo_TestSleep, r);
520 r->out.result = _echo_TestSleep(p, r);
522 if (p->rng_fault_state) {
523 talloc_free(r);
524 /* Return true here, srv_pipe_hnd.c will take care */
525 return true;
528 if (DEBUGLEVEL >= 10) {
529 NDR_PRINT_OUT_DEBUG(echo_TestSleep, r);
532 push = ndr_push_init_ctx(r, NULL);
533 if (push == NULL) {
534 talloc_free(r);
535 return false;
538 ndr_err = call->ndr_push(push, NDR_OUT, r);
539 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
540 talloc_free(r);
541 return false;
544 blob = ndr_push_blob(push);
545 if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
546 talloc_free(r);
547 return false;
550 talloc_free(r);
552 return true;
555 static bool api_echo_TestEnum(pipes_struct *p)
557 const struct ndr_interface_call *call;
558 struct ndr_pull *pull;
559 struct ndr_push *push;
560 enum ndr_err_code ndr_err;
561 DATA_BLOB blob;
562 struct echo_TestEnum *r;
564 call = &ndr_table_rpcecho.calls[NDR_ECHO_TESTENUM];
566 r = talloc(talloc_tos(), struct echo_TestEnum);
567 if (r == NULL) {
568 return false;
571 if (!prs_data_blob(&p->in_data.data, &blob, r)) {
572 talloc_free(r);
573 return false;
576 pull = ndr_pull_init_blob(&blob, r, NULL);
577 if (pull == NULL) {
578 talloc_free(r);
579 return false;
582 pull->flags |= LIBNDR_FLAG_REF_ALLOC;
583 ndr_err = call->ndr_pull(pull, NDR_IN, r);
584 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
585 talloc_free(r);
586 return false;
589 if (DEBUGLEVEL >= 10) {
590 NDR_PRINT_IN_DEBUG(echo_TestEnum, r);
593 ZERO_STRUCT(r->out);
594 r->out.foo1 = r->in.foo1;
595 r->out.foo2 = r->in.foo2;
596 r->out.foo3 = r->in.foo3;
597 _echo_TestEnum(p, r);
599 if (p->rng_fault_state) {
600 talloc_free(r);
601 /* Return true here, srv_pipe_hnd.c will take care */
602 return true;
605 if (DEBUGLEVEL >= 10) {
606 NDR_PRINT_OUT_DEBUG(echo_TestEnum, r);
609 push = ndr_push_init_ctx(r, NULL);
610 if (push == NULL) {
611 talloc_free(r);
612 return false;
615 ndr_err = call->ndr_push(push, NDR_OUT, r);
616 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
617 talloc_free(r);
618 return false;
621 blob = ndr_push_blob(push);
622 if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
623 talloc_free(r);
624 return false;
627 talloc_free(r);
629 return true;
632 static bool api_echo_TestSurrounding(pipes_struct *p)
634 const struct ndr_interface_call *call;
635 struct ndr_pull *pull;
636 struct ndr_push *push;
637 enum ndr_err_code ndr_err;
638 DATA_BLOB blob;
639 struct echo_TestSurrounding *r;
641 call = &ndr_table_rpcecho.calls[NDR_ECHO_TESTSURROUNDING];
643 r = talloc(talloc_tos(), struct echo_TestSurrounding);
644 if (r == NULL) {
645 return false;
648 if (!prs_data_blob(&p->in_data.data, &blob, r)) {
649 talloc_free(r);
650 return false;
653 pull = ndr_pull_init_blob(&blob, r, NULL);
654 if (pull == NULL) {
655 talloc_free(r);
656 return false;
659 pull->flags |= LIBNDR_FLAG_REF_ALLOC;
660 ndr_err = call->ndr_pull(pull, NDR_IN, r);
661 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
662 talloc_free(r);
663 return false;
666 if (DEBUGLEVEL >= 10) {
667 NDR_PRINT_IN_DEBUG(echo_TestSurrounding, r);
670 ZERO_STRUCT(r->out);
671 r->out.data = r->in.data;
672 _echo_TestSurrounding(p, r);
674 if (p->rng_fault_state) {
675 talloc_free(r);
676 /* Return true here, srv_pipe_hnd.c will take care */
677 return true;
680 if (DEBUGLEVEL >= 10) {
681 NDR_PRINT_OUT_DEBUG(echo_TestSurrounding, r);
684 push = ndr_push_init_ctx(r, NULL);
685 if (push == NULL) {
686 talloc_free(r);
687 return false;
690 ndr_err = call->ndr_push(push, NDR_OUT, r);
691 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
692 talloc_free(r);
693 return false;
696 blob = ndr_push_blob(push);
697 if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
698 talloc_free(r);
699 return false;
702 talloc_free(r);
704 return true;
707 static bool api_echo_TestDoublePointer(pipes_struct *p)
709 const struct ndr_interface_call *call;
710 struct ndr_pull *pull;
711 struct ndr_push *push;
712 enum ndr_err_code ndr_err;
713 DATA_BLOB blob;
714 struct echo_TestDoublePointer *r;
716 call = &ndr_table_rpcecho.calls[NDR_ECHO_TESTDOUBLEPOINTER];
718 r = talloc(talloc_tos(), struct echo_TestDoublePointer);
719 if (r == NULL) {
720 return false;
723 if (!prs_data_blob(&p->in_data.data, &blob, r)) {
724 talloc_free(r);
725 return false;
728 pull = ndr_pull_init_blob(&blob, r, NULL);
729 if (pull == NULL) {
730 talloc_free(r);
731 return false;
734 pull->flags |= LIBNDR_FLAG_REF_ALLOC;
735 ndr_err = call->ndr_pull(pull, NDR_IN, r);
736 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
737 talloc_free(r);
738 return false;
741 if (DEBUGLEVEL >= 10) {
742 NDR_PRINT_IN_DEBUG(echo_TestDoublePointer, r);
745 r->out.result = _echo_TestDoublePointer(p, r);
747 if (p->rng_fault_state) {
748 talloc_free(r);
749 /* Return true here, srv_pipe_hnd.c will take care */
750 return true;
753 if (DEBUGLEVEL >= 10) {
754 NDR_PRINT_OUT_DEBUG(echo_TestDoublePointer, r);
757 push = ndr_push_init_ctx(r, NULL);
758 if (push == NULL) {
759 talloc_free(r);
760 return false;
763 ndr_err = call->ndr_push(push, NDR_OUT, r);
764 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
765 talloc_free(r);
766 return false;
769 blob = ndr_push_blob(push);
770 if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
771 talloc_free(r);
772 return false;
775 talloc_free(r);
777 return true;
781 /* Tables */
782 static struct api_struct api_rpcecho_cmds[] =
784 {"ECHO_ADDONE", NDR_ECHO_ADDONE, api_echo_AddOne},
785 {"ECHO_ECHODATA", NDR_ECHO_ECHODATA, api_echo_EchoData},
786 {"ECHO_SINKDATA", NDR_ECHO_SINKDATA, api_echo_SinkData},
787 {"ECHO_SOURCEDATA", NDR_ECHO_SOURCEDATA, api_echo_SourceData},
788 {"ECHO_TESTCALL", NDR_ECHO_TESTCALL, api_echo_TestCall},
789 {"ECHO_TESTCALL2", NDR_ECHO_TESTCALL2, api_echo_TestCall2},
790 {"ECHO_TESTSLEEP", NDR_ECHO_TESTSLEEP, api_echo_TestSleep},
791 {"ECHO_TESTENUM", NDR_ECHO_TESTENUM, api_echo_TestEnum},
792 {"ECHO_TESTSURROUNDING", NDR_ECHO_TESTSURROUNDING, api_echo_TestSurrounding},
793 {"ECHO_TESTDOUBLEPOINTER", NDR_ECHO_TESTDOUBLEPOINTER, api_echo_TestDoublePointer},
796 void rpcecho_get_pipe_fns(struct api_struct **fns, int *n_fns)
798 *fns = api_rpcecho_cmds;
799 *n_fns = sizeof(api_rpcecho_cmds) / sizeof(struct api_struct);
802 NTSTATUS rpc_rpcecho_dispatch(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *interface, uint32_t interface_version, uint32_t opnum, void *_r)
804 if (cli->pipes_struct == NULL) {
805 return NT_STATUS_INVALID_PARAMETER;
808 switch (opnum)
810 case NDR_ECHO_ADDONE: {
811 struct echo_AddOne *r = (struct echo_AddOne *)_r;
812 ZERO_STRUCT(r->out);
813 r->out.out_data = talloc_zero(mem_ctx, uint32_t);
814 if (r->out.out_data == NULL) {
815 return NT_STATUS_NO_MEMORY;
818 _echo_AddOne(cli->pipes_struct, r);
819 return NT_STATUS_OK;
822 case NDR_ECHO_ECHODATA: {
823 struct echo_EchoData *r = (struct echo_EchoData *)_r;
824 ZERO_STRUCT(r->out);
825 r->out.out_data = talloc_zero_array(mem_ctx, uint8_t, r->in.len);
826 if (r->out.out_data == NULL) {
827 return NT_STATUS_NO_MEMORY;
830 _echo_EchoData(cli->pipes_struct, r);
831 return NT_STATUS_OK;
834 case NDR_ECHO_SINKDATA: {
835 struct echo_SinkData *r = (struct echo_SinkData *)_r;
836 _echo_SinkData(cli->pipes_struct, r);
837 return NT_STATUS_OK;
840 case NDR_ECHO_SOURCEDATA: {
841 struct echo_SourceData *r = (struct echo_SourceData *)_r;
842 ZERO_STRUCT(r->out);
843 r->out.data = talloc_zero_array(mem_ctx, uint8_t, r->in.len);
844 if (r->out.data == NULL) {
845 return NT_STATUS_NO_MEMORY;
848 _echo_SourceData(cli->pipes_struct, r);
849 return NT_STATUS_OK;
852 case NDR_ECHO_TESTCALL: {
853 struct echo_TestCall *r = (struct echo_TestCall *)_r;
854 ZERO_STRUCT(r->out);
855 r->out.s2 = talloc_zero(mem_ctx, const char *);
856 if (r->out.s2 == NULL) {
857 return NT_STATUS_NO_MEMORY;
860 _echo_TestCall(cli->pipes_struct, r);
861 return NT_STATUS_OK;
864 case NDR_ECHO_TESTCALL2: {
865 struct echo_TestCall2 *r = (struct echo_TestCall2 *)_r;
866 ZERO_STRUCT(r->out);
867 r->out.info = talloc_zero(mem_ctx, union echo_Info);
868 if (r->out.info == NULL) {
869 return NT_STATUS_NO_MEMORY;
872 r->out.result = _echo_TestCall2(cli->pipes_struct, r);
873 return NT_STATUS_OK;
876 case NDR_ECHO_TESTSLEEP: {
877 struct echo_TestSleep *r = (struct echo_TestSleep *)_r;
878 r->out.result = _echo_TestSleep(cli->pipes_struct, r);
879 return NT_STATUS_OK;
882 case NDR_ECHO_TESTENUM: {
883 struct echo_TestEnum *r = (struct echo_TestEnum *)_r;
884 ZERO_STRUCT(r->out);
885 r->out.foo1 = r->in.foo1;
886 r->out.foo2 = r->in.foo2;
887 r->out.foo3 = r->in.foo3;
888 _echo_TestEnum(cli->pipes_struct, r);
889 return NT_STATUS_OK;
892 case NDR_ECHO_TESTSURROUNDING: {
893 struct echo_TestSurrounding *r = (struct echo_TestSurrounding *)_r;
894 ZERO_STRUCT(r->out);
895 r->out.data = r->in.data;
896 _echo_TestSurrounding(cli->pipes_struct, r);
897 return NT_STATUS_OK;
900 case NDR_ECHO_TESTDOUBLEPOINTER: {
901 struct echo_TestDoublePointer *r = (struct echo_TestDoublePointer *)_r;
902 r->out.result = _echo_TestDoublePointer(cli->pipes_struct, r);
903 return NT_STATUS_OK;
906 default:
907 return NT_STATUS_NOT_IMPLEMENTED;
911 NTSTATUS rpc_rpcecho_init(void)
913 return rpc_srv_register(SMB_RPC_INTERFACE_VERSION, "rpcecho", "rpcecho", &ndr_table_rpcecho, api_rpcecho_cmds, sizeof(api_rpcecho_cmds) / sizeof(struct api_struct));