2 Unix SMB/CIFS implementation.
4 Copyright (C) Andrew Bartlett 2001-2003
5 Copyright (C) Andrew Tridgell 1994-1998,2000-2001
6 Copyright (C) Gerald (Jerry) Carter 2004
7 Copyright (C) Jelmer Vernooij 2003
8 Copyright (C) Jeremy Allison 2001-2009,2011
9 Copyright (C) Stefan Metzmacher 2003,2009
10 Copyright (C) Volker Lendecke 2011
12 This program is free software; you can redistribute it and/or modify
13 it under the terms of the GNU General Public License as published by
14 the Free Software Foundation; either version 3 of the License, or
15 (at your option) any later version.
17 This program is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License for more details.
22 You should have received a copy of the GNU General Public License
23 along with this program. If not, see <http://www.gnu.org/licenses/>.
26 #ifndef _LIBSMB_PROTO_H_
27 #define _LIBSMB_PROTO_H_
30 #include "auth_info.h"
32 struct smb_trans_enc_state;
34 /* The following definitions come from libsmb/cliconnect.c */
36 NTSTATUS cli_session_setup(struct cli_state *cli,
38 const char *pass, int passlen,
39 const char *ntpass, int ntpasslen,
40 const char *workgroup);
41 struct tevent_req *cli_session_setup_guest_create(TALLOC_CTX *mem_ctx,
42 struct event_context *ev,
43 struct cli_state *cli,
44 struct tevent_req **psmbreq);
45 struct tevent_req *cli_session_setup_guest_send(TALLOC_CTX *mem_ctx,
46 struct event_context *ev,
47 struct cli_state *cli);
48 NTSTATUS cli_session_setup_guest_recv(struct tevent_req *req);
49 struct tevent_req *cli_ulogoff_send(TALLOC_CTX *mem_ctx,
50 struct tevent_context *ev,
51 struct cli_state *cli);
52 NTSTATUS cli_ulogoff_recv(struct tevent_req *req);
53 NTSTATUS cli_ulogoff(struct cli_state *cli);
54 struct tevent_req *cli_tcon_andx_create(TALLOC_CTX *mem_ctx,
55 struct event_context *ev,
56 struct cli_state *cli,
57 const char *share, const char *dev,
58 const char *pass, int passlen,
59 struct tevent_req **psmbreq);
60 struct tevent_req *cli_tcon_andx_send(TALLOC_CTX *mem_ctx,
61 struct event_context *ev,
62 struct cli_state *cli,
63 const char *share, const char *dev,
64 const char *pass, int passlen);
65 NTSTATUS cli_tcon_andx_recv(struct tevent_req *req);
66 NTSTATUS cli_tcon_andx(struct cli_state *cli, const char *share,
67 const char *dev, const char *pass, int passlen);
68 NTSTATUS cli_tree_connect(struct cli_state *cli, const char *share,
69 const char *dev, const char *pass, int passlen);
70 struct tevent_req *cli_tdis_send(TALLOC_CTX *mem_ctx,
71 struct tevent_context *ev,
72 struct cli_state *cli);
73 NTSTATUS cli_tdis_recv(struct tevent_req *req);
74 NTSTATUS cli_tdis(struct cli_state *cli);
75 NTSTATUS cli_negprot(struct cli_state *cli, enum protocol_types max_protocol);
76 struct tevent_req *cli_negprot_send(TALLOC_CTX *mem_ctx,
77 struct event_context *ev,
78 struct cli_state *cli,
79 enum protocol_types max_protocol);
80 NTSTATUS cli_negprot_recv(struct tevent_req *req);
81 NTSTATUS cli_connect_nb(const char *host, const struct sockaddr_storage *dest_ss,
82 uint16_t port, int name_type, const char *myname,
83 int signing_state, int flags, struct cli_state **pcli);
84 NTSTATUS cli_start_connection(struct cli_state **output_cli,
86 const char *dest_host,
87 const struct sockaddr_storage *dest_ss, int port,
88 int signing_state, int flags);
89 NTSTATUS cli_full_connection(struct cli_state **output_cli,
91 const char *dest_host,
92 const struct sockaddr_storage *dest_ss, int port,
93 const char *service, const char *service_type,
94 const char *user, const char *domain,
95 const char *password, int flags,
97 NTSTATUS cli_raw_tcon(struct cli_state *cli,
98 const char *service, const char *pass, const char *dev,
99 uint16 *max_xmit, uint16 *tid);
100 struct cli_state *get_ipc_connect(char *server,
101 struct sockaddr_storage *server_ss,
102 const struct user_auth_info *user_info);
103 struct cli_state *get_ipc_connect_master_ip(TALLOC_CTX *ctx,
104 struct sockaddr_storage *mb_ip,
105 const struct user_auth_info *user_info,
106 char **pp_workgroup_out);
107 struct cli_state *get_ipc_connect_master_ip_bcast(TALLOC_CTX *ctx,
108 const struct user_auth_info *user_info,
109 char **pp_workgroup_out);
111 /* The following definitions come from libsmb/clidfs.c */
113 NTSTATUS cli_cm_force_encryption(struct cli_state *c,
114 const char *username,
115 const char *password,
117 const char *sharename);
118 NTSTATUS cli_cm_open(TALLOC_CTX *ctx,
119 struct cli_state *referring_cli,
122 const struct user_auth_info *auth_info,
128 struct cli_state **pcli);
129 void cli_cm_display(struct cli_state *c);
130 struct client_dfs_referral;
131 NTSTATUS cli_dfs_get_referral(TALLOC_CTX *ctx,
132 struct cli_state *cli,
134 struct client_dfs_referral **refs,
137 NTSTATUS cli_resolve_path(TALLOC_CTX *ctx,
139 const struct user_auth_info *dfs_auth_info,
140 struct cli_state *rootcli,
142 struct cli_state **targetcli,
143 char **pp_targetpath);
145 bool cli_check_msdfs_proxy(TALLOC_CTX *ctx,
146 struct cli_state *cli,
147 const char *sharename,
151 const char *username,
152 const char *password,
155 /* The following definitions come from libsmb/clientgen.c */
157 int cli_set_message(char *buf,int num_words,int num_bytes,bool zero);
158 unsigned int cli_set_timeout(struct cli_state *cli, unsigned int timeout);
159 bool cli_set_backup_intent(struct cli_state *cli, bool flag);
160 void cli_setup_packet_buf(struct cli_state *cli, char *buf);
161 NTSTATUS cli_set_domain(struct cli_state *cli, const char *domain);
162 NTSTATUS cli_set_username(struct cli_state *cli, const char *username);
163 NTSTATUS cli_set_password(struct cli_state *cli, const char *password);
164 NTSTATUS cli_init_creds(struct cli_state *cli, const char *username, const char *domain, const char *password);
165 struct cli_state *cli_state_create(TALLOC_CTX *mem_ctx,
167 const char *remote_name,
168 const char *remote_realm,
171 bool cli_state_encryption_on(struct cli_state *cli);
172 void cli_nt_pipes_close(struct cli_state *cli);
173 void cli_shutdown(struct cli_state *cli);
174 const char *cli_state_remote_realm(struct cli_state *cli);
175 uint16_t cli_state_get_vc_num(struct cli_state *cli);
176 uint16 cli_setpid(struct cli_state *cli, uint16 pid);
177 uint16_t cli_getpid(struct cli_state *cli);
178 bool cli_state_has_tcon(struct cli_state *cli);
179 uint16_t cli_state_get_tid(struct cli_state *cli);
180 uint16_t cli_state_set_tid(struct cli_state *cli, uint16_t tid);
181 uint16_t cli_state_get_uid(struct cli_state *cli);
182 uint16_t cli_state_set_uid(struct cli_state *cli, uint16_t uid);
183 bool cli_set_case_sensitive(struct cli_state *cli, bool case_sensitive);
184 uint32_t cli_state_available_size(struct cli_state *cli, uint32_t ofs);
185 const uint8_t *cli_state_server_challenge(struct cli_state *cli);
186 const DATA_BLOB *cli_state_server_gss_blob(struct cli_state *cli);
187 uint16_t cli_state_security_mode(struct cli_state *cli);
188 int cli_state_server_time_zone(struct cli_state *cli);
189 time_t cli_state_server_time(struct cli_state *cli);
190 struct tevent_req *cli_echo_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
191 struct cli_state *cli, uint16_t num_echos,
193 NTSTATUS cli_echo_recv(struct tevent_req *req);
194 NTSTATUS cli_echo(struct cli_state *cli, uint16_t num_echos, DATA_BLOB data);
195 bool cli_ucs2(struct cli_state *cli);
196 bool is_andx_req(uint8_t cmd);
197 NTSTATUS cli_smb(TALLOC_CTX *mem_ctx, struct cli_state *cli,
198 uint8_t smb_command, uint8_t additional_flags,
199 uint8_t wct, uint16_t *vwv,
200 uint32_t num_bytes, const uint8_t *bytes,
201 struct tevent_req **result_parent,
202 uint8_t min_wct, uint8_t *pwct, uint16_t **pvwv,
203 uint32_t *pnum_bytes, uint8_t **pbytes);
205 /* The following definitions come from libsmb/clierror.c */
207 const char *cli_errstr(struct cli_state *cli);
208 NTSTATUS cli_nt_error(struct cli_state *cli);
209 void cli_dos_error(struct cli_state *cli, uint8 *eclass, uint32 *ecode);
210 int cli_errno(struct cli_state *cli);
211 bool cli_is_error(struct cli_state *cli);
212 bool cli_is_nt_error(struct cli_state *cli);
213 bool cli_is_dos_error(struct cli_state *cli);
214 bool cli_state_is_connected(struct cli_state *cli);
215 void cli_state_disconnect(struct cli_state *cli);
217 /* The following definitions come from libsmb/clifile.c */
219 struct tevent_req *cli_setpathinfo_send(TALLOC_CTX *mem_ctx,
220 struct tevent_context *ev,
221 struct cli_state *cli,
226 NTSTATUS cli_setpathinfo_recv(struct tevent_req *req);
227 NTSTATUS cli_setpathinfo(struct cli_state *cli,
233 struct tevent_req *cli_posix_symlink_send(TALLOC_CTX *mem_ctx,
234 struct event_context *ev,
235 struct cli_state *cli,
237 const char *newname);
238 NTSTATUS cli_posix_symlink_recv(struct tevent_req *req);
239 NTSTATUS cli_posix_symlink(struct cli_state *cli,
241 const char *newname);
242 struct tevent_req *cli_posix_readlink_send(TALLOC_CTX *mem_ctx,
243 struct event_context *ev,
244 struct cli_state *cli,
247 NTSTATUS cli_posix_readlink_recv(struct tevent_req *req, struct cli_state *cli,
248 char *retpath, size_t len);
249 NTSTATUS cli_posix_readlink(struct cli_state *cli, const char *fname,
250 char *linkpath, size_t len);
251 struct tevent_req *cli_posix_hardlink_send(TALLOC_CTX *mem_ctx,
252 struct event_context *ev,
253 struct cli_state *cli,
255 const char *newname);
256 NTSTATUS cli_posix_hardlink_recv(struct tevent_req *req);
257 NTSTATUS cli_posix_hardlink(struct cli_state *cli,
259 const char *newname);
260 uint32_t unix_perms_to_wire(mode_t perms);
261 mode_t wire_perms_to_unix(uint32_t perms);
262 struct tevent_req *cli_posix_getfacl_send(TALLOC_CTX *mem_ctx,
263 struct event_context *ev,
264 struct cli_state *cli,
266 NTSTATUS cli_posix_getfacl_recv(struct tevent_req *req,
270 NTSTATUS cli_posix_getfacl(struct cli_state *cli,
275 struct tevent_req *cli_posix_stat_send(TALLOC_CTX *mem_ctx,
276 struct event_context *ev,
277 struct cli_state *cli,
279 NTSTATUS cli_posix_stat_recv(struct tevent_req *req,
280 SMB_STRUCT_STAT *sbuf);
281 NTSTATUS cli_posix_stat(struct cli_state *cli,
283 SMB_STRUCT_STAT *sbuf);
284 struct tevent_req *cli_posix_chmod_send(TALLOC_CTX *mem_ctx,
285 struct event_context *ev,
286 struct cli_state *cli,
289 NTSTATUS cli_posix_chmod_recv(struct tevent_req *req);
290 NTSTATUS cli_posix_chmod(struct cli_state *cli, const char *fname, mode_t mode);
291 struct tevent_req *cli_posix_chown_send(TALLOC_CTX *mem_ctx,
292 struct event_context *ev,
293 struct cli_state *cli,
297 NTSTATUS cli_posix_chown_recv(struct tevent_req *req);
298 NTSTATUS cli_posix_chown(struct cli_state *cli,
302 struct tevent_req *cli_rename_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_rename_recv(struct tevent_req *req);
308 NTSTATUS cli_rename(struct cli_state *cli, const char *fname_src, const char *fname_dst);
309 struct tevent_req *cli_ntrename_send(TALLOC_CTX *mem_ctx,
310 struct event_context *ev,
311 struct cli_state *cli,
312 const char *fname_src,
313 const char *fname_dst);
314 NTSTATUS cli_ntrename_recv(struct tevent_req *req);
315 NTSTATUS cli_ntrename(struct cli_state *cli, const char *fname_src, const char *fname_dst);
317 struct tevent_req *cli_nt_hardlink_send(TALLOC_CTX *mem_ctx,
318 struct event_context *ev,
319 struct cli_state *cli,
320 const char *fname_src,
321 const char *fname_dst);
322 NTSTATUS cli_nt_hardlink_recv(struct tevent_req *req);
323 NTSTATUS cli_nt_hardlink(struct cli_state *cli, const char *fname_src, const char *fname_dst);
325 struct tevent_req *cli_unlink_send(TALLOC_CTX *mem_ctx,
326 struct event_context *ev,
327 struct cli_state *cli,
329 uint16_t mayhave_attrs);
330 NTSTATUS cli_unlink_recv(struct tevent_req *req);
331 NTSTATUS cli_unlink(struct cli_state *cli, const char *fname, uint16_t mayhave_attrs);
333 struct tevent_req *cli_mkdir_send(TALLOC_CTX *mem_ctx,
334 struct event_context *ev,
335 struct cli_state *cli,
337 NTSTATUS cli_mkdir_recv(struct tevent_req *req);
338 NTSTATUS cli_mkdir(struct cli_state *cli, const char *dname);
339 struct tevent_req *cli_rmdir_send(TALLOC_CTX *mem_ctx,
340 struct event_context *ev,
341 struct cli_state *cli,
343 NTSTATUS cli_rmdir_recv(struct tevent_req *req);
344 NTSTATUS cli_rmdir(struct cli_state *cli, const char *dname);
345 struct tevent_req *cli_nt_delete_on_close_send(TALLOC_CTX *mem_ctx,
346 struct event_context *ev,
347 struct cli_state *cli,
350 NTSTATUS cli_nt_delete_on_close_recv(struct tevent_req *req);
351 NTSTATUS cli_nt_delete_on_close(struct cli_state *cli, uint16_t fnum, bool flag);
352 struct tevent_req *cli_ntcreate_send(TALLOC_CTX *mem_ctx,
353 struct event_context *ev,
354 struct cli_state *cli,
357 uint32_t DesiredAccess,
358 uint32_t FileAttributes,
359 uint32_t ShareAccess,
360 uint32_t CreateDisposition,
361 uint32_t CreateOptions,
362 uint8_t SecurityFlags);
363 NTSTATUS cli_ntcreate_recv(struct tevent_req *req, uint16_t *pfnum);
364 NTSTATUS cli_ntcreate(struct cli_state *cli,
367 uint32_t DesiredAccess,
368 uint32_t FileAttributes,
369 uint32_t ShareAccess,
370 uint32_t CreateDisposition,
371 uint32_t CreateOptions,
372 uint8_t SecurityFlags,
374 uint8_t *smb_bytes_push_str(uint8_t *buf, bool ucs2, const char *str,
375 size_t str_len, size_t *pconverted_size);
376 uint8_t *smb_bytes_push_bytes(uint8_t *buf, uint8_t prefix,
377 const uint8_t *bytes, size_t num_bytes);
378 uint8_t *trans2_bytes_push_str(uint8_t *buf, bool ucs2,
379 const char *str, size_t str_len,
380 size_t *pconverted_size);
381 uint8_t *trans2_bytes_push_bytes(uint8_t *buf,
382 const uint8_t *bytes, size_t num_bytes);
383 struct tevent_req *cli_openx_create(TALLOC_CTX *mem_ctx,
384 struct event_context *ev,
385 struct cli_state *cli, const char *fname,
386 int flags, int share_mode,
387 struct tevent_req **psmbreq);
388 struct tevent_req *cli_openx_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
389 struct cli_state *cli, const char *fname,
390 int flags, int share_mode);
391 NTSTATUS cli_openx_recv(struct tevent_req *req, uint16_t *fnum);
392 NTSTATUS cli_openx(struct cli_state *cli, const char *fname, int flags, int share_mode, uint16_t *pfnum);
393 NTSTATUS cli_open(struct cli_state *cli, const char *fname, int flags, int share_mode, uint16_t *pfnum);
394 struct tevent_req *cli_close_create(TALLOC_CTX *mem_ctx,
395 struct event_context *ev,
396 struct cli_state *cli, uint16_t fnum,
397 struct tevent_req **psubreq);
398 struct tevent_req *cli_close_send(TALLOC_CTX *mem_ctx,
399 struct event_context *ev,
400 struct cli_state *cli, uint16_t fnum);
401 NTSTATUS cli_close_recv(struct tevent_req *req);
402 NTSTATUS cli_close(struct cli_state *cli, uint16_t fnum);
403 struct tevent_req *cli_ftruncate_send(TALLOC_CTX *mem_ctx,
404 struct event_context *ev,
405 struct cli_state *cli,
408 NTSTATUS cli_ftruncate_recv(struct tevent_req *req);
409 NTSTATUS cli_ftruncate(struct cli_state *cli, uint16_t fnum, uint64_t size);
410 NTSTATUS cli_locktype(struct cli_state *cli, uint16_t fnum,
411 uint32_t offset, uint32_t len,
412 int timeout, unsigned char locktype);
413 NTSTATUS cli_lock32(struct cli_state *cli, uint16_t fnum, uint32_t offset,
414 uint32_t len, int timeout, enum brl_type lock_type);
415 struct tevent_req *cli_unlock_send(TALLOC_CTX *mem_ctx,
416 struct event_context *ev,
417 struct cli_state *cli,
421 NTSTATUS cli_unlock_recv(struct tevent_req *req);
422 NTSTATUS cli_unlock(struct cli_state *cli, uint16_t fnum, uint32_t offset, uint32_t len);
423 NTSTATUS cli_lock64(struct cli_state *cli, uint16_t fnum,
424 uint64_t offset, uint64_t len, int timeout,
425 enum brl_type lock_type);
426 struct tevent_req *cli_unlock64_send(TALLOC_CTX *mem_ctx,
427 struct event_context *ev,
428 struct cli_state *cli,
432 NTSTATUS cli_unlock64_recv(struct tevent_req *req);
433 NTSTATUS cli_unlock64(struct cli_state *cli, uint16_t fnum, uint64_t offset, uint64_t len);
434 struct tevent_req *cli_posix_lock_send(TALLOC_CTX *mem_ctx,
435 struct event_context *ev,
436 struct cli_state *cli,
441 enum brl_type lock_type);
442 NTSTATUS cli_posix_lock_recv(struct tevent_req *req);
443 NTSTATUS cli_posix_lock(struct cli_state *cli, uint16_t fnum,
444 uint64_t offset, uint64_t len,
445 bool wait_lock, enum brl_type lock_type);
446 struct tevent_req *cli_posix_unlock_send(TALLOC_CTX *mem_ctx,
447 struct event_context *ev,
448 struct cli_state *cli,
452 NTSTATUS cli_posix_unlock_recv(struct tevent_req *req);
453 NTSTATUS cli_posix_unlock(struct cli_state *cli, uint16_t fnum, uint64_t offset, uint64_t len);
454 struct tevent_req *cli_getattrE_send(TALLOC_CTX *mem_ctx,
455 struct event_context *ev,
456 struct cli_state *cli,
458 NTSTATUS cli_getattrE_recv(struct tevent_req *req,
464 NTSTATUS cli_getattrE(struct cli_state *cli,
471 struct tevent_req *cli_setattrE_send(TALLOC_CTX *mem_ctx,
472 struct event_context *ev,
473 struct cli_state *cli,
478 NTSTATUS cli_setattrE_recv(struct tevent_req *req);
479 NTSTATUS cli_setattrE(struct cli_state *cli,
484 struct tevent_req *cli_getatr_send(TALLOC_CTX *mem_ctx,
485 struct event_context *ev,
486 struct cli_state *cli,
488 NTSTATUS cli_getatr_recv(struct tevent_req *req,
492 NTSTATUS cli_getatr(struct cli_state *cli,
497 struct tevent_req *cli_setatr_send(TALLOC_CTX *mem_ctx,
498 struct event_context *ev,
499 struct cli_state *cli,
503 NTSTATUS cli_setatr_recv(struct tevent_req *req);
504 NTSTATUS cli_setatr(struct cli_state *cli,
508 struct tevent_req *cli_chkpath_send(TALLOC_CTX *mem_ctx,
509 struct event_context *ev,
510 struct cli_state *cli,
512 NTSTATUS cli_chkpath_recv(struct tevent_req *req);
513 NTSTATUS cli_chkpath(struct cli_state *cli, const char *path);
514 struct tevent_req *cli_dskattr_send(TALLOC_CTX *mem_ctx,
515 struct event_context *ev,
516 struct cli_state *cli);
517 NTSTATUS cli_dskattr_recv(struct tevent_req *req, int *bsize, int *total,
519 NTSTATUS cli_dskattr(struct cli_state *cli, int *bsize, int *total, int *avail);
520 struct tevent_req *cli_ctemp_send(TALLOC_CTX *mem_ctx,
521 struct event_context *ev,
522 struct cli_state *cli,
524 NTSTATUS cli_ctemp_recv(struct tevent_req *req,
528 NTSTATUS cli_ctemp(struct cli_state *cli,
533 NTSTATUS cli_raw_ioctl(struct cli_state *cli, uint16_t fnum, uint32_t code, DATA_BLOB *blob);
534 NTSTATUS cli_set_ea_path(struct cli_state *cli, const char *path,
535 const char *ea_name, const char *ea_val,
537 NTSTATUS cli_set_ea_fnum(struct cli_state *cli, uint16_t fnum,
538 const char *ea_name, const char *ea_val,
540 struct tevent_req *cli_get_ea_list_path_send(TALLOC_CTX *mem_ctx,
541 struct tevent_context *ev,
542 struct cli_state *cli,
544 NTSTATUS cli_get_ea_list_path_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
545 size_t *pnum_eas, struct ea_struct **peas);
546 NTSTATUS cli_get_ea_list_path(struct cli_state *cli, const char *path,
549 struct ea_struct **pea_list);
550 struct tevent_req *cli_posix_open_send(TALLOC_CTX *mem_ctx,
551 struct event_context *ev,
552 struct cli_state *cli,
556 NTSTATUS cli_posix_open_recv(struct tevent_req *req, uint16_t *pfnum);
557 NTSTATUS cli_posix_open(struct cli_state *cli, const char *fname,
558 int flags, mode_t mode, uint16_t *fnum);
559 struct tevent_req *cli_posix_mkdir_send(TALLOC_CTX *mem_ctx,
560 struct event_context *ev,
561 struct cli_state *cli,
564 NTSTATUS cli_posix_mkdir_recv(struct tevent_req *req);
565 NTSTATUS cli_posix_mkdir(struct cli_state *cli, const char *fname, mode_t mode);
567 struct tevent_req *cli_posix_unlink_send(TALLOC_CTX *mem_ctx,
568 struct event_context *ev,
569 struct cli_state *cli,
571 NTSTATUS cli_posix_unlink_recv(struct tevent_req *req);
572 NTSTATUS cli_posix_unlink(struct cli_state *cli, const char *fname);
574 struct tevent_req *cli_posix_rmdir_send(TALLOC_CTX *mem_ctx,
575 struct event_context *ev,
576 struct cli_state *cli,
578 NTSTATUS cli_posix_rmdir_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx);
579 NTSTATUS cli_posix_rmdir(struct cli_state *cli, const char *fname);
580 struct tevent_req *cli_notify_send(TALLOC_CTX *mem_ctx,
581 struct tevent_context *ev,
582 struct cli_state *cli, uint16_t fnum,
583 uint32_t buffer_size,
584 uint32_t completion_filter, bool recursive);
585 NTSTATUS cli_notify_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
586 uint32_t *pnum_changes,
587 struct notify_change **pchanges);
588 NTSTATUS cli_notify(struct cli_state *cli, uint16_t fnum, uint32_t buffer_size,
589 uint32_t completion_filter, bool recursive,
590 TALLOC_CTX *mem_ctx, uint32_t *pnum_changes,
591 struct notify_change **pchanges);
593 struct tevent_req *cli_nttrans_create_send(TALLOC_CTX *mem_ctx,
594 struct event_context *ev,
595 struct cli_state *cli,
598 uint32_t DesiredAccess,
599 uint32_t FileAttributes,
600 uint32_t ShareAccess,
601 uint32_t CreateDisposition,
602 uint32_t CreateOptions,
603 uint8_t SecurityFlags,
604 struct security_descriptor *secdesc,
605 struct ea_struct *eas,
607 NTSTATUS cli_nttrans_create_recv(struct tevent_req *req, uint16_t *fnum);
608 NTSTATUS cli_nttrans_create(struct cli_state *cli,
611 uint32_t DesiredAccess,
612 uint32_t FileAttributes,
613 uint32_t ShareAccess,
614 uint32_t CreateDisposition,
615 uint32_t CreateOptions,
616 uint8_t SecurityFlags,
617 struct security_descriptor *secdesc,
618 struct ea_struct *eas,
622 /* The following definitions come from libsmb/clifsinfo.c */
624 struct tevent_req *cli_unix_extensions_version_send(TALLOC_CTX *mem_ctx,
625 struct tevent_context *ev,
626 struct cli_state *cli);
627 NTSTATUS cli_unix_extensions_version_recv(struct tevent_req *req,
628 uint16_t *pmajor, uint16_t *pminor,
631 NTSTATUS cli_unix_extensions_version(struct cli_state *cli, uint16 *pmajor,
632 uint16 *pminor, uint32 *pcaplow,
634 struct tevent_req *cli_set_unix_extensions_capabilities_send(
635 TALLOC_CTX *mem_ctx, struct tevent_context *ev, struct cli_state *cli,
636 uint16_t major, uint16_t minor, uint32_t caplow, uint32_t caphigh);
637 NTSTATUS cli_set_unix_extensions_capabilities_recv(struct tevent_req *req);
638 NTSTATUS cli_set_unix_extensions_capabilities(struct cli_state *cli,
639 uint16 major, uint16 minor,
640 uint32 caplow, uint32 caphigh);
641 struct tevent_req *cli_get_fs_attr_info_send(TALLOC_CTX *mem_ctx,
642 struct tevent_context *ev,
643 struct cli_state *cli);
644 NTSTATUS cli_get_fs_attr_info_recv(struct tevent_req *req, uint32_t *fs_attr);
645 NTSTATUS cli_get_fs_attr_info(struct cli_state *cli, uint32_t *fs_attr);
646 NTSTATUS cli_get_fs_volume_info(struct cli_state *cli,
647 TALLOC_CTX *mem_ctx, char **volume_name,
648 uint32 *pserial_number, time_t *pdate);
649 NTSTATUS cli_get_fs_full_size_info(struct cli_state *cli,
650 uint64_t *total_allocation_units,
651 uint64_t *caller_allocation_units,
652 uint64_t *actual_allocation_units,
653 uint64_t *sectors_per_allocation_unit,
654 uint64_t *bytes_per_sector);
655 NTSTATUS cli_get_posix_fs_info(struct cli_state *cli,
656 uint32 *optimal_transfer_size,
658 uint64_t *total_blocks,
659 uint64_t *blocks_available,
660 uint64_t *user_blocks_available,
661 uint64_t *total_file_nodes,
662 uint64_t *free_file_nodes,
663 uint64_t *fs_identifier);
664 NTSTATUS cli_raw_ntlm_smb_encryption_start(struct cli_state *cli,
668 NTSTATUS cli_gss_smb_encryption_start(struct cli_state *cli);
669 NTSTATUS cli_force_encryption(struct cli_state *c,
670 const char *username,
671 const char *password,
674 /* The following definitions come from libsmb/clilist.c */
676 NTSTATUS cli_list_old(struct cli_state *cli,const char *Mask,uint16 attribute,
677 NTSTATUS (*fn)(const char *, struct file_info *,
678 const char *, void *), void *state);
679 NTSTATUS cli_list_trans(struct cli_state *cli, const char *mask,
680 uint16_t attribute, int info_level,
681 NTSTATUS (*fn)(const char *mnt, struct file_info *finfo,
682 const char *mask, void *private_data),
684 struct tevent_req *cli_list_send(TALLOC_CTX *mem_ctx,
685 struct tevent_context *ev,
686 struct cli_state *cli,
689 uint16_t info_level);
690 NTSTATUS cli_list_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
691 struct file_info **finfo, size_t *num_finfo);
692 NTSTATUS cli_list(struct cli_state *cli,const char *Mask,uint16 attribute,
693 NTSTATUS (*fn)(const char *, struct file_info *, const char *,
694 void *), void *state);
696 /* The following definitions come from libsmb/climessage.c */
698 struct tevent_req *cli_message_send(TALLOC_CTX *mem_ctx,
699 struct tevent_context *ev,
700 struct cli_state *cli,
701 const char *host, const char *username,
702 const char *message);
703 NTSTATUS cli_message_recv(struct tevent_req *req);
704 NTSTATUS cli_message(struct cli_state *cli, const char *host,
705 const char *username, const char *message);
707 /* The following definitions come from libsmb/clioplock.c */
709 struct tevent_req *cli_smb_oplock_break_waiter_send(TALLOC_CTX *mem_ctx,
710 struct event_context *ev,
711 struct cli_state *cli);
712 NTSTATUS cli_smb_oplock_break_waiter_recv(struct tevent_req *req,
716 struct tevent_req *cli_oplock_ack_send(TALLOC_CTX *mem_ctx,
717 struct tevent_context *ev,
718 struct cli_state *cli,
719 uint16_t fnum, uint8_t level);
720 NTSTATUS cli_oplock_ack_recv(struct tevent_req *req);
722 /* The following definitions come from libsmb/cliprint.c */
724 int cli_print_queue(struct cli_state *cli,
725 void (*fn)(struct print_job_info *));
726 int cli_printjob_del(struct cli_state *cli, int job);
728 /* The following definitions come from libsmb/cliquota.c */
730 NTSTATUS cli_get_quota_handle(struct cli_state *cli, uint16_t *quota_fnum);
731 void free_ntquota_list(SMB_NTQUOTA_LIST **qt_list);
732 NTSTATUS cli_get_user_quota(struct cli_state *cli, int quota_fnum,
733 SMB_NTQUOTA_STRUCT *pqt);
734 NTSTATUS cli_set_user_quota(struct cli_state *cli, int quota_fnum,
735 SMB_NTQUOTA_STRUCT *pqt);
736 NTSTATUS cli_list_user_quota(struct cli_state *cli, int quota_fnum,
737 SMB_NTQUOTA_LIST **pqt_list);
738 NTSTATUS cli_get_fs_quota_info(struct cli_state *cli, int quota_fnum,
739 SMB_NTQUOTA_STRUCT *pqt);
740 NTSTATUS cli_set_fs_quota_info(struct cli_state *cli, int quota_fnum,
741 SMB_NTQUOTA_STRUCT *pqt);
743 /* The following definitions come from libsmb/clireadwrite.c */
745 struct tevent_req *cli_read_andx_create(TALLOC_CTX *mem_ctx,
746 struct event_context *ev,
747 struct cli_state *cli, uint16_t fnum,
748 off_t offset, size_t size,
749 struct tevent_req **psmbreq);
750 struct tevent_req *cli_read_andx_send(TALLOC_CTX *mem_ctx,
751 struct event_context *ev,
752 struct cli_state *cli, uint16_t fnum,
753 off_t offset, size_t size);
754 NTSTATUS cli_read_andx_recv(struct tevent_req *req, ssize_t *received,
756 struct tevent_req *cli_pull_send(TALLOC_CTX *mem_ctx,
757 struct event_context *ev,
758 struct cli_state *cli,
759 uint16_t fnum, off_t start_offset,
760 off_t size, size_t window_size,
761 NTSTATUS (*sink)(char *buf, size_t n,
764 NTSTATUS cli_pull_recv(struct tevent_req *req, off_t *received);
765 NTSTATUS cli_pull(struct cli_state *cli, uint16_t fnum,
766 off_t start_offset, off_t size, size_t window_size,
767 NTSTATUS (*sink)(char *buf, size_t n, void *priv),
768 void *priv, off_t *received);
769 NTSTATUS cli_read(struct cli_state *cli, uint16_t fnum,
770 char *buf, off_t offset, size_t size,
772 NTSTATUS cli_smbwrite(struct cli_state *cli, uint16_t fnum, char *buf,
773 off_t offset, size_t size1, size_t *ptotal);
774 struct tevent_req *cli_write_andx_create(TALLOC_CTX *mem_ctx,
775 struct event_context *ev,
776 struct cli_state *cli, uint16_t fnum,
777 uint16_t mode, const uint8_t *buf,
778 off_t offset, size_t size,
779 struct tevent_req **reqs_before,
781 struct tevent_req **psmbreq);
782 struct tevent_req *cli_write_andx_send(TALLOC_CTX *mem_ctx,
783 struct event_context *ev,
784 struct cli_state *cli, uint16_t fnum,
785 uint16_t mode, const uint8_t *buf,
786 off_t offset, size_t size);
787 NTSTATUS cli_write_andx_recv(struct tevent_req *req, size_t *pwritten);
789 NTSTATUS cli_writeall(struct cli_state *cli, uint16_t fnum, uint16_t mode,
790 const uint8_t *buf, off_t offset, size_t size,
793 struct tevent_req *cli_push_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
794 struct cli_state *cli,
795 uint16_t fnum, uint16_t mode,
796 off_t start_offset, size_t window_size,
797 size_t (*source)(uint8_t *buf, size_t n,
800 NTSTATUS cli_push_recv(struct tevent_req *req);
801 NTSTATUS cli_push(struct cli_state *cli, uint16_t fnum, uint16_t mode,
802 off_t start_offset, size_t window_size,
803 size_t (*source)(uint8_t *buf, size_t n, void *priv),
806 /* The following definitions come from libsmb/clisecdesc.c */
808 NTSTATUS cli_query_secdesc(struct cli_state *cli, uint16_t fnum,
809 TALLOC_CTX *mem_ctx, struct security_descriptor **sd);
810 NTSTATUS cli_set_secdesc(struct cli_state *cli, uint16_t fnum,
811 const struct security_descriptor *sd);
813 /* The following definitions come from libsmb/clistr.c */
815 size_t clistr_pull_talloc(TALLOC_CTX *ctx,
823 /* The following definitions come from libsmb/clitrans.c */
825 struct tevent_req *cli_trans_send(
826 TALLOC_CTX *mem_ctx, struct tevent_context *ev,
827 struct cli_state *cli, uint8_t cmd,
828 const char *pipe_name, uint16_t fid, uint16_t function, int flags,
829 uint16_t *setup, uint8_t num_setup, uint8_t max_setup,
830 uint8_t *param, uint32_t num_param, uint32_t max_param,
831 uint8_t *data, uint32_t num_data, uint32_t max_data);
832 NTSTATUS cli_trans_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
833 uint16_t *recv_flags2,
834 uint16_t **setup, uint8_t min_setup,
836 uint8_t **param, uint32_t min_param,
838 uint8_t **data, uint32_t min_data,
840 NTSTATUS cli_trans(TALLOC_CTX *mem_ctx, struct cli_state *cli,
842 const char *pipe_name, uint16_t fid, uint16_t function,
844 uint16_t *setup, uint8_t num_setup, uint8_t max_setup,
845 uint8_t *param, uint32_t num_param, uint32_t max_param,
846 uint8_t *data, uint32_t num_data, uint32_t max_data,
847 uint16_t *recv_flags2,
848 uint16_t **rsetup, uint8_t min_rsetup, uint8_t *num_rsetup,
849 uint8_t **rparam, uint32_t min_rparam, uint32_t *num_rparam,
850 uint8_t **rdata, uint32_t min_rdata, uint32_t *num_rdata);
852 /* The following definitions come from libsmb/clisigning.c */
854 bool cli_simple_set_signing(struct cli_state *cli,
855 const DATA_BLOB user_session_key,
856 const DATA_BLOB response);
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);
860 /* The following definitions come from libsmb/reparse_symlink.c */
862 bool symlink_reparse_buffer_marshall(
863 const char *substitute, const char *printname, uint32_t flags,
864 TALLOC_CTX *mem_ctx, uint8_t **pdst, size_t *pdstlen);
865 bool symlink_reparse_buffer_parse(
866 const uint8_t *src, size_t srclen, TALLOC_CTX *mem_ctx,
867 char **psubstitute_name, char **pprint_name, uint32_t *pflags);
869 /* The following definitions come from libsmb/clisymlink.c */
871 struct tevent_req *cli_symlink_send(TALLOC_CTX *mem_ctx,
872 struct tevent_context *ev,
873 struct cli_state *cli,
877 NTSTATUS cli_symlink_recv(struct tevent_req *req);
878 NTSTATUS cli_symlink(struct cli_state *cli, const char *oldname,
879 const char *newname, uint32_t flags);
881 struct tevent_req *cli_readlink_send(TALLOC_CTX *mem_ctx,
882 struct tevent_context *ev,
883 struct cli_state *cli,
885 NTSTATUS cli_readlink_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
886 char **psubstitute_name, char **pprint_name,
888 NTSTATUS cli_readlink(struct cli_state *cli, const char *fname,
889 TALLOC_CTX *mem_ctx, char **psubstitute_name,
890 char **pprint_name, uint32_t *pflags);
892 #endif /* _LIBSMB_PROTO_H_ */