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);
332 NTSTATUS cli_rename_recv(struct tevent_req *req);
333 NTSTATUS cli_rename(struct cli_state *cli, const char *fname_src, const char *fname_dst);
334 struct tevent_req *cli_ntrename_send(TALLOC_CTX *mem_ctx,
335 struct tevent_context *ev,
336 struct cli_state *cli,
337 const char *fname_src,
338 const char *fname_dst);
339 NTSTATUS cli_ntrename_recv(struct tevent_req *req);
340 NTSTATUS cli_ntrename(struct cli_state *cli, const char *fname_src, const char *fname_dst);
342 struct tevent_req *cli_nt_hardlink_send(TALLOC_CTX *mem_ctx,
343 struct tevent_context *ev,
344 struct cli_state *cli,
345 const char *fname_src,
346 const char *fname_dst);
347 NTSTATUS cli_nt_hardlink_recv(struct tevent_req *req);
348 NTSTATUS cli_nt_hardlink(struct cli_state *cli, const char *fname_src, const char *fname_dst);
350 struct tevent_req *cli_unlink_send(TALLOC_CTX *mem_ctx,
351 struct tevent_context *ev,
352 struct cli_state *cli,
354 uint16_t mayhave_attrs);
355 NTSTATUS cli_unlink_recv(struct tevent_req *req);
356 NTSTATUS cli_unlink(struct cli_state *cli, const char *fname, uint16_t mayhave_attrs);
358 struct tevent_req *cli_mkdir_send(TALLOC_CTX *mem_ctx,
359 struct tevent_context *ev,
360 struct cli_state *cli,
362 NTSTATUS cli_mkdir_recv(struct tevent_req *req);
363 NTSTATUS cli_mkdir(struct cli_state *cli, const char *dname);
364 struct tevent_req *cli_rmdir_send(TALLOC_CTX *mem_ctx,
365 struct tevent_context *ev,
366 struct cli_state *cli,
368 NTSTATUS cli_rmdir_recv(struct tevent_req *req);
369 NTSTATUS cli_rmdir(struct cli_state *cli, const char *dname);
370 struct tevent_req *cli_nt_delete_on_close_send(TALLOC_CTX *mem_ctx,
371 struct tevent_context *ev,
372 struct cli_state *cli,
375 NTSTATUS cli_nt_delete_on_close_recv(struct tevent_req *req);
376 NTSTATUS cli_nt_delete_on_close(struct cli_state *cli, uint16_t fnum, bool flag);
377 struct tevent_req *cli_ntcreate_send(TALLOC_CTX *mem_ctx,
378 struct tevent_context *ev,
379 struct cli_state *cli,
382 uint32_t DesiredAccess,
383 uint32_t FileAttributes,
384 uint32_t ShareAccess,
385 uint32_t CreateDisposition,
386 uint32_t CreateOptions,
387 uint8_t SecurityFlags);
388 NTSTATUS cli_ntcreate_recv(struct tevent_req *req,
390 struct smb_create_returns *cr);
391 NTSTATUS cli_ntcreate(struct cli_state *cli,
394 uint32_t DesiredAccess,
395 uint32_t FileAttributes,
396 uint32_t ShareAccess,
397 uint32_t CreateDisposition,
398 uint32_t CreateOptions,
399 uint8_t SecurityFlags,
401 struct smb_create_returns *cr);
402 struct tevent_req *cli_openx_create(TALLOC_CTX *mem_ctx,
403 struct tevent_context *ev,
404 struct cli_state *cli, const char *fname,
405 int flags, int share_mode,
406 struct tevent_req **psmbreq);
407 struct tevent_req *cli_openx_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
408 struct cli_state *cli, const char *fname,
409 int flags, int share_mode);
410 NTSTATUS cli_openx_recv(struct tevent_req *req, uint16_t *fnum);
411 NTSTATUS cli_openx(struct cli_state *cli, const char *fname, int flags, int share_mode, uint16_t *pfnum);
412 NTSTATUS cli_open(struct cli_state *cli, const char *fname, int flags, int share_mode, uint16_t *pfnum);
413 struct tevent_req *cli_close_create(TALLOC_CTX *mem_ctx,
414 struct tevent_context *ev,
415 struct cli_state *cli, uint16_t fnum,
416 struct tevent_req **psubreq);
417 struct tevent_req *cli_close_send(TALLOC_CTX *mem_ctx,
418 struct tevent_context *ev,
419 struct cli_state *cli, uint16_t fnum);
420 NTSTATUS cli_close_recv(struct tevent_req *req);
421 NTSTATUS cli_close(struct cli_state *cli, uint16_t fnum);
422 struct tevent_req *cli_ftruncate_send(TALLOC_CTX *mem_ctx,
423 struct tevent_context *ev,
424 struct cli_state *cli,
427 NTSTATUS cli_ftruncate_recv(struct tevent_req *req);
428 NTSTATUS cli_ftruncate(struct cli_state *cli, uint16_t fnum, uint64_t size);
429 NTSTATUS cli_locktype(struct cli_state *cli, uint16_t fnum,
430 uint32_t offset, uint32_t len,
431 int timeout, unsigned char locktype);
432 NTSTATUS cli_lock32(struct cli_state *cli, uint16_t fnum, uint32_t offset,
433 uint32_t len, int timeout, enum brl_type lock_type);
434 struct tevent_req *cli_unlock_send(TALLOC_CTX *mem_ctx,
435 struct tevent_context *ev,
436 struct cli_state *cli,
440 NTSTATUS cli_unlock_recv(struct tevent_req *req);
441 NTSTATUS cli_unlock(struct cli_state *cli, uint16_t fnum, uint32_t offset, uint32_t len);
442 NTSTATUS cli_lock64(struct cli_state *cli, uint16_t fnum,
443 uint64_t offset, uint64_t len, int timeout,
444 enum brl_type lock_type);
445 struct tevent_req *cli_unlock64_send(TALLOC_CTX *mem_ctx,
446 struct tevent_context *ev,
447 struct cli_state *cli,
451 NTSTATUS cli_unlock64_recv(struct tevent_req *req);
452 NTSTATUS cli_unlock64(struct cli_state *cli, uint16_t fnum, uint64_t offset, uint64_t len);
453 struct tevent_req *cli_posix_lock_send(TALLOC_CTX *mem_ctx,
454 struct tevent_context *ev,
455 struct cli_state *cli,
460 enum brl_type lock_type);
461 NTSTATUS cli_posix_lock_recv(struct tevent_req *req);
462 NTSTATUS cli_posix_lock(struct cli_state *cli, uint16_t fnum,
463 uint64_t offset, uint64_t len,
464 bool wait_lock, enum brl_type lock_type);
465 struct tevent_req *cli_posix_unlock_send(TALLOC_CTX *mem_ctx,
466 struct tevent_context *ev,
467 struct cli_state *cli,
471 NTSTATUS cli_posix_unlock_recv(struct tevent_req *req);
472 NTSTATUS cli_posix_unlock(struct cli_state *cli, uint16_t fnum, uint64_t offset, uint64_t len);
473 struct tevent_req *cli_getattrE_send(TALLOC_CTX *mem_ctx,
474 struct tevent_context *ev,
475 struct cli_state *cli,
477 NTSTATUS cli_getattrE_recv(struct tevent_req *req,
483 NTSTATUS cli_getattrE(struct cli_state *cli,
490 struct tevent_req *cli_setattrE_send(TALLOC_CTX *mem_ctx,
491 struct tevent_context *ev,
492 struct cli_state *cli,
497 NTSTATUS cli_setattrE_recv(struct tevent_req *req);
498 NTSTATUS cli_setattrE(struct cli_state *cli,
503 struct tevent_req *cli_getatr_send(TALLOC_CTX *mem_ctx,
504 struct tevent_context *ev,
505 struct cli_state *cli,
507 NTSTATUS cli_getatr_recv(struct tevent_req *req,
511 NTSTATUS cli_getatr(struct cli_state *cli,
516 struct tevent_req *cli_setatr_send(TALLOC_CTX *mem_ctx,
517 struct tevent_context *ev,
518 struct cli_state *cli,
522 NTSTATUS cli_setatr_recv(struct tevent_req *req);
523 NTSTATUS cli_setatr(struct cli_state *cli,
527 struct tevent_req *cli_chkpath_send(TALLOC_CTX *mem_ctx,
528 struct tevent_context *ev,
529 struct cli_state *cli,
531 NTSTATUS cli_chkpath_recv(struct tevent_req *req);
532 NTSTATUS cli_chkpath(struct cli_state *cli, const char *path);
533 struct tevent_req *cli_dskattr_send(TALLOC_CTX *mem_ctx,
534 struct tevent_context *ev,
535 struct cli_state *cli);
536 NTSTATUS cli_dskattr_recv(struct tevent_req *req, int *bsize, int *total,
538 NTSTATUS cli_dskattr(struct cli_state *cli, int *bsize, int *total, int *avail);
539 NTSTATUS cli_disk_size(struct cli_state *cli, const char *path, uint64_t *bsize,
540 uint64_t *total, uint64_t *avail);
541 struct tevent_req *cli_ctemp_send(TALLOC_CTX *mem_ctx,
542 struct tevent_context *ev,
543 struct cli_state *cli,
545 NTSTATUS cli_ctemp_recv(struct tevent_req *req,
549 NTSTATUS cli_ctemp(struct cli_state *cli,
554 NTSTATUS cli_raw_ioctl(struct cli_state *cli, uint16_t fnum, uint32_t code, DATA_BLOB *blob);
555 NTSTATUS cli_set_ea_path(struct cli_state *cli, const char *path,
556 const char *ea_name, const char *ea_val,
558 NTSTATUS cli_set_ea_fnum(struct cli_state *cli, uint16_t fnum,
559 const char *ea_name, const char *ea_val,
561 struct tevent_req *cli_get_ea_list_path_send(TALLOC_CTX *mem_ctx,
562 struct tevent_context *ev,
563 struct cli_state *cli,
565 NTSTATUS cli_get_ea_list_path_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
566 size_t *pnum_eas, struct ea_struct **peas);
567 NTSTATUS cli_get_ea_list_path(struct cli_state *cli, const char *path,
570 struct ea_struct **pea_list);
571 struct tevent_req *cli_posix_open_send(TALLOC_CTX *mem_ctx,
572 struct tevent_context *ev,
573 struct cli_state *cli,
577 NTSTATUS cli_posix_open_recv(struct tevent_req *req, uint16_t *pfnum);
578 NTSTATUS cli_posix_open(struct cli_state *cli, const char *fname,
579 int flags, mode_t mode, uint16_t *fnum);
580 struct tevent_req *cli_posix_mkdir_send(TALLOC_CTX *mem_ctx,
581 struct tevent_context *ev,
582 struct cli_state *cli,
585 NTSTATUS cli_posix_mkdir_recv(struct tevent_req *req);
586 NTSTATUS cli_posix_mkdir(struct cli_state *cli, const char *fname, mode_t mode);
588 struct tevent_req *cli_posix_unlink_send(TALLOC_CTX *mem_ctx,
589 struct tevent_context *ev,
590 struct cli_state *cli,
592 NTSTATUS cli_posix_unlink_recv(struct tevent_req *req);
593 NTSTATUS cli_posix_unlink(struct cli_state *cli, const char *fname);
595 struct tevent_req *cli_posix_rmdir_send(TALLOC_CTX *mem_ctx,
596 struct tevent_context *ev,
597 struct cli_state *cli,
599 NTSTATUS cli_posix_rmdir_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx);
600 NTSTATUS cli_posix_rmdir(struct cli_state *cli, const char *fname);
601 struct tevent_req *cli_notify_send(TALLOC_CTX *mem_ctx,
602 struct tevent_context *ev,
603 struct cli_state *cli, uint16_t fnum,
604 uint32_t buffer_size,
605 uint32_t completion_filter, bool recursive);
606 NTSTATUS cli_notify_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
607 uint32_t *pnum_changes,
608 struct notify_change **pchanges);
609 NTSTATUS cli_notify(struct cli_state *cli, uint16_t fnum, uint32_t buffer_size,
610 uint32_t completion_filter, bool recursive,
611 TALLOC_CTX *mem_ctx, uint32_t *pnum_changes,
612 struct notify_change **pchanges);
614 struct tevent_req *cli_nttrans_create_send(TALLOC_CTX *mem_ctx,
615 struct tevent_context *ev,
616 struct cli_state *cli,
619 uint32_t DesiredAccess,
620 uint32_t FileAttributes,
621 uint32_t ShareAccess,
622 uint32_t CreateDisposition,
623 uint32_t CreateOptions,
624 uint8_t SecurityFlags,
625 struct security_descriptor *secdesc,
626 struct ea_struct *eas,
628 NTSTATUS cli_nttrans_create_recv(struct tevent_req *req,
630 struct smb_create_returns *cr);
631 NTSTATUS cli_nttrans_create(struct cli_state *cli,
634 uint32_t DesiredAccess,
635 uint32_t FileAttributes,
636 uint32_t ShareAccess,
637 uint32_t CreateDisposition,
638 uint32_t CreateOptions,
639 uint8_t SecurityFlags,
640 struct security_descriptor *secdesc,
641 struct ea_struct *eas,
644 struct smb_create_returns *cr);
646 /* The following definitions come from libsmb/clifsinfo.c */
648 struct tevent_req *cli_unix_extensions_version_send(TALLOC_CTX *mem_ctx,
649 struct tevent_context *ev,
650 struct cli_state *cli);
651 NTSTATUS cli_unix_extensions_version_recv(struct tevent_req *req,
652 uint16_t *pmajor, uint16_t *pminor,
655 NTSTATUS cli_unix_extensions_version(struct cli_state *cli, uint16_t *pmajor,
656 uint16_t *pminor, uint32_t *pcaplow,
658 struct tevent_req *cli_set_unix_extensions_capabilities_send(
659 TALLOC_CTX *mem_ctx, struct tevent_context *ev, struct cli_state *cli,
660 uint16_t major, uint16_t minor, uint32_t caplow, uint32_t caphigh);
661 NTSTATUS cli_set_unix_extensions_capabilities_recv(struct tevent_req *req);
662 NTSTATUS cli_set_unix_extensions_capabilities(struct cli_state *cli,
663 uint16_t major, uint16_t minor,
664 uint32_t caplow, uint32_t caphigh);
665 struct tevent_req *cli_get_fs_attr_info_send(TALLOC_CTX *mem_ctx,
666 struct tevent_context *ev,
667 struct cli_state *cli);
668 NTSTATUS cli_get_fs_attr_info_recv(struct tevent_req *req, uint32_t *fs_attr);
669 NTSTATUS cli_get_fs_attr_info(struct cli_state *cli, uint32_t *fs_attr);
670 NTSTATUS cli_get_fs_volume_info(struct cli_state *cli,
671 TALLOC_CTX *mem_ctx, char **volume_name,
672 uint32_t *pserial_number, time_t *pdate);
673 NTSTATUS cli_get_fs_full_size_info(struct cli_state *cli,
674 uint64_t *total_allocation_units,
675 uint64_t *caller_allocation_units,
676 uint64_t *actual_allocation_units,
677 uint64_t *sectors_per_allocation_unit,
678 uint64_t *bytes_per_sector);
679 NTSTATUS cli_get_posix_fs_info(struct cli_state *cli,
680 uint32_t *optimal_transfer_size,
681 uint32_t *block_size,
682 uint64_t *total_blocks,
683 uint64_t *blocks_available,
684 uint64_t *user_blocks_available,
685 uint64_t *total_file_nodes,
686 uint64_t *free_file_nodes,
687 uint64_t *fs_identifier);
688 struct tevent_req *cli_posix_whoami_send(TALLOC_CTX *mem_ctx,
689 struct tevent_context *ev,
690 struct cli_state *cli);
691 NTSTATUS cli_posix_whoami_recv(struct tevent_req *req,
698 struct dom_sid **psids,
700 NTSTATUS cli_posix_whoami(struct cli_state *cli,
707 struct dom_sid **sids,
710 /* The following definitions come from libsmb/clilist.c */
712 NTSTATUS cli_list_old(struct cli_state *cli,const char *Mask,uint16_t attribute,
713 NTSTATUS (*fn)(const char *, struct file_info *,
714 const char *, void *), void *state);
715 NTSTATUS cli_list_trans(struct cli_state *cli, const char *mask,
716 uint16_t attribute, int info_level,
717 NTSTATUS (*fn)(const char *mnt, struct file_info *finfo,
718 const char *mask, void *private_data),
720 struct tevent_req *cli_list_send(TALLOC_CTX *mem_ctx,
721 struct tevent_context *ev,
722 struct cli_state *cli,
725 uint16_t info_level);
726 NTSTATUS cli_list_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
727 struct file_info **finfo, size_t *num_finfo);
728 NTSTATUS cli_list(struct cli_state *cli,const char *Mask,uint16_t attribute,
729 NTSTATUS (*fn)(const char *, struct file_info *, const char *,
730 void *), void *state);
732 /* The following definitions come from libsmb/climessage.c */
734 struct tevent_req *cli_message_send(TALLOC_CTX *mem_ctx,
735 struct tevent_context *ev,
736 struct cli_state *cli,
737 const char *host, const char *username,
738 const char *message);
739 NTSTATUS cli_message_recv(struct tevent_req *req);
740 NTSTATUS cli_message(struct cli_state *cli, const char *host,
741 const char *username, const char *message);
743 /* The following definitions come from libsmb/clioplock.c */
745 struct tevent_req *cli_smb_oplock_break_waiter_send(TALLOC_CTX *mem_ctx,
746 struct tevent_context *ev,
747 struct cli_state *cli);
748 NTSTATUS cli_smb_oplock_break_waiter_recv(struct tevent_req *req,
752 struct tevent_req *cli_oplock_ack_send(TALLOC_CTX *mem_ctx,
753 struct tevent_context *ev,
754 struct cli_state *cli,
755 uint16_t fnum, uint8_t level);
756 NTSTATUS cli_oplock_ack_recv(struct tevent_req *req);
758 /* The following definitions come from libsmb/cliprint.c */
760 int cli_print_queue(struct cli_state *cli,
761 void (*fn)(struct print_job_info *));
762 int cli_printjob_del(struct cli_state *cli, int job);
764 /* The following definitions come from libsmb/cliquota.c */
766 NTSTATUS cli_get_quota_handle(struct cli_state *cli, uint16_t *quota_fnum);
767 void free_ntquota_list(SMB_NTQUOTA_LIST **qt_list);
768 bool parse_user_quota_record(const uint8_t *rdata,
769 unsigned int rdata_count,
770 unsigned int *offset,
771 SMB_NTQUOTA_STRUCT *pqt);
772 bool add_record_to_ntquota_list(TALLOC_CTX *mem_ctx,
773 SMB_NTQUOTA_STRUCT *pqt,
774 SMB_NTQUOTA_LIST **pqt_list);
775 NTSTATUS parse_user_quota_list(const uint8_t *curdata,
776 uint32_t curdata_size,
778 SMB_NTQUOTA_LIST **pqt_list);
779 NTSTATUS parse_fs_quota_buffer(const uint8_t *rdata,
780 unsigned int rdata_count,
781 SMB_NTQUOTA_STRUCT *pqt);
782 NTSTATUS build_user_quota_buffer(SMB_NTQUOTA_LIST *qt_list,
786 SMB_NTQUOTA_LIST **end_ptr);
787 NTSTATUS build_fs_quota_buffer(TALLOC_CTX *mem_ctx,
788 const SMB_NTQUOTA_STRUCT *pqt,
791 NTSTATUS cli_get_user_quota(struct cli_state *cli, int quota_fnum,
792 SMB_NTQUOTA_STRUCT *pqt);
793 NTSTATUS cli_set_user_quota(struct cli_state *cli,
795 SMB_NTQUOTA_LIST *qtl);
796 NTSTATUS cli_list_user_quota(struct cli_state *cli, int quota_fnum,
797 SMB_NTQUOTA_LIST **pqt_list);
798 NTSTATUS cli_get_fs_quota_info(struct cli_state *cli, int quota_fnum,
799 SMB_NTQUOTA_STRUCT *pqt);
800 NTSTATUS cli_set_fs_quota_info(struct cli_state *cli, int quota_fnum,
801 SMB_NTQUOTA_STRUCT *pqt);
803 /* The following definitions come from libsmb/clireadwrite.c */
805 struct tevent_req *cli_read_andx_create(TALLOC_CTX *mem_ctx,
806 struct tevent_context *ev,
807 struct cli_state *cli, uint16_t fnum,
808 off_t offset, size_t size,
809 struct tevent_req **psmbreq);
810 struct tevent_req *cli_read_andx_send(TALLOC_CTX *mem_ctx,
811 struct tevent_context *ev,
812 struct cli_state *cli, uint16_t fnum,
813 off_t offset, size_t size);
814 NTSTATUS cli_read_andx_recv(struct tevent_req *req, ssize_t *received,
816 struct tevent_req *cli_pull_send(TALLOC_CTX *mem_ctx,
817 struct tevent_context *ev,
818 struct cli_state *cli,
819 uint16_t fnum, off_t start_offset,
820 off_t size, size_t window_size,
821 NTSTATUS (*sink)(char *buf, size_t n,
824 NTSTATUS cli_pull_recv(struct tevent_req *req, off_t *received);
825 NTSTATUS cli_pull(struct cli_state *cli, uint16_t fnum,
826 off_t start_offset, off_t size, size_t window_size,
827 NTSTATUS (*sink)(char *buf, size_t n, void *priv),
828 void *priv, off_t *received);
829 NTSTATUS cli_read(struct cli_state *cli, uint16_t fnum,
830 char *buf, off_t offset, size_t size,
832 NTSTATUS cli_smbwrite(struct cli_state *cli, uint16_t fnum, char *buf,
833 off_t offset, size_t size1, size_t *ptotal);
834 struct tevent_req *cli_write_andx_create(TALLOC_CTX *mem_ctx,
835 struct tevent_context *ev,
836 struct cli_state *cli, uint16_t fnum,
837 uint16_t mode, const uint8_t *buf,
838 off_t offset, size_t size,
839 struct tevent_req **reqs_before,
841 struct tevent_req **psmbreq);
842 struct tevent_req *cli_write_andx_send(TALLOC_CTX *mem_ctx,
843 struct tevent_context *ev,
844 struct cli_state *cli, uint16_t fnum,
845 uint16_t mode, const uint8_t *buf,
846 off_t offset, size_t size);
847 NTSTATUS cli_write_andx_recv(struct tevent_req *req, size_t *pwritten);
849 NTSTATUS cli_writeall(struct cli_state *cli, uint16_t fnum, uint16_t mode,
850 const uint8_t *buf, off_t offset, size_t size,
853 struct tevent_req *cli_push_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
854 struct cli_state *cli,
855 uint16_t fnum, uint16_t mode,
856 off_t start_offset, size_t window_size,
857 size_t (*source)(uint8_t *buf, size_t n,
860 NTSTATUS cli_push_recv(struct tevent_req *req);
861 NTSTATUS cli_push(struct cli_state *cli, uint16_t fnum, uint16_t mode,
862 off_t start_offset, size_t window_size,
863 size_t (*source)(uint8_t *buf, size_t n, void *priv),
866 NTSTATUS cli_splice(struct cli_state *srccli, struct cli_state *dstcli,
867 uint16_t src_fnum, uint16_t dst_fnum,
869 off_t src_offset, off_t dst_offset,
871 int (*splice_cb)(off_t n, void *priv), void *priv);
873 /* The following definitions come from libsmb/clisecdesc.c */
875 NTSTATUS cli_query_security_descriptor(struct cli_state *cli,
879 struct security_descriptor **sd);
880 NTSTATUS cli_query_secdesc(struct cli_state *cli, uint16_t fnum,
881 TALLOC_CTX *mem_ctx, struct security_descriptor **sd);
882 NTSTATUS cli_set_security_descriptor(struct cli_state *cli,
885 const struct security_descriptor *sd);
886 NTSTATUS cli_set_secdesc(struct cli_state *cli, uint16_t fnum,
887 const struct security_descriptor *sd);
889 /* The following definitions come from libsmb/clistr.c */
891 size_t clistr_pull_talloc(TALLOC_CTX *ctx,
898 bool clistr_is_previous_version_path(const char *path,
903 /* The following definitions come from libsmb/clitrans.c */
905 struct tevent_req *cli_trans_send(
906 TALLOC_CTX *mem_ctx, struct tevent_context *ev,
907 struct cli_state *cli, uint16_t additional_flags2, uint8_t cmd,
908 const char *pipe_name, uint16_t fid, uint16_t function, int flags,
909 uint16_t *setup, uint8_t num_setup, uint8_t max_setup,
910 uint8_t *param, uint32_t num_param, uint32_t max_param,
911 uint8_t *data, uint32_t num_data, uint32_t max_data);
912 NTSTATUS cli_trans_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
913 uint16_t *recv_flags2,
914 uint16_t **setup, uint8_t min_setup,
916 uint8_t **param, uint32_t min_param,
918 uint8_t **data, uint32_t min_data,
920 NTSTATUS cli_trans(TALLOC_CTX *mem_ctx, struct cli_state *cli,
922 const char *pipe_name, uint16_t fid, uint16_t function,
924 uint16_t *setup, uint8_t num_setup, uint8_t max_setup,
925 uint8_t *param, uint32_t num_param, uint32_t max_param,
926 uint8_t *data, uint32_t num_data, uint32_t max_data,
927 uint16_t *recv_flags2,
928 uint16_t **rsetup, uint8_t min_rsetup, uint8_t *num_rsetup,
929 uint8_t **rparam, uint32_t min_rparam, uint32_t *num_rparam,
930 uint8_t **rdata, uint32_t min_rdata, uint32_t *num_rdata);
932 /* The following definitions come from libsmb/reparse_symlink.c */
934 bool symlink_reparse_buffer_marshall(
935 const char *substitute, const char *printname, uint32_t flags,
936 TALLOC_CTX *mem_ctx, uint8_t **pdst, size_t *pdstlen);
937 bool symlink_reparse_buffer_parse(
938 const uint8_t *src, size_t srclen, TALLOC_CTX *mem_ctx,
939 char **psubstitute_name, char **pprint_name, uint32_t *pflags);
941 /* The following definitions come from libsmb/clisymlink.c */
943 struct tevent_req *cli_symlink_send(TALLOC_CTX *mem_ctx,
944 struct tevent_context *ev,
945 struct cli_state *cli,
949 NTSTATUS cli_symlink_recv(struct tevent_req *req);
950 NTSTATUS cli_symlink(struct cli_state *cli, const char *oldname,
951 const char *newname, uint32_t flags);
953 struct tevent_req *cli_readlink_send(TALLOC_CTX *mem_ctx,
954 struct tevent_context *ev,
955 struct cli_state *cli,
957 NTSTATUS cli_readlink_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
958 char **psubstitute_name, char **pprint_name,
960 NTSTATUS cli_readlink(struct cli_state *cli, const char *fname,
961 TALLOC_CTX *mem_ctx, char **psubstitute_name,
962 char **pprint_name, uint32_t *pflags);
964 #endif /* _LIBSMB_PROTO_H_ */