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;
34 /* The following definitions come from libsmb/cliconnect.c */
36 struct tevent_req *cli_session_setup_send(TALLOC_CTX *mem_ctx,
37 struct tevent_context *ev,
38 struct cli_state *cli,
40 const char *pass, int passlen,
41 const char *ntpass, int ntpasslen,
42 const char *workgroup);
43 NTSTATUS cli_session_setup_recv(struct tevent_req *req);
44 NTSTATUS cli_session_setup(struct cli_state *cli,
46 const char *pass, int passlen,
47 const char *ntpass, int ntpasslen,
48 const char *workgroup);
49 struct tevent_req *cli_session_setup_guest_create(TALLOC_CTX *mem_ctx,
50 struct tevent_context *ev,
51 struct cli_state *cli,
52 struct tevent_req **psmbreq);
53 struct tevent_req *cli_session_setup_guest_send(TALLOC_CTX *mem_ctx,
54 struct tevent_context *ev,
55 struct cli_state *cli);
56 NTSTATUS cli_session_setup_guest_recv(struct tevent_req *req);
57 NTSTATUS cli_ulogoff(struct cli_state *cli);
58 struct tevent_req *cli_tcon_andx_create(TALLOC_CTX *mem_ctx,
59 struct tevent_context *ev,
60 struct cli_state *cli,
61 const char *share, const char *dev,
62 const char *pass, int passlen,
63 struct tevent_req **psmbreq);
64 struct tevent_req *cli_tcon_andx_send(TALLOC_CTX *mem_ctx,
65 struct tevent_context *ev,
66 struct cli_state *cli,
67 const char *share, const char *dev,
68 const char *pass, int passlen);
69 NTSTATUS cli_tcon_andx_recv(struct tevent_req *req);
70 NTSTATUS cli_tcon_andx(struct cli_state *cli, const char *share,
71 const char *dev, const char *pass, int passlen);
72 NTSTATUS cli_tree_connect(struct cli_state *cli, const char *share,
73 const char *dev, const char *pass, int passlen);
74 NTSTATUS cli_tdis(struct cli_state *cli);
75 NTSTATUS cli_connect_nb(const char *host, const struct sockaddr_storage *dest_ss,
76 uint16_t port, int name_type, const char *myname,
77 int signing_state, int flags, struct cli_state **pcli);
78 NTSTATUS cli_start_connection(struct cli_state **output_cli,
80 const char *dest_host,
81 const struct sockaddr_storage *dest_ss, int port,
82 int signing_state, int flags);
83 struct tevent_req *cli_full_connection_send(
84 TALLOC_CTX *mem_ctx, struct tevent_context *ev,
85 const char *my_name, const char *dest_host,
86 const struct sockaddr_storage *dest_ss, int port,
87 const char *service, const char *service_type,
88 const char *user, const char *domain,
89 const char *password, int flags, int signing_state);
90 NTSTATUS cli_full_connection_recv(struct tevent_req *req,
91 struct cli_state **output_cli);
92 NTSTATUS cli_full_connection(struct cli_state **output_cli,
94 const char *dest_host,
95 const struct sockaddr_storage *dest_ss, int port,
96 const char *service, const char *service_type,
97 const char *user, const char *domain,
98 const char *password, int flags,
100 NTSTATUS cli_raw_tcon(struct cli_state *cli,
101 const char *service, const char *pass, const char *dev,
102 uint16 *max_xmit, uint16 *tid);
103 struct cli_state *get_ipc_connect(char *server,
104 struct sockaddr_storage *server_ss,
105 const struct user_auth_info *user_info);
106 struct cli_state *get_ipc_connect_master_ip(TALLOC_CTX *ctx,
107 struct sockaddr_storage *mb_ip,
108 const struct user_auth_info *user_info,
109 char **pp_workgroup_out);
110 struct cli_state *get_ipc_connect_master_ip_bcast(TALLOC_CTX *ctx,
111 const struct user_auth_info *user_info,
112 char **pp_workgroup_out);
114 /* The following definitions come from libsmb/clidfs.c */
116 NTSTATUS cli_cm_force_encryption(struct cli_state *c,
117 const char *username,
118 const char *password,
120 const char *sharename);
121 NTSTATUS cli_cm_open(TALLOC_CTX *ctx,
122 struct cli_state *referring_cli,
125 const struct user_auth_info *auth_info,
131 struct cli_state **pcli);
132 void cli_cm_display(struct cli_state *c);
133 struct client_dfs_referral;
134 NTSTATUS cli_dfs_get_referral(TALLOC_CTX *ctx,
135 struct cli_state *cli,
137 struct client_dfs_referral **refs,
140 NTSTATUS cli_resolve_path(TALLOC_CTX *ctx,
142 const struct user_auth_info *dfs_auth_info,
143 struct cli_state *rootcli,
145 struct cli_state **targetcli,
146 char **pp_targetpath);
148 bool cli_check_msdfs_proxy(TALLOC_CTX *ctx,
149 struct cli_state *cli,
150 const char *sharename,
154 const char *username,
155 const char *password,
158 /* The following definitions come from libsmb/clientgen.c */
160 int cli_set_message(char *buf,int num_words,int num_bytes,bool zero);
161 unsigned int cli_set_timeout(struct cli_state *cli, unsigned int timeout);
162 bool cli_set_backup_intent(struct cli_state *cli, bool flag);
163 void cli_setup_packet_buf(struct cli_state *cli, char *buf);
164 NTSTATUS cli_set_domain(struct cli_state *cli, const char *domain);
165 NTSTATUS cli_set_username(struct cli_state *cli, const char *username);
166 NTSTATUS cli_set_password(struct cli_state *cli, const char *password);
167 NTSTATUS cli_init_creds(struct cli_state *cli, const char *username, const char *domain, const char *password);
168 struct cli_state *cli_state_create(TALLOC_CTX *mem_ctx,
170 const char *remote_name,
171 const char *remote_realm,
174 void cli_nt_pipes_close(struct cli_state *cli);
175 void cli_shutdown(struct cli_state *cli);
176 const char *cli_state_remote_realm(struct cli_state *cli);
177 uint16_t cli_state_get_vc_num(struct cli_state *cli);
178 uint16 cli_setpid(struct cli_state *cli, uint16 pid);
179 uint16_t cli_getpid(struct cli_state *cli);
180 bool cli_state_has_tcon(struct cli_state *cli);
181 uint16_t cli_state_get_tid(struct cli_state *cli);
182 uint16_t cli_state_set_tid(struct cli_state *cli, uint16_t tid);
183 uint16_t cli_state_get_uid(struct cli_state *cli);
184 uint16_t cli_state_set_uid(struct cli_state *cli, uint16_t uid);
185 bool cli_set_case_sensitive(struct cli_state *cli, bool case_sensitive);
186 uint32_t cli_state_available_size(struct cli_state *cli, uint32_t ofs);
187 time_t cli_state_server_time(struct cli_state *cli);
188 struct tevent_req *cli_echo_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
189 struct cli_state *cli, uint16_t num_echos,
191 NTSTATUS cli_echo_recv(struct tevent_req *req);
192 NTSTATUS cli_echo(struct cli_state *cli, uint16_t num_echos, DATA_BLOB data);
193 bool is_andx_req(uint8_t cmd);
194 NTSTATUS cli_smb(TALLOC_CTX *mem_ctx, struct cli_state *cli,
195 uint8_t smb_command, uint8_t additional_flags,
196 uint8_t wct, uint16_t *vwv,
197 uint32_t num_bytes, const uint8_t *bytes,
198 struct tevent_req **result_parent,
199 uint8_t min_wct, uint8_t *pwct, uint16_t **pvwv,
200 uint32_t *pnum_bytes, uint8_t **pbytes);
202 /* The following definitions come from libsmb/clierror.c */
204 const char *cli_errstr(struct cli_state *cli);
205 NTSTATUS cli_nt_error(struct cli_state *cli);
206 void cli_dos_error(struct cli_state *cli, uint8 *eclass, uint32 *ecode);
207 int cli_errno(struct cli_state *cli);
208 bool cli_is_error(struct cli_state *cli);
209 bool cli_is_nt_error(struct cli_state *cli);
210 bool cli_is_dos_error(struct cli_state *cli);
211 bool cli_state_is_connected(struct cli_state *cli);
213 /* The following definitions come from libsmb/clifile.c */
215 struct tevent_req *cli_setpathinfo_send(TALLOC_CTX *mem_ctx,
216 struct tevent_context *ev,
217 struct cli_state *cli,
222 NTSTATUS cli_setpathinfo_recv(struct tevent_req *req);
223 NTSTATUS cli_setpathinfo(struct cli_state *cli,
229 struct tevent_req *cli_posix_symlink_send(TALLOC_CTX *mem_ctx,
230 struct tevent_context *ev,
231 struct cli_state *cli,
233 const char *newname);
234 NTSTATUS cli_posix_symlink_recv(struct tevent_req *req);
235 NTSTATUS cli_posix_symlink(struct cli_state *cli,
237 const char *newname);
238 struct tevent_req *cli_posix_readlink_send(TALLOC_CTX *mem_ctx,
239 struct tevent_context *ev,
240 struct cli_state *cli,
243 NTSTATUS cli_posix_readlink_recv(struct tevent_req *req, struct cli_state *cli,
244 char *retpath, size_t len);
245 NTSTATUS cli_posix_readlink(struct cli_state *cli, const char *fname,
246 char *linkpath, size_t len);
247 struct tevent_req *cli_posix_hardlink_send(TALLOC_CTX *mem_ctx,
248 struct tevent_context *ev,
249 struct cli_state *cli,
251 const char *newname);
252 NTSTATUS cli_posix_hardlink_recv(struct tevent_req *req);
253 NTSTATUS cli_posix_hardlink(struct cli_state *cli,
255 const char *newname);
256 uint32_t unix_perms_to_wire(mode_t perms);
257 mode_t wire_perms_to_unix(uint32_t perms);
258 struct tevent_req *cli_posix_getfacl_send(TALLOC_CTX *mem_ctx,
259 struct tevent_context *ev,
260 struct cli_state *cli,
262 NTSTATUS cli_posix_getfacl_recv(struct tevent_req *req,
266 NTSTATUS cli_posix_getfacl(struct cli_state *cli,
271 struct tevent_req *cli_posix_stat_send(TALLOC_CTX *mem_ctx,
272 struct tevent_context *ev,
273 struct cli_state *cli,
275 NTSTATUS cli_posix_stat_recv(struct tevent_req *req,
276 SMB_STRUCT_STAT *sbuf);
277 NTSTATUS cli_posix_stat(struct cli_state *cli,
279 SMB_STRUCT_STAT *sbuf);
280 struct tevent_req *cli_posix_chmod_send(TALLOC_CTX *mem_ctx,
281 struct tevent_context *ev,
282 struct cli_state *cli,
285 NTSTATUS cli_posix_chmod_recv(struct tevent_req *req);
286 NTSTATUS cli_posix_chmod(struct cli_state *cli, const char *fname, mode_t mode);
287 struct tevent_req *cli_posix_chown_send(TALLOC_CTX *mem_ctx,
288 struct tevent_context *ev,
289 struct cli_state *cli,
293 NTSTATUS cli_posix_chown_recv(struct tevent_req *req);
294 NTSTATUS cli_posix_chown(struct cli_state *cli,
298 struct tevent_req *cli_rename_send(TALLOC_CTX *mem_ctx,
299 struct tevent_context *ev,
300 struct cli_state *cli,
301 const char *fname_src,
302 const char *fname_dst);
303 NTSTATUS cli_rename_recv(struct tevent_req *req);
304 NTSTATUS cli_rename(struct cli_state *cli, const char *fname_src, const char *fname_dst);
305 struct tevent_req *cli_ntrename_send(TALLOC_CTX *mem_ctx,
306 struct tevent_context *ev,
307 struct cli_state *cli,
308 const char *fname_src,
309 const char *fname_dst);
310 NTSTATUS cli_ntrename_recv(struct tevent_req *req);
311 NTSTATUS cli_ntrename(struct cli_state *cli, const char *fname_src, const char *fname_dst);
313 struct tevent_req *cli_nt_hardlink_send(TALLOC_CTX *mem_ctx,
314 struct tevent_context *ev,
315 struct cli_state *cli,
316 const char *fname_src,
317 const char *fname_dst);
318 NTSTATUS cli_nt_hardlink_recv(struct tevent_req *req);
319 NTSTATUS cli_nt_hardlink(struct cli_state *cli, const char *fname_src, const char *fname_dst);
321 struct tevent_req *cli_unlink_send(TALLOC_CTX *mem_ctx,
322 struct tevent_context *ev,
323 struct cli_state *cli,
325 uint16_t mayhave_attrs);
326 NTSTATUS cli_unlink_recv(struct tevent_req *req);
327 NTSTATUS cli_unlink(struct cli_state *cli, const char *fname, uint16_t mayhave_attrs);
329 struct tevent_req *cli_mkdir_send(TALLOC_CTX *mem_ctx,
330 struct tevent_context *ev,
331 struct cli_state *cli,
333 NTSTATUS cli_mkdir_recv(struct tevent_req *req);
334 NTSTATUS cli_mkdir(struct cli_state *cli, const char *dname);
335 struct tevent_req *cli_rmdir_send(TALLOC_CTX *mem_ctx,
336 struct tevent_context *ev,
337 struct cli_state *cli,
339 NTSTATUS cli_rmdir_recv(struct tevent_req *req);
340 NTSTATUS cli_rmdir(struct cli_state *cli, const char *dname);
341 struct tevent_req *cli_nt_delete_on_close_send(TALLOC_CTX *mem_ctx,
342 struct tevent_context *ev,
343 struct cli_state *cli,
346 NTSTATUS cli_nt_delete_on_close_recv(struct tevent_req *req);
347 NTSTATUS cli_nt_delete_on_close(struct cli_state *cli, uint16_t fnum, bool flag);
348 struct tevent_req *cli_ntcreate_send(TALLOC_CTX *mem_ctx,
349 struct tevent_context *ev,
350 struct cli_state *cli,
353 uint32_t DesiredAccess,
354 uint32_t FileAttributes,
355 uint32_t ShareAccess,
356 uint32_t CreateDisposition,
357 uint32_t CreateOptions,
358 uint8_t SecurityFlags);
359 NTSTATUS cli_ntcreate_recv(struct tevent_req *req,
361 struct smb_create_returns *cr);
362 struct tevent_req *cli_create_send(TALLOC_CTX *mem_ctx,
363 struct tevent_context *ev,
364 struct cli_state *cli,
366 uint32_t create_flags,
367 uint32_t desired_access,
368 uint32_t file_attributes,
369 uint32_t share_access,
370 uint32_t create_disposition,
371 uint32_t create_options,
372 uint8_t security_flags);
373 NTSTATUS cli_create_recv(struct tevent_req *req, uint16_t *fnum,
374 struct smb_create_returns *cr);
375 NTSTATUS cli_ntcreate(struct cli_state *cli,
378 uint32_t DesiredAccess,
379 uint32_t FileAttributes,
380 uint32_t ShareAccess,
381 uint32_t CreateDisposition,
382 uint32_t CreateOptions,
383 uint8_t SecurityFlags,
385 struct smb_create_returns *cr);
386 uint8_t *smb_bytes_push_str(uint8_t *buf, bool ucs2, const char *str,
387 size_t str_len, size_t *pconverted_size);
388 uint8_t *smb_bytes_push_bytes(uint8_t *buf, uint8_t prefix,
389 const uint8_t *bytes, size_t num_bytes);
390 uint8_t *trans2_bytes_push_str(uint8_t *buf, bool ucs2,
391 const char *str, size_t str_len,
392 size_t *pconverted_size);
393 uint8_t *trans2_bytes_push_bytes(uint8_t *buf,
394 const uint8_t *bytes, size_t num_bytes);
395 struct tevent_req *cli_openx_create(TALLOC_CTX *mem_ctx,
396 struct tevent_context *ev,
397 struct cli_state *cli, const char *fname,
398 int flags, int share_mode,
399 struct tevent_req **psmbreq);
400 struct tevent_req *cli_openx_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
401 struct cli_state *cli, const char *fname,
402 int flags, int share_mode);
403 NTSTATUS cli_openx_recv(struct tevent_req *req, uint16_t *fnum);
404 NTSTATUS cli_openx(struct cli_state *cli, const char *fname, int flags, int share_mode, uint16_t *pfnum);
405 NTSTATUS cli_open(struct cli_state *cli, const char *fname, int flags, int share_mode, uint16_t *pfnum);
406 struct tevent_req *cli_close_create(TALLOC_CTX *mem_ctx,
407 struct tevent_context *ev,
408 struct cli_state *cli, uint16_t fnum,
409 struct tevent_req **psubreq);
410 struct tevent_req *cli_close_send(TALLOC_CTX *mem_ctx,
411 struct tevent_context *ev,
412 struct cli_state *cli, uint16_t fnum);
413 NTSTATUS cli_close_recv(struct tevent_req *req);
414 NTSTATUS cli_close(struct cli_state *cli, uint16_t fnum);
415 struct tevent_req *cli_ftruncate_send(TALLOC_CTX *mem_ctx,
416 struct tevent_context *ev,
417 struct cli_state *cli,
420 NTSTATUS cli_ftruncate_recv(struct tevent_req *req);
421 NTSTATUS cli_ftruncate(struct cli_state *cli, uint16_t fnum, uint64_t size);
422 NTSTATUS cli_locktype(struct cli_state *cli, uint16_t fnum,
423 uint32_t offset, uint32_t len,
424 int timeout, unsigned char locktype);
425 NTSTATUS cli_lock32(struct cli_state *cli, uint16_t fnum, uint32_t offset,
426 uint32_t len, int timeout, enum brl_type lock_type);
427 struct tevent_req *cli_unlock_send(TALLOC_CTX *mem_ctx,
428 struct tevent_context *ev,
429 struct cli_state *cli,
433 NTSTATUS cli_unlock_recv(struct tevent_req *req);
434 NTSTATUS cli_unlock(struct cli_state *cli, uint16_t fnum, uint32_t offset, uint32_t len);
435 NTSTATUS cli_lock64(struct cli_state *cli, uint16_t fnum,
436 uint64_t offset, uint64_t len, int timeout,
437 enum brl_type lock_type);
438 struct tevent_req *cli_unlock64_send(TALLOC_CTX *mem_ctx,
439 struct tevent_context *ev,
440 struct cli_state *cli,
444 NTSTATUS cli_unlock64_recv(struct tevent_req *req);
445 NTSTATUS cli_unlock64(struct cli_state *cli, uint16_t fnum, uint64_t offset, uint64_t len);
446 struct tevent_req *cli_posix_lock_send(TALLOC_CTX *mem_ctx,
447 struct tevent_context *ev,
448 struct cli_state *cli,
453 enum brl_type lock_type);
454 NTSTATUS cli_posix_lock_recv(struct tevent_req *req);
455 NTSTATUS cli_posix_lock(struct cli_state *cli, uint16_t fnum,
456 uint64_t offset, uint64_t len,
457 bool wait_lock, enum brl_type lock_type);
458 struct tevent_req *cli_posix_unlock_send(TALLOC_CTX *mem_ctx,
459 struct tevent_context *ev,
460 struct cli_state *cli,
464 NTSTATUS cli_posix_unlock_recv(struct tevent_req *req);
465 NTSTATUS cli_posix_unlock(struct cli_state *cli, uint16_t fnum, uint64_t offset, uint64_t len);
466 struct tevent_req *cli_getattrE_send(TALLOC_CTX *mem_ctx,
467 struct tevent_context *ev,
468 struct cli_state *cli,
470 NTSTATUS cli_getattrE_recv(struct tevent_req *req,
476 NTSTATUS cli_getattrE(struct cli_state *cli,
483 struct tevent_req *cli_setattrE_send(TALLOC_CTX *mem_ctx,
484 struct tevent_context *ev,
485 struct cli_state *cli,
490 NTSTATUS cli_setattrE_recv(struct tevent_req *req);
491 NTSTATUS cli_setattrE(struct cli_state *cli,
496 struct tevent_req *cli_getatr_send(TALLOC_CTX *mem_ctx,
497 struct tevent_context *ev,
498 struct cli_state *cli,
500 NTSTATUS cli_getatr_recv(struct tevent_req *req,
504 NTSTATUS cli_getatr(struct cli_state *cli,
509 struct tevent_req *cli_setatr_send(TALLOC_CTX *mem_ctx,
510 struct tevent_context *ev,
511 struct cli_state *cli,
515 NTSTATUS cli_setatr_recv(struct tevent_req *req);
516 NTSTATUS cli_setatr(struct cli_state *cli,
520 struct tevent_req *cli_chkpath_send(TALLOC_CTX *mem_ctx,
521 struct tevent_context *ev,
522 struct cli_state *cli,
524 NTSTATUS cli_chkpath_recv(struct tevent_req *req);
525 NTSTATUS cli_chkpath(struct cli_state *cli, const char *path);
526 struct tevent_req *cli_dskattr_send(TALLOC_CTX *mem_ctx,
527 struct tevent_context *ev,
528 struct cli_state *cli);
529 NTSTATUS cli_dskattr_recv(struct tevent_req *req, int *bsize, int *total,
531 NTSTATUS cli_dskattr(struct cli_state *cli, int *bsize, int *total, int *avail);
532 NTSTATUS cli_disk_size(struct cli_state *cli, uint64_t *bsize, uint64_t *total, uint64_t *avail);
533 struct tevent_req *cli_ctemp_send(TALLOC_CTX *mem_ctx,
534 struct tevent_context *ev,
535 struct cli_state *cli,
537 NTSTATUS cli_ctemp_recv(struct tevent_req *req,
541 NTSTATUS cli_ctemp(struct cli_state *cli,
546 NTSTATUS cli_raw_ioctl(struct cli_state *cli, uint16_t fnum, uint32_t code, DATA_BLOB *blob);
547 NTSTATUS cli_set_ea_path(struct cli_state *cli, const char *path,
548 const char *ea_name, const char *ea_val,
550 NTSTATUS cli_set_ea_fnum(struct cli_state *cli, uint16_t fnum,
551 const char *ea_name, const char *ea_val,
553 struct tevent_req *cli_get_ea_list_path_send(TALLOC_CTX *mem_ctx,
554 struct tevent_context *ev,
555 struct cli_state *cli,
557 NTSTATUS cli_get_ea_list_path_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
558 size_t *pnum_eas, struct ea_struct **peas);
559 NTSTATUS cli_get_ea_list_path(struct cli_state *cli, const char *path,
562 struct ea_struct **pea_list);
563 struct tevent_req *cli_posix_open_send(TALLOC_CTX *mem_ctx,
564 struct tevent_context *ev,
565 struct cli_state *cli,
569 NTSTATUS cli_posix_open_recv(struct tevent_req *req, uint16_t *pfnum);
570 NTSTATUS cli_posix_open(struct cli_state *cli, const char *fname,
571 int flags, mode_t mode, uint16_t *fnum);
572 struct tevent_req *cli_posix_mkdir_send(TALLOC_CTX *mem_ctx,
573 struct tevent_context *ev,
574 struct cli_state *cli,
577 NTSTATUS cli_posix_mkdir_recv(struct tevent_req *req);
578 NTSTATUS cli_posix_mkdir(struct cli_state *cli, const char *fname, mode_t mode);
580 struct tevent_req *cli_posix_unlink_send(TALLOC_CTX *mem_ctx,
581 struct tevent_context *ev,
582 struct cli_state *cli,
584 NTSTATUS cli_posix_unlink_recv(struct tevent_req *req);
585 NTSTATUS cli_posix_unlink(struct cli_state *cli, const char *fname);
587 struct tevent_req *cli_posix_rmdir_send(TALLOC_CTX *mem_ctx,
588 struct tevent_context *ev,
589 struct cli_state *cli,
591 NTSTATUS cli_posix_rmdir_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx);
592 NTSTATUS cli_posix_rmdir(struct cli_state *cli, const char *fname);
593 struct tevent_req *cli_notify_send(TALLOC_CTX *mem_ctx,
594 struct tevent_context *ev,
595 struct cli_state *cli, uint16_t fnum,
596 uint32_t buffer_size,
597 uint32_t completion_filter, bool recursive);
598 NTSTATUS cli_notify_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
599 uint32_t *pnum_changes,
600 struct notify_change **pchanges);
601 NTSTATUS cli_notify(struct cli_state *cli, uint16_t fnum, uint32_t buffer_size,
602 uint32_t completion_filter, bool recursive,
603 TALLOC_CTX *mem_ctx, uint32_t *pnum_changes,
604 struct notify_change **pchanges);
606 struct tevent_req *cli_nttrans_create_send(TALLOC_CTX *mem_ctx,
607 struct tevent_context *ev,
608 struct cli_state *cli,
611 uint32_t DesiredAccess,
612 uint32_t FileAttributes,
613 uint32_t ShareAccess,
614 uint32_t CreateDisposition,
615 uint32_t CreateOptions,
616 uint8_t SecurityFlags,
617 struct security_descriptor *secdesc,
618 struct ea_struct *eas,
620 NTSTATUS cli_nttrans_create_recv(struct tevent_req *req,
622 struct smb_create_returns *cr);
623 NTSTATUS cli_nttrans_create(struct cli_state *cli,
626 uint32_t DesiredAccess,
627 uint32_t FileAttributes,
628 uint32_t ShareAccess,
629 uint32_t CreateDisposition,
630 uint32_t CreateOptions,
631 uint8_t SecurityFlags,
632 struct security_descriptor *secdesc,
633 struct ea_struct *eas,
636 struct smb_create_returns *cr);
638 /* The following definitions come from libsmb/clifsinfo.c */
640 struct tevent_req *cli_unix_extensions_version_send(TALLOC_CTX *mem_ctx,
641 struct tevent_context *ev,
642 struct cli_state *cli);
643 NTSTATUS cli_unix_extensions_version_recv(struct tevent_req *req,
644 uint16_t *pmajor, uint16_t *pminor,
647 NTSTATUS cli_unix_extensions_version(struct cli_state *cli, uint16 *pmajor,
648 uint16 *pminor, uint32 *pcaplow,
650 struct tevent_req *cli_set_unix_extensions_capabilities_send(
651 TALLOC_CTX *mem_ctx, struct tevent_context *ev, struct cli_state *cli,
652 uint16_t major, uint16_t minor, uint32_t caplow, uint32_t caphigh);
653 NTSTATUS cli_set_unix_extensions_capabilities_recv(struct tevent_req *req);
654 NTSTATUS cli_set_unix_extensions_capabilities(struct cli_state *cli,
655 uint16 major, uint16 minor,
656 uint32 caplow, uint32 caphigh);
657 struct tevent_req *cli_get_fs_attr_info_send(TALLOC_CTX *mem_ctx,
658 struct tevent_context *ev,
659 struct cli_state *cli);
660 NTSTATUS cli_get_fs_attr_info_recv(struct tevent_req *req, uint32_t *fs_attr);
661 NTSTATUS cli_get_fs_attr_info(struct cli_state *cli, uint32_t *fs_attr);
662 NTSTATUS cli_get_fs_volume_info(struct cli_state *cli,
663 TALLOC_CTX *mem_ctx, char **volume_name,
664 uint32 *pserial_number, time_t *pdate);
665 NTSTATUS cli_get_fs_full_size_info(struct cli_state *cli,
666 uint64_t *total_allocation_units,
667 uint64_t *caller_allocation_units,
668 uint64_t *actual_allocation_units,
669 uint64_t *sectors_per_allocation_unit,
670 uint64_t *bytes_per_sector);
671 NTSTATUS cli_get_posix_fs_info(struct cli_state *cli,
672 uint32 *optimal_transfer_size,
674 uint64_t *total_blocks,
675 uint64_t *blocks_available,
676 uint64_t *user_blocks_available,
677 uint64_t *total_file_nodes,
678 uint64_t *free_file_nodes,
679 uint64_t *fs_identifier);
680 NTSTATUS cli_raw_ntlm_smb_encryption_start(struct cli_state *cli,
684 NTSTATUS cli_gss_smb_encryption_start(struct cli_state *cli);
685 NTSTATUS cli_force_encryption(struct cli_state *c,
686 const char *username,
687 const char *password,
690 /* The following definitions come from libsmb/clilist.c */
692 NTSTATUS cli_list_old(struct cli_state *cli,const char *Mask,uint16 attribute,
693 NTSTATUS (*fn)(const char *, struct file_info *,
694 const char *, void *), void *state);
695 NTSTATUS cli_list_trans(struct cli_state *cli, const char *mask,
696 uint16_t attribute, int info_level,
697 NTSTATUS (*fn)(const char *mnt, struct file_info *finfo,
698 const char *mask, void *private_data),
700 struct tevent_req *cli_list_send(TALLOC_CTX *mem_ctx,
701 struct tevent_context *ev,
702 struct cli_state *cli,
705 uint16_t info_level);
706 NTSTATUS cli_list_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
707 struct file_info **finfo, size_t *num_finfo);
708 NTSTATUS cli_list(struct cli_state *cli,const char *Mask,uint16 attribute,
709 NTSTATUS (*fn)(const char *, struct file_info *, const char *,
710 void *), void *state);
712 /* The following definitions come from libsmb/climessage.c */
714 struct tevent_req *cli_message_send(TALLOC_CTX *mem_ctx,
715 struct tevent_context *ev,
716 struct cli_state *cli,
717 const char *host, const char *username,
718 const char *message);
719 NTSTATUS cli_message_recv(struct tevent_req *req);
720 NTSTATUS cli_message(struct cli_state *cli, const char *host,
721 const char *username, const char *message);
723 /* The following definitions come from libsmb/clioplock.c */
725 struct tevent_req *cli_smb_oplock_break_waiter_send(TALLOC_CTX *mem_ctx,
726 struct tevent_context *ev,
727 struct cli_state *cli);
728 NTSTATUS cli_smb_oplock_break_waiter_recv(struct tevent_req *req,
732 struct tevent_req *cli_oplock_ack_send(TALLOC_CTX *mem_ctx,
733 struct tevent_context *ev,
734 struct cli_state *cli,
735 uint16_t fnum, uint8_t level);
736 NTSTATUS cli_oplock_ack_recv(struct tevent_req *req);
738 /* The following definitions come from libsmb/cliprint.c */
740 int cli_print_queue(struct cli_state *cli,
741 void (*fn)(struct print_job_info *));
742 int cli_printjob_del(struct cli_state *cli, int job);
744 /* The following definitions come from libsmb/cliquota.c */
746 NTSTATUS cli_get_quota_handle(struct cli_state *cli, uint16_t *quota_fnum);
747 void free_ntquota_list(SMB_NTQUOTA_LIST **qt_list);
748 NTSTATUS cli_get_user_quota(struct cli_state *cli, int quota_fnum,
749 SMB_NTQUOTA_STRUCT *pqt);
750 NTSTATUS cli_set_user_quota(struct cli_state *cli, int quota_fnum,
751 SMB_NTQUOTA_STRUCT *pqt);
752 NTSTATUS cli_list_user_quota(struct cli_state *cli, int quota_fnum,
753 SMB_NTQUOTA_LIST **pqt_list);
754 NTSTATUS cli_get_fs_quota_info(struct cli_state *cli, int quota_fnum,
755 SMB_NTQUOTA_STRUCT *pqt);
756 NTSTATUS cli_set_fs_quota_info(struct cli_state *cli, int quota_fnum,
757 SMB_NTQUOTA_STRUCT *pqt);
759 /* The following definitions come from libsmb/clireadwrite.c */
761 struct tevent_req *cli_read_andx_create(TALLOC_CTX *mem_ctx,
762 struct tevent_context *ev,
763 struct cli_state *cli, uint16_t fnum,
764 off_t offset, size_t size,
765 struct tevent_req **psmbreq);
766 struct tevent_req *cli_read_andx_send(TALLOC_CTX *mem_ctx,
767 struct tevent_context *ev,
768 struct cli_state *cli, uint16_t fnum,
769 off_t offset, size_t size);
770 NTSTATUS cli_read_andx_recv(struct tevent_req *req, ssize_t *received,
772 struct tevent_req *cli_pull_send(TALLOC_CTX *mem_ctx,
773 struct tevent_context *ev,
774 struct cli_state *cli,
775 uint16_t fnum, off_t start_offset,
776 off_t size, size_t window_size,
777 NTSTATUS (*sink)(char *buf, size_t n,
780 NTSTATUS cli_pull_recv(struct tevent_req *req, off_t *received);
781 NTSTATUS cli_pull(struct cli_state *cli, uint16_t fnum,
782 off_t start_offset, off_t size, size_t window_size,
783 NTSTATUS (*sink)(char *buf, size_t n, void *priv),
784 void *priv, off_t *received);
785 NTSTATUS cli_read(struct cli_state *cli, uint16_t fnum,
786 char *buf, off_t offset, size_t size,
788 NTSTATUS cli_smbwrite(struct cli_state *cli, uint16_t fnum, char *buf,
789 off_t offset, size_t size1, size_t *ptotal);
790 struct tevent_req *cli_write_andx_create(TALLOC_CTX *mem_ctx,
791 struct tevent_context *ev,
792 struct cli_state *cli, uint16_t fnum,
793 uint16_t mode, const uint8_t *buf,
794 off_t offset, size_t size,
795 struct tevent_req **reqs_before,
797 struct tevent_req **psmbreq);
798 struct tevent_req *cli_write_andx_send(TALLOC_CTX *mem_ctx,
799 struct tevent_context *ev,
800 struct cli_state *cli, uint16_t fnum,
801 uint16_t mode, const uint8_t *buf,
802 off_t offset, size_t size);
803 NTSTATUS cli_write_andx_recv(struct tevent_req *req, size_t *pwritten);
805 NTSTATUS cli_writeall(struct cli_state *cli, uint16_t fnum, uint16_t mode,
806 const uint8_t *buf, off_t offset, size_t size,
809 struct tevent_req *cli_push_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
810 struct cli_state *cli,
811 uint16_t fnum, uint16_t mode,
812 off_t start_offset, size_t window_size,
813 size_t (*source)(uint8_t *buf, size_t n,
816 NTSTATUS cli_push_recv(struct tevent_req *req);
817 NTSTATUS cli_push(struct cli_state *cli, uint16_t fnum, uint16_t mode,
818 off_t start_offset, size_t window_size,
819 size_t (*source)(uint8_t *buf, size_t n, void *priv),
822 /* The following definitions come from libsmb/clisecdesc.c */
824 NTSTATUS cli_query_security_descriptor(struct cli_state *cli,
828 struct security_descriptor **sd);
829 NTSTATUS cli_query_secdesc(struct cli_state *cli, uint16_t fnum,
830 TALLOC_CTX *mem_ctx, struct security_descriptor **sd);
831 NTSTATUS cli_set_security_descriptor(struct cli_state *cli,
834 const struct security_descriptor *sd);
835 NTSTATUS cli_set_secdesc(struct cli_state *cli, uint16_t fnum,
836 const struct security_descriptor *sd);
838 /* The following definitions come from libsmb/clistr.c */
840 size_t clistr_pull_talloc(TALLOC_CTX *ctx,
848 /* The following definitions come from libsmb/clitrans.c */
850 struct tevent_req *cli_trans_send(
851 TALLOC_CTX *mem_ctx, struct tevent_context *ev,
852 struct cli_state *cli, uint8_t cmd,
853 const char *pipe_name, uint16_t fid, uint16_t function, int flags,
854 uint16_t *setup, uint8_t num_setup, uint8_t max_setup,
855 uint8_t *param, uint32_t num_param, uint32_t max_param,
856 uint8_t *data, uint32_t num_data, uint32_t max_data);
857 NTSTATUS cli_trans_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
858 uint16_t *recv_flags2,
859 uint16_t **setup, uint8_t min_setup,
861 uint8_t **param, uint32_t min_param,
863 uint8_t **data, uint32_t min_data,
865 NTSTATUS cli_trans(TALLOC_CTX *mem_ctx, struct cli_state *cli,
867 const char *pipe_name, uint16_t fid, uint16_t function,
869 uint16_t *setup, uint8_t num_setup, uint8_t max_setup,
870 uint8_t *param, uint32_t num_param, uint32_t max_param,
871 uint8_t *data, uint32_t num_data, uint32_t max_data,
872 uint16_t *recv_flags2,
873 uint16_t **rsetup, uint8_t min_rsetup, uint8_t *num_rsetup,
874 uint8_t **rparam, uint32_t min_rparam, uint32_t *num_rparam,
875 uint8_t **rdata, uint32_t min_rdata, uint32_t *num_rdata);
877 /* The following definitions come from libsmb/reparse_symlink.c */
879 bool symlink_reparse_buffer_marshall(
880 const char *substitute, const char *printname, uint32_t flags,
881 TALLOC_CTX *mem_ctx, uint8_t **pdst, size_t *pdstlen);
882 bool symlink_reparse_buffer_parse(
883 const uint8_t *src, size_t srclen, TALLOC_CTX *mem_ctx,
884 char **psubstitute_name, char **pprint_name, uint32_t *pflags);
886 /* The following definitions come from libsmb/clisymlink.c */
888 struct tevent_req *cli_symlink_send(TALLOC_CTX *mem_ctx,
889 struct tevent_context *ev,
890 struct cli_state *cli,
894 NTSTATUS cli_symlink_recv(struct tevent_req *req);
895 NTSTATUS cli_symlink(struct cli_state *cli, const char *oldname,
896 const char *newname, uint32_t flags);
898 struct tevent_req *cli_readlink_send(TALLOC_CTX *mem_ctx,
899 struct tevent_context *ev,
900 struct cli_state *cli,
902 NTSTATUS cli_readlink_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
903 char **psubstitute_name, char **pprint_name,
905 NTSTATUS cli_readlink(struct cli_state *cli, const char *fname,
906 TALLOC_CTX *mem_ctx, char **psubstitute_name,
907 char **pprint_name, uint32_t *pflags);
909 #endif /* _LIBSMB_PROTO_H_ */