2 Unix SMB/CIFS implementation.
4 Copyright (C) Andrew Bartlett 2001-2003
5 Copyright (C) Andrew Tridgell 1994-1998,2000-2001
6 Copyright (C) Gerald (Jerry) Carter 2004
7 Copyright (C) Jelmer Vernooij 2003
8 Copyright (C) Jeremy Allison 2001-2009,2011
9 Copyright (C) Stefan Metzmacher 2003,2009
10 Copyright (C) Volker Lendecke 2011
12 This program is free software; you can redistribute it and/or modify
13 it under the terms of the GNU General Public License as published by
14 the Free Software Foundation; either version 3 of the License, or
15 (at your option) any later version.
17 This program is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License for more details.
22 You should have received a copy of the GNU General Public License
23 along with this program. If not, see <http://www.gnu.org/licenses/>.
26 #ifndef _LIBSMB_PROTO_H_
27 #define _LIBSMB_PROTO_H_
29 struct smb_trans_enc_state;
30 struct cli_credentials;
33 struct print_job_info;
35 /* The following definitions come from libsmb/cliconnect.c */
37 struct cli_credentials *cli_session_creds_init(TALLOC_CTX *mem_ctx,
43 bool fallback_after_kerberos,
45 bool password_is_nt_hash);
46 NTSTATUS cli_session_creds_prepare_krb5(struct cli_state *cli,
47 struct cli_credentials *creds);
48 struct tevent_req *cli_session_setup_creds_send(TALLOC_CTX *mem_ctx,
49 struct tevent_context *ev,
50 struct cli_state *cli,
51 struct cli_credentials *creds);
52 NTSTATUS cli_session_setup_creds_recv(struct tevent_req *req);
53 NTSTATUS cli_session_setup_creds(struct cli_state *cli,
54 struct cli_credentials *creds);
55 NTSTATUS cli_session_setup_anon(struct cli_state *cli);
56 struct tevent_req *cli_session_setup_guest_create(TALLOC_CTX *mem_ctx,
57 struct tevent_context *ev,
58 struct cli_state *cli,
59 struct tevent_req **psmbreq);
60 struct tevent_req *cli_session_setup_guest_send(TALLOC_CTX *mem_ctx,
61 struct tevent_context *ev,
62 struct cli_state *cli);
63 NTSTATUS cli_session_setup_guest_recv(struct tevent_req *req);
64 NTSTATUS cli_ulogoff(struct cli_state *cli);
65 struct tevent_req *cli_tcon_andx_create(TALLOC_CTX *mem_ctx,
66 struct tevent_context *ev,
67 struct cli_state *cli,
68 const char *share, const char *dev,
69 const char *pass, int passlen,
70 struct tevent_req **psmbreq);
71 struct tevent_req *cli_tcon_andx_send(TALLOC_CTX *mem_ctx,
72 struct tevent_context *ev,
73 struct cli_state *cli,
74 const char *share, const char *dev,
75 const char *pass, int passlen);
76 NTSTATUS cli_tcon_andx_recv(struct tevent_req *req);
77 NTSTATUS cli_tcon_andx(struct cli_state *cli, const char *share,
78 const char *dev, const char *pass, int passlen);
79 NTSTATUS cli_tree_connect_creds(struct cli_state *cli,
80 const char *share, const char *dev,
81 struct cli_credentials *creds);
82 NTSTATUS cli_tree_connect(struct cli_state *cli, const char *share,
83 const char *dev, const char *pass);
84 NTSTATUS cli_tdis(struct cli_state *cli);
85 NTSTATUS cli_connect_nb(const char *host, const struct sockaddr_storage *dest_ss,
86 uint16_t port, int name_type, const char *myname,
87 enum smb_signing_setting signing_state, int flags, struct cli_state **pcli);
88 NTSTATUS cli_start_connection(struct cli_state **output_cli,
90 const char *dest_host,
91 const struct sockaddr_storage *dest_ss, int port,
92 enum smb_signing_setting signing_state, int flags);
93 NTSTATUS cli_smb1_setup_encryption(struct cli_state *cli,
94 struct cli_credentials *creds);
96 struct smb2_negotiate_contexts;
97 struct tevent_req *cli_full_connection_creds_send(
98 TALLOC_CTX *mem_ctx, struct tevent_context *ev,
99 const char *my_name, const char *dest_host,
100 const struct sockaddr_storage *dest_ss, int port,
101 const char *service, const char *service_type,
102 struct cli_credentials *creds,
104 struct smb2_negotiate_contexts *negotiate_contexts);
105 NTSTATUS cli_full_connection_creds_recv(struct tevent_req *req,
106 struct cli_state **output_cli);
107 NTSTATUS cli_full_connection_creds(struct cli_state **output_cli,
109 const char *dest_host,
110 const struct sockaddr_storage *dest_ss, int port,
111 const char *service, const char *service_type,
112 struct cli_credentials *creds,
114 NTSTATUS cli_raw_tcon(struct cli_state *cli,
115 const char *service, const char *pass, const char *dev,
116 uint16_t *max_xmit, uint16_t *tid);
117 struct cli_state *get_ipc_connect(char *server,
118 struct sockaddr_storage *server_ss,
119 struct cli_credentials *creds);
120 struct cli_state *get_ipc_connect_master_ip(TALLOC_CTX *ctx,
121 struct sockaddr_storage *mb_ip,
122 struct cli_credentials *creds,
123 char **pp_workgroup_out);
125 /* The following definitions come from libsmb/clidfs.c */
127 NTSTATUS cli_cm_open(TALLOC_CTX *ctx,
128 struct cli_state *referring_cli,
131 struct cli_credentials *creds,
132 const struct sockaddr_storage *dest_ss,
135 struct cli_state **pcli);
136 void cli_cm_display(struct cli_state *c);
137 struct client_dfs_referral;
138 bool cli_dfs_is_already_full_path(struct cli_state *cli, const char *path);
139 NTSTATUS cli_dfs_get_referral_ex(TALLOC_CTX *ctx,
140 struct cli_state *cli,
142 uint16_t max_referral_level,
143 struct client_dfs_referral **refs,
146 NTSTATUS cli_dfs_get_referral(TALLOC_CTX *ctx,
147 struct cli_state *cli,
149 struct client_dfs_referral **refs,
152 NTSTATUS cli_resolve_path(TALLOC_CTX *ctx,
154 struct cli_credentials *creds,
155 struct cli_state *rootcli,
157 struct cli_state **targetcli,
158 char **pp_targetpath);
160 bool cli_check_msdfs_proxy(TALLOC_CTX *ctx,
161 struct cli_state *cli,
162 const char *sharename,
165 struct cli_credentials *creds);
167 NTSTATUS cli_dfs_target_check(TALLOC_CTX *mem_ctx,
168 struct cli_state *cli,
169 const char *fname_dst,
170 const char **fname_dst_out);
171 char *smb1_dfs_share_path(TALLOC_CTX *ctx,
172 struct cli_state *cli,
175 /* The following definitions come from libsmb/clientgen.c */
177 unsigned int cli_set_timeout(struct cli_state *cli, unsigned int timeout);
178 bool cli_set_backup_intent(struct cli_state *cli, bool flag);
179 extern struct GUID cli_state_client_guid;
180 struct cli_state *cli_state_create(TALLOC_CTX *mem_ctx,
182 const char *remote_name,
183 enum smb_signing_setting signing_state,
185 void cli_shutdown(struct cli_state *cli);
186 uint16_t cli_state_get_vc_num(struct cli_state *cli);
187 uint32_t cli_setpid(struct cli_state *cli, uint32_t pid);
188 uint32_t cli_getpid(struct cli_state *cli);
189 bool cli_state_is_encryption_on(struct cli_state *cli);
190 bool cli_state_has_tcon(struct cli_state *cli);
191 uint32_t cli_state_get_tid(struct cli_state *cli);
192 uint32_t cli_state_set_tid(struct cli_state *cli, uint32_t tid);
194 void cli_state_save_tcon_share(struct cli_state *cli,
195 struct smbXcli_tcon **_tcon_ret,
197 void cli_state_restore_tcon_share(struct cli_state *cli,
198 struct smbXcli_tcon *tcon,
200 uint16_t cli_state_get_uid(struct cli_state *cli);
201 uint16_t cli_state_set_uid(struct cli_state *cli, uint16_t uid);
202 bool cli_set_case_sensitive(struct cli_state *cli, bool case_sensitive);
203 uint32_t cli_state_available_size(struct cli_state *cli, uint32_t ofs);
204 time_t cli_state_server_time(struct cli_state *cli);
205 struct tevent_req *cli_echo_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
206 struct cli_state *cli, uint16_t num_echos,
208 NTSTATUS cli_echo_recv(struct tevent_req *req);
209 NTSTATUS cli_echo(struct cli_state *cli, uint16_t num_echos, DATA_BLOB data);
210 NTSTATUS cli_smb(TALLOC_CTX *mem_ctx, struct cli_state *cli,
211 uint8_t smb_command, uint8_t additional_flags,
212 uint8_t wct, uint16_t *vwv,
213 uint32_t num_bytes, const uint8_t *bytes,
214 struct tevent_req **result_parent,
215 uint8_t min_wct, uint8_t *pwct, uint16_t **pvwv,
216 uint32_t *pnum_bytes, uint8_t **pbytes);
218 /* The following definitions come from libsmb/clierror.c */
220 NTSTATUS cli_nt_error(struct cli_state *cli);
221 int cli_status_to_errno(NTSTATUS status);
222 int cli_errno(struct cli_state *cli);
223 bool cli_is_error(struct cli_state *cli);
224 bool cli_state_is_connected(struct cli_state *cli);
226 /* The following definitions come from libsmb/clifile.c */
228 struct tevent_req *cli_setpathinfo_send(TALLOC_CTX *mem_ctx,
229 struct tevent_context *ev,
230 struct cli_state *cli,
235 NTSTATUS cli_setpathinfo_recv(struct tevent_req *req);
236 NTSTATUS cli_setpathinfo(struct cli_state *cli,
241 struct tevent_req *cli_setfileinfo_send(
243 struct tevent_context *ev,
244 struct cli_state *cli,
249 NTSTATUS cli_setfileinfo_recv(struct tevent_req *req);
251 struct tevent_req *cli_posix_symlink_send(TALLOC_CTX *mem_ctx,
252 struct tevent_context *ev,
253 struct cli_state *cli,
255 const char *newname);
256 NTSTATUS cli_posix_symlink_recv(struct tevent_req *req);
257 NTSTATUS cli_posix_symlink(struct cli_state *cli,
259 const char *newname);
260 struct tevent_req *cli_posix_readlink_send(TALLOC_CTX *mem_ctx,
261 struct tevent_context *ev,
262 struct cli_state *cli,
264 NTSTATUS cli_posix_readlink_recv(
265 struct tevent_req *req, TALLOC_CTX *mem_ctx, char **target);
266 struct tevent_req *cli_posix_hardlink_send(TALLOC_CTX *mem_ctx,
267 struct tevent_context *ev,
268 struct cli_state *cli,
270 const char *newname);
271 NTSTATUS cli_posix_hardlink_recv(struct tevent_req *req);
272 NTSTATUS cli_posix_hardlink(struct cli_state *cli,
274 const char *newname);
275 uint32_t unix_perms_to_wire(mode_t perms);
276 mode_t wire_perms_to_unix(uint32_t perms);
277 struct tevent_req *cli_posix_getacl_send(TALLOC_CTX *mem_ctx,
278 struct tevent_context *ev,
279 struct cli_state *cli,
281 NTSTATUS cli_posix_getacl_recv(struct tevent_req *req,
285 NTSTATUS cli_posix_getacl(struct cli_state *cli,
290 struct tevent_req *cli_posix_setacl_send(TALLOC_CTX *mem_ctx,
291 struct tevent_context *ev,
292 struct cli_state *cli,
295 size_t acl_buf_size);
296 NTSTATUS cli_posix_setacl_recv(struct tevent_req *req);
297 NTSTATUS cli_posix_setacl(struct cli_state *cli,
300 size_t acl_buf_size);
301 struct tevent_req *cli_posix_stat_send(TALLOC_CTX *mem_ctx,
302 struct tevent_context *ev,
303 struct cli_state *cli,
305 NTSTATUS cli_posix_stat_recv(struct tevent_req *req, struct stat_ex *sbuf);
306 NTSTATUS cli_posix_stat(struct cli_state *cli,
308 struct stat_ex *sbuf);
309 struct tevent_req *cli_posix_chmod_send(TALLOC_CTX *mem_ctx,
310 struct tevent_context *ev,
311 struct cli_state *cli,
314 NTSTATUS cli_posix_chmod_recv(struct tevent_req *req);
315 NTSTATUS cli_posix_chmod(struct cli_state *cli, const char *fname, mode_t mode);
316 struct tevent_req *cli_posix_chown_send(TALLOC_CTX *mem_ctx,
317 struct tevent_context *ev,
318 struct cli_state *cli,
322 NTSTATUS cli_posix_chown_recv(struct tevent_req *req);
323 NTSTATUS cli_posix_chown(struct cli_state *cli,
327 struct tevent_req *cli_mknod_send(
329 struct tevent_context *ev,
330 struct cli_state *cli,
334 NTSTATUS cli_mknod_recv(struct tevent_req *req);
336 cli_mknod(struct cli_state *cli, const char *fname, mode_t mode, dev_t dev);
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 uint32_t mayhave_attrs);
373 NTSTATUS cli_unlink_recv(struct tevent_req *req);
374 NTSTATUS cli_unlink(struct cli_state *cli, const char *fname, uint32_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,
441 NTSTATUS cli_close_recv(struct tevent_req *req);
442 NTSTATUS cli_close(struct cli_state *cli, uint16_t fnum);
443 struct tevent_req *cli_ftruncate_send(TALLOC_CTX *mem_ctx,
444 struct tevent_context *ev,
445 struct cli_state *cli,
448 NTSTATUS cli_ftruncate_recv(struct tevent_req *req);
449 NTSTATUS cli_ftruncate(struct cli_state *cli, uint16_t fnum, uint64_t size);
450 NTSTATUS cli_locktype(struct cli_state *cli, uint16_t fnum,
451 uint32_t offset, uint32_t len,
452 int timeout, unsigned char locktype);
453 struct smb1_lock_element {
459 struct tevent_req *cli_lockingx_create(
461 struct tevent_context *ev,
462 struct cli_state *cli,
465 uint8_t newoplocklevel,
467 uint16_t num_unlocks,
468 const struct smb1_lock_element *unlocks,
470 const struct smb1_lock_element *locks,
471 struct tevent_req **psmbreq);
472 struct tevent_req *cli_lockingx_send(
474 struct tevent_context *ev,
475 struct cli_state *cli,
478 uint8_t newoplocklevel,
480 uint16_t num_unlocks,
481 const struct smb1_lock_element *unlocks,
483 const struct smb1_lock_element *locks);
484 NTSTATUS cli_lockingx_recv(struct tevent_req *req);
485 NTSTATUS cli_lockingx(
486 struct cli_state *cli,
489 uint8_t newoplocklevel,
491 uint16_t num_unlocks,
492 const struct smb1_lock_element *unlocks,
494 const struct smb1_lock_element *locks);
496 NTSTATUS cli_lock32(struct cli_state *cli, uint16_t fnum, uint32_t offset,
497 uint32_t len, int timeout, enum brl_type lock_type);
498 struct tevent_req *cli_unlock_send(TALLOC_CTX *mem_ctx,
499 struct tevent_context *ev,
500 struct cli_state *cli,
504 NTSTATUS cli_unlock_recv(struct tevent_req *req);
505 NTSTATUS cli_unlock(struct cli_state *cli, uint16_t fnum, uint32_t offset, uint32_t len);
506 struct tevent_req *cli_posix_lock_send(TALLOC_CTX *mem_ctx,
507 struct tevent_context *ev,
508 struct cli_state *cli,
513 enum brl_type lock_type);
514 NTSTATUS cli_posix_lock_recv(struct tevent_req *req);
515 NTSTATUS cli_posix_lock(struct cli_state *cli, uint16_t fnum,
516 uint64_t offset, uint64_t len,
517 bool wait_lock, enum brl_type lock_type);
518 struct tevent_req *cli_posix_unlock_send(TALLOC_CTX *mem_ctx,
519 struct tevent_context *ev,
520 struct cli_state *cli,
524 NTSTATUS cli_posix_unlock_recv(struct tevent_req *req);
525 NTSTATUS cli_posix_unlock(struct cli_state *cli, uint16_t fnum, uint64_t offset, uint64_t len);
526 struct tevent_req *cli_getattrE_send(TALLOC_CTX *mem_ctx,
527 struct tevent_context *ev,
528 struct cli_state *cli,
530 NTSTATUS cli_getattrE_recv(struct tevent_req *req,
536 struct tevent_req *cli_setattrE_send(TALLOC_CTX *mem_ctx,
537 struct tevent_context *ev,
538 struct cli_state *cli,
543 NTSTATUS cli_setattrE_recv(struct tevent_req *req);
544 NTSTATUS cli_setattrE(struct cli_state *cli,
549 struct tevent_req *cli_getatr_send(TALLOC_CTX *mem_ctx,
550 struct tevent_context *ev,
551 struct cli_state *cli,
553 NTSTATUS cli_getatr_recv(struct tevent_req *req,
557 NTSTATUS cli_getatr(struct cli_state *cli,
562 struct tevent_req *cli_setatr_send(TALLOC_CTX *mem_ctx,
563 struct tevent_context *ev,
564 struct cli_state *cli,
568 NTSTATUS cli_setatr_recv(struct tevent_req *req);
569 NTSTATUS cli_setatr(struct cli_state *cli,
573 struct tevent_req *cli_chkpath_send(TALLOC_CTX *mem_ctx,
574 struct tevent_context *ev,
575 struct cli_state *cli,
577 NTSTATUS cli_chkpath_recv(struct tevent_req *req);
578 NTSTATUS cli_chkpath(struct cli_state *cli, const char *path);
579 struct tevent_req *cli_dskattr_send(TALLOC_CTX *mem_ctx,
580 struct tevent_context *ev,
581 struct cli_state *cli);
582 NTSTATUS cli_dskattr_recv(struct tevent_req *req, int *bsize, int *total,
584 NTSTATUS cli_dskattr(struct cli_state *cli, int *bsize, int *total, int *avail);
585 NTSTATUS cli_disk_size(struct cli_state *cli, const char *path, uint64_t *bsize,
586 uint64_t *total, uint64_t *avail);
587 struct tevent_req *cli_ctemp_send(TALLOC_CTX *mem_ctx,
588 struct tevent_context *ev,
589 struct cli_state *cli,
591 NTSTATUS cli_ctemp_recv(struct tevent_req *req,
595 NTSTATUS cli_ctemp(struct cli_state *cli,
600 NTSTATUS cli_set_ea_path(struct cli_state *cli, const char *path,
601 const char *ea_name, const char *ea_val,
603 NTSTATUS cli_set_ea_fnum(struct cli_state *cli, uint16_t fnum,
604 const char *ea_name, const char *ea_val,
606 struct tevent_req *cli_get_ea_list_path_send(TALLOC_CTX *mem_ctx,
607 struct tevent_context *ev,
608 struct cli_state *cli,
610 NTSTATUS cli_get_ea_list_path_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
611 size_t *pnum_eas, struct ea_struct **peas);
612 NTSTATUS cli_get_ea_list_path(struct cli_state *cli, const char *path,
615 struct ea_struct **pea_list);
616 struct tevent_req *cli_posix_open_send(TALLOC_CTX *mem_ctx,
617 struct tevent_context *ev,
618 struct cli_state *cli,
622 NTSTATUS cli_posix_open_recv(struct tevent_req *req, uint16_t *pfnum);
623 NTSTATUS cli_posix_open(struct cli_state *cli, const char *fname,
624 int flags, mode_t mode, uint16_t *fnum);
625 struct tevent_req *cli_posix_mkdir_send(TALLOC_CTX *mem_ctx,
626 struct tevent_context *ev,
627 struct cli_state *cli,
630 NTSTATUS cli_posix_mkdir_recv(struct tevent_req *req);
631 NTSTATUS cli_posix_mkdir(struct cli_state *cli, const char *fname, mode_t mode);
633 struct tevent_req *cli_posix_unlink_send(TALLOC_CTX *mem_ctx,
634 struct tevent_context *ev,
635 struct cli_state *cli,
637 NTSTATUS cli_posix_unlink_recv(struct tevent_req *req);
638 NTSTATUS cli_posix_unlink(struct cli_state *cli, const char *fname);
640 struct tevent_req *cli_posix_rmdir_send(TALLOC_CTX *mem_ctx,
641 struct tevent_context *ev,
642 struct cli_state *cli,
644 NTSTATUS cli_posix_rmdir_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx);
645 NTSTATUS cli_posix_rmdir(struct cli_state *cli, const char *fname);
646 struct tevent_req *cli_notify_send(TALLOC_CTX *mem_ctx,
647 struct tevent_context *ev,
648 struct cli_state *cli, uint16_t fnum,
649 uint32_t buffer_size,
650 uint32_t completion_filter, bool recursive);
651 NTSTATUS cli_notify_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
652 uint32_t *pnum_changes,
653 struct notify_change **pchanges);
654 NTSTATUS cli_notify(struct cli_state *cli, uint16_t fnum, uint32_t buffer_size,
655 uint32_t completion_filter, bool recursive,
656 TALLOC_CTX *mem_ctx, uint32_t *pnum_changes,
657 struct notify_change **pchanges);
659 struct tevent_req *cli_nttrans_create_send(TALLOC_CTX *mem_ctx,
660 struct tevent_context *ev,
661 struct cli_state *cli,
664 uint32_t DesiredAccess,
665 uint32_t FileAttributes,
666 uint32_t ShareAccess,
667 uint32_t CreateDisposition,
668 uint32_t CreateOptions,
669 uint8_t SecurityFlags,
670 struct security_descriptor *secdesc,
671 struct ea_struct *eas,
673 NTSTATUS cli_nttrans_create_recv(struct tevent_req *req,
675 struct smb_create_returns *cr);
676 NTSTATUS cli_nttrans_create(struct cli_state *cli,
679 uint32_t DesiredAccess,
680 uint32_t FileAttributes,
681 uint32_t ShareAccess,
682 uint32_t CreateDisposition,
683 uint32_t CreateOptions,
684 uint8_t SecurityFlags,
685 struct security_descriptor *secdesc,
686 struct ea_struct *eas,
689 struct smb_create_returns *cr);
691 /* The following definitions come from libsmb/clifsinfo.c */
693 struct tevent_req *cli_unix_extensions_version_send(TALLOC_CTX *mem_ctx,
694 struct tevent_context *ev,
695 struct cli_state *cli);
696 NTSTATUS cli_unix_extensions_version_recv(struct tevent_req *req,
697 uint16_t *pmajor, uint16_t *pminor,
700 NTSTATUS cli_unix_extensions_version(struct cli_state *cli, uint16_t *pmajor,
701 uint16_t *pminor, uint32_t *pcaplow,
703 struct tevent_req *cli_set_unix_extensions_capabilities_send(
704 TALLOC_CTX *mem_ctx, struct tevent_context *ev, struct cli_state *cli,
705 uint16_t major, uint16_t minor, uint32_t caplow, uint32_t caphigh);
706 NTSTATUS cli_set_unix_extensions_capabilities_recv(struct tevent_req *req);
707 NTSTATUS cli_set_unix_extensions_capabilities(struct cli_state *cli,
708 uint16_t major, uint16_t minor,
709 uint32_t caplow, uint32_t caphigh);
710 struct tevent_req *cli_get_fs_attr_info_send(TALLOC_CTX *mem_ctx,
711 struct tevent_context *ev,
712 struct cli_state *cli);
713 NTSTATUS cli_get_fs_attr_info_recv(struct tevent_req *req, uint32_t *fs_attr);
714 NTSTATUS cli_get_fs_attr_info(struct cli_state *cli, uint32_t *fs_attr);
715 NTSTATUS cli_get_fs_volume_info(struct cli_state *cli,
716 TALLOC_CTX *mem_ctx, char **volume_name,
717 uint32_t *pserial_number, time_t *pdate);
718 NTSTATUS cli_get_fs_full_size_info(struct cli_state *cli,
719 uint64_t *total_allocation_units,
720 uint64_t *caller_allocation_units,
721 uint64_t *actual_allocation_units,
722 uint64_t *sectors_per_allocation_unit,
723 uint64_t *bytes_per_sector);
724 NTSTATUS cli_get_posix_fs_info(struct cli_state *cli,
725 uint32_t *optimal_transfer_size,
726 uint32_t *block_size,
727 uint64_t *total_blocks,
728 uint64_t *blocks_available,
729 uint64_t *user_blocks_available,
730 uint64_t *total_file_nodes,
731 uint64_t *free_file_nodes,
732 uint64_t *fs_identifier);
733 struct tevent_req *cli_posix_whoami_send(TALLOC_CTX *mem_ctx,
734 struct tevent_context *ev,
735 struct cli_state *cli);
736 NTSTATUS cli_posix_whoami_recv(struct tevent_req *req,
743 struct dom_sid **psids,
745 NTSTATUS cli_posix_whoami(struct cli_state *cli,
752 struct dom_sid **sids,
755 /* The following definitions come from libsmb/clilist.c */
757 NTSTATUS is_bad_finfo_name(const struct cli_state *cli,
758 const struct file_info *finfo);
760 NTSTATUS cli_list_old(struct cli_state *cli,const char *Mask,uint32_t attribute,
761 NTSTATUS (*fn)(struct file_info *,
762 const char *, void *), void *state);
763 NTSTATUS cli_list_trans(struct cli_state *cli, const char *mask,
764 uint32_t attribute, int info_level,
766 struct file_info *finfo,
770 struct tevent_req *cli_list_send(TALLOC_CTX *mem_ctx,
771 struct tevent_context *ev,
772 struct cli_state *cli,
775 uint16_t info_level);
776 NTSTATUS cli_list_recv(
777 struct tevent_req *req,
779 struct file_info **pfinfo);
780 NTSTATUS cli_list(struct cli_state *cli,
783 NTSTATUS (*fn)(struct file_info *finfo,
788 /* The following definitions come from libsmb/climessage.c */
790 struct tevent_req *cli_message_send(TALLOC_CTX *mem_ctx,
791 struct tevent_context *ev,
792 struct cli_state *cli,
793 const char *host, const char *username,
794 const char *message);
795 NTSTATUS cli_message_recv(struct tevent_req *req);
796 NTSTATUS cli_message(struct cli_state *cli, const char *host,
797 const char *username, const char *message);
799 /* The following definitions come from libsmb/clioplock.c */
801 struct tevent_req *cli_smb_oplock_break_waiter_send(TALLOC_CTX *mem_ctx,
802 struct tevent_context *ev,
803 struct cli_state *cli);
804 NTSTATUS cli_smb_oplock_break_waiter_recv(struct tevent_req *req,
808 struct tevent_req *cli_oplock_ack_send(TALLOC_CTX *mem_ctx,
809 struct tevent_context *ev,
810 struct cli_state *cli,
811 uint16_t fnum, uint8_t level);
812 NTSTATUS cli_oplock_ack_recv(struct tevent_req *req);
814 /* The following definitions come from libsmb/cliprint.c */
816 NTSTATUS cli_print_queue(struct cli_state *cli,
817 void (*fn)(struct print_job_info *));
818 NTSTATUS cli_printjob_del(struct cli_state *cli, int job);
820 /* The following definitions come from libsmb/cliquota.c */
822 NTSTATUS cli_get_quota_handle(struct cli_state *cli, uint16_t *quota_fnum);
823 void free_ntquota_list(SMB_NTQUOTA_LIST **qt_list);
824 bool parse_user_quota_record(const uint8_t *rdata,
825 unsigned int rdata_count,
826 unsigned int *offset,
827 SMB_NTQUOTA_STRUCT *pqt);
828 bool add_record_to_ntquota_list(TALLOC_CTX *mem_ctx,
829 SMB_NTQUOTA_STRUCT *pqt,
830 SMB_NTQUOTA_LIST **pqt_list);
831 NTSTATUS parse_user_quota_list(const uint8_t *curdata,
832 uint32_t curdata_size,
834 SMB_NTQUOTA_LIST **pqt_list);
835 NTSTATUS parse_fs_quota_buffer(const uint8_t *rdata,
836 unsigned int rdata_count,
837 SMB_NTQUOTA_STRUCT *pqt);
838 NTSTATUS build_user_quota_buffer(SMB_NTQUOTA_LIST *qt_list,
842 SMB_NTQUOTA_LIST **end_ptr);
843 NTSTATUS build_fs_quota_buffer(TALLOC_CTX *mem_ctx,
844 const SMB_NTQUOTA_STRUCT *pqt,
847 NTSTATUS cli_get_user_quota(struct cli_state *cli, int quota_fnum,
848 SMB_NTQUOTA_STRUCT *pqt);
849 NTSTATUS cli_set_user_quota(struct cli_state *cli,
851 SMB_NTQUOTA_LIST *qtl);
852 NTSTATUS cli_list_user_quota(struct cli_state *cli, int quota_fnum,
853 SMB_NTQUOTA_LIST **pqt_list);
854 NTSTATUS cli_get_fs_quota_info(struct cli_state *cli, int quota_fnum,
855 SMB_NTQUOTA_STRUCT *pqt);
856 NTSTATUS cli_set_fs_quota_info(struct cli_state *cli, int quota_fnum,
857 SMB_NTQUOTA_STRUCT *pqt);
859 /* The following definitions come from libsmb/clireadwrite.c */
861 struct tevent_req *cli_read_andx_create(TALLOC_CTX *mem_ctx,
862 struct tevent_context *ev,
863 struct cli_state *cli, uint16_t fnum,
864 off_t offset, size_t size,
865 struct tevent_req **psmbreq);
866 struct tevent_req *cli_read_andx_send(TALLOC_CTX *mem_ctx,
867 struct tevent_context *ev,
868 struct cli_state *cli, uint16_t fnum,
869 off_t offset, size_t size);
870 NTSTATUS cli_read_andx_recv(struct tevent_req *req, ssize_t *received,
872 struct tevent_req *cli_pull_send(TALLOC_CTX *mem_ctx,
873 struct tevent_context *ev,
874 struct cli_state *cli,
875 uint16_t fnum, off_t start_offset,
876 off_t size, size_t window_size,
877 NTSTATUS (*sink)(char *buf, size_t n,
880 NTSTATUS cli_pull_recv(struct tevent_req *req, off_t *received);
881 NTSTATUS cli_pull(struct cli_state *cli, uint16_t fnum,
882 off_t start_offset, off_t size, size_t window_size,
883 NTSTATUS (*sink)(char *buf, size_t n, void *priv),
884 void *priv, off_t *received);
885 NTSTATUS cli_read_sink(char *buf, size_t n, void *priv);
886 struct tevent_req *cli_read_send(
888 struct tevent_context *ev,
889 struct cli_state *cli,
894 NTSTATUS cli_read_recv(struct tevent_req *req, size_t *received);
895 NTSTATUS cli_read(struct cli_state *cli, uint16_t fnum,
896 char *buf, off_t offset, size_t size,
898 NTSTATUS cli_smbwrite(struct cli_state *cli, uint16_t fnum, char *buf,
899 off_t offset, size_t size1, size_t *ptotal);
900 struct tevent_req *cli_write_andx_create(TALLOC_CTX *mem_ctx,
901 struct tevent_context *ev,
902 struct cli_state *cli, uint16_t fnum,
903 uint16_t mode, const uint8_t *buf,
904 off_t offset, size_t size,
905 struct tevent_req **reqs_before,
907 struct tevent_req **psmbreq);
908 struct tevent_req *cli_write_andx_send(TALLOC_CTX *mem_ctx,
909 struct tevent_context *ev,
910 struct cli_state *cli, uint16_t fnum,
911 uint16_t mode, const uint8_t *buf,
912 off_t offset, size_t size);
913 NTSTATUS cli_write_andx_recv(struct tevent_req *req, size_t *pwritten);
915 struct tevent_req *cli_write_send(TALLOC_CTX *mem_ctx,
916 struct tevent_context *ev,
917 struct cli_state *cli, uint16_t fnum,
918 uint16_t mode, const uint8_t *buf,
919 off_t offset, size_t size);
920 NTSTATUS cli_write_recv(struct tevent_req *req, size_t *pwritten);
922 struct tevent_req *cli_writeall_send(
924 struct tevent_context *ev,
925 struct cli_state *cli,
931 NTSTATUS cli_writeall_recv(struct tevent_req *req, size_t *pwritten);
932 NTSTATUS cli_writeall(struct cli_state *cli, uint16_t fnum, uint16_t mode,
933 const uint8_t *buf, off_t offset, size_t size,
936 struct tevent_req *cli_push_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
937 struct cli_state *cli,
938 uint16_t fnum, uint16_t mode,
939 off_t start_offset, size_t window_size,
940 size_t (*source)(uint8_t *buf, size_t n,
943 NTSTATUS cli_push_recv(struct tevent_req *req);
944 NTSTATUS cli_push(struct cli_state *cli, uint16_t fnum, uint16_t mode,
945 off_t start_offset, size_t window_size,
946 size_t (*source)(uint8_t *buf, size_t n, void *priv),
949 NTSTATUS cli_splice(struct cli_state *srccli, struct cli_state *dstcli,
950 uint16_t src_fnum, uint16_t dst_fnum,
952 off_t src_offset, off_t dst_offset,
954 int (*splice_cb)(off_t n, void *priv), void *priv);
956 /* The following definitions come from libsmb/clisecdesc.c */
958 struct tevent_req *cli_query_security_descriptor_send(
960 struct tevent_context *ev,
961 struct cli_state *cli,
964 NTSTATUS cli_query_security_descriptor_recv(
965 struct tevent_req *req,
967 struct security_descriptor **sd);
968 NTSTATUS cli_query_security_descriptor(struct cli_state *cli,
972 struct security_descriptor **sd);
973 NTSTATUS cli_query_secdesc(struct cli_state *cli, uint16_t fnum,
974 TALLOC_CTX *mem_ctx, struct security_descriptor **sd);
975 struct tevent_req *cli_set_security_descriptor_send(
977 struct tevent_context *ev,
978 struct cli_state *cli,
981 const struct security_descriptor *sd);
982 NTSTATUS cli_set_security_descriptor_recv(struct tevent_req *req);
983 NTSTATUS cli_set_security_descriptor(struct cli_state *cli,
986 const struct security_descriptor *sd);
987 NTSTATUS cli_set_secdesc(struct cli_state *cli, uint16_t fnum,
988 const struct security_descriptor *sd);
990 NTSTATUS cli_query_mxac(struct cli_state *cli,
991 const char *filename,
994 /* The following definitions come from libsmb/clitrans.c */
996 struct tevent_req *cli_trans_send(
997 TALLOC_CTX *mem_ctx, struct tevent_context *ev,
998 struct cli_state *cli, uint16_t additional_flags2, uint8_t cmd,
999 const char *pipe_name, uint16_t fid, uint16_t function, int flags,
1000 uint16_t *setup, uint8_t num_setup, uint8_t max_setup,
1001 uint8_t *param, uint32_t num_param, uint32_t max_param,
1002 uint8_t *data, uint32_t num_data, uint32_t max_data);
1003 NTSTATUS cli_trans_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
1004 uint16_t *recv_flags2,
1005 uint16_t **setup, uint8_t min_setup,
1007 uint8_t **param, uint32_t min_param,
1008 uint32_t *num_param,
1009 uint8_t **data, uint32_t min_data,
1010 uint32_t *num_data);
1011 NTSTATUS cli_trans(TALLOC_CTX *mem_ctx, struct cli_state *cli,
1013 const char *pipe_name, uint16_t fid, uint16_t function,
1015 uint16_t *setup, uint8_t num_setup, uint8_t max_setup,
1016 uint8_t *param, uint32_t num_param, uint32_t max_param,
1017 uint8_t *data, uint32_t num_data, uint32_t max_data,
1018 uint16_t *recv_flags2,
1019 uint16_t **rsetup, uint8_t min_rsetup, uint8_t *num_rsetup,
1020 uint8_t **rparam, uint32_t min_rparam, uint32_t *num_rparam,
1021 uint8_t **rdata, uint32_t min_rdata, uint32_t *num_rdata);
1023 /* The following definitions come from libsmb/clisymlink.c */
1025 struct tevent_req *cli_create_reparse_point_send(TALLOC_CTX *mem_ctx,
1026 struct tevent_context *ev,
1027 struct cli_state *cli,
1029 DATA_BLOB reparse_blob);
1030 NTSTATUS cli_create_reparse_point_recv(struct tevent_req *req);
1032 struct tevent_req *cli_symlink_send(TALLOC_CTX *mem_ctx,
1033 struct tevent_context *ev,
1034 struct cli_state *cli,
1035 const char *oldpath,
1036 const char *newpath,
1038 NTSTATUS cli_symlink_recv(struct tevent_req *req);
1039 NTSTATUS cli_symlink(struct cli_state *cli, const char *oldname,
1040 const char *newname, uint32_t flags);
1042 struct tevent_req *cli_get_reparse_data_send(TALLOC_CTX *mem_ctx,
1043 struct tevent_context *ev,
1044 struct cli_state *cli,
1046 NTSTATUS cli_get_reparse_data_recv(struct tevent_req *req,
1047 TALLOC_CTX *mem_ctx,
1049 uint32_t *_datalen);
1050 NTSTATUS cli_get_reparse_data(struct cli_state *cli,
1052 TALLOC_CTX *mem_ctx,
1054 uint32_t *_datalen);
1056 struct tevent_req *cli_readlink_send(TALLOC_CTX *mem_ctx,
1057 struct tevent_context *ev,
1058 struct cli_state *cli,
1060 NTSTATUS cli_readlink_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
1061 char **psubstitute_name, char **pprint_name,
1063 NTSTATUS cli_readlink(struct cli_state *cli, const char *fname,
1064 TALLOC_CTX *mem_ctx, char **psubstitute_name,
1065 char **pprint_name, uint32_t *pflags);
1067 NTSTATUS fill_quota_buffer(TALLOC_CTX *mem_ctx,
1068 SMB_NTQUOTA_LIST *tmp_list,
1072 SMB_NTQUOTA_LIST **end_ptr);
1073 /* The following definitions come from libsmb/passchange.c */
1075 NTSTATUS remote_password_change(const char *remote_machine,
1076 const char *domain, const char *user_name,
1077 const char *old_passwd, const char *new_passwd,
1080 #endif /* _LIBSMB_PROTO_H_ */