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
);
83 return NT_STATUS_NO_MEMORY
;
85 memcpy(*out_data
, r
.data
, size
);
88 return result
? NT_STATUS_OK
: NT_STATUS_UNSUCCESSFUL
;
91 NTSTATUS
rpccli_echo_sink_data(struct rpc_pipe_client
*cli
, TALLOC_CTX
*mem_ctx
,
92 uint32 size
, char *in_data
)
94 prs_struct qbuf
, rbuf
;
102 /* Marshall data and send request */
104 init_echo_q_sink_data(&q
, size
, in_data
);
106 CLI_DO_RPC( cli
, mem_ctx
, PI_ECHO
, ECHO_SINK_DATA
,
111 NT_STATUS_UNSUCCESSFUL
);
115 return result
? NT_STATUS_OK
: NT_STATUS_UNSUCCESSFUL
;
118 NTSTATUS
rpccli_echo_source_data(struct rpc_pipe_client
*cli
, TALLOC_CTX
*mem_ctx
,
119 uint32 size
, char **out_data
)
121 prs_struct qbuf
, rbuf
;
122 ECHO_Q_SOURCE_DATA q
;
123 ECHO_R_SOURCE_DATA r
;
129 /* Marshall data and send request */
131 init_echo_q_source_data(&q
, size
);
133 CLI_DO_RPC( cli
, mem_ctx
, PI_ECHO
, ECHO_SOURCE_DATA
,
136 echo_io_q_source_data
,
137 echo_io_r_source_data
,
138 NT_STATUS_UNSUCCESSFUL
);
142 return result
? NT_STATUS_OK
: NT_STATUS_UNSUCCESSFUL
;