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 extern struct GUID cli_state_client_guid;
169 struct cli_state *cli_state_create(TALLOC_CTX *mem_ctx,
171 const char *remote_name,
172 const char *remote_realm,
175 void cli_nt_pipes_close(struct cli_state *cli);
176 void cli_shutdown(struct cli_state *cli);
177 const char *cli_state_remote_realm(struct cli_state *cli);
178 uint16_t cli_state_get_vc_num(struct cli_state *cli);
179 uint16 cli_setpid(struct cli_state *cli, uint16 pid);
180 uint16_t cli_getpid(struct cli_state *cli);
181 bool cli_state_has_tcon(struct cli_state *cli);
182 uint16_t cli_state_get_tid(struct cli_state *cli);
183 uint16_t cli_state_set_tid(struct cli_state *cli, uint16_t tid);
184 uint16_t cli_state_get_uid(struct cli_state *cli);
185 uint16_t cli_state_set_uid(struct cli_state *cli, uint16_t uid);
186 bool cli_set_case_sensitive(struct cli_state *cli, bool case_sensitive);
187 uint32_t cli_state_available_size(struct cli_state *cli, uint32_t ofs);
188 time_t cli_state_server_time(struct cli_state *cli);
189 struct tevent_req *cli_echo_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
190 struct cli_state *cli, uint16_t num_echos,
192 NTSTATUS cli_echo_recv(struct tevent_req *req);
193 NTSTATUS cli_echo(struct cli_state *cli, uint16_t num_echos, DATA_BLOB data);
194 bool is_andx_req(uint8_t cmd);
195 NTSTATUS cli_smb(TALLOC_CTX *mem_ctx, struct cli_state *cli,
196 uint8_t smb_command, uint8_t additional_flags,
197 uint8_t wct, uint16_t *vwv,
198 uint32_t num_bytes, const uint8_t *bytes,
199 struct tevent_req **result_parent,
200 uint8_t min_wct, uint8_t *pwct, uint16_t **pvwv,
201 uint32_t *pnum_bytes, uint8_t **pbytes);
203 /* The following definitions come from libsmb/clierror.c */
205 const char *cli_errstr(struct cli_state *cli);
206 NTSTATUS cli_nt_error(struct cli_state *cli);
207 void cli_dos_error(struct cli_state *cli, uint8 *eclass, uint32 *ecode);
208 int cli_errno(struct cli_state *cli);
209 bool cli_is_error(struct cli_state *cli);
210 bool cli_is_nt_error(struct cli_state *cli);
211 bool cli_is_dos_error(struct cli_state *cli);
212 bool cli_state_is_connected(struct cli_state *cli);
214 /* The following definitions come from libsmb/clifile.c */
216 struct tevent_req *cli_setpathinfo_send(TALLOC_CTX *mem_ctx,
217 struct tevent_context *ev,
218 struct cli_state *cli,
223 NTSTATUS cli_setpathinfo_recv(struct tevent_req *req);
224 NTSTATUS cli_setpathinfo(struct cli_state *cli,
230 struct tevent_req *cli_posix_symlink_send(TALLOC_CTX *mem_ctx,
231 struct tevent_context *ev,
232 struct cli_state *cli,
234 const char *newname);
235 NTSTATUS cli_posix_symlink_recv(struct tevent_req *req);
236 NTSTATUS cli_posix_symlink(struct cli_state *cli,
238 const char *newname);
239 struct tevent_req *cli_posix_readlink_send(TALLOC_CTX *mem_ctx,
240 struct tevent_context *ev,
241 struct cli_state *cli,
244 NTSTATUS cli_posix_readlink_recv(struct tevent_req *req, struct cli_state *cli,
245 char *retpath, size_t len);
246 NTSTATUS cli_posix_readlink(struct cli_state *cli, const char *fname,
247 char *linkpath, size_t len);
248 struct tevent_req *cli_posix_hardlink_send(TALLOC_CTX *mem_ctx,
249 struct tevent_context *ev,
250 struct cli_state *cli,
252 const char *newname);
253 NTSTATUS cli_posix_hardlink_recv(struct tevent_req *req);
254 NTSTATUS cli_posix_hardlink(struct cli_state *cli,
256 const char *newname);
257 uint32_t unix_perms_to_wire(mode_t perms);
258 mode_t wire_perms_to_unix(uint32_t perms);
259 struct tevent_req *cli_posix_getfacl_send(TALLOC_CTX *mem_ctx,
260 struct tevent_context *ev,
261 struct cli_state *cli,
263 NTSTATUS cli_posix_getfacl_recv(struct tevent_req *req,
267 NTSTATUS cli_posix_getfacl(struct cli_state *cli,
272 struct tevent_req *cli_posix_stat_send(TALLOC_CTX *mem_ctx,
273 struct tevent_context *ev,
274 struct cli_state *cli,
276 NTSTATUS cli_posix_stat_recv(struct tevent_req *req,
277 SMB_STRUCT_STAT *sbuf);
278 NTSTATUS cli_posix_stat(struct cli_state *cli,
280 SMB_STRUCT_STAT *sbuf);
281 struct tevent_req *cli_posix_chmod_send(TALLOC_CTX *mem_ctx,
282 struct tevent_context *ev,
283 struct cli_state *cli,
286 NTSTATUS cli_posix_chmod_recv(struct tevent_req *req);
287 NTSTATUS cli_posix_chmod(struct cli_state *cli, const char *fname, mode_t mode);
288 struct tevent_req *cli_posix_chown_send(TALLOC_CTX *mem_ctx,
289 struct tevent_context *ev,
290 struct cli_state *cli,
294 NTSTATUS cli_posix_chown_recv(struct tevent_req *req);
295 NTSTATUS cli_posix_chown(struct cli_state *cli,
299 struct tevent_req *cli_rename_send(TALLOC_CTX *mem_ctx,
300 struct tevent_context *ev,
301 struct cli_state *cli,
302 const char *fname_src,
303 const char *fname_dst);
304 NTSTATUS cli_rename_recv(struct tevent_req *req);
305 NTSTATUS cli_rename(struct cli_state *cli, const char *fname_src, const char *fname_dst);
306 struct tevent_req *cli_ntrename_send(TALLOC_CTX *mem_ctx,
307 struct tevent_context *ev,
308 struct cli_state *cli,
309 const char *fname_src,
310 const char *fname_dst);
311 NTSTATUS cli_ntrename_recv(struct tevent_req *req);
312 NTSTATUS cli_ntrename(struct cli_state *cli, const char *fname_src, const char *fname_dst);
314 struct tevent_req *cli_nt_hardlink_send(TALLOC_CTX *mem_ctx,
315 struct tevent_context *ev,
316 struct cli_state *cli,
317 const char *fname_src,
318 const char *fname_dst);
319 NTSTATUS cli_nt_hardlink_recv(struct tevent_req *req);
320 NTSTATUS cli_nt_hardlink(struct cli_state *cli, const char *fname_src, const char *fname_dst);
322 struct tevent_req *cli_unlink_send(TALLOC_CTX *mem_ctx,
323 struct tevent_context *ev,
324 struct cli_state *cli,
326 uint16_t mayhave_attrs);
327 NTSTATUS cli_unlink_recv(struct tevent_req *req);
328 NTSTATUS cli_unlink(struct cli_state *cli, const char *fname, uint16_t mayhave_attrs);
330 struct tevent_req *cli_mkdir_send(TALLOC_CTX *mem_ctx,
331 struct tevent_context *ev,
332 struct cli_state *cli,
334 NTSTATUS cli_mkdir_recv(struct tevent_req *req);
335 NTSTATUS cli_mkdir(struct cli_state *cli, const char *dname);
336 struct tevent_req *cli_rmdir_send(TALLOC_CTX *mem_ctx,
337 struct tevent_context *ev,
338 struct cli_state *cli,
340 NTSTATUS cli_rmdir_recv(struct tevent_req *req);
341 NTSTATUS cli_rmdir(struct cli_state *cli, const char *dname);
342 struct tevent_req *cli_nt_delete_on_close_send(TALLOC_CTX *mem_ctx,
343 struct tevent_context *ev,
344 struct cli_state *cli,
347 NTSTATUS cli_nt_delete_on_close_recv(struct tevent_req *req);
348 NTSTATUS cli_nt_delete_on_close(struct cli_state *cli, uint16_t fnum, bool flag);
349 struct tevent_req *cli_ntcreate_send(TALLOC_CTX *mem_ctx,
350 struct tevent_context *ev,
351 struct cli_state *cli,
354 uint32_t DesiredAccess,
355 uint32_t FileAttributes,
356 uint32_t ShareAccess,
357 uint32_t CreateDisposition,
358 uint32_t CreateOptions,
359 uint8_t SecurityFlags);
360 NTSTATUS cli_ntcreate_recv(struct tevent_req *req,
362 struct smb_create_returns *cr);
363 NTSTATUS cli_ntcreate(struct cli_state *cli,
366 uint32_t DesiredAccess,
367 uint32_t FileAttributes,
368 uint32_t ShareAccess,
369 uint32_t CreateDisposition,
370 uint32_t CreateOptions,
371 uint8_t SecurityFlags,
373 struct smb_create_returns *cr);
374 uint8_t *smb_bytes_push_str(uint8_t *buf, bool ucs2, const char *str,
375 size_t str_len, size_t *pconverted_size);
376 uint8_t *smb_bytes_push_bytes(uint8_t *buf, uint8_t prefix,
377 const uint8_t *bytes, size_t num_bytes);
378 uint8_t *trans2_bytes_push_str(uint8_t *buf, bool ucs2,
379 const char *str, size_t str_len,
380 size_t *pconverted_size);
381 uint8_t *trans2_bytes_push_bytes(uint8_t *buf,
382 const uint8_t *bytes, size_t num_bytes);
383 struct tevent_req *cli_openx_create(TALLOC_CTX *mem_ctx,
384 struct tevent_context *ev,
385 struct cli_state *cli, const char *fname,
386 int flags, int share_mode,
387 struct tevent_req **psmbreq);
388 struct tevent_req *cli_openx_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
389 struct cli_state *cli, const char *fname,
390 int flags, int share_mode);
391 NTSTATUS cli_openx_recv(struct tevent_req *req, uint16_t *fnum);
392 NTSTATUS cli_openx(struct cli_state *cli, const char *fname, int flags, int share_mode, uint16_t *pfnum);
393 NTSTATUS cli_open(struct cli_state *cli, const char *fname, int flags, int share_mode, uint16_t *pfnum);
394 struct tevent_req *cli_close_create(TALLOC_CTX *mem_ctx,
395 struct tevent_context *ev,
396 struct cli_state *cli, uint16_t fnum,
397 struct tevent_req **psubreq);
398 struct tevent_req *cli_close_send(TALLOC_CTX *mem_ctx,
399 struct tevent_context *ev,
400 struct cli_state *cli, uint16_t fnum);
401 NTSTATUS cli_close_recv(struct tevent_req *req);
402 NTSTATUS cli_close(struct cli_state *cli, uint16_t fnum);
403 struct tevent_req *cli_ftruncate_send(TALLOC_CTX *mem_ctx,
404 struct tevent_context *ev,
405 struct cli_state *cli,
408 NTSTATUS cli_ftruncate_recv(struct tevent_req *req);
409 NTSTATUS cli_ftruncate(struct cli_state *cli, uint16_t fnum, uint64_t size);
410 NTSTATUS cli_locktype(struct cli_state *cli, uint16_t fnum,
411 uint32_t offset, uint32_t len,
412 int timeout, unsigned char locktype);
413 NTSTATUS cli_lock32(struct cli_state *cli, uint16_t fnum, uint32_t offset,
414 uint32_t len, int timeout, enum brl_type lock_type);
415 struct tevent_req *cli_unlock_send(TALLOC_CTX *mem_ctx,
416 struct tevent_context *ev,
417 struct cli_state *cli,
421 NTSTATUS cli_unlock_recv(struct tevent_req *req);
422 NTSTATUS cli_unlock(struct cli_state *cli, uint16_t fnum, uint32_t offset, uint32_t len);
423 NTSTATUS cli_lock64(struct cli_state *cli, uint16_t fnum,
424 uint64_t offset, uint64_t len, int timeout,
425 enum brl_type lock_type);
426 struct tevent_req *cli_unlock64_send(TALLOC_CTX *mem_ctx,
427 struct tevent_context *ev,
428 struct cli_state *cli,
432 NTSTATUS cli_unlock64_recv(struct tevent_req *req);
433 NTSTATUS cli_unlock64(struct cli_state *cli, uint16_t fnum, uint64_t offset, uint64_t len);
434 struct tevent_req *cli_posix_lock_send(TALLOC_CTX *mem_ctx,
435 struct tevent_context *ev,
436 struct cli_state *cli,
441 enum brl_type lock_type);
442 NTSTATUS cli_posix_lock_recv(struct tevent_req *req);
443 NTSTATUS cli_posix_lock(struct cli_state *cli, uint16_t fnum,
444 uint64_t offset, uint64_t len,
445 bool wait_lock, enum brl_type lock_type);
446 struct tevent_req *cli_posix_unlock_send(TALLOC_CTX *mem_ctx,
447 struct tevent_context *ev,
448 struct cli_state *cli,
452 NTSTATUS cli_posix_unlock_recv(struct tevent_req *req);
453 NTSTATUS cli_posix_unlock(struct cli_state *cli, uint16_t fnum, uint64_t offset, uint64_t len);
454 struct tevent_req *cli_getattrE_send(TALLOC_CTX *mem_ctx,
455 struct tevent_context *ev,
456 struct cli_state *cli,
458 NTSTATUS cli_getattrE_recv(struct tevent_req *req,
464 NTSTATUS cli_getattrE(struct cli_state *cli,
471 struct tevent_req *cli_setattrE_send(TALLOC_CTX *mem_ctx,
472 struct tevent_context *ev,
473 struct cli_state *cli,
478 NTSTATUS cli_setattrE_recv(struct tevent_req *req);
479 NTSTATUS cli_setattrE(struct cli_state *cli,
484 struct tevent_req *cli_getatr_send(TALLOC_CTX *mem_ctx,
485 struct tevent_context *ev,
486 struct cli_state *cli,
488 NTSTATUS cli_getatr_recv(struct tevent_req *req,
492 NTSTATUS cli_getatr(struct cli_state *cli,
497 struct tevent_req *cli_setatr_send(TALLOC_CTX *mem_ctx,
498 struct tevent_context *ev,
499 struct cli_state *cli,
503 NTSTATUS cli_setatr_recv(struct tevent_req *req);
504 NTSTATUS cli_setatr(struct cli_state *cli,
508 struct tevent_req *cli_chkpath_send(TALLOC_CTX *mem_ctx,
509 struct tevent_context *ev,
510 struct cli_state *cli,
512 NTSTATUS cli_chkpath_recv(struct tevent_req *req);
513 NTSTATUS cli_chkpath(struct cli_state *cli, const char *path);
514 struct tevent_req *cli_dskattr_send(TALLOC_CTX *mem_ctx,
515 struct tevent_context *ev,
516 struct cli_state *cli);
517 NTSTATUS cli_dskattr_recv(struct tevent_req *req, int *bsize, int *total,
519 NTSTATUS cli_dskattr(struct cli_state *cli, int *bsize, int *total, int *avail);
520 NTSTATUS cli_disk_size(struct cli_state *cli, uint64_t *bsize, uint64_t *total, uint64_t *avail);
521 struct tevent_req *cli_ctemp_send(TALLOC_CTX *mem_ctx,
522 struct tevent_context *ev,
523 struct cli_state *cli,
525 NTSTATUS cli_ctemp_recv(struct tevent_req *req,
529 NTSTATUS cli_ctemp(struct cli_state *cli,
534 NTSTATUS cli_raw_ioctl(struct cli_state *cli, uint16_t fnum, uint32_t code, DATA_BLOB *blob);
535 NTSTATUS cli_set_ea_path(struct cli_state *cli, const char *path,
536 const char *ea_name, const char *ea_val,
538 NTSTATUS cli_set_ea_fnum(struct cli_state *cli, uint16_t fnum,
539 const char *ea_name, const char *ea_val,
541 struct tevent_req *cli_get_ea_list_path_send(TALLOC_CTX *mem_ctx,
542 struct tevent_context *ev,
543 struct cli_state *cli,
545 NTSTATUS cli_get_ea_list_path_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
546 size_t *pnum_eas, struct ea_struct **peas);
547 NTSTATUS cli_get_ea_list_path(struct cli_state *cli, const char *path,
550 struct ea_struct **pea_list);
551 struct tevent_req *cli_posix_open_send(TALLOC_CTX *mem_ctx,
552 struct tevent_context *ev,
553 struct cli_state *cli,
557 NTSTATUS cli_posix_open_recv(struct tevent_req *req, uint16_t *pfnum);
558 NTSTATUS cli_posix_open(struct cli_state *cli, const char *fname,
559 int flags, mode_t mode, uint16_t *fnum);
560 struct tevent_req *cli_posix_mkdir_send(TALLOC_CTX *mem_ctx,
561 struct tevent_context *ev,
562 struct cli_state *cli,
565 NTSTATUS cli_posix_mkdir_recv(struct tevent_req *req);
566 NTSTATUS cli_posix_mkdir(struct cli_state *cli, const char *fname, mode_t mode);
568 struct tevent_req *cli_posix_unlink_send(TALLOC_CTX *mem_ctx,
569 struct tevent_context *ev,
570 struct cli_state *cli,
572 NTSTATUS cli_posix_unlink_recv(struct tevent_req *req);
573 NTSTATUS cli_posix_unlink(struct cli_state *cli, const char *fname);
575 struct tevent_req *cli_posix_rmdir_send(TALLOC_CTX *mem_ctx,
576 struct tevent_context *ev,
577 struct cli_state *cli,
579 NTSTATUS cli_posix_rmdir_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx);
580 NTSTATUS cli_posix_rmdir(struct cli_state *cli, const char *fname);
581 struct tevent_req *cli_notify_send(TALLOC_CTX *mem_ctx,
582 struct tevent_context *ev,
583 struct cli_state *cli, uint16_t fnum,
584 uint32_t buffer_size,
585 uint32_t completion_filter, bool recursive);
586 NTSTATUS cli_notify_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
587 uint32_t *pnum_changes,
588 struct notify_change **pchanges);
589 NTSTATUS cli_notify(struct cli_state *cli, uint16_t fnum, uint32_t buffer_size,
590 uint32_t completion_filter, bool recursive,
591 TALLOC_CTX *mem_ctx, uint32_t *pnum_changes,
592 struct notify_change **pchanges);
594 struct tevent_req *cli_nttrans_create_send(TALLOC_CTX *mem_ctx,
595 struct tevent_context *ev,
596 struct cli_state *cli,
599 uint32_t DesiredAccess,
600 uint32_t FileAttributes,
601 uint32_t ShareAccess,
602 uint32_t CreateDisposition,
603 uint32_t CreateOptions,
604 uint8_t SecurityFlags,
605 struct security_descriptor *secdesc,
606 struct ea_struct *eas,
608 NTSTATUS cli_nttrans_create_recv(struct tevent_req *req,
610 struct smb_create_returns *cr);
611 NTSTATUS cli_nttrans_create(struct cli_state *cli,
614 uint32_t DesiredAccess,
615 uint32_t FileAttributes,
616 uint32_t ShareAccess,
617 uint32_t CreateDisposition,
618 uint32_t CreateOptions,
619 uint8_t SecurityFlags,
620 struct security_descriptor *secdesc,
621 struct ea_struct *eas,
624 struct smb_create_returns *cr);
626 /* The following definitions come from libsmb/clifsinfo.c */
628 struct tevent_req *cli_unix_extensions_version_send(TALLOC_CTX *mem_ctx,
629 struct tevent_context *ev,
630 struct cli_state *cli);
631 NTSTATUS cli_unix_extensions_version_recv(struct tevent_req *req,
632 uint16_t *pmajor, uint16_t *pminor,
635 NTSTATUS cli_unix_extensions_version(struct cli_state *cli, uint16 *pmajor,
636 uint16 *pminor, uint32 *pcaplow,
638 struct tevent_req *cli_set_unix_extensions_capabilities_send(
639 TALLOC_CTX *mem_ctx, struct tevent_context *ev, struct cli_state *cli,
640 uint16_t major, uint16_t minor, uint32_t caplow, uint32_t caphigh);
641 NTSTATUS cli_set_unix_extensions_capabilities_recv(struct tevent_req *req);
642 NTSTATUS cli_set_unix_extensions_capabilities(struct cli_state *cli,
643 uint16 major, uint16 minor,
644 uint32 caplow, uint32 caphigh);
645 struct tevent_req *cli_get_fs_attr_info_send(TALLOC_CTX *mem_ctx,
646 struct tevent_context *ev,
647 struct cli_state *cli);
648 NTSTATUS cli_get_fs_attr_info_recv(struct tevent_req *req, uint32_t *fs_attr);
649 NTSTATUS cli_get_fs_attr_info(struct cli_state *cli, uint32_t *fs_attr);
650 NTSTATUS cli_get_fs_volume_info(struct cli_state *cli,
651 TALLOC_CTX *mem_ctx, char **volume_name,
652 uint32 *pserial_number, time_t *pdate);
653 NTSTATUS cli_get_fs_full_size_info(struct cli_state *cli,
654 uint64_t *total_allocation_units,
655 uint64_t *caller_allocation_units,
656 uint64_t *actual_allocation_units,
657 uint64_t *sectors_per_allocation_unit,
658 uint64_t *bytes_per_sector);
659 NTSTATUS cli_get_posix_fs_info(struct cli_state *cli,
660 uint32 *optimal_transfer_size,
662 uint64_t *total_blocks,
663 uint64_t *blocks_available,
664 uint64_t *user_blocks_available,
665 uint64_t *total_file_nodes,
666 uint64_t *free_file_nodes,
667 uint64_t *fs_identifier);
668 NTSTATUS cli_raw_ntlm_smb_encryption_start(struct cli_state *cli,
672 NTSTATUS cli_gss_smb_encryption_start(struct cli_state *cli);
673 NTSTATUS cli_force_encryption(struct cli_state *c,
674 const char *username,
675 const char *password,
678 /* The following definitions come from libsmb/clilist.c */
680 NTSTATUS cli_list_old(struct cli_state *cli,const char *Mask,uint16 attribute,
681 NTSTATUS (*fn)(const char *, struct file_info *,
682 const char *, void *), void *state);
683 NTSTATUS cli_list_trans(struct cli_state *cli, const char *mask,
684 uint16_t attribute, int info_level,
685 NTSTATUS (*fn)(const char *mnt, struct file_info *finfo,
686 const char *mask, void *private_data),
688 struct tevent_req *cli_list_send(TALLOC_CTX *mem_ctx,
689 struct tevent_context *ev,
690 struct cli_state *cli,
693 uint16_t info_level);
694 NTSTATUS cli_list_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
695 struct file_info **finfo, size_t *num_finfo);
696 NTSTATUS cli_list(struct cli_state *cli,const char *Mask,uint16 attribute,
697 NTSTATUS (*fn)(const char *, struct file_info *, const char *,
698 void *), void *state);
700 /* The following definitions come from libsmb/climessage.c */
702 struct tevent_req *cli_message_send(TALLOC_CTX *mem_ctx,
703 struct tevent_context *ev,
704 struct cli_state *cli,
705 const char *host, const char *username,
706 const char *message);
707 NTSTATUS cli_message_recv(struct tevent_req *req);
708 NTSTATUS cli_message(struct cli_state *cli, const char *host,
709 const char *username, const char *message);
711 /* The following definitions come from libsmb/clioplock.c */
713 struct tevent_req *cli_smb_oplock_break_waiter_send(TALLOC_CTX *mem_ctx,
714 struct tevent_context *ev,
715 struct cli_state *cli);
716 NTSTATUS cli_smb_oplock_break_waiter_recv(struct tevent_req *req,
720 struct tevent_req *cli_oplock_ack_send(TALLOC_CTX *mem_ctx,
721 struct tevent_context *ev,
722 struct cli_state *cli,
723 uint16_t fnum, uint8_t level);
724 NTSTATUS cli_oplock_ack_recv(struct tevent_req *req);
726 /* The following definitions come from libsmb/cliprint.c */
728 int cli_print_queue(struct cli_state *cli,
729 void (*fn)(struct print_job_info *));
730 int cli_printjob_del(struct cli_state *cli, int job);
732 /* The following definitions come from libsmb/cliquota.c */
734 NTSTATUS cli_get_quota_handle(struct cli_state *cli, uint16_t *quota_fnum);
735 void free_ntquota_list(SMB_NTQUOTA_LIST **qt_list);
736 NTSTATUS cli_get_user_quota(struct cli_state *cli, int quota_fnum,
737 SMB_NTQUOTA_STRUCT *pqt);
738 NTSTATUS cli_set_user_quota(struct cli_state *cli, int quota_fnum,
739 SMB_NTQUOTA_STRUCT *pqt);
740 NTSTATUS cli_list_user_quota(struct cli_state *cli, int quota_fnum,
741 SMB_NTQUOTA_LIST **pqt_list);
742 NTSTATUS cli_get_fs_quota_info(struct cli_state *cli, int quota_fnum,
743 SMB_NTQUOTA_STRUCT *pqt);
744 NTSTATUS cli_set_fs_quota_info(struct cli_state *cli, int quota_fnum,
745 SMB_NTQUOTA_STRUCT *pqt);
747 /* The following definitions come from libsmb/clireadwrite.c */
749 struct tevent_req *cli_read_andx_create(TALLOC_CTX *mem_ctx,
750 struct tevent_context *ev,
751 struct cli_state *cli, uint16_t fnum,
752 off_t offset, size_t size,
753 struct tevent_req **psmbreq);
754 struct tevent_req *cli_read_andx_send(TALLOC_CTX *mem_ctx,
755 struct tevent_context *ev,
756 struct cli_state *cli, uint16_t fnum,
757 off_t offset, size_t size);
758 NTSTATUS cli_read_andx_recv(struct tevent_req *req, ssize_t *received,
760 struct tevent_req *cli_pull_send(TALLOC_CTX *mem_ctx,
761 struct tevent_context *ev,
762 struct cli_state *cli,
763 uint16_t fnum, off_t start_offset,
764 off_t size, size_t window_size,
765 NTSTATUS (*sink)(char *buf, size_t n,
768 NTSTATUS cli_pull_recv(struct tevent_req *req, off_t *received);
769 NTSTATUS cli_pull(struct cli_state *cli, uint16_t fnum,
770 off_t start_offset, off_t size, size_t window_size,
771 NTSTATUS (*sink)(char *buf, size_t n, void *priv),
772 void *priv, off_t *received);
773 NTSTATUS cli_read(struct cli_state *cli, uint16_t fnum,
774 char *buf, off_t offset, size_t size,
776 NTSTATUS cli_smbwrite(struct cli_state *cli, uint16_t fnum, char *buf,
777 off_t offset, size_t size1, size_t *ptotal);
778 struct tevent_req *cli_write_andx_create(TALLOC_CTX *mem_ctx,
779 struct tevent_context *ev,
780 struct cli_state *cli, uint16_t fnum,
781 uint16_t mode, const uint8_t *buf,
782 off_t offset, size_t size,
783 struct tevent_req **reqs_before,
785 struct tevent_req **psmbreq);
786 struct tevent_req *cli_write_andx_send(TALLOC_CTX *mem_ctx,
787 struct tevent_context *ev,
788 struct cli_state *cli, uint16_t fnum,
789 uint16_t mode, const uint8_t *buf,
790 off_t offset, size_t size);
791 NTSTATUS cli_write_andx_recv(struct tevent_req *req, size_t *pwritten);
793 NTSTATUS cli_writeall(struct cli_state *cli, uint16_t fnum, uint16_t mode,
794 const uint8_t *buf, off_t offset, size_t size,
797 struct tevent_req *cli_push_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
798 struct cli_state *cli,
799 uint16_t fnum, uint16_t mode,
800 off_t start_offset, size_t window_size,
801 size_t (*source)(uint8_t *buf, size_t n,
804 NTSTATUS cli_push_recv(struct tevent_req *req);
805 NTSTATUS cli_push(struct cli_state *cli, uint16_t fnum, uint16_t mode,
806 off_t start_offset, size_t window_size,
807 size_t (*source)(uint8_t *buf, size_t n, void *priv),
810 /* The following definitions come from libsmb/clisecdesc.c */
812 NTSTATUS cli_query_security_descriptor(struct cli_state *cli,
816 struct security_descriptor **sd);
817 NTSTATUS cli_query_secdesc(struct cli_state *cli, uint16_t fnum,
818 TALLOC_CTX *mem_ctx, struct security_descriptor **sd);
819 NTSTATUS cli_set_security_descriptor(struct cli_state *cli,
822 const struct security_descriptor *sd);
823 NTSTATUS cli_set_secdesc(struct cli_state *cli, uint16_t fnum,
824 const struct security_descriptor *sd);
826 /* The following definitions come from libsmb/clistr.c */
828 size_t clistr_pull_talloc(TALLOC_CTX *ctx,
836 /* The following definitions come from libsmb/clitrans.c */
838 struct tevent_req *cli_trans_send(
839 TALLOC_CTX *mem_ctx, struct tevent_context *ev,
840 struct cli_state *cli, uint8_t cmd,
841 const char *pipe_name, uint16_t fid, uint16_t function, int flags,
842 uint16_t *setup, uint8_t num_setup, uint8_t max_setup,
843 uint8_t *param, uint32_t num_param, uint32_t max_param,
844 uint8_t *data, uint32_t num_data, uint32_t max_data);
845 NTSTATUS cli_trans_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
846 uint16_t *recv_flags2,
847 uint16_t **setup, uint8_t min_setup,
849 uint8_t **param, uint32_t min_param,
851 uint8_t **data, uint32_t min_data,
853 NTSTATUS cli_trans(TALLOC_CTX *mem_ctx, struct cli_state *cli,
855 const char *pipe_name, uint16_t fid, uint16_t function,
857 uint16_t *setup, uint8_t num_setup, uint8_t max_setup,
858 uint8_t *param, uint32_t num_param, uint32_t max_param,
859 uint8_t *data, uint32_t num_data, uint32_t max_data,
860 uint16_t *recv_flags2,
861 uint16_t **rsetup, uint8_t min_rsetup, uint8_t *num_rsetup,
862 uint8_t **rparam, uint32_t min_rparam, uint32_t *num_rparam,
863 uint8_t **rdata, uint32_t min_rdata, uint32_t *num_rdata);
865 /* The following definitions come from libsmb/reparse_symlink.c */
867 bool symlink_reparse_buffer_marshall(
868 const char *substitute, const char *printname, uint32_t flags,
869 TALLOC_CTX *mem_ctx, uint8_t **pdst, size_t *pdstlen);
870 bool symlink_reparse_buffer_parse(
871 const uint8_t *src, size_t srclen, TALLOC_CTX *mem_ctx,
872 char **psubstitute_name, char **pprint_name, uint32_t *pflags);
874 /* The following definitions come from libsmb/clisymlink.c */
876 struct tevent_req *cli_symlink_send(TALLOC_CTX *mem_ctx,
877 struct tevent_context *ev,
878 struct cli_state *cli,
882 NTSTATUS cli_symlink_recv(struct tevent_req *req);
883 NTSTATUS cli_symlink(struct cli_state *cli, const char *oldname,
884 const char *newname, uint32_t flags);
886 struct tevent_req *cli_readlink_send(TALLOC_CTX *mem_ctx,
887 struct tevent_context *ev,
888 struct cli_state *cli,
890 NTSTATUS cli_readlink_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
891 char **psubstitute_name, char **pprint_name,
893 NTSTATUS cli_readlink(struct cli_state *cli, const char *fname,
894 TALLOC_CTX *mem_ctx, char **psubstitute_name,
895 char **pprint_name, uint32_t *pflags);
897 #endif /* _LIBSMB_PROTO_H_ */