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;
35 struct print_job_info;
37 /* The following definitions come from libsmb/cliconnect.c */
39 struct cli_credentials *cli_session_creds_init(TALLOC_CTX *mem_ctx,
45 bool fallback_after_kerberos,
47 bool password_is_nt_hash);
48 NTSTATUS cli_session_creds_prepare_krb5(struct cli_state *cli,
49 struct cli_credentials *creds);
50 struct tevent_req *cli_session_setup_creds_send(TALLOC_CTX *mem_ctx,
51 struct tevent_context *ev,
52 struct cli_state *cli,
53 struct cli_credentials *creds);
54 NTSTATUS cli_session_setup_creds_recv(struct tevent_req *req);
55 NTSTATUS cli_session_setup_creds(struct cli_state *cli,
56 struct cli_credentials *creds);
57 NTSTATUS cli_session_setup_anon(struct cli_state *cli);
58 struct tevent_req *cli_session_setup_guest_create(TALLOC_CTX *mem_ctx,
59 struct tevent_context *ev,
60 struct cli_state *cli,
61 struct tevent_req **psmbreq);
62 struct tevent_req *cli_session_setup_guest_send(TALLOC_CTX *mem_ctx,
63 struct tevent_context *ev,
64 struct cli_state *cli);
65 NTSTATUS cli_session_setup_guest_recv(struct tevent_req *req);
66 NTSTATUS cli_ulogoff(struct cli_state *cli);
67 struct tevent_req *cli_tcon_andx_create(TALLOC_CTX *mem_ctx,
68 struct tevent_context *ev,
69 struct cli_state *cli,
70 const char *share, const char *dev,
71 const char *pass, int passlen,
72 struct tevent_req **psmbreq);
73 struct tevent_req *cli_tcon_andx_send(TALLOC_CTX *mem_ctx,
74 struct tevent_context *ev,
75 struct cli_state *cli,
76 const char *share, const char *dev,
77 const char *pass, int passlen);
78 NTSTATUS cli_tcon_andx_recv(struct tevent_req *req);
79 NTSTATUS cli_tcon_andx(struct cli_state *cli, const char *share,
80 const char *dev, const char *pass, int passlen);
81 NTSTATUS cli_tree_connect_creds(struct cli_state *cli,
82 const char *share, const char *dev,
83 struct cli_credentials *creds);
84 NTSTATUS cli_tree_connect(struct cli_state *cli, const char *share,
85 const char *dev, const char *pass);
86 NTSTATUS cli_tdis(struct cli_state *cli);
87 NTSTATUS cli_connect_nb(const char *host, const struct sockaddr_storage *dest_ss,
88 uint16_t port, int name_type, const char *myname,
89 int signing_state, int flags, struct cli_state **pcli);
90 NTSTATUS cli_start_connection(struct cli_state **output_cli,
92 const char *dest_host,
93 const struct sockaddr_storage *dest_ss, int port,
94 int signing_state, int flags);
95 NTSTATUS cli_smb1_setup_encryption(struct cli_state *cli,
96 struct cli_credentials *creds);
97 struct tevent_req *cli_full_connection_creds_send(
98 TALLOC_CTX *mem_ctx, struct tevent_context *ev,
99 const char *my_name, const char *dest_host,
100 const struct sockaddr_storage *dest_ss, int port,
101 const char *service, const char *service_type,
102 struct cli_credentials *creds,
103 int flags, int signing_state);
104 NTSTATUS cli_full_connection_creds_recv(struct tevent_req *req,
105 struct cli_state **output_cli);
106 NTSTATUS cli_full_connection_creds(struct cli_state **output_cli,
108 const char *dest_host,
109 const struct sockaddr_storage *dest_ss, int port,
110 const char *service, const char *service_type,
111 struct cli_credentials *creds,
114 NTSTATUS cli_raw_tcon(struct cli_state *cli,
115 const char *service, const char *pass, const char *dev,
116 uint16_t *max_xmit, uint16_t *tid);
117 struct cli_state *get_ipc_connect(char *server,
118 struct sockaddr_storage *server_ss,
119 const struct user_auth_info *user_info);
120 struct cli_state *get_ipc_connect_master_ip(TALLOC_CTX *ctx,
121 struct sockaddr_storage *mb_ip,
122 const struct user_auth_info *user_info,
123 char **pp_workgroup_out);
125 /* The following definitions come from libsmb/clidfs.c */
127 NTSTATUS cli_cm_force_encryption_creds(struct cli_state *c,
128 struct cli_credentials *creds,
129 const char *sharename);
130 NTSTATUS cli_cm_open(TALLOC_CTX *ctx,
131 struct cli_state *referring_cli,
134 const struct user_auth_info *auth_info,
137 const struct sockaddr_storage *dest_ss,
140 struct cli_state **pcli);
141 void cli_cm_display(struct cli_state *c);
142 struct client_dfs_referral;
143 NTSTATUS cli_dfs_get_referral_ex(TALLOC_CTX *ctx,
144 struct cli_state *cli,
146 uint16_t max_referral_level,
147 struct client_dfs_referral **refs,
150 NTSTATUS cli_dfs_get_referral(TALLOC_CTX *ctx,
151 struct cli_state *cli,
153 struct client_dfs_referral **refs,
156 NTSTATUS cli_resolve_path(TALLOC_CTX *ctx,
158 const struct user_auth_info *dfs_auth_info,
159 struct cli_state *rootcli,
161 struct cli_state **targetcli,
162 char **pp_targetpath);
164 bool cli_check_msdfs_proxy(TALLOC_CTX *ctx,
165 struct cli_state *cli,
166 const char *sharename,
170 struct cli_credentials *creds);
172 /* The following definitions come from libsmb/clientgen.c */
174 unsigned int cli_set_timeout(struct cli_state *cli, unsigned int timeout);
175 bool cli_set_backup_intent(struct cli_state *cli, bool flag);
176 extern struct GUID cli_state_client_guid;
177 struct cli_state *cli_state_create(TALLOC_CTX *mem_ctx,
179 const char *remote_name,
182 void cli_nt_pipes_close(struct cli_state *cli);
183 void cli_shutdown(struct cli_state *cli);
184 uint16_t cli_state_get_vc_num(struct cli_state *cli);
185 uint32_t cli_setpid(struct cli_state *cli, uint32_t pid);
186 uint32_t cli_getpid(struct cli_state *cli);
187 bool cli_state_is_encryption_on(struct cli_state *cli);
188 bool cli_state_has_tcon(struct cli_state *cli);
189 uint32_t cli_state_get_tid(struct cli_state *cli);
190 uint32_t cli_state_set_tid(struct cli_state *cli, uint32_t tid);
192 struct smbXcli_tcon *cli_state_save_tcon(struct cli_state *cli);
193 void cli_state_restore_tcon(struct cli_state *cli, struct smbXcli_tcon *tcon);
194 uint16_t cli_state_get_uid(struct cli_state *cli);
195 uint16_t cli_state_set_uid(struct cli_state *cli, uint16_t uid);
196 bool cli_set_case_sensitive(struct cli_state *cli, bool case_sensitive);
197 uint32_t cli_state_available_size(struct cli_state *cli, uint32_t ofs);
198 time_t cli_state_server_time(struct cli_state *cli);
199 struct tevent_req *cli_echo_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
200 struct cli_state *cli, uint16_t num_echos,
202 NTSTATUS cli_echo_recv(struct tevent_req *req);
203 NTSTATUS cli_echo(struct cli_state *cli, uint16_t num_echos, DATA_BLOB data);
204 NTSTATUS cli_smb(TALLOC_CTX *mem_ctx, struct cli_state *cli,
205 uint8_t smb_command, uint8_t additional_flags,
206 uint8_t wct, uint16_t *vwv,
207 uint32_t num_bytes, const uint8_t *bytes,
208 struct tevent_req **result_parent,
209 uint8_t min_wct, uint8_t *pwct, uint16_t **pvwv,
210 uint32_t *pnum_bytes, uint8_t **pbytes);
212 /* The following definitions come from libsmb/clierror.c */
214 NTSTATUS cli_nt_error(struct cli_state *cli);
215 void cli_dos_error(struct cli_state *cli, uint8_t *eclass, uint32_t *ecode);
216 int cli_errno(struct cli_state *cli);
217 bool cli_is_error(struct cli_state *cli);
218 bool cli_is_nt_error(struct cli_state *cli);
219 bool cli_is_dos_error(struct cli_state *cli);
220 bool cli_state_is_connected(struct cli_state *cli);
222 /* The following definitions come from libsmb/clifile.c */
224 struct tevent_req *cli_setpathinfo_send(TALLOC_CTX *mem_ctx,
225 struct tevent_context *ev,
226 struct cli_state *cli,
231 NTSTATUS cli_setpathinfo_recv(struct tevent_req *req);
232 NTSTATUS cli_setpathinfo(struct cli_state *cli,
237 struct tevent_req *cli_setfileinfo_send(
239 struct tevent_context *ev,
240 struct cli_state *cli,
245 NTSTATUS cli_setfileinfo_recv(struct tevent_req *req);
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,
260 NTSTATUS cli_posix_readlink_recv(
261 struct tevent_req *req, TALLOC_CTX *mem_ctx, char **target);
262 NTSTATUS cli_posix_readlink(
263 struct cli_state *cli,
267 struct tevent_req *cli_posix_hardlink_send(TALLOC_CTX *mem_ctx,
268 struct tevent_context *ev,
269 struct cli_state *cli,
271 const char *newname);
272 NTSTATUS cli_posix_hardlink_recv(struct tevent_req *req);
273 NTSTATUS cli_posix_hardlink(struct cli_state *cli,
275 const char *newname);
276 uint32_t unix_perms_to_wire(mode_t perms);
277 mode_t wire_perms_to_unix(uint32_t perms);
278 struct tevent_req *cli_posix_getacl_send(TALLOC_CTX *mem_ctx,
279 struct tevent_context *ev,
280 struct cli_state *cli,
282 NTSTATUS cli_posix_getacl_recv(struct tevent_req *req,
286 NTSTATUS cli_posix_getacl(struct cli_state *cli,
291 struct tevent_req *cli_posix_setacl_send(TALLOC_CTX *mem_ctx,
292 struct tevent_context *ev,
293 struct cli_state *cli,
296 size_t acl_buf_size);
297 NTSTATUS cli_posix_setacl_recv(struct tevent_req *req);
298 NTSTATUS cli_posix_setacl(struct cli_state *cli,
301 size_t acl_buf_size);
302 struct tevent_req *cli_posix_stat_send(TALLOC_CTX *mem_ctx,
303 struct tevent_context *ev,
304 struct cli_state *cli,
306 SMB_STRUCT_STAT *sbuf);
307 NTSTATUS cli_posix_stat_recv(struct tevent_req *req);
308 NTSTATUS cli_posix_stat(struct cli_state *cli,
310 SMB_STRUCT_STAT *sbuf);
311 struct tevent_req *cli_posix_chmod_send(TALLOC_CTX *mem_ctx,
312 struct tevent_context *ev,
313 struct cli_state *cli,
316 NTSTATUS cli_posix_chmod_recv(struct tevent_req *req);
317 NTSTATUS cli_posix_chmod(struct cli_state *cli, const char *fname, mode_t mode);
318 struct tevent_req *cli_posix_chown_send(TALLOC_CTX *mem_ctx,
319 struct tevent_context *ev,
320 struct cli_state *cli,
324 NTSTATUS cli_posix_chown_recv(struct tevent_req *req);
325 NTSTATUS cli_posix_chown(struct cli_state *cli,
329 struct tevent_req *cli_rename_send(TALLOC_CTX *mem_ctx,
330 struct tevent_context *ev,
331 struct cli_state *cli,
332 const char *fname_src,
333 const char *fname_dst,
335 NTSTATUS cli_rename_recv(struct tevent_req *req);
336 NTSTATUS cli_rename(struct cli_state *cli,
337 const char *fname_src,
338 const char *fname_dst,
340 struct tevent_req *cli_ntrename_send(TALLOC_CTX *mem_ctx,
341 struct tevent_context *ev,
342 struct cli_state *cli,
343 const char *fname_src,
344 const char *fname_dst);
345 NTSTATUS cli_ntrename_recv(struct tevent_req *req);
346 NTSTATUS cli_ntrename(struct cli_state *cli, const char *fname_src, const char *fname_dst);
348 struct tevent_req *cli_hardlink_send(
350 struct tevent_context *ev,
351 struct cli_state *cli,
352 const char *fname_src,
353 const char *fname_dst);
354 NTSTATUS cli_hardlink_recv(struct tevent_req *req);
355 NTSTATUS cli_hardlink(
356 struct cli_state *cli,
357 const char *fname_src,
358 const char *fname_dst);
360 struct tevent_req *cli_unlink_send(TALLOC_CTX *mem_ctx,
361 struct tevent_context *ev,
362 struct cli_state *cli,
364 uint16_t mayhave_attrs);
365 NTSTATUS cli_unlink_recv(struct tevent_req *req);
366 NTSTATUS cli_unlink(struct cli_state *cli, const char *fname, uint16_t mayhave_attrs);
368 struct tevent_req *cli_mkdir_send(TALLOC_CTX *mem_ctx,
369 struct tevent_context *ev,
370 struct cli_state *cli,
372 NTSTATUS cli_mkdir_recv(struct tevent_req *req);
373 NTSTATUS cli_mkdir(struct cli_state *cli, const char *dname);
374 struct tevent_req *cli_rmdir_send(TALLOC_CTX *mem_ctx,
375 struct tevent_context *ev,
376 struct cli_state *cli,
378 NTSTATUS cli_rmdir_recv(struct tevent_req *req);
379 NTSTATUS cli_rmdir(struct cli_state *cli, const char *dname);
380 struct tevent_req *cli_nt_delete_on_close_send(TALLOC_CTX *mem_ctx,
381 struct tevent_context *ev,
382 struct cli_state *cli,
385 NTSTATUS cli_nt_delete_on_close_recv(struct tevent_req *req);
386 NTSTATUS cli_nt_delete_on_close(struct cli_state *cli, uint16_t fnum, bool flag);
387 struct tevent_req *cli_ntcreate_send(TALLOC_CTX *mem_ctx,
388 struct tevent_context *ev,
389 struct cli_state *cli,
392 uint32_t DesiredAccess,
393 uint32_t FileAttributes,
394 uint32_t ShareAccess,
395 uint32_t CreateDisposition,
396 uint32_t CreateOptions,
397 uint32_t ImpersonationLevel,
398 uint8_t SecurityFlags);
399 NTSTATUS cli_ntcreate_recv(struct tevent_req *req,
401 struct smb_create_returns *cr);
402 NTSTATUS cli_ntcreate(struct cli_state *cli,
405 uint32_t DesiredAccess,
406 uint32_t FileAttributes,
407 uint32_t ShareAccess,
408 uint32_t CreateDisposition,
409 uint32_t CreateOptions,
410 uint8_t SecurityFlags,
412 struct smb_create_returns *cr);
413 struct tevent_req *cli_openx_create(TALLOC_CTX *mem_ctx,
414 struct tevent_context *ev,
415 struct cli_state *cli, const char *fname,
416 int flags, int share_mode,
417 struct tevent_req **psmbreq);
418 struct tevent_req *cli_openx_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
419 struct cli_state *cli, const char *fname,
420 int flags, int share_mode);
421 NTSTATUS cli_openx_recv(struct tevent_req *req, uint16_t *fnum);
422 NTSTATUS cli_openx(struct cli_state *cli, const char *fname, int flags, int share_mode, uint16_t *pfnum);
423 NTSTATUS cli_open(struct cli_state *cli, const char *fname, int flags, int share_mode, uint16_t *pfnum);
424 struct tevent_req *cli_smb1_close_create(TALLOC_CTX *mem_ctx,
425 struct tevent_context *ev,
426 struct cli_state *cli, uint16_t fnum,
427 struct tevent_req **psubreq);
428 struct tevent_req *cli_close_send(TALLOC_CTX *mem_ctx,
429 struct tevent_context *ev,
430 struct cli_state *cli, uint16_t fnum);
431 NTSTATUS cli_close_recv(struct tevent_req *req);
432 NTSTATUS cli_close(struct cli_state *cli, uint16_t fnum);
433 struct tevent_req *cli_ftruncate_send(TALLOC_CTX *mem_ctx,
434 struct tevent_context *ev,
435 struct cli_state *cli,
438 NTSTATUS cli_ftruncate_recv(struct tevent_req *req);
439 NTSTATUS cli_ftruncate(struct cli_state *cli, uint16_t fnum, uint64_t size);
440 NTSTATUS cli_locktype(struct cli_state *cli, uint16_t fnum,
441 uint32_t offset, uint32_t len,
442 int timeout, unsigned char locktype);
443 struct smb1_lock_element {
449 struct tevent_req *cli_lockingx_create(
451 struct tevent_context *ev,
452 struct cli_state *cli,
455 uint8_t newoplocklevel,
457 uint16_t num_unlocks,
458 const struct smb1_lock_element *unlocks,
460 const struct smb1_lock_element *locks,
461 struct tevent_req **psmbreq);
462 struct tevent_req *cli_lockingx_send(
464 struct tevent_context *ev,
465 struct cli_state *cli,
468 uint8_t newoplocklevel,
470 uint16_t num_unlocks,
471 const struct smb1_lock_element *unlocks,
473 const struct smb1_lock_element *locks);
474 NTSTATUS cli_lockingx_recv(struct tevent_req *req);
475 NTSTATUS cli_lockingx(
476 struct cli_state *cli,
479 uint8_t newoplocklevel,
481 uint16_t num_unlocks,
482 const struct smb1_lock_element *unlocks,
484 const struct smb1_lock_element *locks);
486 NTSTATUS cli_lock32(struct cli_state *cli, uint16_t fnum, uint32_t offset,
487 uint32_t len, int timeout, enum brl_type lock_type);
488 struct tevent_req *cli_unlock_send(TALLOC_CTX *mem_ctx,
489 struct tevent_context *ev,
490 struct cli_state *cli,
494 NTSTATUS cli_unlock_recv(struct tevent_req *req);
495 NTSTATUS cli_unlock(struct cli_state *cli, uint16_t fnum, uint32_t offset, uint32_t len);
496 struct tevent_req *cli_posix_lock_send(TALLOC_CTX *mem_ctx,
497 struct tevent_context *ev,
498 struct cli_state *cli,
503 enum brl_type lock_type);
504 NTSTATUS cli_posix_lock_recv(struct tevent_req *req);
505 NTSTATUS cli_posix_lock(struct cli_state *cli, uint16_t fnum,
506 uint64_t offset, uint64_t len,
507 bool wait_lock, enum brl_type lock_type);
508 struct tevent_req *cli_posix_unlock_send(TALLOC_CTX *mem_ctx,
509 struct tevent_context *ev,
510 struct cli_state *cli,
514 NTSTATUS cli_posix_unlock_recv(struct tevent_req *req);
515 NTSTATUS cli_posix_unlock(struct cli_state *cli, uint16_t fnum, uint64_t offset, uint64_t len);
516 struct tevent_req *cli_getattrE_send(TALLOC_CTX *mem_ctx,
517 struct tevent_context *ev,
518 struct cli_state *cli,
520 NTSTATUS cli_getattrE_recv(struct tevent_req *req,
526 NTSTATUS cli_getattrE(struct cli_state *cli,
533 struct tevent_req *cli_setattrE_send(TALLOC_CTX *mem_ctx,
534 struct tevent_context *ev,
535 struct cli_state *cli,
540 NTSTATUS cli_setattrE_recv(struct tevent_req *req);
541 NTSTATUS cli_setattrE(struct cli_state *cli,
546 struct tevent_req *cli_getatr_send(TALLOC_CTX *mem_ctx,
547 struct tevent_context *ev,
548 struct cli_state *cli,
550 NTSTATUS cli_getatr_recv(struct tevent_req *req,
554 NTSTATUS cli_getatr(struct cli_state *cli,
559 struct tevent_req *cli_setatr_send(TALLOC_CTX *mem_ctx,
560 struct tevent_context *ev,
561 struct cli_state *cli,
565 NTSTATUS cli_setatr_recv(struct tevent_req *req);
566 NTSTATUS cli_setatr(struct cli_state *cli,
570 struct tevent_req *cli_chkpath_send(TALLOC_CTX *mem_ctx,
571 struct tevent_context *ev,
572 struct cli_state *cli,
574 NTSTATUS cli_chkpath_recv(struct tevent_req *req);
575 NTSTATUS cli_chkpath(struct cli_state *cli, const char *path);
576 struct tevent_req *cli_dskattr_send(TALLOC_CTX *mem_ctx,
577 struct tevent_context *ev,
578 struct cli_state *cli);
579 NTSTATUS cli_dskattr_recv(struct tevent_req *req, int *bsize, int *total,
581 NTSTATUS cli_dskattr(struct cli_state *cli, int *bsize, int *total, int *avail);
582 NTSTATUS cli_disk_size(struct cli_state *cli, const char *path, uint64_t *bsize,
583 uint64_t *total, uint64_t *avail);
584 struct tevent_req *cli_ctemp_send(TALLOC_CTX *mem_ctx,
585 struct tevent_context *ev,
586 struct cli_state *cli,
588 NTSTATUS cli_ctemp_recv(struct tevent_req *req,
592 NTSTATUS cli_ctemp(struct cli_state *cli,
597 NTSTATUS cli_raw_ioctl(struct cli_state *cli, uint16_t fnum, uint32_t code, DATA_BLOB *blob);
598 NTSTATUS cli_set_ea_path(struct cli_state *cli, const char *path,
599 const char *ea_name, const char *ea_val,
601 NTSTATUS cli_set_ea_fnum(struct cli_state *cli, uint16_t fnum,
602 const char *ea_name, const char *ea_val,
604 struct tevent_req *cli_get_ea_list_path_send(TALLOC_CTX *mem_ctx,
605 struct tevent_context *ev,
606 struct cli_state *cli,
608 NTSTATUS cli_get_ea_list_path_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
609 size_t *pnum_eas, struct ea_struct **peas);
610 NTSTATUS cli_get_ea_list_path(struct cli_state *cli, const char *path,
613 struct ea_struct **pea_list);
614 struct tevent_req *cli_posix_open_send(TALLOC_CTX *mem_ctx,
615 struct tevent_context *ev,
616 struct cli_state *cli,
620 NTSTATUS cli_posix_open_recv(struct tevent_req *req, uint16_t *pfnum);
621 NTSTATUS cli_posix_open(struct cli_state *cli, const char *fname,
622 int flags, mode_t mode, uint16_t *fnum);
623 struct tevent_req *cli_posix_mkdir_send(TALLOC_CTX *mem_ctx,
624 struct tevent_context *ev,
625 struct cli_state *cli,
628 NTSTATUS cli_posix_mkdir_recv(struct tevent_req *req);
629 NTSTATUS cli_posix_mkdir(struct cli_state *cli, const char *fname, mode_t mode);
631 struct tevent_req *cli_posix_unlink_send(TALLOC_CTX *mem_ctx,
632 struct tevent_context *ev,
633 struct cli_state *cli,
635 NTSTATUS cli_posix_unlink_recv(struct tevent_req *req);
636 NTSTATUS cli_posix_unlink(struct cli_state *cli, const char *fname);
638 struct tevent_req *cli_posix_rmdir_send(TALLOC_CTX *mem_ctx,
639 struct tevent_context *ev,
640 struct cli_state *cli,
642 NTSTATUS cli_posix_rmdir_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx);
643 NTSTATUS cli_posix_rmdir(struct cli_state *cli, const char *fname);
644 struct tevent_req *cli_notify_send(TALLOC_CTX *mem_ctx,
645 struct tevent_context *ev,
646 struct cli_state *cli, uint16_t fnum,
647 uint32_t buffer_size,
648 uint32_t completion_filter, bool recursive);
649 NTSTATUS cli_notify_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
650 uint32_t *pnum_changes,
651 struct notify_change **pchanges);
652 NTSTATUS cli_notify(struct cli_state *cli, uint16_t fnum, uint32_t buffer_size,
653 uint32_t completion_filter, bool recursive,
654 TALLOC_CTX *mem_ctx, uint32_t *pnum_changes,
655 struct notify_change **pchanges);
657 struct tevent_req *cli_nttrans_create_send(TALLOC_CTX *mem_ctx,
658 struct tevent_context *ev,
659 struct cli_state *cli,
662 uint32_t DesiredAccess,
663 uint32_t FileAttributes,
664 uint32_t ShareAccess,
665 uint32_t CreateDisposition,
666 uint32_t CreateOptions,
667 uint8_t SecurityFlags,
668 struct security_descriptor *secdesc,
669 struct ea_struct *eas,
671 NTSTATUS cli_nttrans_create_recv(struct tevent_req *req,
673 struct smb_create_returns *cr);
674 NTSTATUS cli_nttrans_create(struct cli_state *cli,
677 uint32_t DesiredAccess,
678 uint32_t FileAttributes,
679 uint32_t ShareAccess,
680 uint32_t CreateDisposition,
681 uint32_t CreateOptions,
682 uint8_t SecurityFlags,
683 struct security_descriptor *secdesc,
684 struct ea_struct *eas,
687 struct smb_create_returns *cr);
689 /* The following definitions come from libsmb/clifsinfo.c */
691 struct tevent_req *cli_unix_extensions_version_send(TALLOC_CTX *mem_ctx,
692 struct tevent_context *ev,
693 struct cli_state *cli);
694 NTSTATUS cli_unix_extensions_version_recv(struct tevent_req *req,
695 uint16_t *pmajor, uint16_t *pminor,
698 NTSTATUS cli_unix_extensions_version(struct cli_state *cli, uint16_t *pmajor,
699 uint16_t *pminor, uint32_t *pcaplow,
701 struct tevent_req *cli_set_unix_extensions_capabilities_send(
702 TALLOC_CTX *mem_ctx, struct tevent_context *ev, struct cli_state *cli,
703 uint16_t major, uint16_t minor, uint32_t caplow, uint32_t caphigh);
704 NTSTATUS cli_set_unix_extensions_capabilities_recv(struct tevent_req *req);
705 NTSTATUS cli_set_unix_extensions_capabilities(struct cli_state *cli,
706 uint16_t major, uint16_t minor,
707 uint32_t caplow, uint32_t caphigh);
708 struct tevent_req *cli_get_fs_attr_info_send(TALLOC_CTX *mem_ctx,
709 struct tevent_context *ev,
710 struct cli_state *cli);
711 NTSTATUS cli_get_fs_attr_info_recv(struct tevent_req *req, uint32_t *fs_attr);
712 NTSTATUS cli_get_fs_attr_info(struct cli_state *cli, uint32_t *fs_attr);
713 NTSTATUS cli_get_fs_volume_info(struct cli_state *cli,
714 TALLOC_CTX *mem_ctx, char **volume_name,
715 uint32_t *pserial_number, time_t *pdate);
716 NTSTATUS cli_get_fs_full_size_info(struct cli_state *cli,
717 uint64_t *total_allocation_units,
718 uint64_t *caller_allocation_units,
719 uint64_t *actual_allocation_units,
720 uint64_t *sectors_per_allocation_unit,
721 uint64_t *bytes_per_sector);
722 NTSTATUS cli_get_posix_fs_info(struct cli_state *cli,
723 uint32_t *optimal_transfer_size,
724 uint32_t *block_size,
725 uint64_t *total_blocks,
726 uint64_t *blocks_available,
727 uint64_t *user_blocks_available,
728 uint64_t *total_file_nodes,
729 uint64_t *free_file_nodes,
730 uint64_t *fs_identifier);
731 struct tevent_req *cli_posix_whoami_send(TALLOC_CTX *mem_ctx,
732 struct tevent_context *ev,
733 struct cli_state *cli);
734 NTSTATUS cli_posix_whoami_recv(struct tevent_req *req,
741 struct dom_sid **psids,
743 NTSTATUS cli_posix_whoami(struct cli_state *cli,
750 struct dom_sid **sids,
753 /* The following definitions come from libsmb/clilist.c */
755 NTSTATUS is_bad_finfo_name(const struct cli_state *cli,
756 const struct file_info *finfo);
758 NTSTATUS cli_list_old(struct cli_state *cli,const char *Mask,uint16_t attribute,
759 NTSTATUS (*fn)(const char *, struct file_info *,
760 const char *, void *), void *state);
761 NTSTATUS cli_list_trans(struct cli_state *cli, const char *mask,
762 uint16_t attribute, int info_level,
763 NTSTATUS (*fn)(const char *mnt, struct file_info *finfo,
764 const char *mask, void *private_data),
766 struct tevent_req *cli_list_send(TALLOC_CTX *mem_ctx,
767 struct tevent_context *ev,
768 struct cli_state *cli,
771 uint16_t info_level);
772 NTSTATUS cli_list_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
773 struct file_info **finfo, size_t *num_finfo);
774 NTSTATUS cli_list(struct cli_state *cli,const char *Mask,uint16_t attribute,
775 NTSTATUS (*fn)(const char *, struct file_info *, const char *,
776 void *), void *state);
778 /* The following definitions come from libsmb/climessage.c */
780 struct tevent_req *cli_message_send(TALLOC_CTX *mem_ctx,
781 struct tevent_context *ev,
782 struct cli_state *cli,
783 const char *host, const char *username,
784 const char *message);
785 NTSTATUS cli_message_recv(struct tevent_req *req);
786 NTSTATUS cli_message(struct cli_state *cli, const char *host,
787 const char *username, const char *message);
789 /* The following definitions come from libsmb/clioplock.c */
791 struct tevent_req *cli_smb_oplock_break_waiter_send(TALLOC_CTX *mem_ctx,
792 struct tevent_context *ev,
793 struct cli_state *cli);
794 NTSTATUS cli_smb_oplock_break_waiter_recv(struct tevent_req *req,
798 struct tevent_req *cli_oplock_ack_send(TALLOC_CTX *mem_ctx,
799 struct tevent_context *ev,
800 struct cli_state *cli,
801 uint16_t fnum, uint8_t level);
802 NTSTATUS cli_oplock_ack_recv(struct tevent_req *req);
804 /* The following definitions come from libsmb/cliprint.c */
806 int cli_print_queue(struct cli_state *cli,
807 void (*fn)(struct print_job_info *));
808 int cli_printjob_del(struct cli_state *cli, int job);
810 /* The following definitions come from libsmb/cliquota.c */
812 NTSTATUS cli_get_quota_handle(struct cli_state *cli, uint16_t *quota_fnum);
813 void free_ntquota_list(SMB_NTQUOTA_LIST **qt_list);
814 bool parse_user_quota_record(const uint8_t *rdata,
815 unsigned int rdata_count,
816 unsigned int *offset,
817 SMB_NTQUOTA_STRUCT *pqt);
818 bool add_record_to_ntquota_list(TALLOC_CTX *mem_ctx,
819 SMB_NTQUOTA_STRUCT *pqt,
820 SMB_NTQUOTA_LIST **pqt_list);
821 NTSTATUS parse_user_quota_list(const uint8_t *curdata,
822 uint32_t curdata_size,
824 SMB_NTQUOTA_LIST **pqt_list);
825 NTSTATUS parse_fs_quota_buffer(const uint8_t *rdata,
826 unsigned int rdata_count,
827 SMB_NTQUOTA_STRUCT *pqt);
828 NTSTATUS build_user_quota_buffer(SMB_NTQUOTA_LIST *qt_list,
832 SMB_NTQUOTA_LIST **end_ptr);
833 NTSTATUS build_fs_quota_buffer(TALLOC_CTX *mem_ctx,
834 const SMB_NTQUOTA_STRUCT *pqt,
837 NTSTATUS cli_get_user_quota(struct cli_state *cli, int quota_fnum,
838 SMB_NTQUOTA_STRUCT *pqt);
839 NTSTATUS cli_set_user_quota(struct cli_state *cli,
841 SMB_NTQUOTA_LIST *qtl);
842 NTSTATUS cli_list_user_quota(struct cli_state *cli, int quota_fnum,
843 SMB_NTQUOTA_LIST **pqt_list);
844 NTSTATUS cli_get_fs_quota_info(struct cli_state *cli, int quota_fnum,
845 SMB_NTQUOTA_STRUCT *pqt);
846 NTSTATUS cli_set_fs_quota_info(struct cli_state *cli, int quota_fnum,
847 SMB_NTQUOTA_STRUCT *pqt);
849 /* The following definitions come from libsmb/clireadwrite.c */
851 struct tevent_req *cli_read_andx_create(TALLOC_CTX *mem_ctx,
852 struct tevent_context *ev,
853 struct cli_state *cli, uint16_t fnum,
854 off_t offset, size_t size,
855 struct tevent_req **psmbreq);
856 struct tevent_req *cli_read_andx_send(TALLOC_CTX *mem_ctx,
857 struct tevent_context *ev,
858 struct cli_state *cli, uint16_t fnum,
859 off_t offset, size_t size);
860 NTSTATUS cli_read_andx_recv(struct tevent_req *req, ssize_t *received,
862 struct tevent_req *cli_pull_send(TALLOC_CTX *mem_ctx,
863 struct tevent_context *ev,
864 struct cli_state *cli,
865 uint16_t fnum, off_t start_offset,
866 off_t size, size_t window_size,
867 NTSTATUS (*sink)(char *buf, size_t n,
870 NTSTATUS cli_pull_recv(struct tevent_req *req, off_t *received);
871 NTSTATUS cli_pull(struct cli_state *cli, uint16_t fnum,
872 off_t start_offset, off_t size, size_t window_size,
873 NTSTATUS (*sink)(char *buf, size_t n, void *priv),
874 void *priv, off_t *received);
875 NTSTATUS cli_read_sink(char *buf, size_t n, void *priv);
876 struct tevent_req *cli_read_send(
878 struct tevent_context *ev,
879 struct cli_state *cli,
884 NTSTATUS cli_read_recv(struct tevent_req *req, size_t *received);
885 NTSTATUS cli_read(struct cli_state *cli, uint16_t fnum,
886 char *buf, off_t offset, size_t size,
888 NTSTATUS cli_smbwrite(struct cli_state *cli, uint16_t fnum, char *buf,
889 off_t offset, size_t size1, size_t *ptotal);
890 struct tevent_req *cli_write_andx_create(TALLOC_CTX *mem_ctx,
891 struct tevent_context *ev,
892 struct cli_state *cli, uint16_t fnum,
893 uint16_t mode, const uint8_t *buf,
894 off_t offset, size_t size,
895 struct tevent_req **reqs_before,
897 struct tevent_req **psmbreq);
898 struct tevent_req *cli_write_andx_send(TALLOC_CTX *mem_ctx,
899 struct tevent_context *ev,
900 struct cli_state *cli, uint16_t fnum,
901 uint16_t mode, const uint8_t *buf,
902 off_t offset, size_t size);
903 NTSTATUS cli_write_andx_recv(struct tevent_req *req, size_t *pwritten);
905 struct tevent_req *cli_write_send(TALLOC_CTX *mem_ctx,
906 struct tevent_context *ev,
907 struct cli_state *cli, uint16_t fnum,
908 uint16_t mode, const uint8_t *buf,
909 off_t offset, size_t size);
910 NTSTATUS cli_write_recv(struct tevent_req *req, size_t *pwritten);
912 struct tevent_req *cli_writeall_send(
914 struct tevent_context *ev,
915 struct cli_state *cli,
921 NTSTATUS cli_writeall_recv(struct tevent_req *req, size_t *pwritten);
922 NTSTATUS cli_writeall(struct cli_state *cli, uint16_t fnum, uint16_t mode,
923 const uint8_t *buf, off_t offset, size_t size,
926 struct tevent_req *cli_push_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
927 struct cli_state *cli,
928 uint16_t fnum, uint16_t mode,
929 off_t start_offset, size_t window_size,
930 size_t (*source)(uint8_t *buf, size_t n,
933 NTSTATUS cli_push_recv(struct tevent_req *req);
934 NTSTATUS cli_push(struct cli_state *cli, uint16_t fnum, uint16_t mode,
935 off_t start_offset, size_t window_size,
936 size_t (*source)(uint8_t *buf, size_t n, void *priv),
939 NTSTATUS cli_splice(struct cli_state *srccli, struct cli_state *dstcli,
940 uint16_t src_fnum, uint16_t dst_fnum,
942 off_t src_offset, off_t dst_offset,
944 int (*splice_cb)(off_t n, void *priv), void *priv);
946 /* The following definitions come from libsmb/clisecdesc.c */
948 NTSTATUS cli_query_security_descriptor(struct cli_state *cli,
952 struct security_descriptor **sd);
953 NTSTATUS cli_query_secdesc(struct cli_state *cli, uint16_t fnum,
954 TALLOC_CTX *mem_ctx, struct security_descriptor **sd);
955 NTSTATUS cli_set_security_descriptor(struct cli_state *cli,
958 const struct security_descriptor *sd);
959 NTSTATUS cli_set_secdesc(struct cli_state *cli, uint16_t fnum,
960 const struct security_descriptor *sd);
962 NTSTATUS cli_query_mxac(struct cli_state *cli,
963 const char *filename,
966 /* The following definitions come from libsmb/clistr.c */
968 size_t clistr_pull_talloc(TALLOC_CTX *ctx,
975 bool clistr_is_previous_version_path(const char *path,
980 /* The following definitions come from libsmb/clitrans.c */
982 struct tevent_req *cli_trans_send(
983 TALLOC_CTX *mem_ctx, struct tevent_context *ev,
984 struct cli_state *cli, uint16_t additional_flags2, uint8_t cmd,
985 const char *pipe_name, uint16_t fid, uint16_t function, int flags,
986 uint16_t *setup, uint8_t num_setup, uint8_t max_setup,
987 uint8_t *param, uint32_t num_param, uint32_t max_param,
988 uint8_t *data, uint32_t num_data, uint32_t max_data);
989 NTSTATUS cli_trans_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
990 uint16_t *recv_flags2,
991 uint16_t **setup, uint8_t min_setup,
993 uint8_t **param, uint32_t min_param,
995 uint8_t **data, uint32_t min_data,
997 NTSTATUS cli_trans(TALLOC_CTX *mem_ctx, struct cli_state *cli,
999 const char *pipe_name, uint16_t fid, uint16_t function,
1001 uint16_t *setup, uint8_t num_setup, uint8_t max_setup,
1002 uint8_t *param, uint32_t num_param, uint32_t max_param,
1003 uint8_t *data, uint32_t num_data, uint32_t max_data,
1004 uint16_t *recv_flags2,
1005 uint16_t **rsetup, uint8_t min_rsetup, uint8_t *num_rsetup,
1006 uint8_t **rparam, uint32_t min_rparam, uint32_t *num_rparam,
1007 uint8_t **rdata, uint32_t min_rdata, uint32_t *num_rdata);
1009 /* The following definitions come from libsmb/reparse_symlink.c */
1011 bool symlink_reparse_buffer_marshall(
1012 const char *substitute, const char *printname, uint32_t flags,
1013 TALLOC_CTX *mem_ctx, uint8_t **pdst, size_t *pdstlen);
1014 bool symlink_reparse_buffer_parse(
1015 const uint8_t *src, size_t srclen, TALLOC_CTX *mem_ctx,
1016 char **psubstitute_name, char **pprint_name, uint32_t *pflags);
1018 /* The following definitions come from libsmb/clisymlink.c */
1020 struct tevent_req *cli_symlink_send(TALLOC_CTX *mem_ctx,
1021 struct tevent_context *ev,
1022 struct cli_state *cli,
1023 const char *oldpath,
1024 const char *newpath,
1026 NTSTATUS cli_symlink_recv(struct tevent_req *req);
1027 NTSTATUS cli_symlink(struct cli_state *cli, const char *oldname,
1028 const char *newname, uint32_t flags);
1030 struct tevent_req *cli_readlink_send(TALLOC_CTX *mem_ctx,
1031 struct tevent_context *ev,
1032 struct cli_state *cli,
1034 NTSTATUS cli_readlink_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
1035 char **psubstitute_name, char **pprint_name,
1037 NTSTATUS cli_readlink(struct cli_state *cli, const char *fname,
1038 TALLOC_CTX *mem_ctx, char **psubstitute_name,
1039 char **pprint_name, uint32_t *pflags);
1041 NTSTATUS fill_quota_buffer(TALLOC_CTX *mem_ctx,
1042 SMB_NTQUOTA_LIST *tmp_list,
1046 SMB_NTQUOTA_LIST **end_ptr);
1047 /* The following definitions come from libsmb/passchange.c */
1049 NTSTATUS remote_password_change(const char *remote_machine,
1050 const char *domain, const char *user_name,
1051 const char *old_passwd, const char *new_passwd,
1054 #endif /* _LIBSMB_PROTO_H_ */