2 Unix SMB/CIFS implementation.
4 Copyright (C) Andrew Bartlett 2001-2003
5 Copyright (C) Andrew Tridgell 1994-1998,2000-2001
6 Copyright (C) Gerald (Jerry) Carter 2004
7 Copyright (C) Jelmer Vernooij 2003
8 Copyright (C) Jeremy Allison 2001-2009,2011
9 Copyright (C) Stefan Metzmacher 2003,2009
10 Copyright (C) Volker Lendecke 2011
12 This program is free software; you can redistribute it and/or modify
13 it under the terms of the GNU General Public License as published by
14 the Free Software Foundation; either version 3 of the License, or
15 (at your option) any later version.
17 This program is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License for more details.
22 You should have received a copy of the GNU General Public License
23 along with this program. If not, see <http://www.gnu.org/licenses/>.
26 #ifndef _LIBSMB_PROTO_H_
27 #define _LIBSMB_PROTO_H_
29 #include "auth_info.h"
31 struct smb_trans_enc_state;
32 struct cli_credentials;
34 /* The following definitions come from libsmb/cliconnect.c */
36 struct cli_credentials *cli_session_creds_init(TALLOC_CTX *mem_ctx,
42 bool fallback_after_kerberos,
44 bool password_is_nt_hash);
45 NTSTATUS cli_session_creds_prepare_krb5(struct cli_state *cli,
46 struct cli_credentials *creds);
47 struct tevent_req *cli_session_setup_creds_send(TALLOC_CTX *mem_ctx,
48 struct tevent_context *ev,
49 struct cli_state *cli,
50 struct cli_credentials *creds);
51 NTSTATUS cli_session_setup_creds_recv(struct tevent_req *req);
52 NTSTATUS cli_session_setup_creds(struct cli_state *cli,
53 struct cli_credentials *creds);
54 NTSTATUS cli_session_setup_anon(struct cli_state *cli);
55 struct tevent_req *cli_session_setup_guest_create(TALLOC_CTX *mem_ctx,
56 struct tevent_context *ev,
57 struct cli_state *cli,
58 struct tevent_req **psmbreq);
59 struct tevent_req *cli_session_setup_guest_send(TALLOC_CTX *mem_ctx,
60 struct tevent_context *ev,
61 struct cli_state *cli);
62 NTSTATUS cli_session_setup_guest_recv(struct tevent_req *req);
63 NTSTATUS cli_ulogoff(struct cli_state *cli);
64 struct tevent_req *cli_tcon_andx_create(TALLOC_CTX *mem_ctx,
65 struct tevent_context *ev,
66 struct cli_state *cli,
67 const char *share, const char *dev,
68 const char *pass, int passlen,
69 struct tevent_req **psmbreq);
70 struct tevent_req *cli_tcon_andx_send(TALLOC_CTX *mem_ctx,
71 struct tevent_context *ev,
72 struct cli_state *cli,
73 const char *share, const char *dev,
74 const char *pass, int passlen);
75 NTSTATUS cli_tcon_andx_recv(struct tevent_req *req);
76 NTSTATUS cli_tcon_andx(struct cli_state *cli, const char *share,
77 const char *dev, const char *pass, int passlen);
78 NTSTATUS cli_tree_connect_creds(struct cli_state *cli,
79 const char *share, const char *dev,
80 struct cli_credentials *creds);
81 NTSTATUS cli_tree_connect(struct cli_state *cli, const char *share,
82 const char *dev, const char *pass);
83 NTSTATUS cli_tdis(struct cli_state *cli);
84 NTSTATUS cli_connect_nb(const char *host, const struct sockaddr_storage *dest_ss,
85 uint16_t port, int name_type, const char *myname,
86 int signing_state, int flags, struct cli_state **pcli);
87 NTSTATUS cli_start_connection(struct cli_state **output_cli,
89 const char *dest_host,
90 const struct sockaddr_storage *dest_ss, int port,
91 int signing_state, int flags);
92 NTSTATUS cli_smb1_setup_encryption(struct cli_state *cli,
93 struct cli_credentials *creds);
94 struct tevent_req *cli_full_connection_creds_send(
95 TALLOC_CTX *mem_ctx, struct tevent_context *ev,
96 const char *my_name, const char *dest_host,
97 const struct sockaddr_storage *dest_ss, int port,
98 const char *service, const char *service_type,
99 struct cli_credentials *creds,
100 int flags, int signing_state);
101 NTSTATUS cli_full_connection_creds_recv(struct tevent_req *req,
102 struct cli_state **output_cli);
103 NTSTATUS cli_full_connection_creds(struct cli_state **output_cli,
105 const char *dest_host,
106 const struct sockaddr_storage *dest_ss, int port,
107 const char *service, const char *service_type,
108 struct cli_credentials *creds,
111 NTSTATUS cli_full_connection(struct cli_state **output_cli,
113 const char *dest_host,
114 const struct sockaddr_storage *dest_ss, int port,
115 const char *service, const char *service_type,
116 const char *user, const char *domain,
117 const char *password, int flags,
119 NTSTATUS cli_raw_tcon(struct cli_state *cli,
120 const char *service, const char *pass, const char *dev,
121 uint16_t *max_xmit, uint16_t *tid);
122 struct cli_state *get_ipc_connect(char *server,
123 struct sockaddr_storage *server_ss,
124 const struct user_auth_info *user_info);
125 struct cli_state *get_ipc_connect_master_ip(TALLOC_CTX *ctx,
126 struct sockaddr_storage *mb_ip,
127 const struct user_auth_info *user_info,
128 char **pp_workgroup_out);
129 struct cli_state *get_ipc_connect_master_ip_bcast(TALLOC_CTX *ctx,
130 const struct user_auth_info *user_info,
131 char **pp_workgroup_out);
133 /* The following definitions come from libsmb/clidfs.c */
135 NTSTATUS cli_cm_force_encryption_creds(struct cli_state *c,
136 struct cli_credentials *creds,
137 const char *sharename);
138 NTSTATUS cli_cm_force_encryption(struct cli_state *c,
139 const char *username,
140 const char *password,
142 const char *sharename);
143 NTSTATUS cli_cm_open(TALLOC_CTX *ctx,
144 struct cli_state *referring_cli,
147 const struct user_auth_info *auth_info,
153 struct cli_state **pcli);
154 void cli_cm_display(struct cli_state *c);
155 struct client_dfs_referral;
156 NTSTATUS cli_dfs_get_referral(TALLOC_CTX *ctx,
157 struct cli_state *cli,
159 struct client_dfs_referral **refs,
162 NTSTATUS cli_resolve_path(TALLOC_CTX *ctx,
164 const struct user_auth_info *dfs_auth_info,
165 struct cli_state *rootcli,
167 struct cli_state **targetcli,
168 char **pp_targetpath);
170 bool cli_check_msdfs_proxy(TALLOC_CTX *ctx,
171 struct cli_state *cli,
172 const char *sharename,
176 struct cli_credentials *creds);
178 /* The following definitions come from libsmb/clientgen.c */
180 int cli_set_message(char *buf,int num_words,int num_bytes,bool zero);
181 unsigned int cli_set_timeout(struct cli_state *cli, unsigned int timeout);
182 bool cli_set_backup_intent(struct cli_state *cli, bool flag);
183 extern struct GUID cli_state_client_guid;
184 struct cli_state *cli_state_create(TALLOC_CTX *mem_ctx,
186 const char *remote_name,
187 const char *remote_realm,
190 void cli_nt_pipes_close(struct cli_state *cli);
191 void cli_shutdown(struct cli_state *cli);
192 const char *cli_state_remote_realm(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_has_tcon(struct cli_state *cli);
197 uint32_t cli_state_get_tid(struct cli_state *cli);
198 uint32_t cli_state_set_tid(struct cli_state *cli, uint32_t tid);
200 struct smbXcli_tcon *cli_state_save_tcon(struct cli_state *cli);
201 void cli_state_restore_tcon(struct cli_state *cli, struct smbXcli_tcon *tcon);
202 uint16_t cli_state_get_uid(struct cli_state *cli);
203 uint16_t cli_state_set_uid(struct cli_state *cli, uint16_t uid);
204 bool cli_set_case_sensitive(struct cli_state *cli, bool case_sensitive);
205 uint32_t cli_state_available_size(struct cli_state *cli, uint32_t ofs);
206 time_t cli_state_server_time(struct cli_state *cli);
207 struct tevent_req *cli_echo_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
208 struct cli_state *cli, uint16_t num_echos,
210 NTSTATUS cli_echo_recv(struct tevent_req *req);
211 NTSTATUS cli_echo(struct cli_state *cli, uint16_t num_echos, DATA_BLOB data);
212 bool is_andx_req(uint8_t cmd);
213 NTSTATUS cli_smb(TALLOC_CTX *mem_ctx, struct cli_state *cli,
214 uint8_t smb_command, uint8_t additional_flags,
215 uint8_t wct, uint16_t *vwv,
216 uint32_t num_bytes, const uint8_t *bytes,
217 struct tevent_req **result_parent,
218 uint8_t min_wct, uint8_t *pwct, uint16_t **pvwv,
219 uint32_t *pnum_bytes, uint8_t **pbytes);
221 /* The following definitions come from libsmb/clierror.c */
223 const char *cli_errstr(struct cli_state *cli);
224 NTSTATUS cli_nt_error(struct cli_state *cli);
225 void cli_dos_error(struct cli_state *cli, uint8_t *eclass, uint32_t *ecode);
226 int cli_errno(struct cli_state *cli);
227 bool cli_is_error(struct cli_state *cli);
228 bool cli_is_nt_error(struct cli_state *cli);
229 bool cli_is_dos_error(struct cli_state *cli);
230 bool cli_state_is_connected(struct cli_state *cli);
232 /* The following definitions come from libsmb/clifile.c */
234 struct tevent_req *cli_setpathinfo_send(TALLOC_CTX *mem_ctx,
235 struct tevent_context *ev,
236 struct cli_state *cli,
241 NTSTATUS cli_setpathinfo_recv(struct tevent_req *req);
242 NTSTATUS cli_setpathinfo(struct cli_state *cli,
248 struct tevent_req *cli_posix_symlink_send(TALLOC_CTX *mem_ctx,
249 struct tevent_context *ev,
250 struct cli_state *cli,
252 const char *newname);
253 NTSTATUS cli_posix_symlink_recv(struct tevent_req *req);
254 NTSTATUS cli_posix_symlink(struct cli_state *cli,
256 const char *newname);
257 struct tevent_req *cli_posix_readlink_send(TALLOC_CTX *mem_ctx,
258 struct tevent_context *ev,
259 struct cli_state *cli,
262 NTSTATUS cli_posix_readlink_recv(struct tevent_req *req, struct cli_state *cli,
263 char *retpath, size_t len);
264 NTSTATUS cli_posix_readlink(struct cli_state *cli, const char *fname,
265 char *linkpath, size_t len);
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,
306 SMB_STRUCT_STAT *sbuf);
307 NTSTATUS cli_posix_stat(struct cli_state *cli,
309 SMB_STRUCT_STAT *sbuf);
310 struct tevent_req *cli_posix_chmod_send(TALLOC_CTX *mem_ctx,
311 struct tevent_context *ev,
312 struct cli_state *cli,
315 NTSTATUS cli_posix_chmod_recv(struct tevent_req *req);
316 NTSTATUS cli_posix_chmod(struct cli_state *cli, const char *fname, mode_t mode);
317 struct tevent_req *cli_posix_chown_send(TALLOC_CTX *mem_ctx,
318 struct tevent_context *ev,
319 struct cli_state *cli,
323 NTSTATUS cli_posix_chown_recv(struct tevent_req *req);
324 NTSTATUS cli_posix_chown(struct cli_state *cli,
328 struct tevent_req *cli_rename_send(TALLOC_CTX *mem_ctx,
329 struct tevent_context *ev,
330 struct cli_state *cli,
331 const char *fname_src,
332 const char *fname_dst,
334 NTSTATUS cli_rename_recv(struct tevent_req *req);
335 NTSTATUS cli_rename(struct cli_state *cli,
336 const char *fname_src,
337 const char *fname_dst,
339 struct tevent_req *cli_ntrename_send(TALLOC_CTX *mem_ctx,
340 struct tevent_context *ev,
341 struct cli_state *cli,
342 const char *fname_src,
343 const char *fname_dst);
344 NTSTATUS cli_ntrename_recv(struct tevent_req *req);
345 NTSTATUS cli_ntrename(struct cli_state *cli, const char *fname_src, const char *fname_dst);
347 struct tevent_req *cli_nt_hardlink_send(TALLOC_CTX *mem_ctx,
348 struct tevent_context *ev,
349 struct cli_state *cli,
350 const char *fname_src,
351 const char *fname_dst);
352 NTSTATUS cli_nt_hardlink_recv(struct tevent_req *req);
353 NTSTATUS cli_nt_hardlink(struct cli_state *cli, const char *fname_src, const char *fname_dst);
355 struct tevent_req *cli_unlink_send(TALLOC_CTX *mem_ctx,
356 struct tevent_context *ev,
357 struct cli_state *cli,
359 uint16_t mayhave_attrs);
360 NTSTATUS cli_unlink_recv(struct tevent_req *req);
361 NTSTATUS cli_unlink(struct cli_state *cli, const char *fname, uint16_t mayhave_attrs);
363 struct tevent_req *cli_mkdir_send(TALLOC_CTX *mem_ctx,
364 struct tevent_context *ev,
365 struct cli_state *cli,
367 NTSTATUS cli_mkdir_recv(struct tevent_req *req);
368 NTSTATUS cli_mkdir(struct cli_state *cli, const char *dname);
369 struct tevent_req *cli_rmdir_send(TALLOC_CTX *mem_ctx,
370 struct tevent_context *ev,
371 struct cli_state *cli,
373 NTSTATUS cli_rmdir_recv(struct tevent_req *req);
374 NTSTATUS cli_rmdir(struct cli_state *cli, const char *dname);
375 struct tevent_req *cli_nt_delete_on_close_send(TALLOC_CTX *mem_ctx,
376 struct tevent_context *ev,
377 struct cli_state *cli,
380 NTSTATUS cli_nt_delete_on_close_recv(struct tevent_req *req);
381 NTSTATUS cli_nt_delete_on_close(struct cli_state *cli, uint16_t fnum, bool flag);
382 struct tevent_req *cli_ntcreate_send(TALLOC_CTX *mem_ctx,
383 struct tevent_context *ev,
384 struct cli_state *cli,
387 uint32_t DesiredAccess,
388 uint32_t FileAttributes,
389 uint32_t ShareAccess,
390 uint32_t CreateDisposition,
391 uint32_t CreateOptions,
392 uint8_t SecurityFlags);
393 NTSTATUS cli_ntcreate_recv(struct tevent_req *req,
395 struct smb_create_returns *cr);
396 NTSTATUS cli_ntcreate(struct cli_state *cli,
399 uint32_t DesiredAccess,
400 uint32_t FileAttributes,
401 uint32_t ShareAccess,
402 uint32_t CreateDisposition,
403 uint32_t CreateOptions,
404 uint8_t SecurityFlags,
406 struct smb_create_returns *cr);
407 struct tevent_req *cli_openx_create(TALLOC_CTX *mem_ctx,
408 struct tevent_context *ev,
409 struct cli_state *cli, const char *fname,
410 int flags, int share_mode,
411 struct tevent_req **psmbreq);
412 struct tevent_req *cli_openx_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
413 struct cli_state *cli, const char *fname,
414 int flags, int share_mode);
415 NTSTATUS cli_openx_recv(struct tevent_req *req, uint16_t *fnum);
416 NTSTATUS cli_openx(struct cli_state *cli, const char *fname, int flags, int share_mode, uint16_t *pfnum);
417 NTSTATUS cli_open(struct cli_state *cli, const char *fname, int flags, int share_mode, uint16_t *pfnum);
418 struct tevent_req *cli_close_create(TALLOC_CTX *mem_ctx,
419 struct tevent_context *ev,
420 struct cli_state *cli, uint16_t fnum,
421 struct tevent_req **psubreq);
422 struct tevent_req *cli_close_send(TALLOC_CTX *mem_ctx,
423 struct tevent_context *ev,
424 struct cli_state *cli, uint16_t fnum);
425 NTSTATUS cli_close_recv(struct tevent_req *req);
426 NTSTATUS cli_close(struct cli_state *cli, uint16_t fnum);
427 struct tevent_req *cli_ftruncate_send(TALLOC_CTX *mem_ctx,
428 struct tevent_context *ev,
429 struct cli_state *cli,
432 NTSTATUS cli_ftruncate_recv(struct tevent_req *req);
433 NTSTATUS cli_ftruncate(struct cli_state *cli, uint16_t fnum, uint64_t size);
434 NTSTATUS cli_locktype(struct cli_state *cli, uint16_t fnum,
435 uint32_t offset, uint32_t len,
436 int timeout, unsigned char locktype);
437 NTSTATUS cli_lock32(struct cli_state *cli, uint16_t fnum, uint32_t offset,
438 uint32_t len, int timeout, enum brl_type lock_type);
439 struct tevent_req *cli_unlock_send(TALLOC_CTX *mem_ctx,
440 struct tevent_context *ev,
441 struct cli_state *cli,
445 NTSTATUS cli_unlock_recv(struct tevent_req *req);
446 NTSTATUS cli_unlock(struct cli_state *cli, uint16_t fnum, uint32_t offset, uint32_t len);
447 NTSTATUS cli_lock64(struct cli_state *cli, uint16_t fnum,
448 uint64_t offset, uint64_t len, int timeout,
449 enum brl_type lock_type);
450 struct tevent_req *cli_unlock64_send(TALLOC_CTX *mem_ctx,
451 struct tevent_context *ev,
452 struct cli_state *cli,
456 NTSTATUS cli_unlock64_recv(struct tevent_req *req);
457 NTSTATUS cli_unlock64(struct cli_state *cli, uint16_t fnum, uint64_t offset, uint64_t len);
458 struct tevent_req *cli_posix_lock_send(TALLOC_CTX *mem_ctx,
459 struct tevent_context *ev,
460 struct cli_state *cli,
465 enum brl_type lock_type);
466 NTSTATUS cli_posix_lock_recv(struct tevent_req *req);
467 NTSTATUS cli_posix_lock(struct cli_state *cli, uint16_t fnum,
468 uint64_t offset, uint64_t len,
469 bool wait_lock, enum brl_type lock_type);
470 struct tevent_req *cli_posix_unlock_send(TALLOC_CTX *mem_ctx,
471 struct tevent_context *ev,
472 struct cli_state *cli,
476 NTSTATUS cli_posix_unlock_recv(struct tevent_req *req);
477 NTSTATUS cli_posix_unlock(struct cli_state *cli, uint16_t fnum, uint64_t offset, uint64_t len);
478 struct tevent_req *cli_getattrE_send(TALLOC_CTX *mem_ctx,
479 struct tevent_context *ev,
480 struct cli_state *cli,
482 NTSTATUS cli_getattrE_recv(struct tevent_req *req,
488 NTSTATUS cli_getattrE(struct cli_state *cli,
495 struct tevent_req *cli_setattrE_send(TALLOC_CTX *mem_ctx,
496 struct tevent_context *ev,
497 struct cli_state *cli,
502 NTSTATUS cli_setattrE_recv(struct tevent_req *req);
503 NTSTATUS cli_setattrE(struct cli_state *cli,
508 struct tevent_req *cli_getatr_send(TALLOC_CTX *mem_ctx,
509 struct tevent_context *ev,
510 struct cli_state *cli,
512 NTSTATUS cli_getatr_recv(struct tevent_req *req,
516 NTSTATUS cli_getatr(struct cli_state *cli,
521 struct tevent_req *cli_setatr_send(TALLOC_CTX *mem_ctx,
522 struct tevent_context *ev,
523 struct cli_state *cli,
527 NTSTATUS cli_setatr_recv(struct tevent_req *req);
528 NTSTATUS cli_setatr(struct cli_state *cli,
532 struct tevent_req *cli_chkpath_send(TALLOC_CTX *mem_ctx,
533 struct tevent_context *ev,
534 struct cli_state *cli,
536 NTSTATUS cli_chkpath_recv(struct tevent_req *req);
537 NTSTATUS cli_chkpath(struct cli_state *cli, const char *path);
538 struct tevent_req *cli_dskattr_send(TALLOC_CTX *mem_ctx,
539 struct tevent_context *ev,
540 struct cli_state *cli);
541 NTSTATUS cli_dskattr_recv(struct tevent_req *req, int *bsize, int *total,
543 NTSTATUS cli_dskattr(struct cli_state *cli, int *bsize, int *total, int *avail);
544 NTSTATUS cli_disk_size(struct cli_state *cli, const char *path, uint64_t *bsize,
545 uint64_t *total, uint64_t *avail);
546 struct tevent_req *cli_ctemp_send(TALLOC_CTX *mem_ctx,
547 struct tevent_context *ev,
548 struct cli_state *cli,
550 NTSTATUS cli_ctemp_recv(struct tevent_req *req,
554 NTSTATUS cli_ctemp(struct cli_state *cli,
559 NTSTATUS cli_raw_ioctl(struct cli_state *cli, uint16_t fnum, uint32_t code, DATA_BLOB *blob);
560 NTSTATUS cli_set_ea_path(struct cli_state *cli, const char *path,
561 const char *ea_name, const char *ea_val,
563 NTSTATUS cli_set_ea_fnum(struct cli_state *cli, uint16_t fnum,
564 const char *ea_name, const char *ea_val,
566 struct tevent_req *cli_get_ea_list_path_send(TALLOC_CTX *mem_ctx,
567 struct tevent_context *ev,
568 struct cli_state *cli,
570 NTSTATUS cli_get_ea_list_path_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
571 size_t *pnum_eas, struct ea_struct **peas);
572 NTSTATUS cli_get_ea_list_path(struct cli_state *cli, const char *path,
575 struct ea_struct **pea_list);
576 struct tevent_req *cli_posix_open_send(TALLOC_CTX *mem_ctx,
577 struct tevent_context *ev,
578 struct cli_state *cli,
582 NTSTATUS cli_posix_open_recv(struct tevent_req *req, uint16_t *pfnum);
583 NTSTATUS cli_posix_open(struct cli_state *cli, const char *fname,
584 int flags, mode_t mode, uint16_t *fnum);
585 struct tevent_req *cli_posix_mkdir_send(TALLOC_CTX *mem_ctx,
586 struct tevent_context *ev,
587 struct cli_state *cli,
590 NTSTATUS cli_posix_mkdir_recv(struct tevent_req *req);
591 NTSTATUS cli_posix_mkdir(struct cli_state *cli, const char *fname, mode_t mode);
593 struct tevent_req *cli_posix_unlink_send(TALLOC_CTX *mem_ctx,
594 struct tevent_context *ev,
595 struct cli_state *cli,
597 NTSTATUS cli_posix_unlink_recv(struct tevent_req *req);
598 NTSTATUS cli_posix_unlink(struct cli_state *cli, const char *fname);
600 struct tevent_req *cli_posix_rmdir_send(TALLOC_CTX *mem_ctx,
601 struct tevent_context *ev,
602 struct cli_state *cli,
604 NTSTATUS cli_posix_rmdir_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx);
605 NTSTATUS cli_posix_rmdir(struct cli_state *cli, const char *fname);
606 struct tevent_req *cli_notify_send(TALLOC_CTX *mem_ctx,
607 struct tevent_context *ev,
608 struct cli_state *cli, uint16_t fnum,
609 uint32_t buffer_size,
610 uint32_t completion_filter, bool recursive);
611 NTSTATUS cli_notify_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
612 uint32_t *pnum_changes,
613 struct notify_change **pchanges);
614 NTSTATUS cli_notify(struct cli_state *cli, uint16_t fnum, uint32_t buffer_size,
615 uint32_t completion_filter, bool recursive,
616 TALLOC_CTX *mem_ctx, uint32_t *pnum_changes,
617 struct notify_change **pchanges);
619 struct tevent_req *cli_nttrans_create_send(TALLOC_CTX *mem_ctx,
620 struct tevent_context *ev,
621 struct cli_state *cli,
624 uint32_t DesiredAccess,
625 uint32_t FileAttributes,
626 uint32_t ShareAccess,
627 uint32_t CreateDisposition,
628 uint32_t CreateOptions,
629 uint8_t SecurityFlags,
630 struct security_descriptor *secdesc,
631 struct ea_struct *eas,
633 NTSTATUS cli_nttrans_create_recv(struct tevent_req *req,
635 struct smb_create_returns *cr);
636 NTSTATUS cli_nttrans_create(struct cli_state *cli,
639 uint32_t DesiredAccess,
640 uint32_t FileAttributes,
641 uint32_t ShareAccess,
642 uint32_t CreateDisposition,
643 uint32_t CreateOptions,
644 uint8_t SecurityFlags,
645 struct security_descriptor *secdesc,
646 struct ea_struct *eas,
649 struct smb_create_returns *cr);
651 /* The following definitions come from libsmb/clifsinfo.c */
653 struct tevent_req *cli_unix_extensions_version_send(TALLOC_CTX *mem_ctx,
654 struct tevent_context *ev,
655 struct cli_state *cli);
656 NTSTATUS cli_unix_extensions_version_recv(struct tevent_req *req,
657 uint16_t *pmajor, uint16_t *pminor,
660 NTSTATUS cli_unix_extensions_version(struct cli_state *cli, uint16_t *pmajor,
661 uint16_t *pminor, uint32_t *pcaplow,
663 struct tevent_req *cli_set_unix_extensions_capabilities_send(
664 TALLOC_CTX *mem_ctx, struct tevent_context *ev, struct cli_state *cli,
665 uint16_t major, uint16_t minor, uint32_t caplow, uint32_t caphigh);
666 NTSTATUS cli_set_unix_extensions_capabilities_recv(struct tevent_req *req);
667 NTSTATUS cli_set_unix_extensions_capabilities(struct cli_state *cli,
668 uint16_t major, uint16_t minor,
669 uint32_t caplow, uint32_t caphigh);
670 struct tevent_req *cli_get_fs_attr_info_send(TALLOC_CTX *mem_ctx,
671 struct tevent_context *ev,
672 struct cli_state *cli);
673 NTSTATUS cli_get_fs_attr_info_recv(struct tevent_req *req, uint32_t *fs_attr);
674 NTSTATUS cli_get_fs_attr_info(struct cli_state *cli, uint32_t *fs_attr);
675 NTSTATUS cli_get_fs_volume_info(struct cli_state *cli,
676 TALLOC_CTX *mem_ctx, char **volume_name,
677 uint32_t *pserial_number, time_t *pdate);
678 NTSTATUS cli_get_fs_full_size_info(struct cli_state *cli,
679 uint64_t *total_allocation_units,
680 uint64_t *caller_allocation_units,
681 uint64_t *actual_allocation_units,
682 uint64_t *sectors_per_allocation_unit,
683 uint64_t *bytes_per_sector);
684 NTSTATUS cli_get_posix_fs_info(struct cli_state *cli,
685 uint32_t *optimal_transfer_size,
686 uint32_t *block_size,
687 uint64_t *total_blocks,
688 uint64_t *blocks_available,
689 uint64_t *user_blocks_available,
690 uint64_t *total_file_nodes,
691 uint64_t *free_file_nodes,
692 uint64_t *fs_identifier);
693 struct tevent_req *cli_posix_whoami_send(TALLOC_CTX *mem_ctx,
694 struct tevent_context *ev,
695 struct cli_state *cli);
696 NTSTATUS cli_posix_whoami_recv(struct tevent_req *req,
703 struct dom_sid **psids,
705 NTSTATUS cli_posix_whoami(struct cli_state *cli,
712 struct dom_sid **sids,
715 /* The following definitions come from libsmb/clilist.c */
717 NTSTATUS cli_list_old(struct cli_state *cli,const char *Mask,uint16_t attribute,
718 NTSTATUS (*fn)(const char *, struct file_info *,
719 const char *, void *), void *state);
720 NTSTATUS cli_list_trans(struct cli_state *cli, const char *mask,
721 uint16_t attribute, int info_level,
722 NTSTATUS (*fn)(const char *mnt, struct file_info *finfo,
723 const char *mask, void *private_data),
725 struct tevent_req *cli_list_send(TALLOC_CTX *mem_ctx,
726 struct tevent_context *ev,
727 struct cli_state *cli,
730 uint16_t info_level);
731 NTSTATUS cli_list_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
732 struct file_info **finfo, size_t *num_finfo);
733 NTSTATUS cli_list(struct cli_state *cli,const char *Mask,uint16_t attribute,
734 NTSTATUS (*fn)(const char *, struct file_info *, const char *,
735 void *), void *state);
737 /* The following definitions come from libsmb/climessage.c */
739 struct tevent_req *cli_message_send(TALLOC_CTX *mem_ctx,
740 struct tevent_context *ev,
741 struct cli_state *cli,
742 const char *host, const char *username,
743 const char *message);
744 NTSTATUS cli_message_recv(struct tevent_req *req);
745 NTSTATUS cli_message(struct cli_state *cli, const char *host,
746 const char *username, const char *message);
748 /* The following definitions come from libsmb/clioplock.c */
750 struct tevent_req *cli_smb_oplock_break_waiter_send(TALLOC_CTX *mem_ctx,
751 struct tevent_context *ev,
752 struct cli_state *cli);
753 NTSTATUS cli_smb_oplock_break_waiter_recv(struct tevent_req *req,
757 struct tevent_req *cli_oplock_ack_send(TALLOC_CTX *mem_ctx,
758 struct tevent_context *ev,
759 struct cli_state *cli,
760 uint16_t fnum, uint8_t level);
761 NTSTATUS cli_oplock_ack_recv(struct tevent_req *req);
763 /* The following definitions come from libsmb/cliprint.c */
765 int cli_print_queue(struct cli_state *cli,
766 void (*fn)(struct print_job_info *));
767 int cli_printjob_del(struct cli_state *cli, int job);
769 /* The following definitions come from libsmb/cliquota.c */
771 NTSTATUS cli_get_quota_handle(struct cli_state *cli, uint16_t *quota_fnum);
772 void free_ntquota_list(SMB_NTQUOTA_LIST **qt_list);
773 bool parse_user_quota_record(const uint8_t *rdata,
774 unsigned int rdata_count,
775 unsigned int *offset,
776 SMB_NTQUOTA_STRUCT *pqt);
777 bool add_record_to_ntquota_list(TALLOC_CTX *mem_ctx,
778 SMB_NTQUOTA_STRUCT *pqt,
779 SMB_NTQUOTA_LIST **pqt_list);
780 NTSTATUS parse_user_quota_list(const uint8_t *curdata,
781 uint32_t curdata_size,
783 SMB_NTQUOTA_LIST **pqt_list);
784 NTSTATUS parse_fs_quota_buffer(const uint8_t *rdata,
785 unsigned int rdata_count,
786 SMB_NTQUOTA_STRUCT *pqt);
787 NTSTATUS build_user_quota_buffer(SMB_NTQUOTA_LIST *qt_list,
791 SMB_NTQUOTA_LIST **end_ptr);
792 NTSTATUS build_fs_quota_buffer(TALLOC_CTX *mem_ctx,
793 const SMB_NTQUOTA_STRUCT *pqt,
796 NTSTATUS cli_get_user_quota(struct cli_state *cli, int quota_fnum,
797 SMB_NTQUOTA_STRUCT *pqt);
798 NTSTATUS cli_set_user_quota(struct cli_state *cli,
800 SMB_NTQUOTA_LIST *qtl);
801 NTSTATUS cli_list_user_quota(struct cli_state *cli, int quota_fnum,
802 SMB_NTQUOTA_LIST **pqt_list);
803 NTSTATUS cli_get_fs_quota_info(struct cli_state *cli, int quota_fnum,
804 SMB_NTQUOTA_STRUCT *pqt);
805 NTSTATUS cli_set_fs_quota_info(struct cli_state *cli, int quota_fnum,
806 SMB_NTQUOTA_STRUCT *pqt);
808 /* The following definitions come from libsmb/clireadwrite.c */
810 struct tevent_req *cli_read_andx_create(TALLOC_CTX *mem_ctx,
811 struct tevent_context *ev,
812 struct cli_state *cli, uint16_t fnum,
813 off_t offset, size_t size,
814 struct tevent_req **psmbreq);
815 struct tevent_req *cli_read_andx_send(TALLOC_CTX *mem_ctx,
816 struct tevent_context *ev,
817 struct cli_state *cli, uint16_t fnum,
818 off_t offset, size_t size);
819 NTSTATUS cli_read_andx_recv(struct tevent_req *req, ssize_t *received,
821 struct tevent_req *cli_pull_send(TALLOC_CTX *mem_ctx,
822 struct tevent_context *ev,
823 struct cli_state *cli,
824 uint16_t fnum, off_t start_offset,
825 off_t size, size_t window_size,
826 NTSTATUS (*sink)(char *buf, size_t n,
829 NTSTATUS cli_pull_recv(struct tevent_req *req, off_t *received);
830 NTSTATUS cli_pull(struct cli_state *cli, uint16_t fnum,
831 off_t start_offset, off_t size, size_t window_size,
832 NTSTATUS (*sink)(char *buf, size_t n, void *priv),
833 void *priv, off_t *received);
834 NTSTATUS cli_read(struct cli_state *cli, uint16_t fnum,
835 char *buf, off_t offset, size_t size,
837 NTSTATUS cli_smbwrite(struct cli_state *cli, uint16_t fnum, char *buf,
838 off_t offset, size_t size1, size_t *ptotal);
839 struct tevent_req *cli_write_andx_create(TALLOC_CTX *mem_ctx,
840 struct tevent_context *ev,
841 struct cli_state *cli, uint16_t fnum,
842 uint16_t mode, const uint8_t *buf,
843 off_t offset, size_t size,
844 struct tevent_req **reqs_before,
846 struct tevent_req **psmbreq);
847 struct tevent_req *cli_write_andx_send(TALLOC_CTX *mem_ctx,
848 struct tevent_context *ev,
849 struct cli_state *cli, uint16_t fnum,
850 uint16_t mode, const uint8_t *buf,
851 off_t offset, size_t size);
852 NTSTATUS cli_write_andx_recv(struct tevent_req *req, size_t *pwritten);
854 NTSTATUS cli_writeall(struct cli_state *cli, uint16_t fnum, uint16_t mode,
855 const uint8_t *buf, off_t offset, size_t size,
858 struct tevent_req *cli_push_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
859 struct cli_state *cli,
860 uint16_t fnum, uint16_t mode,
861 off_t start_offset, size_t window_size,
862 size_t (*source)(uint8_t *buf, size_t n,
865 NTSTATUS cli_push_recv(struct tevent_req *req);
866 NTSTATUS cli_push(struct cli_state *cli, uint16_t fnum, uint16_t mode,
867 off_t start_offset, size_t window_size,
868 size_t (*source)(uint8_t *buf, size_t n, void *priv),
871 NTSTATUS cli_splice(struct cli_state *srccli, struct cli_state *dstcli,
872 uint16_t src_fnum, uint16_t dst_fnum,
874 off_t src_offset, off_t dst_offset,
876 int (*splice_cb)(off_t n, void *priv), void *priv);
878 /* The following definitions come from libsmb/clisecdesc.c */
880 NTSTATUS cli_query_security_descriptor(struct cli_state *cli,
884 struct security_descriptor **sd);
885 NTSTATUS cli_query_secdesc(struct cli_state *cli, uint16_t fnum,
886 TALLOC_CTX *mem_ctx, struct security_descriptor **sd);
887 NTSTATUS cli_set_security_descriptor(struct cli_state *cli,
890 const struct security_descriptor *sd);
891 NTSTATUS cli_set_secdesc(struct cli_state *cli, uint16_t fnum,
892 const struct security_descriptor *sd);
894 /* The following definitions come from libsmb/clistr.c */
896 size_t clistr_pull_talloc(TALLOC_CTX *ctx,
903 bool clistr_is_previous_version_path(const char *path,
908 /* The following definitions come from libsmb/clitrans.c */
910 struct tevent_req *cli_trans_send(
911 TALLOC_CTX *mem_ctx, struct tevent_context *ev,
912 struct cli_state *cli, uint16_t additional_flags2, uint8_t cmd,
913 const char *pipe_name, uint16_t fid, uint16_t function, int flags,
914 uint16_t *setup, uint8_t num_setup, uint8_t max_setup,
915 uint8_t *param, uint32_t num_param, uint32_t max_param,
916 uint8_t *data, uint32_t num_data, uint32_t max_data);
917 NTSTATUS cli_trans_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
918 uint16_t *recv_flags2,
919 uint16_t **setup, uint8_t min_setup,
921 uint8_t **param, uint32_t min_param,
923 uint8_t **data, uint32_t min_data,
925 NTSTATUS cli_trans(TALLOC_CTX *mem_ctx, struct cli_state *cli,
927 const char *pipe_name, uint16_t fid, uint16_t function,
929 uint16_t *setup, uint8_t num_setup, uint8_t max_setup,
930 uint8_t *param, uint32_t num_param, uint32_t max_param,
931 uint8_t *data, uint32_t num_data, uint32_t max_data,
932 uint16_t *recv_flags2,
933 uint16_t **rsetup, uint8_t min_rsetup, uint8_t *num_rsetup,
934 uint8_t **rparam, uint32_t min_rparam, uint32_t *num_rparam,
935 uint8_t **rdata, uint32_t min_rdata, uint32_t *num_rdata);
937 /* The following definitions come from libsmb/reparse_symlink.c */
939 bool symlink_reparse_buffer_marshall(
940 const char *substitute, const char *printname, uint32_t flags,
941 TALLOC_CTX *mem_ctx, uint8_t **pdst, size_t *pdstlen);
942 bool symlink_reparse_buffer_parse(
943 const uint8_t *src, size_t srclen, TALLOC_CTX *mem_ctx,
944 char **psubstitute_name, char **pprint_name, uint32_t *pflags);
946 /* The following definitions come from libsmb/clisymlink.c */
948 struct tevent_req *cli_symlink_send(TALLOC_CTX *mem_ctx,
949 struct tevent_context *ev,
950 struct cli_state *cli,
954 NTSTATUS cli_symlink_recv(struct tevent_req *req);
955 NTSTATUS cli_symlink(struct cli_state *cli, const char *oldname,
956 const char *newname, uint32_t flags);
958 struct tevent_req *cli_readlink_send(TALLOC_CTX *mem_ctx,
959 struct tevent_context *ev,
960 struct cli_state *cli,
962 NTSTATUS cli_readlink_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
963 char **psubstitute_name, char **pprint_name,
965 NTSTATUS cli_readlink(struct cli_state *cli, const char *fname,
966 TALLOC_CTX *mem_ctx, char **psubstitute_name,
967 char **pprint_name, uint32_t *pflags);
969 #endif /* _LIBSMB_PROTO_H_ */