2 * Unix SMB/CIFS implementation.
3 * server auto-generated by pidl. DO NOT MODIFY!
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
;
16 struct echo_AddOne
*r
;
18 call
= &ndr_table_rpcecho
.calls
[NDR_ECHO_ADDONE
];
20 r
= talloc(talloc_tos(), struct echo_AddOne
);
25 if (!prs_data_blob(&p
->in_data
.data
, &blob
, r
)) {
30 pull
= ndr_pull_init_blob(&blob
, r
, NULL
);
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
)) {
43 if (DEBUGLEVEL
>= 10) {
44 NDR_PRINT_IN_DEBUG(echo_AddOne
, r
);
48 r
->out
.out_data
= talloc_zero(r
, uint32_t);
49 if (r
->out
.out_data
== NULL
) {
56 if (p
->rng_fault_state
) {
58 /* Return true here, srv_pipe_hnd.c will take care */
62 if (DEBUGLEVEL
>= 10) {
63 NDR_PRINT_OUT_DEBUG(echo_AddOne
, r
);
66 push
= ndr_push_init_ctx(r
, NULL
);
72 ndr_err
= call
->ndr_push(push
, NDR_OUT
, r
);
73 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err
)) {
78 blob
= ndr_push_blob(push
);
79 if (!prs_copy_data_in(&p
->out_data
.rdata
, (const char *)blob
.data
, (uint32_t)blob
.length
)) {
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
;
96 struct echo_EchoData
*r
;
98 call
= &ndr_table_rpcecho
.calls
[NDR_ECHO_ECHODATA
];
100 r
= talloc(talloc_tos(), struct echo_EchoData
);
105 if (!prs_data_blob(&p
->in_data
.data
, &blob
, r
)) {
110 pull
= ndr_pull_init_blob(&blob
, r
, NULL
);
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
)) {
123 if (DEBUGLEVEL
>= 10) {
124 NDR_PRINT_IN_DEBUG(echo_EchoData
, r
);
128 r
->out
.out_data
= talloc_zero_array(r
, uint8_t, r
->in
.len
);
129 if (r
->out
.out_data
== NULL
) {
134 _echo_EchoData(p
, r
);
136 if (p
->rng_fault_state
) {
138 /* Return true here, srv_pipe_hnd.c will take care */
142 if (DEBUGLEVEL
>= 10) {
143 NDR_PRINT_OUT_DEBUG(echo_EchoData
, r
);
146 push
= ndr_push_init_ctx(r
, NULL
);
152 ndr_err
= call
->ndr_push(push
, NDR_OUT
, r
);
153 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err
)) {
158 blob
= ndr_push_blob(push
);
159 if (!prs_copy_data_in(&p
->out_data
.rdata
, (const char *)blob
.data
, (uint32_t)blob
.length
)) {
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
;
176 struct echo_SinkData
*r
;
178 call
= &ndr_table_rpcecho
.calls
[NDR_ECHO_SINKDATA
];
180 r
= talloc(talloc_tos(), struct echo_SinkData
);
185 if (!prs_data_blob(&p
->in_data
.data
, &blob
, r
)) {
190 pull
= ndr_pull_init_blob(&blob
, r
, NULL
);
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
)) {
203 if (DEBUGLEVEL
>= 10) {
204 NDR_PRINT_IN_DEBUG(echo_SinkData
, r
);
207 _echo_SinkData(p
, r
);
209 if (p
->rng_fault_state
) {
211 /* Return true here, srv_pipe_hnd.c will take care */
215 if (DEBUGLEVEL
>= 10) {
216 NDR_PRINT_OUT_DEBUG(echo_SinkData
, r
);
219 push
= ndr_push_init_ctx(r
, NULL
);
225 ndr_err
= call
->ndr_push(push
, NDR_OUT
, r
);
226 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err
)) {
231 blob
= ndr_push_blob(push
);
232 if (!prs_copy_data_in(&p
->out_data
.rdata
, (const char *)blob
.data
, (uint32_t)blob
.length
)) {
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
;
249 struct echo_SourceData
*r
;
251 call
= &ndr_table_rpcecho
.calls
[NDR_ECHO_SOURCEDATA
];
253 r
= talloc(talloc_tos(), struct echo_SourceData
);
258 if (!prs_data_blob(&p
->in_data
.data
, &blob
, r
)) {
263 pull
= ndr_pull_init_blob(&blob
, r
, NULL
);
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
)) {
276 if (DEBUGLEVEL
>= 10) {
277 NDR_PRINT_IN_DEBUG(echo_SourceData
, r
);
281 r
->out
.data
= talloc_zero_array(r
, uint8_t, r
->in
.len
);
282 if (r
->out
.data
== NULL
) {
287 _echo_SourceData(p
, r
);
289 if (p
->rng_fault_state
) {
291 /* Return true here, srv_pipe_hnd.c will take care */
295 if (DEBUGLEVEL
>= 10) {
296 NDR_PRINT_OUT_DEBUG(echo_SourceData
, r
);
299 push
= ndr_push_init_ctx(r
, NULL
);
305 ndr_err
= call
->ndr_push(push
, NDR_OUT
, r
);
306 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err
)) {
311 blob
= ndr_push_blob(push
);
312 if (!prs_copy_data_in(&p
->out_data
.rdata
, (const char *)blob
.data
, (uint32_t)blob
.length
)) {
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
;
329 struct echo_TestCall
*r
;
331 call
= &ndr_table_rpcecho
.calls
[NDR_ECHO_TESTCALL
];
333 r
= talloc(talloc_tos(), struct echo_TestCall
);
338 if (!prs_data_blob(&p
->in_data
.data
, &blob
, r
)) {
343 pull
= ndr_pull_init_blob(&blob
, r
, NULL
);
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
)) {
356 if (DEBUGLEVEL
>= 10) {
357 NDR_PRINT_IN_DEBUG(echo_TestCall
, r
);
361 r
->out
.s2
= talloc_zero(r
, const char *);
362 if (r
->out
.s2
== NULL
) {
367 _echo_TestCall(p
, r
);
369 if (p
->rng_fault_state
) {
371 /* Return true here, srv_pipe_hnd.c will take care */
375 if (DEBUGLEVEL
>= 10) {
376 NDR_PRINT_OUT_DEBUG(echo_TestCall
, r
);
379 push
= ndr_push_init_ctx(r
, NULL
);
385 ndr_err
= call
->ndr_push(push
, NDR_OUT
, r
);
386 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err
)) {
391 blob
= ndr_push_blob(push
);
392 if (!prs_copy_data_in(&p
->out_data
.rdata
, (const char *)blob
.data
, (uint32_t)blob
.length
)) {
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
;
409 struct echo_TestCall2
*r
;
411 call
= &ndr_table_rpcecho
.calls
[NDR_ECHO_TESTCALL2
];
413 r
= talloc(talloc_tos(), struct echo_TestCall2
);
418 if (!prs_data_blob(&p
->in_data
.data
, &blob
, r
)) {
423 pull
= ndr_pull_init_blob(&blob
, r
, NULL
);
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
)) {
436 if (DEBUGLEVEL
>= 10) {
437 NDR_PRINT_IN_DEBUG(echo_TestCall2
, r
);
441 r
->out
.info
= talloc_zero(r
, union echo_Info
);
442 if (r
->out
.info
== NULL
) {
447 r
->out
.result
= _echo_TestCall2(p
, r
);
449 if (p
->rng_fault_state
) {
451 /* Return true here, srv_pipe_hnd.c will take care */
455 if (DEBUGLEVEL
>= 10) {
456 NDR_PRINT_OUT_DEBUG(echo_TestCall2
, r
);
459 push
= ndr_push_init_ctx(r
, NULL
);
465 ndr_err
= call
->ndr_push(push
, NDR_OUT
, r
);
466 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err
)) {
471 blob
= ndr_push_blob(push
);
472 if (!prs_copy_data_in(&p
->out_data
.rdata
, (const char *)blob
.data
, (uint32_t)blob
.length
)) {
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
;
489 struct echo_TestSleep
*r
;
491 call
= &ndr_table_rpcecho
.calls
[NDR_ECHO_TESTSLEEP
];
493 r
= talloc(talloc_tos(), struct echo_TestSleep
);
498 if (!prs_data_blob(&p
->in_data
.data
, &blob
, r
)) {
503 pull
= ndr_pull_init_blob(&blob
, r
, NULL
);
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
)) {
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
) {
524 /* Return true here, srv_pipe_hnd.c will take care */
528 if (DEBUGLEVEL
>= 10) {
529 NDR_PRINT_OUT_DEBUG(echo_TestSleep
, r
);
532 push
= ndr_push_init_ctx(r
, NULL
);
538 ndr_err
= call
->ndr_push(push
, NDR_OUT
, r
);
539 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err
)) {
544 blob
= ndr_push_blob(push
);
545 if (!prs_copy_data_in(&p
->out_data
.rdata
, (const char *)blob
.data
, (uint32_t)blob
.length
)) {
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
;
562 struct echo_TestEnum
*r
;
564 call
= &ndr_table_rpcecho
.calls
[NDR_ECHO_TESTENUM
];
566 r
= talloc(talloc_tos(), struct echo_TestEnum
);
571 if (!prs_data_blob(&p
->in_data
.data
, &blob
, r
)) {
576 pull
= ndr_pull_init_blob(&blob
, r
, NULL
);
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
)) {
589 if (DEBUGLEVEL
>= 10) {
590 NDR_PRINT_IN_DEBUG(echo_TestEnum
, r
);
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
) {
601 /* Return true here, srv_pipe_hnd.c will take care */
605 if (DEBUGLEVEL
>= 10) {
606 NDR_PRINT_OUT_DEBUG(echo_TestEnum
, r
);
609 push
= ndr_push_init_ctx(r
, NULL
);
615 ndr_err
= call
->ndr_push(push
, NDR_OUT
, r
);
616 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err
)) {
621 blob
= ndr_push_blob(push
);
622 if (!prs_copy_data_in(&p
->out_data
.rdata
, (const char *)blob
.data
, (uint32_t)blob
.length
)) {
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
;
639 struct echo_TestSurrounding
*r
;
641 call
= &ndr_table_rpcecho
.calls
[NDR_ECHO_TESTSURROUNDING
];
643 r
= talloc(talloc_tos(), struct echo_TestSurrounding
);
648 if (!prs_data_blob(&p
->in_data
.data
, &blob
, r
)) {
653 pull
= ndr_pull_init_blob(&blob
, r
, NULL
);
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
)) {
666 if (DEBUGLEVEL
>= 10) {
667 NDR_PRINT_IN_DEBUG(echo_TestSurrounding
, r
);
671 r
->out
.data
= r
->in
.data
;
672 _echo_TestSurrounding(p
, r
);
674 if (p
->rng_fault_state
) {
676 /* Return true here, srv_pipe_hnd.c will take care */
680 if (DEBUGLEVEL
>= 10) {
681 NDR_PRINT_OUT_DEBUG(echo_TestSurrounding
, r
);
684 push
= ndr_push_init_ctx(r
, NULL
);
690 ndr_err
= call
->ndr_push(push
, NDR_OUT
, r
);
691 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err
)) {
696 blob
= ndr_push_blob(push
);
697 if (!prs_copy_data_in(&p
->out_data
.rdata
, (const char *)blob
.data
, (uint32_t)blob
.length
)) {
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
;
714 struct echo_TestDoublePointer
*r
;
716 call
= &ndr_table_rpcecho
.calls
[NDR_ECHO_TESTDOUBLEPOINTER
];
718 r
= talloc(talloc_tos(), struct echo_TestDoublePointer
);
723 if (!prs_data_blob(&p
->in_data
.data
, &blob
, r
)) {
728 pull
= ndr_pull_init_blob(&blob
, r
, NULL
);
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
)) {
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
) {
749 /* Return true here, srv_pipe_hnd.c will take care */
753 if (DEBUGLEVEL
>= 10) {
754 NDR_PRINT_OUT_DEBUG(echo_TestDoublePointer
, r
);
757 push
= ndr_push_init_ctx(r
, NULL
);
763 ndr_err
= call
->ndr_push(push
, NDR_OUT
, r
);
764 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err
)) {
769 blob
= ndr_push_blob(push
);
770 if (!prs_copy_data_in(&p
->out_data
.rdata
, (const char *)blob
.data
, (uint32_t)blob
.length
)) {
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 struct ndr_interface_table
*table
, uint32_t opnum
, void *_r
)
804 if (cli
->pipes_struct
== NULL
) {
805 return NT_STATUS_INVALID_PARAMETER
;
810 case NDR_ECHO_ADDONE
: {
811 struct echo_AddOne
*r
= (struct echo_AddOne
*)_r
;
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
);
822 case NDR_ECHO_ECHODATA
: {
823 struct echo_EchoData
*r
= (struct echo_EchoData
*)_r
;
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
);
834 case NDR_ECHO_SINKDATA
: {
835 struct echo_SinkData
*r
= (struct echo_SinkData
*)_r
;
836 _echo_SinkData(cli
->pipes_struct
, r
);
840 case NDR_ECHO_SOURCEDATA
: {
841 struct echo_SourceData
*r
= (struct echo_SourceData
*)_r
;
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
);
852 case NDR_ECHO_TESTCALL
: {
853 struct echo_TestCall
*r
= (struct echo_TestCall
*)_r
;
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
);
864 case NDR_ECHO_TESTCALL2
: {
865 struct echo_TestCall2
*r
= (struct echo_TestCall2
*)_r
;
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
);
876 case NDR_ECHO_TESTSLEEP
: {
877 struct echo_TestSleep
*r
= (struct echo_TestSleep
*)_r
;
878 r
->out
.result
= _echo_TestSleep(cli
->pipes_struct
, r
);
882 case NDR_ECHO_TESTENUM
: {
883 struct echo_TestEnum
*r
= (struct echo_TestEnum
*)_r
;
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
);
892 case NDR_ECHO_TESTSURROUNDING
: {
893 struct echo_TestSurrounding
*r
= (struct echo_TestSurrounding
*)_r
;
895 r
->out
.data
= r
->in
.data
;
896 _echo_TestSurrounding(cli
->pipes_struct
, r
);
900 case NDR_ECHO_TESTDOUBLEPOINTER
: {
901 struct echo_TestDoublePointer
*r
= (struct echo_TestDoublePointer
*)_r
;
902 r
->out
.result
= _echo_TestDoublePointer(cli
->pipes_struct
, r
);
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
));