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_
30 #include "auth_info.h"
32 struct smb_trans_enc_state
;
33 struct cli_credentials
;
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 int 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 int signing_state
, int flags
);
93 NTSTATUS
cli_smb1_setup_encryption(struct cli_state
*cli
,
94 struct cli_credentials
*creds
);
95 struct tevent_req
*cli_full_connection_creds_send(
96 TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
97 const char *my_name
, const char *dest_host
,
98 const struct sockaddr_storage
*dest_ss
, int port
,
99 const char *service
, const char *service_type
,
100 struct cli_credentials
*creds
,
101 int flags
, int signing_state
);
102 NTSTATUS
cli_full_connection_creds_recv(struct tevent_req
*req
,
103 struct cli_state
**output_cli
);
104 NTSTATUS
cli_full_connection_creds(struct cli_state
**output_cli
,
106 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
,
112 NTSTATUS
cli_full_connection(struct cli_state
**output_cli
,
114 const char *dest_host
,
115 const struct sockaddr_storage
*dest_ss
, int port
,
116 const char *service
, const char *service_type
,
117 const char *user
, const char *domain
,
118 const char *password
, int flags
,
120 NTSTATUS
cli_raw_tcon(struct cli_state
*cli
,
121 const char *service
, const char *pass
, const char *dev
,
122 uint16_t *max_xmit
, uint16_t *tid
);
123 struct cli_state
*get_ipc_connect(char *server
,
124 struct sockaddr_storage
*server_ss
,
125 const struct user_auth_info
*user_info
);
126 struct cli_state
*get_ipc_connect_master_ip(TALLOC_CTX
*ctx
,
127 struct sockaddr_storage
*mb_ip
,
128 const struct user_auth_info
*user_info
,
129 char **pp_workgroup_out
);
130 struct cli_state
*get_ipc_connect_master_ip_bcast(TALLOC_CTX
*ctx
,
131 const struct user_auth_info
*user_info
,
132 char **pp_workgroup_out
);
134 /* The following definitions come from libsmb/clidfs.c */
136 NTSTATUS
cli_cm_force_encryption_creds(struct cli_state
*c
,
137 struct cli_credentials
*creds
,
138 const char *sharename
);
139 NTSTATUS
cli_cm_force_encryption(struct cli_state
*c
,
140 const char *username
,
141 const char *password
,
143 const char *sharename
);
144 NTSTATUS
cli_cm_open(TALLOC_CTX
*ctx
,
145 struct cli_state
*referring_cli
,
148 const struct user_auth_info
*auth_info
,
154 struct cli_state
**pcli
);
155 void cli_cm_display(struct cli_state
*c
);
156 struct client_dfs_referral
;
157 NTSTATUS
cli_dfs_get_referral(TALLOC_CTX
*ctx
,
158 struct cli_state
*cli
,
160 struct client_dfs_referral
**refs
,
163 NTSTATUS
cli_resolve_path(TALLOC_CTX
*ctx
,
165 const struct user_auth_info
*dfs_auth_info
,
166 struct cli_state
*rootcli
,
168 struct cli_state
**targetcli
,
169 char **pp_targetpath
);
171 bool cli_check_msdfs_proxy(TALLOC_CTX
*ctx
,
172 struct cli_state
*cli
,
173 const char *sharename
,
177 struct cli_credentials
*creds
);
179 /* The following definitions come from libsmb/clientgen.c */
181 int cli_set_message(char *buf
,int num_words
,int num_bytes
,bool zero
);
182 unsigned int cli_set_timeout(struct cli_state
*cli
, unsigned int timeout
);
183 bool cli_set_backup_intent(struct cli_state
*cli
, bool flag
);
184 extern struct GUID cli_state_client_guid
;
185 struct cli_state
*cli_state_create(TALLOC_CTX
*mem_ctx
,
187 const char *remote_name
,
188 const char *remote_realm
,
191 void cli_nt_pipes_close(struct cli_state
*cli
);
192 void cli_shutdown(struct cli_state
*cli
);
193 const char *cli_state_remote_realm(struct cli_state
*cli
);
194 uint16_t cli_state_get_vc_num(struct cli_state
*cli
);
195 uint32_t cli_setpid(struct cli_state
*cli
, uint32_t pid
);
196 uint32_t cli_getpid(struct cli_state
*cli
);
197 bool cli_state_has_tcon(struct cli_state
*cli
);
198 uint16_t cli_state_get_tid(struct cli_state
*cli
);
199 uint16_t cli_state_set_tid(struct cli_state
*cli
, uint16_t tid
);
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 bool is_andx_req(uint8_t cmd
);
211 NTSTATUS
cli_smb(TALLOC_CTX
*mem_ctx
, struct cli_state
*cli
,
212 uint8_t smb_command
, uint8_t additional_flags
,
213 uint8_t wct
, uint16_t *vwv
,
214 uint32_t num_bytes
, const uint8_t *bytes
,
215 struct tevent_req
**result_parent
,
216 uint8_t min_wct
, uint8_t *pwct
, uint16_t **pvwv
,
217 uint32_t *pnum_bytes
, uint8_t **pbytes
);
219 /* The following definitions come from libsmb/clierror.c */
221 const char *cli_errstr(struct cli_state
*cli
);
222 NTSTATUS
cli_nt_error(struct cli_state
*cli
);
223 void cli_dos_error(struct cli_state
*cli
, uint8_t *eclass
, uint32_t *ecode
);
224 int cli_errno(struct cli_state
*cli
);
225 bool cli_is_error(struct cli_state
*cli
);
226 bool cli_is_nt_error(struct cli_state
*cli
);
227 bool cli_is_dos_error(struct cli_state
*cli
);
228 bool cli_state_is_connected(struct cli_state
*cli
);
230 /* The following definitions come from libsmb/clifile.c */
232 struct tevent_req
*cli_setpathinfo_send(TALLOC_CTX
*mem_ctx
,
233 struct tevent_context
*ev
,
234 struct cli_state
*cli
,
239 NTSTATUS
cli_setpathinfo_recv(struct tevent_req
*req
);
240 NTSTATUS
cli_setpathinfo(struct cli_state
*cli
,
246 struct tevent_req
*cli_posix_symlink_send(TALLOC_CTX
*mem_ctx
,
247 struct tevent_context
*ev
,
248 struct cli_state
*cli
,
250 const char *newname
);
251 NTSTATUS
cli_posix_symlink_recv(struct tevent_req
*req
);
252 NTSTATUS
cli_posix_symlink(struct cli_state
*cli
,
254 const char *newname
);
255 struct tevent_req
*cli_posix_readlink_send(TALLOC_CTX
*mem_ctx
,
256 struct tevent_context
*ev
,
257 struct cli_state
*cli
,
260 NTSTATUS
cli_posix_readlink_recv(struct tevent_req
*req
, struct cli_state
*cli
,
261 char *retpath
, size_t len
);
262 NTSTATUS
cli_posix_readlink(struct cli_state
*cli
, const char *fname
,
263 char *linkpath
, size_t len
);
264 struct tevent_req
*cli_posix_hardlink_send(TALLOC_CTX
*mem_ctx
,
265 struct tevent_context
*ev
,
266 struct cli_state
*cli
,
268 const char *newname
);
269 NTSTATUS
cli_posix_hardlink_recv(struct tevent_req
*req
);
270 NTSTATUS
cli_posix_hardlink(struct cli_state
*cli
,
272 const char *newname
);
273 uint32_t unix_perms_to_wire(mode_t perms
);
274 mode_t
wire_perms_to_unix(uint32_t perms
);
275 struct tevent_req
*cli_posix_getacl_send(TALLOC_CTX
*mem_ctx
,
276 struct tevent_context
*ev
,
277 struct cli_state
*cli
,
279 NTSTATUS
cli_posix_getacl_recv(struct tevent_req
*req
,
283 NTSTATUS
cli_posix_getacl(struct cli_state
*cli
,
288 struct tevent_req
*cli_posix_setacl_send(TALLOC_CTX
*mem_ctx
,
289 struct tevent_context
*ev
,
290 struct cli_state
*cli
,
293 size_t acl_buf_size
);
294 NTSTATUS
cli_posix_setacl_recv(struct tevent_req
*req
);
295 NTSTATUS
cli_posix_setacl(struct cli_state
*cli
,
298 size_t acl_buf_size
);
299 struct tevent_req
*cli_posix_stat_send(TALLOC_CTX
*mem_ctx
,
300 struct tevent_context
*ev
,
301 struct cli_state
*cli
,
303 NTSTATUS
cli_posix_stat_recv(struct tevent_req
*req
,
304 SMB_STRUCT_STAT
*sbuf
);
305 NTSTATUS
cli_posix_stat(struct cli_state
*cli
,
307 SMB_STRUCT_STAT
*sbuf
);
308 struct tevent_req
*cli_posix_chmod_send(TALLOC_CTX
*mem_ctx
,
309 struct tevent_context
*ev
,
310 struct cli_state
*cli
,
313 NTSTATUS
cli_posix_chmod_recv(struct tevent_req
*req
);
314 NTSTATUS
cli_posix_chmod(struct cli_state
*cli
, const char *fname
, mode_t mode
);
315 struct tevent_req
*cli_posix_chown_send(TALLOC_CTX
*mem_ctx
,
316 struct tevent_context
*ev
,
317 struct cli_state
*cli
,
321 NTSTATUS
cli_posix_chown_recv(struct tevent_req
*req
);
322 NTSTATUS
cli_posix_chown(struct cli_state
*cli
,
326 struct tevent_req
*cli_rename_send(TALLOC_CTX
*mem_ctx
,
327 struct tevent_context
*ev
,
328 struct cli_state
*cli
,
329 const char *fname_src
,
330 const char *fname_dst
,
332 NTSTATUS
cli_rename_recv(struct tevent_req
*req
);
333 NTSTATUS
cli_rename(struct cli_state
*cli
,
334 const char *fname_src
,
335 const char *fname_dst
,
337 struct tevent_req
*cli_ntrename_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
);
342 NTSTATUS
cli_ntrename_recv(struct tevent_req
*req
);
343 NTSTATUS
cli_ntrename(struct cli_state
*cli
, const char *fname_src
, const char *fname_dst
);
345 struct tevent_req
*cli_nt_hardlink_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
);
350 NTSTATUS
cli_nt_hardlink_recv(struct tevent_req
*req
);
351 NTSTATUS
cli_nt_hardlink(struct cli_state
*cli
, const char *fname_src
, const char *fname_dst
);
353 struct tevent_req
*cli_unlink_send(TALLOC_CTX
*mem_ctx
,
354 struct tevent_context
*ev
,
355 struct cli_state
*cli
,
357 uint16_t mayhave_attrs
);
358 NTSTATUS
cli_unlink_recv(struct tevent_req
*req
);
359 NTSTATUS
cli_unlink(struct cli_state
*cli
, const char *fname
, uint16_t mayhave_attrs
);
361 struct tevent_req
*cli_mkdir_send(TALLOC_CTX
*mem_ctx
,
362 struct tevent_context
*ev
,
363 struct cli_state
*cli
,
365 NTSTATUS
cli_mkdir_recv(struct tevent_req
*req
);
366 NTSTATUS
cli_mkdir(struct cli_state
*cli
, const char *dname
);
367 struct tevent_req
*cli_rmdir_send(TALLOC_CTX
*mem_ctx
,
368 struct tevent_context
*ev
,
369 struct cli_state
*cli
,
371 NTSTATUS
cli_rmdir_recv(struct tevent_req
*req
);
372 NTSTATUS
cli_rmdir(struct cli_state
*cli
, const char *dname
);
373 struct tevent_req
*cli_nt_delete_on_close_send(TALLOC_CTX
*mem_ctx
,
374 struct tevent_context
*ev
,
375 struct cli_state
*cli
,
378 NTSTATUS
cli_nt_delete_on_close_recv(struct tevent_req
*req
);
379 NTSTATUS
cli_nt_delete_on_close(struct cli_state
*cli
, uint16_t fnum
, bool flag
);
380 struct tevent_req
*cli_ntcreate_send(TALLOC_CTX
*mem_ctx
,
381 struct tevent_context
*ev
,
382 struct cli_state
*cli
,
385 uint32_t DesiredAccess
,
386 uint32_t FileAttributes
,
387 uint32_t ShareAccess
,
388 uint32_t CreateDisposition
,
389 uint32_t CreateOptions
,
390 uint8_t SecurityFlags
);
391 NTSTATUS
cli_ntcreate_recv(struct tevent_req
*req
,
393 struct smb_create_returns
*cr
);
394 NTSTATUS
cli_ntcreate(struct cli_state
*cli
,
397 uint32_t DesiredAccess
,
398 uint32_t FileAttributes
,
399 uint32_t ShareAccess
,
400 uint32_t CreateDisposition
,
401 uint32_t CreateOptions
,
402 uint8_t SecurityFlags
,
404 struct smb_create_returns
*cr
);
405 struct tevent_req
*cli_openx_create(TALLOC_CTX
*mem_ctx
,
406 struct tevent_context
*ev
,
407 struct cli_state
*cli
, const char *fname
,
408 int flags
, int share_mode
,
409 struct tevent_req
**psmbreq
);
410 struct tevent_req
*cli_openx_send(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
411 struct cli_state
*cli
, const char *fname
,
412 int flags
, int share_mode
);
413 NTSTATUS
cli_openx_recv(struct tevent_req
*req
, uint16_t *fnum
);
414 NTSTATUS
cli_openx(struct cli_state
*cli
, const char *fname
, int flags
, int share_mode
, uint16_t *pfnum
);
415 NTSTATUS
cli_open(struct cli_state
*cli
, const char *fname
, int flags
, int share_mode
, uint16_t *pfnum
);
416 struct tevent_req
*cli_close_create(TALLOC_CTX
*mem_ctx
,
417 struct tevent_context
*ev
,
418 struct cli_state
*cli
, uint16_t fnum
,
419 struct tevent_req
**psubreq
);
420 struct tevent_req
*cli_close_send(TALLOC_CTX
*mem_ctx
,
421 struct tevent_context
*ev
,
422 struct cli_state
*cli
, uint16_t fnum
);
423 NTSTATUS
cli_close_recv(struct tevent_req
*req
);
424 NTSTATUS
cli_close(struct cli_state
*cli
, uint16_t fnum
);
425 struct tevent_req
*cli_ftruncate_send(TALLOC_CTX
*mem_ctx
,
426 struct tevent_context
*ev
,
427 struct cli_state
*cli
,
430 NTSTATUS
cli_ftruncate_recv(struct tevent_req
*req
);
431 NTSTATUS
cli_ftruncate(struct cli_state
*cli
, uint16_t fnum
, uint64_t size
);
432 NTSTATUS
cli_locktype(struct cli_state
*cli
, uint16_t fnum
,
433 uint32_t offset
, uint32_t len
,
434 int timeout
, unsigned char locktype
);
435 NTSTATUS
cli_lock32(struct cli_state
*cli
, uint16_t fnum
, uint32_t offset
,
436 uint32_t len
, int timeout
, enum brl_type lock_type
);
437 struct tevent_req
*cli_unlock_send(TALLOC_CTX
*mem_ctx
,
438 struct tevent_context
*ev
,
439 struct cli_state
*cli
,
443 NTSTATUS
cli_unlock_recv(struct tevent_req
*req
);
444 NTSTATUS
cli_unlock(struct cli_state
*cli
, uint16_t fnum
, uint32_t offset
, uint32_t len
);
445 NTSTATUS
cli_lock64(struct cli_state
*cli
, uint16_t fnum
,
446 uint64_t offset
, uint64_t len
, int timeout
,
447 enum brl_type lock_type
);
448 struct tevent_req
*cli_unlock64_send(TALLOC_CTX
*mem_ctx
,
449 struct tevent_context
*ev
,
450 struct cli_state
*cli
,
454 NTSTATUS
cli_unlock64_recv(struct tevent_req
*req
);
455 NTSTATUS
cli_unlock64(struct cli_state
*cli
, uint16_t fnum
, uint64_t offset
, uint64_t len
);
456 struct tevent_req
*cli_posix_lock_send(TALLOC_CTX
*mem_ctx
,
457 struct tevent_context
*ev
,
458 struct cli_state
*cli
,
463 enum brl_type lock_type
);
464 NTSTATUS
cli_posix_lock_recv(struct tevent_req
*req
);
465 NTSTATUS
cli_posix_lock(struct cli_state
*cli
, uint16_t fnum
,
466 uint64_t offset
, uint64_t len
,
467 bool wait_lock
, enum brl_type lock_type
);
468 struct tevent_req
*cli_posix_unlock_send(TALLOC_CTX
*mem_ctx
,
469 struct tevent_context
*ev
,
470 struct cli_state
*cli
,
474 NTSTATUS
cli_posix_unlock_recv(struct tevent_req
*req
);
475 NTSTATUS
cli_posix_unlock(struct cli_state
*cli
, uint16_t fnum
, uint64_t offset
, uint64_t len
);
476 struct tevent_req
*cli_getattrE_send(TALLOC_CTX
*mem_ctx
,
477 struct tevent_context
*ev
,
478 struct cli_state
*cli
,
480 NTSTATUS
cli_getattrE_recv(struct tevent_req
*req
,
486 NTSTATUS
cli_getattrE(struct cli_state
*cli
,
493 struct tevent_req
*cli_setattrE_send(TALLOC_CTX
*mem_ctx
,
494 struct tevent_context
*ev
,
495 struct cli_state
*cli
,
500 NTSTATUS
cli_setattrE_recv(struct tevent_req
*req
);
501 NTSTATUS
cli_setattrE(struct cli_state
*cli
,
506 struct tevent_req
*cli_getatr_send(TALLOC_CTX
*mem_ctx
,
507 struct tevent_context
*ev
,
508 struct cli_state
*cli
,
510 NTSTATUS
cli_getatr_recv(struct tevent_req
*req
,
514 NTSTATUS
cli_getatr(struct cli_state
*cli
,
519 struct tevent_req
*cli_setatr_send(TALLOC_CTX
*mem_ctx
,
520 struct tevent_context
*ev
,
521 struct cli_state
*cli
,
525 NTSTATUS
cli_setatr_recv(struct tevent_req
*req
);
526 NTSTATUS
cli_setatr(struct cli_state
*cli
,
530 struct tevent_req
*cli_chkpath_send(TALLOC_CTX
*mem_ctx
,
531 struct tevent_context
*ev
,
532 struct cli_state
*cli
,
534 NTSTATUS
cli_chkpath_recv(struct tevent_req
*req
);
535 NTSTATUS
cli_chkpath(struct cli_state
*cli
, const char *path
);
536 struct tevent_req
*cli_dskattr_send(TALLOC_CTX
*mem_ctx
,
537 struct tevent_context
*ev
,
538 struct cli_state
*cli
);
539 NTSTATUS
cli_dskattr_recv(struct tevent_req
*req
, int *bsize
, int *total
,
541 NTSTATUS
cli_dskattr(struct cli_state
*cli
, int *bsize
, int *total
, int *avail
);
542 NTSTATUS
cli_disk_size(struct cli_state
*cli
, const char *path
, uint64_t *bsize
,
543 uint64_t *total
, uint64_t *avail
);
544 struct tevent_req
*cli_ctemp_send(TALLOC_CTX
*mem_ctx
,
545 struct tevent_context
*ev
,
546 struct cli_state
*cli
,
548 NTSTATUS
cli_ctemp_recv(struct tevent_req
*req
,
552 NTSTATUS
cli_ctemp(struct cli_state
*cli
,
557 NTSTATUS
cli_raw_ioctl(struct cli_state
*cli
, uint16_t fnum
, uint32_t code
, DATA_BLOB
*blob
);
558 NTSTATUS
cli_set_ea_path(struct cli_state
*cli
, const char *path
,
559 const char *ea_name
, const char *ea_val
,
561 NTSTATUS
cli_set_ea_fnum(struct cli_state
*cli
, uint16_t fnum
,
562 const char *ea_name
, const char *ea_val
,
564 struct tevent_req
*cli_get_ea_list_path_send(TALLOC_CTX
*mem_ctx
,
565 struct tevent_context
*ev
,
566 struct cli_state
*cli
,
568 NTSTATUS
cli_get_ea_list_path_recv(struct tevent_req
*req
, TALLOC_CTX
*mem_ctx
,
569 size_t *pnum_eas
, struct ea_struct
**peas
);
570 NTSTATUS
cli_get_ea_list_path(struct cli_state
*cli
, const char *path
,
573 struct ea_struct
**pea_list
);
574 struct tevent_req
*cli_posix_open_send(TALLOC_CTX
*mem_ctx
,
575 struct tevent_context
*ev
,
576 struct cli_state
*cli
,
580 NTSTATUS
cli_posix_open_recv(struct tevent_req
*req
, uint16_t *pfnum
);
581 NTSTATUS
cli_posix_open(struct cli_state
*cli
, const char *fname
,
582 int flags
, mode_t mode
, uint16_t *fnum
);
583 struct tevent_req
*cli_posix_mkdir_send(TALLOC_CTX
*mem_ctx
,
584 struct tevent_context
*ev
,
585 struct cli_state
*cli
,
588 NTSTATUS
cli_posix_mkdir_recv(struct tevent_req
*req
);
589 NTSTATUS
cli_posix_mkdir(struct cli_state
*cli
, const char *fname
, mode_t mode
);
591 struct tevent_req
*cli_posix_unlink_send(TALLOC_CTX
*mem_ctx
,
592 struct tevent_context
*ev
,
593 struct cli_state
*cli
,
595 NTSTATUS
cli_posix_unlink_recv(struct tevent_req
*req
);
596 NTSTATUS
cli_posix_unlink(struct cli_state
*cli
, const char *fname
);
598 struct tevent_req
*cli_posix_rmdir_send(TALLOC_CTX
*mem_ctx
,
599 struct tevent_context
*ev
,
600 struct cli_state
*cli
,
602 NTSTATUS
cli_posix_rmdir_recv(struct tevent_req
*req
, TALLOC_CTX
*mem_ctx
);
603 NTSTATUS
cli_posix_rmdir(struct cli_state
*cli
, const char *fname
);
604 struct tevent_req
*cli_notify_send(TALLOC_CTX
*mem_ctx
,
605 struct tevent_context
*ev
,
606 struct cli_state
*cli
, uint16_t fnum
,
607 uint32_t buffer_size
,
608 uint32_t completion_filter
, bool recursive
);
609 NTSTATUS
cli_notify_recv(struct tevent_req
*req
, TALLOC_CTX
*mem_ctx
,
610 uint32_t *pnum_changes
,
611 struct notify_change
**pchanges
);
612 NTSTATUS
cli_notify(struct cli_state
*cli
, uint16_t fnum
, uint32_t buffer_size
,
613 uint32_t completion_filter
, bool recursive
,
614 TALLOC_CTX
*mem_ctx
, uint32_t *pnum_changes
,
615 struct notify_change
**pchanges
);
617 struct tevent_req
*cli_nttrans_create_send(TALLOC_CTX
*mem_ctx
,
618 struct tevent_context
*ev
,
619 struct cli_state
*cli
,
622 uint32_t DesiredAccess
,
623 uint32_t FileAttributes
,
624 uint32_t ShareAccess
,
625 uint32_t CreateDisposition
,
626 uint32_t CreateOptions
,
627 uint8_t SecurityFlags
,
628 struct security_descriptor
*secdesc
,
629 struct ea_struct
*eas
,
631 NTSTATUS
cli_nttrans_create_recv(struct tevent_req
*req
,
633 struct smb_create_returns
*cr
);
634 NTSTATUS
cli_nttrans_create(struct cli_state
*cli
,
637 uint32_t DesiredAccess
,
638 uint32_t FileAttributes
,
639 uint32_t ShareAccess
,
640 uint32_t CreateDisposition
,
641 uint32_t CreateOptions
,
642 uint8_t SecurityFlags
,
643 struct security_descriptor
*secdesc
,
644 struct ea_struct
*eas
,
647 struct smb_create_returns
*cr
);
649 /* The following definitions come from libsmb/clifsinfo.c */
651 struct tevent_req
*cli_unix_extensions_version_send(TALLOC_CTX
*mem_ctx
,
652 struct tevent_context
*ev
,
653 struct cli_state
*cli
);
654 NTSTATUS
cli_unix_extensions_version_recv(struct tevent_req
*req
,
655 uint16_t *pmajor
, uint16_t *pminor
,
658 NTSTATUS
cli_unix_extensions_version(struct cli_state
*cli
, uint16_t *pmajor
,
659 uint16_t *pminor
, uint32_t *pcaplow
,
661 struct tevent_req
*cli_set_unix_extensions_capabilities_send(
662 TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
, struct cli_state
*cli
,
663 uint16_t major
, uint16_t minor
, uint32_t caplow
, uint32_t caphigh
);
664 NTSTATUS
cli_set_unix_extensions_capabilities_recv(struct tevent_req
*req
);
665 NTSTATUS
cli_set_unix_extensions_capabilities(struct cli_state
*cli
,
666 uint16_t major
, uint16_t minor
,
667 uint32_t caplow
, uint32_t caphigh
);
668 struct tevent_req
*cli_get_fs_attr_info_send(TALLOC_CTX
*mem_ctx
,
669 struct tevent_context
*ev
,
670 struct cli_state
*cli
);
671 NTSTATUS
cli_get_fs_attr_info_recv(struct tevent_req
*req
, uint32_t *fs_attr
);
672 NTSTATUS
cli_get_fs_attr_info(struct cli_state
*cli
, uint32_t *fs_attr
);
673 NTSTATUS
cli_get_fs_volume_info(struct cli_state
*cli
,
674 TALLOC_CTX
*mem_ctx
, char **volume_name
,
675 uint32_t *pserial_number
, time_t *pdate
);
676 NTSTATUS
cli_get_fs_full_size_info(struct cli_state
*cli
,
677 uint64_t *total_allocation_units
,
678 uint64_t *caller_allocation_units
,
679 uint64_t *actual_allocation_units
,
680 uint64_t *sectors_per_allocation_unit
,
681 uint64_t *bytes_per_sector
);
682 NTSTATUS
cli_get_posix_fs_info(struct cli_state
*cli
,
683 uint32_t *optimal_transfer_size
,
684 uint32_t *block_size
,
685 uint64_t *total_blocks
,
686 uint64_t *blocks_available
,
687 uint64_t *user_blocks_available
,
688 uint64_t *total_file_nodes
,
689 uint64_t *free_file_nodes
,
690 uint64_t *fs_identifier
);
691 struct tevent_req
*cli_posix_whoami_send(TALLOC_CTX
*mem_ctx
,
692 struct tevent_context
*ev
,
693 struct cli_state
*cli
);
694 NTSTATUS
cli_posix_whoami_recv(struct tevent_req
*req
,
701 struct dom_sid
**psids
,
703 NTSTATUS
cli_posix_whoami(struct cli_state
*cli
,
710 struct dom_sid
**sids
,
713 /* The following definitions come from libsmb/clilist.c */
715 NTSTATUS
cli_list_old(struct cli_state
*cli
,const char *Mask
,uint16_t attribute
,
716 NTSTATUS (*fn
)(const char *, struct file_info
*,
717 const char *, void *), void *state
);
718 NTSTATUS
cli_list_trans(struct cli_state
*cli
, const char *mask
,
719 uint16_t attribute
, int info_level
,
720 NTSTATUS (*fn
)(const char *mnt
, struct file_info
*finfo
,
721 const char *mask
, void *private_data
),
723 struct tevent_req
*cli_list_send(TALLOC_CTX
*mem_ctx
,
724 struct tevent_context
*ev
,
725 struct cli_state
*cli
,
728 uint16_t info_level
);
729 NTSTATUS
cli_list_recv(struct tevent_req
*req
, TALLOC_CTX
*mem_ctx
,
730 struct file_info
**finfo
, size_t *num_finfo
);
731 NTSTATUS
cli_list(struct cli_state
*cli
,const char *Mask
,uint16_t attribute
,
732 NTSTATUS (*fn
)(const char *, struct file_info
*, const char *,
733 void *), void *state
);
735 /* The following definitions come from libsmb/climessage.c */
737 struct tevent_req
*cli_message_send(TALLOC_CTX
*mem_ctx
,
738 struct tevent_context
*ev
,
739 struct cli_state
*cli
,
740 const char *host
, const char *username
,
741 const char *message
);
742 NTSTATUS
cli_message_recv(struct tevent_req
*req
);
743 NTSTATUS
cli_message(struct cli_state
*cli
, const char *host
,
744 const char *username
, const char *message
);
746 /* The following definitions come from libsmb/clioplock.c */
748 struct tevent_req
*cli_smb_oplock_break_waiter_send(TALLOC_CTX
*mem_ctx
,
749 struct tevent_context
*ev
,
750 struct cli_state
*cli
);
751 NTSTATUS
cli_smb_oplock_break_waiter_recv(struct tevent_req
*req
,
755 struct tevent_req
*cli_oplock_ack_send(TALLOC_CTX
*mem_ctx
,
756 struct tevent_context
*ev
,
757 struct cli_state
*cli
,
758 uint16_t fnum
, uint8_t level
);
759 NTSTATUS
cli_oplock_ack_recv(struct tevent_req
*req
);
761 /* The following definitions come from libsmb/cliprint.c */
763 int cli_print_queue(struct cli_state
*cli
,
764 void (*fn
)(struct print_job_info
*));
765 int cli_printjob_del(struct cli_state
*cli
, int job
);
767 /* The following definitions come from libsmb/cliquota.c */
769 NTSTATUS
cli_get_quota_handle(struct cli_state
*cli
, uint16_t *quota_fnum
);
770 void free_ntquota_list(SMB_NTQUOTA_LIST
**qt_list
);
771 bool parse_user_quota_record(const uint8_t *rdata
,
772 unsigned int rdata_count
,
773 unsigned int *offset
,
774 SMB_NTQUOTA_STRUCT
*pqt
);
775 bool add_record_to_ntquota_list(TALLOC_CTX
*mem_ctx
,
776 SMB_NTQUOTA_STRUCT
*pqt
,
777 SMB_NTQUOTA_LIST
**pqt_list
);
778 NTSTATUS
parse_user_quota_list(const uint8_t *curdata
,
779 uint32_t curdata_size
,
781 SMB_NTQUOTA_LIST
**pqt_list
);
782 NTSTATUS
parse_fs_quota_buffer(const uint8_t *rdata
,
783 unsigned int rdata_count
,
784 SMB_NTQUOTA_STRUCT
*pqt
);
785 NTSTATUS
build_user_quota_buffer(SMB_NTQUOTA_LIST
*qt_list
,
789 SMB_NTQUOTA_LIST
**end_ptr
);
790 NTSTATUS
build_fs_quota_buffer(TALLOC_CTX
*mem_ctx
,
791 const SMB_NTQUOTA_STRUCT
*pqt
,
794 NTSTATUS
cli_get_user_quota(struct cli_state
*cli
, int quota_fnum
,
795 SMB_NTQUOTA_STRUCT
*pqt
);
796 NTSTATUS
cli_set_user_quota(struct cli_state
*cli
,
798 SMB_NTQUOTA_LIST
*qtl
);
799 NTSTATUS
cli_list_user_quota(struct cli_state
*cli
, int quota_fnum
,
800 SMB_NTQUOTA_LIST
**pqt_list
);
801 NTSTATUS
cli_get_fs_quota_info(struct cli_state
*cli
, int quota_fnum
,
802 SMB_NTQUOTA_STRUCT
*pqt
);
803 NTSTATUS
cli_set_fs_quota_info(struct cli_state
*cli
, int quota_fnum
,
804 SMB_NTQUOTA_STRUCT
*pqt
);
806 /* The following definitions come from libsmb/clireadwrite.c */
808 struct tevent_req
*cli_read_andx_create(TALLOC_CTX
*mem_ctx
,
809 struct tevent_context
*ev
,
810 struct cli_state
*cli
, uint16_t fnum
,
811 off_t offset
, size_t size
,
812 struct tevent_req
**psmbreq
);
813 struct tevent_req
*cli_read_andx_send(TALLOC_CTX
*mem_ctx
,
814 struct tevent_context
*ev
,
815 struct cli_state
*cli
, uint16_t fnum
,
816 off_t offset
, size_t size
);
817 NTSTATUS
cli_read_andx_recv(struct tevent_req
*req
, ssize_t
*received
,
819 struct tevent_req
*cli_pull_send(TALLOC_CTX
*mem_ctx
,
820 struct tevent_context
*ev
,
821 struct cli_state
*cli
,
822 uint16_t fnum
, off_t start_offset
,
823 off_t size
, size_t window_size
,
824 NTSTATUS (*sink
)(char *buf
, size_t n
,
827 NTSTATUS
cli_pull_recv(struct tevent_req
*req
, off_t
*received
);
828 NTSTATUS
cli_pull(struct cli_state
*cli
, uint16_t fnum
,
829 off_t start_offset
, off_t size
, size_t window_size
,
830 NTSTATUS (*sink
)(char *buf
, size_t n
, void *priv
),
831 void *priv
, off_t
*received
);
832 NTSTATUS
cli_read(struct cli_state
*cli
, uint16_t fnum
,
833 char *buf
, off_t offset
, size_t size
,
835 NTSTATUS
cli_smbwrite(struct cli_state
*cli
, uint16_t fnum
, char *buf
,
836 off_t offset
, size_t size1
, size_t *ptotal
);
837 struct tevent_req
*cli_write_andx_create(TALLOC_CTX
*mem_ctx
,
838 struct tevent_context
*ev
,
839 struct cli_state
*cli
, uint16_t fnum
,
840 uint16_t mode
, const uint8_t *buf
,
841 off_t offset
, size_t size
,
842 struct tevent_req
**reqs_before
,
844 struct tevent_req
**psmbreq
);
845 struct tevent_req
*cli_write_andx_send(TALLOC_CTX
*mem_ctx
,
846 struct tevent_context
*ev
,
847 struct cli_state
*cli
, uint16_t fnum
,
848 uint16_t mode
, const uint8_t *buf
,
849 off_t offset
, size_t size
);
850 NTSTATUS
cli_write_andx_recv(struct tevent_req
*req
, size_t *pwritten
);
852 NTSTATUS
cli_writeall(struct cli_state
*cli
, uint16_t fnum
, uint16_t mode
,
853 const uint8_t *buf
, off_t offset
, size_t size
,
856 struct tevent_req
*cli_push_send(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
857 struct cli_state
*cli
,
858 uint16_t fnum
, uint16_t mode
,
859 off_t start_offset
, size_t window_size
,
860 size_t (*source
)(uint8_t *buf
, size_t n
,
863 NTSTATUS
cli_push_recv(struct tevent_req
*req
);
864 NTSTATUS
cli_push(struct cli_state
*cli
, uint16_t fnum
, uint16_t mode
,
865 off_t start_offset
, size_t window_size
,
866 size_t (*source
)(uint8_t *buf
, size_t n
, void *priv
),
869 NTSTATUS
cli_splice(struct cli_state
*srccli
, struct cli_state
*dstcli
,
870 uint16_t src_fnum
, uint16_t dst_fnum
,
872 off_t src_offset
, off_t dst_offset
,
874 int (*splice_cb
)(off_t n
, void *priv
), void *priv
);
876 /* The following definitions come from libsmb/clisecdesc.c */
878 NTSTATUS
cli_query_security_descriptor(struct cli_state
*cli
,
882 struct security_descriptor
**sd
);
883 NTSTATUS
cli_query_secdesc(struct cli_state
*cli
, uint16_t fnum
,
884 TALLOC_CTX
*mem_ctx
, struct security_descriptor
**sd
);
885 NTSTATUS
cli_set_security_descriptor(struct cli_state
*cli
,
888 const struct security_descriptor
*sd
);
889 NTSTATUS
cli_set_secdesc(struct cli_state
*cli
, uint16_t fnum
,
890 const struct security_descriptor
*sd
);
892 /* The following definitions come from libsmb/clistr.c */
894 size_t clistr_pull_talloc(TALLOC_CTX
*ctx
,
901 bool clistr_is_previous_version_path(const char *path
,
906 /* The following definitions come from libsmb/clitrans.c */
908 struct tevent_req
*cli_trans_send(
909 TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
910 struct cli_state
*cli
, uint16_t additional_flags2
, uint8_t cmd
,
911 const char *pipe_name
, uint16_t fid
, uint16_t function
, int flags
,
912 uint16_t *setup
, uint8_t num_setup
, uint8_t max_setup
,
913 uint8_t *param
, uint32_t num_param
, uint32_t max_param
,
914 uint8_t *data
, uint32_t num_data
, uint32_t max_data
);
915 NTSTATUS
cli_trans_recv(struct tevent_req
*req
, TALLOC_CTX
*mem_ctx
,
916 uint16_t *recv_flags2
,
917 uint16_t **setup
, uint8_t min_setup
,
919 uint8_t **param
, uint32_t min_param
,
921 uint8_t **data
, uint32_t min_data
,
923 NTSTATUS
cli_trans(TALLOC_CTX
*mem_ctx
, struct cli_state
*cli
,
925 const char *pipe_name
, uint16_t fid
, uint16_t function
,
927 uint16_t *setup
, uint8_t num_setup
, uint8_t max_setup
,
928 uint8_t *param
, uint32_t num_param
, uint32_t max_param
,
929 uint8_t *data
, uint32_t num_data
, uint32_t max_data
,
930 uint16_t *recv_flags2
,
931 uint16_t **rsetup
, uint8_t min_rsetup
, uint8_t *num_rsetup
,
932 uint8_t **rparam
, uint32_t min_rparam
, uint32_t *num_rparam
,
933 uint8_t **rdata
, uint32_t min_rdata
, uint32_t *num_rdata
);
935 /* The following definitions come from libsmb/reparse_symlink.c */
937 bool symlink_reparse_buffer_marshall(
938 const char *substitute
, const char *printname
, uint32_t flags
,
939 TALLOC_CTX
*mem_ctx
, uint8_t **pdst
, size_t *pdstlen
);
940 bool symlink_reparse_buffer_parse(
941 const uint8_t *src
, size_t srclen
, TALLOC_CTX
*mem_ctx
,
942 char **psubstitute_name
, char **pprint_name
, uint32_t *pflags
);
944 /* The following definitions come from libsmb/clisymlink.c */
946 struct tevent_req
*cli_symlink_send(TALLOC_CTX
*mem_ctx
,
947 struct tevent_context
*ev
,
948 struct cli_state
*cli
,
952 NTSTATUS
cli_symlink_recv(struct tevent_req
*req
);
953 NTSTATUS
cli_symlink(struct cli_state
*cli
, const char *oldname
,
954 const char *newname
, uint32_t flags
);
956 struct tevent_req
*cli_readlink_send(TALLOC_CTX
*mem_ctx
,
957 struct tevent_context
*ev
,
958 struct cli_state
*cli
,
960 NTSTATUS
cli_readlink_recv(struct tevent_req
*req
, TALLOC_CTX
*mem_ctx
,
961 char **psubstitute_name
, char **pprint_name
,
963 NTSTATUS
cli_readlink(struct cli_state
*cli
, const char *fname
,
964 TALLOC_CTX
*mem_ctx
, char **psubstitute_name
,
965 char **pprint_name
, uint32_t *pflags
);
967 #endif /* _LIBSMB_PROTO_H_ */