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 struct tevent_req *cli_echo_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
185 struct cli_state *cli, uint16_t num_echos,
187 NTSTATUS cli_echo_recv(struct tevent_req *req);
188 NTSTATUS cli_echo(struct cli_state *cli, uint16_t num_echos, DATA_BLOB data);
189 bool cli_ucs2(struct cli_state *cli);
190 bool is_andx_req(uint8_t cmd);
191 NTSTATUS cli_smb(TALLOC_CTX *mem_ctx, struct cli_state *cli,
192 uint8_t smb_command, uint8_t additional_flags,
193 uint8_t wct, uint16_t *vwv,
194 uint32_t num_bytes, const uint8_t *bytes,
195 struct tevent_req **result_parent,
196 uint8_t min_wct, uint8_t *pwct, uint16_t **pvwv,
197 uint32_t *pnum_bytes, uint8_t **pbytes);
199 /* The following definitions come from libsmb/clierror.c */
201 const char *cli_errstr(struct cli_state *cli);
202 NTSTATUS cli_nt_error(struct cli_state *cli);
203 void cli_dos_error(struct cli_state *cli, uint8 *eclass, uint32 *ecode);
204 int cli_errno(struct cli_state *cli);
205 bool cli_is_error(struct cli_state *cli);
206 bool cli_is_nt_error(struct cli_state *cli);
207 bool cli_is_dos_error(struct cli_state *cli);
208 bool cli_state_is_connected(struct cli_state *cli);
209 void cli_state_disconnect(struct cli_state *cli);
211 /* The following definitions come from libsmb/clifile.c */
213 struct tevent_req *cli_setpathinfo_send(TALLOC_CTX *mem_ctx,
214 struct tevent_context *ev,
215 struct cli_state *cli,
220 NTSTATUS cli_setpathinfo_recv(struct tevent_req *req);
221 NTSTATUS cli_setpathinfo(struct cli_state *cli,
227 struct tevent_req *cli_posix_symlink_send(TALLOC_CTX *mem_ctx,
228 struct event_context *ev,
229 struct cli_state *cli,
231 const char *newname);
232 NTSTATUS cli_posix_symlink_recv(struct tevent_req *req);
233 NTSTATUS cli_posix_symlink(struct cli_state *cli,
235 const char *newname);
236 struct tevent_req *cli_posix_readlink_send(TALLOC_CTX *mem_ctx,
237 struct event_context *ev,
238 struct cli_state *cli,
241 NTSTATUS cli_posix_readlink_recv(struct tevent_req *req, struct cli_state *cli,
242 char *retpath, size_t len);
243 NTSTATUS cli_posix_readlink(struct cli_state *cli, const char *fname,
244 char *linkpath, size_t len);
245 struct tevent_req *cli_posix_hardlink_send(TALLOC_CTX *mem_ctx,
246 struct event_context *ev,
247 struct cli_state *cli,
249 const char *newname);
250 NTSTATUS cli_posix_hardlink_recv(struct tevent_req *req);
251 NTSTATUS cli_posix_hardlink(struct cli_state *cli,
253 const char *newname);
254 uint32_t unix_perms_to_wire(mode_t perms);
255 mode_t wire_perms_to_unix(uint32_t perms);
256 struct tevent_req *cli_posix_getfacl_send(TALLOC_CTX *mem_ctx,
257 struct event_context *ev,
258 struct cli_state *cli,
260 NTSTATUS cli_posix_getfacl_recv(struct tevent_req *req,
264 NTSTATUS cli_posix_getfacl(struct cli_state *cli,
269 struct tevent_req *cli_posix_stat_send(TALLOC_CTX *mem_ctx,
270 struct event_context *ev,
271 struct cli_state *cli,
273 NTSTATUS cli_posix_stat_recv(struct tevent_req *req,
274 SMB_STRUCT_STAT *sbuf);
275 NTSTATUS cli_posix_stat(struct cli_state *cli,
277 SMB_STRUCT_STAT *sbuf);
278 struct tevent_req *cli_posix_chmod_send(TALLOC_CTX *mem_ctx,
279 struct event_context *ev,
280 struct cli_state *cli,
283 NTSTATUS cli_posix_chmod_recv(struct tevent_req *req);
284 NTSTATUS cli_posix_chmod(struct cli_state *cli, const char *fname, mode_t mode);
285 struct tevent_req *cli_posix_chown_send(TALLOC_CTX *mem_ctx,
286 struct event_context *ev,
287 struct cli_state *cli,
291 NTSTATUS cli_posix_chown_recv(struct tevent_req *req);
292 NTSTATUS cli_posix_chown(struct cli_state *cli,
296 struct tevent_req *cli_rename_send(TALLOC_CTX *mem_ctx,
297 struct event_context *ev,
298 struct cli_state *cli,
299 const char *fname_src,
300 const char *fname_dst);
301 NTSTATUS cli_rename_recv(struct tevent_req *req);
302 NTSTATUS cli_rename(struct cli_state *cli, const char *fname_src, const char *fname_dst);
303 struct tevent_req *cli_ntrename_send(TALLOC_CTX *mem_ctx,
304 struct event_context *ev,
305 struct cli_state *cli,
306 const char *fname_src,
307 const char *fname_dst);
308 NTSTATUS cli_ntrename_recv(struct tevent_req *req);
309 NTSTATUS cli_ntrename(struct cli_state *cli, const char *fname_src, const char *fname_dst);
311 struct tevent_req *cli_nt_hardlink_send(TALLOC_CTX *mem_ctx,
312 struct event_context *ev,
313 struct cli_state *cli,
314 const char *fname_src,
315 const char *fname_dst);
316 NTSTATUS cli_nt_hardlink_recv(struct tevent_req *req);
317 NTSTATUS cli_nt_hardlink(struct cli_state *cli, const char *fname_src, const char *fname_dst);
319 struct tevent_req *cli_unlink_send(TALLOC_CTX *mem_ctx,
320 struct event_context *ev,
321 struct cli_state *cli,
323 uint16_t mayhave_attrs);
324 NTSTATUS cli_unlink_recv(struct tevent_req *req);
325 NTSTATUS cli_unlink(struct cli_state *cli, const char *fname, uint16_t mayhave_attrs);
327 struct tevent_req *cli_mkdir_send(TALLOC_CTX *mem_ctx,
328 struct event_context *ev,
329 struct cli_state *cli,
331 NTSTATUS cli_mkdir_recv(struct tevent_req *req);
332 NTSTATUS cli_mkdir(struct cli_state *cli, const char *dname);
333 struct tevent_req *cli_rmdir_send(TALLOC_CTX *mem_ctx,
334 struct event_context *ev,
335 struct cli_state *cli,
337 NTSTATUS cli_rmdir_recv(struct tevent_req *req);
338 NTSTATUS cli_rmdir(struct cli_state *cli, const char *dname);
339 struct tevent_req *cli_nt_delete_on_close_send(TALLOC_CTX *mem_ctx,
340 struct event_context *ev,
341 struct cli_state *cli,
344 NTSTATUS cli_nt_delete_on_close_recv(struct tevent_req *req);
345 NTSTATUS cli_nt_delete_on_close(struct cli_state *cli, uint16_t fnum, bool flag);
346 struct tevent_req *cli_ntcreate_send(TALLOC_CTX *mem_ctx,
347 struct event_context *ev,
348 struct cli_state *cli,
351 uint32_t DesiredAccess,
352 uint32_t FileAttributes,
353 uint32_t ShareAccess,
354 uint32_t CreateDisposition,
355 uint32_t CreateOptions,
356 uint8_t SecurityFlags);
357 NTSTATUS cli_ntcreate_recv(struct tevent_req *req, uint16_t *pfnum);
358 NTSTATUS cli_ntcreate(struct cli_state *cli,
361 uint32_t DesiredAccess,
362 uint32_t FileAttributes,
363 uint32_t ShareAccess,
364 uint32_t CreateDisposition,
365 uint32_t CreateOptions,
366 uint8_t SecurityFlags,
368 uint8_t *smb_bytes_push_str(uint8_t *buf, bool ucs2, const char *str,
369 size_t str_len, size_t *pconverted_size);
370 uint8_t *smb_bytes_push_bytes(uint8_t *buf, uint8_t prefix,
371 const uint8_t *bytes, size_t num_bytes);
372 uint8_t *trans2_bytes_push_str(uint8_t *buf, bool ucs2,
373 const char *str, size_t str_len,
374 size_t *pconverted_size);
375 uint8_t *trans2_bytes_push_bytes(uint8_t *buf,
376 const uint8_t *bytes, size_t num_bytes);
377 struct tevent_req *cli_open_create(TALLOC_CTX *mem_ctx,
378 struct event_context *ev,
379 struct cli_state *cli, const char *fname,
380 int flags, int share_mode,
381 struct tevent_req **psmbreq);
382 struct tevent_req *cli_open_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
383 struct cli_state *cli, const char *fname,
384 int flags, int share_mode);
385 NTSTATUS cli_open_recv(struct tevent_req *req, uint16_t *fnum);
386 NTSTATUS cli_open(struct cli_state *cli, const char *fname, int flags, int share_mode, uint16_t *pfnum);
387 struct tevent_req *cli_close_create(TALLOC_CTX *mem_ctx,
388 struct event_context *ev,
389 struct cli_state *cli, uint16_t fnum,
390 struct tevent_req **psubreq);
391 struct tevent_req *cli_close_send(TALLOC_CTX *mem_ctx,
392 struct event_context *ev,
393 struct cli_state *cli, uint16_t fnum);
394 NTSTATUS cli_close_recv(struct tevent_req *req);
395 NTSTATUS cli_close(struct cli_state *cli, uint16_t fnum);
396 struct tevent_req *cli_ftruncate_send(TALLOC_CTX *mem_ctx,
397 struct event_context *ev,
398 struct cli_state *cli,
401 NTSTATUS cli_ftruncate_recv(struct tevent_req *req);
402 NTSTATUS cli_ftruncate(struct cli_state *cli, uint16_t fnum, uint64_t size);
403 NTSTATUS cli_locktype(struct cli_state *cli, uint16_t fnum,
404 uint32_t offset, uint32_t len,
405 int timeout, unsigned char locktype);
406 NTSTATUS cli_lock32(struct cli_state *cli, uint16_t fnum, uint32_t offset,
407 uint32_t len, int timeout, enum brl_type lock_type);
408 struct tevent_req *cli_unlock_send(TALLOC_CTX *mem_ctx,
409 struct event_context *ev,
410 struct cli_state *cli,
414 NTSTATUS cli_unlock_recv(struct tevent_req *req);
415 NTSTATUS cli_unlock(struct cli_state *cli, uint16_t fnum, uint32_t offset, uint32_t len);
416 NTSTATUS cli_lock64(struct cli_state *cli, uint16_t fnum,
417 uint64_t offset, uint64_t len, int timeout,
418 enum brl_type lock_type);
419 struct tevent_req *cli_unlock64_send(TALLOC_CTX *mem_ctx,
420 struct event_context *ev,
421 struct cli_state *cli,
425 NTSTATUS cli_unlock64_recv(struct tevent_req *req);
426 NTSTATUS cli_unlock64(struct cli_state *cli, uint16_t fnum, uint64_t offset, uint64_t len);
427 struct tevent_req *cli_posix_lock_send(TALLOC_CTX *mem_ctx,
428 struct event_context *ev,
429 struct cli_state *cli,
434 enum brl_type lock_type);
435 NTSTATUS cli_posix_lock_recv(struct tevent_req *req);
436 NTSTATUS cli_posix_lock(struct cli_state *cli, uint16_t fnum,
437 uint64_t offset, uint64_t len,
438 bool wait_lock, enum brl_type lock_type);
439 struct tevent_req *cli_posix_unlock_send(TALLOC_CTX *mem_ctx,
440 struct event_context *ev,
441 struct cli_state *cli,
445 NTSTATUS cli_posix_unlock_recv(struct tevent_req *req);
446 NTSTATUS cli_posix_unlock(struct cli_state *cli, uint16_t fnum, uint64_t offset, uint64_t len);
447 struct tevent_req *cli_getattrE_send(TALLOC_CTX *mem_ctx,
448 struct event_context *ev,
449 struct cli_state *cli,
451 NTSTATUS cli_getattrE_recv(struct tevent_req *req,
457 NTSTATUS cli_getattrE(struct cli_state *cli,
464 struct tevent_req *cli_setattrE_send(TALLOC_CTX *mem_ctx,
465 struct event_context *ev,
466 struct cli_state *cli,
471 NTSTATUS cli_setattrE_recv(struct tevent_req *req);
472 NTSTATUS cli_setattrE(struct cli_state *cli,
477 struct tevent_req *cli_getatr_send(TALLOC_CTX *mem_ctx,
478 struct event_context *ev,
479 struct cli_state *cli,
481 NTSTATUS cli_getatr_recv(struct tevent_req *req,
485 NTSTATUS cli_getatr(struct cli_state *cli,
490 struct tevent_req *cli_setatr_send(TALLOC_CTX *mem_ctx,
491 struct event_context *ev,
492 struct cli_state *cli,
496 NTSTATUS cli_setatr_recv(struct tevent_req *req);
497 NTSTATUS cli_setatr(struct cli_state *cli,
501 struct tevent_req *cli_chkpath_send(TALLOC_CTX *mem_ctx,
502 struct event_context *ev,
503 struct cli_state *cli,
505 NTSTATUS cli_chkpath_recv(struct tevent_req *req);
506 NTSTATUS cli_chkpath(struct cli_state *cli, const char *path);
507 struct tevent_req *cli_dskattr_send(TALLOC_CTX *mem_ctx,
508 struct event_context *ev,
509 struct cli_state *cli);
510 NTSTATUS cli_dskattr_recv(struct tevent_req *req, int *bsize, int *total,
512 NTSTATUS cli_dskattr(struct cli_state *cli, int *bsize, int *total, int *avail);
513 struct tevent_req *cli_ctemp_send(TALLOC_CTX *mem_ctx,
514 struct event_context *ev,
515 struct cli_state *cli,
517 NTSTATUS cli_ctemp_recv(struct tevent_req *req,
521 NTSTATUS cli_ctemp(struct cli_state *cli,
526 NTSTATUS cli_raw_ioctl(struct cli_state *cli, uint16_t fnum, uint32_t code, DATA_BLOB *blob);
527 NTSTATUS cli_set_ea_path(struct cli_state *cli, const char *path,
528 const char *ea_name, const char *ea_val,
530 NTSTATUS cli_set_ea_fnum(struct cli_state *cli, uint16_t fnum,
531 const char *ea_name, const char *ea_val,
533 struct tevent_req *cli_get_ea_list_path_send(TALLOC_CTX *mem_ctx,
534 struct tevent_context *ev,
535 struct cli_state *cli,
537 NTSTATUS cli_get_ea_list_path_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
538 size_t *pnum_eas, struct ea_struct **peas);
539 NTSTATUS cli_get_ea_list_path(struct cli_state *cli, const char *path,
542 struct ea_struct **pea_list);
543 struct tevent_req *cli_posix_open_send(TALLOC_CTX *mem_ctx,
544 struct event_context *ev,
545 struct cli_state *cli,
549 NTSTATUS cli_posix_open_recv(struct tevent_req *req, uint16_t *pfnum);
550 NTSTATUS cli_posix_open(struct cli_state *cli, const char *fname,
551 int flags, mode_t mode, uint16_t *fnum);
552 struct tevent_req *cli_posix_mkdir_send(TALLOC_CTX *mem_ctx,
553 struct event_context *ev,
554 struct cli_state *cli,
557 NTSTATUS cli_posix_mkdir_recv(struct tevent_req *req);
558 NTSTATUS cli_posix_mkdir(struct cli_state *cli, const char *fname, mode_t mode);
560 struct tevent_req *cli_posix_unlink_send(TALLOC_CTX *mem_ctx,
561 struct event_context *ev,
562 struct cli_state *cli,
564 NTSTATUS cli_posix_unlink_recv(struct tevent_req *req);
565 NTSTATUS cli_posix_unlink(struct cli_state *cli, const char *fname);
567 struct tevent_req *cli_posix_rmdir_send(TALLOC_CTX *mem_ctx,
568 struct event_context *ev,
569 struct cli_state *cli,
571 NTSTATUS cli_posix_rmdir_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx);
572 NTSTATUS cli_posix_rmdir(struct cli_state *cli, const char *fname);
573 struct tevent_req *cli_notify_send(TALLOC_CTX *mem_ctx,
574 struct tevent_context *ev,
575 struct cli_state *cli, uint16_t fnum,
576 uint32_t buffer_size,
577 uint32_t completion_filter, bool recursive);
578 NTSTATUS cli_notify_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
579 uint32_t *pnum_changes,
580 struct notify_change **pchanges);
582 struct tevent_req *cli_nttrans_create_send(TALLOC_CTX *mem_ctx,
583 struct event_context *ev,
584 struct cli_state *cli,
587 uint32_t DesiredAccess,
588 uint32_t FileAttributes,
589 uint32_t ShareAccess,
590 uint32_t CreateDisposition,
591 uint32_t CreateOptions,
592 uint8_t SecurityFlags,
593 struct security_descriptor *secdesc,
594 struct ea_struct *eas,
596 NTSTATUS cli_nttrans_create_recv(struct tevent_req *req, uint16_t *fnum);
597 NTSTATUS cli_nttrans_create(struct cli_state *cli,
600 uint32_t DesiredAccess,
601 uint32_t FileAttributes,
602 uint32_t ShareAccess,
603 uint32_t CreateDisposition,
604 uint32_t CreateOptions,
605 uint8_t SecurityFlags,
606 struct security_descriptor *secdesc,
607 struct ea_struct *eas,
611 /* The following definitions come from libsmb/clifsinfo.c */
613 struct tevent_req *cli_unix_extensions_version_send(TALLOC_CTX *mem_ctx,
614 struct tevent_context *ev,
615 struct cli_state *cli);
616 NTSTATUS cli_unix_extensions_version_recv(struct tevent_req *req,
617 uint16_t *pmajor, uint16_t *pminor,
620 NTSTATUS cli_unix_extensions_version(struct cli_state *cli, uint16 *pmajor,
621 uint16 *pminor, uint32 *pcaplow,
623 struct tevent_req *cli_set_unix_extensions_capabilities_send(
624 TALLOC_CTX *mem_ctx, struct tevent_context *ev, struct cli_state *cli,
625 uint16_t major, uint16_t minor, uint32_t caplow, uint32_t caphigh);
626 NTSTATUS cli_set_unix_extensions_capabilities_recv(struct tevent_req *req);
627 NTSTATUS cli_set_unix_extensions_capabilities(struct cli_state *cli,
628 uint16 major, uint16 minor,
629 uint32 caplow, uint32 caphigh);
630 struct tevent_req *cli_get_fs_attr_info_send(TALLOC_CTX *mem_ctx,
631 struct tevent_context *ev,
632 struct cli_state *cli);
633 NTSTATUS cli_get_fs_attr_info_recv(struct tevent_req *req, uint32_t *fs_attr);
634 NTSTATUS cli_get_fs_attr_info(struct cli_state *cli, uint32_t *fs_attr);
635 NTSTATUS cli_get_fs_volume_info(struct cli_state *cli,
636 TALLOC_CTX *mem_ctx, char **volume_name,
637 uint32 *pserial_number, time_t *pdate);
638 NTSTATUS cli_get_fs_full_size_info(struct cli_state *cli,
639 uint64_t *total_allocation_units,
640 uint64_t *caller_allocation_units,
641 uint64_t *actual_allocation_units,
642 uint64_t *sectors_per_allocation_unit,
643 uint64_t *bytes_per_sector);
644 NTSTATUS cli_get_posix_fs_info(struct cli_state *cli,
645 uint32 *optimal_transfer_size,
647 uint64_t *total_blocks,
648 uint64_t *blocks_available,
649 uint64_t *user_blocks_available,
650 uint64_t *total_file_nodes,
651 uint64_t *free_file_nodes,
652 uint64_t *fs_identifier);
653 NTSTATUS cli_raw_ntlm_smb_encryption_start(struct cli_state *cli,
657 NTSTATUS cli_gss_smb_encryption_start(struct cli_state *cli);
658 NTSTATUS cli_force_encryption(struct cli_state *c,
659 const char *username,
660 const char *password,
663 /* The following definitions come from libsmb/clilist.c */
665 NTSTATUS cli_list_old(struct cli_state *cli,const char *Mask,uint16 attribute,
666 NTSTATUS (*fn)(const char *, struct file_info *,
667 const char *, void *), void *state);
668 NTSTATUS cli_list_trans(struct cli_state *cli, const char *mask,
669 uint16_t attribute, int info_level,
670 NTSTATUS (*fn)(const char *mnt, struct file_info *finfo,
671 const char *mask, void *private_data),
673 struct tevent_req *cli_list_send(TALLOC_CTX *mem_ctx,
674 struct tevent_context *ev,
675 struct cli_state *cli,
678 uint16_t info_level);
679 NTSTATUS cli_list_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
680 struct file_info **finfo, size_t *num_finfo);
681 NTSTATUS cli_list(struct cli_state *cli,const char *Mask,uint16 attribute,
682 NTSTATUS (*fn)(const char *, struct file_info *, const char *,
683 void *), void *state);
685 /* The following definitions come from libsmb/climessage.c */
687 struct tevent_req *cli_message_send(TALLOC_CTX *mem_ctx,
688 struct tevent_context *ev,
689 struct cli_state *cli,
690 const char *host, const char *username,
691 const char *message);
692 NTSTATUS cli_message_recv(struct tevent_req *req);
693 NTSTATUS cli_message(struct cli_state *cli, const char *host,
694 const char *username, const char *message);
696 /* The following definitions come from libsmb/clioplock.c */
698 struct tevent_req *cli_smb_oplock_break_waiter_send(TALLOC_CTX *mem_ctx,
699 struct event_context *ev,
700 struct cli_state *cli);
701 NTSTATUS cli_smb_oplock_break_waiter_recv(struct tevent_req *req,
705 struct tevent_req *cli_oplock_ack_send(TALLOC_CTX *mem_ctx,
706 struct tevent_context *ev,
707 struct cli_state *cli,
708 uint16_t fnum, uint8_t level);
709 NTSTATUS cli_oplock_ack_recv(struct tevent_req *req);
711 /* The following definitions come from libsmb/cliprint.c */
713 int cli_print_queue(struct cli_state *cli,
714 void (*fn)(struct print_job_info *));
715 int cli_printjob_del(struct cli_state *cli, int job);
717 /* The following definitions come from libsmb/cliquota.c */
719 NTSTATUS cli_get_quota_handle(struct cli_state *cli, uint16_t *quota_fnum);
720 void free_ntquota_list(SMB_NTQUOTA_LIST **qt_list);
721 NTSTATUS cli_get_user_quota(struct cli_state *cli, int quota_fnum,
722 SMB_NTQUOTA_STRUCT *pqt);
723 NTSTATUS cli_set_user_quota(struct cli_state *cli, int quota_fnum,
724 SMB_NTQUOTA_STRUCT *pqt);
725 NTSTATUS cli_list_user_quota(struct cli_state *cli, int quota_fnum,
726 SMB_NTQUOTA_LIST **pqt_list);
727 NTSTATUS cli_get_fs_quota_info(struct cli_state *cli, int quota_fnum,
728 SMB_NTQUOTA_STRUCT *pqt);
729 NTSTATUS cli_set_fs_quota_info(struct cli_state *cli, int quota_fnum,
730 SMB_NTQUOTA_STRUCT *pqt);
732 /* The following definitions come from libsmb/clireadwrite.c */
734 struct tevent_req *cli_read_andx_create(TALLOC_CTX *mem_ctx,
735 struct event_context *ev,
736 struct cli_state *cli, uint16_t fnum,
737 off_t offset, size_t size,
738 struct tevent_req **psmbreq);
739 struct tevent_req *cli_read_andx_send(TALLOC_CTX *mem_ctx,
740 struct event_context *ev,
741 struct cli_state *cli, uint16_t fnum,
742 off_t offset, size_t size);
743 NTSTATUS cli_read_andx_recv(struct tevent_req *req, ssize_t *received,
745 struct tevent_req *cli_pull_send(TALLOC_CTX *mem_ctx,
746 struct event_context *ev,
747 struct cli_state *cli,
748 uint16_t fnum, off_t start_offset,
749 SMB_OFF_T size, size_t window_size,
750 NTSTATUS (*sink)(char *buf, size_t n,
753 NTSTATUS cli_pull_recv(struct tevent_req *req, SMB_OFF_T *received);
754 NTSTATUS cli_pull(struct cli_state *cli, uint16_t fnum,
755 off_t start_offset, SMB_OFF_T size, size_t window_size,
756 NTSTATUS (*sink)(char *buf, size_t n, void *priv),
757 void *priv, SMB_OFF_T *received);
758 NTSTATUS cli_read(struct cli_state *cli, uint16_t fnum,
759 char *buf, off_t offset, size_t size,
761 NTSTATUS cli_smbwrite(struct cli_state *cli, uint16_t fnum, char *buf,
762 off_t offset, size_t size1, size_t *ptotal);
763 struct tevent_req *cli_write_andx_create(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 struct tevent_req **reqs_before,
770 struct tevent_req **psmbreq);
771 struct tevent_req *cli_write_andx_send(TALLOC_CTX *mem_ctx,
772 struct event_context *ev,
773 struct cli_state *cli, uint16_t fnum,
774 uint16_t mode, const uint8_t *buf,
775 off_t offset, size_t size);
776 NTSTATUS cli_write_andx_recv(struct tevent_req *req, size_t *pwritten);
778 NTSTATUS cli_writeall(struct cli_state *cli, uint16_t fnum, uint16_t mode,
779 const uint8_t *buf, off_t offset, size_t size,
782 struct tevent_req *cli_push_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
783 struct cli_state *cli,
784 uint16_t fnum, uint16_t mode,
785 off_t start_offset, size_t window_size,
786 size_t (*source)(uint8_t *buf, size_t n,
789 NTSTATUS cli_push_recv(struct tevent_req *req);
790 NTSTATUS cli_push(struct cli_state *cli, uint16_t fnum, uint16_t mode,
791 off_t start_offset, size_t window_size,
792 size_t (*source)(uint8_t *buf, size_t n, void *priv),
795 /* The following definitions come from libsmb/clisecdesc.c */
797 NTSTATUS cli_query_secdesc(struct cli_state *cli, uint16_t fnum,
798 TALLOC_CTX *mem_ctx, struct security_descriptor **sd);
799 NTSTATUS cli_set_secdesc(struct cli_state *cli, uint16_t fnum,
800 const struct security_descriptor *sd);
802 /* The following definitions come from libsmb/clistr.c */
804 size_t clistr_pull_talloc(TALLOC_CTX *ctx,
812 /* The following definitions come from libsmb/clitrans.c */
814 struct tevent_req *cli_trans_send(
815 TALLOC_CTX *mem_ctx, struct event_context *ev,
816 struct cli_state *cli, uint8_t cmd,
817 const char *pipe_name, uint16_t fid, uint16_t function, int flags,
818 uint16_t *setup, uint8_t num_setup, uint8_t max_setup,
819 uint8_t *param, uint32_t num_param, uint32_t max_param,
820 uint8_t *data, uint32_t num_data, uint32_t max_data);
821 NTSTATUS cli_trans_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
822 uint16_t *recv_flags2,
823 uint16_t **setup, uint8_t min_setup,
825 uint8_t **param, uint32_t min_param,
827 uint8_t **data, uint32_t min_data,
829 NTSTATUS cli_trans(TALLOC_CTX *mem_ctx, struct cli_state *cli,
831 const char *pipe_name, uint16_t fid, uint16_t function,
833 uint16_t *setup, uint8_t num_setup, uint8_t max_setup,
834 uint8_t *param, uint32_t num_param, uint32_t max_param,
835 uint8_t *data, uint32_t num_data, uint32_t max_data,
836 uint16_t *recv_flags2,
837 uint16_t **rsetup, uint8_t min_rsetup, uint8_t *num_rsetup,
838 uint8_t **rparam, uint32_t min_rparam, uint32_t *num_rparam,
839 uint8_t **rdata, uint32_t min_rdata, uint32_t *num_rdata);
841 /* The following definitions come from libsmb/smb_seal.c */
843 NTSTATUS get_enc_ctx_num(const uint8_t *buf, uint16 *p_enc_ctx_num);
844 bool common_encryption_on(struct smb_trans_enc_state *es);
845 NTSTATUS common_ntlm_decrypt_buffer(struct auth_ntlmssp_state *auth_ntlmssp_state, char *buf);
846 NTSTATUS common_ntlm_encrypt_buffer(struct auth_ntlmssp_state *auth_ntlmssp_state,
850 NTSTATUS common_encrypt_buffer(struct smb_trans_enc_state *es, char *buffer, char **buf_out);
851 NTSTATUS common_decrypt_buffer(struct smb_trans_enc_state *es, char *buf);
852 void common_free_encryption_state(struct smb_trans_enc_state **pp_es);
853 void common_free_enc_buffer(struct smb_trans_enc_state *es, char *buf);
854 bool cli_encryption_on(struct cli_state *cli);
855 void cli_free_encryption_context(struct cli_state *cli);
856 void cli_free_enc_buffer(struct cli_state *cli, char *buf);
858 /* The following definitions come from libsmb/clisigning.c */
860 bool cli_simple_set_signing(struct cli_state *cli,
861 const DATA_BLOB user_session_key,
862 const DATA_BLOB response);
863 bool cli_temp_set_signing(struct cli_state *cli);
864 void cli_calculate_sign_mac(struct cli_state *cli, char *buf, uint32_t *seqnum);
865 bool cli_check_sign_mac(struct cli_state *cli, const char *buf, uint32_t seqnum);
866 bool client_is_signing_on(struct cli_state *cli);
867 bool client_is_signing_allowed(struct cli_state *cli);
868 bool client_is_signing_mandatory(struct cli_state *cli);
869 void cli_set_signing_negotiated(struct cli_state *cli);
871 /* The following definitions come from libsmb/reparse_symlink.c */
873 bool symlink_reparse_buffer_marshall(
874 const char *substitute, const char *printname, uint32_t flags,
875 TALLOC_CTX *mem_ctx, uint8_t **pdst, size_t *pdstlen);
876 bool symlink_reparse_buffer_parse(
877 const uint8_t *src, size_t srclen, TALLOC_CTX *mem_ctx,
878 char **psubstitute_name, char **pprint_name, uint32_t *pflags);
880 /* The following definitions come from libsmb/clisymlink.c */
882 struct tevent_req *cli_symlink_send(TALLOC_CTX *mem_ctx,
883 struct tevent_context *ev,
884 struct cli_state *cli,
888 NTSTATUS cli_symlink_recv(struct tevent_req *req);
889 NTSTATUS cli_symlink(struct cli_state *cli, const char *oldname,
890 const char *newname, uint32_t flags);
892 struct tevent_req *cli_readlink_send(TALLOC_CTX *mem_ctx,
893 struct tevent_context *ev,
894 struct cli_state *cli,
896 NTSTATUS cli_readlink_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
897 char **psubstitute_name, char **pprint_name,
899 NTSTATUS cli_readlink(struct cli_state *cli, const char *fname,
900 TALLOC_CTX *mem_ctx, char **psubstitute_name,
901 char **pprint_name, uint32_t *pflags);
903 #endif /* _LIBSMB_PROTO_H_ */