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_
31 /* The following definitions come from libsmb/cliconnect.c */
33 NTSTATUS cli_session_setup(struct cli_state *cli,
35 const char *pass, int passlen,
36 const char *ntpass, int ntpasslen,
37 const char *workgroup);
38 struct tevent_req *cli_session_setup_guest_create(TALLOC_CTX *mem_ctx,
39 struct event_context *ev,
40 struct cli_state *cli,
41 struct tevent_req **psmbreq);
42 struct tevent_req *cli_session_setup_guest_send(TALLOC_CTX *mem_ctx,
43 struct event_context *ev,
44 struct cli_state *cli);
45 NTSTATUS cli_session_setup_guest_recv(struct tevent_req *req);
46 struct tevent_req *cli_ulogoff_send(TALLOC_CTX *mem_ctx,
47 struct tevent_context *ev,
48 struct cli_state *cli);
49 NTSTATUS cli_ulogoff_recv(struct tevent_req *req);
50 NTSTATUS cli_ulogoff(struct cli_state *cli);
51 struct tevent_req *cli_tcon_andx_create(TALLOC_CTX *mem_ctx,
52 struct event_context *ev,
53 struct cli_state *cli,
54 const char *share, const char *dev,
55 const char *pass, int passlen,
56 struct tevent_req **psmbreq);
57 struct tevent_req *cli_tcon_andx_send(TALLOC_CTX *mem_ctx,
58 struct event_context *ev,
59 struct cli_state *cli,
60 const char *share, const char *dev,
61 const char *pass, int passlen);
62 NTSTATUS cli_tcon_andx_recv(struct tevent_req *req);
63 NTSTATUS cli_tcon_andx(struct cli_state *cli, const char *share,
64 const char *dev, const char *pass, int passlen);
65 struct tevent_req *cli_tdis_send(TALLOC_CTX *mem_ctx,
66 struct tevent_context *ev,
67 struct cli_state *cli);
68 NTSTATUS cli_tdis_recv(struct tevent_req *req);
69 NTSTATUS cli_tdis(struct cli_state *cli);
70 NTSTATUS cli_negprot(struct cli_state *cli);
71 struct tevent_req *cli_negprot_send(TALLOC_CTX *mem_ctx,
72 struct event_context *ev,
73 struct cli_state *cli);
74 NTSTATUS cli_negprot_recv(struct tevent_req *req);
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 NTSTATUS cli_full_connection(struct cli_state **output_cli,
85 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,
91 NTSTATUS cli_raw_tcon(struct cli_state *cli,
92 const char *service, const char *pass, const char *dev,
93 uint16 *max_xmit, uint16 *tid);
94 struct cli_state *get_ipc_connect(char *server,
95 struct sockaddr_storage *server_ss,
96 const struct user_auth_info *user_info);
97 struct cli_state *get_ipc_connect_master_ip(TALLOC_CTX *ctx,
98 struct sockaddr_storage *mb_ip,
99 const struct user_auth_info *user_info,
100 char **pp_workgroup_out);
101 struct cli_state *get_ipc_connect_master_ip_bcast(TALLOC_CTX *ctx,
102 const struct user_auth_info *user_info,
103 char **pp_workgroup_out);
105 /* The following definitions come from libsmb/clidfs.c */
107 NTSTATUS cli_cm_force_encryption(struct cli_state *c,
108 const char *username,
109 const char *password,
111 const char *sharename);
112 NTSTATUS cli_cm_open(TALLOC_CTX *ctx,
113 struct cli_state *referring_cli,
116 const struct user_auth_info *auth_info,
122 struct cli_state **pcli);
123 void cli_cm_display(struct cli_state *c);
124 struct client_dfs_referral;
125 NTSTATUS cli_dfs_get_referral(TALLOC_CTX *ctx,
126 struct cli_state *cli,
128 struct client_dfs_referral **refs,
131 NTSTATUS cli_resolve_path(TALLOC_CTX *ctx,
133 const struct user_auth_info *dfs_auth_info,
134 struct cli_state *rootcli,
136 struct cli_state **targetcli,
137 char **pp_targetpath);
139 bool cli_check_msdfs_proxy(TALLOC_CTX *ctx,
140 struct cli_state *cli,
141 const char *sharename,
145 const char *username,
146 const char *password,
149 /* The following definitions come from libsmb/clientgen.c */
151 int cli_set_message(char *buf,int num_words,int num_bytes,bool zero);
152 unsigned int cli_set_timeout(struct cli_state *cli, unsigned int timeout);
153 void cli_setup_packet_buf(struct cli_state *cli, char *buf);
154 NTSTATUS cli_set_domain(struct cli_state *cli, const char *domain);
155 NTSTATUS cli_set_username(struct cli_state *cli, const char *username);
156 NTSTATUS cli_set_password(struct cli_state *cli, const char *password);
157 NTSTATUS cli_init_creds(struct cli_state *cli, const char *username, const char *domain, const char *password);
158 struct cli_state *cli_state_create(TALLOC_CTX *mem_ctx,
160 const char *remote_name,
161 const char *remote_realm,
164 bool cli_state_encryption_on(struct cli_state *cli);
165 void cli_nt_pipes_close(struct cli_state *cli);
166 void cli_shutdown(struct cli_state *cli);
167 void cli_sockopt(struct cli_state *cli, const char *options);
168 const struct sockaddr_storage *cli_state_local_sockaddr(struct cli_state *cli);
169 const struct sockaddr_storage *cli_state_remote_sockaddr(struct cli_state *cli);
170 const char *cli_state_remote_name(struct cli_state *cli);
171 const char *cli_state_remote_realm(struct cli_state *cli);
172 uint16_t cli_state_get_vc_num(struct cli_state *cli);
173 uint16 cli_setpid(struct cli_state *cli, uint16 pid);
174 uint16_t cli_getpid(struct cli_state *cli);
175 bool cli_state_has_tcon(struct cli_state *cli);
176 uint16_t cli_state_get_tid(struct cli_state *cli);
177 uint16_t cli_state_set_tid(struct cli_state *cli, uint16_t tid);
178 uint16_t cli_state_get_uid(struct cli_state *cli);
179 uint16_t cli_state_set_uid(struct cli_state *cli, uint16_t uid);
180 bool cli_set_case_sensitive(struct cli_state *cli, bool case_sensitive);
181 enum protocol_types cli_state_protocol(struct cli_state *cli);
182 uint32_t cli_state_capabilities(struct cli_state *cli);
183 uint32_t cli_state_available_size(struct cli_state *cli, uint32_t ofs);
184 uint16_t cli_state_max_requests(struct cli_state *cli);
185 struct tevent_req *cli_echo_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
186 struct cli_state *cli, uint16_t num_echos,
188 NTSTATUS cli_echo_recv(struct tevent_req *req);
189 NTSTATUS cli_echo(struct cli_state *cli, uint16_t num_echos, DATA_BLOB data);
190 bool cli_ucs2(struct cli_state *cli);
191 bool is_andx_req(uint8_t cmd);
192 NTSTATUS cli_smb(TALLOC_CTX *mem_ctx, struct cli_state *cli,
193 uint8_t smb_command, uint8_t additional_flags,
194 uint8_t wct, uint16_t *vwv,
195 uint32_t num_bytes, const uint8_t *bytes,
196 struct tevent_req **result_parent,
197 uint8_t min_wct, uint8_t *pwct, uint16_t **pvwv,
198 uint32_t *pnum_bytes, uint8_t **pbytes);
200 /* The following definitions come from libsmb/clierror.c */
202 const char *cli_errstr(struct cli_state *cli);
203 NTSTATUS cli_nt_error(struct cli_state *cli);
204 void cli_dos_error(struct cli_state *cli, uint8 *eclass, uint32 *ecode);
205 int cli_errno(struct cli_state *cli);
206 bool cli_is_error(struct cli_state *cli);
207 bool cli_is_nt_error(struct cli_state *cli);
208 bool cli_is_dos_error(struct cli_state *cli);
209 bool cli_state_is_connected(struct cli_state *cli);
210 void cli_state_disconnect(struct cli_state *cli);
212 /* The following definitions come from libsmb/clifile.c */
214 struct tevent_req *cli_setpathinfo_send(TALLOC_CTX *mem_ctx,
215 struct tevent_context *ev,
216 struct cli_state *cli,
221 NTSTATUS cli_setpathinfo_recv(struct tevent_req *req);
222 NTSTATUS cli_setpathinfo(struct cli_state *cli,
228 struct tevent_req *cli_posix_symlink_send(TALLOC_CTX *mem_ctx,
229 struct event_context *ev,
230 struct cli_state *cli,
232 const char *newname);
233 NTSTATUS cli_posix_symlink_recv(struct tevent_req *req);
234 NTSTATUS cli_posix_symlink(struct cli_state *cli,
236 const char *newname);
237 struct tevent_req *cli_posix_readlink_send(TALLOC_CTX *mem_ctx,
238 struct event_context *ev,
239 struct cli_state *cli,
242 NTSTATUS cli_posix_readlink_recv(struct tevent_req *req, struct cli_state *cli,
243 char *retpath, size_t len);
244 NTSTATUS cli_posix_readlink(struct cli_state *cli, const char *fname,
245 char *linkpath, size_t len);
246 struct tevent_req *cli_posix_hardlink_send(TALLOC_CTX *mem_ctx,
247 struct event_context *ev,
248 struct cli_state *cli,
250 const char *newname);
251 NTSTATUS cli_posix_hardlink_recv(struct tevent_req *req);
252 NTSTATUS cli_posix_hardlink(struct cli_state *cli,
254 const char *newname);
255 uint32_t unix_perms_to_wire(mode_t perms);
256 mode_t wire_perms_to_unix(uint32_t perms);
257 struct tevent_req *cli_posix_getfacl_send(TALLOC_CTX *mem_ctx,
258 struct event_context *ev,
259 struct cli_state *cli,
261 NTSTATUS cli_posix_getfacl_recv(struct tevent_req *req,
265 NTSTATUS cli_posix_getfacl(struct cli_state *cli,
270 struct tevent_req *cli_posix_stat_send(TALLOC_CTX *mem_ctx,
271 struct event_context *ev,
272 struct cli_state *cli,
274 NTSTATUS cli_posix_stat_recv(struct tevent_req *req,
275 SMB_STRUCT_STAT *sbuf);
276 NTSTATUS cli_posix_stat(struct cli_state *cli,
278 SMB_STRUCT_STAT *sbuf);
279 struct tevent_req *cli_posix_chmod_send(TALLOC_CTX *mem_ctx,
280 struct event_context *ev,
281 struct cli_state *cli,
284 NTSTATUS cli_posix_chmod_recv(struct tevent_req *req);
285 NTSTATUS cli_posix_chmod(struct cli_state *cli, const char *fname, mode_t mode);
286 struct tevent_req *cli_posix_chown_send(TALLOC_CTX *mem_ctx,
287 struct event_context *ev,
288 struct cli_state *cli,
292 NTSTATUS cli_posix_chown_recv(struct tevent_req *req);
293 NTSTATUS cli_posix_chown(struct cli_state *cli,
297 struct tevent_req *cli_rename_send(TALLOC_CTX *mem_ctx,
298 struct event_context *ev,
299 struct cli_state *cli,
300 const char *fname_src,
301 const char *fname_dst);
302 NTSTATUS cli_rename_recv(struct tevent_req *req);
303 NTSTATUS cli_rename(struct cli_state *cli, const char *fname_src, const char *fname_dst);
304 struct tevent_req *cli_ntrename_send(TALLOC_CTX *mem_ctx,
305 struct event_context *ev,
306 struct cli_state *cli,
307 const char *fname_src,
308 const char *fname_dst);
309 NTSTATUS cli_ntrename_recv(struct tevent_req *req);
310 NTSTATUS cli_ntrename(struct cli_state *cli, const char *fname_src, const char *fname_dst);
312 struct tevent_req *cli_nt_hardlink_send(TALLOC_CTX *mem_ctx,
313 struct event_context *ev,
314 struct cli_state *cli,
315 const char *fname_src,
316 const char *fname_dst);
317 NTSTATUS cli_nt_hardlink_recv(struct tevent_req *req);
318 NTSTATUS cli_nt_hardlink(struct cli_state *cli, const char *fname_src, const char *fname_dst);
320 struct tevent_req *cli_unlink_send(TALLOC_CTX *mem_ctx,
321 struct event_context *ev,
322 struct cli_state *cli,
324 uint16_t mayhave_attrs);
325 NTSTATUS cli_unlink_recv(struct tevent_req *req);
326 NTSTATUS cli_unlink(struct cli_state *cli, const char *fname, uint16_t mayhave_attrs);
328 struct tevent_req *cli_mkdir_send(TALLOC_CTX *mem_ctx,
329 struct event_context *ev,
330 struct cli_state *cli,
332 NTSTATUS cli_mkdir_recv(struct tevent_req *req);
333 NTSTATUS cli_mkdir(struct cli_state *cli, const char *dname);
334 struct tevent_req *cli_rmdir_send(TALLOC_CTX *mem_ctx,
335 struct event_context *ev,
336 struct cli_state *cli,
338 NTSTATUS cli_rmdir_recv(struct tevent_req *req);
339 NTSTATUS cli_rmdir(struct cli_state *cli, const char *dname);
340 struct tevent_req *cli_nt_delete_on_close_send(TALLOC_CTX *mem_ctx,
341 struct event_context *ev,
342 struct cli_state *cli,
345 NTSTATUS cli_nt_delete_on_close_recv(struct tevent_req *req);
346 NTSTATUS cli_nt_delete_on_close(struct cli_state *cli, uint16_t fnum, bool flag);
347 struct tevent_req *cli_ntcreate_send(TALLOC_CTX *mem_ctx,
348 struct event_context *ev,
349 struct cli_state *cli,
352 uint32_t DesiredAccess,
353 uint32_t FileAttributes,
354 uint32_t ShareAccess,
355 uint32_t CreateDisposition,
356 uint32_t CreateOptions,
357 uint8_t SecurityFlags);
358 NTSTATUS cli_ntcreate_recv(struct tevent_req *req, uint16_t *pfnum);
359 NTSTATUS cli_ntcreate(struct cli_state *cli,
362 uint32_t DesiredAccess,
363 uint32_t FileAttributes,
364 uint32_t ShareAccess,
365 uint32_t CreateDisposition,
366 uint32_t CreateOptions,
367 uint8_t SecurityFlags,
369 uint8_t *smb_bytes_push_str(uint8_t *buf, bool ucs2, const char *str,
370 size_t str_len, size_t *pconverted_size);
371 uint8_t *smb_bytes_push_bytes(uint8_t *buf, uint8_t prefix,
372 const uint8_t *bytes, size_t num_bytes);
373 uint8_t *trans2_bytes_push_str(uint8_t *buf, bool ucs2,
374 const char *str, size_t str_len,
375 size_t *pconverted_size);
376 uint8_t *trans2_bytes_push_bytes(uint8_t *buf,
377 const uint8_t *bytes, size_t num_bytes);
378 struct tevent_req *cli_open_create(TALLOC_CTX *mem_ctx,
379 struct event_context *ev,
380 struct cli_state *cli, const char *fname,
381 int flags, int share_mode,
382 struct tevent_req **psmbreq);
383 struct tevent_req *cli_open_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
384 struct cli_state *cli, const char *fname,
385 int flags, int share_mode);
386 NTSTATUS cli_open_recv(struct tevent_req *req, uint16_t *fnum);
387 NTSTATUS cli_open(struct cli_state *cli, const char *fname, int flags, int share_mode, uint16_t *pfnum);
388 struct tevent_req *cli_close_create(TALLOC_CTX *mem_ctx,
389 struct event_context *ev,
390 struct cli_state *cli, uint16_t fnum,
391 struct tevent_req **psubreq);
392 struct tevent_req *cli_close_send(TALLOC_CTX *mem_ctx,
393 struct event_context *ev,
394 struct cli_state *cli, uint16_t fnum);
395 NTSTATUS cli_close_recv(struct tevent_req *req);
396 NTSTATUS cli_close(struct cli_state *cli, uint16_t fnum);
397 struct tevent_req *cli_ftruncate_send(TALLOC_CTX *mem_ctx,
398 struct event_context *ev,
399 struct cli_state *cli,
402 NTSTATUS cli_ftruncate_recv(struct tevent_req *req);
403 NTSTATUS cli_ftruncate(struct cli_state *cli, uint16_t fnum, uint64_t size);
404 NTSTATUS cli_locktype(struct cli_state *cli, uint16_t fnum,
405 uint32_t offset, uint32_t len,
406 int timeout, unsigned char locktype);
407 NTSTATUS cli_lock32(struct cli_state *cli, uint16_t fnum, uint32_t offset,
408 uint32_t len, int timeout, enum brl_type lock_type);
409 struct tevent_req *cli_unlock_send(TALLOC_CTX *mem_ctx,
410 struct event_context *ev,
411 struct cli_state *cli,
415 NTSTATUS cli_unlock_recv(struct tevent_req *req);
416 NTSTATUS cli_unlock(struct cli_state *cli, uint16_t fnum, uint32_t offset, uint32_t len);
417 NTSTATUS cli_lock64(struct cli_state *cli, uint16_t fnum,
418 uint64_t offset, uint64_t len, int timeout,
419 enum brl_type lock_type);
420 struct tevent_req *cli_unlock64_send(TALLOC_CTX *mem_ctx,
421 struct event_context *ev,
422 struct cli_state *cli,
426 NTSTATUS cli_unlock64_recv(struct tevent_req *req);
427 NTSTATUS cli_unlock64(struct cli_state *cli, uint16_t fnum, uint64_t offset, uint64_t len);
428 struct tevent_req *cli_posix_lock_send(TALLOC_CTX *mem_ctx,
429 struct event_context *ev,
430 struct cli_state *cli,
435 enum brl_type lock_type);
436 NTSTATUS cli_posix_lock_recv(struct tevent_req *req);
437 NTSTATUS cli_posix_lock(struct cli_state *cli, uint16_t fnum,
438 uint64_t offset, uint64_t len,
439 bool wait_lock, enum brl_type lock_type);
440 struct tevent_req *cli_posix_unlock_send(TALLOC_CTX *mem_ctx,
441 struct event_context *ev,
442 struct cli_state *cli,
446 NTSTATUS cli_posix_unlock_recv(struct tevent_req *req);
447 NTSTATUS cli_posix_unlock(struct cli_state *cli, uint16_t fnum, uint64_t offset, uint64_t len);
448 struct tevent_req *cli_getattrE_send(TALLOC_CTX *mem_ctx,
449 struct event_context *ev,
450 struct cli_state *cli,
452 NTSTATUS cli_getattrE_recv(struct tevent_req *req,
458 NTSTATUS cli_getattrE(struct cli_state *cli,
465 struct tevent_req *cli_setattrE_send(TALLOC_CTX *mem_ctx,
466 struct event_context *ev,
467 struct cli_state *cli,
472 NTSTATUS cli_setattrE_recv(struct tevent_req *req);
473 NTSTATUS cli_setattrE(struct cli_state *cli,
478 struct tevent_req *cli_getatr_send(TALLOC_CTX *mem_ctx,
479 struct event_context *ev,
480 struct cli_state *cli,
482 NTSTATUS cli_getatr_recv(struct tevent_req *req,
486 NTSTATUS cli_getatr(struct cli_state *cli,
491 struct tevent_req *cli_setatr_send(TALLOC_CTX *mem_ctx,
492 struct event_context *ev,
493 struct cli_state *cli,
497 NTSTATUS cli_setatr_recv(struct tevent_req *req);
498 NTSTATUS cli_setatr(struct cli_state *cli,
502 struct tevent_req *cli_chkpath_send(TALLOC_CTX *mem_ctx,
503 struct event_context *ev,
504 struct cli_state *cli,
506 NTSTATUS cli_chkpath_recv(struct tevent_req *req);
507 NTSTATUS cli_chkpath(struct cli_state *cli, const char *path);
508 struct tevent_req *cli_dskattr_send(TALLOC_CTX *mem_ctx,
509 struct event_context *ev,
510 struct cli_state *cli);
511 NTSTATUS cli_dskattr_recv(struct tevent_req *req, int *bsize, int *total,
513 NTSTATUS cli_dskattr(struct cli_state *cli, int *bsize, int *total, int *avail);
514 struct tevent_req *cli_ctemp_send(TALLOC_CTX *mem_ctx,
515 struct event_context *ev,
516 struct cli_state *cli,
518 NTSTATUS cli_ctemp_recv(struct tevent_req *req,
522 NTSTATUS cli_ctemp(struct cli_state *cli,
527 NTSTATUS cli_raw_ioctl(struct cli_state *cli, uint16_t fnum, uint32_t code, DATA_BLOB *blob);
528 NTSTATUS cli_set_ea_path(struct cli_state *cli, const char *path,
529 const char *ea_name, const char *ea_val,
531 NTSTATUS cli_set_ea_fnum(struct cli_state *cli, uint16_t fnum,
532 const char *ea_name, const char *ea_val,
534 struct tevent_req *cli_get_ea_list_path_send(TALLOC_CTX *mem_ctx,
535 struct tevent_context *ev,
536 struct cli_state *cli,
538 NTSTATUS cli_get_ea_list_path_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
539 size_t *pnum_eas, struct ea_struct **peas);
540 NTSTATUS cli_get_ea_list_path(struct cli_state *cli, const char *path,
543 struct ea_struct **pea_list);
544 struct tevent_req *cli_posix_open_send(TALLOC_CTX *mem_ctx,
545 struct event_context *ev,
546 struct cli_state *cli,
550 NTSTATUS cli_posix_open_recv(struct tevent_req *req, uint16_t *pfnum);
551 NTSTATUS cli_posix_open(struct cli_state *cli, const char *fname,
552 int flags, mode_t mode, uint16_t *fnum);
553 struct tevent_req *cli_posix_mkdir_send(TALLOC_CTX *mem_ctx,
554 struct event_context *ev,
555 struct cli_state *cli,
558 NTSTATUS cli_posix_mkdir_recv(struct tevent_req *req);
559 NTSTATUS cli_posix_mkdir(struct cli_state *cli, const char *fname, mode_t mode);
561 struct tevent_req *cli_posix_unlink_send(TALLOC_CTX *mem_ctx,
562 struct event_context *ev,
563 struct cli_state *cli,
565 NTSTATUS cli_posix_unlink_recv(struct tevent_req *req);
566 NTSTATUS cli_posix_unlink(struct cli_state *cli, const char *fname);
568 struct tevent_req *cli_posix_rmdir_send(TALLOC_CTX *mem_ctx,
569 struct event_context *ev,
570 struct cli_state *cli,
572 NTSTATUS cli_posix_rmdir_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx);
573 NTSTATUS cli_posix_rmdir(struct cli_state *cli, const char *fname);
574 struct tevent_req *cli_notify_send(TALLOC_CTX *mem_ctx,
575 struct tevent_context *ev,
576 struct cli_state *cli, uint16_t fnum,
577 uint32_t buffer_size,
578 uint32_t completion_filter, bool recursive);
579 NTSTATUS cli_notify_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
580 uint32_t *pnum_changes,
581 struct notify_change **pchanges);
583 struct tevent_req *cli_nttrans_create_send(TALLOC_CTX *mem_ctx,
584 struct event_context *ev,
585 struct cli_state *cli,
588 uint32_t DesiredAccess,
589 uint32_t FileAttributes,
590 uint32_t ShareAccess,
591 uint32_t CreateDisposition,
592 uint32_t CreateOptions,
593 uint8_t SecurityFlags,
594 struct security_descriptor *secdesc,
595 struct ea_struct *eas,
597 NTSTATUS cli_nttrans_create_recv(struct tevent_req *req, uint16_t *fnum);
598 NTSTATUS cli_nttrans_create(struct cli_state *cli,
601 uint32_t DesiredAccess,
602 uint32_t FileAttributes,
603 uint32_t ShareAccess,
604 uint32_t CreateDisposition,
605 uint32_t CreateOptions,
606 uint8_t SecurityFlags,
607 struct security_descriptor *secdesc,
608 struct ea_struct *eas,
612 /* The following definitions come from libsmb/clifsinfo.c */
614 struct tevent_req *cli_unix_extensions_version_send(TALLOC_CTX *mem_ctx,
615 struct tevent_context *ev,
616 struct cli_state *cli);
617 NTSTATUS cli_unix_extensions_version_recv(struct tevent_req *req,
618 uint16_t *pmajor, uint16_t *pminor,
621 NTSTATUS cli_unix_extensions_version(struct cli_state *cli, uint16 *pmajor,
622 uint16 *pminor, uint32 *pcaplow,
624 struct tevent_req *cli_set_unix_extensions_capabilities_send(
625 TALLOC_CTX *mem_ctx, struct tevent_context *ev, struct cli_state *cli,
626 uint16_t major, uint16_t minor, uint32_t caplow, uint32_t caphigh);
627 NTSTATUS cli_set_unix_extensions_capabilities_recv(struct tevent_req *req);
628 NTSTATUS cli_set_unix_extensions_capabilities(struct cli_state *cli,
629 uint16 major, uint16 minor,
630 uint32 caplow, uint32 caphigh);
631 struct tevent_req *cli_get_fs_attr_info_send(TALLOC_CTX *mem_ctx,
632 struct tevent_context *ev,
633 struct cli_state *cli);
634 NTSTATUS cli_get_fs_attr_info_recv(struct tevent_req *req, uint32_t *fs_attr);
635 NTSTATUS cli_get_fs_attr_info(struct cli_state *cli, uint32_t *fs_attr);
636 NTSTATUS cli_get_fs_volume_info(struct cli_state *cli,
637 TALLOC_CTX *mem_ctx, char **volume_name,
638 uint32 *pserial_number, time_t *pdate);
639 NTSTATUS cli_get_fs_full_size_info(struct cli_state *cli,
640 uint64_t *total_allocation_units,
641 uint64_t *caller_allocation_units,
642 uint64_t *actual_allocation_units,
643 uint64_t *sectors_per_allocation_unit,
644 uint64_t *bytes_per_sector);
645 NTSTATUS cli_get_posix_fs_info(struct cli_state *cli,
646 uint32 *optimal_transfer_size,
648 uint64_t *total_blocks,
649 uint64_t *blocks_available,
650 uint64_t *user_blocks_available,
651 uint64_t *total_file_nodes,
652 uint64_t *free_file_nodes,
653 uint64_t *fs_identifier);
654 NTSTATUS cli_raw_ntlm_smb_encryption_start(struct cli_state *cli,
658 NTSTATUS cli_gss_smb_encryption_start(struct cli_state *cli);
659 NTSTATUS cli_force_encryption(struct cli_state *c,
660 const char *username,
661 const char *password,
664 /* The following definitions come from libsmb/clilist.c */
666 NTSTATUS cli_list_old(struct cli_state *cli,const char *Mask,uint16 attribute,
667 NTSTATUS (*fn)(const char *, struct file_info *,
668 const char *, void *), void *state);
669 NTSTATUS cli_list_trans(struct cli_state *cli, const char *mask,
670 uint16_t attribute, int info_level,
671 NTSTATUS (*fn)(const char *mnt, struct file_info *finfo,
672 const char *mask, void *private_data),
674 struct tevent_req *cli_list_send(TALLOC_CTX *mem_ctx,
675 struct tevent_context *ev,
676 struct cli_state *cli,
679 uint16_t info_level);
680 NTSTATUS cli_list_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
681 struct file_info **finfo, size_t *num_finfo);
682 NTSTATUS cli_list(struct cli_state *cli,const char *Mask,uint16 attribute,
683 NTSTATUS (*fn)(const char *, struct file_info *, const char *,
684 void *), void *state);
686 /* The following definitions come from libsmb/climessage.c */
688 struct tevent_req *cli_message_send(TALLOC_CTX *mem_ctx,
689 struct tevent_context *ev,
690 struct cli_state *cli,
691 const char *host, const char *username,
692 const char *message);
693 NTSTATUS cli_message_recv(struct tevent_req *req);
694 NTSTATUS cli_message(struct cli_state *cli, const char *host,
695 const char *username, const char *message);
697 /* The following definitions come from libsmb/clioplock.c */
699 struct tevent_req *cli_smb_oplock_break_waiter_send(TALLOC_CTX *mem_ctx,
700 struct event_context *ev,
701 struct cli_state *cli);
702 NTSTATUS cli_smb_oplock_break_waiter_recv(struct tevent_req *req,
706 struct tevent_req *cli_oplock_ack_send(TALLOC_CTX *mem_ctx,
707 struct tevent_context *ev,
708 struct cli_state *cli,
709 uint16_t fnum, uint8_t level);
710 NTSTATUS cli_oplock_ack_recv(struct tevent_req *req);
712 /* The following definitions come from libsmb/cliprint.c */
714 int cli_print_queue(struct cli_state *cli,
715 void (*fn)(struct print_job_info *));
716 int cli_printjob_del(struct cli_state *cli, int job);
718 /* The following definitions come from libsmb/cliquota.c */
720 NTSTATUS cli_get_quota_handle(struct cli_state *cli, uint16_t *quota_fnum);
721 void free_ntquota_list(SMB_NTQUOTA_LIST **qt_list);
722 NTSTATUS cli_get_user_quota(struct cli_state *cli, int quota_fnum,
723 SMB_NTQUOTA_STRUCT *pqt);
724 NTSTATUS cli_set_user_quota(struct cli_state *cli, int quota_fnum,
725 SMB_NTQUOTA_STRUCT *pqt);
726 NTSTATUS cli_list_user_quota(struct cli_state *cli, int quota_fnum,
727 SMB_NTQUOTA_LIST **pqt_list);
728 NTSTATUS cli_get_fs_quota_info(struct cli_state *cli, int quota_fnum,
729 SMB_NTQUOTA_STRUCT *pqt);
730 NTSTATUS cli_set_fs_quota_info(struct cli_state *cli, int quota_fnum,
731 SMB_NTQUOTA_STRUCT *pqt);
733 /* The following definitions come from libsmb/clireadwrite.c */
735 struct tevent_req *cli_read_andx_create(TALLOC_CTX *mem_ctx,
736 struct event_context *ev,
737 struct cli_state *cli, uint16_t fnum,
738 off_t offset, size_t size,
739 struct tevent_req **psmbreq);
740 struct tevent_req *cli_read_andx_send(TALLOC_CTX *mem_ctx,
741 struct event_context *ev,
742 struct cli_state *cli, uint16_t fnum,
743 off_t offset, size_t size);
744 NTSTATUS cli_read_andx_recv(struct tevent_req *req, ssize_t *received,
746 struct tevent_req *cli_pull_send(TALLOC_CTX *mem_ctx,
747 struct event_context *ev,
748 struct cli_state *cli,
749 uint16_t fnum, off_t start_offset,
750 SMB_OFF_T size, size_t window_size,
751 NTSTATUS (*sink)(char *buf, size_t n,
754 NTSTATUS cli_pull_recv(struct tevent_req *req, SMB_OFF_T *received);
755 NTSTATUS cli_pull(struct cli_state *cli, uint16_t fnum,
756 off_t start_offset, SMB_OFF_T size, size_t window_size,
757 NTSTATUS (*sink)(char *buf, size_t n, void *priv),
758 void *priv, SMB_OFF_T *received);
759 NTSTATUS cli_read(struct cli_state *cli, uint16_t fnum,
760 char *buf, off_t offset, size_t size,
762 NTSTATUS cli_smbwrite(struct cli_state *cli, uint16_t fnum, char *buf,
763 off_t offset, size_t size1, size_t *ptotal);
764 struct tevent_req *cli_write_andx_create(TALLOC_CTX *mem_ctx,
765 struct event_context *ev,
766 struct cli_state *cli, uint16_t fnum,
767 uint16_t mode, const uint8_t *buf,
768 off_t offset, size_t size,
769 struct tevent_req **reqs_before,
771 struct tevent_req **psmbreq);
772 struct tevent_req *cli_write_andx_send(TALLOC_CTX *mem_ctx,
773 struct event_context *ev,
774 struct cli_state *cli, uint16_t fnum,
775 uint16_t mode, const uint8_t *buf,
776 off_t offset, size_t size);
777 NTSTATUS cli_write_andx_recv(struct tevent_req *req, size_t *pwritten);
779 NTSTATUS cli_writeall(struct cli_state *cli, uint16_t fnum, uint16_t mode,
780 const uint8_t *buf, off_t offset, size_t size,
783 struct tevent_req *cli_push_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
784 struct cli_state *cli,
785 uint16_t fnum, uint16_t mode,
786 off_t start_offset, size_t window_size,
787 size_t (*source)(uint8_t *buf, size_t n,
790 NTSTATUS cli_push_recv(struct tevent_req *req);
791 NTSTATUS cli_push(struct cli_state *cli, uint16_t fnum, uint16_t mode,
792 off_t start_offset, size_t window_size,
793 size_t (*source)(uint8_t *buf, size_t n, void *priv),
796 /* The following definitions come from libsmb/clisecdesc.c */
798 NTSTATUS cli_query_secdesc(struct cli_state *cli, uint16_t fnum,
799 TALLOC_CTX *mem_ctx, struct security_descriptor **sd);
800 NTSTATUS cli_set_secdesc(struct cli_state *cli, uint16_t fnum,
801 const struct security_descriptor *sd);
803 /* The following definitions come from libsmb/clistr.c */
805 size_t clistr_pull_talloc(TALLOC_CTX *ctx,
813 /* The following definitions come from libsmb/clitrans.c */
815 struct tevent_req *cli_trans_send(
816 TALLOC_CTX *mem_ctx, struct event_context *ev,
817 struct cli_state *cli, uint8_t cmd,
818 const char *pipe_name, uint16_t fid, uint16_t function, int flags,
819 uint16_t *setup, uint8_t num_setup, uint8_t max_setup,
820 uint8_t *param, uint32_t num_param, uint32_t max_param,
821 uint8_t *data, uint32_t num_data, uint32_t max_data);
822 NTSTATUS cli_trans_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
823 uint16_t *recv_flags2,
824 uint16_t **setup, uint8_t min_setup,
826 uint8_t **param, uint32_t min_param,
828 uint8_t **data, uint32_t min_data,
830 NTSTATUS cli_trans(TALLOC_CTX *mem_ctx, struct cli_state *cli,
832 const char *pipe_name, uint16_t fid, uint16_t function,
834 uint16_t *setup, uint8_t num_setup, uint8_t max_setup,
835 uint8_t *param, uint32_t num_param, uint32_t max_param,
836 uint8_t *data, uint32_t num_data, uint32_t max_data,
837 uint16_t *recv_flags2,
838 uint16_t **rsetup, uint8_t min_rsetup, uint8_t *num_rsetup,
839 uint8_t **rparam, uint32_t min_rparam, uint32_t *num_rparam,
840 uint8_t **rdata, uint32_t min_rdata, uint32_t *num_rdata);
842 /* The following definitions come from libsmb/smb_seal.c */
844 NTSTATUS get_enc_ctx_num(const uint8_t *buf, uint16 *p_enc_ctx_num);
845 bool common_encryption_on(struct smb_trans_enc_state *es);
846 NTSTATUS common_ntlm_decrypt_buffer(struct auth_ntlmssp_state *auth_ntlmssp_state, char *buf);
847 NTSTATUS common_ntlm_encrypt_buffer(struct auth_ntlmssp_state *auth_ntlmssp_state,
851 NTSTATUS common_encrypt_buffer(struct smb_trans_enc_state *es, char *buffer, char **buf_out);
852 NTSTATUS common_decrypt_buffer(struct smb_trans_enc_state *es, char *buf);
853 void common_free_encryption_state(struct smb_trans_enc_state **pp_es);
854 void common_free_enc_buffer(struct smb_trans_enc_state *es, char *buf);
855 bool cli_encryption_on(struct cli_state *cli);
856 void cli_free_encryption_context(struct cli_state *cli);
857 void cli_free_enc_buffer(struct cli_state *cli, char *buf);
859 /* The following definitions come from libsmb/clisigning.c */
861 bool cli_simple_set_signing(struct cli_state *cli,
862 const DATA_BLOB user_session_key,
863 const DATA_BLOB response);
864 bool cli_temp_set_signing(struct cli_state *cli);
865 void cli_calculate_sign_mac(struct cli_state *cli, char *buf, uint32_t *seqnum);
866 bool cli_check_sign_mac(struct cli_state *cli, const char *buf, uint32_t seqnum);
867 bool client_is_signing_on(struct cli_state *cli);
868 bool client_is_signing_allowed(struct cli_state *cli);
869 bool client_is_signing_mandatory(struct cli_state *cli);
870 void cli_set_signing_negotiated(struct cli_state *cli);
872 /* The following definitions come from libsmb/reparse_symlink.c */
874 bool symlink_reparse_buffer_marshall(
875 const char *substitute, const char *printname, uint32_t flags,
876 TALLOC_CTX *mem_ctx, uint8_t **pdst, size_t *pdstlen);
877 bool symlink_reparse_buffer_parse(
878 const uint8_t *src, size_t srclen, TALLOC_CTX *mem_ctx,
879 char **psubstitute_name, char **pprint_name, uint32_t *pflags);
881 /* The following definitions come from libsmb/clisymlink.c */
883 struct tevent_req *cli_symlink_send(TALLOC_CTX *mem_ctx,
884 struct tevent_context *ev,
885 struct cli_state *cli,
889 NTSTATUS cli_symlink_recv(struct tevent_req *req);
890 NTSTATUS cli_symlink(struct cli_state *cli, const char *oldname,
891 const char *newname, uint32_t flags);
893 struct tevent_req *cli_readlink_send(TALLOC_CTX *mem_ctx,
894 struct tevent_context *ev,
895 struct cli_state *cli,
897 NTSTATUS cli_readlink_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
898 char **psubstitute_name, char **pprint_name,
900 NTSTATUS cli_readlink(struct cli_state *cli, const char *fname,
901 TALLOC_CTX *mem_ctx, char **psubstitute_name,
902 char **pprint_name, uint32_t *pflags);
904 #endif /* _LIBSMB_PROTO_H_ */