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_full_connection(struct cli_state **output_cli,
116 const char *dest_host,
117 const struct sockaddr_storage *dest_ss, int port,
118 const char *service, const char *service_type,
119 const char *user, const char *domain,
120 const char *password, int flags,
122 NTSTATUS cli_raw_tcon(struct cli_state *cli,
123 const char *service, const char *pass, const char *dev,
124 uint16_t *max_xmit, uint16_t *tid);
125 struct cli_state *get_ipc_connect(char *server,
126 struct sockaddr_storage *server_ss,
127 const struct user_auth_info *user_info);
128 struct cli_state *get_ipc_connect_master_ip(TALLOC_CTX *ctx,
129 struct sockaddr_storage *mb_ip,
130 const struct user_auth_info *user_info,
131 char **pp_workgroup_out);
132 struct cli_state *get_ipc_connect_master_ip_bcast(TALLOC_CTX *ctx,
133 const struct user_auth_info *user_info,
134 char **pp_workgroup_out);
136 /* The following definitions come from libsmb/clidfs.c */
138 NTSTATUS cli_cm_force_encryption_creds(struct cli_state *c,
139 struct cli_credentials *creds,
140 const char *sharename);
141 NTSTATUS cli_cm_force_encryption(struct cli_state *c,
142 const char *username,
143 const char *password,
145 const char *sharename);
146 NTSTATUS cli_cm_open(TALLOC_CTX *ctx,
147 struct cli_state *referring_cli,
150 const struct user_auth_info *auth_info,
155 struct cli_state **pcli);
156 void cli_cm_display(struct cli_state *c);
157 struct client_dfs_referral;
158 NTSTATUS cli_dfs_get_referral_ex(TALLOC_CTX *ctx,
159 struct cli_state *cli,
161 uint16_t max_referral_level,
162 struct client_dfs_referral **refs,
165 NTSTATUS cli_dfs_get_referral(TALLOC_CTX *ctx,
166 struct cli_state *cli,
168 struct client_dfs_referral **refs,
171 NTSTATUS cli_resolve_path(TALLOC_CTX *ctx,
173 const struct user_auth_info *dfs_auth_info,
174 struct cli_state *rootcli,
176 struct cli_state **targetcli,
177 char **pp_targetpath);
179 bool cli_check_msdfs_proxy(TALLOC_CTX *ctx,
180 struct cli_state *cli,
181 const char *sharename,
185 struct cli_credentials *creds);
187 /* The following definitions come from libsmb/clientgen.c */
189 int cli_set_message(char *buf,int num_words,int num_bytes,bool zero);
190 unsigned int cli_set_timeout(struct cli_state *cli, unsigned int timeout);
191 bool cli_set_backup_intent(struct cli_state *cli, bool flag);
192 extern struct GUID cli_state_client_guid;
193 struct cli_state *cli_state_create(TALLOC_CTX *mem_ctx,
195 const char *remote_name,
198 struct cli_state *cli_state_dup(TALLOC_CTX *mem_ctx,
199 struct cli_state *primary);
200 void cli_nt_pipes_close(struct cli_state *cli);
201 void cli_shutdown(struct cli_state *cli);
202 uint16_t cli_state_get_vc_num(struct cli_state *cli);
203 uint32_t cli_setpid(struct cli_state *cli, uint32_t pid);
204 uint32_t cli_getpid(struct cli_state *cli);
205 bool cli_state_is_encryption_on(struct cli_state *cli);
206 bool cli_state_has_tcon(struct cli_state *cli);
207 uint32_t cli_state_get_tid(struct cli_state *cli);
208 uint32_t cli_state_set_tid(struct cli_state *cli, uint32_t tid);
210 struct smbXcli_tcon *cli_state_save_tcon(struct cli_state *cli);
211 void cli_state_restore_tcon(struct cli_state *cli, struct smbXcli_tcon *tcon);
212 uint16_t cli_state_get_uid(struct cli_state *cli);
213 uint16_t cli_state_set_uid(struct cli_state *cli, uint16_t uid);
214 bool cli_set_case_sensitive(struct cli_state *cli, bool case_sensitive);
215 uint32_t cli_state_available_size(struct cli_state *cli, uint32_t ofs);
216 time_t cli_state_server_time(struct cli_state *cli);
217 struct tevent_req *cli_echo_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
218 struct cli_state *cli, uint16_t num_echos,
220 NTSTATUS cli_echo_recv(struct tevent_req *req);
221 NTSTATUS cli_echo(struct cli_state *cli, uint16_t num_echos, DATA_BLOB data);
222 bool is_andx_req(uint8_t cmd);
223 NTSTATUS cli_smb(TALLOC_CTX *mem_ctx, struct cli_state *cli,
224 uint8_t smb_command, uint8_t additional_flags,
225 uint8_t wct, uint16_t *vwv,
226 uint32_t num_bytes, const uint8_t *bytes,
227 struct tevent_req **result_parent,
228 uint8_t min_wct, uint8_t *pwct, uint16_t **pvwv,
229 uint32_t *pnum_bytes, uint8_t **pbytes);
231 /* The following definitions come from libsmb/clierror.c */
233 const char *cli_errstr(struct cli_state *cli);
234 NTSTATUS cli_nt_error(struct cli_state *cli);
235 void cli_dos_error(struct cli_state *cli, uint8_t *eclass, uint32_t *ecode);
236 int cli_errno(struct cli_state *cli);
237 bool cli_is_error(struct cli_state *cli);
238 bool cli_is_nt_error(struct cli_state *cli);
239 bool cli_is_dos_error(struct cli_state *cli);
240 bool cli_state_is_connected(struct cli_state *cli);
242 /* The following definitions come from libsmb/clifile.c */
244 struct tevent_req *cli_setpathinfo_send(TALLOC_CTX *mem_ctx,
245 struct tevent_context *ev,
246 struct cli_state *cli,
251 NTSTATUS cli_setpathinfo_recv(struct tevent_req *req);
252 NTSTATUS cli_setpathinfo(struct cli_state *cli,
258 struct tevent_req *cli_posix_symlink_send(TALLOC_CTX *mem_ctx,
259 struct tevent_context *ev,
260 struct cli_state *cli,
262 const char *newname);
263 NTSTATUS cli_posix_symlink_recv(struct tevent_req *req);
264 NTSTATUS cli_posix_symlink(struct cli_state *cli,
266 const char *newname);
267 struct tevent_req *cli_posix_readlink_send(TALLOC_CTX *mem_ctx,
268 struct tevent_context *ev,
269 struct cli_state *cli,
272 NTSTATUS cli_posix_readlink_recv(struct tevent_req *req, struct cli_state *cli,
273 char *retpath, size_t len);
274 NTSTATUS cli_posix_readlink(struct cli_state *cli, const char *fname,
275 char *linkpath, size_t len);
276 struct tevent_req *cli_posix_hardlink_send(TALLOC_CTX *mem_ctx,
277 struct tevent_context *ev,
278 struct cli_state *cli,
280 const char *newname);
281 NTSTATUS cli_posix_hardlink_recv(struct tevent_req *req);
282 NTSTATUS cli_posix_hardlink(struct cli_state *cli,
284 const char *newname);
285 uint32_t unix_perms_to_wire(mode_t perms);
286 mode_t wire_perms_to_unix(uint32_t perms);
287 struct tevent_req *cli_posix_getacl_send(TALLOC_CTX *mem_ctx,
288 struct tevent_context *ev,
289 struct cli_state *cli,
291 NTSTATUS cli_posix_getacl_recv(struct tevent_req *req,
295 NTSTATUS cli_posix_getacl(struct cli_state *cli,
300 struct tevent_req *cli_posix_setacl_send(TALLOC_CTX *mem_ctx,
301 struct tevent_context *ev,
302 struct cli_state *cli,
305 size_t acl_buf_size);
306 NTSTATUS cli_posix_setacl_recv(struct tevent_req *req);
307 NTSTATUS cli_posix_setacl(struct cli_state *cli,
310 size_t acl_buf_size);
311 struct tevent_req *cli_posix_stat_send(TALLOC_CTX *mem_ctx,
312 struct tevent_context *ev,
313 struct cli_state *cli,
315 NTSTATUS cli_posix_stat_recv(struct tevent_req *req,
316 SMB_STRUCT_STAT *sbuf);
317 NTSTATUS cli_posix_stat(struct cli_state *cli,
319 SMB_STRUCT_STAT *sbuf);
320 struct tevent_req *cli_posix_chmod_send(TALLOC_CTX *mem_ctx,
321 struct tevent_context *ev,
322 struct cli_state *cli,
325 NTSTATUS cli_posix_chmod_recv(struct tevent_req *req);
326 NTSTATUS cli_posix_chmod(struct cli_state *cli, const char *fname, mode_t mode);
327 struct tevent_req *cli_posix_chown_send(TALLOC_CTX *mem_ctx,
328 struct tevent_context *ev,
329 struct cli_state *cli,
333 NTSTATUS cli_posix_chown_recv(struct tevent_req *req);
334 NTSTATUS cli_posix_chown(struct cli_state *cli,
338 struct tevent_req *cli_rename_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,
344 NTSTATUS cli_rename_recv(struct tevent_req *req);
345 NTSTATUS cli_rename(struct cli_state *cli,
346 const char *fname_src,
347 const char *fname_dst,
349 struct tevent_req *cli_ntrename_send(TALLOC_CTX *mem_ctx,
350 struct tevent_context *ev,
351 struct cli_state *cli,
352 const char *fname_src,
353 const char *fname_dst);
354 NTSTATUS cli_ntrename_recv(struct tevent_req *req);
355 NTSTATUS cli_ntrename(struct cli_state *cli, const char *fname_src, const char *fname_dst);
357 struct tevent_req *cli_nt_hardlink_send(TALLOC_CTX *mem_ctx,
358 struct tevent_context *ev,
359 struct cli_state *cli,
360 const char *fname_src,
361 const char *fname_dst);
362 NTSTATUS cli_nt_hardlink_recv(struct tevent_req *req);
363 NTSTATUS cli_nt_hardlink(struct cli_state *cli, const char *fname_src, const char *fname_dst);
365 struct tevent_req *cli_unlink_send(TALLOC_CTX *mem_ctx,
366 struct tevent_context *ev,
367 struct cli_state *cli,
369 uint16_t mayhave_attrs);
370 NTSTATUS cli_unlink_recv(struct tevent_req *req);
371 NTSTATUS cli_unlink(struct cli_state *cli, const char *fname, uint16_t mayhave_attrs);
373 struct tevent_req *cli_mkdir_send(TALLOC_CTX *mem_ctx,
374 struct tevent_context *ev,
375 struct cli_state *cli,
377 NTSTATUS cli_mkdir_recv(struct tevent_req *req);
378 NTSTATUS cli_mkdir(struct cli_state *cli, const char *dname);
379 struct tevent_req *cli_rmdir_send(TALLOC_CTX *mem_ctx,
380 struct tevent_context *ev,
381 struct cli_state *cli,
383 NTSTATUS cli_rmdir_recv(struct tevent_req *req);
384 NTSTATUS cli_rmdir(struct cli_state *cli, const char *dname);
385 struct tevent_req *cli_nt_delete_on_close_send(TALLOC_CTX *mem_ctx,
386 struct tevent_context *ev,
387 struct cli_state *cli,
390 NTSTATUS cli_nt_delete_on_close_recv(struct tevent_req *req);
391 NTSTATUS cli_nt_delete_on_close(struct cli_state *cli, uint16_t fnum, bool flag);
392 struct tevent_req *cli_ntcreate_send(TALLOC_CTX *mem_ctx,
393 struct tevent_context *ev,
394 struct cli_state *cli,
397 uint32_t DesiredAccess,
398 uint32_t FileAttributes,
399 uint32_t ShareAccess,
400 uint32_t CreateDisposition,
401 uint32_t CreateOptions,
402 uint32_t ImpersonationLevel,
403 uint8_t SecurityFlags);
404 NTSTATUS cli_ntcreate_recv(struct tevent_req *req,
406 struct smb_create_returns *cr);
407 NTSTATUS cli_ntcreate(struct cli_state *cli,
410 uint32_t DesiredAccess,
411 uint32_t FileAttributes,
412 uint32_t ShareAccess,
413 uint32_t CreateDisposition,
414 uint32_t CreateOptions,
415 uint8_t SecurityFlags,
417 struct smb_create_returns *cr);
418 struct tevent_req *cli_openx_create(TALLOC_CTX *mem_ctx,
419 struct tevent_context *ev,
420 struct cli_state *cli, const char *fname,
421 int flags, int share_mode,
422 struct tevent_req **psmbreq);
423 struct tevent_req *cli_openx_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
424 struct cli_state *cli, const char *fname,
425 int flags, int share_mode);
426 NTSTATUS cli_openx_recv(struct tevent_req *req, uint16_t *fnum);
427 NTSTATUS cli_openx(struct cli_state *cli, const char *fname, int flags, int share_mode, uint16_t *pfnum);
428 NTSTATUS cli_open(struct cli_state *cli, const char *fname, int flags, int share_mode, uint16_t *pfnum);
429 struct tevent_req *cli_smb1_close_create(TALLOC_CTX *mem_ctx,
430 struct tevent_context *ev,
431 struct cli_state *cli, uint16_t fnum,
432 struct tevent_req **psubreq);
433 struct tevent_req *cli_close_send(TALLOC_CTX *mem_ctx,
434 struct tevent_context *ev,
435 struct cli_state *cli, uint16_t fnum);
436 NTSTATUS cli_close_recv(struct tevent_req *req);
437 NTSTATUS cli_close(struct cli_state *cli, uint16_t fnum);
438 struct tevent_req *cli_ftruncate_send(TALLOC_CTX *mem_ctx,
439 struct tevent_context *ev,
440 struct cli_state *cli,
443 NTSTATUS cli_ftruncate_recv(struct tevent_req *req);
444 NTSTATUS cli_ftruncate(struct cli_state *cli, uint16_t fnum, uint64_t size);
445 NTSTATUS cli_locktype(struct cli_state *cli, uint16_t fnum,
446 uint32_t offset, uint32_t len,
447 int timeout, unsigned char locktype);
448 NTSTATUS cli_lock32(struct cli_state *cli, uint16_t fnum, uint32_t offset,
449 uint32_t len, int timeout, enum brl_type lock_type);
450 struct tevent_req *cli_unlock_send(TALLOC_CTX *mem_ctx,
451 struct tevent_context *ev,
452 struct cli_state *cli,
456 NTSTATUS cli_unlock_recv(struct tevent_req *req);
457 NTSTATUS cli_unlock(struct cli_state *cli, uint16_t fnum, uint32_t offset, uint32_t len);
458 NTSTATUS cli_lock64(struct cli_state *cli, uint16_t fnum,
459 uint64_t offset, uint64_t len, int timeout,
460 enum brl_type lock_type);
461 struct tevent_req *cli_unlock64_send(TALLOC_CTX *mem_ctx,
462 struct tevent_context *ev,
463 struct cli_state *cli,
467 NTSTATUS cli_unlock64_recv(struct tevent_req *req);
468 NTSTATUS cli_unlock64(struct cli_state *cli, uint16_t fnum, uint64_t offset, uint64_t len);
469 struct tevent_req *cli_posix_lock_send(TALLOC_CTX *mem_ctx,
470 struct tevent_context *ev,
471 struct cli_state *cli,
476 enum brl_type lock_type);
477 NTSTATUS cli_posix_lock_recv(struct tevent_req *req);
478 NTSTATUS cli_posix_lock(struct cli_state *cli, uint16_t fnum,
479 uint64_t offset, uint64_t len,
480 bool wait_lock, enum brl_type lock_type);
481 struct tevent_req *cli_posix_unlock_send(TALLOC_CTX *mem_ctx,
482 struct tevent_context *ev,
483 struct cli_state *cli,
487 NTSTATUS cli_posix_unlock_recv(struct tevent_req *req);
488 NTSTATUS cli_posix_unlock(struct cli_state *cli, uint16_t fnum, uint64_t offset, uint64_t len);
489 struct tevent_req *cli_getattrE_send(TALLOC_CTX *mem_ctx,
490 struct tevent_context *ev,
491 struct cli_state *cli,
493 NTSTATUS cli_getattrE_recv(struct tevent_req *req,
499 NTSTATUS cli_getattrE(struct cli_state *cli,
506 struct tevent_req *cli_setattrE_send(TALLOC_CTX *mem_ctx,
507 struct tevent_context *ev,
508 struct cli_state *cli,
513 NTSTATUS cli_setattrE_recv(struct tevent_req *req);
514 NTSTATUS cli_setattrE(struct cli_state *cli,
519 struct tevent_req *cli_getatr_send(TALLOC_CTX *mem_ctx,
520 struct tevent_context *ev,
521 struct cli_state *cli,
523 NTSTATUS cli_getatr_recv(struct tevent_req *req,
527 NTSTATUS cli_getatr(struct cli_state *cli,
532 struct tevent_req *cli_setatr_send(TALLOC_CTX *mem_ctx,
533 struct tevent_context *ev,
534 struct cli_state *cli,
538 NTSTATUS cli_setatr_recv(struct tevent_req *req);
539 NTSTATUS cli_setatr(struct cli_state *cli,
543 struct tevent_req *cli_chkpath_send(TALLOC_CTX *mem_ctx,
544 struct tevent_context *ev,
545 struct cli_state *cli,
547 NTSTATUS cli_chkpath_recv(struct tevent_req *req);
548 NTSTATUS cli_chkpath(struct cli_state *cli, const char *path);
549 struct tevent_req *cli_dskattr_send(TALLOC_CTX *mem_ctx,
550 struct tevent_context *ev,
551 struct cli_state *cli);
552 NTSTATUS cli_dskattr_recv(struct tevent_req *req, int *bsize, int *total,
554 NTSTATUS cli_dskattr(struct cli_state *cli, int *bsize, int *total, int *avail);
555 NTSTATUS cli_disk_size(struct cli_state *cli, const char *path, uint64_t *bsize,
556 uint64_t *total, uint64_t *avail);
557 struct tevent_req *cli_ctemp_send(TALLOC_CTX *mem_ctx,
558 struct tevent_context *ev,
559 struct cli_state *cli,
561 NTSTATUS cli_ctemp_recv(struct tevent_req *req,
565 NTSTATUS cli_ctemp(struct cli_state *cli,
570 NTSTATUS cli_raw_ioctl(struct cli_state *cli, uint16_t fnum, uint32_t code, DATA_BLOB *blob);
571 NTSTATUS cli_set_ea_path(struct cli_state *cli, const char *path,
572 const char *ea_name, const char *ea_val,
574 NTSTATUS cli_set_ea_fnum(struct cli_state *cli, uint16_t fnum,
575 const char *ea_name, const char *ea_val,
577 struct tevent_req *cli_get_ea_list_path_send(TALLOC_CTX *mem_ctx,
578 struct tevent_context *ev,
579 struct cli_state *cli,
581 NTSTATUS cli_get_ea_list_path_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
582 size_t *pnum_eas, struct ea_struct **peas);
583 NTSTATUS cli_get_ea_list_path(struct cli_state *cli, const char *path,
586 struct ea_struct **pea_list);
587 struct tevent_req *cli_posix_open_send(TALLOC_CTX *mem_ctx,
588 struct tevent_context *ev,
589 struct cli_state *cli,
593 NTSTATUS cli_posix_open_recv(struct tevent_req *req, uint16_t *pfnum);
594 NTSTATUS cli_posix_open(struct cli_state *cli, const char *fname,
595 int flags, mode_t mode, uint16_t *fnum);
596 struct tevent_req *cli_posix_mkdir_send(TALLOC_CTX *mem_ctx,
597 struct tevent_context *ev,
598 struct cli_state *cli,
601 NTSTATUS cli_posix_mkdir_recv(struct tevent_req *req);
602 NTSTATUS cli_posix_mkdir(struct cli_state *cli, const char *fname, mode_t mode);
604 struct tevent_req *cli_posix_unlink_send(TALLOC_CTX *mem_ctx,
605 struct tevent_context *ev,
606 struct cli_state *cli,
608 NTSTATUS cli_posix_unlink_recv(struct tevent_req *req);
609 NTSTATUS cli_posix_unlink(struct cli_state *cli, const char *fname);
611 struct tevent_req *cli_posix_rmdir_send(TALLOC_CTX *mem_ctx,
612 struct tevent_context *ev,
613 struct cli_state *cli,
615 NTSTATUS cli_posix_rmdir_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx);
616 NTSTATUS cli_posix_rmdir(struct cli_state *cli, const char *fname);
617 struct tevent_req *cli_notify_send(TALLOC_CTX *mem_ctx,
618 struct tevent_context *ev,
619 struct cli_state *cli, uint16_t fnum,
620 uint32_t buffer_size,
621 uint32_t completion_filter, bool recursive);
622 NTSTATUS cli_notify_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
623 uint32_t *pnum_changes,
624 struct notify_change **pchanges);
625 NTSTATUS cli_notify(struct cli_state *cli, uint16_t fnum, uint32_t buffer_size,
626 uint32_t completion_filter, bool recursive,
627 TALLOC_CTX *mem_ctx, uint32_t *pnum_changes,
628 struct notify_change **pchanges);
630 struct tevent_req *cli_nttrans_create_send(TALLOC_CTX *mem_ctx,
631 struct tevent_context *ev,
632 struct cli_state *cli,
635 uint32_t DesiredAccess,
636 uint32_t FileAttributes,
637 uint32_t ShareAccess,
638 uint32_t CreateDisposition,
639 uint32_t CreateOptions,
640 uint8_t SecurityFlags,
641 struct security_descriptor *secdesc,
642 struct ea_struct *eas,
644 NTSTATUS cli_nttrans_create_recv(struct tevent_req *req,
646 struct smb_create_returns *cr);
647 NTSTATUS cli_nttrans_create(struct cli_state *cli,
650 uint32_t DesiredAccess,
651 uint32_t FileAttributes,
652 uint32_t ShareAccess,
653 uint32_t CreateDisposition,
654 uint32_t CreateOptions,
655 uint8_t SecurityFlags,
656 struct security_descriptor *secdesc,
657 struct ea_struct *eas,
660 struct smb_create_returns *cr);
662 /* The following definitions come from libsmb/clifsinfo.c */
664 struct tevent_req *cli_unix_extensions_version_send(TALLOC_CTX *mem_ctx,
665 struct tevent_context *ev,
666 struct cli_state *cli);
667 NTSTATUS cli_unix_extensions_version_recv(struct tevent_req *req,
668 uint16_t *pmajor, uint16_t *pminor,
671 NTSTATUS cli_unix_extensions_version(struct cli_state *cli, uint16_t *pmajor,
672 uint16_t *pminor, uint32_t *pcaplow,
674 struct tevent_req *cli_set_unix_extensions_capabilities_send(
675 TALLOC_CTX *mem_ctx, struct tevent_context *ev, struct cli_state *cli,
676 uint16_t major, uint16_t minor, uint32_t caplow, uint32_t caphigh);
677 NTSTATUS cli_set_unix_extensions_capabilities_recv(struct tevent_req *req);
678 NTSTATUS cli_set_unix_extensions_capabilities(struct cli_state *cli,
679 uint16_t major, uint16_t minor,
680 uint32_t caplow, uint32_t caphigh);
681 struct tevent_req *cli_get_fs_attr_info_send(TALLOC_CTX *mem_ctx,
682 struct tevent_context *ev,
683 struct cli_state *cli);
684 NTSTATUS cli_get_fs_attr_info_recv(struct tevent_req *req, uint32_t *fs_attr);
685 NTSTATUS cli_get_fs_attr_info(struct cli_state *cli, uint32_t *fs_attr);
686 NTSTATUS cli_get_fs_volume_info(struct cli_state *cli,
687 TALLOC_CTX *mem_ctx, char **volume_name,
688 uint32_t *pserial_number, time_t *pdate);
689 NTSTATUS cli_get_fs_full_size_info(struct cli_state *cli,
690 uint64_t *total_allocation_units,
691 uint64_t *caller_allocation_units,
692 uint64_t *actual_allocation_units,
693 uint64_t *sectors_per_allocation_unit,
694 uint64_t *bytes_per_sector);
695 NTSTATUS cli_get_posix_fs_info(struct cli_state *cli,
696 uint32_t *optimal_transfer_size,
697 uint32_t *block_size,
698 uint64_t *total_blocks,
699 uint64_t *blocks_available,
700 uint64_t *user_blocks_available,
701 uint64_t *total_file_nodes,
702 uint64_t *free_file_nodes,
703 uint64_t *fs_identifier);
704 struct tevent_req *cli_posix_whoami_send(TALLOC_CTX *mem_ctx,
705 struct tevent_context *ev,
706 struct cli_state *cli);
707 NTSTATUS cli_posix_whoami_recv(struct tevent_req *req,
714 struct dom_sid **psids,
716 NTSTATUS cli_posix_whoami(struct cli_state *cli,
723 struct dom_sid **sids,
726 /* The following definitions come from libsmb/clilist.c */
728 NTSTATUS cli_list_old(struct cli_state *cli,const char *Mask,uint16_t attribute,
729 NTSTATUS (*fn)(const char *, struct file_info *,
730 const char *, void *), void *state);
731 NTSTATUS cli_list_trans(struct cli_state *cli, const char *mask,
732 uint16_t attribute, int info_level,
733 NTSTATUS (*fn)(const char *mnt, struct file_info *finfo,
734 const char *mask, void *private_data),
736 struct tevent_req *cli_list_send(TALLOC_CTX *mem_ctx,
737 struct tevent_context *ev,
738 struct cli_state *cli,
741 uint16_t info_level);
742 NTSTATUS cli_list_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
743 struct file_info **finfo, size_t *num_finfo);
744 NTSTATUS cli_list(struct cli_state *cli,const char *Mask,uint16_t attribute,
745 NTSTATUS (*fn)(const char *, struct file_info *, const char *,
746 void *), void *state);
748 /* The following definitions come from libsmb/climessage.c */
750 struct tevent_req *cli_message_send(TALLOC_CTX *mem_ctx,
751 struct tevent_context *ev,
752 struct cli_state *cli,
753 const char *host, const char *username,
754 const char *message);
755 NTSTATUS cli_message_recv(struct tevent_req *req);
756 NTSTATUS cli_message(struct cli_state *cli, const char *host,
757 const char *username, const char *message);
759 /* The following definitions come from libsmb/clioplock.c */
761 struct tevent_req *cli_smb_oplock_break_waiter_send(TALLOC_CTX *mem_ctx,
762 struct tevent_context *ev,
763 struct cli_state *cli);
764 NTSTATUS cli_smb_oplock_break_waiter_recv(struct tevent_req *req,
768 struct tevent_req *cli_oplock_ack_send(TALLOC_CTX *mem_ctx,
769 struct tevent_context *ev,
770 struct cli_state *cli,
771 uint16_t fnum, uint8_t level);
772 NTSTATUS cli_oplock_ack_recv(struct tevent_req *req);
774 /* The following definitions come from libsmb/cliprint.c */
776 int cli_print_queue(struct cli_state *cli,
777 void (*fn)(struct print_job_info *));
778 int cli_printjob_del(struct cli_state *cli, int job);
780 /* The following definitions come from libsmb/cliquota.c */
782 NTSTATUS cli_get_quota_handle(struct cli_state *cli, uint16_t *quota_fnum);
783 void free_ntquota_list(SMB_NTQUOTA_LIST **qt_list);
784 bool parse_user_quota_record(const uint8_t *rdata,
785 unsigned int rdata_count,
786 unsigned int *offset,
787 SMB_NTQUOTA_STRUCT *pqt);
788 bool add_record_to_ntquota_list(TALLOC_CTX *mem_ctx,
789 SMB_NTQUOTA_STRUCT *pqt,
790 SMB_NTQUOTA_LIST **pqt_list);
791 NTSTATUS parse_user_quota_list(const uint8_t *curdata,
792 uint32_t curdata_size,
794 SMB_NTQUOTA_LIST **pqt_list);
795 NTSTATUS parse_fs_quota_buffer(const uint8_t *rdata,
796 unsigned int rdata_count,
797 SMB_NTQUOTA_STRUCT *pqt);
798 NTSTATUS build_user_quota_buffer(SMB_NTQUOTA_LIST *qt_list,
802 SMB_NTQUOTA_LIST **end_ptr);
803 NTSTATUS build_fs_quota_buffer(TALLOC_CTX *mem_ctx,
804 const SMB_NTQUOTA_STRUCT *pqt,
807 NTSTATUS cli_get_user_quota(struct cli_state *cli, int quota_fnum,
808 SMB_NTQUOTA_STRUCT *pqt);
809 NTSTATUS cli_set_user_quota(struct cli_state *cli,
811 SMB_NTQUOTA_LIST *qtl);
812 NTSTATUS cli_list_user_quota(struct cli_state *cli, int quota_fnum,
813 SMB_NTQUOTA_LIST **pqt_list);
814 NTSTATUS cli_get_fs_quota_info(struct cli_state *cli, int quota_fnum,
815 SMB_NTQUOTA_STRUCT *pqt);
816 NTSTATUS cli_set_fs_quota_info(struct cli_state *cli, int quota_fnum,
817 SMB_NTQUOTA_STRUCT *pqt);
819 /* The following definitions come from libsmb/clireadwrite.c */
821 struct tevent_req *cli_read_andx_create(TALLOC_CTX *mem_ctx,
822 struct tevent_context *ev,
823 struct cli_state *cli, uint16_t fnum,
824 off_t offset, size_t size,
825 struct tevent_req **psmbreq);
826 struct tevent_req *cli_read_andx_send(TALLOC_CTX *mem_ctx,
827 struct tevent_context *ev,
828 struct cli_state *cli, uint16_t fnum,
829 off_t offset, size_t size);
830 NTSTATUS cli_read_andx_recv(struct tevent_req *req, ssize_t *received,
832 struct tevent_req *cli_pull_send(TALLOC_CTX *mem_ctx,
833 struct tevent_context *ev,
834 struct cli_state *cli,
835 uint16_t fnum, off_t start_offset,
836 off_t size, size_t window_size,
837 NTSTATUS (*sink)(char *buf, size_t n,
840 NTSTATUS cli_pull_recv(struct tevent_req *req, off_t *received);
841 NTSTATUS cli_pull(struct cli_state *cli, uint16_t fnum,
842 off_t start_offset, off_t size, size_t window_size,
843 NTSTATUS (*sink)(char *buf, size_t n, void *priv),
844 void *priv, off_t *received);
845 NTSTATUS cli_read_sink(char *buf, size_t n, void *priv);
846 struct tevent_req *cli_read_send(
848 struct tevent_context *ev,
849 struct cli_state *cli,
854 NTSTATUS cli_read_recv(struct tevent_req *req, size_t *received);
855 NTSTATUS cli_read(struct cli_state *cli, uint16_t fnum,
856 char *buf, off_t offset, size_t size,
858 NTSTATUS cli_smbwrite(struct cli_state *cli, uint16_t fnum, char *buf,
859 off_t offset, size_t size1, size_t *ptotal);
860 struct tevent_req *cli_write_andx_create(TALLOC_CTX *mem_ctx,
861 struct tevent_context *ev,
862 struct cli_state *cli, uint16_t fnum,
863 uint16_t mode, const uint8_t *buf,
864 off_t offset, size_t size,
865 struct tevent_req **reqs_before,
867 struct tevent_req **psmbreq);
868 struct tevent_req *cli_write_andx_send(TALLOC_CTX *mem_ctx,
869 struct tevent_context *ev,
870 struct cli_state *cli, uint16_t fnum,
871 uint16_t mode, const uint8_t *buf,
872 off_t offset, size_t size);
873 NTSTATUS cli_write_andx_recv(struct tevent_req *req, size_t *pwritten);
875 struct tevent_req *cli_write_send(TALLOC_CTX *mem_ctx,
876 struct tevent_context *ev,
877 struct cli_state *cli, uint16_t fnum,
878 uint16_t mode, const uint8_t *buf,
879 off_t offset, size_t size);
880 NTSTATUS cli_write_recv(struct tevent_req *req, size_t *pwritten);
882 struct tevent_req *cli_writeall_send(
884 struct tevent_context *ev,
885 struct cli_state *cli,
891 NTSTATUS cli_writeall_recv(struct tevent_req *req, size_t *pwritten);
892 NTSTATUS cli_writeall(struct cli_state *cli, uint16_t fnum, uint16_t mode,
893 const uint8_t *buf, off_t offset, size_t size,
896 struct tevent_req *cli_push_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
897 struct cli_state *cli,
898 uint16_t fnum, uint16_t mode,
899 off_t start_offset, size_t window_size,
900 size_t (*source)(uint8_t *buf, size_t n,
903 NTSTATUS cli_push_recv(struct tevent_req *req);
904 NTSTATUS cli_push(struct cli_state *cli, uint16_t fnum, uint16_t mode,
905 off_t start_offset, size_t window_size,
906 size_t (*source)(uint8_t *buf, size_t n, void *priv),
909 NTSTATUS cli_splice(struct cli_state *srccli, struct cli_state *dstcli,
910 uint16_t src_fnum, uint16_t dst_fnum,
912 off_t src_offset, off_t dst_offset,
914 int (*splice_cb)(off_t n, void *priv), void *priv);
916 /* The following definitions come from libsmb/clisecdesc.c */
918 NTSTATUS cli_query_security_descriptor(struct cli_state *cli,
922 struct security_descriptor **sd);
923 NTSTATUS cli_query_secdesc(struct cli_state *cli, uint16_t fnum,
924 TALLOC_CTX *mem_ctx, struct security_descriptor **sd);
925 NTSTATUS cli_set_security_descriptor(struct cli_state *cli,
928 const struct security_descriptor *sd);
929 NTSTATUS cli_set_secdesc(struct cli_state *cli, uint16_t fnum,
930 const struct security_descriptor *sd);
932 /* The following definitions come from libsmb/clistr.c */
934 size_t clistr_pull_talloc(TALLOC_CTX *ctx,
941 bool clistr_is_previous_version_path(const char *path,
946 /* The following definitions come from libsmb/clitrans.c */
948 struct tevent_req *cli_trans_send(
949 TALLOC_CTX *mem_ctx, struct tevent_context *ev,
950 struct cli_state *cli, uint16_t additional_flags2, uint8_t cmd,
951 const char *pipe_name, uint16_t fid, uint16_t function, int flags,
952 uint16_t *setup, uint8_t num_setup, uint8_t max_setup,
953 uint8_t *param, uint32_t num_param, uint32_t max_param,
954 uint8_t *data, uint32_t num_data, uint32_t max_data);
955 NTSTATUS cli_trans_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
956 uint16_t *recv_flags2,
957 uint16_t **setup, uint8_t min_setup,
959 uint8_t **param, uint32_t min_param,
961 uint8_t **data, uint32_t min_data,
963 NTSTATUS cli_trans(TALLOC_CTX *mem_ctx, struct cli_state *cli,
965 const char *pipe_name, uint16_t fid, uint16_t function,
967 uint16_t *setup, uint8_t num_setup, uint8_t max_setup,
968 uint8_t *param, uint32_t num_param, uint32_t max_param,
969 uint8_t *data, uint32_t num_data, uint32_t max_data,
970 uint16_t *recv_flags2,
971 uint16_t **rsetup, uint8_t min_rsetup, uint8_t *num_rsetup,
972 uint8_t **rparam, uint32_t min_rparam, uint32_t *num_rparam,
973 uint8_t **rdata, uint32_t min_rdata, uint32_t *num_rdata);
975 /* The following definitions come from libsmb/reparse_symlink.c */
977 bool symlink_reparse_buffer_marshall(
978 const char *substitute, const char *printname, uint32_t flags,
979 TALLOC_CTX *mem_ctx, uint8_t **pdst, size_t *pdstlen);
980 bool symlink_reparse_buffer_parse(
981 const uint8_t *src, size_t srclen, TALLOC_CTX *mem_ctx,
982 char **psubstitute_name, char **pprint_name, uint32_t *pflags);
984 /* The following definitions come from libsmb/clisymlink.c */
986 struct tevent_req *cli_symlink_send(TALLOC_CTX *mem_ctx,
987 struct tevent_context *ev,
988 struct cli_state *cli,
992 NTSTATUS cli_symlink_recv(struct tevent_req *req);
993 NTSTATUS cli_symlink(struct cli_state *cli, const char *oldname,
994 const char *newname, uint32_t flags);
996 struct tevent_req *cli_readlink_send(TALLOC_CTX *mem_ctx,
997 struct tevent_context *ev,
998 struct cli_state *cli,
1000 NTSTATUS cli_readlink_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
1001 char **psubstitute_name, char **pprint_name,
1003 NTSTATUS cli_readlink(struct cli_state *cli, const char *fname,
1004 TALLOC_CTX *mem_ctx, char **psubstitute_name,
1005 char **pprint_name, uint32_t *pflags);
1007 NTSTATUS fill_quota_buffer(TALLOC_CTX *mem_ctx,
1008 SMB_NTQUOTA_LIST *tmp_list,
1012 SMB_NTQUOTA_LIST **end_ptr);
1013 /* The following definitions come from libsmb/passchange.c */
1015 NTSTATUS remote_password_change(const char *remote_machine,
1016 const char *domain, const char *user_name,
1017 const char *old_passwd, const char *new_passwd,
1020 #endif /* _LIBSMB_PROTO_H_ */