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 int cli_status_to_errno(NTSTATUS status
);
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 struct tevent_req
*cli_posix_getacl_send(TALLOC_CTX
*mem_ctx
,
279 struct tevent_context
*ev
,
280 struct cli_state
*cli
,
282 NTSTATUS
cli_posix_getacl_recv(struct tevent_req
*req
,
286 NTSTATUS
cli_posix_getacl(struct cli_state
*cli
,
291 struct tevent_req
*cli_posix_setacl_send(TALLOC_CTX
*mem_ctx
,
292 struct tevent_context
*ev
,
293 struct cli_state
*cli
,
296 size_t acl_buf_size
);
297 NTSTATUS
cli_posix_setacl_recv(struct tevent_req
*req
);
298 NTSTATUS
cli_posix_setacl(struct cli_state
*cli
,
301 size_t acl_buf_size
);
302 struct tevent_req
*cli_posix_stat_send(TALLOC_CTX
*mem_ctx
,
303 struct tevent_context
*ev
,
304 struct cli_state
*cli
,
306 NTSTATUS
cli_posix_stat_recv(struct tevent_req
*req
, struct stat_ex
*sbuf
);
307 NTSTATUS
cli_posix_stat(struct cli_state
*cli
,
309 struct stat_ex
*sbuf
);
311 struct tevent_req
*cli_fchmod_send(TALLOC_CTX
*mem_ctx
,
312 struct tevent_context
*ev
,
313 struct cli_state
*cli
,
316 NTSTATUS
cli_fchmod_recv(struct tevent_req
*req
);
317 struct tevent_req
*cli_chmod_send(TALLOC_CTX
*mem_ctx
,
318 struct tevent_context
*ev
,
319 struct cli_state
*cli
,
322 NTSTATUS
cli_chmod_recv(struct tevent_req
*req
);
323 NTSTATUS
cli_chmod(struct cli_state
*cli
, const char *fname
, mode_t mode
);
324 struct tevent_req
*cli_posix_chown_send(TALLOC_CTX
*mem_ctx
,
325 struct tevent_context
*ev
,
326 struct cli_state
*cli
,
330 NTSTATUS
cli_posix_chown_recv(struct tevent_req
*req
);
331 NTSTATUS
cli_posix_chown(struct cli_state
*cli
,
335 struct tevent_req
*cli_mknod_send(
337 struct tevent_context
*ev
,
338 struct cli_state
*cli
,
342 NTSTATUS
cli_mknod_recv(struct tevent_req
*req
);
344 cli_mknod(struct cli_state
*cli
, const char *fname
, mode_t mode
, dev_t dev
);
345 struct tevent_req
*cli_rename_send(TALLOC_CTX
*mem_ctx
,
346 struct tevent_context
*ev
,
347 struct cli_state
*cli
,
348 const char *fname_src
,
349 const char *fname_dst
,
351 NTSTATUS
cli_rename_recv(struct tevent_req
*req
);
352 NTSTATUS
cli_rename(struct cli_state
*cli
,
353 const char *fname_src
,
354 const char *fname_dst
,
356 struct tevent_req
*cli_ntrename_send(TALLOC_CTX
*mem_ctx
,
357 struct tevent_context
*ev
,
358 struct cli_state
*cli
,
359 const char *fname_src
,
360 const char *fname_dst
);
361 NTSTATUS
cli_ntrename_recv(struct tevent_req
*req
);
362 NTSTATUS
cli_ntrename(struct cli_state
*cli
, const char *fname_src
, const char *fname_dst
);
364 struct tevent_req
*cli_hardlink_send(
366 struct tevent_context
*ev
,
367 struct cli_state
*cli
,
368 const char *fname_src
,
369 const char *fname_dst
);
370 NTSTATUS
cli_hardlink_recv(struct tevent_req
*req
);
371 NTSTATUS
cli_hardlink(
372 struct cli_state
*cli
,
373 const char *fname_src
,
374 const char *fname_dst
);
376 struct tevent_req
*cli_unlink_send(TALLOC_CTX
*mem_ctx
,
377 struct tevent_context
*ev
,
378 struct cli_state
*cli
,
380 uint32_t mayhave_attrs
);
381 NTSTATUS
cli_unlink_recv(struct tevent_req
*req
);
382 NTSTATUS
cli_unlink(struct cli_state
*cli
, const char *fname
, uint32_t mayhave_attrs
);
384 struct tevent_req
*cli_mkdir_send(TALLOC_CTX
*mem_ctx
,
385 struct tevent_context
*ev
,
386 struct cli_state
*cli
,
388 NTSTATUS
cli_mkdir_recv(struct tevent_req
*req
);
389 NTSTATUS
cli_mkdir(struct cli_state
*cli
, const char *dname
);
390 struct tevent_req
*cli_rmdir_send(TALLOC_CTX
*mem_ctx
,
391 struct tevent_context
*ev
,
392 struct cli_state
*cli
,
394 NTSTATUS
cli_rmdir_recv(struct tevent_req
*req
);
395 NTSTATUS
cli_rmdir(struct cli_state
*cli
, const char *dname
);
396 struct tevent_req
*cli_nt_delete_on_close_send(TALLOC_CTX
*mem_ctx
,
397 struct tevent_context
*ev
,
398 struct cli_state
*cli
,
401 NTSTATUS
cli_nt_delete_on_close_recv(struct tevent_req
*req
);
402 NTSTATUS
cli_nt_delete_on_close(struct cli_state
*cli
, uint16_t fnum
, bool flag
);
403 struct tevent_req
*cli_ntcreate_send(TALLOC_CTX
*mem_ctx
,
404 struct tevent_context
*ev
,
405 struct cli_state
*cli
,
408 uint32_t DesiredAccess
,
409 uint32_t FileAttributes
,
410 uint32_t ShareAccess
,
411 uint32_t CreateDisposition
,
412 uint32_t CreateOptions
,
413 uint32_t ImpersonationLevel
,
414 uint8_t SecurityFlags
);
415 NTSTATUS
cli_ntcreate_recv(struct tevent_req
*req
,
417 struct smb_create_returns
*cr
);
418 NTSTATUS
cli_ntcreate(struct cli_state
*cli
,
421 uint32_t DesiredAccess
,
422 uint32_t FileAttributes
,
423 uint32_t ShareAccess
,
424 uint32_t CreateDisposition
,
425 uint32_t CreateOptions
,
426 uint8_t SecurityFlags
,
428 struct smb_create_returns
*cr
);
429 struct tevent_req
*cli_openx_create(TALLOC_CTX
*mem_ctx
,
430 struct tevent_context
*ev
,
431 struct cli_state
*cli
, const char *fname
,
432 int flags
, int share_mode
,
433 struct tevent_req
**psmbreq
);
434 struct tevent_req
*cli_openx_send(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
435 struct cli_state
*cli
, const char *fname
,
436 int flags
, int share_mode
);
437 NTSTATUS
cli_openx_recv(struct tevent_req
*req
, uint16_t *fnum
);
438 NTSTATUS
cli_openx(struct cli_state
*cli
, const char *fname
, int flags
, int share_mode
, uint16_t *pfnum
);
439 NTSTATUS
cli_open(struct cli_state
*cli
, const char *fname
, int flags
, int share_mode
, uint16_t *pfnum
);
440 struct tevent_req
*cli_smb1_close_create(TALLOC_CTX
*mem_ctx
,
441 struct tevent_context
*ev
,
442 struct cli_state
*cli
, uint16_t fnum
,
443 struct tevent_req
**psubreq
);
444 struct tevent_req
*cli_close_send(TALLOC_CTX
*mem_ctx
,
445 struct tevent_context
*ev
,
446 struct cli_state
*cli
,
449 NTSTATUS
cli_close_recv(struct tevent_req
*req
);
450 NTSTATUS
cli_close(struct cli_state
*cli
, uint16_t fnum
);
451 struct tevent_req
*cli_ftruncate_send(TALLOC_CTX
*mem_ctx
,
452 struct tevent_context
*ev
,
453 struct cli_state
*cli
,
456 NTSTATUS
cli_ftruncate_recv(struct tevent_req
*req
);
457 NTSTATUS
cli_ftruncate(struct cli_state
*cli
, uint16_t fnum
, uint64_t size
);
458 NTSTATUS
cli_locktype(struct cli_state
*cli
, uint16_t fnum
,
459 uint32_t offset
, uint32_t len
,
460 int timeout
, unsigned char locktype
);
461 struct smb1_lock_element
{
467 struct tevent_req
*cli_lockingx_create(
469 struct tevent_context
*ev
,
470 struct cli_state
*cli
,
473 uint8_t newoplocklevel
,
475 uint16_t num_unlocks
,
476 const struct smb1_lock_element
*unlocks
,
478 const struct smb1_lock_element
*locks
,
479 struct tevent_req
**psmbreq
);
480 struct tevent_req
*cli_lockingx_send(
482 struct tevent_context
*ev
,
483 struct cli_state
*cli
,
486 uint8_t newoplocklevel
,
488 uint16_t num_unlocks
,
489 const struct smb1_lock_element
*unlocks
,
491 const struct smb1_lock_element
*locks
);
492 NTSTATUS
cli_lockingx_recv(struct tevent_req
*req
);
493 NTSTATUS
cli_lockingx(
494 struct cli_state
*cli
,
497 uint8_t newoplocklevel
,
499 uint16_t num_unlocks
,
500 const struct smb1_lock_element
*unlocks
,
502 const struct smb1_lock_element
*locks
);
504 NTSTATUS
cli_lock32(struct cli_state
*cli
, uint16_t fnum
, uint32_t offset
,
505 uint32_t len
, int timeout
, enum brl_type lock_type
);
506 struct tevent_req
*cli_unlock_send(TALLOC_CTX
*mem_ctx
,
507 struct tevent_context
*ev
,
508 struct cli_state
*cli
,
512 NTSTATUS
cli_unlock_recv(struct tevent_req
*req
);
513 NTSTATUS
cli_unlock(struct cli_state
*cli
, uint16_t fnum
, uint32_t offset
, uint32_t len
);
514 struct tevent_req
*cli_posix_lock_send(TALLOC_CTX
*mem_ctx
,
515 struct tevent_context
*ev
,
516 struct cli_state
*cli
,
521 enum brl_type lock_type
);
522 NTSTATUS
cli_posix_lock_recv(struct tevent_req
*req
);
523 NTSTATUS
cli_posix_lock(struct cli_state
*cli
, uint16_t fnum
,
524 uint64_t offset
, uint64_t len
,
525 bool wait_lock
, enum brl_type lock_type
);
526 struct tevent_req
*cli_posix_unlock_send(TALLOC_CTX
*mem_ctx
,
527 struct tevent_context
*ev
,
528 struct cli_state
*cli
,
532 NTSTATUS
cli_posix_unlock_recv(struct tevent_req
*req
);
533 NTSTATUS
cli_posix_unlock(struct cli_state
*cli
, uint16_t fnum
, uint64_t offset
, uint64_t len
);
534 struct tevent_req
*cli_getattrE_send(TALLOC_CTX
*mem_ctx
,
535 struct tevent_context
*ev
,
536 struct cli_state
*cli
,
538 NTSTATUS
cli_getattrE_recv(struct tevent_req
*req
,
544 struct tevent_req
*cli_setattrE_send(TALLOC_CTX
*mem_ctx
,
545 struct tevent_context
*ev
,
546 struct cli_state
*cli
,
551 NTSTATUS
cli_setattrE_recv(struct tevent_req
*req
);
552 NTSTATUS
cli_setattrE(struct cli_state
*cli
,
557 struct tevent_req
*cli_getatr_send(TALLOC_CTX
*mem_ctx
,
558 struct tevent_context
*ev
,
559 struct cli_state
*cli
,
561 NTSTATUS
cli_getatr_recv(struct tevent_req
*req
,
565 NTSTATUS
cli_getatr(struct cli_state
*cli
,
570 struct tevent_req
*cli_setatr_send(TALLOC_CTX
*mem_ctx
,
571 struct tevent_context
*ev
,
572 struct cli_state
*cli
,
576 NTSTATUS
cli_setatr_recv(struct tevent_req
*req
);
577 NTSTATUS
cli_setatr(struct cli_state
*cli
,
581 struct tevent_req
*cli_chkpath_send(TALLOC_CTX
*mem_ctx
,
582 struct tevent_context
*ev
,
583 struct cli_state
*cli
,
585 NTSTATUS
cli_chkpath_recv(struct tevent_req
*req
);
586 NTSTATUS
cli_chkpath(struct cli_state
*cli
, const char *path
);
587 struct tevent_req
*cli_dskattr_send(TALLOC_CTX
*mem_ctx
,
588 struct tevent_context
*ev
,
589 struct cli_state
*cli
);
590 NTSTATUS
cli_dskattr_recv(struct tevent_req
*req
, int *bsize
, int *total
,
592 NTSTATUS
cli_dskattr(struct cli_state
*cli
, int *bsize
, int *total
, int *avail
);
593 NTSTATUS
cli_disk_size(struct cli_state
*cli
, const char *path
, uint64_t *bsize
,
594 uint64_t *total
, uint64_t *avail
);
595 struct tevent_req
*cli_ctemp_send(TALLOC_CTX
*mem_ctx
,
596 struct tevent_context
*ev
,
597 struct cli_state
*cli
,
599 NTSTATUS
cli_ctemp_recv(struct tevent_req
*req
,
603 NTSTATUS
cli_ctemp(struct cli_state
*cli
,
608 NTSTATUS
cli_set_ea_path(struct cli_state
*cli
, const char *path
,
609 const char *ea_name
, const char *ea_val
,
611 NTSTATUS
cli_set_ea_fnum(struct cli_state
*cli
, uint16_t fnum
,
612 const char *ea_name
, const char *ea_val
,
614 struct tevent_req
*cli_get_ea_list_path_send(TALLOC_CTX
*mem_ctx
,
615 struct tevent_context
*ev
,
616 struct cli_state
*cli
,
618 NTSTATUS
cli_get_ea_list_path_recv(struct tevent_req
*req
, TALLOC_CTX
*mem_ctx
,
619 size_t *pnum_eas
, struct ea_struct
**peas
);
620 NTSTATUS
cli_get_ea_list_path(struct cli_state
*cli
, const char *path
,
623 struct ea_struct
**pea_list
);
624 struct tevent_req
*cli_posix_open_send(TALLOC_CTX
*mem_ctx
,
625 struct tevent_context
*ev
,
626 struct cli_state
*cli
,
630 NTSTATUS
cli_posix_open_recv(struct tevent_req
*req
, uint16_t *pfnum
);
631 NTSTATUS
cli_posix_open(struct cli_state
*cli
, const char *fname
,
632 int flags
, mode_t mode
, uint16_t *fnum
);
633 struct tevent_req
*cli_posix_mkdir_send(TALLOC_CTX
*mem_ctx
,
634 struct tevent_context
*ev
,
635 struct cli_state
*cli
,
638 NTSTATUS
cli_posix_mkdir_recv(struct tevent_req
*req
);
639 NTSTATUS
cli_posix_mkdir(struct cli_state
*cli
, const char *fname
, mode_t mode
);
641 struct tevent_req
*cli_posix_unlink_send(TALLOC_CTX
*mem_ctx
,
642 struct tevent_context
*ev
,
643 struct cli_state
*cli
,
645 NTSTATUS
cli_posix_unlink_recv(struct tevent_req
*req
);
646 NTSTATUS
cli_posix_unlink(struct cli_state
*cli
, const char *fname
);
648 struct tevent_req
*cli_posix_rmdir_send(TALLOC_CTX
*mem_ctx
,
649 struct tevent_context
*ev
,
650 struct cli_state
*cli
,
652 NTSTATUS
cli_posix_rmdir_recv(struct tevent_req
*req
, TALLOC_CTX
*mem_ctx
);
653 NTSTATUS
cli_posix_rmdir(struct cli_state
*cli
, const char *fname
);
654 struct tevent_req
*cli_notify_send(TALLOC_CTX
*mem_ctx
,
655 struct tevent_context
*ev
,
656 struct cli_state
*cli
, uint16_t fnum
,
657 uint32_t buffer_size
,
658 uint32_t completion_filter
, bool recursive
);
659 NTSTATUS
cli_notify_recv(struct tevent_req
*req
, TALLOC_CTX
*mem_ctx
,
660 uint32_t *pnum_changes
,
661 struct notify_change
**pchanges
);
662 NTSTATUS
cli_notify(struct cli_state
*cli
, uint16_t fnum
, uint32_t buffer_size
,
663 uint32_t completion_filter
, bool recursive
,
664 TALLOC_CTX
*mem_ctx
, uint32_t *pnum_changes
,
665 struct notify_change
**pchanges
);
667 struct tevent_req
*cli_nttrans_create_send(TALLOC_CTX
*mem_ctx
,
668 struct tevent_context
*ev
,
669 struct cli_state
*cli
,
672 uint32_t DesiredAccess
,
673 uint32_t FileAttributes
,
674 uint32_t ShareAccess
,
675 uint32_t CreateDisposition
,
676 uint32_t CreateOptions
,
677 uint8_t SecurityFlags
,
678 struct security_descriptor
*secdesc
,
679 struct ea_struct
*eas
,
681 NTSTATUS
cli_nttrans_create_recv(struct tevent_req
*req
,
683 struct smb_create_returns
*cr
);
684 NTSTATUS
cli_nttrans_create(struct cli_state
*cli
,
687 uint32_t DesiredAccess
,
688 uint32_t FileAttributes
,
689 uint32_t ShareAccess
,
690 uint32_t CreateDisposition
,
691 uint32_t CreateOptions
,
692 uint8_t SecurityFlags
,
693 struct security_descriptor
*secdesc
,
694 struct ea_struct
*eas
,
697 struct smb_create_returns
*cr
);
699 /* The following definitions come from libsmb/clifsinfo.c */
701 struct tevent_req
*cli_unix_extensions_version_send(TALLOC_CTX
*mem_ctx
,
702 struct tevent_context
*ev
,
703 struct cli_state
*cli
);
704 NTSTATUS
cli_unix_extensions_version_recv(struct tevent_req
*req
,
705 uint16_t *pmajor
, uint16_t *pminor
,
708 NTSTATUS
cli_unix_extensions_version(struct cli_state
*cli
, uint16_t *pmajor
,
709 uint16_t *pminor
, uint32_t *pcaplow
,
711 struct tevent_req
*cli_set_unix_extensions_capabilities_send(
712 TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
, struct cli_state
*cli
,
713 uint16_t major
, uint16_t minor
, uint32_t caplow
, uint32_t caphigh
);
714 NTSTATUS
cli_set_unix_extensions_capabilities_recv(struct tevent_req
*req
);
715 NTSTATUS
cli_set_unix_extensions_capabilities(struct cli_state
*cli
,
716 uint16_t major
, uint16_t minor
,
717 uint32_t caplow
, uint32_t caphigh
);
718 struct tevent_req
*cli_get_fs_attr_info_send(TALLOC_CTX
*mem_ctx
,
719 struct tevent_context
*ev
,
720 struct cli_state
*cli
);
721 NTSTATUS
cli_get_fs_attr_info_recv(struct tevent_req
*req
, uint32_t *fs_attr
);
722 NTSTATUS
cli_get_fs_attr_info(struct cli_state
*cli
, uint32_t *fs_attr
);
723 NTSTATUS
cli_get_fs_volume_info(struct cli_state
*cli
,
724 TALLOC_CTX
*mem_ctx
, char **volume_name
,
725 uint32_t *pserial_number
, time_t *pdate
);
726 NTSTATUS
cli_get_fs_full_size_info(struct cli_state
*cli
,
727 uint64_t *total_allocation_units
,
728 uint64_t *caller_allocation_units
,
729 uint64_t *actual_allocation_units
,
730 uint64_t *sectors_per_allocation_unit
,
731 uint64_t *bytes_per_sector
);
732 NTSTATUS
cli_get_posix_fs_info(struct cli_state
*cli
,
733 uint32_t *optimal_transfer_size
,
734 uint32_t *block_size
,
735 uint64_t *total_blocks
,
736 uint64_t *blocks_available
,
737 uint64_t *user_blocks_available
,
738 uint64_t *total_file_nodes
,
739 uint64_t *free_file_nodes
,
740 uint64_t *fs_identifier
);
741 struct tevent_req
*cli_get_posix_fs_info_send(TALLOC_CTX
*mem_ctx
,
742 struct tevent_context
*ev
,
743 struct cli_state
*cli
);
744 NTSTATUS
cli_get_posix_fs_info_recv(struct tevent_req
*req
,
745 uint32_t *optimal_transfer_size
,
746 uint32_t *block_size
,
747 uint64_t *total_blocks
,
748 uint64_t *blocks_available
,
749 uint64_t *user_blocks_available
,
750 uint64_t *total_file_nodes
,
751 uint64_t *free_file_nodes
,
752 uint64_t *fs_identifier
);
753 struct tevent_req
*cli_posix_whoami_send(TALLOC_CTX
*mem_ctx
,
754 struct tevent_context
*ev
,
755 struct cli_state
*cli
);
756 NTSTATUS
cli_posix_whoami_recv(struct tevent_req
*req
,
763 struct dom_sid
**psids
,
765 NTSTATUS
cli_posix_whoami(struct cli_state
*cli
,
772 struct dom_sid
**sids
,
775 /* The following definitions come from libsmb/clilist.c */
777 NTSTATUS
is_bad_finfo_name(const struct cli_state
*cli
,
778 const struct file_info
*finfo
);
780 NTSTATUS
cli_list_old(struct cli_state
*cli
,const char *Mask
,uint32_t attribute
,
781 NTSTATUS (*fn
)(struct file_info
*,
782 const char *, void *), void *state
);
783 struct tevent_req
*cli_list_send(TALLOC_CTX
*mem_ctx
,
784 struct tevent_context
*ev
,
785 struct cli_state
*cli
,
788 uint16_t info_level
);
789 NTSTATUS
cli_list_recv(
790 struct tevent_req
*req
,
792 struct file_info
**pfinfo
);
793 NTSTATUS
cli_list(struct cli_state
*cli
,
796 NTSTATUS (*fn
)(struct file_info
*finfo
,
801 /* The following definitions come from libsmb/climessage.c */
803 struct tevent_req
*cli_message_send(TALLOC_CTX
*mem_ctx
,
804 struct tevent_context
*ev
,
805 struct cli_state
*cli
,
806 const char *host
, const char *username
,
807 const char *message
);
808 NTSTATUS
cli_message_recv(struct tevent_req
*req
);
809 NTSTATUS
cli_message(struct cli_state
*cli
, const char *host
,
810 const char *username
, const char *message
);
812 /* The following definitions come from libsmb/clioplock.c */
814 struct tevent_req
*cli_smb_oplock_break_waiter_send(TALLOC_CTX
*mem_ctx
,
815 struct tevent_context
*ev
,
816 struct cli_state
*cli
);
817 NTSTATUS
cli_smb_oplock_break_waiter_recv(struct tevent_req
*req
,
821 struct tevent_req
*cli_oplock_ack_send(TALLOC_CTX
*mem_ctx
,
822 struct tevent_context
*ev
,
823 struct cli_state
*cli
,
824 uint16_t fnum
, uint8_t level
);
825 NTSTATUS
cli_oplock_ack_recv(struct tevent_req
*req
);
827 /* The following definitions come from libsmb/cliprint.c */
829 NTSTATUS
cli_print_queue(struct cli_state
*cli
,
830 void (*fn
)(struct print_job_info
*));
831 NTSTATUS
cli_printjob_del(struct cli_state
*cli
, int job
);
833 /* The following definitions come from libsmb/cliquota.c */
835 NTSTATUS
cli_get_quota_handle(struct cli_state
*cli
, uint16_t *quota_fnum
);
836 void free_ntquota_list(SMB_NTQUOTA_LIST
**qt_list
);
837 bool parse_user_quota_record(const uint8_t *rdata
,
838 unsigned int rdata_count
,
839 unsigned int *offset
,
840 SMB_NTQUOTA_STRUCT
*pqt
);
841 bool add_record_to_ntquota_list(TALLOC_CTX
*mem_ctx
,
842 SMB_NTQUOTA_STRUCT
*pqt
,
843 SMB_NTQUOTA_LIST
**pqt_list
);
844 NTSTATUS
parse_user_quota_list(const uint8_t *curdata
,
845 uint32_t curdata_size
,
847 SMB_NTQUOTA_LIST
**pqt_list
);
848 NTSTATUS
parse_fs_quota_buffer(const uint8_t *rdata
,
849 unsigned int rdata_count
,
850 SMB_NTQUOTA_STRUCT
*pqt
);
851 NTSTATUS
build_user_quota_buffer(SMB_NTQUOTA_LIST
*qt_list
,
855 SMB_NTQUOTA_LIST
**end_ptr
);
856 NTSTATUS
build_fs_quota_buffer(TALLOC_CTX
*mem_ctx
,
857 const SMB_NTQUOTA_STRUCT
*pqt
,
860 NTSTATUS
cli_get_user_quota(struct cli_state
*cli
, int quota_fnum
,
861 SMB_NTQUOTA_STRUCT
*pqt
);
862 NTSTATUS
cli_set_user_quota(struct cli_state
*cli
,
864 SMB_NTQUOTA_LIST
*qtl
);
865 NTSTATUS
cli_list_user_quota(struct cli_state
*cli
, int quota_fnum
,
866 SMB_NTQUOTA_LIST
**pqt_list
);
867 NTSTATUS
cli_get_fs_quota_info(struct cli_state
*cli
, int quota_fnum
,
868 SMB_NTQUOTA_STRUCT
*pqt
);
869 NTSTATUS
cli_set_fs_quota_info(struct cli_state
*cli
, int quota_fnum
,
870 SMB_NTQUOTA_STRUCT
*pqt
);
872 /* The following definitions come from libsmb/clireadwrite.c */
874 struct tevent_req
*cli_read_andx_create(TALLOC_CTX
*mem_ctx
,
875 struct tevent_context
*ev
,
876 struct cli_state
*cli
, uint16_t fnum
,
877 off_t offset
, size_t size
,
878 struct tevent_req
**psmbreq
);
879 struct tevent_req
*cli_read_andx_send(TALLOC_CTX
*mem_ctx
,
880 struct tevent_context
*ev
,
881 struct cli_state
*cli
, uint16_t fnum
,
882 off_t offset
, size_t size
);
883 NTSTATUS
cli_read_andx_recv(struct tevent_req
*req
, ssize_t
*received
,
885 struct tevent_req
*cli_pull_send(TALLOC_CTX
*mem_ctx
,
886 struct tevent_context
*ev
,
887 struct cli_state
*cli
,
888 uint16_t fnum
, off_t start_offset
,
889 off_t size
, size_t window_size
,
890 NTSTATUS (*sink
)(char *buf
, size_t n
,
893 NTSTATUS
cli_pull_recv(struct tevent_req
*req
, off_t
*received
);
894 NTSTATUS
cli_pull(struct cli_state
*cli
, uint16_t fnum
,
895 off_t start_offset
, off_t size
, size_t window_size
,
896 NTSTATUS (*sink
)(char *buf
, size_t n
, void *priv
),
897 void *priv
, off_t
*received
);
898 NTSTATUS
cli_read_sink(char *buf
, size_t n
, void *priv
);
899 struct tevent_req
*cli_read_send(
901 struct tevent_context
*ev
,
902 struct cli_state
*cli
,
907 NTSTATUS
cli_read_recv(struct tevent_req
*req
, size_t *received
);
908 NTSTATUS
cli_read(struct cli_state
*cli
, uint16_t fnum
,
909 char *buf
, off_t offset
, size_t size
,
911 NTSTATUS
cli_smbwrite(struct cli_state
*cli
, uint16_t fnum
, char *buf
,
912 off_t offset
, size_t size1
, size_t *ptotal
);
913 struct tevent_req
*cli_write_andx_create(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 struct tevent_req
**reqs_before
,
920 struct tevent_req
**psmbreq
);
921 struct tevent_req
*cli_write_andx_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_andx_recv(struct tevent_req
*req
, size_t *pwritten
);
928 struct tevent_req
*cli_write_send(TALLOC_CTX
*mem_ctx
,
929 struct tevent_context
*ev
,
930 struct cli_state
*cli
, uint16_t fnum
,
931 uint16_t mode
, const uint8_t *buf
,
932 off_t offset
, size_t size
);
933 NTSTATUS
cli_write_recv(struct tevent_req
*req
, size_t *pwritten
);
935 struct tevent_req
*cli_writeall_send(
937 struct tevent_context
*ev
,
938 struct cli_state
*cli
,
944 NTSTATUS
cli_writeall_recv(struct tevent_req
*req
, size_t *pwritten
);
945 NTSTATUS
cli_writeall(struct cli_state
*cli
, uint16_t fnum
, uint16_t mode
,
946 const uint8_t *buf
, off_t offset
, size_t size
,
949 struct tevent_req
*cli_push_send(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
950 struct cli_state
*cli
,
951 uint16_t fnum
, uint16_t mode
,
952 off_t start_offset
, size_t window_size
,
953 size_t (*source
)(uint8_t *buf
, size_t n
,
956 NTSTATUS
cli_push_recv(struct tevent_req
*req
);
957 NTSTATUS
cli_push(struct cli_state
*cli
, uint16_t fnum
, uint16_t mode
,
958 off_t start_offset
, size_t window_size
,
959 size_t (*source
)(uint8_t *buf
, size_t n
, void *priv
),
962 NTSTATUS
cli_splice(struct cli_state
*srccli
, struct cli_state
*dstcli
,
963 uint16_t src_fnum
, uint16_t dst_fnum
,
965 off_t src_offset
, off_t dst_offset
,
967 int (*splice_cb
)(off_t n
, void *priv
), void *priv
);
969 /* The following definitions come from libsmb/clisecdesc.c */
971 struct tevent_req
*cli_query_security_descriptor_send(
973 struct tevent_context
*ev
,
974 struct cli_state
*cli
,
977 NTSTATUS
cli_query_security_descriptor_recv(
978 struct tevent_req
*req
,
980 struct security_descriptor
**sd
);
981 NTSTATUS
cli_query_security_descriptor(struct cli_state
*cli
,
985 struct security_descriptor
**sd
);
986 NTSTATUS
cli_query_secdesc(struct cli_state
*cli
, uint16_t fnum
,
987 TALLOC_CTX
*mem_ctx
, struct security_descriptor
**sd
);
988 struct tevent_req
*cli_set_security_descriptor_send(
990 struct tevent_context
*ev
,
991 struct cli_state
*cli
,
994 const struct security_descriptor
*sd
);
995 NTSTATUS
cli_set_security_descriptor_recv(struct tevent_req
*req
);
996 NTSTATUS
cli_set_security_descriptor(struct cli_state
*cli
,
999 const struct security_descriptor
*sd
);
1000 NTSTATUS
cli_set_secdesc(struct cli_state
*cli
, uint16_t fnum
,
1001 const struct security_descriptor
*sd
);
1003 NTSTATUS
cli_query_mxac(struct cli_state
*cli
,
1004 const char *filename
,
1007 /* The following definitions come from libsmb/clitrans.c */
1009 struct tevent_req
*cli_trans_send(
1010 TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
1011 struct cli_state
*cli
, uint16_t additional_flags2
, uint8_t cmd
,
1012 const char *pipe_name
, uint16_t fid
, uint16_t function
, int flags
,
1013 uint16_t *setup
, uint8_t num_setup
, uint8_t max_setup
,
1014 uint8_t *param
, uint32_t num_param
, uint32_t max_param
,
1015 uint8_t *data
, uint32_t num_data
, uint32_t max_data
);
1016 NTSTATUS
cli_trans_recv(struct tevent_req
*req
, TALLOC_CTX
*mem_ctx
,
1017 uint16_t *recv_flags2
,
1018 uint16_t **setup
, uint8_t min_setup
,
1020 uint8_t **param
, uint32_t min_param
,
1021 uint32_t *num_param
,
1022 uint8_t **data
, uint32_t min_data
,
1023 uint32_t *num_data
);
1024 NTSTATUS
cli_trans(TALLOC_CTX
*mem_ctx
, struct cli_state
*cli
,
1026 const char *pipe_name
, uint16_t fid
, uint16_t function
,
1028 uint16_t *setup
, uint8_t num_setup
, uint8_t max_setup
,
1029 uint8_t *param
, uint32_t num_param
, uint32_t max_param
,
1030 uint8_t *data
, uint32_t num_data
, uint32_t max_data
,
1031 uint16_t *recv_flags2
,
1032 uint16_t **rsetup
, uint8_t min_rsetup
, uint8_t *num_rsetup
,
1033 uint8_t **rparam
, uint32_t min_rparam
, uint32_t *num_rparam
,
1034 uint8_t **rdata
, uint32_t min_rdata
, uint32_t *num_rdata
);
1036 /* The following definitions come from libsmb/clisymlink.c */
1038 struct tevent_req
*cli_create_reparse_point_send(TALLOC_CTX
*mem_ctx
,
1039 struct tevent_context
*ev
,
1040 struct cli_state
*cli
,
1042 DATA_BLOB reparse_blob
);
1043 NTSTATUS
cli_create_reparse_point_recv(struct tevent_req
*req
);
1045 struct tevent_req
*cli_symlink_send(TALLOC_CTX
*mem_ctx
,
1046 struct tevent_context
*ev
,
1047 struct cli_state
*cli
,
1048 const char *oldpath
,
1049 const char *newpath
,
1051 NTSTATUS
cli_symlink_recv(struct tevent_req
*req
);
1052 NTSTATUS
cli_symlink(struct cli_state
*cli
, const char *oldname
,
1053 const char *newname
, uint32_t flags
);
1055 struct tevent_req
*cli_get_reparse_data_send(TALLOC_CTX
*mem_ctx
,
1056 struct tevent_context
*ev
,
1057 struct cli_state
*cli
,
1059 NTSTATUS
cli_get_reparse_data_recv(struct tevent_req
*req
,
1060 TALLOC_CTX
*mem_ctx
,
1062 uint32_t *_datalen
);
1063 NTSTATUS
cli_get_reparse_data(struct cli_state
*cli
,
1065 TALLOC_CTX
*mem_ctx
,
1067 uint32_t *_datalen
);
1069 struct tevent_req
*cli_readlink_send(TALLOC_CTX
*mem_ctx
,
1070 struct tevent_context
*ev
,
1071 struct cli_state
*cli
,
1073 NTSTATUS
cli_readlink_recv(struct tevent_req
*req
, TALLOC_CTX
*mem_ctx
,
1074 char **psubstitute_name
, char **pprint_name
,
1076 NTSTATUS
cli_readlink(struct cli_state
*cli
, const char *fname
,
1077 TALLOC_CTX
*mem_ctx
, char **psubstitute_name
,
1078 char **pprint_name
, uint32_t *pflags
);
1080 NTSTATUS
fill_quota_buffer(TALLOC_CTX
*mem_ctx
,
1081 SMB_NTQUOTA_LIST
*tmp_list
,
1085 SMB_NTQUOTA_LIST
**end_ptr
);
1086 /* The following definitions come from libsmb/passchange.c */
1088 NTSTATUS
remote_password_change(const char *remote_machine
,
1089 const char *domain
, const char *user_name
,
1090 const char *old_passwd
, const char *new_passwd
,
1093 #endif /* _LIBSMB_PROTO_H_ */