ctdbd_conn: Fix CID 1301580 Explicit null dereferenced
[Samba.git] / libcli / smb / smbXcli_base.h
blobcf93135cd9773674482b59fa15edc6a5c602d0eb
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);
306 uint8_t smb2cli_conn_get_io_priority(struct smbXcli_conn *conn);
307 void smb2cli_conn_set_io_priority(struct smbXcli_conn *conn,
308 uint8_t io_priority);
309 uint32_t smb2cli_conn_cc_chunk_len(struct smbXcli_conn *conn);
310 void smb2cli_conn_set_cc_chunk_len(struct smbXcli_conn *conn,
311 uint32_t chunk_len);
312 uint32_t smb2cli_conn_cc_max_chunks(struct smbXcli_conn *conn);
313 void smb2cli_conn_set_cc_max_chunks(struct smbXcli_conn *conn,
314 uint32_t max_chunks);
316 struct tevent_req *smb2cli_req_create(TALLOC_CTX *mem_ctx,
317 struct tevent_context *ev,
318 struct smbXcli_conn *conn,
319 uint16_t cmd,
320 uint32_t additional_flags,
321 uint32_t clear_flags,
322 uint32_t timeout_msec,
323 struct smbXcli_tcon *tcon,
324 struct smbXcli_session *session,
325 const uint8_t *fixed,
326 uint16_t fixed_len,
327 const uint8_t *dyn,
328 uint32_t dyn_len,
329 uint32_t max_dyn_len);
330 void smb2cli_req_set_notify_async(struct tevent_req *req);
331 NTSTATUS smb2cli_req_compound_submit(struct tevent_req **reqs,
332 int num_reqs);
333 void smb2cli_req_set_credit_charge(struct tevent_req *req, uint16_t charge);
335 struct smb2cli_req_expected_response {
336 NTSTATUS status;
337 uint16_t body_size;
340 struct tevent_req *smb2cli_req_send(TALLOC_CTX *mem_ctx,
341 struct tevent_context *ev,
342 struct smbXcli_conn *conn,
343 uint16_t cmd,
344 uint32_t additional_flags,
345 uint32_t clear_flags,
346 uint32_t timeout_msec,
347 struct smbXcli_tcon *tcon,
348 struct smbXcli_session *session,
349 const uint8_t *fixed,
350 uint16_t fixed_len,
351 const uint8_t *dyn,
352 uint32_t dyn_len,
353 uint32_t max_dyn_len);
354 NTSTATUS smb2cli_req_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
355 struct iovec **piov,
356 const struct smb2cli_req_expected_response *expected,
357 size_t num_expected);
360 * This expects an iov[3] array, that is filled with references to
361 * the buffers used for the sending the requests into the socket.
363 * This can only be called after smb2cli_req_recv(subreq) before
364 * the TALLOC_FREE(subreq).
366 NTSTATUS smb2cli_req_get_sent_iov(struct tevent_req *req,
367 struct iovec *sent_iov);
369 struct tevent_req *smbXcli_negprot_send(TALLOC_CTX *mem_ctx,
370 struct tevent_context *ev,
371 struct smbXcli_conn *conn,
372 uint32_t timeout_msec,
373 enum protocol_types min_protocol,
374 enum protocol_types max_protocol);
375 NTSTATUS smbXcli_negprot_recv(struct tevent_req *req);
376 NTSTATUS smbXcli_negprot(struct smbXcli_conn *conn,
377 uint32_t timeout_msec,
378 enum protocol_types min_protocol,
379 enum protocol_types max_protocol);
381 struct tevent_req *smb2cli_validate_negotiate_info_send(TALLOC_CTX *mem_ctx,
382 struct tevent_context *ev,
383 struct smbXcli_conn *conn,
384 uint32_t timeout_msec,
385 struct smbXcli_session *session,
386 struct smbXcli_tcon *tcon);
387 NTSTATUS smb2cli_validate_negotiate_info_recv(struct tevent_req *req);
389 struct smbXcli_session *smbXcli_session_create(TALLOC_CTX *mem_ctx,
390 struct smbXcli_conn *conn);
391 struct smbXcli_session *smbXcli_session_copy(TALLOC_CTX *mem_ctx,
392 struct smbXcli_session *src);
393 bool smbXcli_session_is_authenticated(struct smbXcli_session *session);
394 NTSTATUS smbXcli_session_application_key(struct smbXcli_session *session,
395 TALLOC_CTX *mem_ctx,
396 DATA_BLOB *key);
397 void smbXcli_session_set_disconnect_expired(struct smbXcli_session *session);
398 uint16_t smb1cli_session_current_id(struct smbXcli_session* session);
399 void smb1cli_session_set_id(struct smbXcli_session* session,
400 uint16_t session_id);
401 NTSTATUS smb1cli_session_set_session_key(struct smbXcli_session *session,
402 const DATA_BLOB _session_key);
403 NTSTATUS smb1cli_session_protect_session_key(struct smbXcli_session *session);
404 uint8_t smb2cli_session_security_mode(struct smbXcli_session *session);
405 uint64_t smb2cli_session_current_id(struct smbXcli_session *session);
406 uint16_t smb2cli_session_get_flags(struct smbXcli_session *session);
407 void smb2cli_session_set_id_and_flags(struct smbXcli_session *session,
408 uint64_t session_id,
409 uint16_t session_flags);
410 void smb2cli_session_increment_channel_sequence(struct smbXcli_session *session);
411 uint16_t smb2cli_session_reset_channel_sequence(struct smbXcli_session *session,
412 uint16_t channel_sequence);
413 void smb2cli_session_start_replay(struct smbXcli_session *session);
414 void smb2cli_session_stop_replay(struct smbXcli_session *session);
415 NTSTATUS smb2cli_session_update_preauth(struct smbXcli_session *session,
416 const struct iovec *iov);
417 NTSTATUS smb2cli_session_set_session_key(struct smbXcli_session *session,
418 const DATA_BLOB session_key,
419 const struct iovec *recv_iov);
420 NTSTATUS smb2cli_session_create_channel(TALLOC_CTX *mem_ctx,
421 struct smbXcli_session *session1,
422 struct smbXcli_conn *conn,
423 struct smbXcli_session **_session2);
424 NTSTATUS smb2cli_session_set_channel_key(struct smbXcli_session *session,
425 const DATA_BLOB channel_key,
426 const struct iovec *recv_iov);
427 NTSTATUS smb2cli_session_encryption_on(struct smbXcli_session *session);
429 struct smbXcli_tcon *smbXcli_tcon_create(TALLOC_CTX *mem_ctx);
430 void smbXcli_tcon_set_fs_attributes(struct smbXcli_tcon *tcon,
431 uint32_t fs_attributes);
432 uint32_t smbXcli_tcon_get_fs_attributes(struct smbXcli_tcon *tcon);
433 bool smbXcli_tcon_is_dfs_share(struct smbXcli_tcon *tcon);
434 uint16_t smb1cli_tcon_current_id(struct smbXcli_tcon *tcon);
435 void smb1cli_tcon_set_id(struct smbXcli_tcon *tcon, uint16_t tcon_id);
436 bool smb1cli_tcon_set_values(struct smbXcli_tcon *tcon,
437 uint16_t tcon_id,
438 uint16_t optional_support,
439 uint32_t maximal_access,
440 uint32_t guest_maximal_access,
441 const char *service,
442 const char *fs_type);
443 uint32_t smb2cli_tcon_current_id(struct smbXcli_tcon *tcon);
444 uint32_t smb2cli_tcon_capabilities(struct smbXcli_tcon *tcon);
445 void smb2cli_tcon_set_values(struct smbXcli_tcon *tcon,
446 struct smbXcli_session *session,
447 uint32_t tcon_id,
448 uint8_t type,
449 uint32_t flags,
450 uint32_t capabilities,
451 uint32_t maximal_access);
452 void smb2cli_tcon_should_sign(struct smbXcli_tcon *tcon,
453 bool should_sign);
454 bool smb2cli_tcon_is_signing_on(struct smbXcli_tcon *tcon);
455 void smb2cli_tcon_should_encrypt(struct smbXcli_tcon *tcon,
456 bool should_encrypt);
457 bool smb2cli_tcon_is_encryption_on(struct smbXcli_tcon *tcon);
459 struct tevent_req *smb2cli_session_setup_send(TALLOC_CTX *mem_ctx,
460 struct tevent_context *ev,
461 struct smbXcli_conn *conn,
462 uint32_t timeout_msec,
463 struct smbXcli_session *session,
464 uint8_t in_flags,
465 uint32_t in_capabilities,
466 uint32_t in_channel,
467 uint64_t in_previous_session_id,
468 const DATA_BLOB *in_security_buffer);
469 NTSTATUS smb2cli_session_setup_recv(struct tevent_req *req,
470 TALLOC_CTX *mem_ctx,
471 struct iovec **recv_iov,
472 DATA_BLOB *out_security_buffer);
474 struct tevent_req *smb2cli_logoff_send(TALLOC_CTX *mem_ctx,
475 struct tevent_context *ev,
476 struct smbXcli_conn *conn,
477 uint32_t timeout_msec,
478 struct smbXcli_session *session);
479 NTSTATUS smb2cli_logoff_recv(struct tevent_req *req);
480 NTSTATUS smb2cli_logoff(struct smbXcli_conn *conn,
481 uint32_t timeout_msec,
482 struct smbXcli_session *session);
484 struct tevent_req *smb2cli_tcon_send(TALLOC_CTX *mem_ctx,
485 struct tevent_context *ev,
486 struct smbXcli_conn *conn,
487 uint32_t timeout_msec,
488 struct smbXcli_session *session,
489 struct smbXcli_tcon *tcon,
490 uint16_t flags,
491 const char *unc);
492 NTSTATUS smb2cli_tcon_recv(struct tevent_req *req);
493 NTSTATUS smb2cli_tcon(struct smbXcli_conn *conn,
494 uint32_t timeout_msec,
495 struct smbXcli_session *session,
496 struct smbXcli_tcon *tcon,
497 uint16_t flags,
498 const char *unc);
500 struct tevent_req *smb2cli_tdis_send(TALLOC_CTX *mem_ctx,
501 struct tevent_context *ev,
502 struct smbXcli_conn *conn,
503 uint32_t timeout_msec,
504 struct smbXcli_session *session,
505 struct smbXcli_tcon *tcon);
506 NTSTATUS smb2cli_tdis_recv(struct tevent_req *req);
507 NTSTATUS smb2cli_tdis(struct smbXcli_conn *conn,
508 uint32_t timeout_msec,
509 struct smbXcli_session *session,
510 struct smbXcli_tcon *tcon);
512 struct tevent_req *smb2cli_create_send(
513 TALLOC_CTX *mem_ctx,
514 struct tevent_context *ev,
515 struct smbXcli_conn *conn,
516 uint32_t timeout_msec,
517 struct smbXcli_session *session,
518 struct smbXcli_tcon *tcon,
519 const char *filename,
520 uint8_t oplock_level, /* SMB2_OPLOCK_LEVEL_* */
521 uint32_t impersonation_level, /* SMB2_IMPERSONATION_* */
522 uint32_t desired_access,
523 uint32_t file_attributes,
524 uint32_t share_access,
525 uint32_t create_disposition,
526 uint32_t create_options,
527 struct smb2_create_blobs *blobs);
528 NTSTATUS smb2cli_create_recv(struct tevent_req *req,
529 uint64_t *fid_persistent,
530 uint64_t *fid_volatile,
531 struct smb_create_returns *cr,
532 TALLOC_CTX *mem_ctx,
533 struct smb2_create_blobs *blobs);
534 NTSTATUS smb2cli_create(struct smbXcli_conn *conn,
535 uint32_t timeout_msec,
536 struct smbXcli_session *session,
537 struct smbXcli_tcon *tcon,
538 const char *filename,
539 uint8_t oplock_level, /* SMB2_OPLOCK_LEVEL_* */
540 uint32_t impersonation_level, /* SMB2_IMPERSONATION_* */
541 uint32_t desired_access,
542 uint32_t file_attributes,
543 uint32_t share_access,
544 uint32_t create_disposition,
545 uint32_t create_options,
546 struct smb2_create_blobs *blobs,
547 uint64_t *fid_persistent,
548 uint64_t *fid_volatile,
549 struct smb_create_returns *cr,
550 TALLOC_CTX *mem_ctx,
551 struct smb2_create_blobs *ret_blobs);
553 struct tevent_req *smb2cli_close_send(TALLOC_CTX *mem_ctx,
554 struct tevent_context *ev,
555 struct smbXcli_conn *conn,
556 uint32_t timeout_msec,
557 struct smbXcli_session *session,
558 struct smbXcli_tcon *tcon,
559 uint16_t flags,
560 uint64_t fid_persistent,
561 uint64_t fid_volatile);
562 NTSTATUS smb2cli_close_recv(struct tevent_req *req);
563 NTSTATUS smb2cli_close(struct smbXcli_conn *conn,
564 uint32_t timeout_msec,
565 struct smbXcli_session *session,
566 struct smbXcli_tcon *tcon,
567 uint16_t flags,
568 uint64_t fid_persistent,
569 uint64_t fid_volatile);
571 struct tevent_req *smb2cli_read_send(TALLOC_CTX *mem_ctx,
572 struct tevent_context *ev,
573 struct smbXcli_conn *conn,
574 uint32_t timeout_msec,
575 struct smbXcli_session *session,
576 struct smbXcli_tcon *tcon,
577 uint32_t length,
578 uint64_t offset,
579 uint64_t fid_persistent,
580 uint64_t fid_volatile,
581 uint64_t minimum_count,
582 uint64_t remaining_bytes);
583 NTSTATUS smb2cli_read_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
584 uint8_t **data, uint32_t *data_length);
585 NTSTATUS smb2cli_read(struct smbXcli_conn *conn,
586 uint32_t timeout_msec,
587 struct smbXcli_session *session,
588 struct smbXcli_tcon *tcon,
589 uint32_t length,
590 uint64_t offset,
591 uint64_t fid_persistent,
592 uint64_t fid_volatile,
593 uint64_t minimum_count,
594 uint64_t remaining_bytes,
595 TALLOC_CTX *mem_ctx,
596 uint8_t **data,
597 uint32_t *data_length);
599 struct tevent_req *smb2cli_write_send(TALLOC_CTX *mem_ctx,
600 struct tevent_context *ev,
601 struct smbXcli_conn *conn,
602 uint32_t timeout_msec,
603 struct smbXcli_session *session,
604 struct smbXcli_tcon *tcon,
605 uint32_t length,
606 uint64_t offset,
607 uint64_t fid_persistent,
608 uint64_t fid_volatile,
609 uint32_t remaining_bytes,
610 uint32_t flags,
611 const uint8_t *data);
612 NTSTATUS smb2cli_write_recv(struct tevent_req *req,
613 uint32_t *written);
614 NTSTATUS smb2cli_write(struct smbXcli_conn *conn,
615 uint32_t timeout_msec,
616 struct smbXcli_session *session,
617 struct smbXcli_tcon *tcon,
618 uint32_t length,
619 uint64_t offset,
620 uint64_t fid_persistent,
621 uint64_t fid_volatile,
622 uint32_t remaining_bytes,
623 uint32_t flags,
624 const uint8_t *data,
625 uint32_t *written);
627 struct tevent_req *smb2cli_flush_send(TALLOC_CTX *mem_ctx,
628 struct tevent_context *ev,
629 struct smbXcli_conn *conn,
630 uint32_t timeout_msec,
631 struct smbXcli_session *session,
632 struct smbXcli_tcon *tcon,
633 uint64_t fid_persistent,
634 uint64_t fid_volatile);
635 NTSTATUS smb2cli_flush_recv(struct tevent_req *req);
636 NTSTATUS smb2cli_flush(struct smbXcli_conn *conn,
637 uint32_t timeout_msec,
638 struct smbXcli_session *session,
639 struct smbXcli_tcon *tcon,
640 uint64_t fid_persistent,
641 uint64_t fid_volatile);
643 struct tevent_req *smb2cli_set_info_send(TALLOC_CTX *mem_ctx,
644 struct tevent_context *ev,
645 struct smbXcli_conn *conn,
646 uint32_t timeout_msec,
647 struct smbXcli_session *session,
648 struct smbXcli_tcon *tcon,
649 uint8_t in_info_type,
650 uint8_t in_file_info_class,
651 const DATA_BLOB *in_input_buffer,
652 uint32_t in_additional_info,
653 uint64_t in_fid_persistent,
654 uint64_t in_fid_volatile);
655 NTSTATUS smb2cli_set_info_recv(struct tevent_req *req);
656 NTSTATUS smb2cli_set_info(struct smbXcli_conn *conn,
657 uint32_t timeout_msec,
658 struct smbXcli_session *session,
659 struct smbXcli_tcon *tcon,
660 uint8_t in_info_type,
661 uint8_t in_file_info_class,
662 const DATA_BLOB *in_input_buffer,
663 uint32_t in_additional_info,
664 uint64_t in_fid_persistent,
665 uint64_t in_fid_volatile);
667 struct tevent_req *smb2cli_query_info_send(TALLOC_CTX *mem_ctx,
668 struct tevent_context *ev,
669 struct smbXcli_conn *conn,
670 uint32_t timeout_msec,
671 struct smbXcli_session *session,
672 struct smbXcli_tcon *tcon,
673 uint8_t in_info_type,
674 uint8_t in_file_info_class,
675 uint32_t in_max_output_length,
676 const DATA_BLOB *in_input_buffer,
677 uint32_t in_additional_info,
678 uint32_t in_flags,
679 uint64_t in_fid_persistent,
680 uint64_t in_fid_volatile);
681 NTSTATUS smb2cli_query_info_recv(struct tevent_req *req,
682 TALLOC_CTX *mem_ctx,
683 DATA_BLOB *out_output_buffer);
684 NTSTATUS smb2cli_query_info(struct smbXcli_conn *conn,
685 uint32_t timeout_msec,
686 struct smbXcli_session *session,
687 struct smbXcli_tcon *tcon,
688 uint8_t in_info_type,
689 uint8_t in_file_info_class,
690 uint32_t in_max_output_length,
691 const DATA_BLOB *in_input_buffer,
692 uint32_t in_additional_info,
693 uint32_t in_flags,
694 uint64_t in_fid_persistent,
695 uint64_t in_fid_volatile,
696 TALLOC_CTX *mem_ctx,
697 DATA_BLOB *out_output_buffer);
699 struct tevent_req *smb2cli_query_directory_send(TALLOC_CTX *mem_ctx,
700 struct tevent_context *ev,
701 struct smbXcli_conn *conn,
702 uint32_t timeout_msec,
703 struct smbXcli_session *session,
704 struct smbXcli_tcon *tcon,
705 uint8_t level,
706 uint8_t flags,
707 uint32_t file_index,
708 uint64_t fid_persistent,
709 uint64_t fid_volatile,
710 const char *mask,
711 uint32_t outbuf_len);
712 NTSTATUS smb2cli_query_directory_recv(struct tevent_req *req,
713 TALLOC_CTX *mem_ctx,
714 uint8_t **data,
715 uint32_t *data_length);
716 NTSTATUS smb2cli_query_directory(struct smbXcli_conn *conn,
717 uint32_t timeout_msec,
718 struct smbXcli_session *session,
719 struct smbXcli_tcon *tcon,
720 uint8_t level,
721 uint8_t flags,
722 uint32_t file_index,
723 uint64_t fid_persistent,
724 uint64_t fid_volatile,
725 const char *mask,
726 uint32_t outbuf_len,
727 TALLOC_CTX *mem_ctx,
728 uint8_t **data,
729 uint32_t *data_length);
731 struct tevent_req *smb2cli_ioctl_send(TALLOC_CTX *mem_ctx,
732 struct tevent_context *ev,
733 struct smbXcli_conn *conn,
734 uint32_t timeout_msec,
735 struct smbXcli_session *session,
736 struct smbXcli_tcon *tcon,
737 uint64_t in_fid_persistent,
738 uint64_t in_fid_volatile,
739 uint32_t in_ctl_code,
740 uint32_t in_max_input_length,
741 const DATA_BLOB *in_input_buffer,
742 uint32_t in_max_output_length,
743 const DATA_BLOB *in_output_buffer,
744 uint32_t in_flags);
745 NTSTATUS smb2cli_ioctl_recv(struct tevent_req *req,
746 TALLOC_CTX *mem_ctx,
747 DATA_BLOB *out_input_buffer,
748 DATA_BLOB *out_output_buffer);
749 NTSTATUS smb2cli_ioctl(struct smbXcli_conn *conn,
750 uint32_t timeout_msec,
751 struct smbXcli_session *session,
752 struct smbXcli_tcon *tcon,
753 uint64_t in_fid_persistent,
754 uint64_t in_fid_volatile,
755 uint32_t in_ctl_code,
756 uint32_t in_max_input_length,
757 const DATA_BLOB *in_input_buffer,
758 uint32_t in_max_output_length,
759 const DATA_BLOB *in_output_buffer,
760 uint32_t in_flags,
761 TALLOC_CTX *mem_ctx,
762 DATA_BLOB *out_input_buffer,
763 DATA_BLOB *out_output_buffer);
765 struct tevent_req *smb2cli_echo_send(TALLOC_CTX *mem_ctx,
766 struct tevent_context *ev,
767 struct smbXcli_conn *conn,
768 uint32_t timeout_msec);
769 NTSTATUS smb2cli_echo_recv(struct tevent_req *req);
770 NTSTATUS smb2cli_echo(struct smbXcli_conn *conn,
771 uint32_t timeout_msec);
773 #endif /* _SMBXCLI_BASE_H_ */