s3:rpc_client: add cli_rpc_pipe_open_schannel_with_creds() helper function
[Samba.git] / libcli / smb / smbXcli_base.h
blob2e13b57ef8ff0fe081d573de858f304ffe669932
1 /*
2 Unix SMB/CIFS implementation.
3 Infrastructure for async SMB client requests
4 Copyright (C) Volker Lendecke 2008
5 Copyright (C) Stefan Metzmacher 2011
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>.
21 #ifndef _SMBXCLI_BASE_H_
22 #define _SMBXCLI_BASE_H_
24 struct smbXcli_conn;
25 struct smbXcli_session;
26 struct smbXcli_tcon;
27 struct smb_trans_enc_state;
28 struct GUID;
29 struct iovec;
30 struct smb2_create_blobs;
31 struct smb_create_returns;
33 struct smbXcli_conn *smbXcli_conn_create(TALLOC_CTX *mem_ctx,
34 int fd,
35 const char *remote_name,
36 enum smb_signing_setting signing_state,
37 uint32_t smb1_capabilities,
38 struct GUID *client_guid,
39 uint32_t smb2_capabilities);
41 bool smbXcli_conn_is_connected(struct smbXcli_conn *conn);
42 void smbXcli_conn_disconnect(struct smbXcli_conn *conn, NTSTATUS status);
44 bool smbXcli_conn_has_async_calls(struct smbXcli_conn *conn);
46 bool smbXcli_conn_dfs_supported(struct smbXcli_conn *conn);
48 enum protocol_types smbXcli_conn_protocol(struct smbXcli_conn *conn);
49 bool smbXcli_conn_use_unicode(struct smbXcli_conn *conn);
51 void smbXcli_conn_set_sockopt(struct smbXcli_conn *conn, const char *options);
52 const struct sockaddr_storage *smbXcli_conn_local_sockaddr(struct smbXcli_conn *conn);
53 const struct sockaddr_storage *smbXcli_conn_remote_sockaddr(struct smbXcli_conn *conn);
54 const char *smbXcli_conn_remote_name(struct smbXcli_conn *conn);
56 uint16_t smbXcli_conn_max_requests(struct smbXcli_conn *conn);
57 NTTIME smbXcli_conn_server_system_time(struct smbXcli_conn *conn);
58 const DATA_BLOB *smbXcli_conn_server_gss_blob(struct smbXcli_conn *conn);
59 const struct GUID *smbXcli_conn_server_guid(struct smbXcli_conn *conn);
61 struct tevent_req *smbXcli_conn_samba_suicide_send(TALLOC_CTX *mem_ctx,
62 struct tevent_context *ev,
63 struct smbXcli_conn *conn,
64 uint8_t exitcode);
65 NTSTATUS smbXcli_conn_samba_suicide_recv(struct tevent_req *req);
66 NTSTATUS smbXcli_conn_samba_suicide(struct smbXcli_conn *conn,
67 uint8_t exitcode);
69 void smbXcli_req_unset_pending(struct tevent_req *req);
70 bool smbXcli_req_set_pending(struct tevent_req *req);
72 uint32_t smb1cli_conn_capabilities(struct smbXcli_conn *conn);
73 uint32_t smb1cli_conn_max_xmit(struct smbXcli_conn *conn);
74 bool smb1cli_conn_req_possible(struct smbXcli_conn *conn);
75 uint32_t smb1cli_conn_server_session_key(struct smbXcli_conn *conn);
76 const uint8_t *smb1cli_conn_server_challenge(struct smbXcli_conn *conn);
77 uint16_t smb1cli_conn_server_security_mode(struct smbXcli_conn *conn);
78 bool smb1cli_conn_server_readbraw(struct smbXcli_conn *conn);
79 bool smb1cli_conn_server_writebraw(struct smbXcli_conn *conn);
80 bool smb1cli_conn_server_lockread(struct smbXcli_conn *conn);
81 bool smb1cli_conn_server_writeunlock(struct smbXcli_conn *conn);
82 int smb1cli_conn_server_time_zone(struct smbXcli_conn *conn);
84 bool smb1cli_conn_activate_signing(struct smbXcli_conn *conn,
85 const DATA_BLOB user_session_key,
86 const DATA_BLOB response);
87 bool smb1cli_conn_check_signing(struct smbXcli_conn *conn,
88 const uint8_t *buf, uint32_t seqnum);
89 bool smb1cli_conn_signing_is_active(struct smbXcli_conn *conn);
91 void smb1cli_conn_set_encryption(struct smbXcli_conn *conn,
92 struct smb_trans_enc_state *es);
93 bool smb1cli_conn_encryption_on(struct smbXcli_conn *conn);
95 bool smb1cli_is_andx_req(uint8_t cmd);
96 size_t smb1cli_req_wct_ofs(struct tevent_req **reqs, int num_reqs);
98 uint16_t smb1cli_req_mid(struct tevent_req *req);
99 void smb1cli_req_set_mid(struct tevent_req *req, uint16_t mid);
101 uint32_t smb1cli_req_seqnum(struct tevent_req *req);
102 void smb1cli_req_set_seqnum(struct tevent_req *req, uint32_t seqnum);
104 struct smb1cli_req_expected_response {
105 NTSTATUS status;
106 uint8_t wct;
109 struct tevent_req *smb1cli_req_create(TALLOC_CTX *mem_ctx,
110 struct tevent_context *ev,
111 struct smbXcli_conn *conn,
112 uint8_t smb_command,
113 uint8_t additional_flags,
114 uint8_t clear_flags,
115 uint16_t additional_flags2,
116 uint16_t clear_flags2,
117 uint32_t timeout_msec,
118 uint32_t pid,
119 struct smbXcli_tcon *tcon,
120 struct smbXcli_session *session,
121 uint8_t wct, uint16_t *vwv,
122 int iov_count,
123 struct iovec *bytes_iov);
124 NTSTATUS smb1cli_req_chain_submit(struct tevent_req **reqs, int num_reqs);
126 struct tevent_req *smb1cli_req_send(TALLOC_CTX *mem_ctx,
127 struct tevent_context *ev,
128 struct smbXcli_conn *conn,
129 uint8_t smb_command,
130 uint8_t additional_flags,
131 uint8_t clear_flags,
132 uint16_t additional_flags2,
133 uint16_t clear_flags2,
134 uint32_t timeout_msec,
135 uint32_t pid,
136 struct smbXcli_tcon *tcon,
137 struct smbXcli_session *session,
138 uint8_t wct, uint16_t *vwv,
139 uint32_t num_bytes,
140 const uint8_t *bytes);
141 NTSTATUS smb1cli_req_recv(struct tevent_req *req,
142 TALLOC_CTX *mem_ctx,
143 struct iovec **piov,
144 uint8_t **phdr,
145 uint8_t *pwct,
146 uint16_t **pvwv,
147 uint32_t *pvwv_offset,
148 uint32_t *pnum_bytes,
149 uint8_t **pbytes,
150 uint32_t *pbytes_offset,
151 uint8_t **pinbuf,
152 const struct smb1cli_req_expected_response *expected,
153 size_t num_expected);
155 struct tevent_req *smb1cli_trans_send(
156 TALLOC_CTX *mem_ctx, struct tevent_context *ev,
157 struct smbXcli_conn *conn, uint8_t cmd,
158 uint8_t additional_flags, uint8_t clear_flags,
159 uint16_t additional_flags2, uint16_t clear_flags2,
160 uint32_t timeout_msec,
161 uint32_t pid,
162 struct smbXcli_tcon *tcon,
163 struct smbXcli_session *session,
164 const char *pipe_name, uint16_t fid, uint16_t function, int flags,
165 uint16_t *setup, uint8_t num_setup, uint8_t max_setup,
166 uint8_t *param, uint32_t num_param, uint32_t max_param,
167 uint8_t *data, uint32_t num_data, uint32_t max_data);
168 NTSTATUS smb1cli_trans_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
169 uint16_t *recv_flags2,
170 uint16_t **setup, uint8_t min_setup,
171 uint8_t *num_setup,
172 uint8_t **param, uint32_t min_param,
173 uint32_t *num_param,
174 uint8_t **data, uint32_t min_data,
175 uint32_t *num_data);
176 NTSTATUS smb1cli_trans(TALLOC_CTX *mem_ctx, struct smbXcli_conn *conn,
177 uint8_t trans_cmd,
178 uint8_t additional_flags, uint8_t clear_flags,
179 uint16_t additional_flags2, uint16_t clear_flags2,
180 uint32_t timeout_msec,
181 uint32_t pid,
182 struct smbXcli_tcon *tcon,
183 struct smbXcli_session *session,
184 const char *pipe_name, uint16_t fid, uint16_t function,
185 int flags,
186 uint16_t *setup, uint8_t num_setup, uint8_t max_setup,
187 uint8_t *param, uint32_t num_param, uint32_t max_param,
188 uint8_t *data, uint32_t num_data, uint32_t max_data,
189 uint16_t *recv_flags2,
190 uint16_t **rsetup, uint8_t min_rsetup, uint8_t *num_rsetup,
191 uint8_t **rparam, uint32_t min_rparam, uint32_t *num_rparam,
192 uint8_t **rdata, uint32_t min_rdata, uint32_t *num_rdata);
194 struct tevent_req *smb1cli_echo_send(TALLOC_CTX *mem_ctx,
195 struct tevent_context *ev,
196 struct smbXcli_conn *conn,
197 uint32_t timeout_msec,
198 uint16_t num_echos,
199 DATA_BLOB data);
200 NTSTATUS smb1cli_echo_recv(struct tevent_req *req);
201 NTSTATUS smb1cli_echo(struct smbXcli_conn *conn, uint32_t timeout_msec,
202 uint16_t num_echos, DATA_BLOB data);
204 struct tevent_req *smb1cli_ntcreatex_send(TALLOC_CTX *mem_ctx,
205 struct tevent_context *ev,
206 struct smbXcli_conn *conn,
207 uint32_t timeout_msec,
208 uint32_t pid,
209 struct smbXcli_tcon *tcon,
210 struct smbXcli_session *session,
211 const char *fname,
212 uint32_t CreatFlags,
213 uint32_t RootDirectoryFid,
214 uint32_t DesiredAccess,
215 uint64_t AllocationSize,
216 uint32_t FileAttributes,
217 uint32_t ShareAccess,
218 uint32_t CreateDisposition,
219 uint32_t CreateOptions,
220 uint32_t ImpersonationLevel,
221 uint8_t SecurityFlags);
222 NTSTATUS smb1cli_ntcreatex_recv(struct tevent_req *req, uint16_t *pfnum);
223 NTSTATUS smb1cli_ntcreatex(struct smbXcli_conn *conn,
224 uint32_t timeout_msec,
225 uint32_t pid,
226 struct smbXcli_tcon *tcon,
227 struct smbXcli_session *session,
228 const char *fname,
229 uint32_t CreatFlags,
230 uint32_t RootDirectoryFid,
231 uint32_t DesiredAccess,
232 uint64_t AllocationSize,
233 uint32_t FileAttributes,
234 uint32_t ShareAccess,
235 uint32_t CreateDisposition,
236 uint32_t CreateOptions,
237 uint32_t ImpersonationLevel,
238 uint8_t SecurityFlags,
239 uint16_t *pfnum);
240 struct tevent_req *smb1cli_close_send(TALLOC_CTX *mem_ctx,
241 struct tevent_context *ev,
242 struct smbXcli_conn *conn,
243 uint32_t timeout_msec,
244 uint32_t pid,
245 struct smbXcli_tcon *tcon,
246 struct smbXcli_session *session,
247 uint16_t fnum,
248 uint32_t last_modified);
249 NTSTATUS smb1cli_close_recv(struct tevent_req *req);
250 NTSTATUS smb1cli_close(struct smbXcli_conn *conn,
251 uint32_t timeout_msec,
252 uint32_t pid,
253 struct smbXcli_tcon *tcon,
254 struct smbXcli_session *session,
255 uint16_t fnum,
256 uint32_t last_modified);
257 struct tevent_req *smb1cli_writex_send(TALLOC_CTX *mem_ctx,
258 struct tevent_context *ev,
259 struct smbXcli_conn *conn,
260 uint32_t timeout_msec,
261 uint32_t pid,
262 struct smbXcli_tcon *tcon,
263 struct smbXcli_session *session,
264 uint16_t fnum,
265 uint16_t mode,
266 const uint8_t *buf,
267 uint64_t offset,
268 uint32_t size);
269 NTSTATUS smb1cli_writex_recv(struct tevent_req *req,
270 uint32_t *pwritten,
271 uint16_t *pavailable);
272 NTSTATUS smb1cli_writex(struct smbXcli_conn *conn,
273 uint32_t timeout_msec,
274 uint32_t pid,
275 struct smbXcli_tcon *tcon,
276 struct smbXcli_session *session,
277 uint16_t fnum,
278 uint16_t mode,
279 const uint8_t *buf,
280 uint64_t offset,
281 uint32_t size,
282 uint32_t *pwritten,
283 uint16_t *pavailable);
284 struct tevent_req *smb1cli_readx_send(TALLOC_CTX *mem_ctx,
285 struct tevent_context *ev,
286 struct smbXcli_conn *conn,
287 uint32_t timeout_msec,
288 uint32_t pid,
289 struct smbXcli_tcon *tcon,
290 struct smbXcli_session *session,
291 uint16_t fnum,
292 uint64_t offset,
293 uint32_t size);
294 NTSTATUS smb1cli_readx_recv(struct tevent_req *req,
295 uint32_t *received,
296 uint8_t **rcvbuf);
298 bool smb2cli_conn_req_possible(struct smbXcli_conn *conn, uint32_t *max_dyn_len);
299 uint32_t smb2cli_conn_server_capabilities(struct smbXcli_conn *conn);
300 uint16_t smb2cli_conn_server_security_mode(struct smbXcli_conn *conn);
301 uint32_t smb2cli_conn_max_trans_size(struct smbXcli_conn *conn);
302 uint32_t smb2cli_conn_max_read_size(struct smbXcli_conn *conn);
303 uint32_t smb2cli_conn_max_write_size(struct smbXcli_conn *conn);
304 void smb2cli_conn_set_max_credits(struct smbXcli_conn *conn,
305 uint16_t max_credits);
307 struct tevent_req *smb2cli_req_create(TALLOC_CTX *mem_ctx,
308 struct tevent_context *ev,
309 struct smbXcli_conn *conn,
310 uint16_t cmd,
311 uint32_t additional_flags,
312 uint32_t clear_flags,
313 uint32_t timeout_msec,
314 struct smbXcli_tcon *tcon,
315 struct smbXcli_session *session,
316 const uint8_t *fixed,
317 uint16_t fixed_len,
318 const uint8_t *dyn,
319 uint32_t dyn_len,
320 uint32_t max_dyn_len);
321 void smb2cli_req_set_notify_async(struct tevent_req *req);
322 NTSTATUS smb2cli_req_compound_submit(struct tevent_req **reqs,
323 int num_reqs);
324 void smb2cli_req_set_credit_charge(struct tevent_req *req, uint16_t charge);
326 struct smb2cli_req_expected_response {
327 NTSTATUS status;
328 uint16_t body_size;
331 struct tevent_req *smb2cli_req_send(TALLOC_CTX *mem_ctx,
332 struct tevent_context *ev,
333 struct smbXcli_conn *conn,
334 uint16_t cmd,
335 uint32_t additional_flags,
336 uint32_t clear_flags,
337 uint32_t timeout_msec,
338 struct smbXcli_tcon *tcon,
339 struct smbXcli_session *session,
340 const uint8_t *fixed,
341 uint16_t fixed_len,
342 const uint8_t *dyn,
343 uint32_t dyn_len,
344 uint32_t max_dyn_len);
345 NTSTATUS smb2cli_req_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
346 struct iovec **piov,
347 const struct smb2cli_req_expected_response *expected,
348 size_t num_expected);
351 * This expects an iov[3] array, that is filled with references to
352 * the buffers used for the sending the requests into the socket.
354 * This can only be called after smb2cli_req_recv(subreq) before
355 * the TALLOC_FREE(subreq).
357 NTSTATUS smb2cli_req_get_sent_iov(struct tevent_req *req,
358 struct iovec *sent_iov);
360 struct tevent_req *smbXcli_negprot_send(TALLOC_CTX *mem_ctx,
361 struct tevent_context *ev,
362 struct smbXcli_conn *conn,
363 uint32_t timeout_msec,
364 enum protocol_types min_protocol,
365 enum protocol_types max_protocol);
366 NTSTATUS smbXcli_negprot_recv(struct tevent_req *req);
367 NTSTATUS smbXcli_negprot(struct smbXcli_conn *conn,
368 uint32_t timeout_msec,
369 enum protocol_types min_protocol,
370 enum protocol_types max_protocol);
372 struct tevent_req *smb2cli_validate_negotiate_info_send(TALLOC_CTX *mem_ctx,
373 struct tevent_context *ev,
374 struct smbXcli_conn *conn,
375 uint32_t timeout_msec,
376 struct smbXcli_session *session,
377 struct smbXcli_tcon *tcon);
378 NTSTATUS smb2cli_validate_negotiate_info_recv(struct tevent_req *req);
380 struct smbXcli_session *smbXcli_session_create(TALLOC_CTX *mem_ctx,
381 struct smbXcli_conn *conn);
382 struct smbXcli_session *smbXcli_session_copy(TALLOC_CTX *mem_ctx,
383 struct smbXcli_session *src);
384 bool smbXcli_session_is_authenticated(struct smbXcli_session *session);
385 NTSTATUS smbXcli_session_application_key(struct smbXcli_session *session,
386 TALLOC_CTX *mem_ctx,
387 DATA_BLOB *key);
388 void smbXcli_session_set_disconnect_expired(struct smbXcli_session *session);
389 uint16_t smb1cli_session_current_id(struct smbXcli_session* session);
390 void smb1cli_session_set_id(struct smbXcli_session* session,
391 uint16_t session_id);
392 NTSTATUS smb1cli_session_set_session_key(struct smbXcli_session *session,
393 const DATA_BLOB _session_key);
394 NTSTATUS smb1cli_session_protect_session_key(struct smbXcli_session *session);
395 uint8_t smb2cli_session_security_mode(struct smbXcli_session *session);
396 uint64_t smb2cli_session_current_id(struct smbXcli_session *session);
397 uint16_t smb2cli_session_get_flags(struct smbXcli_session *session);
398 void smb2cli_session_set_id_and_flags(struct smbXcli_session *session,
399 uint64_t session_id,
400 uint16_t session_flags);
401 void smb2cli_session_increment_channel_sequence(struct smbXcli_session *session);
402 uint16_t smb2cli_session_reset_channel_sequence(struct smbXcli_session *session,
403 uint16_t channel_sequence);
404 void smb2cli_session_start_replay(struct smbXcli_session *session);
405 void smb2cli_session_stop_replay(struct smbXcli_session *session);
406 NTSTATUS smb2cli_session_update_preauth(struct smbXcli_session *session,
407 const struct iovec *iov);
408 NTSTATUS smb2cli_session_set_session_key(struct smbXcli_session *session,
409 const DATA_BLOB session_key,
410 const struct iovec *recv_iov);
411 NTSTATUS smb2cli_session_create_channel(TALLOC_CTX *mem_ctx,
412 struct smbXcli_session *session1,
413 struct smbXcli_conn *conn,
414 struct smbXcli_session **_session2);
415 NTSTATUS smb2cli_session_set_channel_key(struct smbXcli_session *session,
416 const DATA_BLOB channel_key,
417 const struct iovec *recv_iov);
418 NTSTATUS smb2cli_session_encryption_on(struct smbXcli_session *session);
420 struct smbXcli_tcon *smbXcli_tcon_create(TALLOC_CTX *mem_ctx);
421 void smbXcli_tcon_set_fs_attributes(struct smbXcli_tcon *tcon,
422 uint32_t fs_attributes);
423 uint32_t smbXcli_tcon_get_fs_attributes(struct smbXcli_tcon *tcon);
424 bool smbXcli_tcon_is_dfs_share(struct smbXcli_tcon *tcon);
425 uint16_t smb1cli_tcon_current_id(struct smbXcli_tcon *tcon);
426 void smb1cli_tcon_set_id(struct smbXcli_tcon *tcon, uint16_t tcon_id);
427 bool smb1cli_tcon_set_values(struct smbXcli_tcon *tcon,
428 uint16_t tcon_id,
429 uint16_t optional_support,
430 uint32_t maximal_access,
431 uint32_t guest_maximal_access,
432 const char *service,
433 const char *fs_type);
434 uint32_t smb2cli_tcon_current_id(struct smbXcli_tcon *tcon);
435 uint32_t smb2cli_tcon_capabilities(struct smbXcli_tcon *tcon);
436 void smb2cli_tcon_set_values(struct smbXcli_tcon *tcon,
437 struct smbXcli_session *session,
438 uint32_t tcon_id,
439 uint8_t type,
440 uint32_t flags,
441 uint32_t capabilities,
442 uint32_t maximal_access);
443 void smb2cli_tcon_should_sign(struct smbXcli_tcon *tcon,
444 bool should_sign);
445 bool smb2cli_tcon_is_signing_on(struct smbXcli_tcon *tcon);
446 void smb2cli_tcon_should_encrypt(struct smbXcli_tcon *tcon,
447 bool should_encrypt);
448 bool smb2cli_tcon_is_encryption_on(struct smbXcli_tcon *tcon);
450 struct tevent_req *smb2cli_session_setup_send(TALLOC_CTX *mem_ctx,
451 struct tevent_context *ev,
452 struct smbXcli_conn *conn,
453 uint32_t timeout_msec,
454 struct smbXcli_session *session,
455 uint8_t in_flags,
456 uint32_t in_capabilities,
457 uint32_t in_channel,
458 uint64_t in_previous_session_id,
459 const DATA_BLOB *in_security_buffer);
460 NTSTATUS smb2cli_session_setup_recv(struct tevent_req *req,
461 TALLOC_CTX *mem_ctx,
462 struct iovec **recv_iov,
463 DATA_BLOB *out_security_buffer);
465 struct tevent_req *smb2cli_logoff_send(TALLOC_CTX *mem_ctx,
466 struct tevent_context *ev,
467 struct smbXcli_conn *conn,
468 uint32_t timeout_msec,
469 struct smbXcli_session *session);
470 NTSTATUS smb2cli_logoff_recv(struct tevent_req *req);
471 NTSTATUS smb2cli_logoff(struct smbXcli_conn *conn,
472 uint32_t timeout_msec,
473 struct smbXcli_session *session);
475 struct tevent_req *smb2cli_tcon_send(TALLOC_CTX *mem_ctx,
476 struct tevent_context *ev,
477 struct smbXcli_conn *conn,
478 uint32_t timeout_msec,
479 struct smbXcli_session *session,
480 struct smbXcli_tcon *tcon,
481 uint16_t flags,
482 const char *unc);
483 NTSTATUS smb2cli_tcon_recv(struct tevent_req *req);
484 NTSTATUS smb2cli_tcon(struct smbXcli_conn *conn,
485 uint32_t timeout_msec,
486 struct smbXcli_session *session,
487 struct smbXcli_tcon *tcon,
488 uint16_t flags,
489 const char *unc);
491 struct tevent_req *smb2cli_tdis_send(TALLOC_CTX *mem_ctx,
492 struct tevent_context *ev,
493 struct smbXcli_conn *conn,
494 uint32_t timeout_msec,
495 struct smbXcli_session *session,
496 struct smbXcli_tcon *tcon);
497 NTSTATUS smb2cli_tdis_recv(struct tevent_req *req);
498 NTSTATUS smb2cli_tdis(struct smbXcli_conn *conn,
499 uint32_t timeout_msec,
500 struct smbXcli_session *session,
501 struct smbXcli_tcon *tcon);
503 struct tevent_req *smb2cli_create_send(
504 TALLOC_CTX *mem_ctx,
505 struct tevent_context *ev,
506 struct smbXcli_conn *conn,
507 uint32_t timeout_msec,
508 struct smbXcli_session *session,
509 struct smbXcli_tcon *tcon,
510 const char *filename,
511 uint8_t oplock_level, /* SMB2_OPLOCK_LEVEL_* */
512 uint32_t impersonation_level, /* SMB2_IMPERSONATION_* */
513 uint32_t desired_access,
514 uint32_t file_attributes,
515 uint32_t share_access,
516 uint32_t create_disposition,
517 uint32_t create_options,
518 struct smb2_create_blobs *blobs);
519 NTSTATUS smb2cli_create_recv(struct tevent_req *req,
520 uint64_t *fid_persistent,
521 uint64_t *fid_volatile,
522 struct smb_create_returns *cr,
523 TALLOC_CTX *mem_ctx,
524 struct smb2_create_blobs *blobs);
525 NTSTATUS smb2cli_create(struct smbXcli_conn *conn,
526 uint32_t timeout_msec,
527 struct smbXcli_session *session,
528 struct smbXcli_tcon *tcon,
529 const char *filename,
530 uint8_t oplock_level, /* SMB2_OPLOCK_LEVEL_* */
531 uint32_t impersonation_level, /* SMB2_IMPERSONATION_* */
532 uint32_t desired_access,
533 uint32_t file_attributes,
534 uint32_t share_access,
535 uint32_t create_disposition,
536 uint32_t create_options,
537 struct smb2_create_blobs *blobs,
538 uint64_t *fid_persistent,
539 uint64_t *fid_volatile,
540 struct smb_create_returns *cr,
541 TALLOC_CTX *mem_ctx,
542 struct smb2_create_blobs *ret_blobs);
544 struct tevent_req *smb2cli_close_send(TALLOC_CTX *mem_ctx,
545 struct tevent_context *ev,
546 struct smbXcli_conn *conn,
547 uint32_t timeout_msec,
548 struct smbXcli_session *session,
549 struct smbXcli_tcon *tcon,
550 uint16_t flags,
551 uint64_t fid_persistent,
552 uint64_t fid_volatile);
553 NTSTATUS smb2cli_close_recv(struct tevent_req *req);
554 NTSTATUS smb2cli_close(struct smbXcli_conn *conn,
555 uint32_t timeout_msec,
556 struct smbXcli_session *session,
557 struct smbXcli_tcon *tcon,
558 uint16_t flags,
559 uint64_t fid_persistent,
560 uint64_t fid_volatile);
562 struct tevent_req *smb2cli_read_send(TALLOC_CTX *mem_ctx,
563 struct tevent_context *ev,
564 struct smbXcli_conn *conn,
565 uint32_t timeout_msec,
566 struct smbXcli_session *session,
567 struct smbXcli_tcon *tcon,
568 uint32_t length,
569 uint64_t offset,
570 uint64_t fid_persistent,
571 uint64_t fid_volatile,
572 uint64_t minimum_count,
573 uint64_t remaining_bytes);
574 NTSTATUS smb2cli_read_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
575 uint8_t **data, uint32_t *data_length);
576 NTSTATUS smb2cli_read(struct smbXcli_conn *conn,
577 uint32_t timeout_msec,
578 struct smbXcli_session *session,
579 struct smbXcli_tcon *tcon,
580 uint32_t length,
581 uint64_t offset,
582 uint64_t fid_persistent,
583 uint64_t fid_volatile,
584 uint64_t minimum_count,
585 uint64_t remaining_bytes,
586 TALLOC_CTX *mem_ctx,
587 uint8_t **data,
588 uint32_t *data_length);
590 struct tevent_req *smb2cli_write_send(TALLOC_CTX *mem_ctx,
591 struct tevent_context *ev,
592 struct smbXcli_conn *conn,
593 uint32_t timeout_msec,
594 struct smbXcli_session *session,
595 struct smbXcli_tcon *tcon,
596 uint32_t length,
597 uint64_t offset,
598 uint64_t fid_persistent,
599 uint64_t fid_volatile,
600 uint32_t remaining_bytes,
601 uint32_t flags,
602 const uint8_t *data);
603 NTSTATUS smb2cli_write_recv(struct tevent_req *req,
604 uint32_t *written);
605 NTSTATUS smb2cli_write(struct smbXcli_conn *conn,
606 uint32_t timeout_msec,
607 struct smbXcli_session *session,
608 struct smbXcli_tcon *tcon,
609 uint32_t length,
610 uint64_t offset,
611 uint64_t fid_persistent,
612 uint64_t fid_volatile,
613 uint32_t remaining_bytes,
614 uint32_t flags,
615 const uint8_t *data,
616 uint32_t *written);
618 struct tevent_req *smb2cli_flush_send(TALLOC_CTX *mem_ctx,
619 struct tevent_context *ev,
620 struct smbXcli_conn *conn,
621 uint32_t timeout_msec,
622 struct smbXcli_session *session,
623 struct smbXcli_tcon *tcon,
624 uint64_t fid_persistent,
625 uint64_t fid_volatile);
626 NTSTATUS smb2cli_flush_recv(struct tevent_req *req);
627 NTSTATUS smb2cli_flush(struct smbXcli_conn *conn,
628 uint32_t timeout_msec,
629 struct smbXcli_session *session,
630 struct smbXcli_tcon *tcon,
631 uint64_t fid_persistent,
632 uint64_t fid_volatile);
634 struct tevent_req *smb2cli_set_info_send(TALLOC_CTX *mem_ctx,
635 struct tevent_context *ev,
636 struct smbXcli_conn *conn,
637 uint32_t timeout_msec,
638 struct smbXcli_session *session,
639 struct smbXcli_tcon *tcon,
640 uint8_t in_info_type,
641 uint8_t in_file_info_class,
642 const DATA_BLOB *in_input_buffer,
643 uint32_t in_additional_info,
644 uint64_t in_fid_persistent,
645 uint64_t in_fid_volatile);
646 NTSTATUS smb2cli_set_info_recv(struct tevent_req *req);
647 NTSTATUS smb2cli_set_info(struct smbXcli_conn *conn,
648 uint32_t timeout_msec,
649 struct smbXcli_session *session,
650 struct smbXcli_tcon *tcon,
651 uint8_t in_info_type,
652 uint8_t in_file_info_class,
653 const DATA_BLOB *in_input_buffer,
654 uint32_t in_additional_info,
655 uint64_t in_fid_persistent,
656 uint64_t in_fid_volatile);
658 struct tevent_req *smb2cli_query_info_send(TALLOC_CTX *mem_ctx,
659 struct tevent_context *ev,
660 struct smbXcli_conn *conn,
661 uint32_t timeout_msec,
662 struct smbXcli_session *session,
663 struct smbXcli_tcon *tcon,
664 uint8_t in_info_type,
665 uint8_t in_file_info_class,
666 uint32_t in_max_output_length,
667 const DATA_BLOB *in_input_buffer,
668 uint32_t in_additional_info,
669 uint32_t in_flags,
670 uint64_t in_fid_persistent,
671 uint64_t in_fid_volatile);
672 NTSTATUS smb2cli_query_info_recv(struct tevent_req *req,
673 TALLOC_CTX *mem_ctx,
674 DATA_BLOB *out_output_buffer);
675 NTSTATUS smb2cli_query_info(struct smbXcli_conn *conn,
676 uint32_t timeout_msec,
677 struct smbXcli_session *session,
678 struct smbXcli_tcon *tcon,
679 uint8_t in_info_type,
680 uint8_t in_file_info_class,
681 uint32_t in_max_output_length,
682 const DATA_BLOB *in_input_buffer,
683 uint32_t in_additional_info,
684 uint32_t in_flags,
685 uint64_t in_fid_persistent,
686 uint64_t in_fid_volatile,
687 TALLOC_CTX *mem_ctx,
688 DATA_BLOB *out_output_buffer);
690 struct tevent_req *smb2cli_query_directory_send(TALLOC_CTX *mem_ctx,
691 struct tevent_context *ev,
692 struct smbXcli_conn *conn,
693 uint32_t timeout_msec,
694 struct smbXcli_session *session,
695 struct smbXcli_tcon *tcon,
696 uint8_t level,
697 uint8_t flags,
698 uint32_t file_index,
699 uint64_t fid_persistent,
700 uint64_t fid_volatile,
701 const char *mask,
702 uint32_t outbuf_len);
703 NTSTATUS smb2cli_query_directory_recv(struct tevent_req *req,
704 TALLOC_CTX *mem_ctx,
705 uint8_t **data,
706 uint32_t *data_length);
707 NTSTATUS smb2cli_query_directory(struct smbXcli_conn *conn,
708 uint32_t timeout_msec,
709 struct smbXcli_session *session,
710 struct smbXcli_tcon *tcon,
711 uint8_t level,
712 uint8_t flags,
713 uint32_t file_index,
714 uint64_t fid_persistent,
715 uint64_t fid_volatile,
716 const char *mask,
717 uint32_t outbuf_len,
718 TALLOC_CTX *mem_ctx,
719 uint8_t **data,
720 uint32_t *data_length);
722 struct tevent_req *smb2cli_ioctl_send(TALLOC_CTX *mem_ctx,
723 struct tevent_context *ev,
724 struct smbXcli_conn *conn,
725 uint32_t timeout_msec,
726 struct smbXcli_session *session,
727 struct smbXcli_tcon *tcon,
728 uint64_t in_fid_persistent,
729 uint64_t in_fid_volatile,
730 uint32_t in_ctl_code,
731 uint32_t in_max_input_length,
732 const DATA_BLOB *in_input_buffer,
733 uint32_t in_max_output_length,
734 const DATA_BLOB *in_output_buffer,
735 uint32_t in_flags);
736 NTSTATUS smb2cli_ioctl_recv(struct tevent_req *req,
737 TALLOC_CTX *mem_ctx,
738 DATA_BLOB *out_input_buffer,
739 DATA_BLOB *out_output_buffer);
740 NTSTATUS smb2cli_ioctl(struct smbXcli_conn *conn,
741 uint32_t timeout_msec,
742 struct smbXcli_session *session,
743 struct smbXcli_tcon *tcon,
744 uint64_t in_fid_persistent,
745 uint64_t in_fid_volatile,
746 uint32_t in_ctl_code,
747 uint32_t in_max_input_length,
748 const DATA_BLOB *in_input_buffer,
749 uint32_t in_max_output_length,
750 const DATA_BLOB *in_output_buffer,
751 uint32_t in_flags,
752 TALLOC_CTX *mem_ctx,
753 DATA_BLOB *out_input_buffer,
754 DATA_BLOB *out_output_buffer);
756 struct tevent_req *smb2cli_echo_send(TALLOC_CTX *mem_ctx,
757 struct tevent_context *ev,
758 struct smbXcli_conn *conn,
759 uint32_t timeout_msec);
760 NTSTATUS smb2cli_echo_recv(struct tevent_req *req);
761 NTSTATUS smb2cli_echo(struct smbXcli_conn *conn,
762 uint32_t timeout_msec);
764 #endif /* _SMBXCLI_BASE_H_ */