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,
152 struct cli_state **pcli);
153 void cli_cm_display(struct cli_state *c);
154 struct client_dfs_referral;
155 NTSTATUS cli_dfs_get_referral(TALLOC_CTX *ctx,
156 struct cli_state *cli,
158 struct client_dfs_referral **refs,
161 NTSTATUS cli_resolve_path(TALLOC_CTX *ctx,
163 const struct user_auth_info *dfs_auth_info,
164 struct cli_state *rootcli,
166 struct cli_state **targetcli,
167 char **pp_targetpath);
169 bool cli_check_msdfs_proxy(TALLOC_CTX *ctx,
170 struct cli_state *cli,
171 const char *sharename,
175 struct cli_credentials *creds);
177 /* The following definitions come from libsmb/clientgen.c */
179 int cli_set_message(char *buf,int num_words,int num_bytes,bool zero);
180 unsigned int cli_set_timeout(struct cli_state *cli, unsigned int timeout);
181 bool cli_set_backup_intent(struct cli_state *cli, bool flag);
182 extern struct GUID cli_state_client_guid;
183 struct cli_state *cli_state_create(TALLOC_CTX *mem_ctx,
185 const char *remote_name,
188 void cli_nt_pipes_close(struct cli_state *cli);
189 void cli_shutdown(struct cli_state *cli);
190 uint16_t cli_state_get_vc_num(struct cli_state *cli);
191 uint32_t cli_setpid(struct cli_state *cli, uint32_t pid);
192 uint32_t cli_getpid(struct cli_state *cli);
193 bool cli_state_has_tcon(struct cli_state *cli);
194 uint32_t cli_state_get_tid(struct cli_state *cli);
195 uint32_t cli_state_set_tid(struct cli_state *cli, uint32_t tid);
197 struct smbXcli_tcon *cli_state_save_tcon(struct cli_state *cli);
198 void cli_state_restore_tcon(struct cli_state *cli, struct smbXcli_tcon *tcon);
199 uint16_t cli_state_get_uid(struct cli_state *cli);
200 uint16_t cli_state_set_uid(struct cli_state *cli, uint16_t uid);
201 bool cli_set_case_sensitive(struct cli_state *cli, bool case_sensitive);
202 uint32_t cli_state_available_size(struct cli_state *cli, uint32_t ofs);
203 time_t cli_state_server_time(struct cli_state *cli);
204 struct tevent_req *cli_echo_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
205 struct cli_state *cli, uint16_t num_echos,
207 NTSTATUS cli_echo_recv(struct tevent_req *req);
208 NTSTATUS cli_echo(struct cli_state *cli, uint16_t num_echos, DATA_BLOB data);
209 bool is_andx_req(uint8_t cmd);
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 const char *cli_errstr(struct cli_state *cli);
221 NTSTATUS cli_nt_error(struct cli_state *cli);
222 void cli_dos_error(struct cli_state *cli, uint8_t *eclass, uint32_t *ecode);
223 int cli_errno(struct cli_state *cli);
224 bool cli_is_error(struct cli_state *cli);
225 bool cli_is_nt_error(struct cli_state *cli);
226 bool cli_is_dos_error(struct cli_state *cli);
227 bool cli_state_is_connected(struct cli_state *cli);
229 /* The following definitions come from libsmb/clifile.c */
231 struct tevent_req *cli_setpathinfo_send(TALLOC_CTX *mem_ctx,
232 struct tevent_context *ev,
233 struct cli_state *cli,
238 NTSTATUS cli_setpathinfo_recv(struct tevent_req *req);
239 NTSTATUS cli_setpathinfo(struct cli_state *cli,
245 struct tevent_req *cli_posix_symlink_send(TALLOC_CTX *mem_ctx,
246 struct tevent_context *ev,
247 struct cli_state *cli,
249 const char *newname);
250 NTSTATUS cli_posix_symlink_recv(struct tevent_req *req);
251 NTSTATUS cli_posix_symlink(struct cli_state *cli,
253 const char *newname);
254 struct tevent_req *cli_posix_readlink_send(TALLOC_CTX *mem_ctx,
255 struct tevent_context *ev,
256 struct cli_state *cli,
259 NTSTATUS cli_posix_readlink_recv(struct tevent_req *req, struct cli_state *cli,
260 char *retpath, size_t len);
261 NTSTATUS cli_posix_readlink(struct cli_state *cli, const char *fname,
262 char *linkpath, size_t len);
263 struct tevent_req *cli_posix_hardlink_send(TALLOC_CTX *mem_ctx,
264 struct tevent_context *ev,
265 struct cli_state *cli,
267 const char *newname);
268 NTSTATUS cli_posix_hardlink_recv(struct tevent_req *req);
269 NTSTATUS cli_posix_hardlink(struct cli_state *cli,
271 const char *newname);
272 uint32_t unix_perms_to_wire(mode_t perms);
273 mode_t wire_perms_to_unix(uint32_t perms);
274 struct tevent_req *cli_posix_getacl_send(TALLOC_CTX *mem_ctx,
275 struct tevent_context *ev,
276 struct cli_state *cli,
278 NTSTATUS cli_posix_getacl_recv(struct tevent_req *req,
282 NTSTATUS cli_posix_getacl(struct cli_state *cli,
287 struct tevent_req *cli_posix_setacl_send(TALLOC_CTX *mem_ctx,
288 struct tevent_context *ev,
289 struct cli_state *cli,
292 size_t acl_buf_size);
293 NTSTATUS cli_posix_setacl_recv(struct tevent_req *req);
294 NTSTATUS cli_posix_setacl(struct cli_state *cli,
297 size_t acl_buf_size);
298 struct tevent_req *cli_posix_stat_send(TALLOC_CTX *mem_ctx,
299 struct tevent_context *ev,
300 struct cli_state *cli,
302 NTSTATUS cli_posix_stat_recv(struct tevent_req *req,
303 SMB_STRUCT_STAT *sbuf);
304 NTSTATUS cli_posix_stat(struct cli_state *cli,
306 SMB_STRUCT_STAT *sbuf);
307 struct tevent_req *cli_posix_chmod_send(TALLOC_CTX *mem_ctx,
308 struct tevent_context *ev,
309 struct cli_state *cli,
312 NTSTATUS cli_posix_chmod_recv(struct tevent_req *req);
313 NTSTATUS cli_posix_chmod(struct cli_state *cli, const char *fname, mode_t mode);
314 struct tevent_req *cli_posix_chown_send(TALLOC_CTX *mem_ctx,
315 struct tevent_context *ev,
316 struct cli_state *cli,
320 NTSTATUS cli_posix_chown_recv(struct tevent_req *req);
321 NTSTATUS cli_posix_chown(struct cli_state *cli,
325 struct tevent_req *cli_rename_send(TALLOC_CTX *mem_ctx,
326 struct tevent_context *ev,
327 struct cli_state *cli,
328 const char *fname_src,
329 const char *fname_dst,
331 NTSTATUS cli_rename_recv(struct tevent_req *req);
332 NTSTATUS cli_rename(struct cli_state *cli,
333 const char *fname_src,
334 const char *fname_dst,
336 struct tevent_req *cli_ntrename_send(TALLOC_CTX *mem_ctx,
337 struct tevent_context *ev,
338 struct cli_state *cli,
339 const char *fname_src,
340 const char *fname_dst);
341 NTSTATUS cli_ntrename_recv(struct tevent_req *req);
342 NTSTATUS cli_ntrename(struct cli_state *cli, const char *fname_src, const char *fname_dst);
344 struct tevent_req *cli_nt_hardlink_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);
349 NTSTATUS cli_nt_hardlink_recv(struct tevent_req *req);
350 NTSTATUS cli_nt_hardlink(struct cli_state *cli, const char *fname_src, const char *fname_dst);
352 struct tevent_req *cli_unlink_send(TALLOC_CTX *mem_ctx,
353 struct tevent_context *ev,
354 struct cli_state *cli,
356 uint16_t mayhave_attrs);
357 NTSTATUS cli_unlink_recv(struct tevent_req *req);
358 NTSTATUS cli_unlink(struct cli_state *cli, const char *fname, uint16_t mayhave_attrs);
360 struct tevent_req *cli_mkdir_send(TALLOC_CTX *mem_ctx,
361 struct tevent_context *ev,
362 struct cli_state *cli,
364 NTSTATUS cli_mkdir_recv(struct tevent_req *req);
365 NTSTATUS cli_mkdir(struct cli_state *cli, const char *dname);
366 struct tevent_req *cli_rmdir_send(TALLOC_CTX *mem_ctx,
367 struct tevent_context *ev,
368 struct cli_state *cli,
370 NTSTATUS cli_rmdir_recv(struct tevent_req *req);
371 NTSTATUS cli_rmdir(struct cli_state *cli, const char *dname);
372 struct tevent_req *cli_nt_delete_on_close_send(TALLOC_CTX *mem_ctx,
373 struct tevent_context *ev,
374 struct cli_state *cli,
377 NTSTATUS cli_nt_delete_on_close_recv(struct tevent_req *req);
378 NTSTATUS cli_nt_delete_on_close(struct cli_state *cli, uint16_t fnum, bool flag);
379 struct tevent_req *cli_ntcreate_send(TALLOC_CTX *mem_ctx,
380 struct tevent_context *ev,
381 struct cli_state *cli,
384 uint32_t DesiredAccess,
385 uint32_t FileAttributes,
386 uint32_t ShareAccess,
387 uint32_t CreateDisposition,
388 uint32_t CreateOptions,
389 uint8_t SecurityFlags);
390 NTSTATUS cli_ntcreate_recv(struct tevent_req *req,
392 struct smb_create_returns *cr);
393 NTSTATUS cli_ntcreate(struct cli_state *cli,
396 uint32_t DesiredAccess,
397 uint32_t FileAttributes,
398 uint32_t ShareAccess,
399 uint32_t CreateDisposition,
400 uint32_t CreateOptions,
401 uint8_t SecurityFlags,
403 struct smb_create_returns *cr);
404 struct tevent_req *cli_openx_create(TALLOC_CTX *mem_ctx,
405 struct tevent_context *ev,
406 struct cli_state *cli, const char *fname,
407 int flags, int share_mode,
408 struct tevent_req **psmbreq);
409 struct tevent_req *cli_openx_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
410 struct cli_state *cli, const char *fname,
411 int flags, int share_mode);
412 NTSTATUS cli_openx_recv(struct tevent_req *req, uint16_t *fnum);
413 NTSTATUS cli_openx(struct cli_state *cli, const char *fname, int flags, int share_mode, uint16_t *pfnum);
414 NTSTATUS cli_open(struct cli_state *cli, const char *fname, int flags, int share_mode, uint16_t *pfnum);
415 struct tevent_req *cli_close_create(TALLOC_CTX *mem_ctx,
416 struct tevent_context *ev,
417 struct cli_state *cli, uint16_t fnum,
418 struct tevent_req **psubreq);
419 struct tevent_req *cli_close_send(TALLOC_CTX *mem_ctx,
420 struct tevent_context *ev,
421 struct cli_state *cli, uint16_t fnum);
422 NTSTATUS cli_close_recv(struct tevent_req *req);
423 NTSTATUS cli_close(struct cli_state *cli, uint16_t fnum);
424 struct tevent_req *cli_ftruncate_send(TALLOC_CTX *mem_ctx,
425 struct tevent_context *ev,
426 struct cli_state *cli,
429 NTSTATUS cli_ftruncate_recv(struct tevent_req *req);
430 NTSTATUS cli_ftruncate(struct cli_state *cli, uint16_t fnum, uint64_t size);
431 NTSTATUS cli_locktype(struct cli_state *cli, uint16_t fnum,
432 uint32_t offset, uint32_t len,
433 int timeout, unsigned char locktype);
434 NTSTATUS cli_lock32(struct cli_state *cli, uint16_t fnum, uint32_t offset,
435 uint32_t len, int timeout, enum brl_type lock_type);
436 struct tevent_req *cli_unlock_send(TALLOC_CTX *mem_ctx,
437 struct tevent_context *ev,
438 struct cli_state *cli,
442 NTSTATUS cli_unlock_recv(struct tevent_req *req);
443 NTSTATUS cli_unlock(struct cli_state *cli, uint16_t fnum, uint32_t offset, uint32_t len);
444 NTSTATUS cli_lock64(struct cli_state *cli, uint16_t fnum,
445 uint64_t offset, uint64_t len, int timeout,
446 enum brl_type lock_type);
447 struct tevent_req *cli_unlock64_send(TALLOC_CTX *mem_ctx,
448 struct tevent_context *ev,
449 struct cli_state *cli,
453 NTSTATUS cli_unlock64_recv(struct tevent_req *req);
454 NTSTATUS cli_unlock64(struct cli_state *cli, uint16_t fnum, uint64_t offset, uint64_t len);
455 struct tevent_req *cli_posix_lock_send(TALLOC_CTX *mem_ctx,
456 struct tevent_context *ev,
457 struct cli_state *cli,
462 enum brl_type lock_type);
463 NTSTATUS cli_posix_lock_recv(struct tevent_req *req);
464 NTSTATUS cli_posix_lock(struct cli_state *cli, uint16_t fnum,
465 uint64_t offset, uint64_t len,
466 bool wait_lock, enum brl_type lock_type);
467 struct tevent_req *cli_posix_unlock_send(TALLOC_CTX *mem_ctx,
468 struct tevent_context *ev,
469 struct cli_state *cli,
473 NTSTATUS cli_posix_unlock_recv(struct tevent_req *req);
474 NTSTATUS cli_posix_unlock(struct cli_state *cli, uint16_t fnum, uint64_t offset, uint64_t len);
475 struct tevent_req *cli_getattrE_send(TALLOC_CTX *mem_ctx,
476 struct tevent_context *ev,
477 struct cli_state *cli,
479 NTSTATUS cli_getattrE_recv(struct tevent_req *req,
485 NTSTATUS cli_getattrE(struct cli_state *cli,
492 struct tevent_req *cli_setattrE_send(TALLOC_CTX *mem_ctx,
493 struct tevent_context *ev,
494 struct cli_state *cli,
499 NTSTATUS cli_setattrE_recv(struct tevent_req *req);
500 NTSTATUS cli_setattrE(struct cli_state *cli,
505 struct tevent_req *cli_getatr_send(TALLOC_CTX *mem_ctx,
506 struct tevent_context *ev,
507 struct cli_state *cli,
509 NTSTATUS cli_getatr_recv(struct tevent_req *req,
513 NTSTATUS cli_getatr(struct cli_state *cli,
518 struct tevent_req *cli_setatr_send(TALLOC_CTX *mem_ctx,
519 struct tevent_context *ev,
520 struct cli_state *cli,
524 NTSTATUS cli_setatr_recv(struct tevent_req *req);
525 NTSTATUS cli_setatr(struct cli_state *cli,
529 struct tevent_req *cli_chkpath_send(TALLOC_CTX *mem_ctx,
530 struct tevent_context *ev,
531 struct cli_state *cli,
533 NTSTATUS cli_chkpath_recv(struct tevent_req *req);
534 NTSTATUS cli_chkpath(struct cli_state *cli, const char *path);
535 struct tevent_req *cli_dskattr_send(TALLOC_CTX *mem_ctx,
536 struct tevent_context *ev,
537 struct cli_state *cli);
538 NTSTATUS cli_dskattr_recv(struct tevent_req *req, int *bsize, int *total,
540 NTSTATUS cli_dskattr(struct cli_state *cli, int *bsize, int *total, int *avail);
541 NTSTATUS cli_disk_size(struct cli_state *cli, const char *path, uint64_t *bsize,
542 uint64_t *total, uint64_t *avail);
543 struct tevent_req *cli_ctemp_send(TALLOC_CTX *mem_ctx,
544 struct tevent_context *ev,
545 struct cli_state *cli,
547 NTSTATUS cli_ctemp_recv(struct tevent_req *req,
551 NTSTATUS cli_ctemp(struct cli_state *cli,
556 NTSTATUS cli_raw_ioctl(struct cli_state *cli, uint16_t fnum, uint32_t code, DATA_BLOB *blob);
557 NTSTATUS cli_set_ea_path(struct cli_state *cli, const char *path,
558 const char *ea_name, const char *ea_val,
560 NTSTATUS cli_set_ea_fnum(struct cli_state *cli, uint16_t fnum,
561 const char *ea_name, const char *ea_val,
563 struct tevent_req *cli_get_ea_list_path_send(TALLOC_CTX *mem_ctx,
564 struct tevent_context *ev,
565 struct cli_state *cli,
567 NTSTATUS cli_get_ea_list_path_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
568 size_t *pnum_eas, struct ea_struct **peas);
569 NTSTATUS cli_get_ea_list_path(struct cli_state *cli, const char *path,
572 struct ea_struct **pea_list);
573 struct tevent_req *cli_posix_open_send(TALLOC_CTX *mem_ctx,
574 struct tevent_context *ev,
575 struct cli_state *cli,
579 NTSTATUS cli_posix_open_recv(struct tevent_req *req, uint16_t *pfnum);
580 NTSTATUS cli_posix_open(struct cli_state *cli, const char *fname,
581 int flags, mode_t mode, uint16_t *fnum);
582 struct tevent_req *cli_posix_mkdir_send(TALLOC_CTX *mem_ctx,
583 struct tevent_context *ev,
584 struct cli_state *cli,
587 NTSTATUS cli_posix_mkdir_recv(struct tevent_req *req);
588 NTSTATUS cli_posix_mkdir(struct cli_state *cli, const char *fname, mode_t mode);
590 struct tevent_req *cli_posix_unlink_send(TALLOC_CTX *mem_ctx,
591 struct tevent_context *ev,
592 struct cli_state *cli,
594 NTSTATUS cli_posix_unlink_recv(struct tevent_req *req);
595 NTSTATUS cli_posix_unlink(struct cli_state *cli, const char *fname);
597 struct tevent_req *cli_posix_rmdir_send(TALLOC_CTX *mem_ctx,
598 struct tevent_context *ev,
599 struct cli_state *cli,
601 NTSTATUS cli_posix_rmdir_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx);
602 NTSTATUS cli_posix_rmdir(struct cli_state *cli, const char *fname);
603 struct tevent_req *cli_notify_send(TALLOC_CTX *mem_ctx,
604 struct tevent_context *ev,
605 struct cli_state *cli, uint16_t fnum,
606 uint32_t buffer_size,
607 uint32_t completion_filter, bool recursive);
608 NTSTATUS cli_notify_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
609 uint32_t *pnum_changes,
610 struct notify_change **pchanges);
611 NTSTATUS cli_notify(struct cli_state *cli, uint16_t fnum, uint32_t buffer_size,
612 uint32_t completion_filter, bool recursive,
613 TALLOC_CTX *mem_ctx, uint32_t *pnum_changes,
614 struct notify_change **pchanges);
616 struct tevent_req *cli_nttrans_create_send(TALLOC_CTX *mem_ctx,
617 struct tevent_context *ev,
618 struct cli_state *cli,
621 uint32_t DesiredAccess,
622 uint32_t FileAttributes,
623 uint32_t ShareAccess,
624 uint32_t CreateDisposition,
625 uint32_t CreateOptions,
626 uint8_t SecurityFlags,
627 struct security_descriptor *secdesc,
628 struct ea_struct *eas,
630 NTSTATUS cli_nttrans_create_recv(struct tevent_req *req,
632 struct smb_create_returns *cr);
633 NTSTATUS cli_nttrans_create(struct cli_state *cli,
636 uint32_t DesiredAccess,
637 uint32_t FileAttributes,
638 uint32_t ShareAccess,
639 uint32_t CreateDisposition,
640 uint32_t CreateOptions,
641 uint8_t SecurityFlags,
642 struct security_descriptor *secdesc,
643 struct ea_struct *eas,
646 struct smb_create_returns *cr);
648 /* The following definitions come from libsmb/clifsinfo.c */
650 struct tevent_req *cli_unix_extensions_version_send(TALLOC_CTX *mem_ctx,
651 struct tevent_context *ev,
652 struct cli_state *cli);
653 NTSTATUS cli_unix_extensions_version_recv(struct tevent_req *req,
654 uint16_t *pmajor, uint16_t *pminor,
657 NTSTATUS cli_unix_extensions_version(struct cli_state *cli, uint16_t *pmajor,
658 uint16_t *pminor, uint32_t *pcaplow,
660 struct tevent_req *cli_set_unix_extensions_capabilities_send(
661 TALLOC_CTX *mem_ctx, struct tevent_context *ev, struct cli_state *cli,
662 uint16_t major, uint16_t minor, uint32_t caplow, uint32_t caphigh);
663 NTSTATUS cli_set_unix_extensions_capabilities_recv(struct tevent_req *req);
664 NTSTATUS cli_set_unix_extensions_capabilities(struct cli_state *cli,
665 uint16_t major, uint16_t minor,
666 uint32_t caplow, uint32_t caphigh);
667 struct tevent_req *cli_get_fs_attr_info_send(TALLOC_CTX *mem_ctx,
668 struct tevent_context *ev,
669 struct cli_state *cli);
670 NTSTATUS cli_get_fs_attr_info_recv(struct tevent_req *req, uint32_t *fs_attr);
671 NTSTATUS cli_get_fs_attr_info(struct cli_state *cli, uint32_t *fs_attr);
672 NTSTATUS cli_get_fs_volume_info(struct cli_state *cli,
673 TALLOC_CTX *mem_ctx, char **volume_name,
674 uint32_t *pserial_number, time_t *pdate);
675 NTSTATUS cli_get_fs_full_size_info(struct cli_state *cli,
676 uint64_t *total_allocation_units,
677 uint64_t *caller_allocation_units,
678 uint64_t *actual_allocation_units,
679 uint64_t *sectors_per_allocation_unit,
680 uint64_t *bytes_per_sector);
681 NTSTATUS cli_get_posix_fs_info(struct cli_state *cli,
682 uint32_t *optimal_transfer_size,
683 uint32_t *block_size,
684 uint64_t *total_blocks,
685 uint64_t *blocks_available,
686 uint64_t *user_blocks_available,
687 uint64_t *total_file_nodes,
688 uint64_t *free_file_nodes,
689 uint64_t *fs_identifier);
690 struct tevent_req *cli_posix_whoami_send(TALLOC_CTX *mem_ctx,
691 struct tevent_context *ev,
692 struct cli_state *cli);
693 NTSTATUS cli_posix_whoami_recv(struct tevent_req *req,
700 struct dom_sid **psids,
702 NTSTATUS cli_posix_whoami(struct cli_state *cli,
709 struct dom_sid **sids,
712 /* The following definitions come from libsmb/clilist.c */
714 NTSTATUS cli_list_old(struct cli_state *cli,const char *Mask,uint16_t attribute,
715 NTSTATUS (*fn)(const char *, struct file_info *,
716 const char *, void *), void *state);
717 NTSTATUS cli_list_trans(struct cli_state *cli, const char *mask,
718 uint16_t attribute, int info_level,
719 NTSTATUS (*fn)(const char *mnt, struct file_info *finfo,
720 const char *mask, void *private_data),
722 struct tevent_req *cli_list_send(TALLOC_CTX *mem_ctx,
723 struct tevent_context *ev,
724 struct cli_state *cli,
727 uint16_t info_level);
728 NTSTATUS cli_list_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
729 struct file_info **finfo, size_t *num_finfo);
730 NTSTATUS cli_list(struct cli_state *cli,const char *Mask,uint16_t attribute,
731 NTSTATUS (*fn)(const char *, struct file_info *, const char *,
732 void *), void *state);
734 /* The following definitions come from libsmb/climessage.c */
736 struct tevent_req *cli_message_send(TALLOC_CTX *mem_ctx,
737 struct tevent_context *ev,
738 struct cli_state *cli,
739 const char *host, const char *username,
740 const char *message);
741 NTSTATUS cli_message_recv(struct tevent_req *req);
742 NTSTATUS cli_message(struct cli_state *cli, const char *host,
743 const char *username, const char *message);
745 /* The following definitions come from libsmb/clioplock.c */
747 struct tevent_req *cli_smb_oplock_break_waiter_send(TALLOC_CTX *mem_ctx,
748 struct tevent_context *ev,
749 struct cli_state *cli);
750 NTSTATUS cli_smb_oplock_break_waiter_recv(struct tevent_req *req,
754 struct tevent_req *cli_oplock_ack_send(TALLOC_CTX *mem_ctx,
755 struct tevent_context *ev,
756 struct cli_state *cli,
757 uint16_t fnum, uint8_t level);
758 NTSTATUS cli_oplock_ack_recv(struct tevent_req *req);
760 /* The following definitions come from libsmb/cliprint.c */
762 int cli_print_queue(struct cli_state *cli,
763 void (*fn)(struct print_job_info *));
764 int cli_printjob_del(struct cli_state *cli, int job);
766 /* The following definitions come from libsmb/cliquota.c */
768 NTSTATUS cli_get_quota_handle(struct cli_state *cli, uint16_t *quota_fnum);
769 void free_ntquota_list(SMB_NTQUOTA_LIST **qt_list);
770 bool parse_user_quota_record(const uint8_t *rdata,
771 unsigned int rdata_count,
772 unsigned int *offset,
773 SMB_NTQUOTA_STRUCT *pqt);
774 bool add_record_to_ntquota_list(TALLOC_CTX *mem_ctx,
775 SMB_NTQUOTA_STRUCT *pqt,
776 SMB_NTQUOTA_LIST **pqt_list);
777 NTSTATUS parse_user_quota_list(const uint8_t *curdata,
778 uint32_t curdata_size,
780 SMB_NTQUOTA_LIST **pqt_list);
781 NTSTATUS parse_fs_quota_buffer(const uint8_t *rdata,
782 unsigned int rdata_count,
783 SMB_NTQUOTA_STRUCT *pqt);
784 NTSTATUS build_user_quota_buffer(SMB_NTQUOTA_LIST *qt_list,
788 SMB_NTQUOTA_LIST **end_ptr);
789 NTSTATUS build_fs_quota_buffer(TALLOC_CTX *mem_ctx,
790 const SMB_NTQUOTA_STRUCT *pqt,
793 NTSTATUS cli_get_user_quota(struct cli_state *cli, int quota_fnum,
794 SMB_NTQUOTA_STRUCT *pqt);
795 NTSTATUS cli_set_user_quota(struct cli_state *cli,
797 SMB_NTQUOTA_LIST *qtl);
798 NTSTATUS cli_list_user_quota(struct cli_state *cli, int quota_fnum,
799 SMB_NTQUOTA_LIST **pqt_list);
800 NTSTATUS cli_get_fs_quota_info(struct cli_state *cli, int quota_fnum,
801 SMB_NTQUOTA_STRUCT *pqt);
802 NTSTATUS cli_set_fs_quota_info(struct cli_state *cli, int quota_fnum,
803 SMB_NTQUOTA_STRUCT *pqt);
805 /* The following definitions come from libsmb/clireadwrite.c */
807 struct tevent_req *cli_read_andx_create(TALLOC_CTX *mem_ctx,
808 struct tevent_context *ev,
809 struct cli_state *cli, uint16_t fnum,
810 off_t offset, size_t size,
811 struct tevent_req **psmbreq);
812 struct tevent_req *cli_read_andx_send(TALLOC_CTX *mem_ctx,
813 struct tevent_context *ev,
814 struct cli_state *cli, uint16_t fnum,
815 off_t offset, size_t size);
816 NTSTATUS cli_read_andx_recv(struct tevent_req *req, ssize_t *received,
818 struct tevent_req *cli_pull_send(TALLOC_CTX *mem_ctx,
819 struct tevent_context *ev,
820 struct cli_state *cli,
821 uint16_t fnum, off_t start_offset,
822 off_t size, size_t window_size,
823 NTSTATUS (*sink)(char *buf, size_t n,
826 NTSTATUS cli_pull_recv(struct tevent_req *req, off_t *received);
827 NTSTATUS cli_pull(struct cli_state *cli, uint16_t fnum,
828 off_t start_offset, off_t size, size_t window_size,
829 NTSTATUS (*sink)(char *buf, size_t n, void *priv),
830 void *priv, off_t *received);
831 NTSTATUS cli_read(struct cli_state *cli, uint16_t fnum,
832 char *buf, off_t offset, size_t size,
834 NTSTATUS cli_smbwrite(struct cli_state *cli, uint16_t fnum, char *buf,
835 off_t offset, size_t size1, size_t *ptotal);
836 struct tevent_req *cli_write_andx_create(TALLOC_CTX *mem_ctx,
837 struct tevent_context *ev,
838 struct cli_state *cli, uint16_t fnum,
839 uint16_t mode, const uint8_t *buf,
840 off_t offset, size_t size,
841 struct tevent_req **reqs_before,
843 struct tevent_req **psmbreq);
844 struct tevent_req *cli_write_andx_send(TALLOC_CTX *mem_ctx,
845 struct tevent_context *ev,
846 struct cli_state *cli, uint16_t fnum,
847 uint16_t mode, const uint8_t *buf,
848 off_t offset, size_t size);
849 NTSTATUS cli_write_andx_recv(struct tevent_req *req, size_t *pwritten);
851 NTSTATUS cli_writeall(struct cli_state *cli, uint16_t fnum, uint16_t mode,
852 const uint8_t *buf, off_t offset, size_t size,
855 struct tevent_req *cli_push_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
856 struct cli_state *cli,
857 uint16_t fnum, uint16_t mode,
858 off_t start_offset, size_t window_size,
859 size_t (*source)(uint8_t *buf, size_t n,
862 NTSTATUS cli_push_recv(struct tevent_req *req);
863 NTSTATUS cli_push(struct cli_state *cli, uint16_t fnum, uint16_t mode,
864 off_t start_offset, size_t window_size,
865 size_t (*source)(uint8_t *buf, size_t n, void *priv),
868 NTSTATUS cli_splice(struct cli_state *srccli, struct cli_state *dstcli,
869 uint16_t src_fnum, uint16_t dst_fnum,
871 off_t src_offset, off_t dst_offset,
873 int (*splice_cb)(off_t n, void *priv), void *priv);
875 /* The following definitions come from libsmb/clisecdesc.c */
877 NTSTATUS cli_query_security_descriptor(struct cli_state *cli,
881 struct security_descriptor **sd);
882 NTSTATUS cli_query_secdesc(struct cli_state *cli, uint16_t fnum,
883 TALLOC_CTX *mem_ctx, struct security_descriptor **sd);
884 NTSTATUS cli_set_security_descriptor(struct cli_state *cli,
887 const struct security_descriptor *sd);
888 NTSTATUS cli_set_secdesc(struct cli_state *cli, uint16_t fnum,
889 const struct security_descriptor *sd);
891 /* The following definitions come from libsmb/clistr.c */
893 size_t clistr_pull_talloc(TALLOC_CTX *ctx,
900 bool clistr_is_previous_version_path(const char *path,
905 /* The following definitions come from libsmb/clitrans.c */
907 struct tevent_req *cli_trans_send(
908 TALLOC_CTX *mem_ctx, struct tevent_context *ev,
909 struct cli_state *cli, uint16_t additional_flags2, uint8_t cmd,
910 const char *pipe_name, uint16_t fid, uint16_t function, int flags,
911 uint16_t *setup, uint8_t num_setup, uint8_t max_setup,
912 uint8_t *param, uint32_t num_param, uint32_t max_param,
913 uint8_t *data, uint32_t num_data, uint32_t max_data);
914 NTSTATUS cli_trans_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
915 uint16_t *recv_flags2,
916 uint16_t **setup, uint8_t min_setup,
918 uint8_t **param, uint32_t min_param,
920 uint8_t **data, uint32_t min_data,
922 NTSTATUS cli_trans(TALLOC_CTX *mem_ctx, struct cli_state *cli,
924 const char *pipe_name, uint16_t fid, uint16_t function,
926 uint16_t *setup, uint8_t num_setup, uint8_t max_setup,
927 uint8_t *param, uint32_t num_param, uint32_t max_param,
928 uint8_t *data, uint32_t num_data, uint32_t max_data,
929 uint16_t *recv_flags2,
930 uint16_t **rsetup, uint8_t min_rsetup, uint8_t *num_rsetup,
931 uint8_t **rparam, uint32_t min_rparam, uint32_t *num_rparam,
932 uint8_t **rdata, uint32_t min_rdata, uint32_t *num_rdata);
934 /* The following definitions come from libsmb/reparse_symlink.c */
936 bool symlink_reparse_buffer_marshall(
937 const char *substitute, const char *printname, uint32_t flags,
938 TALLOC_CTX *mem_ctx, uint8_t **pdst, size_t *pdstlen);
939 bool symlink_reparse_buffer_parse(
940 const uint8_t *src, size_t srclen, TALLOC_CTX *mem_ctx,
941 char **psubstitute_name, char **pprint_name, uint32_t *pflags);
943 /* The following definitions come from libsmb/clisymlink.c */
945 struct tevent_req *cli_symlink_send(TALLOC_CTX *mem_ctx,
946 struct tevent_context *ev,
947 struct cli_state *cli,
951 NTSTATUS cli_symlink_recv(struct tevent_req *req);
952 NTSTATUS cli_symlink(struct cli_state *cli, const char *oldname,
953 const char *newname, uint32_t flags);
955 struct tevent_req *cli_readlink_send(TALLOC_CTX *mem_ctx,
956 struct tevent_context *ev,
957 struct cli_state *cli,
959 NTSTATUS cli_readlink_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
960 char **psubstitute_name, char **pprint_name,
962 NTSTATUS cli_readlink(struct cli_state *cli, const char *fname,
963 TALLOC_CTX *mem_ctx, char **psubstitute_name,
964 char **pprint_name, uint32_t *pflags);
966 #endif /* _LIBSMB_PROTO_H_ */