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 ADS_STATUS cli_session_setup_spnego(struct cli_state *cli, const char *user,
34 const char *pass, const char *user_domain,
35 const char * dest_realm);
37 NTSTATUS cli_session_setup(struct cli_state *cli,
39 const char *pass, int passlen,
40 const char *ntpass, int ntpasslen,
41 const char *workgroup);
42 struct tevent_req *cli_session_setup_guest_create(TALLOC_CTX *mem_ctx,
43 struct event_context *ev,
44 struct cli_state *cli,
45 struct tevent_req **psmbreq);
46 struct tevent_req *cli_session_setup_guest_send(TALLOC_CTX *mem_ctx,
47 struct event_context *ev,
48 struct cli_state *cli);
49 NTSTATUS cli_session_setup_guest_recv(struct tevent_req *req);
50 struct tevent_req *cli_ulogoff_send(TALLOC_CTX *mem_ctx,
51 struct tevent_context *ev,
52 struct cli_state *cli);
53 NTSTATUS cli_ulogoff_recv(struct tevent_req *req);
54 NTSTATUS cli_ulogoff(struct cli_state *cli);
55 struct tevent_req *cli_tcon_andx_create(TALLOC_CTX *mem_ctx,
56 struct event_context *ev,
57 struct cli_state *cli,
58 const char *share, const char *dev,
59 const char *pass, int passlen,
60 struct tevent_req **psmbreq);
61 struct tevent_req *cli_tcon_andx_send(TALLOC_CTX *mem_ctx,
62 struct event_context *ev,
63 struct cli_state *cli,
64 const char *share, const char *dev,
65 const char *pass, int passlen);
66 NTSTATUS cli_tcon_andx_recv(struct tevent_req *req);
67 NTSTATUS cli_tcon_andx(struct cli_state *cli, const char *share,
68 const char *dev, const char *pass, int passlen);
69 struct tevent_req *cli_tdis_send(TALLOC_CTX *mem_ctx,
70 struct tevent_context *ev,
71 struct cli_state *cli);
72 NTSTATUS cli_tdis_recv(struct tevent_req *req);
73 NTSTATUS cli_tdis(struct cli_state *cli);
74 NTSTATUS cli_negprot(struct cli_state *cli);
75 struct tevent_req *cli_negprot_send(TALLOC_CTX *mem_ctx,
76 struct event_context *ev,
77 struct cli_state *cli);
78 NTSTATUS cli_negprot_recv(struct tevent_req *req);
79 NTSTATUS cli_connect_nb(const char *host, const struct sockaddr_storage *dest_ss,
80 uint16_t port, int name_type, const char *myname,
81 int signing_state, struct cli_state **pcli);
82 NTSTATUS cli_start_connection(struct cli_state **output_cli,
84 const char *dest_host,
85 const struct sockaddr_storage *dest_ss, int port,
86 int signing_state, int flags);
87 NTSTATUS cli_full_connection(struct cli_state **output_cli,
89 const char *dest_host,
90 const struct sockaddr_storage *dest_ss, int port,
91 const char *service, const char *service_type,
92 const char *user, const char *domain,
93 const char *password, int flags,
95 NTSTATUS cli_raw_tcon(struct cli_state *cli,
96 const char *service, const char *pass, const char *dev,
97 uint16 *max_xmit, uint16 *tid);
98 struct cli_state *get_ipc_connect(char *server,
99 struct sockaddr_storage *server_ss,
100 const struct user_auth_info *user_info);
101 struct cli_state *get_ipc_connect_master_ip(TALLOC_CTX *ctx,
102 struct sockaddr_storage *mb_ip,
103 const struct user_auth_info *user_info,
104 char **pp_workgroup_out);
105 struct cli_state *get_ipc_connect_master_ip_bcast(TALLOC_CTX *ctx,
106 const struct user_auth_info *user_info,
107 char **pp_workgroup_out);
109 /* The following definitions come from libsmb/clidfs.c */
111 NTSTATUS cli_cm_force_encryption(struct cli_state *c,
112 const char *username,
113 const char *password,
115 const char *sharename);
116 NTSTATUS cli_cm_open(TALLOC_CTX *ctx,
117 struct cli_state *referring_cli,
120 const struct user_auth_info *auth_info,
126 struct cli_state **pcli);
127 void cli_cm_display(struct cli_state *c);
128 struct client_dfs_referral;
129 NTSTATUS cli_dfs_get_referral(TALLOC_CTX *ctx,
130 struct cli_state *cli,
132 struct client_dfs_referral **refs,
135 NTSTATUS cli_resolve_path(TALLOC_CTX *ctx,
137 const struct user_auth_info *dfs_auth_info,
138 struct cli_state *rootcli,
140 struct cli_state **targetcli,
141 char **pp_targetpath);
143 bool cli_check_msdfs_proxy(TALLOC_CTX *ctx,
144 struct cli_state *cli,
145 const char *sharename,
149 const char *username,
150 const char *password,
153 /* The following definitions come from libsmb/clientgen.c */
155 int cli_set_message(char *buf,int num_words,int num_bytes,bool zero);
156 unsigned int cli_set_timeout(struct cli_state *cli, unsigned int timeout);
157 void cli_setup_packet_buf(struct cli_state *cli, char *buf);
158 NTSTATUS cli_set_domain(struct cli_state *cli, const char *domain);
159 NTSTATUS cli_set_username(struct cli_state *cli, const char *username);
160 NTSTATUS cli_set_password(struct cli_state *cli, const char *password);
161 NTSTATUS cli_init_creds(struct cli_state *cli, const char *username, const char *domain, const char *password);
162 struct cli_state *cli_state_create(TALLOC_CTX *mem_ctx,
164 const char *remote_name,
166 bool cli_state_encryption_on(struct cli_state *cli);
167 void cli_nt_pipes_close(struct cli_state *cli);
168 void cli_shutdown(struct cli_state *cli);
169 void cli_sockopt(struct cli_state *cli, const char *options);
170 const struct sockaddr_storage *cli_state_local_sockaddr(struct cli_state *cli);
171 const struct sockaddr_storage *cli_state_remote_sockaddr(struct cli_state *cli);
172 const char *cli_state_remote_name(struct cli_state *cli);
173 uint16_t cli_state_get_vc_num(struct cli_state *cli);
174 uint16 cli_setpid(struct cli_state *cli, uint16 pid);
175 uint16_t cli_getpid(struct cli_state *cli);
176 bool cli_state_has_tcon(struct cli_state *cli);
177 uint16_t cli_state_get_tid(struct cli_state *cli);
178 uint16_t cli_state_set_tid(struct cli_state *cli, uint16_t tid);
179 uint16_t cli_state_get_uid(struct cli_state *cli);
180 uint16_t cli_state_set_uid(struct cli_state *cli, uint16_t uid);
181 bool cli_set_case_sensitive(struct cli_state *cli, bool case_sensitive);
182 uint32_t cli_state_capabilities(struct cli_state *cli);
183 struct tevent_req *cli_echo_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
184 struct cli_state *cli, uint16_t num_echos,
186 NTSTATUS cli_echo_recv(struct tevent_req *req);
187 NTSTATUS cli_echo(struct cli_state *cli, uint16_t num_echos, DATA_BLOB data);
188 bool cli_ucs2(struct cli_state *cli);
189 bool is_andx_req(uint8_t cmd);
190 NTSTATUS cli_smb(TALLOC_CTX *mem_ctx, struct cli_state *cli,
191 uint8_t smb_command, uint8_t additional_flags,
192 uint8_t wct, uint16_t *vwv,
193 uint32_t num_bytes, const uint8_t *bytes,
194 struct tevent_req **result_parent,
195 uint8_t min_wct, uint8_t *pwct, uint16_t **pvwv,
196 uint32_t *pnum_bytes, uint8_t **pbytes);
198 /* The following definitions come from libsmb/clierror.c */
200 const char *cli_errstr(struct cli_state *cli);
201 NTSTATUS cli_nt_error(struct cli_state *cli);
202 void cli_dos_error(struct cli_state *cli, uint8 *eclass, uint32 *ecode);
203 int cli_errno(struct cli_state *cli);
204 bool cli_is_error(struct cli_state *cli);
205 bool cli_is_nt_error(struct cli_state *cli);
206 bool cli_is_dos_error(struct cli_state *cli);
207 bool cli_state_is_connected(struct cli_state *cli);
208 void cli_state_disconnect(struct cli_state *cli);
210 /* The following definitions come from libsmb/clifile.c */
212 struct tevent_req *cli_setpathinfo_send(TALLOC_CTX *mem_ctx,
213 struct tevent_context *ev,
214 struct cli_state *cli,
219 NTSTATUS cli_setpathinfo_recv(struct tevent_req *req);
220 NTSTATUS cli_setpathinfo(struct cli_state *cli,
226 struct tevent_req *cli_posix_symlink_send(TALLOC_CTX *mem_ctx,
227 struct event_context *ev,
228 struct cli_state *cli,
230 const char *newname);
231 NTSTATUS cli_posix_symlink_recv(struct tevent_req *req);
232 NTSTATUS cli_posix_symlink(struct cli_state *cli,
234 const char *newname);
235 struct tevent_req *cli_posix_readlink_send(TALLOC_CTX *mem_ctx,
236 struct event_context *ev,
237 struct cli_state *cli,
240 NTSTATUS cli_posix_readlink_recv(struct tevent_req *req, struct cli_state *cli,
241 char *retpath, size_t len);
242 NTSTATUS cli_posix_readlink(struct cli_state *cli, const char *fname,
243 char *linkpath, size_t len);
244 struct tevent_req *cli_posix_hardlink_send(TALLOC_CTX *mem_ctx,
245 struct event_context *ev,
246 struct cli_state *cli,
248 const char *newname);
249 NTSTATUS cli_posix_hardlink_recv(struct tevent_req *req);
250 NTSTATUS cli_posix_hardlink(struct cli_state *cli,
252 const char *newname);
253 uint32_t unix_perms_to_wire(mode_t perms);
254 mode_t wire_perms_to_unix(uint32_t perms);
255 struct tevent_req *cli_posix_getfacl_send(TALLOC_CTX *mem_ctx,
256 struct event_context *ev,
257 struct cli_state *cli,
259 NTSTATUS cli_posix_getfacl_recv(struct tevent_req *req,
263 NTSTATUS cli_posix_getfacl(struct cli_state *cli,
268 struct tevent_req *cli_posix_stat_send(TALLOC_CTX *mem_ctx,
269 struct event_context *ev,
270 struct cli_state *cli,
272 NTSTATUS cli_posix_stat_recv(struct tevent_req *req,
273 SMB_STRUCT_STAT *sbuf);
274 NTSTATUS cli_posix_stat(struct cli_state *cli,
276 SMB_STRUCT_STAT *sbuf);
277 struct tevent_req *cli_posix_chmod_send(TALLOC_CTX *mem_ctx,
278 struct event_context *ev,
279 struct cli_state *cli,
282 NTSTATUS cli_posix_chmod_recv(struct tevent_req *req);
283 NTSTATUS cli_posix_chmod(struct cli_state *cli, const char *fname, mode_t mode);
284 struct tevent_req *cli_posix_chown_send(TALLOC_CTX *mem_ctx,
285 struct event_context *ev,
286 struct cli_state *cli,
290 NTSTATUS cli_posix_chown_recv(struct tevent_req *req);
291 NTSTATUS cli_posix_chown(struct cli_state *cli,
295 struct tevent_req *cli_rename_send(TALLOC_CTX *mem_ctx,
296 struct event_context *ev,
297 struct cli_state *cli,
298 const char *fname_src,
299 const char *fname_dst);
300 NTSTATUS cli_rename_recv(struct tevent_req *req);
301 NTSTATUS cli_rename(struct cli_state *cli, const char *fname_src, const char *fname_dst);
302 struct tevent_req *cli_ntrename_send(TALLOC_CTX *mem_ctx,
303 struct event_context *ev,
304 struct cli_state *cli,
305 const char *fname_src,
306 const char *fname_dst);
307 NTSTATUS cli_ntrename_recv(struct tevent_req *req);
308 NTSTATUS cli_ntrename(struct cli_state *cli, const char *fname_src, const char *fname_dst);
310 struct tevent_req *cli_nt_hardlink_send(TALLOC_CTX *mem_ctx,
311 struct event_context *ev,
312 struct cli_state *cli,
313 const char *fname_src,
314 const char *fname_dst);
315 NTSTATUS cli_nt_hardlink_recv(struct tevent_req *req);
316 NTSTATUS cli_nt_hardlink(struct cli_state *cli, const char *fname_src, const char *fname_dst);
318 struct tevent_req *cli_unlink_send(TALLOC_CTX *mem_ctx,
319 struct event_context *ev,
320 struct cli_state *cli,
322 uint16_t mayhave_attrs);
323 NTSTATUS cli_unlink_recv(struct tevent_req *req);
324 NTSTATUS cli_unlink(struct cli_state *cli, const char *fname, uint16_t mayhave_attrs);
326 struct tevent_req *cli_mkdir_send(TALLOC_CTX *mem_ctx,
327 struct event_context *ev,
328 struct cli_state *cli,
330 NTSTATUS cli_mkdir_recv(struct tevent_req *req);
331 NTSTATUS cli_mkdir(struct cli_state *cli, const char *dname);
332 struct tevent_req *cli_rmdir_send(TALLOC_CTX *mem_ctx,
333 struct event_context *ev,
334 struct cli_state *cli,
336 NTSTATUS cli_rmdir_recv(struct tevent_req *req);
337 NTSTATUS cli_rmdir(struct cli_state *cli, const char *dname);
338 struct tevent_req *cli_nt_delete_on_close_send(TALLOC_CTX *mem_ctx,
339 struct event_context *ev,
340 struct cli_state *cli,
343 NTSTATUS cli_nt_delete_on_close_recv(struct tevent_req *req);
344 NTSTATUS cli_nt_delete_on_close(struct cli_state *cli, uint16_t fnum, bool flag);
345 struct tevent_req *cli_ntcreate_send(TALLOC_CTX *mem_ctx,
346 struct event_context *ev,
347 struct cli_state *cli,
350 uint32_t DesiredAccess,
351 uint32_t FileAttributes,
352 uint32_t ShareAccess,
353 uint32_t CreateDisposition,
354 uint32_t CreateOptions,
355 uint8_t SecurityFlags);
356 NTSTATUS cli_ntcreate_recv(struct tevent_req *req, uint16_t *pfnum);
357 NTSTATUS cli_ntcreate(struct cli_state *cli,
360 uint32_t DesiredAccess,
361 uint32_t FileAttributes,
362 uint32_t ShareAccess,
363 uint32_t CreateDisposition,
364 uint32_t CreateOptions,
365 uint8_t SecurityFlags,
367 uint8_t *smb_bytes_push_str(uint8_t *buf, bool ucs2, const char *str,
368 size_t str_len, size_t *pconverted_size);
369 uint8_t *smb_bytes_push_bytes(uint8_t *buf, uint8_t prefix,
370 const uint8_t *bytes, size_t num_bytes);
371 uint8_t *trans2_bytes_push_str(uint8_t *buf, bool ucs2,
372 const char *str, size_t str_len,
373 size_t *pconverted_size);
374 uint8_t *trans2_bytes_push_bytes(uint8_t *buf,
375 const uint8_t *bytes, size_t num_bytes);
376 struct tevent_req *cli_open_create(TALLOC_CTX *mem_ctx,
377 struct event_context *ev,
378 struct cli_state *cli, const char *fname,
379 int flags, int share_mode,
380 struct tevent_req **psmbreq);
381 struct tevent_req *cli_open_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
382 struct cli_state *cli, const char *fname,
383 int flags, int share_mode);
384 NTSTATUS cli_open_recv(struct tevent_req *req, uint16_t *fnum);
385 NTSTATUS cli_open(struct cli_state *cli, const char *fname, int flags, int share_mode, uint16_t *pfnum);
386 struct tevent_req *cli_close_create(TALLOC_CTX *mem_ctx,
387 struct event_context *ev,
388 struct cli_state *cli, uint16_t fnum,
389 struct tevent_req **psubreq);
390 struct tevent_req *cli_close_send(TALLOC_CTX *mem_ctx,
391 struct event_context *ev,
392 struct cli_state *cli, uint16_t fnum);
393 NTSTATUS cli_close_recv(struct tevent_req *req);
394 NTSTATUS cli_close(struct cli_state *cli, uint16_t fnum);
395 struct tevent_req *cli_ftruncate_send(TALLOC_CTX *mem_ctx,
396 struct event_context *ev,
397 struct cli_state *cli,
400 NTSTATUS cli_ftruncate_recv(struct tevent_req *req);
401 NTSTATUS cli_ftruncate(struct cli_state *cli, uint16_t fnum, uint64_t size);
402 NTSTATUS cli_locktype(struct cli_state *cli, uint16_t fnum,
403 uint32_t offset, uint32_t len,
404 int timeout, unsigned char locktype);
405 NTSTATUS cli_lock32(struct cli_state *cli, uint16_t fnum, uint32_t offset,
406 uint32_t len, int timeout, enum brl_type lock_type);
407 struct tevent_req *cli_unlock_send(TALLOC_CTX *mem_ctx,
408 struct event_context *ev,
409 struct cli_state *cli,
413 NTSTATUS cli_unlock_recv(struct tevent_req *req);
414 NTSTATUS cli_unlock(struct cli_state *cli, uint16_t fnum, uint32_t offset, uint32_t len);
415 NTSTATUS cli_lock64(struct cli_state *cli, uint16_t fnum,
416 uint64_t offset, uint64_t len, int timeout,
417 enum brl_type lock_type);
418 struct tevent_req *cli_unlock64_send(TALLOC_CTX *mem_ctx,
419 struct event_context *ev,
420 struct cli_state *cli,
424 NTSTATUS cli_unlock64_recv(struct tevent_req *req);
425 NTSTATUS cli_unlock64(struct cli_state *cli, uint16_t fnum, uint64_t offset, uint64_t len);
426 struct tevent_req *cli_posix_lock_send(TALLOC_CTX *mem_ctx,
427 struct event_context *ev,
428 struct cli_state *cli,
433 enum brl_type lock_type);
434 NTSTATUS cli_posix_lock_recv(struct tevent_req *req);
435 NTSTATUS cli_posix_lock(struct cli_state *cli, uint16_t fnum,
436 uint64_t offset, uint64_t len,
437 bool wait_lock, enum brl_type lock_type);
438 struct tevent_req *cli_posix_unlock_send(TALLOC_CTX *mem_ctx,
439 struct event_context *ev,
440 struct cli_state *cli,
444 NTSTATUS cli_posix_unlock_recv(struct tevent_req *req);
445 NTSTATUS cli_posix_unlock(struct cli_state *cli, uint16_t fnum, uint64_t offset, uint64_t len);
446 struct tevent_req *cli_getattrE_send(TALLOC_CTX *mem_ctx,
447 struct event_context *ev,
448 struct cli_state *cli,
450 NTSTATUS cli_getattrE_recv(struct tevent_req *req,
456 NTSTATUS cli_getattrE(struct cli_state *cli,
463 struct tevent_req *cli_setattrE_send(TALLOC_CTX *mem_ctx,
464 struct event_context *ev,
465 struct cli_state *cli,
470 NTSTATUS cli_setattrE_recv(struct tevent_req *req);
471 NTSTATUS cli_setattrE(struct cli_state *cli,
476 struct tevent_req *cli_getatr_send(TALLOC_CTX *mem_ctx,
477 struct event_context *ev,
478 struct cli_state *cli,
480 NTSTATUS cli_getatr_recv(struct tevent_req *req,
484 NTSTATUS cli_getatr(struct cli_state *cli,
489 struct tevent_req *cli_setatr_send(TALLOC_CTX *mem_ctx,
490 struct event_context *ev,
491 struct cli_state *cli,
495 NTSTATUS cli_setatr_recv(struct tevent_req *req);
496 NTSTATUS cli_setatr(struct cli_state *cli,
500 struct tevent_req *cli_chkpath_send(TALLOC_CTX *mem_ctx,
501 struct event_context *ev,
502 struct cli_state *cli,
504 NTSTATUS cli_chkpath_recv(struct tevent_req *req);
505 NTSTATUS cli_chkpath(struct cli_state *cli, const char *path);
506 struct tevent_req *cli_dskattr_send(TALLOC_CTX *mem_ctx,
507 struct event_context *ev,
508 struct cli_state *cli);
509 NTSTATUS cli_dskattr_recv(struct tevent_req *req, int *bsize, int *total,
511 NTSTATUS cli_dskattr(struct cli_state *cli, int *bsize, int *total, int *avail);
512 struct tevent_req *cli_ctemp_send(TALLOC_CTX *mem_ctx,
513 struct event_context *ev,
514 struct cli_state *cli,
516 NTSTATUS cli_ctemp_recv(struct tevent_req *req,
520 NTSTATUS cli_ctemp(struct cli_state *cli,
525 NTSTATUS cli_raw_ioctl(struct cli_state *cli, uint16_t fnum, uint32_t code, DATA_BLOB *blob);
526 NTSTATUS cli_set_ea_path(struct cli_state *cli, const char *path,
527 const char *ea_name, const char *ea_val,
529 NTSTATUS cli_set_ea_fnum(struct cli_state *cli, uint16_t fnum,
530 const char *ea_name, const char *ea_val,
532 struct tevent_req *cli_get_ea_list_path_send(TALLOC_CTX *mem_ctx,
533 struct tevent_context *ev,
534 struct cli_state *cli,
536 NTSTATUS cli_get_ea_list_path_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
537 size_t *pnum_eas, struct ea_struct **peas);
538 NTSTATUS cli_get_ea_list_path(struct cli_state *cli, const char *path,
541 struct ea_struct **pea_list);
542 struct tevent_req *cli_posix_open_send(TALLOC_CTX *mem_ctx,
543 struct event_context *ev,
544 struct cli_state *cli,
548 NTSTATUS cli_posix_open_recv(struct tevent_req *req, uint16_t *pfnum);
549 NTSTATUS cli_posix_open(struct cli_state *cli, const char *fname,
550 int flags, mode_t mode, uint16_t *fnum);
551 struct tevent_req *cli_posix_mkdir_send(TALLOC_CTX *mem_ctx,
552 struct event_context *ev,
553 struct cli_state *cli,
556 NTSTATUS cli_posix_mkdir_recv(struct tevent_req *req);
557 NTSTATUS cli_posix_mkdir(struct cli_state *cli, const char *fname, mode_t mode);
559 struct tevent_req *cli_posix_unlink_send(TALLOC_CTX *mem_ctx,
560 struct event_context *ev,
561 struct cli_state *cli,
563 NTSTATUS cli_posix_unlink_recv(struct tevent_req *req);
564 NTSTATUS cli_posix_unlink(struct cli_state *cli, const char *fname);
566 struct tevent_req *cli_posix_rmdir_send(TALLOC_CTX *mem_ctx,
567 struct event_context *ev,
568 struct cli_state *cli,
570 NTSTATUS cli_posix_rmdir_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx);
571 NTSTATUS cli_posix_rmdir(struct cli_state *cli, const char *fname);
572 struct tevent_req *cli_notify_send(TALLOC_CTX *mem_ctx,
573 struct tevent_context *ev,
574 struct cli_state *cli, uint16_t fnum,
575 uint32_t buffer_size,
576 uint32_t completion_filter, bool recursive);
577 NTSTATUS cli_notify_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
578 uint32_t *pnum_changes,
579 struct notify_change **pchanges);
581 struct tevent_req *cli_nttrans_create_send(TALLOC_CTX *mem_ctx,
582 struct event_context *ev,
583 struct cli_state *cli,
586 uint32_t DesiredAccess,
587 uint32_t FileAttributes,
588 uint32_t ShareAccess,
589 uint32_t CreateDisposition,
590 uint32_t CreateOptions,
591 uint8_t SecurityFlags,
592 struct security_descriptor *secdesc,
593 struct ea_struct *eas,
595 NTSTATUS cli_nttrans_create_recv(struct tevent_req *req, uint16_t *fnum);
596 NTSTATUS cli_nttrans_create(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,
610 /* The following definitions come from libsmb/clifsinfo.c */
612 struct tevent_req *cli_unix_extensions_version_send(TALLOC_CTX *mem_ctx,
613 struct tevent_context *ev,
614 struct cli_state *cli);
615 NTSTATUS cli_unix_extensions_version_recv(struct tevent_req *req,
616 uint16_t *pmajor, uint16_t *pminor,
619 NTSTATUS cli_unix_extensions_version(struct cli_state *cli, uint16 *pmajor,
620 uint16 *pminor, uint32 *pcaplow,
622 struct tevent_req *cli_set_unix_extensions_capabilities_send(
623 TALLOC_CTX *mem_ctx, struct tevent_context *ev, struct cli_state *cli,
624 uint16_t major, uint16_t minor, uint32_t caplow, uint32_t caphigh);
625 NTSTATUS cli_set_unix_extensions_capabilities_recv(struct tevent_req *req);
626 NTSTATUS cli_set_unix_extensions_capabilities(struct cli_state *cli,
627 uint16 major, uint16 minor,
628 uint32 caplow, uint32 caphigh);
629 struct tevent_req *cli_get_fs_attr_info_send(TALLOC_CTX *mem_ctx,
630 struct tevent_context *ev,
631 struct cli_state *cli);
632 NTSTATUS cli_get_fs_attr_info_recv(struct tevent_req *req, uint32_t *fs_attr);
633 NTSTATUS cli_get_fs_attr_info(struct cli_state *cli, uint32_t *fs_attr);
634 NTSTATUS cli_get_fs_volume_info(struct cli_state *cli,
635 TALLOC_CTX *mem_ctx, char **volume_name,
636 uint32 *pserial_number, time_t *pdate);
637 NTSTATUS cli_get_fs_full_size_info(struct cli_state *cli,
638 uint64_t *total_allocation_units,
639 uint64_t *caller_allocation_units,
640 uint64_t *actual_allocation_units,
641 uint64_t *sectors_per_allocation_unit,
642 uint64_t *bytes_per_sector);
643 NTSTATUS cli_get_posix_fs_info(struct cli_state *cli,
644 uint32 *optimal_transfer_size,
646 uint64_t *total_blocks,
647 uint64_t *blocks_available,
648 uint64_t *user_blocks_available,
649 uint64_t *total_file_nodes,
650 uint64_t *free_file_nodes,
651 uint64_t *fs_identifier);
652 NTSTATUS cli_raw_ntlm_smb_encryption_start(struct cli_state *cli,
656 NTSTATUS cli_gss_smb_encryption_start(struct cli_state *cli);
657 NTSTATUS cli_force_encryption(struct cli_state *c,
658 const char *username,
659 const char *password,
662 /* The following definitions come from libsmb/clilist.c */
664 NTSTATUS cli_list_old(struct cli_state *cli,const char *Mask,uint16 attribute,
665 NTSTATUS (*fn)(const char *, struct file_info *,
666 const char *, void *), void *state);
667 NTSTATUS cli_list_trans(struct cli_state *cli, const char *mask,
668 uint16_t attribute, int info_level,
669 NTSTATUS (*fn)(const char *mnt, struct file_info *finfo,
670 const char *mask, void *private_data),
672 struct tevent_req *cli_list_send(TALLOC_CTX *mem_ctx,
673 struct tevent_context *ev,
674 struct cli_state *cli,
677 uint16_t info_level);
678 NTSTATUS cli_list_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
679 struct file_info **finfo, size_t *num_finfo);
680 NTSTATUS cli_list(struct cli_state *cli,const char *Mask,uint16 attribute,
681 NTSTATUS (*fn)(const char *, struct file_info *, const char *,
682 void *), void *state);
684 /* The following definitions come from libsmb/climessage.c */
686 struct tevent_req *cli_message_send(TALLOC_CTX *mem_ctx,
687 struct tevent_context *ev,
688 struct cli_state *cli,
689 const char *host, const char *username,
690 const char *message);
691 NTSTATUS cli_message_recv(struct tevent_req *req);
692 NTSTATUS cli_message(struct cli_state *cli, const char *host,
693 const char *username, const char *message);
695 /* The following definitions come from libsmb/clioplock.c */
697 struct tevent_req *cli_oplock_ack_send(TALLOC_CTX *mem_ctx,
698 struct tevent_context *ev,
699 struct cli_state *cli,
700 uint16_t fnum, uint8_t level);
701 NTSTATUS cli_oplock_ack_recv(struct tevent_req *req);
703 /* The following definitions come from libsmb/cliprint.c */
705 int cli_print_queue(struct cli_state *cli,
706 void (*fn)(struct print_job_info *));
707 int cli_printjob_del(struct cli_state *cli, int job);
709 /* The following definitions come from libsmb/cliquota.c */
711 NTSTATUS cli_get_quota_handle(struct cli_state *cli, uint16_t *quota_fnum);
712 void free_ntquota_list(SMB_NTQUOTA_LIST **qt_list);
713 NTSTATUS cli_get_user_quota(struct cli_state *cli, int quota_fnum,
714 SMB_NTQUOTA_STRUCT *pqt);
715 NTSTATUS cli_set_user_quota(struct cli_state *cli, int quota_fnum,
716 SMB_NTQUOTA_STRUCT *pqt);
717 NTSTATUS cli_list_user_quota(struct cli_state *cli, int quota_fnum,
718 SMB_NTQUOTA_LIST **pqt_list);
719 NTSTATUS cli_get_fs_quota_info(struct cli_state *cli, int quota_fnum,
720 SMB_NTQUOTA_STRUCT *pqt);
721 NTSTATUS cli_set_fs_quota_info(struct cli_state *cli, int quota_fnum,
722 SMB_NTQUOTA_STRUCT *pqt);
724 /* The following definitions come from libsmb/clireadwrite.c */
726 struct tevent_req *cli_read_andx_create(TALLOC_CTX *mem_ctx,
727 struct event_context *ev,
728 struct cli_state *cli, uint16_t fnum,
729 off_t offset, size_t size,
730 struct tevent_req **psmbreq);
731 struct tevent_req *cli_read_andx_send(TALLOC_CTX *mem_ctx,
732 struct event_context *ev,
733 struct cli_state *cli, uint16_t fnum,
734 off_t offset, size_t size);
735 NTSTATUS cli_read_andx_recv(struct tevent_req *req, ssize_t *received,
737 struct tevent_req *cli_pull_send(TALLOC_CTX *mem_ctx,
738 struct event_context *ev,
739 struct cli_state *cli,
740 uint16_t fnum, off_t start_offset,
741 SMB_OFF_T size, size_t window_size,
742 NTSTATUS (*sink)(char *buf, size_t n,
745 NTSTATUS cli_pull_recv(struct tevent_req *req, SMB_OFF_T *received);
746 NTSTATUS cli_pull(struct cli_state *cli, uint16_t fnum,
747 off_t start_offset, SMB_OFF_T size, size_t window_size,
748 NTSTATUS (*sink)(char *buf, size_t n, void *priv),
749 void *priv, SMB_OFF_T *received);
750 NTSTATUS cli_read(struct cli_state *cli, uint16_t fnum,
751 char *buf, off_t offset, size_t size,
753 NTSTATUS cli_smbwrite(struct cli_state *cli, uint16_t fnum, char *buf,
754 off_t offset, size_t size1, size_t *ptotal);
755 struct tevent_req *cli_write_andx_create(TALLOC_CTX *mem_ctx,
756 struct event_context *ev,
757 struct cli_state *cli, uint16_t fnum,
758 uint16_t mode, const uint8_t *buf,
759 off_t offset, size_t size,
760 struct tevent_req **reqs_before,
762 struct tevent_req **psmbreq);
763 struct tevent_req *cli_write_andx_send(TALLOC_CTX *mem_ctx,
764 struct event_context *ev,
765 struct cli_state *cli, uint16_t fnum,
766 uint16_t mode, const uint8_t *buf,
767 off_t offset, size_t size);
768 NTSTATUS cli_write_andx_recv(struct tevent_req *req, size_t *pwritten);
770 NTSTATUS cli_writeall(struct cli_state *cli, uint16_t fnum, uint16_t mode,
771 const uint8_t *buf, off_t offset, size_t size,
774 struct tevent_req *cli_push_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
775 struct cli_state *cli,
776 uint16_t fnum, uint16_t mode,
777 off_t start_offset, size_t window_size,
778 size_t (*source)(uint8_t *buf, size_t n,
781 NTSTATUS cli_push_recv(struct tevent_req *req);
782 NTSTATUS cli_push(struct cli_state *cli, uint16_t fnum, uint16_t mode,
783 off_t start_offset, size_t window_size,
784 size_t (*source)(uint8_t *buf, size_t n, void *priv),
787 /* The following definitions come from libsmb/clisecdesc.c */
789 NTSTATUS cli_query_secdesc(struct cli_state *cli, uint16_t fnum,
790 TALLOC_CTX *mem_ctx, struct security_descriptor **sd);
791 NTSTATUS cli_set_secdesc(struct cli_state *cli, uint16_t fnum,
792 const struct security_descriptor *sd);
794 /* The following definitions come from libsmb/clistr.c */
796 size_t clistr_pull_talloc(TALLOC_CTX *ctx,
804 /* The following definitions come from libsmb/clitrans.c */
806 struct tevent_req *cli_trans_send(
807 TALLOC_CTX *mem_ctx, struct event_context *ev,
808 struct cli_state *cli, uint8_t cmd,
809 const char *pipe_name, uint16_t fid, uint16_t function, int flags,
810 uint16_t *setup, uint8_t num_setup, uint8_t max_setup,
811 uint8_t *param, uint32_t num_param, uint32_t max_param,
812 uint8_t *data, uint32_t num_data, uint32_t max_data);
813 NTSTATUS cli_trans_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
814 uint16_t *recv_flags2,
815 uint16_t **setup, uint8_t min_setup,
817 uint8_t **param, uint32_t min_param,
819 uint8_t **data, uint32_t min_data,
821 NTSTATUS cli_trans(TALLOC_CTX *mem_ctx, struct cli_state *cli,
823 const char *pipe_name, uint16_t fid, uint16_t function,
825 uint16_t *setup, uint8_t num_setup, uint8_t max_setup,
826 uint8_t *param, uint32_t num_param, uint32_t max_param,
827 uint8_t *data, uint32_t num_data, uint32_t max_data,
828 uint16_t *recv_flags2,
829 uint16_t **rsetup, uint8_t min_rsetup, uint8_t *num_rsetup,
830 uint8_t **rparam, uint32_t min_rparam, uint32_t *num_rparam,
831 uint8_t **rdata, uint32_t min_rdata, uint32_t *num_rdata);
833 /* The following definitions come from libsmb/smb_seal.c */
835 NTSTATUS get_enc_ctx_num(const uint8_t *buf, uint16 *p_enc_ctx_num);
836 bool common_encryption_on(struct smb_trans_enc_state *es);
837 NTSTATUS common_ntlm_decrypt_buffer(struct ntlmssp_state *ntlmssp_state, char *buf);
838 NTSTATUS common_ntlm_encrypt_buffer(struct ntlmssp_state *ntlmssp_state,
842 NTSTATUS common_encrypt_buffer(struct smb_trans_enc_state *es, char *buffer, char **buf_out);
843 NTSTATUS common_decrypt_buffer(struct smb_trans_enc_state *es, char *buf);
844 void common_free_encryption_state(struct smb_trans_enc_state **pp_es);
845 void common_free_enc_buffer(struct smb_trans_enc_state *es, char *buf);
846 bool cli_encryption_on(struct cli_state *cli);
847 void cli_free_encryption_context(struct cli_state *cli);
848 void cli_free_enc_buffer(struct cli_state *cli, char *buf);
850 /* The following definitions come from libsmb/clisigning.c */
852 bool cli_simple_set_signing(struct cli_state *cli,
853 const DATA_BLOB user_session_key,
854 const DATA_BLOB response);
855 bool cli_temp_set_signing(struct cli_state *cli);
856 void cli_calculate_sign_mac(struct cli_state *cli, char *buf, uint32_t *seqnum);
857 bool cli_check_sign_mac(struct cli_state *cli, const char *buf, uint32_t seqnum);
858 bool client_is_signing_on(struct cli_state *cli);
859 bool client_is_signing_allowed(struct cli_state *cli);
860 bool client_is_signing_mandatory(struct cli_state *cli);
861 void cli_set_signing_negotiated(struct cli_state *cli);
863 /* The following definitions come from libsmb/reparse_symlink.c */
865 bool symlink_reparse_buffer_marshall(
866 const char *substitute, const char *printname, uint32_t flags,
867 TALLOC_CTX *mem_ctx, uint8_t **pdst, size_t *pdstlen);
868 bool symlink_reparse_buffer_parse(
869 const uint8_t *src, size_t srclen, TALLOC_CTX *mem_ctx,
870 char **psubstitute_name, char **pprint_name, uint32_t *pflags);
872 /* The following definitions come from libsmb/clisymlink.c */
874 struct tevent_req *cli_symlink_send(TALLOC_CTX *mem_ctx,
875 struct tevent_context *ev,
876 struct cli_state *cli,
880 NTSTATUS cli_symlink_recv(struct tevent_req *req);
881 NTSTATUS cli_symlink(struct cli_state *cli, const char *oldname,
882 const char *newname, uint32_t flags);
884 struct tevent_req *cli_readlink_send(TALLOC_CTX *mem_ctx,
885 struct tevent_context *ev,
886 struct cli_state *cli,
888 NTSTATUS cli_readlink_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
889 char **psubstitute_name, char **pprint_name,
891 NTSTATUS cli_readlink(struct cli_state *cli, const char *fname,
892 TALLOC_CTX *mem_ctx, char **psubstitute_name,
893 char **pprint_name, uint32_t *pflags);
895 #endif /* _LIBSMB_PROTO_H_ */