2 Unix SMB/CIFS implementation.
6 Copyright (C) Tim Potter 2003
7 Copyright (C) Jeremy Allison 2005.
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 NTSTATUS
rpccli_echo_add_one(struct rpc_pipe_client
*cli
, TALLOC_CTX
*mem_ctx
,
27 uint32 request
, uint32
*response
)
29 prs_struct qbuf
, rbuf
;
37 /* Marshall data and send request */
39 init_echo_q_add_one(&q
, request
);
41 CLI_DO_RPC( cli
, mem_ctx
, PI_ECHO
, ECHO_ADD_ONE
,
46 NT_STATUS_UNSUCCESSFUL
);
49 *response
= r
.response
;
53 return result
? NT_STATUS_OK
: NT_STATUS_UNSUCCESSFUL
;
56 NTSTATUS
rpccli_echo_data(struct rpc_pipe_client
*cli
, TALLOC_CTX
*mem_ctx
,
57 uint32 size
, char *in_data
, char **out_data
)
59 prs_struct qbuf
, rbuf
;
67 /* Marshall data and send request */
69 init_echo_q_echo_data(&q
, size
, in_data
);
71 CLI_DO_RPC( cli
, mem_ctx
, PI_ECHO
, ECHO_DATA
,
76 NT_STATUS_UNSUCCESSFUL
);
81 *out_data
= TALLOC(mem_ctx
, size
);
82 memcpy(*out_data
, r
.data
, size
);
85 return result
? NT_STATUS_OK
: NT_STATUS_UNSUCCESSFUL
;
88 NTSTATUS
rpccli_echo_sink_data(struct rpc_pipe_client
*cli
, TALLOC_CTX
*mem_ctx
,
89 uint32 size
, char *in_data
)
91 prs_struct qbuf
, rbuf
;
99 /* Marshall data and send request */
101 init_echo_q_sink_data(&q
, size
, in_data
);
103 CLI_DO_RPC( cli
, mem_ctx
, PI_ECHO
, ECHO_SINK_DATA
,
108 NT_STATUS_UNSUCCESSFUL
);
112 return result
? NT_STATUS_OK
: NT_STATUS_UNSUCCESSFUL
;
115 NTSTATUS
rpccli_echo_source_data(struct rpc_pipe_client
*cli
, TALLOC_CTX
*mem_ctx
,
116 uint32 size
, char **out_data
)
118 prs_struct qbuf
, rbuf
;
119 ECHO_Q_SOURCE_DATA q
;
120 ECHO_R_SOURCE_DATA r
;
126 /* Marshall data and send request */
128 init_echo_q_source_data(&q
, size
);
130 CLI_DO_RPC( cli
, mem_ctx
, PI_ECHO
, ECHO_SOURCE_DATA
,
133 echo_io_q_source_data
,
134 echo_io_r_source_data
,
135 NT_STATUS_UNSUCCESSFUL
);
139 return result
? NT_STATUS_OK
: NT_STATUS_UNSUCCESSFUL
;