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 #include "auth_info.h"
31 struct smb_trans_enc_state
;
32 struct cli_credentials
;
35 struct print_job_info
;
37 /* The following definitions come from libsmb/cliconnect.c */
39 struct cli_credentials
*cli_session_creds_init(TALLOC_CTX
*mem_ctx
,
45 bool fallback_after_kerberos
,
47 bool password_is_nt_hash
);
48 NTSTATUS
cli_session_creds_prepare_krb5(struct cli_state
*cli
,
49 struct cli_credentials
*creds
);
50 struct tevent_req
*cli_session_setup_creds_send(TALLOC_CTX
*mem_ctx
,
51 struct tevent_context
*ev
,
52 struct cli_state
*cli
,
53 struct cli_credentials
*creds
);
54 NTSTATUS
cli_session_setup_creds_recv(struct tevent_req
*req
);
55 NTSTATUS
cli_session_setup_creds(struct cli_state
*cli
,
56 struct cli_credentials
*creds
);
57 NTSTATUS
cli_session_setup_anon(struct cli_state
*cli
);
58 struct tevent_req
*cli_session_setup_guest_create(TALLOC_CTX
*mem_ctx
,
59 struct tevent_context
*ev
,
60 struct cli_state
*cli
,
61 struct tevent_req
**psmbreq
);
62 struct tevent_req
*cli_session_setup_guest_send(TALLOC_CTX
*mem_ctx
,
63 struct tevent_context
*ev
,
64 struct cli_state
*cli
);
65 NTSTATUS
cli_session_setup_guest_recv(struct tevent_req
*req
);
66 NTSTATUS
cli_ulogoff(struct cli_state
*cli
);
67 struct tevent_req
*cli_tcon_andx_create(TALLOC_CTX
*mem_ctx
,
68 struct tevent_context
*ev
,
69 struct cli_state
*cli
,
70 const char *share
, const char *dev
,
71 const char *pass
, int passlen
,
72 struct tevent_req
**psmbreq
);
73 struct tevent_req
*cli_tcon_andx_send(TALLOC_CTX
*mem_ctx
,
74 struct tevent_context
*ev
,
75 struct cli_state
*cli
,
76 const char *share
, const char *dev
,
77 const char *pass
, int passlen
);
78 NTSTATUS
cli_tcon_andx_recv(struct tevent_req
*req
);
79 NTSTATUS
cli_tcon_andx(struct cli_state
*cli
, const char *share
,
80 const char *dev
, const char *pass
, int passlen
);
81 NTSTATUS
cli_tree_connect_creds(struct cli_state
*cli
,
82 const char *share
, const char *dev
,
83 struct cli_credentials
*creds
);
84 NTSTATUS
cli_tree_connect(struct cli_state
*cli
, const char *share
,
85 const char *dev
, const char *pass
);
86 NTSTATUS
cli_tdis(struct cli_state
*cli
);
87 NTSTATUS
cli_connect_nb(const char *host
, const struct sockaddr_storage
*dest_ss
,
88 uint16_t port
, int name_type
, const char *myname
,
89 int signing_state
, int flags
, struct cli_state
**pcli
);
90 NTSTATUS
cli_start_connection(struct cli_state
**output_cli
,
92 const char *dest_host
,
93 const struct sockaddr_storage
*dest_ss
, int port
,
94 int signing_state
, int flags
);
95 NTSTATUS
cli_smb1_setup_encryption(struct cli_state
*cli
,
96 struct cli_credentials
*creds
);
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
,
103 int flags
, int signing_state
);
104 NTSTATUS
cli_full_connection_creds_recv(struct tevent_req
*req
,
105 struct cli_state
**output_cli
);
106 NTSTATUS
cli_full_connection_creds(struct cli_state
**output_cli
,
108 const char *dest_host
,
109 const struct sockaddr_storage
*dest_ss
, int port
,
110 const char *service
, const char *service_type
,
111 struct cli_credentials
*creds
,
114 NTSTATUS
cli_full_connection(struct cli_state
**output_cli
,
116 const char *dest_host
,
117 const struct sockaddr_storage
*dest_ss
, int port
,
118 const char *service
, const char *service_type
,
119 const char *user
, const char *domain
,
120 const char *password
, int flags
,
122 NTSTATUS
cli_raw_tcon(struct cli_state
*cli
,
123 const char *service
, const char *pass
, const char *dev
,
124 uint16_t *max_xmit
, uint16_t *tid
);
125 struct cli_state
*get_ipc_connect(char *server
,
126 struct sockaddr_storage
*server_ss
,
127 const struct user_auth_info
*user_info
);
128 struct cli_state
*get_ipc_connect_master_ip(TALLOC_CTX
*ctx
,
129 struct sockaddr_storage
*mb_ip
,
130 const struct user_auth_info
*user_info
,
131 char **pp_workgroup_out
);
132 struct cli_state
*get_ipc_connect_master_ip_bcast(TALLOC_CTX
*ctx
,
133 const struct user_auth_info
*user_info
,
134 char **pp_workgroup_out
);
136 /* The following definitions come from libsmb/clidfs.c */
138 NTSTATUS
cli_cm_force_encryption_creds(struct cli_state
*c
,
139 struct cli_credentials
*creds
,
140 const char *sharename
);
141 NTSTATUS
cli_cm_force_encryption(struct cli_state
*c
,
142 const char *username
,
143 const char *password
,
145 const char *sharename
);
146 NTSTATUS
cli_cm_open(TALLOC_CTX
*ctx
,
147 struct cli_state
*referring_cli
,
150 const struct user_auth_info
*auth_info
,
155 struct cli_state
**pcli
);
156 void cli_cm_display(struct cli_state
*c
);
157 struct client_dfs_referral
;
158 NTSTATUS
cli_dfs_get_referral_ex(TALLOC_CTX
*ctx
,
159 struct cli_state
*cli
,
161 uint16_t max_referral_level
,
162 struct client_dfs_referral
**refs
,
165 NTSTATUS
cli_dfs_get_referral(TALLOC_CTX
*ctx
,
166 struct cli_state
*cli
,
168 struct client_dfs_referral
**refs
,
171 NTSTATUS
cli_resolve_path(TALLOC_CTX
*ctx
,
173 const struct user_auth_info
*dfs_auth_info
,
174 struct cli_state
*rootcli
,
176 struct cli_state
**targetcli
,
177 char **pp_targetpath
);
179 bool cli_check_msdfs_proxy(TALLOC_CTX
*ctx
,
180 struct cli_state
*cli
,
181 const char *sharename
,
185 struct cli_credentials
*creds
);
187 /* The following definitions come from libsmb/clientgen.c */
189 int cli_set_message(char *buf
,int num_words
,int num_bytes
,bool zero
);
190 unsigned int cli_set_timeout(struct cli_state
*cli
, unsigned int timeout
);
191 bool cli_set_backup_intent(struct cli_state
*cli
, bool flag
);
192 extern struct GUID cli_state_client_guid
;
193 struct cli_state
*cli_state_create(TALLOC_CTX
*mem_ctx
,
195 const char *remote_name
,
198 void cli_nt_pipes_close(struct cli_state
*cli
);
199 void cli_shutdown(struct cli_state
*cli
);
200 uint16_t cli_state_get_vc_num(struct cli_state
*cli
);
201 uint32_t cli_setpid(struct cli_state
*cli
, uint32_t pid
);
202 uint32_t cli_getpid(struct cli_state
*cli
);
203 bool cli_state_is_encryption_on(struct cli_state
*cli
);
204 bool cli_state_has_tcon(struct cli_state
*cli
);
205 uint32_t cli_state_get_tid(struct cli_state
*cli
);
206 uint32_t cli_state_set_tid(struct cli_state
*cli
, uint32_t tid
);
208 struct smbXcli_tcon
*cli_state_save_tcon(struct cli_state
*cli
);
209 void cli_state_restore_tcon(struct cli_state
*cli
, struct smbXcli_tcon
*tcon
);
210 uint16_t cli_state_get_uid(struct cli_state
*cli
);
211 uint16_t cli_state_set_uid(struct cli_state
*cli
, uint16_t uid
);
212 bool cli_set_case_sensitive(struct cli_state
*cli
, bool case_sensitive
);
213 uint32_t cli_state_available_size(struct cli_state
*cli
, uint32_t ofs
);
214 time_t cli_state_server_time(struct cli_state
*cli
);
215 struct tevent_req
*cli_echo_send(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
216 struct cli_state
*cli
, uint16_t num_echos
,
218 NTSTATUS
cli_echo_recv(struct tevent_req
*req
);
219 NTSTATUS
cli_echo(struct cli_state
*cli
, uint16_t num_echos
, DATA_BLOB data
);
220 NTSTATUS
cli_smb(TALLOC_CTX
*mem_ctx
, struct cli_state
*cli
,
221 uint8_t smb_command
, uint8_t additional_flags
,
222 uint8_t wct
, uint16_t *vwv
,
223 uint32_t num_bytes
, const uint8_t *bytes
,
224 struct tevent_req
**result_parent
,
225 uint8_t min_wct
, uint8_t *pwct
, uint16_t **pvwv
,
226 uint32_t *pnum_bytes
, uint8_t **pbytes
);
228 /* The following definitions come from libsmb/clierror.c */
230 const char *cli_errstr(struct cli_state
*cli
);
231 NTSTATUS
cli_nt_error(struct cli_state
*cli
);
232 void cli_dos_error(struct cli_state
*cli
, uint8_t *eclass
, uint32_t *ecode
);
233 int cli_errno(struct cli_state
*cli
);
234 bool cli_is_error(struct cli_state
*cli
);
235 bool cli_is_nt_error(struct cli_state
*cli
);
236 bool cli_is_dos_error(struct cli_state
*cli
);
237 bool cli_state_is_connected(struct cli_state
*cli
);
239 /* The following definitions come from libsmb/clifile.c */
241 struct tevent_req
*cli_setpathinfo_send(TALLOC_CTX
*mem_ctx
,
242 struct tevent_context
*ev
,
243 struct cli_state
*cli
,
248 NTSTATUS
cli_setpathinfo_recv(struct tevent_req
*req
);
249 NTSTATUS
cli_setpathinfo(struct cli_state
*cli
,
255 struct tevent_req
*cli_posix_symlink_send(TALLOC_CTX
*mem_ctx
,
256 struct tevent_context
*ev
,
257 struct cli_state
*cli
,
259 const char *newname
);
260 NTSTATUS
cli_posix_symlink_recv(struct tevent_req
*req
);
261 NTSTATUS
cli_posix_symlink(struct cli_state
*cli
,
263 const char *newname
);
264 struct tevent_req
*cli_posix_readlink_send(TALLOC_CTX
*mem_ctx
,
265 struct tevent_context
*ev
,
266 struct cli_state
*cli
,
268 NTSTATUS
cli_posix_readlink_recv(
269 struct tevent_req
*req
, TALLOC_CTX
*mem_ctx
, char **target
);
270 NTSTATUS
cli_posix_readlink(
271 struct cli_state
*cli
,
275 struct tevent_req
*cli_posix_hardlink_send(TALLOC_CTX
*mem_ctx
,
276 struct tevent_context
*ev
,
277 struct cli_state
*cli
,
279 const char *newname
);
280 NTSTATUS
cli_posix_hardlink_recv(struct tevent_req
*req
);
281 NTSTATUS
cli_posix_hardlink(struct cli_state
*cli
,
283 const char *newname
);
284 uint32_t unix_perms_to_wire(mode_t perms
);
285 mode_t
wire_perms_to_unix(uint32_t perms
);
286 struct tevent_req
*cli_posix_getacl_send(TALLOC_CTX
*mem_ctx
,
287 struct tevent_context
*ev
,
288 struct cli_state
*cli
,
290 NTSTATUS
cli_posix_getacl_recv(struct tevent_req
*req
,
294 NTSTATUS
cli_posix_getacl(struct cli_state
*cli
,
299 struct tevent_req
*cli_posix_setacl_send(TALLOC_CTX
*mem_ctx
,
300 struct tevent_context
*ev
,
301 struct cli_state
*cli
,
304 size_t acl_buf_size
);
305 NTSTATUS
cli_posix_setacl_recv(struct tevent_req
*req
);
306 NTSTATUS
cli_posix_setacl(struct cli_state
*cli
,
309 size_t acl_buf_size
);
310 struct tevent_req
*cli_posix_stat_send(TALLOC_CTX
*mem_ctx
,
311 struct tevent_context
*ev
,
312 struct cli_state
*cli
,
314 SMB_STRUCT_STAT
*sbuf
);
315 NTSTATUS
cli_posix_stat_recv(struct tevent_req
*req
);
316 NTSTATUS
cli_posix_stat(struct cli_state
*cli
,
318 SMB_STRUCT_STAT
*sbuf
);
319 struct tevent_req
*cli_posix_chmod_send(TALLOC_CTX
*mem_ctx
,
320 struct tevent_context
*ev
,
321 struct cli_state
*cli
,
324 NTSTATUS
cli_posix_chmod_recv(struct tevent_req
*req
);
325 NTSTATUS
cli_posix_chmod(struct cli_state
*cli
, const char *fname
, mode_t mode
);
326 struct tevent_req
*cli_posix_chown_send(TALLOC_CTX
*mem_ctx
,
327 struct tevent_context
*ev
,
328 struct cli_state
*cli
,
332 NTSTATUS
cli_posix_chown_recv(struct tevent_req
*req
);
333 NTSTATUS
cli_posix_chown(struct cli_state
*cli
,
337 struct tevent_req
*cli_rename_send(TALLOC_CTX
*mem_ctx
,
338 struct tevent_context
*ev
,
339 struct cli_state
*cli
,
340 const char *fname_src
,
341 const char *fname_dst
,
343 NTSTATUS
cli_rename_recv(struct tevent_req
*req
);
344 NTSTATUS
cli_rename(struct cli_state
*cli
,
345 const char *fname_src
,
346 const char *fname_dst
,
348 struct tevent_req
*cli_ntrename_send(TALLOC_CTX
*mem_ctx
,
349 struct tevent_context
*ev
,
350 struct cli_state
*cli
,
351 const char *fname_src
,
352 const char *fname_dst
);
353 NTSTATUS
cli_ntrename_recv(struct tevent_req
*req
);
354 NTSTATUS
cli_ntrename(struct cli_state
*cli
, const char *fname_src
, const char *fname_dst
);
356 struct tevent_req
*cli_hardlink_send(
358 struct tevent_context
*ev
,
359 struct cli_state
*cli
,
360 const char *fname_src
,
361 const char *fname_dst
);
362 NTSTATUS
cli_hardlink_recv(struct tevent_req
*req
);
363 NTSTATUS
cli_hardlink(
364 struct cli_state
*cli
,
365 const char *fname_src
,
366 const char *fname_dst
);
368 struct tevent_req
*cli_unlink_send(TALLOC_CTX
*mem_ctx
,
369 struct tevent_context
*ev
,
370 struct cli_state
*cli
,
372 uint16_t mayhave_attrs
);
373 NTSTATUS
cli_unlink_recv(struct tevent_req
*req
);
374 NTSTATUS
cli_unlink(struct cli_state
*cli
, const char *fname
, uint16_t mayhave_attrs
);
376 struct tevent_req
*cli_mkdir_send(TALLOC_CTX
*mem_ctx
,
377 struct tevent_context
*ev
,
378 struct cli_state
*cli
,
380 NTSTATUS
cli_mkdir_recv(struct tevent_req
*req
);
381 NTSTATUS
cli_mkdir(struct cli_state
*cli
, const char *dname
);
382 struct tevent_req
*cli_rmdir_send(TALLOC_CTX
*mem_ctx
,
383 struct tevent_context
*ev
,
384 struct cli_state
*cli
,
386 NTSTATUS
cli_rmdir_recv(struct tevent_req
*req
);
387 NTSTATUS
cli_rmdir(struct cli_state
*cli
, const char *dname
);
388 struct tevent_req
*cli_nt_delete_on_close_send(TALLOC_CTX
*mem_ctx
,
389 struct tevent_context
*ev
,
390 struct cli_state
*cli
,
393 NTSTATUS
cli_nt_delete_on_close_recv(struct tevent_req
*req
);
394 NTSTATUS
cli_nt_delete_on_close(struct cli_state
*cli
, uint16_t fnum
, bool flag
);
395 struct tevent_req
*cli_ntcreate_send(TALLOC_CTX
*mem_ctx
,
396 struct tevent_context
*ev
,
397 struct cli_state
*cli
,
400 uint32_t DesiredAccess
,
401 uint32_t FileAttributes
,
402 uint32_t ShareAccess
,
403 uint32_t CreateDisposition
,
404 uint32_t CreateOptions
,
405 uint32_t ImpersonationLevel
,
406 uint8_t SecurityFlags
);
407 NTSTATUS
cli_ntcreate_recv(struct tevent_req
*req
,
409 struct smb_create_returns
*cr
);
410 NTSTATUS
cli_ntcreate(struct cli_state
*cli
,
413 uint32_t DesiredAccess
,
414 uint32_t FileAttributes
,
415 uint32_t ShareAccess
,
416 uint32_t CreateDisposition
,
417 uint32_t CreateOptions
,
418 uint8_t SecurityFlags
,
420 struct smb_create_returns
*cr
);
421 struct tevent_req
*cli_openx_create(TALLOC_CTX
*mem_ctx
,
422 struct tevent_context
*ev
,
423 struct cli_state
*cli
, const char *fname
,
424 int flags
, int share_mode
,
425 struct tevent_req
**psmbreq
);
426 struct tevent_req
*cli_openx_send(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
427 struct cli_state
*cli
, const char *fname
,
428 int flags
, int share_mode
);
429 NTSTATUS
cli_openx_recv(struct tevent_req
*req
, uint16_t *fnum
);
430 NTSTATUS
cli_openx(struct cli_state
*cli
, const char *fname
, int flags
, int share_mode
, uint16_t *pfnum
);
431 NTSTATUS
cli_open(struct cli_state
*cli
, const char *fname
, int flags
, int share_mode
, uint16_t *pfnum
);
432 struct tevent_req
*cli_smb1_close_create(TALLOC_CTX
*mem_ctx
,
433 struct tevent_context
*ev
,
434 struct cli_state
*cli
, uint16_t fnum
,
435 struct tevent_req
**psubreq
);
436 struct tevent_req
*cli_close_send(TALLOC_CTX
*mem_ctx
,
437 struct tevent_context
*ev
,
438 struct cli_state
*cli
, uint16_t fnum
);
439 NTSTATUS
cli_close_recv(struct tevent_req
*req
);
440 NTSTATUS
cli_close(struct cli_state
*cli
, uint16_t fnum
);
441 struct tevent_req
*cli_ftruncate_send(TALLOC_CTX
*mem_ctx
,
442 struct tevent_context
*ev
,
443 struct cli_state
*cli
,
446 NTSTATUS
cli_ftruncate_recv(struct tevent_req
*req
);
447 NTSTATUS
cli_ftruncate(struct cli_state
*cli
, uint16_t fnum
, uint64_t size
);
448 NTSTATUS
cli_locktype(struct cli_state
*cli
, uint16_t fnum
,
449 uint32_t offset
, uint32_t len
,
450 int timeout
, unsigned char locktype
);
451 struct smb1_lock_element
{
457 struct tevent_req
*cli_lockingx_create(
459 struct tevent_context
*ev
,
460 struct cli_state
*cli
,
463 uint8_t newoplocklevel
,
465 uint16_t num_unlocks
,
466 const struct smb1_lock_element
*unlocks
,
468 const struct smb1_lock_element
*locks
,
469 struct tevent_req
**psmbreq
);
470 struct tevent_req
*cli_lockingx_send(
472 struct tevent_context
*ev
,
473 struct cli_state
*cli
,
476 uint8_t newoplocklevel
,
478 uint16_t num_unlocks
,
479 const struct smb1_lock_element
*unlocks
,
481 const struct smb1_lock_element
*locks
);
482 NTSTATUS
cli_lockingx_recv(struct tevent_req
*req
);
483 NTSTATUS
cli_lockingx(
484 struct cli_state
*cli
,
487 uint8_t newoplocklevel
,
489 uint16_t num_unlocks
,
490 const struct smb1_lock_element
*unlocks
,
492 const struct smb1_lock_element
*locks
);
494 NTSTATUS
cli_lock32(struct cli_state
*cli
, uint16_t fnum
, uint32_t offset
,
495 uint32_t len
, int timeout
, enum brl_type lock_type
);
496 struct tevent_req
*cli_unlock_send(TALLOC_CTX
*mem_ctx
,
497 struct tevent_context
*ev
,
498 struct cli_state
*cli
,
502 NTSTATUS
cli_unlock_recv(struct tevent_req
*req
);
503 NTSTATUS
cli_unlock(struct cli_state
*cli
, uint16_t fnum
, uint32_t offset
, uint32_t len
);
504 struct tevent_req
*cli_posix_lock_send(TALLOC_CTX
*mem_ctx
,
505 struct tevent_context
*ev
,
506 struct cli_state
*cli
,
511 enum brl_type lock_type
);
512 NTSTATUS
cli_posix_lock_recv(struct tevent_req
*req
);
513 NTSTATUS
cli_posix_lock(struct cli_state
*cli
, uint16_t fnum
,
514 uint64_t offset
, uint64_t len
,
515 bool wait_lock
, enum brl_type lock_type
);
516 struct tevent_req
*cli_posix_unlock_send(TALLOC_CTX
*mem_ctx
,
517 struct tevent_context
*ev
,
518 struct cli_state
*cli
,
522 NTSTATUS
cli_posix_unlock_recv(struct tevent_req
*req
);
523 NTSTATUS
cli_posix_unlock(struct cli_state
*cli
, uint16_t fnum
, uint64_t offset
, uint64_t len
);
524 struct tevent_req
*cli_getattrE_send(TALLOC_CTX
*mem_ctx
,
525 struct tevent_context
*ev
,
526 struct cli_state
*cli
,
528 NTSTATUS
cli_getattrE_recv(struct tevent_req
*req
,
534 NTSTATUS
cli_getattrE(struct cli_state
*cli
,
541 struct tevent_req
*cli_setattrE_send(TALLOC_CTX
*mem_ctx
,
542 struct tevent_context
*ev
,
543 struct cli_state
*cli
,
548 NTSTATUS
cli_setattrE_recv(struct tevent_req
*req
);
549 NTSTATUS
cli_setattrE(struct cli_state
*cli
,
554 struct tevent_req
*cli_getatr_send(TALLOC_CTX
*mem_ctx
,
555 struct tevent_context
*ev
,
556 struct cli_state
*cli
,
558 NTSTATUS
cli_getatr_recv(struct tevent_req
*req
,
562 NTSTATUS
cli_getatr(struct cli_state
*cli
,
567 struct tevent_req
*cli_setatr_send(TALLOC_CTX
*mem_ctx
,
568 struct tevent_context
*ev
,
569 struct cli_state
*cli
,
573 NTSTATUS
cli_setatr_recv(struct tevent_req
*req
);
574 NTSTATUS
cli_setatr(struct cli_state
*cli
,
578 struct tevent_req
*cli_chkpath_send(TALLOC_CTX
*mem_ctx
,
579 struct tevent_context
*ev
,
580 struct cli_state
*cli
,
582 NTSTATUS
cli_chkpath_recv(struct tevent_req
*req
);
583 NTSTATUS
cli_chkpath(struct cli_state
*cli
, const char *path
);
584 struct tevent_req
*cli_dskattr_send(TALLOC_CTX
*mem_ctx
,
585 struct tevent_context
*ev
,
586 struct cli_state
*cli
);
587 NTSTATUS
cli_dskattr_recv(struct tevent_req
*req
, int *bsize
, int *total
,
589 NTSTATUS
cli_dskattr(struct cli_state
*cli
, int *bsize
, int *total
, int *avail
);
590 NTSTATUS
cli_disk_size(struct cli_state
*cli
, const char *path
, uint64_t *bsize
,
591 uint64_t *total
, uint64_t *avail
);
592 struct tevent_req
*cli_ctemp_send(TALLOC_CTX
*mem_ctx
,
593 struct tevent_context
*ev
,
594 struct cli_state
*cli
,
596 NTSTATUS
cli_ctemp_recv(struct tevent_req
*req
,
600 NTSTATUS
cli_ctemp(struct cli_state
*cli
,
605 NTSTATUS
cli_raw_ioctl(struct cli_state
*cli
, uint16_t fnum
, uint32_t code
, DATA_BLOB
*blob
);
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
,uint16_t attribute
,
767 NTSTATUS (*fn
)(const char *, struct file_info
*,
768 const char *, void *), void *state
);
769 NTSTATUS
cli_list_trans(struct cli_state
*cli
, const char *mask
,
770 uint16_t attribute
, int info_level
,
771 NTSTATUS (*fn
)(const char *mnt
, struct file_info
*finfo
,
772 const char *mask
, void *private_data
),
774 struct tevent_req
*cli_list_send(TALLOC_CTX
*mem_ctx
,
775 struct tevent_context
*ev
,
776 struct cli_state
*cli
,
779 uint16_t info_level
);
780 NTSTATUS
cli_list_recv(struct tevent_req
*req
, TALLOC_CTX
*mem_ctx
,
781 struct file_info
**finfo
, size_t *num_finfo
);
782 NTSTATUS
cli_list(struct cli_state
*cli
,const char *Mask
,uint16_t attribute
,
783 NTSTATUS (*fn
)(const char *, struct file_info
*, const char *,
784 void *), void *state
);
786 /* The following definitions come from libsmb/climessage.c */
788 struct tevent_req
*cli_message_send(TALLOC_CTX
*mem_ctx
,
789 struct tevent_context
*ev
,
790 struct cli_state
*cli
,
791 const char *host
, const char *username
,
792 const char *message
);
793 NTSTATUS
cli_message_recv(struct tevent_req
*req
);
794 NTSTATUS
cli_message(struct cli_state
*cli
, const char *host
,
795 const char *username
, const char *message
);
797 /* The following definitions come from libsmb/clioplock.c */
799 struct tevent_req
*cli_smb_oplock_break_waiter_send(TALLOC_CTX
*mem_ctx
,
800 struct tevent_context
*ev
,
801 struct cli_state
*cli
);
802 NTSTATUS
cli_smb_oplock_break_waiter_recv(struct tevent_req
*req
,
806 struct tevent_req
*cli_oplock_ack_send(TALLOC_CTX
*mem_ctx
,
807 struct tevent_context
*ev
,
808 struct cli_state
*cli
,
809 uint16_t fnum
, uint8_t level
);
810 NTSTATUS
cli_oplock_ack_recv(struct tevent_req
*req
);
812 /* The following definitions come from libsmb/cliprint.c */
814 int cli_print_queue(struct cli_state
*cli
,
815 void (*fn
)(struct print_job_info
*));
816 int cli_printjob_del(struct cli_state
*cli
, int job
);
818 /* The following definitions come from libsmb/cliquota.c */
820 NTSTATUS
cli_get_quota_handle(struct cli_state
*cli
, uint16_t *quota_fnum
);
821 void free_ntquota_list(SMB_NTQUOTA_LIST
**qt_list
);
822 bool parse_user_quota_record(const uint8_t *rdata
,
823 unsigned int rdata_count
,
824 unsigned int *offset
,
825 SMB_NTQUOTA_STRUCT
*pqt
);
826 bool add_record_to_ntquota_list(TALLOC_CTX
*mem_ctx
,
827 SMB_NTQUOTA_STRUCT
*pqt
,
828 SMB_NTQUOTA_LIST
**pqt_list
);
829 NTSTATUS
parse_user_quota_list(const uint8_t *curdata
,
830 uint32_t curdata_size
,
832 SMB_NTQUOTA_LIST
**pqt_list
);
833 NTSTATUS
parse_fs_quota_buffer(const uint8_t *rdata
,
834 unsigned int rdata_count
,
835 SMB_NTQUOTA_STRUCT
*pqt
);
836 NTSTATUS
build_user_quota_buffer(SMB_NTQUOTA_LIST
*qt_list
,
840 SMB_NTQUOTA_LIST
**end_ptr
);
841 NTSTATUS
build_fs_quota_buffer(TALLOC_CTX
*mem_ctx
,
842 const SMB_NTQUOTA_STRUCT
*pqt
,
845 NTSTATUS
cli_get_user_quota(struct cli_state
*cli
, int quota_fnum
,
846 SMB_NTQUOTA_STRUCT
*pqt
);
847 NTSTATUS
cli_set_user_quota(struct cli_state
*cli
,
849 SMB_NTQUOTA_LIST
*qtl
);
850 NTSTATUS
cli_list_user_quota(struct cli_state
*cli
, int quota_fnum
,
851 SMB_NTQUOTA_LIST
**pqt_list
);
852 NTSTATUS
cli_get_fs_quota_info(struct cli_state
*cli
, int quota_fnum
,
853 SMB_NTQUOTA_STRUCT
*pqt
);
854 NTSTATUS
cli_set_fs_quota_info(struct cli_state
*cli
, int quota_fnum
,
855 SMB_NTQUOTA_STRUCT
*pqt
);
857 /* The following definitions come from libsmb/clireadwrite.c */
859 struct tevent_req
*cli_read_andx_create(TALLOC_CTX
*mem_ctx
,
860 struct tevent_context
*ev
,
861 struct cli_state
*cli
, uint16_t fnum
,
862 off_t offset
, size_t size
,
863 struct tevent_req
**psmbreq
);
864 struct tevent_req
*cli_read_andx_send(TALLOC_CTX
*mem_ctx
,
865 struct tevent_context
*ev
,
866 struct cli_state
*cli
, uint16_t fnum
,
867 off_t offset
, size_t size
);
868 NTSTATUS
cli_read_andx_recv(struct tevent_req
*req
, ssize_t
*received
,
870 struct tevent_req
*cli_pull_send(TALLOC_CTX
*mem_ctx
,
871 struct tevent_context
*ev
,
872 struct cli_state
*cli
,
873 uint16_t fnum
, off_t start_offset
,
874 off_t size
, size_t window_size
,
875 NTSTATUS (*sink
)(char *buf
, size_t n
,
878 NTSTATUS
cli_pull_recv(struct tevent_req
*req
, off_t
*received
);
879 NTSTATUS
cli_pull(struct cli_state
*cli
, uint16_t fnum
,
880 off_t start_offset
, off_t size
, size_t window_size
,
881 NTSTATUS (*sink
)(char *buf
, size_t n
, void *priv
),
882 void *priv
, off_t
*received
);
883 NTSTATUS
cli_read_sink(char *buf
, size_t n
, void *priv
);
884 struct tevent_req
*cli_read_send(
886 struct tevent_context
*ev
,
887 struct cli_state
*cli
,
892 NTSTATUS
cli_read_recv(struct tevent_req
*req
, size_t *received
);
893 NTSTATUS
cli_read(struct cli_state
*cli
, uint16_t fnum
,
894 char *buf
, off_t offset
, size_t size
,
896 NTSTATUS
cli_smbwrite(struct cli_state
*cli
, uint16_t fnum
, char *buf
,
897 off_t offset
, size_t size1
, size_t *ptotal
);
898 struct tevent_req
*cli_write_andx_create(TALLOC_CTX
*mem_ctx
,
899 struct tevent_context
*ev
,
900 struct cli_state
*cli
, uint16_t fnum
,
901 uint16_t mode
, const uint8_t *buf
,
902 off_t offset
, size_t size
,
903 struct tevent_req
**reqs_before
,
905 struct tevent_req
**psmbreq
);
906 struct tevent_req
*cli_write_andx_send(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 NTSTATUS
cli_write_andx_recv(struct tevent_req
*req
, size_t *pwritten
);
913 struct tevent_req
*cli_write_send(TALLOC_CTX
*mem_ctx
,
914 struct tevent_context
*ev
,
915 struct cli_state
*cli
, uint16_t fnum
,
916 uint16_t mode
, const uint8_t *buf
,
917 off_t offset
, size_t size
);
918 NTSTATUS
cli_write_recv(struct tevent_req
*req
, size_t *pwritten
);
920 struct tevent_req
*cli_writeall_send(
922 struct tevent_context
*ev
,
923 struct cli_state
*cli
,
929 NTSTATUS
cli_writeall_recv(struct tevent_req
*req
, size_t *pwritten
);
930 NTSTATUS
cli_writeall(struct cli_state
*cli
, uint16_t fnum
, uint16_t mode
,
931 const uint8_t *buf
, off_t offset
, size_t size
,
934 struct tevent_req
*cli_push_send(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
935 struct cli_state
*cli
,
936 uint16_t fnum
, uint16_t mode
,
937 off_t start_offset
, size_t window_size
,
938 size_t (*source
)(uint8_t *buf
, size_t n
,
941 NTSTATUS
cli_push_recv(struct tevent_req
*req
);
942 NTSTATUS
cli_push(struct cli_state
*cli
, uint16_t fnum
, uint16_t mode
,
943 off_t start_offset
, size_t window_size
,
944 size_t (*source
)(uint8_t *buf
, size_t n
, void *priv
),
947 NTSTATUS
cli_splice(struct cli_state
*srccli
, struct cli_state
*dstcli
,
948 uint16_t src_fnum
, uint16_t dst_fnum
,
950 off_t src_offset
, off_t dst_offset
,
952 int (*splice_cb
)(off_t n
, void *priv
), void *priv
);
954 /* The following definitions come from libsmb/clisecdesc.c */
956 NTSTATUS
cli_query_security_descriptor(struct cli_state
*cli
,
960 struct security_descriptor
**sd
);
961 NTSTATUS
cli_query_secdesc(struct cli_state
*cli
, uint16_t fnum
,
962 TALLOC_CTX
*mem_ctx
, struct security_descriptor
**sd
);
963 NTSTATUS
cli_set_security_descriptor(struct cli_state
*cli
,
966 const struct security_descriptor
*sd
);
967 NTSTATUS
cli_set_secdesc(struct cli_state
*cli
, uint16_t fnum
,
968 const struct security_descriptor
*sd
);
970 NTSTATUS
cli_query_mxac(struct cli_state
*cli
,
971 const char *filename
,
974 /* The following definitions come from libsmb/clistr.c */
976 size_t clistr_pull_talloc(TALLOC_CTX
*ctx
,
983 bool clistr_is_previous_version_path(const char *path
,
988 /* The following definitions come from libsmb/clitrans.c */
990 struct tevent_req
*cli_trans_send(
991 TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
992 struct cli_state
*cli
, uint16_t additional_flags2
, uint8_t cmd
,
993 const char *pipe_name
, uint16_t fid
, uint16_t function
, int flags
,
994 uint16_t *setup
, uint8_t num_setup
, uint8_t max_setup
,
995 uint8_t *param
, uint32_t num_param
, uint32_t max_param
,
996 uint8_t *data
, uint32_t num_data
, uint32_t max_data
);
997 NTSTATUS
cli_trans_recv(struct tevent_req
*req
, TALLOC_CTX
*mem_ctx
,
998 uint16_t *recv_flags2
,
999 uint16_t **setup
, uint8_t min_setup
,
1001 uint8_t **param
, uint32_t min_param
,
1002 uint32_t *num_param
,
1003 uint8_t **data
, uint32_t min_data
,
1004 uint32_t *num_data
);
1005 NTSTATUS
cli_trans(TALLOC_CTX
*mem_ctx
, struct cli_state
*cli
,
1007 const char *pipe_name
, uint16_t fid
, uint16_t function
,
1009 uint16_t *setup
, uint8_t num_setup
, uint8_t max_setup
,
1010 uint8_t *param
, uint32_t num_param
, uint32_t max_param
,
1011 uint8_t *data
, uint32_t num_data
, uint32_t max_data
,
1012 uint16_t *recv_flags2
,
1013 uint16_t **rsetup
, uint8_t min_rsetup
, uint8_t *num_rsetup
,
1014 uint8_t **rparam
, uint32_t min_rparam
, uint32_t *num_rparam
,
1015 uint8_t **rdata
, uint32_t min_rdata
, uint32_t *num_rdata
);
1017 /* The following definitions come from libsmb/reparse_symlink.c */
1019 bool symlink_reparse_buffer_marshall(
1020 const char *substitute
, const char *printname
, uint32_t flags
,
1021 TALLOC_CTX
*mem_ctx
, uint8_t **pdst
, size_t *pdstlen
);
1022 bool symlink_reparse_buffer_parse(
1023 const uint8_t *src
, size_t srclen
, TALLOC_CTX
*mem_ctx
,
1024 char **psubstitute_name
, char **pprint_name
, uint32_t *pflags
);
1026 /* The following definitions come from libsmb/clisymlink.c */
1028 struct tevent_req
*cli_symlink_send(TALLOC_CTX
*mem_ctx
,
1029 struct tevent_context
*ev
,
1030 struct cli_state
*cli
,
1031 const char *oldpath
,
1032 const char *newpath
,
1034 NTSTATUS
cli_symlink_recv(struct tevent_req
*req
);
1035 NTSTATUS
cli_symlink(struct cli_state
*cli
, const char *oldname
,
1036 const char *newname
, uint32_t flags
);
1038 struct tevent_req
*cli_readlink_send(TALLOC_CTX
*mem_ctx
,
1039 struct tevent_context
*ev
,
1040 struct cli_state
*cli
,
1042 NTSTATUS
cli_readlink_recv(struct tevent_req
*req
, TALLOC_CTX
*mem_ctx
,
1043 char **psubstitute_name
, char **pprint_name
,
1045 NTSTATUS
cli_readlink(struct cli_state
*cli
, const char *fname
,
1046 TALLOC_CTX
*mem_ctx
, char **psubstitute_name
,
1047 char **pprint_name
, uint32_t *pflags
);
1049 NTSTATUS
fill_quota_buffer(TALLOC_CTX
*mem_ctx
,
1050 SMB_NTQUOTA_LIST
*tmp_list
,
1054 SMB_NTQUOTA_LIST
**end_ptr
);
1055 /* The following definitions come from libsmb/passchange.c */
1057 NTSTATUS
remote_password_change(const char *remote_machine
,
1058 const char *domain
, const char *user_name
,
1059 const char *old_passwd
, const char *new_passwd
,
1062 #endif /* _LIBSMB_PROTO_H_ */