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,
113 struct cli_state **output_cli);
114 NTSTATUS cli_full_connection_creds(struct cli_state **output_cli,
116 const char *dest_host,
117 const struct sockaddr_storage *dest_ss, int port,
118 const char *service, const char *service_type,
119 struct cli_credentials *creds,
121 NTSTATUS cli_raw_tcon(struct cli_state *cli,
122 const char *service, const char *pass, const char *dev,
123 uint16_t *max_xmit, uint16_t *tid);
124 struct cli_state *get_ipc_connect(char *server,
125 struct sockaddr_storage *server_ss,
126 struct cli_credentials *creds);
127 struct cli_state *get_ipc_connect_master_ip(TALLOC_CTX *ctx,
128 struct sockaddr_storage *mb_ip,
129 struct cli_credentials *creds,
130 char **pp_workgroup_out);
132 /* The following definitions come from libsmb/clidfs.c */
134 NTSTATUS cli_cm_open(TALLOC_CTX *ctx,
135 struct cli_state *referring_cli,
138 struct cli_credentials *creds,
139 const struct sockaddr_storage *dest_ss,
142 struct cli_state **pcli);
143 void cli_cm_display(struct cli_state *c);
144 struct client_dfs_referral;
145 bool cli_dfs_is_already_full_path(struct cli_state *cli, const char *path);
146 NTSTATUS cli_dfs_get_referral_ex(TALLOC_CTX *ctx,
147 struct cli_state *cli,
149 uint16_t max_referral_level,
150 struct client_dfs_referral **refs,
153 NTSTATUS cli_dfs_get_referral(TALLOC_CTX *ctx,
154 struct cli_state *cli,
156 struct client_dfs_referral **refs,
159 NTSTATUS cli_resolve_path(TALLOC_CTX *ctx,
161 struct cli_credentials *creds,
162 struct cli_state *rootcli,
164 struct cli_state **targetcli,
165 char **pp_targetpath);
167 bool cli_check_msdfs_proxy(TALLOC_CTX *ctx,
168 struct cli_state *cli,
169 const char *sharename,
172 struct cli_credentials *creds);
174 NTSTATUS cli_dfs_target_check(TALLOC_CTX *mem_ctx,
175 struct cli_state *cli,
176 const char *fname_dst,
177 const char **fname_dst_out);
178 char *smb1_dfs_share_path(TALLOC_CTX *ctx,
179 struct cli_state *cli,
182 /* The following definitions come from libsmb/clientgen.c */
184 unsigned int cli_set_timeout(struct cli_state *cli, unsigned int timeout);
185 bool cli_set_backup_intent(struct cli_state *cli, bool flag);
186 extern struct GUID cli_state_client_guid;
187 struct cli_state *cli_state_create(TALLOC_CTX *mem_ctx,
189 const char *remote_name,
190 enum smb_signing_setting signing_state,
192 void cli_shutdown(struct cli_state *cli);
193 uint16_t cli_state_get_vc_num(struct cli_state *cli);
194 uint32_t cli_setpid(struct cli_state *cli, uint32_t pid);
195 uint32_t cli_getpid(struct cli_state *cli);
196 bool cli_state_is_encryption_on(struct cli_state *cli);
197 bool cli_state_has_tcon(struct cli_state *cli);
198 uint32_t cli_state_get_tid(struct cli_state *cli);
199 uint32_t cli_state_set_tid(struct cli_state *cli, uint32_t tid);
201 void cli_state_save_tcon_share(struct cli_state *cli,
202 struct smbXcli_tcon **_tcon_ret,
204 void cli_state_restore_tcon_share(struct cli_state *cli,
205 struct smbXcli_tcon *tcon,
207 uint16_t cli_state_get_uid(struct cli_state *cli);
208 uint16_t cli_state_set_uid(struct cli_state *cli, uint16_t uid);
209 bool cli_set_case_sensitive(struct cli_state *cli, bool case_sensitive);
210 uint32_t cli_state_available_size(struct cli_state *cli, uint32_t ofs);
211 time_t cli_state_server_time(struct cli_state *cli);
212 struct tevent_req *cli_echo_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
213 struct cli_state *cli, uint16_t num_echos,
215 NTSTATUS cli_echo_recv(struct tevent_req *req);
216 NTSTATUS cli_echo(struct cli_state *cli, uint16_t num_echos, DATA_BLOB data);
217 NTSTATUS cli_smb(TALLOC_CTX *mem_ctx, struct cli_state *cli,
218 uint8_t smb_command, uint8_t additional_flags,
219 uint8_t wct, uint16_t *vwv,
220 uint32_t num_bytes, const uint8_t *bytes,
221 struct tevent_req **result_parent,
222 uint8_t min_wct, uint8_t *pwct, uint16_t **pvwv,
223 uint32_t *pnum_bytes, uint8_t **pbytes);
225 /* The following definitions come from libsmb/clierror.c */
227 NTSTATUS cli_nt_error(struct cli_state *cli);
228 int cli_status_to_errno(NTSTATUS status);
229 int cli_errno(struct cli_state *cli);
230 bool cli_is_error(struct cli_state *cli);
231 bool cli_state_is_connected(struct cli_state *cli);
233 /* The following definitions come from libsmb/clifile.c */
235 struct tevent_req *cli_setpathinfo_send(TALLOC_CTX *mem_ctx,
236 struct tevent_context *ev,
237 struct cli_state *cli,
242 NTSTATUS cli_setpathinfo_recv(struct tevent_req *req);
243 NTSTATUS cli_setpathinfo(struct cli_state *cli,
248 struct tevent_req *cli_setfileinfo_send(
250 struct tevent_context *ev,
251 struct cli_state *cli,
256 NTSTATUS cli_setfileinfo_recv(struct tevent_req *req);
258 struct tevent_req *cli_posix_symlink_send(TALLOC_CTX *mem_ctx,
259 struct tevent_context *ev,
260 struct cli_state *cli,
262 const char *newname);
263 NTSTATUS cli_posix_symlink_recv(struct tevent_req *req);
264 NTSTATUS cli_posix_symlink(struct cli_state *cli,
266 const char *newname);
267 struct tevent_req *cli_posix_readlink_send(TALLOC_CTX *mem_ctx,
268 struct tevent_context *ev,
269 struct cli_state *cli,
271 NTSTATUS cli_posix_readlink_recv(
272 struct tevent_req *req, TALLOC_CTX *mem_ctx, char **target);
273 struct tevent_req *cli_posix_hardlink_send(TALLOC_CTX *mem_ctx,
274 struct tevent_context *ev,
275 struct cli_state *cli,
277 const char *newname);
278 NTSTATUS cli_posix_hardlink_recv(struct tevent_req *req);
279 NTSTATUS cli_posix_hardlink(struct cli_state *cli,
281 const char *newname);
282 uint32_t unix_perms_to_wire(mode_t perms);
283 mode_t wire_perms_to_unix(uint32_t perms);
284 struct tevent_req *cli_posix_getacl_send(TALLOC_CTX *mem_ctx,
285 struct tevent_context *ev,
286 struct cli_state *cli,
288 NTSTATUS cli_posix_getacl_recv(struct tevent_req *req,
292 NTSTATUS cli_posix_getacl(struct cli_state *cli,
297 struct tevent_req *cli_posix_setacl_send(TALLOC_CTX *mem_ctx,
298 struct tevent_context *ev,
299 struct cli_state *cli,
302 size_t acl_buf_size);
303 NTSTATUS cli_posix_setacl_recv(struct tevent_req *req);
304 NTSTATUS cli_posix_setacl(struct cli_state *cli,
307 size_t acl_buf_size);
308 struct tevent_req *cli_posix_stat_send(TALLOC_CTX *mem_ctx,
309 struct tevent_context *ev,
310 struct cli_state *cli,
312 NTSTATUS cli_posix_stat_recv(struct tevent_req *req, struct stat_ex *sbuf);
313 NTSTATUS cli_posix_stat(struct cli_state *cli,
315 struct stat_ex *sbuf);
316 struct tevent_req *cli_posix_chmod_send(TALLOC_CTX *mem_ctx,
317 struct tevent_context *ev,
318 struct cli_state *cli,
321 NTSTATUS cli_posix_chmod_recv(struct tevent_req *req);
322 NTSTATUS cli_posix_chmod(struct cli_state *cli, const char *fname, mode_t mode);
323 struct tevent_req *cli_posix_chown_send(TALLOC_CTX *mem_ctx,
324 struct tevent_context *ev,
325 struct cli_state *cli,
329 NTSTATUS cli_posix_chown_recv(struct tevent_req *req);
330 NTSTATUS cli_posix_chown(struct cli_state *cli,
334 struct tevent_req *cli_mknod_send(
336 struct tevent_context *ev,
337 struct cli_state *cli,
341 NTSTATUS cli_mknod_recv(struct tevent_req *req);
343 cli_mknod(struct cli_state *cli, const char *fname, mode_t mode, dev_t dev);
344 struct tevent_req *cli_rename_send(TALLOC_CTX *mem_ctx,
345 struct tevent_context *ev,
346 struct cli_state *cli,
347 const char *fname_src,
348 const char *fname_dst,
350 NTSTATUS cli_rename_recv(struct tevent_req *req);
351 NTSTATUS cli_rename(struct cli_state *cli,
352 const char *fname_src,
353 const char *fname_dst,
355 struct tevent_req *cli_ntrename_send(TALLOC_CTX *mem_ctx,
356 struct tevent_context *ev,
357 struct cli_state *cli,
358 const char *fname_src,
359 const char *fname_dst);
360 NTSTATUS cli_ntrename_recv(struct tevent_req *req);
361 NTSTATUS cli_ntrename(struct cli_state *cli, const char *fname_src, const char *fname_dst);
363 struct tevent_req *cli_hardlink_send(
365 struct tevent_context *ev,
366 struct cli_state *cli,
367 const char *fname_src,
368 const char *fname_dst);
369 NTSTATUS cli_hardlink_recv(struct tevent_req *req);
370 NTSTATUS cli_hardlink(
371 struct cli_state *cli,
372 const char *fname_src,
373 const char *fname_dst);
375 struct tevent_req *cli_unlink_send(TALLOC_CTX *mem_ctx,
376 struct tevent_context *ev,
377 struct cli_state *cli,
379 uint32_t mayhave_attrs);
380 NTSTATUS cli_unlink_recv(struct tevent_req *req);
381 NTSTATUS cli_unlink(struct cli_state *cli, const char *fname, uint32_t mayhave_attrs);
383 struct tevent_req *cli_mkdir_send(TALLOC_CTX *mem_ctx,
384 struct tevent_context *ev,
385 struct cli_state *cli,
387 NTSTATUS cli_mkdir_recv(struct tevent_req *req);
388 NTSTATUS cli_mkdir(struct cli_state *cli, const char *dname);
389 struct tevent_req *cli_rmdir_send(TALLOC_CTX *mem_ctx,
390 struct tevent_context *ev,
391 struct cli_state *cli,
393 NTSTATUS cli_rmdir_recv(struct tevent_req *req);
394 NTSTATUS cli_rmdir(struct cli_state *cli, const char *dname);
395 struct tevent_req *cli_nt_delete_on_close_send(TALLOC_CTX *mem_ctx,
396 struct tevent_context *ev,
397 struct cli_state *cli,
400 NTSTATUS cli_nt_delete_on_close_recv(struct tevent_req *req);
401 NTSTATUS cli_nt_delete_on_close(struct cli_state *cli, uint16_t fnum, bool flag);
402 struct tevent_req *cli_ntcreate_send(TALLOC_CTX *mem_ctx,
403 struct tevent_context *ev,
404 struct cli_state *cli,
407 uint32_t DesiredAccess,
408 uint32_t FileAttributes,
409 uint32_t ShareAccess,
410 uint32_t CreateDisposition,
411 uint32_t CreateOptions,
412 uint32_t ImpersonationLevel,
413 uint8_t SecurityFlags);
414 NTSTATUS cli_ntcreate_recv(struct tevent_req *req,
416 struct smb_create_returns *cr);
417 NTSTATUS cli_ntcreate(struct cli_state *cli,
420 uint32_t DesiredAccess,
421 uint32_t FileAttributes,
422 uint32_t ShareAccess,
423 uint32_t CreateDisposition,
424 uint32_t CreateOptions,
425 uint8_t SecurityFlags,
427 struct smb_create_returns *cr);
428 struct tevent_req *cli_openx_create(TALLOC_CTX *mem_ctx,
429 struct tevent_context *ev,
430 struct cli_state *cli, const char *fname,
431 int flags, int share_mode,
432 struct tevent_req **psmbreq);
433 struct tevent_req *cli_openx_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
434 struct cli_state *cli, const char *fname,
435 int flags, int share_mode);
436 NTSTATUS cli_openx_recv(struct tevent_req *req, uint16_t *fnum);
437 NTSTATUS cli_openx(struct cli_state *cli, const char *fname, int flags, int share_mode, uint16_t *pfnum);
438 NTSTATUS cli_open(struct cli_state *cli, const char *fname, int flags, int share_mode, uint16_t *pfnum);
439 struct tevent_req *cli_smb1_close_create(TALLOC_CTX *mem_ctx,
440 struct tevent_context *ev,
441 struct cli_state *cli, uint16_t fnum,
442 struct tevent_req **psubreq);
443 struct tevent_req *cli_close_send(TALLOC_CTX *mem_ctx,
444 struct tevent_context *ev,
445 struct cli_state *cli,
448 NTSTATUS cli_close_recv(struct tevent_req *req);
449 NTSTATUS cli_close(struct cli_state *cli, uint16_t fnum);
450 struct tevent_req *cli_ftruncate_send(TALLOC_CTX *mem_ctx,
451 struct tevent_context *ev,
452 struct cli_state *cli,
455 NTSTATUS cli_ftruncate_recv(struct tevent_req *req);
456 NTSTATUS cli_ftruncate(struct cli_state *cli, uint16_t fnum, uint64_t size);
457 NTSTATUS cli_locktype(struct cli_state *cli, uint16_t fnum,
458 uint32_t offset, uint32_t len,
459 int timeout, unsigned char locktype);
460 struct smb1_lock_element {
466 struct tevent_req *cli_lockingx_create(
468 struct tevent_context *ev,
469 struct cli_state *cli,
472 uint8_t newoplocklevel,
474 uint16_t num_unlocks,
475 const struct smb1_lock_element *unlocks,
477 const struct smb1_lock_element *locks,
478 struct tevent_req **psmbreq);
479 struct tevent_req *cli_lockingx_send(
481 struct tevent_context *ev,
482 struct cli_state *cli,
485 uint8_t newoplocklevel,
487 uint16_t num_unlocks,
488 const struct smb1_lock_element *unlocks,
490 const struct smb1_lock_element *locks);
491 NTSTATUS cli_lockingx_recv(struct tevent_req *req);
492 NTSTATUS cli_lockingx(
493 struct cli_state *cli,
496 uint8_t newoplocklevel,
498 uint16_t num_unlocks,
499 const struct smb1_lock_element *unlocks,
501 const struct smb1_lock_element *locks);
503 NTSTATUS cli_lock32(struct cli_state *cli, uint16_t fnum, uint32_t offset,
504 uint32_t len, int timeout, enum brl_type lock_type);
505 struct tevent_req *cli_unlock_send(TALLOC_CTX *mem_ctx,
506 struct tevent_context *ev,
507 struct cli_state *cli,
511 NTSTATUS cli_unlock_recv(struct tevent_req *req);
512 NTSTATUS cli_unlock(struct cli_state *cli, uint16_t fnum, uint32_t offset, uint32_t len);
513 struct tevent_req *cli_posix_lock_send(TALLOC_CTX *mem_ctx,
514 struct tevent_context *ev,
515 struct cli_state *cli,
520 enum brl_type lock_type);
521 NTSTATUS cli_posix_lock_recv(struct tevent_req *req);
522 NTSTATUS cli_posix_lock(struct cli_state *cli, uint16_t fnum,
523 uint64_t offset, uint64_t len,
524 bool wait_lock, enum brl_type lock_type);
525 struct tevent_req *cli_posix_unlock_send(TALLOC_CTX *mem_ctx,
526 struct tevent_context *ev,
527 struct cli_state *cli,
531 NTSTATUS cli_posix_unlock_recv(struct tevent_req *req);
532 NTSTATUS cli_posix_unlock(struct cli_state *cli, uint16_t fnum, uint64_t offset, uint64_t len);
533 struct tevent_req *cli_getattrE_send(TALLOC_CTX *mem_ctx,
534 struct tevent_context *ev,
535 struct cli_state *cli,
537 NTSTATUS cli_getattrE_recv(struct tevent_req *req,
543 struct tevent_req *cli_setattrE_send(TALLOC_CTX *mem_ctx,
544 struct tevent_context *ev,
545 struct cli_state *cli,
550 NTSTATUS cli_setattrE_recv(struct tevent_req *req);
551 NTSTATUS cli_setattrE(struct cli_state *cli,
556 struct tevent_req *cli_getatr_send(TALLOC_CTX *mem_ctx,
557 struct tevent_context *ev,
558 struct cli_state *cli,
560 NTSTATUS cli_getatr_recv(struct tevent_req *req,
564 NTSTATUS cli_getatr(struct cli_state *cli,
569 struct tevent_req *cli_setatr_send(TALLOC_CTX *mem_ctx,
570 struct tevent_context *ev,
571 struct cli_state *cli,
575 NTSTATUS cli_setatr_recv(struct tevent_req *req);
576 NTSTATUS cli_setatr(struct cli_state *cli,
580 struct tevent_req *cli_chkpath_send(TALLOC_CTX *mem_ctx,
581 struct tevent_context *ev,
582 struct cli_state *cli,
584 NTSTATUS cli_chkpath_recv(struct tevent_req *req);
585 NTSTATUS cli_chkpath(struct cli_state *cli, const char *path);
586 struct tevent_req *cli_dskattr_send(TALLOC_CTX *mem_ctx,
587 struct tevent_context *ev,
588 struct cli_state *cli);
589 NTSTATUS cli_dskattr_recv(struct tevent_req *req, int *bsize, int *total,
591 NTSTATUS cli_dskattr(struct cli_state *cli, int *bsize, int *total, int *avail);
592 NTSTATUS cli_disk_size(struct cli_state *cli, const char *path, uint64_t *bsize,
593 uint64_t *total, uint64_t *avail);
594 struct tevent_req *cli_ctemp_send(TALLOC_CTX *mem_ctx,
595 struct tevent_context *ev,
596 struct cli_state *cli,
598 NTSTATUS cli_ctemp_recv(struct tevent_req *req,
602 NTSTATUS cli_ctemp(struct cli_state *cli,
607 NTSTATUS cli_set_ea_path(struct cli_state *cli, const char *path,
608 const char *ea_name, const char *ea_val,
610 NTSTATUS cli_set_ea_fnum(struct cli_state *cli, uint16_t fnum,
611 const char *ea_name, const char *ea_val,
613 struct tevent_req *cli_get_ea_list_path_send(TALLOC_CTX *mem_ctx,
614 struct tevent_context *ev,
615 struct cli_state *cli,
617 NTSTATUS cli_get_ea_list_path_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
618 size_t *pnum_eas, struct ea_struct **peas);
619 NTSTATUS cli_get_ea_list_path(struct cli_state *cli, const char *path,
622 struct ea_struct **pea_list);
623 struct tevent_req *cli_posix_open_send(TALLOC_CTX *mem_ctx,
624 struct tevent_context *ev,
625 struct cli_state *cli,
629 NTSTATUS cli_posix_open_recv(struct tevent_req *req, uint16_t *pfnum);
630 NTSTATUS cli_posix_open(struct cli_state *cli, const char *fname,
631 int flags, mode_t mode, uint16_t *fnum);
632 struct tevent_req *cli_posix_mkdir_send(TALLOC_CTX *mem_ctx,
633 struct tevent_context *ev,
634 struct cli_state *cli,
637 NTSTATUS cli_posix_mkdir_recv(struct tevent_req *req);
638 NTSTATUS cli_posix_mkdir(struct cli_state *cli, const char *fname, mode_t mode);
640 struct tevent_req *cli_posix_unlink_send(TALLOC_CTX *mem_ctx,
641 struct tevent_context *ev,
642 struct cli_state *cli,
644 NTSTATUS cli_posix_unlink_recv(struct tevent_req *req);
645 NTSTATUS cli_posix_unlink(struct cli_state *cli, const char *fname);
647 struct tevent_req *cli_posix_rmdir_send(TALLOC_CTX *mem_ctx,
648 struct tevent_context *ev,
649 struct cli_state *cli,
651 NTSTATUS cli_posix_rmdir_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx);
652 NTSTATUS cli_posix_rmdir(struct cli_state *cli, const char *fname);
653 struct tevent_req *cli_notify_send(TALLOC_CTX *mem_ctx,
654 struct tevent_context *ev,
655 struct cli_state *cli, uint16_t fnum,
656 uint32_t buffer_size,
657 uint32_t completion_filter, bool recursive);
658 NTSTATUS cli_notify_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
659 uint32_t *pnum_changes,
660 struct notify_change **pchanges);
661 NTSTATUS cli_notify(struct cli_state *cli, uint16_t fnum, uint32_t buffer_size,
662 uint32_t completion_filter, bool recursive,
663 TALLOC_CTX *mem_ctx, uint32_t *pnum_changes,
664 struct notify_change **pchanges);
666 struct tevent_req *cli_nttrans_create_send(TALLOC_CTX *mem_ctx,
667 struct tevent_context *ev,
668 struct cli_state *cli,
671 uint32_t DesiredAccess,
672 uint32_t FileAttributes,
673 uint32_t ShareAccess,
674 uint32_t CreateDisposition,
675 uint32_t CreateOptions,
676 uint8_t SecurityFlags,
677 struct security_descriptor *secdesc,
678 struct ea_struct *eas,
680 NTSTATUS cli_nttrans_create_recv(struct tevent_req *req,
682 struct smb_create_returns *cr);
683 NTSTATUS cli_nttrans_create(struct cli_state *cli,
686 uint32_t DesiredAccess,
687 uint32_t FileAttributes,
688 uint32_t ShareAccess,
689 uint32_t CreateDisposition,
690 uint32_t CreateOptions,
691 uint8_t SecurityFlags,
692 struct security_descriptor *secdesc,
693 struct ea_struct *eas,
696 struct smb_create_returns *cr);
698 /* The following definitions come from libsmb/clifsinfo.c */
700 struct tevent_req *cli_unix_extensions_version_send(TALLOC_CTX *mem_ctx,
701 struct tevent_context *ev,
702 struct cli_state *cli);
703 NTSTATUS cli_unix_extensions_version_recv(struct tevent_req *req,
704 uint16_t *pmajor, uint16_t *pminor,
707 NTSTATUS cli_unix_extensions_version(struct cli_state *cli, uint16_t *pmajor,
708 uint16_t *pminor, uint32_t *pcaplow,
710 struct tevent_req *cli_set_unix_extensions_capabilities_send(
711 TALLOC_CTX *mem_ctx, struct tevent_context *ev, struct cli_state *cli,
712 uint16_t major, uint16_t minor, uint32_t caplow, uint32_t caphigh);
713 NTSTATUS cli_set_unix_extensions_capabilities_recv(struct tevent_req *req);
714 NTSTATUS cli_set_unix_extensions_capabilities(struct cli_state *cli,
715 uint16_t major, uint16_t minor,
716 uint32_t caplow, uint32_t caphigh);
717 struct tevent_req *cli_get_fs_attr_info_send(TALLOC_CTX *mem_ctx,
718 struct tevent_context *ev,
719 struct cli_state *cli);
720 NTSTATUS cli_get_fs_attr_info_recv(struct tevent_req *req, uint32_t *fs_attr);
721 NTSTATUS cli_get_fs_attr_info(struct cli_state *cli, uint32_t *fs_attr);
722 NTSTATUS cli_get_fs_volume_info(struct cli_state *cli,
723 TALLOC_CTX *mem_ctx, char **volume_name,
724 uint32_t *pserial_number, time_t *pdate);
725 NTSTATUS cli_get_fs_full_size_info(struct cli_state *cli,
726 uint64_t *total_allocation_units,
727 uint64_t *caller_allocation_units,
728 uint64_t *actual_allocation_units,
729 uint64_t *sectors_per_allocation_unit,
730 uint64_t *bytes_per_sector);
731 NTSTATUS cli_get_posix_fs_info(struct cli_state *cli,
732 uint32_t *optimal_transfer_size,
733 uint32_t *block_size,
734 uint64_t *total_blocks,
735 uint64_t *blocks_available,
736 uint64_t *user_blocks_available,
737 uint64_t *total_file_nodes,
738 uint64_t *free_file_nodes,
739 uint64_t *fs_identifier);
740 struct tevent_req *cli_posix_whoami_send(TALLOC_CTX *mem_ctx,
741 struct tevent_context *ev,
742 struct cli_state *cli);
743 NTSTATUS cli_posix_whoami_recv(struct tevent_req *req,
750 struct dom_sid **psids,
752 NTSTATUS cli_posix_whoami(struct cli_state *cli,
759 struct dom_sid **sids,
762 /* The following definitions come from libsmb/clilist.c */
764 NTSTATUS is_bad_finfo_name(const struct cli_state *cli,
765 const struct file_info *finfo);
767 NTSTATUS cli_list_old(struct cli_state *cli,const char *Mask,uint32_t attribute,
768 NTSTATUS (*fn)(struct file_info *,
769 const char *, void *), void *state);
770 NTSTATUS cli_list_trans(struct cli_state *cli, const char *mask,
771 uint32_t attribute, int info_level,
773 struct file_info *finfo,
777 struct tevent_req *cli_list_send(TALLOC_CTX *mem_ctx,
778 struct tevent_context *ev,
779 struct cli_state *cli,
782 uint16_t info_level);
783 NTSTATUS cli_list_recv(
784 struct tevent_req *req,
786 struct file_info **pfinfo);
787 NTSTATUS cli_list(struct cli_state *cli,
790 NTSTATUS (*fn)(struct file_info *finfo,
795 /* The following definitions come from libsmb/climessage.c */
797 struct tevent_req *cli_message_send(TALLOC_CTX *mem_ctx,
798 struct tevent_context *ev,
799 struct cli_state *cli,
800 const char *host, const char *username,
801 const char *message);
802 NTSTATUS cli_message_recv(struct tevent_req *req);
803 NTSTATUS cli_message(struct cli_state *cli, const char *host,
804 const char *username, const char *message);
806 /* The following definitions come from libsmb/clioplock.c */
808 struct tevent_req *cli_smb_oplock_break_waiter_send(TALLOC_CTX *mem_ctx,
809 struct tevent_context *ev,
810 struct cli_state *cli);
811 NTSTATUS cli_smb_oplock_break_waiter_recv(struct tevent_req *req,
815 struct tevent_req *cli_oplock_ack_send(TALLOC_CTX *mem_ctx,
816 struct tevent_context *ev,
817 struct cli_state *cli,
818 uint16_t fnum, uint8_t level);
819 NTSTATUS cli_oplock_ack_recv(struct tevent_req *req);
821 /* The following definitions come from libsmb/cliprint.c */
823 NTSTATUS cli_print_queue(struct cli_state *cli,
824 void (*fn)(struct print_job_info *));
825 NTSTATUS cli_printjob_del(struct cli_state *cli, int job);
827 /* The following definitions come from libsmb/cliquota.c */
829 NTSTATUS cli_get_quota_handle(struct cli_state *cli, uint16_t *quota_fnum);
830 void free_ntquota_list(SMB_NTQUOTA_LIST **qt_list);
831 bool parse_user_quota_record(const uint8_t *rdata,
832 unsigned int rdata_count,
833 unsigned int *offset,
834 SMB_NTQUOTA_STRUCT *pqt);
835 bool add_record_to_ntquota_list(TALLOC_CTX *mem_ctx,
836 SMB_NTQUOTA_STRUCT *pqt,
837 SMB_NTQUOTA_LIST **pqt_list);
838 NTSTATUS parse_user_quota_list(const uint8_t *curdata,
839 uint32_t curdata_size,
841 SMB_NTQUOTA_LIST **pqt_list);
842 NTSTATUS parse_fs_quota_buffer(const uint8_t *rdata,
843 unsigned int rdata_count,
844 SMB_NTQUOTA_STRUCT *pqt);
845 NTSTATUS build_user_quota_buffer(SMB_NTQUOTA_LIST *qt_list,
849 SMB_NTQUOTA_LIST **end_ptr);
850 NTSTATUS build_fs_quota_buffer(TALLOC_CTX *mem_ctx,
851 const SMB_NTQUOTA_STRUCT *pqt,
854 NTSTATUS cli_get_user_quota(struct cli_state *cli, int quota_fnum,
855 SMB_NTQUOTA_STRUCT *pqt);
856 NTSTATUS cli_set_user_quota(struct cli_state *cli,
858 SMB_NTQUOTA_LIST *qtl);
859 NTSTATUS cli_list_user_quota(struct cli_state *cli, int quota_fnum,
860 SMB_NTQUOTA_LIST **pqt_list);
861 NTSTATUS cli_get_fs_quota_info(struct cli_state *cli, int quota_fnum,
862 SMB_NTQUOTA_STRUCT *pqt);
863 NTSTATUS cli_set_fs_quota_info(struct cli_state *cli, int quota_fnum,
864 SMB_NTQUOTA_STRUCT *pqt);
866 /* The following definitions come from libsmb/clireadwrite.c */
868 struct tevent_req *cli_read_andx_create(TALLOC_CTX *mem_ctx,
869 struct tevent_context *ev,
870 struct cli_state *cli, uint16_t fnum,
871 off_t offset, size_t size,
872 struct tevent_req **psmbreq);
873 struct tevent_req *cli_read_andx_send(TALLOC_CTX *mem_ctx,
874 struct tevent_context *ev,
875 struct cli_state *cli, uint16_t fnum,
876 off_t offset, size_t size);
877 NTSTATUS cli_read_andx_recv(struct tevent_req *req, ssize_t *received,
879 struct tevent_req *cli_pull_send(TALLOC_CTX *mem_ctx,
880 struct tevent_context *ev,
881 struct cli_state *cli,
882 uint16_t fnum, off_t start_offset,
883 off_t size, size_t window_size,
884 NTSTATUS (*sink)(char *buf, size_t n,
887 NTSTATUS cli_pull_recv(struct tevent_req *req, off_t *received);
888 NTSTATUS cli_pull(struct cli_state *cli, uint16_t fnum,
889 off_t start_offset, off_t size, size_t window_size,
890 NTSTATUS (*sink)(char *buf, size_t n, void *priv),
891 void *priv, off_t *received);
892 NTSTATUS cli_read_sink(char *buf, size_t n, void *priv);
893 struct tevent_req *cli_read_send(
895 struct tevent_context *ev,
896 struct cli_state *cli,
901 NTSTATUS cli_read_recv(struct tevent_req *req, size_t *received);
902 NTSTATUS cli_read(struct cli_state *cli, uint16_t fnum,
903 char *buf, off_t offset, size_t size,
905 NTSTATUS cli_smbwrite(struct cli_state *cli, uint16_t fnum, char *buf,
906 off_t offset, size_t size1, size_t *ptotal);
907 struct tevent_req *cli_write_andx_create(TALLOC_CTX *mem_ctx,
908 struct tevent_context *ev,
909 struct cli_state *cli, uint16_t fnum,
910 uint16_t mode, const uint8_t *buf,
911 off_t offset, size_t size,
912 struct tevent_req **reqs_before,
914 struct tevent_req **psmbreq);
915 struct tevent_req *cli_write_andx_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_andx_recv(struct tevent_req *req, size_t *pwritten);
922 struct tevent_req *cli_write_send(TALLOC_CTX *mem_ctx,
923 struct tevent_context *ev,
924 struct cli_state *cli, uint16_t fnum,
925 uint16_t mode, const uint8_t *buf,
926 off_t offset, size_t size);
927 NTSTATUS cli_write_recv(struct tevent_req *req, size_t *pwritten);
929 struct tevent_req *cli_writeall_send(
931 struct tevent_context *ev,
932 struct cli_state *cli,
938 NTSTATUS cli_writeall_recv(struct tevent_req *req, size_t *pwritten);
939 NTSTATUS cli_writeall(struct cli_state *cli, uint16_t fnum, uint16_t mode,
940 const uint8_t *buf, off_t offset, size_t size,
943 struct tevent_req *cli_push_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
944 struct cli_state *cli,
945 uint16_t fnum, uint16_t mode,
946 off_t start_offset, size_t window_size,
947 size_t (*source)(uint8_t *buf, size_t n,
950 NTSTATUS cli_push_recv(struct tevent_req *req);
951 NTSTATUS cli_push(struct cli_state *cli, 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, void *priv),
956 NTSTATUS cli_splice(struct cli_state *srccli, struct cli_state *dstcli,
957 uint16_t src_fnum, uint16_t dst_fnum,
959 off_t src_offset, off_t dst_offset,
961 int (*splice_cb)(off_t n, void *priv), void *priv);
963 /* The following definitions come from libsmb/clisecdesc.c */
965 struct tevent_req *cli_query_security_descriptor_send(
967 struct tevent_context *ev,
968 struct cli_state *cli,
971 NTSTATUS cli_query_security_descriptor_recv(
972 struct tevent_req *req,
974 struct security_descriptor **sd);
975 NTSTATUS cli_query_security_descriptor(struct cli_state *cli,
979 struct security_descriptor **sd);
980 NTSTATUS cli_query_secdesc(struct cli_state *cli, uint16_t fnum,
981 TALLOC_CTX *mem_ctx, struct security_descriptor **sd);
982 struct tevent_req *cli_set_security_descriptor_send(
984 struct tevent_context *ev,
985 struct cli_state *cli,
988 const struct security_descriptor *sd);
989 NTSTATUS cli_set_security_descriptor_recv(struct tevent_req *req);
990 NTSTATUS cli_set_security_descriptor(struct cli_state *cli,
993 const struct security_descriptor *sd);
994 NTSTATUS cli_set_secdesc(struct cli_state *cli, uint16_t fnum,
995 const struct security_descriptor *sd);
997 NTSTATUS cli_query_mxac(struct cli_state *cli,
998 const char *filename,
1001 /* The following definitions come from libsmb/clitrans.c */
1003 struct tevent_req *cli_trans_send(
1004 TALLOC_CTX *mem_ctx, struct tevent_context *ev,
1005 struct cli_state *cli, uint16_t additional_flags2, uint8_t cmd,
1006 const char *pipe_name, uint16_t fid, uint16_t function, int flags,
1007 uint16_t *setup, uint8_t num_setup, uint8_t max_setup,
1008 uint8_t *param, uint32_t num_param, uint32_t max_param,
1009 uint8_t *data, uint32_t num_data, uint32_t max_data);
1010 NTSTATUS cli_trans_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
1011 uint16_t *recv_flags2,
1012 uint16_t **setup, uint8_t min_setup,
1014 uint8_t **param, uint32_t min_param,
1015 uint32_t *num_param,
1016 uint8_t **data, uint32_t min_data,
1017 uint32_t *num_data);
1018 NTSTATUS cli_trans(TALLOC_CTX *mem_ctx, struct cli_state *cli,
1020 const char *pipe_name, uint16_t fid, uint16_t function,
1022 uint16_t *setup, uint8_t num_setup, uint8_t max_setup,
1023 uint8_t *param, uint32_t num_param, uint32_t max_param,
1024 uint8_t *data, uint32_t num_data, uint32_t max_data,
1025 uint16_t *recv_flags2,
1026 uint16_t **rsetup, uint8_t min_rsetup, uint8_t *num_rsetup,
1027 uint8_t **rparam, uint32_t min_rparam, uint32_t *num_rparam,
1028 uint8_t **rdata, uint32_t min_rdata, uint32_t *num_rdata);
1030 /* The following definitions come from libsmb/clisymlink.c */
1032 struct tevent_req *cli_create_reparse_point_send(TALLOC_CTX *mem_ctx,
1033 struct tevent_context *ev,
1034 struct cli_state *cli,
1036 DATA_BLOB reparse_blob);
1037 NTSTATUS cli_create_reparse_point_recv(struct tevent_req *req);
1039 struct tevent_req *cli_symlink_send(TALLOC_CTX *mem_ctx,
1040 struct tevent_context *ev,
1041 struct cli_state *cli,
1042 const char *oldpath,
1043 const char *newpath,
1045 NTSTATUS cli_symlink_recv(struct tevent_req *req);
1046 NTSTATUS cli_symlink(struct cli_state *cli, const char *oldname,
1047 const char *newname, uint32_t flags);
1049 struct tevent_req *cli_get_reparse_data_send(TALLOC_CTX *mem_ctx,
1050 struct tevent_context *ev,
1051 struct cli_state *cli,
1053 NTSTATUS cli_get_reparse_data_recv(struct tevent_req *req,
1054 TALLOC_CTX *mem_ctx,
1056 uint32_t *_datalen);
1057 NTSTATUS cli_get_reparse_data(struct cli_state *cli,
1059 TALLOC_CTX *mem_ctx,
1061 uint32_t *_datalen);
1063 struct tevent_req *cli_readlink_send(TALLOC_CTX *mem_ctx,
1064 struct tevent_context *ev,
1065 struct cli_state *cli,
1067 NTSTATUS cli_readlink_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
1068 char **psubstitute_name, char **pprint_name,
1070 NTSTATUS cli_readlink(struct cli_state *cli, const char *fname,
1071 TALLOC_CTX *mem_ctx, char **psubstitute_name,
1072 char **pprint_name, uint32_t *pflags);
1074 NTSTATUS fill_quota_buffer(TALLOC_CTX *mem_ctx,
1075 SMB_NTQUOTA_LIST *tmp_list,
1079 SMB_NTQUOTA_LIST **end_ptr);
1080 /* The following definitions come from libsmb/passchange.c */
1082 NTSTATUS remote_password_change(const char *remote_machine,
1083 const char *domain, const char *user_name,
1084 const char *old_passwd, const char *new_passwd,
1087 #endif /* _LIBSMB_PROTO_H_ */