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(const char *host
, const struct sockaddr_storage
*dest_ss
,
86 uint16_t port
, int name_type
, const char *myname
,
87 enum smb_signing_setting signing_state
, int flags
, struct cli_state
**pcli
);
88 NTSTATUS
cli_start_connection(struct cli_state
**output_cli
,
90 const char *dest_host
,
91 const struct sockaddr_storage
*dest_ss
, int port
,
92 enum smb_signing_setting signing_state
, int flags
);
93 NTSTATUS
cli_smb1_setup_encryption(struct cli_state
*cli
,
94 struct cli_credentials
*creds
);
96 struct smb2_negotiate_contexts
;
97 struct tevent_req
*cli_full_connection_creds_send(
98 TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
99 const char *my_name
, const char *dest_host
,
100 const struct sockaddr_storage
*dest_ss
, int port
,
101 const char *service
, const char *service_type
,
102 struct cli_credentials
*creds
,
104 struct smb2_negotiate_contexts
*negotiate_contexts
);
105 NTSTATUS
cli_full_connection_creds_recv(struct tevent_req
*req
,
106 struct cli_state
**output_cli
);
107 NTSTATUS
cli_full_connection_creds(struct cli_state
**output_cli
,
109 const char *dest_host
,
110 const struct sockaddr_storage
*dest_ss
, int port
,
111 const char *service
, const char *service_type
,
112 struct cli_credentials
*creds
,
114 NTSTATUS
cli_raw_tcon(struct cli_state
*cli
,
115 const char *service
, const char *pass
, const char *dev
,
116 uint16_t *max_xmit
, uint16_t *tid
);
117 struct cli_state
*get_ipc_connect(char *server
,
118 struct sockaddr_storage
*server_ss
,
119 struct cli_credentials
*creds
);
120 struct cli_state
*get_ipc_connect_master_ip(TALLOC_CTX
*ctx
,
121 struct sockaddr_storage
*mb_ip
,
122 struct cli_credentials
*creds
,
123 char **pp_workgroup_out
);
125 /* The following definitions come from libsmb/clidfs.c */
127 NTSTATUS
cli_cm_open(TALLOC_CTX
*ctx
,
128 struct cli_state
*referring_cli
,
131 struct cli_credentials
*creds
,
132 const struct sockaddr_storage
*dest_ss
,
135 struct cli_state
**pcli
);
136 void cli_cm_display(struct cli_state
*c
);
137 struct client_dfs_referral
;
138 bool cli_dfs_is_already_full_path(struct cli_state
*cli
, const char *path
);
139 NTSTATUS
cli_dfs_get_referral_ex(TALLOC_CTX
*ctx
,
140 struct cli_state
*cli
,
142 uint16_t max_referral_level
,
143 struct client_dfs_referral
**refs
,
146 NTSTATUS
cli_dfs_get_referral(TALLOC_CTX
*ctx
,
147 struct cli_state
*cli
,
149 struct client_dfs_referral
**refs
,
152 NTSTATUS
cli_resolve_path(TALLOC_CTX
*ctx
,
154 struct cli_credentials
*creds
,
155 struct cli_state
*rootcli
,
157 struct cli_state
**targetcli
,
158 char **pp_targetpath
);
160 bool cli_check_msdfs_proxy(TALLOC_CTX
*ctx
,
161 struct cli_state
*cli
,
162 const char *sharename
,
165 struct cli_credentials
*creds
);
167 NTSTATUS
cli_dfs_target_check(TALLOC_CTX
*mem_ctx
,
168 struct cli_state
*cli
,
169 const char *fname_dst
,
170 const char **fname_dst_out
);
171 char *smb1_dfs_share_path(TALLOC_CTX
*ctx
,
172 struct cli_state
*cli
,
175 /* The following definitions come from libsmb/clientgen.c */
177 unsigned int cli_set_timeout(struct cli_state
*cli
, unsigned int timeout
);
178 bool cli_set_backup_intent(struct cli_state
*cli
, bool flag
);
179 extern struct GUID cli_state_client_guid
;
180 struct cli_state
*cli_state_create(TALLOC_CTX
*mem_ctx
,
182 const char *remote_name
,
183 enum smb_signing_setting signing_state
,
185 void cli_shutdown(struct cli_state
*cli
);
186 uint16_t cli_state_get_vc_num(struct cli_state
*cli
);
187 uint32_t cli_setpid(struct cli_state
*cli
, uint32_t pid
);
188 uint32_t cli_getpid(struct cli_state
*cli
);
189 bool cli_state_is_encryption_on(struct cli_state
*cli
);
190 bool cli_state_has_tcon(struct cli_state
*cli
);
191 uint32_t cli_state_get_tid(struct cli_state
*cli
);
192 uint32_t cli_state_set_tid(struct cli_state
*cli
, uint32_t tid
);
194 void cli_state_save_tcon_share(struct cli_state
*cli
,
195 struct smbXcli_tcon
**_tcon_ret
,
197 void cli_state_restore_tcon_share(struct cli_state
*cli
,
198 struct smbXcli_tcon
*tcon
,
200 uint16_t cli_state_get_uid(struct cli_state
*cli
);
201 uint16_t cli_state_set_uid(struct cli_state
*cli
, uint16_t uid
);
202 bool cli_set_case_sensitive(struct cli_state
*cli
, bool case_sensitive
);
203 uint32_t cli_state_available_size(struct cli_state
*cli
, uint32_t ofs
);
204 time_t cli_state_server_time(struct cli_state
*cli
);
205 struct tevent_req
*cli_echo_send(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
206 struct cli_state
*cli
, uint16_t num_echos
,
208 NTSTATUS
cli_echo_recv(struct tevent_req
*req
);
209 NTSTATUS
cli_echo(struct cli_state
*cli
, uint16_t num_echos
, DATA_BLOB data
);
210 NTSTATUS
cli_smb(TALLOC_CTX
*mem_ctx
, struct cli_state
*cli
,
211 uint8_t smb_command
, uint8_t additional_flags
,
212 uint8_t wct
, uint16_t *vwv
,
213 uint32_t num_bytes
, const uint8_t *bytes
,
214 struct tevent_req
**result_parent
,
215 uint8_t min_wct
, uint8_t *pwct
, uint16_t **pvwv
,
216 uint32_t *pnum_bytes
, uint8_t **pbytes
);
218 /* The following definitions come from libsmb/clierror.c */
220 NTSTATUS
cli_nt_error(struct cli_state
*cli
);
221 void cli_dos_error(struct cli_state
*cli
, uint8_t *eclass
, uint32_t *ecode
);
222 int cli_status_to_errno(NTSTATUS status
);
223 int cli_errno(struct cli_state
*cli
);
224 bool cli_is_error(struct cli_state
*cli
);
225 bool cli_is_nt_error(struct cli_state
*cli
);
226 bool cli_is_dos_error(struct cli_state
*cli
);
227 bool cli_state_is_connected(struct cli_state
*cli
);
229 /* The following definitions come from libsmb/clifile.c */
231 struct tevent_req
*cli_setpathinfo_send(TALLOC_CTX
*mem_ctx
,
232 struct tevent_context
*ev
,
233 struct cli_state
*cli
,
238 NTSTATUS
cli_setpathinfo_recv(struct tevent_req
*req
);
239 NTSTATUS
cli_setpathinfo(struct cli_state
*cli
,
244 struct tevent_req
*cli_setfileinfo_send(
246 struct tevent_context
*ev
,
247 struct cli_state
*cli
,
252 NTSTATUS
cli_setfileinfo_recv(struct tevent_req
*req
);
254 struct tevent_req
*cli_posix_symlink_send(TALLOC_CTX
*mem_ctx
,
255 struct tevent_context
*ev
,
256 struct cli_state
*cli
,
258 const char *newname
);
259 NTSTATUS
cli_posix_symlink_recv(struct tevent_req
*req
);
260 NTSTATUS
cli_posix_symlink(struct cli_state
*cli
,
262 const char *newname
);
263 struct tevent_req
*cli_posix_readlink_send(TALLOC_CTX
*mem_ctx
,
264 struct tevent_context
*ev
,
265 struct cli_state
*cli
,
267 NTSTATUS
cli_posix_readlink_recv(
268 struct tevent_req
*req
, TALLOC_CTX
*mem_ctx
, char **target
);
269 struct tevent_req
*cli_posix_hardlink_send(TALLOC_CTX
*mem_ctx
,
270 struct tevent_context
*ev
,
271 struct cli_state
*cli
,
273 const char *newname
);
274 NTSTATUS
cli_posix_hardlink_recv(struct tevent_req
*req
);
275 NTSTATUS
cli_posix_hardlink(struct cli_state
*cli
,
277 const char *newname
);
278 uint32_t unix_perms_to_wire(mode_t perms
);
279 mode_t
wire_perms_to_unix(uint32_t perms
);
280 struct tevent_req
*cli_posix_getacl_send(TALLOC_CTX
*mem_ctx
,
281 struct tevent_context
*ev
,
282 struct cli_state
*cli
,
284 NTSTATUS
cli_posix_getacl_recv(struct tevent_req
*req
,
288 NTSTATUS
cli_posix_getacl(struct cli_state
*cli
,
293 struct tevent_req
*cli_posix_setacl_send(TALLOC_CTX
*mem_ctx
,
294 struct tevent_context
*ev
,
295 struct cli_state
*cli
,
298 size_t acl_buf_size
);
299 NTSTATUS
cli_posix_setacl_recv(struct tevent_req
*req
);
300 NTSTATUS
cli_posix_setacl(struct cli_state
*cli
,
303 size_t acl_buf_size
);
304 struct tevent_req
*cli_posix_stat_send(TALLOC_CTX
*mem_ctx
,
305 struct tevent_context
*ev
,
306 struct cli_state
*cli
,
308 NTSTATUS
cli_posix_stat_recv(struct tevent_req
*req
, struct stat_ex
*sbuf
);
309 NTSTATUS
cli_posix_stat(struct cli_state
*cli
,
311 struct stat_ex
*sbuf
);
312 struct tevent_req
*cli_posix_chmod_send(TALLOC_CTX
*mem_ctx
,
313 struct tevent_context
*ev
,
314 struct cli_state
*cli
,
317 NTSTATUS
cli_posix_chmod_recv(struct tevent_req
*req
);
318 NTSTATUS
cli_posix_chmod(struct cli_state
*cli
, const char *fname
, mode_t mode
);
319 struct tevent_req
*cli_posix_chown_send(TALLOC_CTX
*mem_ctx
,
320 struct tevent_context
*ev
,
321 struct cli_state
*cli
,
325 NTSTATUS
cli_posix_chown_recv(struct tevent_req
*req
);
326 NTSTATUS
cli_posix_chown(struct cli_state
*cli
,
330 struct tevent_req
*cli_mknod_send(
332 struct tevent_context
*ev
,
333 struct cli_state
*cli
,
337 NTSTATUS
cli_mknod_recv(struct tevent_req
*req
);
338 struct tevent_req
*cli_rename_send(TALLOC_CTX
*mem_ctx
,
339 struct tevent_context
*ev
,
340 struct cli_state
*cli
,
341 const char *fname_src
,
342 const char *fname_dst
,
344 NTSTATUS
cli_rename_recv(struct tevent_req
*req
);
345 NTSTATUS
cli_rename(struct cli_state
*cli
,
346 const char *fname_src
,
347 const char *fname_dst
,
349 struct tevent_req
*cli_ntrename_send(TALLOC_CTX
*mem_ctx
,
350 struct tevent_context
*ev
,
351 struct cli_state
*cli
,
352 const char *fname_src
,
353 const char *fname_dst
);
354 NTSTATUS
cli_ntrename_recv(struct tevent_req
*req
);
355 NTSTATUS
cli_ntrename(struct cli_state
*cli
, const char *fname_src
, const char *fname_dst
);
357 struct tevent_req
*cli_hardlink_send(
359 struct tevent_context
*ev
,
360 struct cli_state
*cli
,
361 const char *fname_src
,
362 const char *fname_dst
);
363 NTSTATUS
cli_hardlink_recv(struct tevent_req
*req
);
364 NTSTATUS
cli_hardlink(
365 struct cli_state
*cli
,
366 const char *fname_src
,
367 const char *fname_dst
);
369 struct tevent_req
*cli_unlink_send(TALLOC_CTX
*mem_ctx
,
370 struct tevent_context
*ev
,
371 struct cli_state
*cli
,
373 uint32_t mayhave_attrs
);
374 NTSTATUS
cli_unlink_recv(struct tevent_req
*req
);
375 NTSTATUS
cli_unlink(struct cli_state
*cli
, const char *fname
, uint32_t mayhave_attrs
);
377 struct tevent_req
*cli_mkdir_send(TALLOC_CTX
*mem_ctx
,
378 struct tevent_context
*ev
,
379 struct cli_state
*cli
,
381 NTSTATUS
cli_mkdir_recv(struct tevent_req
*req
);
382 NTSTATUS
cli_mkdir(struct cli_state
*cli
, const char *dname
);
383 struct tevent_req
*cli_rmdir_send(TALLOC_CTX
*mem_ctx
,
384 struct tevent_context
*ev
,
385 struct cli_state
*cli
,
387 NTSTATUS
cli_rmdir_recv(struct tevent_req
*req
);
388 NTSTATUS
cli_rmdir(struct cli_state
*cli
, const char *dname
);
389 struct tevent_req
*cli_nt_delete_on_close_send(TALLOC_CTX
*mem_ctx
,
390 struct tevent_context
*ev
,
391 struct cli_state
*cli
,
394 NTSTATUS
cli_nt_delete_on_close_recv(struct tevent_req
*req
);
395 NTSTATUS
cli_nt_delete_on_close(struct cli_state
*cli
, uint16_t fnum
, bool flag
);
396 struct tevent_req
*cli_ntcreate_send(TALLOC_CTX
*mem_ctx
,
397 struct tevent_context
*ev
,
398 struct cli_state
*cli
,
401 uint32_t DesiredAccess
,
402 uint32_t FileAttributes
,
403 uint32_t ShareAccess
,
404 uint32_t CreateDisposition
,
405 uint32_t CreateOptions
,
406 uint32_t ImpersonationLevel
,
407 uint8_t SecurityFlags
);
408 NTSTATUS
cli_ntcreate_recv(struct tevent_req
*req
,
410 struct smb_create_returns
*cr
);
411 NTSTATUS
cli_ntcreate(struct cli_state
*cli
,
414 uint32_t DesiredAccess
,
415 uint32_t FileAttributes
,
416 uint32_t ShareAccess
,
417 uint32_t CreateDisposition
,
418 uint32_t CreateOptions
,
419 uint8_t SecurityFlags
,
421 struct smb_create_returns
*cr
);
422 struct tevent_req
*cli_openx_create(TALLOC_CTX
*mem_ctx
,
423 struct tevent_context
*ev
,
424 struct cli_state
*cli
, const char *fname
,
425 int flags
, int share_mode
,
426 struct tevent_req
**psmbreq
);
427 struct tevent_req
*cli_openx_send(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
428 struct cli_state
*cli
, const char *fname
,
429 int flags
, int share_mode
);
430 NTSTATUS
cli_openx_recv(struct tevent_req
*req
, uint16_t *fnum
);
431 NTSTATUS
cli_openx(struct cli_state
*cli
, const char *fname
, int flags
, int share_mode
, uint16_t *pfnum
);
432 NTSTATUS
cli_open(struct cli_state
*cli
, const char *fname
, int flags
, int share_mode
, uint16_t *pfnum
);
433 struct tevent_req
*cli_smb1_close_create(TALLOC_CTX
*mem_ctx
,
434 struct tevent_context
*ev
,
435 struct cli_state
*cli
, uint16_t fnum
,
436 struct tevent_req
**psubreq
);
437 struct tevent_req
*cli_close_send(TALLOC_CTX
*mem_ctx
,
438 struct tevent_context
*ev
,
439 struct cli_state
*cli
, uint16_t fnum
);
440 NTSTATUS
cli_close_recv(struct tevent_req
*req
);
441 NTSTATUS
cli_close(struct cli_state
*cli
, uint16_t fnum
);
442 struct tevent_req
*cli_ftruncate_send(TALLOC_CTX
*mem_ctx
,
443 struct tevent_context
*ev
,
444 struct cli_state
*cli
,
447 NTSTATUS
cli_ftruncate_recv(struct tevent_req
*req
);
448 NTSTATUS
cli_ftruncate(struct cli_state
*cli
, uint16_t fnum
, uint64_t size
);
449 NTSTATUS
cli_locktype(struct cli_state
*cli
, uint16_t fnum
,
450 uint32_t offset
, uint32_t len
,
451 int timeout
, unsigned char locktype
);
452 struct smb1_lock_element
{
458 struct tevent_req
*cli_lockingx_create(
460 struct tevent_context
*ev
,
461 struct cli_state
*cli
,
464 uint8_t newoplocklevel
,
466 uint16_t num_unlocks
,
467 const struct smb1_lock_element
*unlocks
,
469 const struct smb1_lock_element
*locks
,
470 struct tevent_req
**psmbreq
);
471 struct tevent_req
*cli_lockingx_send(
473 struct tevent_context
*ev
,
474 struct cli_state
*cli
,
477 uint8_t newoplocklevel
,
479 uint16_t num_unlocks
,
480 const struct smb1_lock_element
*unlocks
,
482 const struct smb1_lock_element
*locks
);
483 NTSTATUS
cli_lockingx_recv(struct tevent_req
*req
);
484 NTSTATUS
cli_lockingx(
485 struct cli_state
*cli
,
488 uint8_t newoplocklevel
,
490 uint16_t num_unlocks
,
491 const struct smb1_lock_element
*unlocks
,
493 const struct smb1_lock_element
*locks
);
495 NTSTATUS
cli_lock32(struct cli_state
*cli
, uint16_t fnum
, uint32_t offset
,
496 uint32_t len
, int timeout
, enum brl_type lock_type
);
497 struct tevent_req
*cli_unlock_send(TALLOC_CTX
*mem_ctx
,
498 struct tevent_context
*ev
,
499 struct cli_state
*cli
,
503 NTSTATUS
cli_unlock_recv(struct tevent_req
*req
);
504 NTSTATUS
cli_unlock(struct cli_state
*cli
, uint16_t fnum
, uint32_t offset
, uint32_t len
);
505 struct tevent_req
*cli_posix_lock_send(TALLOC_CTX
*mem_ctx
,
506 struct tevent_context
*ev
,
507 struct cli_state
*cli
,
512 enum brl_type lock_type
);
513 NTSTATUS
cli_posix_lock_recv(struct tevent_req
*req
);
514 NTSTATUS
cli_posix_lock(struct cli_state
*cli
, uint16_t fnum
,
515 uint64_t offset
, uint64_t len
,
516 bool wait_lock
, enum brl_type lock_type
);
517 struct tevent_req
*cli_posix_unlock_send(TALLOC_CTX
*mem_ctx
,
518 struct tevent_context
*ev
,
519 struct cli_state
*cli
,
523 NTSTATUS
cli_posix_unlock_recv(struct tevent_req
*req
);
524 NTSTATUS
cli_posix_unlock(struct cli_state
*cli
, uint16_t fnum
, uint64_t offset
, uint64_t len
);
525 struct tevent_req
*cli_getattrE_send(TALLOC_CTX
*mem_ctx
,
526 struct tevent_context
*ev
,
527 struct cli_state
*cli
,
529 NTSTATUS
cli_getattrE_recv(struct tevent_req
*req
,
535 struct tevent_req
*cli_setattrE_send(TALLOC_CTX
*mem_ctx
,
536 struct tevent_context
*ev
,
537 struct cli_state
*cli
,
542 NTSTATUS
cli_setattrE_recv(struct tevent_req
*req
);
543 NTSTATUS
cli_setattrE(struct cli_state
*cli
,
548 struct tevent_req
*cli_getatr_send(TALLOC_CTX
*mem_ctx
,
549 struct tevent_context
*ev
,
550 struct cli_state
*cli
,
552 NTSTATUS
cli_getatr_recv(struct tevent_req
*req
,
556 NTSTATUS
cli_getatr(struct cli_state
*cli
,
561 struct tevent_req
*cli_setatr_send(TALLOC_CTX
*mem_ctx
,
562 struct tevent_context
*ev
,
563 struct cli_state
*cli
,
567 NTSTATUS
cli_setatr_recv(struct tevent_req
*req
);
568 NTSTATUS
cli_setatr(struct cli_state
*cli
,
572 struct tevent_req
*cli_chkpath_send(TALLOC_CTX
*mem_ctx
,
573 struct tevent_context
*ev
,
574 struct cli_state
*cli
,
576 NTSTATUS
cli_chkpath_recv(struct tevent_req
*req
);
577 NTSTATUS
cli_chkpath(struct cli_state
*cli
, const char *path
);
578 struct tevent_req
*cli_dskattr_send(TALLOC_CTX
*mem_ctx
,
579 struct tevent_context
*ev
,
580 struct cli_state
*cli
);
581 NTSTATUS
cli_dskattr_recv(struct tevent_req
*req
, int *bsize
, int *total
,
583 NTSTATUS
cli_dskattr(struct cli_state
*cli
, int *bsize
, int *total
, int *avail
);
584 NTSTATUS
cli_disk_size(struct cli_state
*cli
, const char *path
, uint64_t *bsize
,
585 uint64_t *total
, uint64_t *avail
);
586 struct tevent_req
*cli_ctemp_send(TALLOC_CTX
*mem_ctx
,
587 struct tevent_context
*ev
,
588 struct cli_state
*cli
,
590 NTSTATUS
cli_ctemp_recv(struct tevent_req
*req
,
594 NTSTATUS
cli_ctemp(struct cli_state
*cli
,
599 NTSTATUS
cli_raw_ioctl(struct cli_state
*cli
, uint16_t fnum
, uint32_t code
, DATA_BLOB
*blob
);
600 NTSTATUS
cli_set_ea_path(struct cli_state
*cli
, const char *path
,
601 const char *ea_name
, const char *ea_val
,
603 NTSTATUS
cli_set_ea_fnum(struct cli_state
*cli
, uint16_t fnum
,
604 const char *ea_name
, const char *ea_val
,
606 struct tevent_req
*cli_get_ea_list_path_send(TALLOC_CTX
*mem_ctx
,
607 struct tevent_context
*ev
,
608 struct cli_state
*cli
,
610 NTSTATUS
cli_get_ea_list_path_recv(struct tevent_req
*req
, TALLOC_CTX
*mem_ctx
,
611 size_t *pnum_eas
, struct ea_struct
**peas
);
612 NTSTATUS
cli_get_ea_list_path(struct cli_state
*cli
, const char *path
,
615 struct ea_struct
**pea_list
);
616 struct tevent_req
*cli_posix_open_send(TALLOC_CTX
*mem_ctx
,
617 struct tevent_context
*ev
,
618 struct cli_state
*cli
,
622 NTSTATUS
cli_posix_open_recv(struct tevent_req
*req
, uint16_t *pfnum
);
623 NTSTATUS
cli_posix_open(struct cli_state
*cli
, const char *fname
,
624 int flags
, mode_t mode
, uint16_t *fnum
);
625 struct tevent_req
*cli_posix_mkdir_send(TALLOC_CTX
*mem_ctx
,
626 struct tevent_context
*ev
,
627 struct cli_state
*cli
,
630 NTSTATUS
cli_posix_mkdir_recv(struct tevent_req
*req
);
631 NTSTATUS
cli_posix_mkdir(struct cli_state
*cli
, const char *fname
, mode_t mode
);
633 struct tevent_req
*cli_posix_unlink_send(TALLOC_CTX
*mem_ctx
,
634 struct tevent_context
*ev
,
635 struct cli_state
*cli
,
637 NTSTATUS
cli_posix_unlink_recv(struct tevent_req
*req
);
638 NTSTATUS
cli_posix_unlink(struct cli_state
*cli
, const char *fname
);
640 struct tevent_req
*cli_posix_rmdir_send(TALLOC_CTX
*mem_ctx
,
641 struct tevent_context
*ev
,
642 struct cli_state
*cli
,
644 NTSTATUS
cli_posix_rmdir_recv(struct tevent_req
*req
, TALLOC_CTX
*mem_ctx
);
645 NTSTATUS
cli_posix_rmdir(struct cli_state
*cli
, const char *fname
);
646 struct tevent_req
*cli_notify_send(TALLOC_CTX
*mem_ctx
,
647 struct tevent_context
*ev
,
648 struct cli_state
*cli
, uint16_t fnum
,
649 uint32_t buffer_size
,
650 uint32_t completion_filter
, bool recursive
);
651 NTSTATUS
cli_notify_recv(struct tevent_req
*req
, TALLOC_CTX
*mem_ctx
,
652 uint32_t *pnum_changes
,
653 struct notify_change
**pchanges
);
654 NTSTATUS
cli_notify(struct cli_state
*cli
, uint16_t fnum
, uint32_t buffer_size
,
655 uint32_t completion_filter
, bool recursive
,
656 TALLOC_CTX
*mem_ctx
, uint32_t *pnum_changes
,
657 struct notify_change
**pchanges
);
659 struct tevent_req
*cli_nttrans_create_send(TALLOC_CTX
*mem_ctx
,
660 struct tevent_context
*ev
,
661 struct cli_state
*cli
,
664 uint32_t DesiredAccess
,
665 uint32_t FileAttributes
,
666 uint32_t ShareAccess
,
667 uint32_t CreateDisposition
,
668 uint32_t CreateOptions
,
669 uint8_t SecurityFlags
,
670 struct security_descriptor
*secdesc
,
671 struct ea_struct
*eas
,
673 NTSTATUS
cli_nttrans_create_recv(struct tevent_req
*req
,
675 struct smb_create_returns
*cr
);
676 NTSTATUS
cli_nttrans_create(struct cli_state
*cli
,
679 uint32_t DesiredAccess
,
680 uint32_t FileAttributes
,
681 uint32_t ShareAccess
,
682 uint32_t CreateDisposition
,
683 uint32_t CreateOptions
,
684 uint8_t SecurityFlags
,
685 struct security_descriptor
*secdesc
,
686 struct ea_struct
*eas
,
689 struct smb_create_returns
*cr
);
691 /* The following definitions come from libsmb/clifsinfo.c */
693 struct tevent_req
*cli_unix_extensions_version_send(TALLOC_CTX
*mem_ctx
,
694 struct tevent_context
*ev
,
695 struct cli_state
*cli
);
696 NTSTATUS
cli_unix_extensions_version_recv(struct tevent_req
*req
,
697 uint16_t *pmajor
, uint16_t *pminor
,
700 NTSTATUS
cli_unix_extensions_version(struct cli_state
*cli
, uint16_t *pmajor
,
701 uint16_t *pminor
, uint32_t *pcaplow
,
703 struct tevent_req
*cli_set_unix_extensions_capabilities_send(
704 TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
, struct cli_state
*cli
,
705 uint16_t major
, uint16_t minor
, uint32_t caplow
, uint32_t caphigh
);
706 NTSTATUS
cli_set_unix_extensions_capabilities_recv(struct tevent_req
*req
);
707 NTSTATUS
cli_set_unix_extensions_capabilities(struct cli_state
*cli
,
708 uint16_t major
, uint16_t minor
,
709 uint32_t caplow
, uint32_t caphigh
);
710 struct tevent_req
*cli_get_fs_attr_info_send(TALLOC_CTX
*mem_ctx
,
711 struct tevent_context
*ev
,
712 struct cli_state
*cli
);
713 NTSTATUS
cli_get_fs_attr_info_recv(struct tevent_req
*req
, uint32_t *fs_attr
);
714 NTSTATUS
cli_get_fs_attr_info(struct cli_state
*cli
, uint32_t *fs_attr
);
715 NTSTATUS
cli_get_fs_volume_info(struct cli_state
*cli
,
716 TALLOC_CTX
*mem_ctx
, char **volume_name
,
717 uint32_t *pserial_number
, time_t *pdate
);
718 NTSTATUS
cli_get_fs_full_size_info(struct cli_state
*cli
,
719 uint64_t *total_allocation_units
,
720 uint64_t *caller_allocation_units
,
721 uint64_t *actual_allocation_units
,
722 uint64_t *sectors_per_allocation_unit
,
723 uint64_t *bytes_per_sector
);
724 NTSTATUS
cli_get_posix_fs_info(struct cli_state
*cli
,
725 uint32_t *optimal_transfer_size
,
726 uint32_t *block_size
,
727 uint64_t *total_blocks
,
728 uint64_t *blocks_available
,
729 uint64_t *user_blocks_available
,
730 uint64_t *total_file_nodes
,
731 uint64_t *free_file_nodes
,
732 uint64_t *fs_identifier
);
733 struct tevent_req
*cli_posix_whoami_send(TALLOC_CTX
*mem_ctx
,
734 struct tevent_context
*ev
,
735 struct cli_state
*cli
);
736 NTSTATUS
cli_posix_whoami_recv(struct tevent_req
*req
,
743 struct dom_sid
**psids
,
745 NTSTATUS
cli_posix_whoami(struct cli_state
*cli
,
752 struct dom_sid
**sids
,
755 /* The following definitions come from libsmb/clilist.c */
757 NTSTATUS
is_bad_finfo_name(const struct cli_state
*cli
,
758 const struct file_info
*finfo
);
760 NTSTATUS
cli_list_old(struct cli_state
*cli
,const char *Mask
,uint32_t attribute
,
761 NTSTATUS (*fn
)(struct file_info
*,
762 const char *, void *), void *state
);
763 NTSTATUS
cli_list_trans(struct cli_state
*cli
, const char *mask
,
764 uint32_t attribute
, int info_level
,
766 struct file_info
*finfo
,
770 struct tevent_req
*cli_list_send(TALLOC_CTX
*mem_ctx
,
771 struct tevent_context
*ev
,
772 struct cli_state
*cli
,
777 NTSTATUS
cli_list_recv(
778 struct tevent_req
*req
,
780 struct file_info
**pfinfo
);
781 NTSTATUS
cli_list(struct cli_state
*cli
,
784 NTSTATUS (*fn
)(struct file_info
*finfo
,
789 /* The following definitions come from libsmb/climessage.c */
791 struct tevent_req
*cli_message_send(TALLOC_CTX
*mem_ctx
,
792 struct tevent_context
*ev
,
793 struct cli_state
*cli
,
794 const char *host
, const char *username
,
795 const char *message
);
796 NTSTATUS
cli_message_recv(struct tevent_req
*req
);
797 NTSTATUS
cli_message(struct cli_state
*cli
, const char *host
,
798 const char *username
, const char *message
);
800 /* The following definitions come from libsmb/clioplock.c */
802 struct tevent_req
*cli_smb_oplock_break_waiter_send(TALLOC_CTX
*mem_ctx
,
803 struct tevent_context
*ev
,
804 struct cli_state
*cli
);
805 NTSTATUS
cli_smb_oplock_break_waiter_recv(struct tevent_req
*req
,
809 struct tevent_req
*cli_oplock_ack_send(TALLOC_CTX
*mem_ctx
,
810 struct tevent_context
*ev
,
811 struct cli_state
*cli
,
812 uint16_t fnum
, uint8_t level
);
813 NTSTATUS
cli_oplock_ack_recv(struct tevent_req
*req
);
815 /* The following definitions come from libsmb/cliprint.c */
817 NTSTATUS
cli_print_queue(struct cli_state
*cli
,
818 void (*fn
)(struct print_job_info
*));
819 int cli_printjob_del(struct cli_state
*cli
, int job
);
821 /* The following definitions come from libsmb/cliquota.c */
823 NTSTATUS
cli_get_quota_handle(struct cli_state
*cli
, uint16_t *quota_fnum
);
824 void free_ntquota_list(SMB_NTQUOTA_LIST
**qt_list
);
825 bool parse_user_quota_record(const uint8_t *rdata
,
826 unsigned int rdata_count
,
827 unsigned int *offset
,
828 SMB_NTQUOTA_STRUCT
*pqt
);
829 bool add_record_to_ntquota_list(TALLOC_CTX
*mem_ctx
,
830 SMB_NTQUOTA_STRUCT
*pqt
,
831 SMB_NTQUOTA_LIST
**pqt_list
);
832 NTSTATUS
parse_user_quota_list(const uint8_t *curdata
,
833 uint32_t curdata_size
,
835 SMB_NTQUOTA_LIST
**pqt_list
);
836 NTSTATUS
parse_fs_quota_buffer(const uint8_t *rdata
,
837 unsigned int rdata_count
,
838 SMB_NTQUOTA_STRUCT
*pqt
);
839 NTSTATUS
build_user_quota_buffer(SMB_NTQUOTA_LIST
*qt_list
,
843 SMB_NTQUOTA_LIST
**end_ptr
);
844 NTSTATUS
build_fs_quota_buffer(TALLOC_CTX
*mem_ctx
,
845 const SMB_NTQUOTA_STRUCT
*pqt
,
848 NTSTATUS
cli_get_user_quota(struct cli_state
*cli
, int quota_fnum
,
849 SMB_NTQUOTA_STRUCT
*pqt
);
850 NTSTATUS
cli_set_user_quota(struct cli_state
*cli
,
852 SMB_NTQUOTA_LIST
*qtl
);
853 NTSTATUS
cli_list_user_quota(struct cli_state
*cli
, int quota_fnum
,
854 SMB_NTQUOTA_LIST
**pqt_list
);
855 NTSTATUS
cli_get_fs_quota_info(struct cli_state
*cli
, int quota_fnum
,
856 SMB_NTQUOTA_STRUCT
*pqt
);
857 NTSTATUS
cli_set_fs_quota_info(struct cli_state
*cli
, int quota_fnum
,
858 SMB_NTQUOTA_STRUCT
*pqt
);
860 /* The following definitions come from libsmb/clireadwrite.c */
862 struct tevent_req
*cli_read_andx_create(TALLOC_CTX
*mem_ctx
,
863 struct tevent_context
*ev
,
864 struct cli_state
*cli
, uint16_t fnum
,
865 off_t offset
, size_t size
,
866 struct tevent_req
**psmbreq
);
867 struct tevent_req
*cli_read_andx_send(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 NTSTATUS
cli_read_andx_recv(struct tevent_req
*req
, ssize_t
*received
,
873 struct tevent_req
*cli_pull_send(TALLOC_CTX
*mem_ctx
,
874 struct tevent_context
*ev
,
875 struct cli_state
*cli
,
876 uint16_t fnum
, off_t start_offset
,
877 off_t size
, size_t window_size
,
878 NTSTATUS (*sink
)(char *buf
, size_t n
,
881 NTSTATUS
cli_pull_recv(struct tevent_req
*req
, off_t
*received
);
882 NTSTATUS
cli_pull(struct cli_state
*cli
, uint16_t fnum
,
883 off_t start_offset
, off_t size
, size_t window_size
,
884 NTSTATUS (*sink
)(char *buf
, size_t n
, void *priv
),
885 void *priv
, off_t
*received
);
886 NTSTATUS
cli_read_sink(char *buf
, size_t n
, void *priv
);
887 struct tevent_req
*cli_read_send(
889 struct tevent_context
*ev
,
890 struct cli_state
*cli
,
895 NTSTATUS
cli_read_recv(struct tevent_req
*req
, size_t *received
);
896 NTSTATUS
cli_read(struct cli_state
*cli
, uint16_t fnum
,
897 char *buf
, off_t offset
, size_t size
,
899 NTSTATUS
cli_smbwrite(struct cli_state
*cli
, uint16_t fnum
, char *buf
,
900 off_t offset
, size_t size1
, size_t *ptotal
);
901 struct tevent_req
*cli_write_andx_create(TALLOC_CTX
*mem_ctx
,
902 struct tevent_context
*ev
,
903 struct cli_state
*cli
, uint16_t fnum
,
904 uint16_t mode
, const uint8_t *buf
,
905 off_t offset
, size_t size
,
906 struct tevent_req
**reqs_before
,
908 struct tevent_req
**psmbreq
);
909 struct tevent_req
*cli_write_andx_send(TALLOC_CTX
*mem_ctx
,
910 struct tevent_context
*ev
,
911 struct cli_state
*cli
, uint16_t fnum
,
912 uint16_t mode
, const uint8_t *buf
,
913 off_t offset
, size_t size
);
914 NTSTATUS
cli_write_andx_recv(struct tevent_req
*req
, size_t *pwritten
);
916 struct tevent_req
*cli_write_send(TALLOC_CTX
*mem_ctx
,
917 struct tevent_context
*ev
,
918 struct cli_state
*cli
, uint16_t fnum
,
919 uint16_t mode
, const uint8_t *buf
,
920 off_t offset
, size_t size
);
921 NTSTATUS
cli_write_recv(struct tevent_req
*req
, size_t *pwritten
);
923 struct tevent_req
*cli_writeall_send(
925 struct tevent_context
*ev
,
926 struct cli_state
*cli
,
932 NTSTATUS
cli_writeall_recv(struct tevent_req
*req
, size_t *pwritten
);
933 NTSTATUS
cli_writeall(struct cli_state
*cli
, uint16_t fnum
, uint16_t mode
,
934 const uint8_t *buf
, off_t offset
, size_t size
,
937 struct tevent_req
*cli_push_send(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
938 struct cli_state
*cli
,
939 uint16_t fnum
, uint16_t mode
,
940 off_t start_offset
, size_t window_size
,
941 size_t (*source
)(uint8_t *buf
, size_t n
,
944 NTSTATUS
cli_push_recv(struct tevent_req
*req
);
945 NTSTATUS
cli_push(struct cli_state
*cli
, uint16_t fnum
, uint16_t mode
,
946 off_t start_offset
, size_t window_size
,
947 size_t (*source
)(uint8_t *buf
, size_t n
, void *priv
),
950 NTSTATUS
cli_splice(struct cli_state
*srccli
, struct cli_state
*dstcli
,
951 uint16_t src_fnum
, uint16_t dst_fnum
,
953 off_t src_offset
, off_t dst_offset
,
955 int (*splice_cb
)(off_t n
, void *priv
), void *priv
);
957 /* The following definitions come from libsmb/clisecdesc.c */
959 struct tevent_req
*cli_query_security_descriptor_send(
961 struct tevent_context
*ev
,
962 struct cli_state
*cli
,
965 NTSTATUS
cli_query_security_descriptor_recv(
966 struct tevent_req
*req
,
968 struct security_descriptor
**sd
);
969 NTSTATUS
cli_query_security_descriptor(struct cli_state
*cli
,
973 struct security_descriptor
**sd
);
974 NTSTATUS
cli_query_secdesc(struct cli_state
*cli
, uint16_t fnum
,
975 TALLOC_CTX
*mem_ctx
, struct security_descriptor
**sd
);
976 struct tevent_req
*cli_set_security_descriptor_send(
978 struct tevent_context
*ev
,
979 struct cli_state
*cli
,
982 const struct security_descriptor
*sd
);
983 NTSTATUS
cli_set_security_descriptor_recv(struct tevent_req
*req
);
984 NTSTATUS
cli_set_security_descriptor(struct cli_state
*cli
,
987 const struct security_descriptor
*sd
);
988 NTSTATUS
cli_set_secdesc(struct cli_state
*cli
, uint16_t fnum
,
989 const struct security_descriptor
*sd
);
991 NTSTATUS
cli_query_mxac(struct cli_state
*cli
,
992 const char *filename
,
995 /* The following definitions come from libsmb/clitrans.c */
997 struct tevent_req
*cli_trans_send(
998 TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
999 struct cli_state
*cli
, uint16_t additional_flags2
, uint8_t cmd
,
1000 const char *pipe_name
, uint16_t fid
, uint16_t function
, int flags
,
1001 uint16_t *setup
, uint8_t num_setup
, uint8_t max_setup
,
1002 uint8_t *param
, uint32_t num_param
, uint32_t max_param
,
1003 uint8_t *data
, uint32_t num_data
, uint32_t max_data
);
1004 NTSTATUS
cli_trans_recv(struct tevent_req
*req
, TALLOC_CTX
*mem_ctx
,
1005 uint16_t *recv_flags2
,
1006 uint16_t **setup
, uint8_t min_setup
,
1008 uint8_t **param
, uint32_t min_param
,
1009 uint32_t *num_param
,
1010 uint8_t **data
, uint32_t min_data
,
1011 uint32_t *num_data
);
1012 NTSTATUS
cli_trans(TALLOC_CTX
*mem_ctx
, struct cli_state
*cli
,
1014 const char *pipe_name
, uint16_t fid
, uint16_t function
,
1016 uint16_t *setup
, uint8_t num_setup
, uint8_t max_setup
,
1017 uint8_t *param
, uint32_t num_param
, uint32_t max_param
,
1018 uint8_t *data
, uint32_t num_data
, uint32_t max_data
,
1019 uint16_t *recv_flags2
,
1020 uint16_t **rsetup
, uint8_t min_rsetup
, uint8_t *num_rsetup
,
1021 uint8_t **rparam
, uint32_t min_rparam
, uint32_t *num_rparam
,
1022 uint8_t **rdata
, uint32_t min_rdata
, uint32_t *num_rdata
);
1024 /* The following definitions come from libsmb/clisymlink.c */
1026 struct tevent_req
*cli_symlink_send(TALLOC_CTX
*mem_ctx
,
1027 struct tevent_context
*ev
,
1028 struct cli_state
*cli
,
1029 const char *oldpath
,
1030 const char *newpath
,
1032 NTSTATUS
cli_symlink_recv(struct tevent_req
*req
);
1033 NTSTATUS
cli_symlink(struct cli_state
*cli
, const char *oldname
,
1034 const char *newname
, uint32_t flags
);
1036 struct tevent_req
*cli_readlink_send(TALLOC_CTX
*mem_ctx
,
1037 struct tevent_context
*ev
,
1038 struct cli_state
*cli
,
1040 NTSTATUS
cli_readlink_recv(struct tevent_req
*req
, TALLOC_CTX
*mem_ctx
,
1041 char **psubstitute_name
, char **pprint_name
,
1043 NTSTATUS
cli_readlink(struct cli_state
*cli
, const char *fname
,
1044 TALLOC_CTX
*mem_ctx
, char **psubstitute_name
,
1045 char **pprint_name
, uint32_t *pflags
);
1047 NTSTATUS
fill_quota_buffer(TALLOC_CTX
*mem_ctx
,
1048 SMB_NTQUOTA_LIST
*tmp_list
,
1052 SMB_NTQUOTA_LIST
**end_ptr
);
1053 /* The following definitions come from libsmb/passchange.c */
1055 NTSTATUS
remote_password_change(const char *remote_machine
,
1056 const char *domain
, const char *user_name
,
1057 const char *old_passwd
, const char *new_passwd
,
1060 #endif /* _LIBSMB_PROTO_H_ */