2 Unix SMB/CIFS implementation.
4 Copyright (C) Andrew Bartlett 2001-2003
5 Copyright (C) Andrew Tridgell 1994-1998,2000-2001
6 Copyright (C) Gerald (Jerry) Carter 2004
7 Copyright (C) Jelmer Vernooij 2003
8 Copyright (C) Jeremy Allison 2001-2009,2011
9 Copyright (C) Stefan Metzmacher 2003,2009
10 Copyright (C) Volker Lendecke 2011
12 This program is free software; you can redistribute it and/or modify
13 it under the terms of the GNU General Public License as published by
14 the Free Software Foundation; either version 3 of the License, or
15 (at your option) any later version.
17 This program is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License for more details.
22 You should have received a copy of the GNU General Public License
23 along with this program. If not, see <http://www.gnu.org/licenses/>.
26 #ifndef _LIBSMB_PROTO_H_
27 #define _LIBSMB_PROTO_H_
30 #include "auth_info.h"
32 struct smb_trans_enc_state;
33 struct cli_credentials;
35 /* The following definitions come from libsmb/cliconnect.c */
37 struct cli_credentials *cli_session_creds_init(TALLOC_CTX *mem_ctx,
43 bool fallback_after_kerberos,
45 bool password_is_nt_hash);
46 NTSTATUS cli_session_creds_prepare_krb5(struct cli_state *cli,
47 struct cli_credentials *creds);
48 struct tevent_req *cli_session_setup_creds_send(TALLOC_CTX *mem_ctx,
49 struct tevent_context *ev,
50 struct cli_state *cli,
51 struct cli_credentials *creds);
52 NTSTATUS cli_session_setup_creds_recv(struct tevent_req *req);
53 NTSTATUS cli_session_setup_creds(struct cli_state *cli,
54 struct cli_credentials *creds);
55 NTSTATUS cli_session_setup_anon(struct cli_state *cli);
56 struct tevent_req *cli_session_setup_guest_create(TALLOC_CTX *mem_ctx,
57 struct tevent_context *ev,
58 struct cli_state *cli,
59 struct tevent_req **psmbreq);
60 struct tevent_req *cli_session_setup_guest_send(TALLOC_CTX *mem_ctx,
61 struct tevent_context *ev,
62 struct cli_state *cli);
63 NTSTATUS cli_session_setup_guest_recv(struct tevent_req *req);
64 NTSTATUS cli_ulogoff(struct cli_state *cli);
65 struct tevent_req *cli_tcon_andx_create(TALLOC_CTX *mem_ctx,
66 struct tevent_context *ev,
67 struct cli_state *cli,
68 const char *share, const char *dev,
69 const char *pass, int passlen,
70 struct tevent_req **psmbreq);
71 struct tevent_req *cli_tcon_andx_send(TALLOC_CTX *mem_ctx,
72 struct tevent_context *ev,
73 struct cli_state *cli,
74 const char *share, const char *dev,
75 const char *pass, int passlen);
76 NTSTATUS cli_tcon_andx_recv(struct tevent_req *req);
77 NTSTATUS cli_tcon_andx(struct cli_state *cli, const char *share,
78 const char *dev, const char *pass, int passlen);
79 NTSTATUS cli_tree_connect_creds(struct cli_state *cli,
80 const char *share, const char *dev,
81 struct cli_credentials *creds);
82 NTSTATUS cli_tree_connect(struct cli_state *cli, const char *share,
83 const char *dev, const char *pass);
84 NTSTATUS cli_tdis(struct cli_state *cli);
85 NTSTATUS cli_connect_nb(const char *host, const struct sockaddr_storage *dest_ss,
86 uint16_t port, int name_type, const char *myname,
87 int signing_state, int flags, struct cli_state **pcli);
88 NTSTATUS cli_start_connection(struct cli_state **output_cli,
90 const char *dest_host,
91 const struct sockaddr_storage *dest_ss, int port,
92 int signing_state, int flags);
93 NTSTATUS cli_smb1_setup_encryption(struct cli_state *cli,
94 struct cli_credentials *creds);
95 struct tevent_req *cli_full_connection_creds_send(
96 TALLOC_CTX *mem_ctx, struct tevent_context *ev,
97 const char *my_name, const char *dest_host,
98 const struct sockaddr_storage *dest_ss, int port,
99 const char *service, const char *service_type,
100 struct cli_credentials *creds,
101 int flags, int signing_state);
102 NTSTATUS cli_full_connection_creds_recv(struct tevent_req *req,
103 struct cli_state **output_cli);
104 NTSTATUS cli_full_connection_creds(struct cli_state **output_cli,
106 const char *dest_host,
107 const struct sockaddr_storage *dest_ss, int port,
108 const char *service, const char *service_type,
109 struct cli_credentials *creds,
112 NTSTATUS cli_full_connection(struct cli_state **output_cli,
114 const char *dest_host,
115 const struct sockaddr_storage *dest_ss, int port,
116 const char *service, const char *service_type,
117 const char *user, const char *domain,
118 const char *password, int flags,
120 NTSTATUS cli_raw_tcon(struct cli_state *cli,
121 const char *service, const char *pass, const char *dev,
122 uint16_t *max_xmit, uint16_t *tid);
123 struct cli_state *get_ipc_connect(char *server,
124 struct sockaddr_storage *server_ss,
125 const struct user_auth_info *user_info);
126 struct cli_state *get_ipc_connect_master_ip(TALLOC_CTX *ctx,
127 struct sockaddr_storage *mb_ip,
128 const struct user_auth_info *user_info,
129 char **pp_workgroup_out);
130 struct cli_state *get_ipc_connect_master_ip_bcast(TALLOC_CTX *ctx,
131 const struct user_auth_info *user_info,
132 char **pp_workgroup_out);
134 /* The following definitions come from libsmb/clidfs.c */
136 NTSTATUS cli_cm_force_encryption_creds(struct cli_state *c,
137 struct cli_credentials *creds,
138 const char *sharename);
139 NTSTATUS cli_cm_force_encryption(struct cli_state *c,
140 const char *username,
141 const char *password,
143 const char *sharename);
144 NTSTATUS cli_cm_open(TALLOC_CTX *ctx,
145 struct cli_state *referring_cli,
148 const struct user_auth_info *auth_info,
154 struct cli_state **pcli);
155 void cli_cm_display(struct cli_state *c);
156 struct client_dfs_referral;
157 NTSTATUS cli_dfs_get_referral(TALLOC_CTX *ctx,
158 struct cli_state *cli,
160 struct client_dfs_referral **refs,
163 NTSTATUS cli_resolve_path(TALLOC_CTX *ctx,
165 const struct user_auth_info *dfs_auth_info,
166 struct cli_state *rootcli,
168 struct cli_state **targetcli,
169 char **pp_targetpath);
171 bool cli_check_msdfs_proxy(TALLOC_CTX *ctx,
172 struct cli_state *cli,
173 const char *sharename,
177 struct cli_credentials *creds);
179 /* The following definitions come from libsmb/clientgen.c */
181 int cli_set_message(char *buf,int num_words,int num_bytes,bool zero);
182 unsigned int cli_set_timeout(struct cli_state *cli, unsigned int timeout);
183 bool cli_set_backup_intent(struct cli_state *cli, bool flag);
184 void cli_setup_packet_buf(struct cli_state *cli, char *buf);
185 extern struct GUID cli_state_client_guid;
186 struct cli_state *cli_state_create(TALLOC_CTX *mem_ctx,
188 const char *remote_name,
189 const char *remote_realm,
192 void cli_nt_pipes_close(struct cli_state *cli);
193 void cli_shutdown(struct cli_state *cli);
194 const char *cli_state_remote_realm(struct cli_state *cli);
195 uint16_t cli_state_get_vc_num(struct cli_state *cli);
196 uint32_t cli_setpid(struct cli_state *cli, uint32_t pid);
197 uint32_t cli_getpid(struct cli_state *cli);
198 bool cli_state_has_tcon(struct cli_state *cli);
199 uint16_t cli_state_get_tid(struct cli_state *cli);
200 uint16_t cli_state_set_tid(struct cli_state *cli, uint16_t tid);
201 uint16_t cli_state_get_uid(struct cli_state *cli);
202 uint16_t cli_state_set_uid(struct cli_state *cli, uint16_t uid);
203 bool cli_set_case_sensitive(struct cli_state *cli, bool case_sensitive);
204 uint32_t cli_state_available_size(struct cli_state *cli, uint32_t ofs);
205 time_t cli_state_server_time(struct cli_state *cli);
206 struct tevent_req *cli_echo_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
207 struct cli_state *cli, uint16_t num_echos,
209 NTSTATUS cli_echo_recv(struct tevent_req *req);
210 NTSTATUS cli_echo(struct cli_state *cli, uint16_t num_echos, DATA_BLOB data);
211 bool is_andx_req(uint8_t cmd);
212 NTSTATUS cli_smb(TALLOC_CTX *mem_ctx, struct cli_state *cli,
213 uint8_t smb_command, uint8_t additional_flags,
214 uint8_t wct, uint16_t *vwv,
215 uint32_t num_bytes, const uint8_t *bytes,
216 struct tevent_req **result_parent,
217 uint8_t min_wct, uint8_t *pwct, uint16_t **pvwv,
218 uint32_t *pnum_bytes, uint8_t **pbytes);
220 /* The following definitions come from libsmb/clierror.c */
222 const char *cli_errstr(struct cli_state *cli);
223 NTSTATUS cli_nt_error(struct cli_state *cli);
224 void cli_dos_error(struct cli_state *cli, uint8_t *eclass, uint32_t *ecode);
225 int cli_errno(struct cli_state *cli);
226 bool cli_is_error(struct cli_state *cli);
227 bool cli_is_nt_error(struct cli_state *cli);
228 bool cli_is_dos_error(struct cli_state *cli);
229 bool cli_state_is_connected(struct cli_state *cli);
231 /* The following definitions come from libsmb/clifile.c */
233 struct tevent_req *cli_setpathinfo_send(TALLOC_CTX *mem_ctx,
234 struct tevent_context *ev,
235 struct cli_state *cli,
240 NTSTATUS cli_setpathinfo_recv(struct tevent_req *req);
241 NTSTATUS cli_setpathinfo(struct cli_state *cli,
247 struct tevent_req *cli_posix_symlink_send(TALLOC_CTX *mem_ctx,
248 struct tevent_context *ev,
249 struct cli_state *cli,
251 const char *newname);
252 NTSTATUS cli_posix_symlink_recv(struct tevent_req *req);
253 NTSTATUS cli_posix_symlink(struct cli_state *cli,
255 const char *newname);
256 struct tevent_req *cli_posix_readlink_send(TALLOC_CTX *mem_ctx,
257 struct tevent_context *ev,
258 struct cli_state *cli,
261 NTSTATUS cli_posix_readlink_recv(struct tevent_req *req, struct cli_state *cli,
262 char *retpath, size_t len);
263 NTSTATUS cli_posix_readlink(struct cli_state *cli, const char *fname,
264 char *linkpath, size_t len);
265 struct tevent_req *cli_posix_hardlink_send(TALLOC_CTX *mem_ctx,
266 struct tevent_context *ev,
267 struct cli_state *cli,
269 const char *newname);
270 NTSTATUS cli_posix_hardlink_recv(struct tevent_req *req);
271 NTSTATUS cli_posix_hardlink(struct cli_state *cli,
273 const char *newname);
274 uint32_t unix_perms_to_wire(mode_t perms);
275 mode_t wire_perms_to_unix(uint32_t perms);
276 struct tevent_req *cli_posix_getacl_send(TALLOC_CTX *mem_ctx,
277 struct tevent_context *ev,
278 struct cli_state *cli,
280 NTSTATUS cli_posix_getacl_recv(struct tevent_req *req,
284 NTSTATUS cli_posix_getacl(struct cli_state *cli,
289 struct tevent_req *cli_posix_setacl_send(TALLOC_CTX *mem_ctx,
290 struct tevent_context *ev,
291 struct cli_state *cli,
294 size_t acl_buf_size);
295 NTSTATUS cli_posix_setacl_recv(struct tevent_req *req);
296 NTSTATUS cli_posix_setacl(struct cli_state *cli,
299 size_t acl_buf_size);
300 struct tevent_req *cli_posix_stat_send(TALLOC_CTX *mem_ctx,
301 struct tevent_context *ev,
302 struct cli_state *cli,
304 NTSTATUS cli_posix_stat_recv(struct tevent_req *req,
305 SMB_STRUCT_STAT *sbuf);
306 NTSTATUS cli_posix_stat(struct cli_state *cli,
308 SMB_STRUCT_STAT *sbuf);
309 struct tevent_req *cli_posix_chmod_send(TALLOC_CTX *mem_ctx,
310 struct tevent_context *ev,
311 struct cli_state *cli,
314 NTSTATUS cli_posix_chmod_recv(struct tevent_req *req);
315 NTSTATUS cli_posix_chmod(struct cli_state *cli, const char *fname, mode_t mode);
316 struct tevent_req *cli_posix_chown_send(TALLOC_CTX *mem_ctx,
317 struct tevent_context *ev,
318 struct cli_state *cli,
322 NTSTATUS cli_posix_chown_recv(struct tevent_req *req);
323 NTSTATUS cli_posix_chown(struct cli_state *cli,
327 struct tevent_req *cli_rename_send(TALLOC_CTX *mem_ctx,
328 struct tevent_context *ev,
329 struct cli_state *cli,
330 const char *fname_src,
331 const char *fname_dst,
333 NTSTATUS cli_rename_recv(struct tevent_req *req);
334 NTSTATUS cli_rename(struct cli_state *cli,
335 const char *fname_src,
336 const char *fname_dst,
338 struct tevent_req *cli_ntrename_send(TALLOC_CTX *mem_ctx,
339 struct tevent_context *ev,
340 struct cli_state *cli,
341 const char *fname_src,
342 const char *fname_dst);
343 NTSTATUS cli_ntrename_recv(struct tevent_req *req);
344 NTSTATUS cli_ntrename(struct cli_state *cli, const char *fname_src, const char *fname_dst);
346 struct tevent_req *cli_nt_hardlink_send(TALLOC_CTX *mem_ctx,
347 struct tevent_context *ev,
348 struct cli_state *cli,
349 const char *fname_src,
350 const char *fname_dst);
351 NTSTATUS cli_nt_hardlink_recv(struct tevent_req *req);
352 NTSTATUS cli_nt_hardlink(struct cli_state *cli, const char *fname_src, const char *fname_dst);
354 struct tevent_req *cli_unlink_send(TALLOC_CTX *mem_ctx,
355 struct tevent_context *ev,
356 struct cli_state *cli,
358 uint16_t mayhave_attrs);
359 NTSTATUS cli_unlink_recv(struct tevent_req *req);
360 NTSTATUS cli_unlink(struct cli_state *cli, const char *fname, uint16_t mayhave_attrs);
362 struct tevent_req *cli_mkdir_send(TALLOC_CTX *mem_ctx,
363 struct tevent_context *ev,
364 struct cli_state *cli,
366 NTSTATUS cli_mkdir_recv(struct tevent_req *req);
367 NTSTATUS cli_mkdir(struct cli_state *cli, const char *dname);
368 struct tevent_req *cli_rmdir_send(TALLOC_CTX *mem_ctx,
369 struct tevent_context *ev,
370 struct cli_state *cli,
372 NTSTATUS cli_rmdir_recv(struct tevent_req *req);
373 NTSTATUS cli_rmdir(struct cli_state *cli, const char *dname);
374 struct tevent_req *cli_nt_delete_on_close_send(TALLOC_CTX *mem_ctx,
375 struct tevent_context *ev,
376 struct cli_state *cli,
379 NTSTATUS cli_nt_delete_on_close_recv(struct tevent_req *req);
380 NTSTATUS cli_nt_delete_on_close(struct cli_state *cli, uint16_t fnum, bool flag);
381 struct tevent_req *cli_ntcreate_send(TALLOC_CTX *mem_ctx,
382 struct tevent_context *ev,
383 struct cli_state *cli,
386 uint32_t DesiredAccess,
387 uint32_t FileAttributes,
388 uint32_t ShareAccess,
389 uint32_t CreateDisposition,
390 uint32_t CreateOptions,
391 uint8_t SecurityFlags);
392 NTSTATUS cli_ntcreate_recv(struct tevent_req *req,
394 struct smb_create_returns *cr);
395 NTSTATUS cli_ntcreate(struct cli_state *cli,
398 uint32_t DesiredAccess,
399 uint32_t FileAttributes,
400 uint32_t ShareAccess,
401 uint32_t CreateDisposition,
402 uint32_t CreateOptions,
403 uint8_t SecurityFlags,
405 struct smb_create_returns *cr);
406 struct tevent_req *cli_openx_create(TALLOC_CTX *mem_ctx,
407 struct tevent_context *ev,
408 struct cli_state *cli, const char *fname,
409 int flags, int share_mode,
410 struct tevent_req **psmbreq);
411 struct tevent_req *cli_openx_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
412 struct cli_state *cli, const char *fname,
413 int flags, int share_mode);
414 NTSTATUS cli_openx_recv(struct tevent_req *req, uint16_t *fnum);
415 NTSTATUS cli_openx(struct cli_state *cli, const char *fname, int flags, int share_mode, uint16_t *pfnum);
416 NTSTATUS cli_open(struct cli_state *cli, const char *fname, int flags, int share_mode, uint16_t *pfnum);
417 struct tevent_req *cli_close_create(TALLOC_CTX *mem_ctx,
418 struct tevent_context *ev,
419 struct cli_state *cli, uint16_t fnum,
420 struct tevent_req **psubreq);
421 struct tevent_req *cli_close_send(TALLOC_CTX *mem_ctx,
422 struct tevent_context *ev,
423 struct cli_state *cli, uint16_t fnum);
424 NTSTATUS cli_close_recv(struct tevent_req *req);
425 NTSTATUS cli_close(struct cli_state *cli, uint16_t fnum);
426 struct tevent_req *cli_ftruncate_send(TALLOC_CTX *mem_ctx,
427 struct tevent_context *ev,
428 struct cli_state *cli,
431 NTSTATUS cli_ftruncate_recv(struct tevent_req *req);
432 NTSTATUS cli_ftruncate(struct cli_state *cli, uint16_t fnum, uint64_t size);
433 NTSTATUS cli_locktype(struct cli_state *cli, uint16_t fnum,
434 uint32_t offset, uint32_t len,
435 int timeout, unsigned char locktype);
436 NTSTATUS cli_lock32(struct cli_state *cli, uint16_t fnum, uint32_t offset,
437 uint32_t len, int timeout, enum brl_type lock_type);
438 struct tevent_req *cli_unlock_send(TALLOC_CTX *mem_ctx,
439 struct tevent_context *ev,
440 struct cli_state *cli,
444 NTSTATUS cli_unlock_recv(struct tevent_req *req);
445 NTSTATUS cli_unlock(struct cli_state *cli, uint16_t fnum, uint32_t offset, uint32_t len);
446 NTSTATUS cli_lock64(struct cli_state *cli, uint16_t fnum,
447 uint64_t offset, uint64_t len, int timeout,
448 enum brl_type lock_type);
449 struct tevent_req *cli_unlock64_send(TALLOC_CTX *mem_ctx,
450 struct tevent_context *ev,
451 struct cli_state *cli,
455 NTSTATUS cli_unlock64_recv(struct tevent_req *req);
456 NTSTATUS cli_unlock64(struct cli_state *cli, uint16_t fnum, uint64_t offset, uint64_t len);
457 struct tevent_req *cli_posix_lock_send(TALLOC_CTX *mem_ctx,
458 struct tevent_context *ev,
459 struct cli_state *cli,
464 enum brl_type lock_type);
465 NTSTATUS cli_posix_lock_recv(struct tevent_req *req);
466 NTSTATUS cli_posix_lock(struct cli_state *cli, uint16_t fnum,
467 uint64_t offset, uint64_t len,
468 bool wait_lock, enum brl_type lock_type);
469 struct tevent_req *cli_posix_unlock_send(TALLOC_CTX *mem_ctx,
470 struct tevent_context *ev,
471 struct cli_state *cli,
475 NTSTATUS cli_posix_unlock_recv(struct tevent_req *req);
476 NTSTATUS cli_posix_unlock(struct cli_state *cli, uint16_t fnum, uint64_t offset, uint64_t len);
477 struct tevent_req *cli_getattrE_send(TALLOC_CTX *mem_ctx,
478 struct tevent_context *ev,
479 struct cli_state *cli,
481 NTSTATUS cli_getattrE_recv(struct tevent_req *req,
487 NTSTATUS cli_getattrE(struct cli_state *cli,
494 struct tevent_req *cli_setattrE_send(TALLOC_CTX *mem_ctx,
495 struct tevent_context *ev,
496 struct cli_state *cli,
501 NTSTATUS cli_setattrE_recv(struct tevent_req *req);
502 NTSTATUS cli_setattrE(struct cli_state *cli,
507 struct tevent_req *cli_getatr_send(TALLOC_CTX *mem_ctx,
508 struct tevent_context *ev,
509 struct cli_state *cli,
511 NTSTATUS cli_getatr_recv(struct tevent_req *req,
515 NTSTATUS cli_getatr(struct cli_state *cli,
520 struct tevent_req *cli_setatr_send(TALLOC_CTX *mem_ctx,
521 struct tevent_context *ev,
522 struct cli_state *cli,
526 NTSTATUS cli_setatr_recv(struct tevent_req *req);
527 NTSTATUS cli_setatr(struct cli_state *cli,
531 struct tevent_req *cli_chkpath_send(TALLOC_CTX *mem_ctx,
532 struct tevent_context *ev,
533 struct cli_state *cli,
535 NTSTATUS cli_chkpath_recv(struct tevent_req *req);
536 NTSTATUS cli_chkpath(struct cli_state *cli, const char *path);
537 struct tevent_req *cli_dskattr_send(TALLOC_CTX *mem_ctx,
538 struct tevent_context *ev,
539 struct cli_state *cli);
540 NTSTATUS cli_dskattr_recv(struct tevent_req *req, int *bsize, int *total,
542 NTSTATUS cli_dskattr(struct cli_state *cli, int *bsize, int *total, int *avail);
543 NTSTATUS cli_disk_size(struct cli_state *cli, const char *path, uint64_t *bsize,
544 uint64_t *total, uint64_t *avail);
545 struct tevent_req *cli_ctemp_send(TALLOC_CTX *mem_ctx,
546 struct tevent_context *ev,
547 struct cli_state *cli,
549 NTSTATUS cli_ctemp_recv(struct tevent_req *req,
553 NTSTATUS cli_ctemp(struct cli_state *cli,
558 NTSTATUS cli_raw_ioctl(struct cli_state *cli, uint16_t fnum, uint32_t code, DATA_BLOB *blob);
559 NTSTATUS cli_set_ea_path(struct cli_state *cli, const char *path,
560 const char *ea_name, const char *ea_val,
562 NTSTATUS cli_set_ea_fnum(struct cli_state *cli, uint16_t fnum,
563 const char *ea_name, const char *ea_val,
565 struct tevent_req *cli_get_ea_list_path_send(TALLOC_CTX *mem_ctx,
566 struct tevent_context *ev,
567 struct cli_state *cli,
569 NTSTATUS cli_get_ea_list_path_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
570 size_t *pnum_eas, struct ea_struct **peas);
571 NTSTATUS cli_get_ea_list_path(struct cli_state *cli, const char *path,
574 struct ea_struct **pea_list);
575 struct tevent_req *cli_posix_open_send(TALLOC_CTX *mem_ctx,
576 struct tevent_context *ev,
577 struct cli_state *cli,
581 NTSTATUS cli_posix_open_recv(struct tevent_req *req, uint16_t *pfnum);
582 NTSTATUS cli_posix_open(struct cli_state *cli, const char *fname,
583 int flags, mode_t mode, uint16_t *fnum);
584 struct tevent_req *cli_posix_mkdir_send(TALLOC_CTX *mem_ctx,
585 struct tevent_context *ev,
586 struct cli_state *cli,
589 NTSTATUS cli_posix_mkdir_recv(struct tevent_req *req);
590 NTSTATUS cli_posix_mkdir(struct cli_state *cli, const char *fname, mode_t mode);
592 struct tevent_req *cli_posix_unlink_send(TALLOC_CTX *mem_ctx,
593 struct tevent_context *ev,
594 struct cli_state *cli,
596 NTSTATUS cli_posix_unlink_recv(struct tevent_req *req);
597 NTSTATUS cli_posix_unlink(struct cli_state *cli, const char *fname);
599 struct tevent_req *cli_posix_rmdir_send(TALLOC_CTX *mem_ctx,
600 struct tevent_context *ev,
601 struct cli_state *cli,
603 NTSTATUS cli_posix_rmdir_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx);
604 NTSTATUS cli_posix_rmdir(struct cli_state *cli, const char *fname);
605 struct tevent_req *cli_notify_send(TALLOC_CTX *mem_ctx,
606 struct tevent_context *ev,
607 struct cli_state *cli, uint16_t fnum,
608 uint32_t buffer_size,
609 uint32_t completion_filter, bool recursive);
610 NTSTATUS cli_notify_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
611 uint32_t *pnum_changes,
612 struct notify_change **pchanges);
613 NTSTATUS cli_notify(struct cli_state *cli, uint16_t fnum, uint32_t buffer_size,
614 uint32_t completion_filter, bool recursive,
615 TALLOC_CTX *mem_ctx, uint32_t *pnum_changes,
616 struct notify_change **pchanges);
618 struct tevent_req *cli_nttrans_create_send(TALLOC_CTX *mem_ctx,
619 struct tevent_context *ev,
620 struct cli_state *cli,
623 uint32_t DesiredAccess,
624 uint32_t FileAttributes,
625 uint32_t ShareAccess,
626 uint32_t CreateDisposition,
627 uint32_t CreateOptions,
628 uint8_t SecurityFlags,
629 struct security_descriptor *secdesc,
630 struct ea_struct *eas,
632 NTSTATUS cli_nttrans_create_recv(struct tevent_req *req,
634 struct smb_create_returns *cr);
635 NTSTATUS cli_nttrans_create(struct cli_state *cli,
638 uint32_t DesiredAccess,
639 uint32_t FileAttributes,
640 uint32_t ShareAccess,
641 uint32_t CreateDisposition,
642 uint32_t CreateOptions,
643 uint8_t SecurityFlags,
644 struct security_descriptor *secdesc,
645 struct ea_struct *eas,
648 struct smb_create_returns *cr);
650 /* The following definitions come from libsmb/clifsinfo.c */
652 struct tevent_req *cli_unix_extensions_version_send(TALLOC_CTX *mem_ctx,
653 struct tevent_context *ev,
654 struct cli_state *cli);
655 NTSTATUS cli_unix_extensions_version_recv(struct tevent_req *req,
656 uint16_t *pmajor, uint16_t *pminor,
659 NTSTATUS cli_unix_extensions_version(struct cli_state *cli, uint16_t *pmajor,
660 uint16_t *pminor, uint32_t *pcaplow,
662 struct tevent_req *cli_set_unix_extensions_capabilities_send(
663 TALLOC_CTX *mem_ctx, struct tevent_context *ev, struct cli_state *cli,
664 uint16_t major, uint16_t minor, uint32_t caplow, uint32_t caphigh);
665 NTSTATUS cli_set_unix_extensions_capabilities_recv(struct tevent_req *req);
666 NTSTATUS cli_set_unix_extensions_capabilities(struct cli_state *cli,
667 uint16_t major, uint16_t minor,
668 uint32_t caplow, uint32_t caphigh);
669 struct tevent_req *cli_get_fs_attr_info_send(TALLOC_CTX *mem_ctx,
670 struct tevent_context *ev,
671 struct cli_state *cli);
672 NTSTATUS cli_get_fs_attr_info_recv(struct tevent_req *req, uint32_t *fs_attr);
673 NTSTATUS cli_get_fs_attr_info(struct cli_state *cli, uint32_t *fs_attr);
674 NTSTATUS cli_get_fs_volume_info(struct cli_state *cli,
675 TALLOC_CTX *mem_ctx, char **volume_name,
676 uint32_t *pserial_number, time_t *pdate);
677 NTSTATUS cli_get_fs_full_size_info(struct cli_state *cli,
678 uint64_t *total_allocation_units,
679 uint64_t *caller_allocation_units,
680 uint64_t *actual_allocation_units,
681 uint64_t *sectors_per_allocation_unit,
682 uint64_t *bytes_per_sector);
683 NTSTATUS cli_get_posix_fs_info(struct cli_state *cli,
684 uint32_t *optimal_transfer_size,
685 uint32_t *block_size,
686 uint64_t *total_blocks,
687 uint64_t *blocks_available,
688 uint64_t *user_blocks_available,
689 uint64_t *total_file_nodes,
690 uint64_t *free_file_nodes,
691 uint64_t *fs_identifier);
692 struct tevent_req *cli_posix_whoami_send(TALLOC_CTX *mem_ctx,
693 struct tevent_context *ev,
694 struct cli_state *cli);
695 NTSTATUS cli_posix_whoami_recv(struct tevent_req *req,
702 struct dom_sid **psids,
704 NTSTATUS cli_posix_whoami(struct cli_state *cli,
711 struct dom_sid **sids,
714 /* The following definitions come from libsmb/clilist.c */
716 NTSTATUS cli_list_old(struct cli_state *cli,const char *Mask,uint16_t attribute,
717 NTSTATUS (*fn)(const char *, struct file_info *,
718 const char *, void *), void *state);
719 NTSTATUS cli_list_trans(struct cli_state *cli, const char *mask,
720 uint16_t attribute, int info_level,
721 NTSTATUS (*fn)(const char *mnt, struct file_info *finfo,
722 const char *mask, void *private_data),
724 struct tevent_req *cli_list_send(TALLOC_CTX *mem_ctx,
725 struct tevent_context *ev,
726 struct cli_state *cli,
729 uint16_t info_level);
730 NTSTATUS cli_list_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
731 struct file_info **finfo, size_t *num_finfo);
732 NTSTATUS cli_list(struct cli_state *cli,const char *Mask,uint16_t attribute,
733 NTSTATUS (*fn)(const char *, struct file_info *, const char *,
734 void *), void *state);
736 /* The following definitions come from libsmb/climessage.c */
738 struct tevent_req *cli_message_send(TALLOC_CTX *mem_ctx,
739 struct tevent_context *ev,
740 struct cli_state *cli,
741 const char *host, const char *username,
742 const char *message);
743 NTSTATUS cli_message_recv(struct tevent_req *req);
744 NTSTATUS cli_message(struct cli_state *cli, const char *host,
745 const char *username, const char *message);
747 /* The following definitions come from libsmb/clioplock.c */
749 struct tevent_req *cli_smb_oplock_break_waiter_send(TALLOC_CTX *mem_ctx,
750 struct tevent_context *ev,
751 struct cli_state *cli);
752 NTSTATUS cli_smb_oplock_break_waiter_recv(struct tevent_req *req,
756 struct tevent_req *cli_oplock_ack_send(TALLOC_CTX *mem_ctx,
757 struct tevent_context *ev,
758 struct cli_state *cli,
759 uint16_t fnum, uint8_t level);
760 NTSTATUS cli_oplock_ack_recv(struct tevent_req *req);
762 /* The following definitions come from libsmb/cliprint.c */
764 int cli_print_queue(struct cli_state *cli,
765 void (*fn)(struct print_job_info *));
766 int cli_printjob_del(struct cli_state *cli, int job);
768 /* The following definitions come from libsmb/cliquota.c */
770 NTSTATUS cli_get_quota_handle(struct cli_state *cli, uint16_t *quota_fnum);
771 void free_ntquota_list(SMB_NTQUOTA_LIST **qt_list);
772 bool parse_user_quota_record(const uint8_t *rdata,
773 unsigned int rdata_count,
774 unsigned int *offset,
775 SMB_NTQUOTA_STRUCT *pqt);
776 bool add_record_to_ntquota_list(TALLOC_CTX *mem_ctx,
777 SMB_NTQUOTA_STRUCT *pqt,
778 SMB_NTQUOTA_LIST **pqt_list);
779 NTSTATUS parse_user_quota_list(const uint8_t *curdata,
780 uint32_t curdata_size,
782 SMB_NTQUOTA_LIST **pqt_list);
783 NTSTATUS parse_fs_quota_buffer(const uint8_t *rdata,
784 unsigned int rdata_count,
785 SMB_NTQUOTA_STRUCT *pqt);
786 NTSTATUS build_user_quota_buffer(SMB_NTQUOTA_LIST *qt_list,
790 SMB_NTQUOTA_LIST **end_ptr);
791 NTSTATUS build_fs_quota_buffer(TALLOC_CTX *mem_ctx,
792 const SMB_NTQUOTA_STRUCT *pqt,
795 NTSTATUS cli_get_user_quota(struct cli_state *cli, int quota_fnum,
796 SMB_NTQUOTA_STRUCT *pqt);
797 NTSTATUS cli_set_user_quota(struct cli_state *cli,
799 SMB_NTQUOTA_LIST *qtl);
800 NTSTATUS cli_list_user_quota(struct cli_state *cli, int quota_fnum,
801 SMB_NTQUOTA_LIST **pqt_list);
802 NTSTATUS cli_get_fs_quota_info(struct cli_state *cli, int quota_fnum,
803 SMB_NTQUOTA_STRUCT *pqt);
804 NTSTATUS cli_set_fs_quota_info(struct cli_state *cli, int quota_fnum,
805 SMB_NTQUOTA_STRUCT *pqt);
807 /* The following definitions come from libsmb/clireadwrite.c */
809 struct tevent_req *cli_read_andx_create(TALLOC_CTX *mem_ctx,
810 struct tevent_context *ev,
811 struct cli_state *cli, uint16_t fnum,
812 off_t offset, size_t size,
813 struct tevent_req **psmbreq);
814 struct tevent_req *cli_read_andx_send(TALLOC_CTX *mem_ctx,
815 struct tevent_context *ev,
816 struct cli_state *cli, uint16_t fnum,
817 off_t offset, size_t size);
818 NTSTATUS cli_read_andx_recv(struct tevent_req *req, ssize_t *received,
820 struct tevent_req *cli_pull_send(TALLOC_CTX *mem_ctx,
821 struct tevent_context *ev,
822 struct cli_state *cli,
823 uint16_t fnum, off_t start_offset,
824 off_t size, size_t window_size,
825 NTSTATUS (*sink)(char *buf, size_t n,
828 NTSTATUS cli_pull_recv(struct tevent_req *req, off_t *received);
829 NTSTATUS cli_pull(struct cli_state *cli, uint16_t fnum,
830 off_t start_offset, off_t size, size_t window_size,
831 NTSTATUS (*sink)(char *buf, size_t n, void *priv),
832 void *priv, off_t *received);
833 NTSTATUS cli_read(struct cli_state *cli, uint16_t fnum,
834 char *buf, off_t offset, size_t size,
836 NTSTATUS cli_smbwrite(struct cli_state *cli, uint16_t fnum, char *buf,
837 off_t offset, size_t size1, size_t *ptotal);
838 struct tevent_req *cli_write_andx_create(TALLOC_CTX *mem_ctx,
839 struct tevent_context *ev,
840 struct cli_state *cli, uint16_t fnum,
841 uint16_t mode, const uint8_t *buf,
842 off_t offset, size_t size,
843 struct tevent_req **reqs_before,
845 struct tevent_req **psmbreq);
846 struct tevent_req *cli_write_andx_send(TALLOC_CTX *mem_ctx,
847 struct tevent_context *ev,
848 struct cli_state *cli, uint16_t fnum,
849 uint16_t mode, const uint8_t *buf,
850 off_t offset, size_t size);
851 NTSTATUS cli_write_andx_recv(struct tevent_req *req, size_t *pwritten);
853 NTSTATUS cli_writeall(struct cli_state *cli, uint16_t fnum, uint16_t mode,
854 const uint8_t *buf, off_t offset, size_t size,
857 struct tevent_req *cli_push_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
858 struct cli_state *cli,
859 uint16_t fnum, uint16_t mode,
860 off_t start_offset, size_t window_size,
861 size_t (*source)(uint8_t *buf, size_t n,
864 NTSTATUS cli_push_recv(struct tevent_req *req);
865 NTSTATUS cli_push(struct cli_state *cli, uint16_t fnum, uint16_t mode,
866 off_t start_offset, size_t window_size,
867 size_t (*source)(uint8_t *buf, size_t n, void *priv),
870 NTSTATUS cli_splice(struct cli_state *srccli, struct cli_state *dstcli,
871 uint16_t src_fnum, uint16_t dst_fnum,
873 off_t src_offset, off_t dst_offset,
875 int (*splice_cb)(off_t n, void *priv), void *priv);
877 /* The following definitions come from libsmb/clisecdesc.c */
879 NTSTATUS cli_query_security_descriptor(struct cli_state *cli,
883 struct security_descriptor **sd);
884 NTSTATUS cli_query_secdesc(struct cli_state *cli, uint16_t fnum,
885 TALLOC_CTX *mem_ctx, struct security_descriptor **sd);
886 NTSTATUS cli_set_security_descriptor(struct cli_state *cli,
889 const struct security_descriptor *sd);
890 NTSTATUS cli_set_secdesc(struct cli_state *cli, uint16_t fnum,
891 const struct security_descriptor *sd);
893 /* The following definitions come from libsmb/clistr.c */
895 size_t clistr_pull_talloc(TALLOC_CTX *ctx,
902 bool clistr_is_previous_version_path(const char *path,
907 /* The following definitions come from libsmb/clitrans.c */
909 struct tevent_req *cli_trans_send(
910 TALLOC_CTX *mem_ctx, struct tevent_context *ev,
911 struct cli_state *cli, uint16_t additional_flags2, uint8_t cmd,
912 const char *pipe_name, uint16_t fid, uint16_t function, int flags,
913 uint16_t *setup, uint8_t num_setup, uint8_t max_setup,
914 uint8_t *param, uint32_t num_param, uint32_t max_param,
915 uint8_t *data, uint32_t num_data, uint32_t max_data);
916 NTSTATUS cli_trans_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
917 uint16_t *recv_flags2,
918 uint16_t **setup, uint8_t min_setup,
920 uint8_t **param, uint32_t min_param,
922 uint8_t **data, uint32_t min_data,
924 NTSTATUS cli_trans(TALLOC_CTX *mem_ctx, struct cli_state *cli,
926 const char *pipe_name, uint16_t fid, uint16_t function,
928 uint16_t *setup, uint8_t num_setup, uint8_t max_setup,
929 uint8_t *param, uint32_t num_param, uint32_t max_param,
930 uint8_t *data, uint32_t num_data, uint32_t max_data,
931 uint16_t *recv_flags2,
932 uint16_t **rsetup, uint8_t min_rsetup, uint8_t *num_rsetup,
933 uint8_t **rparam, uint32_t min_rparam, uint32_t *num_rparam,
934 uint8_t **rdata, uint32_t min_rdata, uint32_t *num_rdata);
936 /* The following definitions come from libsmb/reparse_symlink.c */
938 bool symlink_reparse_buffer_marshall(
939 const char *substitute, const char *printname, uint32_t flags,
940 TALLOC_CTX *mem_ctx, uint8_t **pdst, size_t *pdstlen);
941 bool symlink_reparse_buffer_parse(
942 const uint8_t *src, size_t srclen, TALLOC_CTX *mem_ctx,
943 char **psubstitute_name, char **pprint_name, uint32_t *pflags);
945 /* The following definitions come from libsmb/clisymlink.c */
947 struct tevent_req *cli_symlink_send(TALLOC_CTX *mem_ctx,
948 struct tevent_context *ev,
949 struct cli_state *cli,
953 NTSTATUS cli_symlink_recv(struct tevent_req *req);
954 NTSTATUS cli_symlink(struct cli_state *cli, const char *oldname,
955 const char *newname, uint32_t flags);
957 struct tevent_req *cli_readlink_send(TALLOC_CTX *mem_ctx,
958 struct tevent_context *ev,
959 struct cli_state *cli,
961 NTSTATUS cli_readlink_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
962 char **psubstitute_name, char **pprint_name,
964 NTSTATUS cli_readlink(struct cli_state *cli, const char *fname,
965 TALLOC_CTX *mem_ctx, char **psubstitute_name,
966 char **pprint_name, uint32_t *pflags);
968 #endif /* _LIBSMB_PROTO_H_ */