2 Unix SMB/CIFS implementation.
4 Copyright (C) Andrew Bartlett 2001-2003
5 Copyright (C) Andrew Tridgell 1994-1998,2000-2001
6 Copyright (C) Gerald (Jerry) Carter 2004
7 Copyright (C) Jelmer Vernooij 2003
8 Copyright (C) Jeremy Allison 2001-2009,2011
9 Copyright (C) Stefan Metzmacher 2003,2009
10 Copyright (C) Volker Lendecke 2011
12 This program is free software; you can redistribute it and/or modify
13 it under the terms of the GNU General Public License as published by
14 the Free Software Foundation; either version 3 of the License, or
15 (at your option) any later version.
17 This program is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License for more details.
22 You should have received a copy of the GNU General Public License
23 along with this program. If not, see <http://www.gnu.org/licenses/>.
26 #ifndef _LIBSMB_PROTO_H_
27 #define _LIBSMB_PROTO_H_
29 struct smb_trans_enc_state
;
30 struct cli_credentials
;
33 struct print_job_info
;
35 /* The following definitions come from libsmb/cliconnect.c */
37 struct cli_credentials
*cli_session_creds_init(TALLOC_CTX
*mem_ctx
,
43 bool fallback_after_kerberos
,
45 bool password_is_nt_hash
);
46 NTSTATUS
cli_session_creds_prepare_krb5(struct cli_state
*cli
,
47 struct cli_credentials
*creds
);
48 struct tevent_req
*cli_session_setup_creds_send(TALLOC_CTX
*mem_ctx
,
49 struct tevent_context
*ev
,
50 struct cli_state
*cli
,
51 struct cli_credentials
*creds
);
52 NTSTATUS
cli_session_setup_creds_recv(struct tevent_req
*req
);
53 NTSTATUS
cli_session_setup_creds(struct cli_state
*cli
,
54 struct cli_credentials
*creds
);
55 NTSTATUS
cli_session_setup_anon(struct cli_state
*cli
);
56 struct tevent_req
*cli_session_setup_guest_create(TALLOC_CTX
*mem_ctx
,
57 struct tevent_context
*ev
,
58 struct cli_state
*cli
,
59 struct tevent_req
**psmbreq
);
60 struct tevent_req
*cli_session_setup_guest_send(TALLOC_CTX
*mem_ctx
,
61 struct tevent_context
*ev
,
62 struct cli_state
*cli
);
63 NTSTATUS
cli_session_setup_guest_recv(struct tevent_req
*req
);
64 NTSTATUS
cli_ulogoff(struct cli_state
*cli
);
65 struct tevent_req
*cli_tcon_andx_create(TALLOC_CTX
*mem_ctx
,
66 struct tevent_context
*ev
,
67 struct cli_state
*cli
,
68 const char *share
, const char *dev
,
69 const char *pass
, int passlen
,
70 struct tevent_req
**psmbreq
);
71 struct tevent_req
*cli_tcon_andx_send(TALLOC_CTX
*mem_ctx
,
72 struct tevent_context
*ev
,
73 struct cli_state
*cli
,
74 const char *share
, const char *dev
,
75 const char *pass
, int passlen
);
76 NTSTATUS
cli_tcon_andx_recv(struct tevent_req
*req
);
77 NTSTATUS
cli_tcon_andx(struct cli_state
*cli
, const char *share
,
78 const char *dev
, const char *pass
, int passlen
);
79 NTSTATUS
cli_tree_connect_creds(struct cli_state
*cli
,
80 const char *share
, const char *dev
,
81 struct cli_credentials
*creds
);
82 NTSTATUS
cli_tree_connect(struct cli_state
*cli
, const char *share
,
83 const char *dev
, const char *pass
);
84 NTSTATUS
cli_tdis(struct cli_state
*cli
);
85 NTSTATUS
cli_connect_nb(TALLOC_CTX
*mem_ctx
,
87 const struct sockaddr_storage
*dest_ss
,
91 enum smb_signing_setting signing_state
,
93 struct cli_state
**pcli
);
94 NTSTATUS
cli_start_connection(TALLOC_CTX
*mem_ctx
,
95 struct cli_state
**output_cli
,
97 const char *dest_host
,
98 const struct sockaddr_storage
*dest_ss
, int port
,
99 enum smb_signing_setting signing_state
, int flags
);
100 NTSTATUS
cli_smb1_setup_encryption(struct cli_state
*cli
,
101 struct cli_credentials
*creds
);
103 struct smb2_negotiate_contexts
;
104 struct tevent_req
*cli_full_connection_creds_send(
105 TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
106 const char *my_name
, const char *dest_host
,
107 const struct sockaddr_storage
*dest_ss
, int port
,
108 const char *service
, const char *service_type
,
109 struct cli_credentials
*creds
,
111 struct smb2_negotiate_contexts
*negotiate_contexts
);
112 NTSTATUS
cli_full_connection_creds_recv(struct tevent_req
*req
,
114 struct cli_state
**output_cli
);
115 NTSTATUS
cli_full_connection_creds(TALLOC_CTX
*mem_ctx
,
116 struct cli_state
**output_cli
,
118 const char *dest_host
,
119 const struct sockaddr_storage
*dest_ss
, int port
,
120 const char *service
, const char *service_type
,
121 struct cli_credentials
*creds
,
123 NTSTATUS
cli_raw_tcon(struct cli_state
*cli
,
124 const char *service
, const char *pass
, const char *dev
,
125 uint16_t *max_xmit
, uint16_t *tid
);
126 struct cli_state
*get_ipc_connect_master_ip(TALLOC_CTX
*ctx
,
127 struct sockaddr_storage
*mb_ip
,
128 struct cli_credentials
*creds
,
129 char **pp_workgroup_out
);
131 /* The following definitions come from libsmb/clidfs.c */
133 NTSTATUS
cli_cm_open(TALLOC_CTX
*ctx
,
134 struct cli_state
*referring_cli
,
137 struct cli_credentials
*creds
,
138 const struct sockaddr_storage
*dest_ss
,
141 struct cli_state
**pcli
);
142 void cli_cm_display(struct cli_state
*c
);
143 struct client_dfs_referral
;
144 bool cli_dfs_is_already_full_path(struct cli_state
*cli
, const char *path
);
145 NTSTATUS
cli_dfs_get_referral_ex(TALLOC_CTX
*ctx
,
146 struct cli_state
*cli
,
148 uint16_t max_referral_level
,
149 struct client_dfs_referral
**refs
,
152 NTSTATUS
cli_dfs_get_referral(TALLOC_CTX
*ctx
,
153 struct cli_state
*cli
,
155 struct client_dfs_referral
**refs
,
158 NTSTATUS
cli_resolve_path(TALLOC_CTX
*ctx
,
160 struct cli_credentials
*creds
,
161 struct cli_state
*rootcli
,
163 struct cli_state
**targetcli
,
164 char **pp_targetpath
);
166 bool cli_check_msdfs_proxy(TALLOC_CTX
*ctx
,
167 struct cli_state
*cli
,
168 const char *sharename
,
171 struct cli_credentials
*creds
);
173 NTSTATUS
cli_dfs_target_check(TALLOC_CTX
*mem_ctx
,
174 struct cli_state
*cli
,
175 const char *fname_dst
,
176 const char **fname_dst_out
);
177 char *smb1_dfs_share_path(TALLOC_CTX
*ctx
,
178 struct cli_state
*cli
,
181 /* The following definitions come from libsmb/clientgen.c */
183 unsigned int cli_set_timeout(struct cli_state
*cli
, unsigned int timeout
);
184 bool cli_set_backup_intent(struct cli_state
*cli
, bool flag
);
185 extern struct GUID cli_state_client_guid
;
186 struct cli_state
*cli_state_create(TALLOC_CTX
*mem_ctx
,
188 const char *remote_name
,
189 enum smb_signing_setting signing_state
,
191 void cli_shutdown(struct cli_state
*cli
);
192 uint16_t cli_state_get_vc_num(struct cli_state
*cli
);
193 uint32_t cli_setpid(struct cli_state
*cli
, uint32_t pid
);
194 uint32_t cli_getpid(struct cli_state
*cli
);
195 bool cli_state_is_encryption_on(struct cli_state
*cli
);
196 bool cli_state_has_tcon(struct cli_state
*cli
);
197 uint32_t cli_state_get_tid(struct cli_state
*cli
);
198 uint32_t cli_state_set_tid(struct cli_state
*cli
, uint32_t tid
);
200 void cli_state_save_tcon_share(struct cli_state
*cli
,
201 struct smbXcli_tcon
**_tcon_ret
,
203 void cli_state_restore_tcon_share(struct cli_state
*cli
,
204 struct smbXcli_tcon
*tcon
,
206 uint16_t cli_state_get_uid(struct cli_state
*cli
);
207 uint16_t cli_state_set_uid(struct cli_state
*cli
, uint16_t uid
);
208 bool cli_set_case_sensitive(struct cli_state
*cli
, bool case_sensitive
);
209 uint32_t cli_state_available_size(struct cli_state
*cli
, uint32_t ofs
);
210 time_t cli_state_server_time(struct cli_state
*cli
);
211 struct tevent_req
*cli_echo_send(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
212 struct cli_state
*cli
, uint16_t num_echos
,
214 NTSTATUS
cli_echo_recv(struct tevent_req
*req
);
215 NTSTATUS
cli_echo(struct cli_state
*cli
, uint16_t num_echos
, DATA_BLOB data
);
216 NTSTATUS
cli_smb(TALLOC_CTX
*mem_ctx
, struct cli_state
*cli
,
217 uint8_t smb_command
, uint8_t additional_flags
,
218 uint8_t wct
, uint16_t *vwv
,
219 uint32_t num_bytes
, const uint8_t *bytes
,
220 struct tevent_req
**result_parent
,
221 uint8_t min_wct
, uint8_t *pwct
, uint16_t **pvwv
,
222 uint32_t *pnum_bytes
, uint8_t **pbytes
);
224 /* The following definitions come from libsmb/clierror.c */
226 NTSTATUS
cli_nt_error(struct cli_state
*cli
);
227 int cli_status_to_errno(NTSTATUS status
);
228 int cli_errno(struct cli_state
*cli
);
229 bool cli_is_error(struct cli_state
*cli
);
230 bool cli_state_is_connected(struct cli_state
*cli
);
232 /* The following definitions come from libsmb/clifile.c */
234 struct tevent_req
*cli_setpathinfo_send(TALLOC_CTX
*mem_ctx
,
235 struct tevent_context
*ev
,
236 struct cli_state
*cli
,
241 NTSTATUS
cli_setpathinfo_recv(struct tevent_req
*req
);
242 NTSTATUS
cli_setpathinfo(struct cli_state
*cli
,
247 struct tevent_req
*cli_setfileinfo_send(
249 struct tevent_context
*ev
,
250 struct cli_state
*cli
,
255 NTSTATUS
cli_setfileinfo_recv(struct tevent_req
*req
);
257 struct tevent_req
*cli_posix_symlink_send(TALLOC_CTX
*mem_ctx
,
258 struct tevent_context
*ev
,
259 struct cli_state
*cli
,
261 const char *newname
);
262 NTSTATUS
cli_posix_symlink_recv(struct tevent_req
*req
);
263 NTSTATUS
cli_posix_symlink(struct cli_state
*cli
,
265 const char *newname
);
266 struct tevent_req
*cli_posix_readlink_send(TALLOC_CTX
*mem_ctx
,
267 struct tevent_context
*ev
,
268 struct cli_state
*cli
,
270 NTSTATUS
cli_posix_readlink_recv(
271 struct tevent_req
*req
, TALLOC_CTX
*mem_ctx
, char **target
);
272 struct tevent_req
*cli_posix_hardlink_send(TALLOC_CTX
*mem_ctx
,
273 struct tevent_context
*ev
,
274 struct cli_state
*cli
,
276 const char *newname
);
277 NTSTATUS
cli_posix_hardlink_recv(struct tevent_req
*req
);
278 NTSTATUS
cli_posix_hardlink(struct cli_state
*cli
,
280 const char *newname
);
281 uint32_t unix_perms_to_wire(mode_t perms
);
282 mode_t
wire_perms_to_unix(uint32_t perms
);
283 struct tevent_req
*cli_posix_getacl_send(TALLOC_CTX
*mem_ctx
,
284 struct tevent_context
*ev
,
285 struct cli_state
*cli
,
287 NTSTATUS
cli_posix_getacl_recv(struct tevent_req
*req
,
291 NTSTATUS
cli_posix_getacl(struct cli_state
*cli
,
296 struct tevent_req
*cli_posix_setacl_send(TALLOC_CTX
*mem_ctx
,
297 struct tevent_context
*ev
,
298 struct cli_state
*cli
,
301 size_t acl_buf_size
);
302 NTSTATUS
cli_posix_setacl_recv(struct tevent_req
*req
);
303 NTSTATUS
cli_posix_setacl(struct cli_state
*cli
,
306 size_t acl_buf_size
);
307 struct tevent_req
*cli_posix_stat_send(TALLOC_CTX
*mem_ctx
,
308 struct tevent_context
*ev
,
309 struct cli_state
*cli
,
311 NTSTATUS
cli_posix_stat_recv(struct tevent_req
*req
, struct stat_ex
*sbuf
);
312 NTSTATUS
cli_posix_stat(struct cli_state
*cli
,
314 struct stat_ex
*sbuf
);
315 struct tevent_req
*cli_posix_chmod_send(TALLOC_CTX
*mem_ctx
,
316 struct tevent_context
*ev
,
317 struct cli_state
*cli
,
320 NTSTATUS
cli_posix_chmod_recv(struct tevent_req
*req
);
321 NTSTATUS
cli_posix_chmod(struct cli_state
*cli
, const char *fname
, mode_t mode
);
322 struct tevent_req
*cli_posix_chown_send(TALLOC_CTX
*mem_ctx
,
323 struct tevent_context
*ev
,
324 struct cli_state
*cli
,
328 NTSTATUS
cli_posix_chown_recv(struct tevent_req
*req
);
329 NTSTATUS
cli_posix_chown(struct cli_state
*cli
,
333 struct tevent_req
*cli_mknod_send(
335 struct tevent_context
*ev
,
336 struct cli_state
*cli
,
340 NTSTATUS
cli_mknod_recv(struct tevent_req
*req
);
342 cli_mknod(struct cli_state
*cli
, const char *fname
, mode_t mode
, dev_t dev
);
343 struct tevent_req
*cli_rename_send(TALLOC_CTX
*mem_ctx
,
344 struct tevent_context
*ev
,
345 struct cli_state
*cli
,
346 const char *fname_src
,
347 const char *fname_dst
,
349 NTSTATUS
cli_rename_recv(struct tevent_req
*req
);
350 NTSTATUS
cli_rename(struct cli_state
*cli
,
351 const char *fname_src
,
352 const char *fname_dst
,
354 struct tevent_req
*cli_ntrename_send(TALLOC_CTX
*mem_ctx
,
355 struct tevent_context
*ev
,
356 struct cli_state
*cli
,
357 const char *fname_src
,
358 const char *fname_dst
);
359 NTSTATUS
cli_ntrename_recv(struct tevent_req
*req
);
360 NTSTATUS
cli_ntrename(struct cli_state
*cli
, const char *fname_src
, const char *fname_dst
);
362 struct tevent_req
*cli_hardlink_send(
364 struct tevent_context
*ev
,
365 struct cli_state
*cli
,
366 const char *fname_src
,
367 const char *fname_dst
);
368 NTSTATUS
cli_hardlink_recv(struct tevent_req
*req
);
369 NTSTATUS
cli_hardlink(
370 struct cli_state
*cli
,
371 const char *fname_src
,
372 const char *fname_dst
);
374 struct tevent_req
*cli_unlink_send(TALLOC_CTX
*mem_ctx
,
375 struct tevent_context
*ev
,
376 struct cli_state
*cli
,
378 uint32_t mayhave_attrs
);
379 NTSTATUS
cli_unlink_recv(struct tevent_req
*req
);
380 NTSTATUS
cli_unlink(struct cli_state
*cli
, const char *fname
, uint32_t mayhave_attrs
);
382 struct tevent_req
*cli_mkdir_send(TALLOC_CTX
*mem_ctx
,
383 struct tevent_context
*ev
,
384 struct cli_state
*cli
,
386 NTSTATUS
cli_mkdir_recv(struct tevent_req
*req
);
387 NTSTATUS
cli_mkdir(struct cli_state
*cli
, const char *dname
);
388 struct tevent_req
*cli_rmdir_send(TALLOC_CTX
*mem_ctx
,
389 struct tevent_context
*ev
,
390 struct cli_state
*cli
,
392 NTSTATUS
cli_rmdir_recv(struct tevent_req
*req
);
393 NTSTATUS
cli_rmdir(struct cli_state
*cli
, const char *dname
);
394 struct tevent_req
*cli_nt_delete_on_close_send(TALLOC_CTX
*mem_ctx
,
395 struct tevent_context
*ev
,
396 struct cli_state
*cli
,
399 NTSTATUS
cli_nt_delete_on_close_recv(struct tevent_req
*req
);
400 NTSTATUS
cli_nt_delete_on_close(struct cli_state
*cli
, uint16_t fnum
, bool flag
);
401 struct tevent_req
*cli_ntcreate_send(TALLOC_CTX
*mem_ctx
,
402 struct tevent_context
*ev
,
403 struct cli_state
*cli
,
406 uint32_t DesiredAccess
,
407 uint32_t FileAttributes
,
408 uint32_t ShareAccess
,
409 uint32_t CreateDisposition
,
410 uint32_t CreateOptions
,
411 uint32_t ImpersonationLevel
,
412 uint8_t SecurityFlags
);
413 NTSTATUS
cli_ntcreate_recv(struct tevent_req
*req
,
415 struct smb_create_returns
*cr
);
416 NTSTATUS
cli_ntcreate(struct cli_state
*cli
,
419 uint32_t DesiredAccess
,
420 uint32_t FileAttributes
,
421 uint32_t ShareAccess
,
422 uint32_t CreateDisposition
,
423 uint32_t CreateOptions
,
424 uint8_t SecurityFlags
,
426 struct smb_create_returns
*cr
);
427 struct tevent_req
*cli_openx_create(TALLOC_CTX
*mem_ctx
,
428 struct tevent_context
*ev
,
429 struct cli_state
*cli
, const char *fname
,
430 int flags
, int share_mode
,
431 struct tevent_req
**psmbreq
);
432 struct tevent_req
*cli_openx_send(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
433 struct cli_state
*cli
, const char *fname
,
434 int flags
, int share_mode
);
435 NTSTATUS
cli_openx_recv(struct tevent_req
*req
, uint16_t *fnum
);
436 NTSTATUS
cli_openx(struct cli_state
*cli
, const char *fname
, int flags
, int share_mode
, uint16_t *pfnum
);
437 NTSTATUS
cli_open(struct cli_state
*cli
, const char *fname
, int flags
, int share_mode
, uint16_t *pfnum
);
438 struct tevent_req
*cli_smb1_close_create(TALLOC_CTX
*mem_ctx
,
439 struct tevent_context
*ev
,
440 struct cli_state
*cli
, uint16_t fnum
,
441 struct tevent_req
**psubreq
);
442 struct tevent_req
*cli_close_send(TALLOC_CTX
*mem_ctx
,
443 struct tevent_context
*ev
,
444 struct cli_state
*cli
,
447 NTSTATUS
cli_close_recv(struct tevent_req
*req
);
448 NTSTATUS
cli_close(struct cli_state
*cli
, uint16_t fnum
);
449 struct tevent_req
*cli_ftruncate_send(TALLOC_CTX
*mem_ctx
,
450 struct tevent_context
*ev
,
451 struct cli_state
*cli
,
454 NTSTATUS
cli_ftruncate_recv(struct tevent_req
*req
);
455 NTSTATUS
cli_ftruncate(struct cli_state
*cli
, uint16_t fnum
, uint64_t size
);
456 NTSTATUS
cli_locktype(struct cli_state
*cli
, uint16_t fnum
,
457 uint32_t offset
, uint32_t len
,
458 int timeout
, unsigned char locktype
);
459 struct smb1_lock_element
{
465 struct tevent_req
*cli_lockingx_create(
467 struct tevent_context
*ev
,
468 struct cli_state
*cli
,
471 uint8_t newoplocklevel
,
473 uint16_t num_unlocks
,
474 const struct smb1_lock_element
*unlocks
,
476 const struct smb1_lock_element
*locks
,
477 struct tevent_req
**psmbreq
);
478 struct tevent_req
*cli_lockingx_send(
480 struct tevent_context
*ev
,
481 struct cli_state
*cli
,
484 uint8_t newoplocklevel
,
486 uint16_t num_unlocks
,
487 const struct smb1_lock_element
*unlocks
,
489 const struct smb1_lock_element
*locks
);
490 NTSTATUS
cli_lockingx_recv(struct tevent_req
*req
);
491 NTSTATUS
cli_lockingx(
492 struct cli_state
*cli
,
495 uint8_t newoplocklevel
,
497 uint16_t num_unlocks
,
498 const struct smb1_lock_element
*unlocks
,
500 const struct smb1_lock_element
*locks
);
502 NTSTATUS
cli_lock32(struct cli_state
*cli
, uint16_t fnum
, uint32_t offset
,
503 uint32_t len
, int timeout
, enum brl_type lock_type
);
504 struct tevent_req
*cli_unlock_send(TALLOC_CTX
*mem_ctx
,
505 struct tevent_context
*ev
,
506 struct cli_state
*cli
,
510 NTSTATUS
cli_unlock_recv(struct tevent_req
*req
);
511 NTSTATUS
cli_unlock(struct cli_state
*cli
, uint16_t fnum
, uint32_t offset
, uint32_t len
);
512 struct tevent_req
*cli_posix_lock_send(TALLOC_CTX
*mem_ctx
,
513 struct tevent_context
*ev
,
514 struct cli_state
*cli
,
519 enum brl_type lock_type
);
520 NTSTATUS
cli_posix_lock_recv(struct tevent_req
*req
);
521 NTSTATUS
cli_posix_lock(struct cli_state
*cli
, uint16_t fnum
,
522 uint64_t offset
, uint64_t len
,
523 bool wait_lock
, enum brl_type lock_type
);
524 struct tevent_req
*cli_posix_unlock_send(TALLOC_CTX
*mem_ctx
,
525 struct tevent_context
*ev
,
526 struct cli_state
*cli
,
530 NTSTATUS
cli_posix_unlock_recv(struct tevent_req
*req
);
531 NTSTATUS
cli_posix_unlock(struct cli_state
*cli
, uint16_t fnum
, uint64_t offset
, uint64_t len
);
532 struct tevent_req
*cli_getattrE_send(TALLOC_CTX
*mem_ctx
,
533 struct tevent_context
*ev
,
534 struct cli_state
*cli
,
536 NTSTATUS
cli_getattrE_recv(struct tevent_req
*req
,
542 struct tevent_req
*cli_setattrE_send(TALLOC_CTX
*mem_ctx
,
543 struct tevent_context
*ev
,
544 struct cli_state
*cli
,
549 NTSTATUS
cli_setattrE_recv(struct tevent_req
*req
);
550 NTSTATUS
cli_setattrE(struct cli_state
*cli
,
555 struct tevent_req
*cli_getatr_send(TALLOC_CTX
*mem_ctx
,
556 struct tevent_context
*ev
,
557 struct cli_state
*cli
,
559 NTSTATUS
cli_getatr_recv(struct tevent_req
*req
,
563 NTSTATUS
cli_getatr(struct cli_state
*cli
,
568 struct tevent_req
*cli_setatr_send(TALLOC_CTX
*mem_ctx
,
569 struct tevent_context
*ev
,
570 struct cli_state
*cli
,
574 NTSTATUS
cli_setatr_recv(struct tevent_req
*req
);
575 NTSTATUS
cli_setatr(struct cli_state
*cli
,
579 struct tevent_req
*cli_chkpath_send(TALLOC_CTX
*mem_ctx
,
580 struct tevent_context
*ev
,
581 struct cli_state
*cli
,
583 NTSTATUS
cli_chkpath_recv(struct tevent_req
*req
);
584 NTSTATUS
cli_chkpath(struct cli_state
*cli
, const char *path
);
585 struct tevent_req
*cli_dskattr_send(TALLOC_CTX
*mem_ctx
,
586 struct tevent_context
*ev
,
587 struct cli_state
*cli
);
588 NTSTATUS
cli_dskattr_recv(struct tevent_req
*req
, int *bsize
, int *total
,
590 NTSTATUS
cli_dskattr(struct cli_state
*cli
, int *bsize
, int *total
, int *avail
);
591 NTSTATUS
cli_disk_size(struct cli_state
*cli
, const char *path
, uint64_t *bsize
,
592 uint64_t *total
, uint64_t *avail
);
593 struct tevent_req
*cli_ctemp_send(TALLOC_CTX
*mem_ctx
,
594 struct tevent_context
*ev
,
595 struct cli_state
*cli
,
597 NTSTATUS
cli_ctemp_recv(struct tevent_req
*req
,
601 NTSTATUS
cli_ctemp(struct cli_state
*cli
,
606 NTSTATUS
cli_set_ea_path(struct cli_state
*cli
, const char *path
,
607 const char *ea_name
, const char *ea_val
,
609 NTSTATUS
cli_set_ea_fnum(struct cli_state
*cli
, uint16_t fnum
,
610 const char *ea_name
, const char *ea_val
,
612 struct tevent_req
*cli_get_ea_list_path_send(TALLOC_CTX
*mem_ctx
,
613 struct tevent_context
*ev
,
614 struct cli_state
*cli
,
616 NTSTATUS
cli_get_ea_list_path_recv(struct tevent_req
*req
, TALLOC_CTX
*mem_ctx
,
617 size_t *pnum_eas
, struct ea_struct
**peas
);
618 NTSTATUS
cli_get_ea_list_path(struct cli_state
*cli
, const char *path
,
621 struct ea_struct
**pea_list
);
622 struct tevent_req
*cli_posix_open_send(TALLOC_CTX
*mem_ctx
,
623 struct tevent_context
*ev
,
624 struct cli_state
*cli
,
628 NTSTATUS
cli_posix_open_recv(struct tevent_req
*req
, uint16_t *pfnum
);
629 NTSTATUS
cli_posix_open(struct cli_state
*cli
, const char *fname
,
630 int flags
, mode_t mode
, uint16_t *fnum
);
631 struct tevent_req
*cli_posix_mkdir_send(TALLOC_CTX
*mem_ctx
,
632 struct tevent_context
*ev
,
633 struct cli_state
*cli
,
636 NTSTATUS
cli_posix_mkdir_recv(struct tevent_req
*req
);
637 NTSTATUS
cli_posix_mkdir(struct cli_state
*cli
, const char *fname
, mode_t mode
);
639 struct tevent_req
*cli_posix_unlink_send(TALLOC_CTX
*mem_ctx
,
640 struct tevent_context
*ev
,
641 struct cli_state
*cli
,
643 NTSTATUS
cli_posix_unlink_recv(struct tevent_req
*req
);
644 NTSTATUS
cli_posix_unlink(struct cli_state
*cli
, const char *fname
);
646 struct tevent_req
*cli_posix_rmdir_send(TALLOC_CTX
*mem_ctx
,
647 struct tevent_context
*ev
,
648 struct cli_state
*cli
,
650 NTSTATUS
cli_posix_rmdir_recv(struct tevent_req
*req
, TALLOC_CTX
*mem_ctx
);
651 NTSTATUS
cli_posix_rmdir(struct cli_state
*cli
, const char *fname
);
652 struct tevent_req
*cli_notify_send(TALLOC_CTX
*mem_ctx
,
653 struct tevent_context
*ev
,
654 struct cli_state
*cli
, uint16_t fnum
,
655 uint32_t buffer_size
,
656 uint32_t completion_filter
, bool recursive
);
657 NTSTATUS
cli_notify_recv(struct tevent_req
*req
, TALLOC_CTX
*mem_ctx
,
658 uint32_t *pnum_changes
,
659 struct notify_change
**pchanges
);
660 NTSTATUS
cli_notify(struct cli_state
*cli
, uint16_t fnum
, uint32_t buffer_size
,
661 uint32_t completion_filter
, bool recursive
,
662 TALLOC_CTX
*mem_ctx
, uint32_t *pnum_changes
,
663 struct notify_change
**pchanges
);
665 struct tevent_req
*cli_nttrans_create_send(TALLOC_CTX
*mem_ctx
,
666 struct tevent_context
*ev
,
667 struct cli_state
*cli
,
670 uint32_t DesiredAccess
,
671 uint32_t FileAttributes
,
672 uint32_t ShareAccess
,
673 uint32_t CreateDisposition
,
674 uint32_t CreateOptions
,
675 uint8_t SecurityFlags
,
676 struct security_descriptor
*secdesc
,
677 struct ea_struct
*eas
,
679 NTSTATUS
cli_nttrans_create_recv(struct tevent_req
*req
,
681 struct smb_create_returns
*cr
);
682 NTSTATUS
cli_nttrans_create(struct cli_state
*cli
,
685 uint32_t DesiredAccess
,
686 uint32_t FileAttributes
,
687 uint32_t ShareAccess
,
688 uint32_t CreateDisposition
,
689 uint32_t CreateOptions
,
690 uint8_t SecurityFlags
,
691 struct security_descriptor
*secdesc
,
692 struct ea_struct
*eas
,
695 struct smb_create_returns
*cr
);
697 /* The following definitions come from libsmb/clifsinfo.c */
699 struct tevent_req
*cli_unix_extensions_version_send(TALLOC_CTX
*mem_ctx
,
700 struct tevent_context
*ev
,
701 struct cli_state
*cli
);
702 NTSTATUS
cli_unix_extensions_version_recv(struct tevent_req
*req
,
703 uint16_t *pmajor
, uint16_t *pminor
,
706 NTSTATUS
cli_unix_extensions_version(struct cli_state
*cli
, uint16_t *pmajor
,
707 uint16_t *pminor
, uint32_t *pcaplow
,
709 struct tevent_req
*cli_set_unix_extensions_capabilities_send(
710 TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
, struct cli_state
*cli
,
711 uint16_t major
, uint16_t minor
, uint32_t caplow
, uint32_t caphigh
);
712 NTSTATUS
cli_set_unix_extensions_capabilities_recv(struct tevent_req
*req
);
713 NTSTATUS
cli_set_unix_extensions_capabilities(struct cli_state
*cli
,
714 uint16_t major
, uint16_t minor
,
715 uint32_t caplow
, uint32_t caphigh
);
716 struct tevent_req
*cli_get_fs_attr_info_send(TALLOC_CTX
*mem_ctx
,
717 struct tevent_context
*ev
,
718 struct cli_state
*cli
);
719 NTSTATUS
cli_get_fs_attr_info_recv(struct tevent_req
*req
, uint32_t *fs_attr
);
720 NTSTATUS
cli_get_fs_attr_info(struct cli_state
*cli
, uint32_t *fs_attr
);
721 NTSTATUS
cli_get_fs_volume_info(struct cli_state
*cli
,
722 TALLOC_CTX
*mem_ctx
, char **volume_name
,
723 uint32_t *pserial_number
, time_t *pdate
);
724 NTSTATUS
cli_get_fs_full_size_info(struct cli_state
*cli
,
725 uint64_t *total_allocation_units
,
726 uint64_t *caller_allocation_units
,
727 uint64_t *actual_allocation_units
,
728 uint64_t *sectors_per_allocation_unit
,
729 uint64_t *bytes_per_sector
);
730 NTSTATUS
cli_get_posix_fs_info(struct cli_state
*cli
,
731 uint32_t *optimal_transfer_size
,
732 uint32_t *block_size
,
733 uint64_t *total_blocks
,
734 uint64_t *blocks_available
,
735 uint64_t *user_blocks_available
,
736 uint64_t *total_file_nodes
,
737 uint64_t *free_file_nodes
,
738 uint64_t *fs_identifier
);
739 struct tevent_req
*cli_posix_whoami_send(TALLOC_CTX
*mem_ctx
,
740 struct tevent_context
*ev
,
741 struct cli_state
*cli
);
742 NTSTATUS
cli_posix_whoami_recv(struct tevent_req
*req
,
749 struct dom_sid
**psids
,
751 NTSTATUS
cli_posix_whoami(struct cli_state
*cli
,
758 struct dom_sid
**sids
,
761 /* The following definitions come from libsmb/clilist.c */
763 NTSTATUS
is_bad_finfo_name(const struct cli_state
*cli
,
764 const struct file_info
*finfo
);
766 NTSTATUS
cli_list_old(struct cli_state
*cli
,const char *Mask
,uint32_t attribute
,
767 NTSTATUS (*fn
)(struct file_info
*,
768 const char *, void *), void *state
);
769 NTSTATUS
cli_list_trans(struct cli_state
*cli
, const char *mask
,
770 uint32_t attribute
, int info_level
,
772 struct file_info
*finfo
,
776 struct tevent_req
*cli_list_send(TALLOC_CTX
*mem_ctx
,
777 struct tevent_context
*ev
,
778 struct cli_state
*cli
,
781 uint16_t info_level
);
782 NTSTATUS
cli_list_recv(
783 struct tevent_req
*req
,
785 struct file_info
**pfinfo
);
786 NTSTATUS
cli_list(struct cli_state
*cli
,
789 NTSTATUS (*fn
)(struct file_info
*finfo
,
794 /* The following definitions come from libsmb/climessage.c */
796 struct tevent_req
*cli_message_send(TALLOC_CTX
*mem_ctx
,
797 struct tevent_context
*ev
,
798 struct cli_state
*cli
,
799 const char *host
, const char *username
,
800 const char *message
);
801 NTSTATUS
cli_message_recv(struct tevent_req
*req
);
802 NTSTATUS
cli_message(struct cli_state
*cli
, const char *host
,
803 const char *username
, const char *message
);
805 /* The following definitions come from libsmb/clioplock.c */
807 struct tevent_req
*cli_smb_oplock_break_waiter_send(TALLOC_CTX
*mem_ctx
,
808 struct tevent_context
*ev
,
809 struct cli_state
*cli
);
810 NTSTATUS
cli_smb_oplock_break_waiter_recv(struct tevent_req
*req
,
814 struct tevent_req
*cli_oplock_ack_send(TALLOC_CTX
*mem_ctx
,
815 struct tevent_context
*ev
,
816 struct cli_state
*cli
,
817 uint16_t fnum
, uint8_t level
);
818 NTSTATUS
cli_oplock_ack_recv(struct tevent_req
*req
);
820 /* The following definitions come from libsmb/cliprint.c */
822 NTSTATUS
cli_print_queue(struct cli_state
*cli
,
823 void (*fn
)(struct print_job_info
*));
824 NTSTATUS
cli_printjob_del(struct cli_state
*cli
, int job
);
826 /* The following definitions come from libsmb/cliquota.c */
828 NTSTATUS
cli_get_quota_handle(struct cli_state
*cli
, uint16_t *quota_fnum
);
829 void free_ntquota_list(SMB_NTQUOTA_LIST
**qt_list
);
830 bool parse_user_quota_record(const uint8_t *rdata
,
831 unsigned int rdata_count
,
832 unsigned int *offset
,
833 SMB_NTQUOTA_STRUCT
*pqt
);
834 bool add_record_to_ntquota_list(TALLOC_CTX
*mem_ctx
,
835 SMB_NTQUOTA_STRUCT
*pqt
,
836 SMB_NTQUOTA_LIST
**pqt_list
);
837 NTSTATUS
parse_user_quota_list(const uint8_t *curdata
,
838 uint32_t curdata_size
,
840 SMB_NTQUOTA_LIST
**pqt_list
);
841 NTSTATUS
parse_fs_quota_buffer(const uint8_t *rdata
,
842 unsigned int rdata_count
,
843 SMB_NTQUOTA_STRUCT
*pqt
);
844 NTSTATUS
build_user_quota_buffer(SMB_NTQUOTA_LIST
*qt_list
,
848 SMB_NTQUOTA_LIST
**end_ptr
);
849 NTSTATUS
build_fs_quota_buffer(TALLOC_CTX
*mem_ctx
,
850 const SMB_NTQUOTA_STRUCT
*pqt
,
853 NTSTATUS
cli_get_user_quota(struct cli_state
*cli
, int quota_fnum
,
854 SMB_NTQUOTA_STRUCT
*pqt
);
855 NTSTATUS
cli_set_user_quota(struct cli_state
*cli
,
857 SMB_NTQUOTA_LIST
*qtl
);
858 NTSTATUS
cli_list_user_quota(struct cli_state
*cli
, int quota_fnum
,
859 SMB_NTQUOTA_LIST
**pqt_list
);
860 NTSTATUS
cli_get_fs_quota_info(struct cli_state
*cli
, int quota_fnum
,
861 SMB_NTQUOTA_STRUCT
*pqt
);
862 NTSTATUS
cli_set_fs_quota_info(struct cli_state
*cli
, int quota_fnum
,
863 SMB_NTQUOTA_STRUCT
*pqt
);
865 /* The following definitions come from libsmb/clireadwrite.c */
867 struct tevent_req
*cli_read_andx_create(TALLOC_CTX
*mem_ctx
,
868 struct tevent_context
*ev
,
869 struct cli_state
*cli
, uint16_t fnum
,
870 off_t offset
, size_t size
,
871 struct tevent_req
**psmbreq
);
872 struct tevent_req
*cli_read_andx_send(TALLOC_CTX
*mem_ctx
,
873 struct tevent_context
*ev
,
874 struct cli_state
*cli
, uint16_t fnum
,
875 off_t offset
, size_t size
);
876 NTSTATUS
cli_read_andx_recv(struct tevent_req
*req
, ssize_t
*received
,
878 struct tevent_req
*cli_pull_send(TALLOC_CTX
*mem_ctx
,
879 struct tevent_context
*ev
,
880 struct cli_state
*cli
,
881 uint16_t fnum
, off_t start_offset
,
882 off_t size
, size_t window_size
,
883 NTSTATUS (*sink
)(char *buf
, size_t n
,
886 NTSTATUS
cli_pull_recv(struct tevent_req
*req
, off_t
*received
);
887 NTSTATUS
cli_pull(struct cli_state
*cli
, uint16_t fnum
,
888 off_t start_offset
, off_t size
, size_t window_size
,
889 NTSTATUS (*sink
)(char *buf
, size_t n
, void *priv
),
890 void *priv
, off_t
*received
);
891 NTSTATUS
cli_read_sink(char *buf
, size_t n
, void *priv
);
892 struct tevent_req
*cli_read_send(
894 struct tevent_context
*ev
,
895 struct cli_state
*cli
,
900 NTSTATUS
cli_read_recv(struct tevent_req
*req
, size_t *received
);
901 NTSTATUS
cli_read(struct cli_state
*cli
, uint16_t fnum
,
902 char *buf
, off_t offset
, size_t size
,
904 NTSTATUS
cli_smbwrite(struct cli_state
*cli
, uint16_t fnum
, char *buf
,
905 off_t offset
, size_t size1
, size_t *ptotal
);
906 struct tevent_req
*cli_write_andx_create(TALLOC_CTX
*mem_ctx
,
907 struct tevent_context
*ev
,
908 struct cli_state
*cli
, uint16_t fnum
,
909 uint16_t mode
, const uint8_t *buf
,
910 off_t offset
, size_t size
,
911 struct tevent_req
**reqs_before
,
913 struct tevent_req
**psmbreq
);
914 struct tevent_req
*cli_write_andx_send(TALLOC_CTX
*mem_ctx
,
915 struct tevent_context
*ev
,
916 struct cli_state
*cli
, uint16_t fnum
,
917 uint16_t mode
, const uint8_t *buf
,
918 off_t offset
, size_t size
);
919 NTSTATUS
cli_write_andx_recv(struct tevent_req
*req
, size_t *pwritten
);
921 struct tevent_req
*cli_write_send(TALLOC_CTX
*mem_ctx
,
922 struct tevent_context
*ev
,
923 struct cli_state
*cli
, uint16_t fnum
,
924 uint16_t mode
, const uint8_t *buf
,
925 off_t offset
, size_t size
);
926 NTSTATUS
cli_write_recv(struct tevent_req
*req
, size_t *pwritten
);
928 struct tevent_req
*cli_writeall_send(
930 struct tevent_context
*ev
,
931 struct cli_state
*cli
,
937 NTSTATUS
cli_writeall_recv(struct tevent_req
*req
, size_t *pwritten
);
938 NTSTATUS
cli_writeall(struct cli_state
*cli
, uint16_t fnum
, uint16_t mode
,
939 const uint8_t *buf
, off_t offset
, size_t size
,
942 struct tevent_req
*cli_push_send(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
943 struct cli_state
*cli
,
944 uint16_t fnum
, uint16_t mode
,
945 off_t start_offset
, size_t window_size
,
946 size_t (*source
)(uint8_t *buf
, size_t n
,
949 NTSTATUS
cli_push_recv(struct tevent_req
*req
);
950 NTSTATUS
cli_push(struct cli_state
*cli
, uint16_t fnum
, uint16_t mode
,
951 off_t start_offset
, size_t window_size
,
952 size_t (*source
)(uint8_t *buf
, size_t n
, void *priv
),
955 NTSTATUS
cli_splice(struct cli_state
*srccli
, struct cli_state
*dstcli
,
956 uint16_t src_fnum
, uint16_t dst_fnum
,
958 off_t src_offset
, off_t dst_offset
,
960 int (*splice_cb
)(off_t n
, void *priv
), void *priv
);
962 /* The following definitions come from libsmb/clisecdesc.c */
964 struct tevent_req
*cli_query_security_descriptor_send(
966 struct tevent_context
*ev
,
967 struct cli_state
*cli
,
970 NTSTATUS
cli_query_security_descriptor_recv(
971 struct tevent_req
*req
,
973 struct security_descriptor
**sd
);
974 NTSTATUS
cli_query_security_descriptor(struct cli_state
*cli
,
978 struct security_descriptor
**sd
);
979 NTSTATUS
cli_query_secdesc(struct cli_state
*cli
, uint16_t fnum
,
980 TALLOC_CTX
*mem_ctx
, struct security_descriptor
**sd
);
981 struct tevent_req
*cli_set_security_descriptor_send(
983 struct tevent_context
*ev
,
984 struct cli_state
*cli
,
987 const struct security_descriptor
*sd
);
988 NTSTATUS
cli_set_security_descriptor_recv(struct tevent_req
*req
);
989 NTSTATUS
cli_set_security_descriptor(struct cli_state
*cli
,
992 const struct security_descriptor
*sd
);
993 NTSTATUS
cli_set_secdesc(struct cli_state
*cli
, uint16_t fnum
,
994 const struct security_descriptor
*sd
);
996 NTSTATUS
cli_query_mxac(struct cli_state
*cli
,
997 const char *filename
,
1000 /* The following definitions come from libsmb/clitrans.c */
1002 struct tevent_req
*cli_trans_send(
1003 TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
1004 struct cli_state
*cli
, uint16_t additional_flags2
, uint8_t cmd
,
1005 const char *pipe_name
, uint16_t fid
, uint16_t function
, int flags
,
1006 uint16_t *setup
, uint8_t num_setup
, uint8_t max_setup
,
1007 uint8_t *param
, uint32_t num_param
, uint32_t max_param
,
1008 uint8_t *data
, uint32_t num_data
, uint32_t max_data
);
1009 NTSTATUS
cli_trans_recv(struct tevent_req
*req
, TALLOC_CTX
*mem_ctx
,
1010 uint16_t *recv_flags2
,
1011 uint16_t **setup
, uint8_t min_setup
,
1013 uint8_t **param
, uint32_t min_param
,
1014 uint32_t *num_param
,
1015 uint8_t **data
, uint32_t min_data
,
1016 uint32_t *num_data
);
1017 NTSTATUS
cli_trans(TALLOC_CTX
*mem_ctx
, struct cli_state
*cli
,
1019 const char *pipe_name
, uint16_t fid
, uint16_t function
,
1021 uint16_t *setup
, uint8_t num_setup
, uint8_t max_setup
,
1022 uint8_t *param
, uint32_t num_param
, uint32_t max_param
,
1023 uint8_t *data
, uint32_t num_data
, uint32_t max_data
,
1024 uint16_t *recv_flags2
,
1025 uint16_t **rsetup
, uint8_t min_rsetup
, uint8_t *num_rsetup
,
1026 uint8_t **rparam
, uint32_t min_rparam
, uint32_t *num_rparam
,
1027 uint8_t **rdata
, uint32_t min_rdata
, uint32_t *num_rdata
);
1029 /* The following definitions come from libsmb/clisymlink.c */
1031 struct tevent_req
*cli_create_reparse_point_send(TALLOC_CTX
*mem_ctx
,
1032 struct tevent_context
*ev
,
1033 struct cli_state
*cli
,
1035 DATA_BLOB reparse_blob
);
1036 NTSTATUS
cli_create_reparse_point_recv(struct tevent_req
*req
);
1038 struct tevent_req
*cli_symlink_send(TALLOC_CTX
*mem_ctx
,
1039 struct tevent_context
*ev
,
1040 struct cli_state
*cli
,
1041 const char *oldpath
,
1042 const char *newpath
,
1044 NTSTATUS
cli_symlink_recv(struct tevent_req
*req
);
1045 NTSTATUS
cli_symlink(struct cli_state
*cli
, const char *oldname
,
1046 const char *newname
, uint32_t flags
);
1048 struct tevent_req
*cli_get_reparse_data_send(TALLOC_CTX
*mem_ctx
,
1049 struct tevent_context
*ev
,
1050 struct cli_state
*cli
,
1052 NTSTATUS
cli_get_reparse_data_recv(struct tevent_req
*req
,
1053 TALLOC_CTX
*mem_ctx
,
1055 uint32_t *_datalen
);
1056 NTSTATUS
cli_get_reparse_data(struct cli_state
*cli
,
1058 TALLOC_CTX
*mem_ctx
,
1060 uint32_t *_datalen
);
1062 struct tevent_req
*cli_readlink_send(TALLOC_CTX
*mem_ctx
,
1063 struct tevent_context
*ev
,
1064 struct cli_state
*cli
,
1066 NTSTATUS
cli_readlink_recv(struct tevent_req
*req
, TALLOC_CTX
*mem_ctx
,
1067 char **psubstitute_name
, char **pprint_name
,
1069 NTSTATUS
cli_readlink(struct cli_state
*cli
, const char *fname
,
1070 TALLOC_CTX
*mem_ctx
, char **psubstitute_name
,
1071 char **pprint_name
, uint32_t *pflags
);
1073 NTSTATUS
fill_quota_buffer(TALLOC_CTX
*mem_ctx
,
1074 SMB_NTQUOTA_LIST
*tmp_list
,
1078 SMB_NTQUOTA_LIST
**end_ptr
);
1079 /* The following definitions come from libsmb/passchange.c */
1081 NTSTATUS
remote_password_change(const char *remote_machine
,
1082 const char *domain
, const char *user_name
,
1083 const char *old_passwd
, const char *new_passwd
,
1086 #endif /* _LIBSMB_PROTO_H_ */