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 struct sockaddr_storage *cli_state_local_sockaddr(struct cli_state *cli);
175 const struct sockaddr_storage *cli_state_remote_sockaddr(struct cli_state *cli);
176 const char *cli_state_remote_name(struct cli_state *cli);
177 const char *cli_state_remote_realm(struct cli_state *cli);
178 uint16_t cli_state_get_vc_num(struct cli_state *cli);
179 uint32_t cli_state_server_session_key(struct cli_state *cli);
180 uint16 cli_setpid(struct cli_state *cli, uint16 pid);
181 uint16_t cli_getpid(struct cli_state *cli);
182 bool cli_state_has_tcon(struct cli_state *cli);
183 uint16_t cli_state_get_tid(struct cli_state *cli);
184 uint16_t cli_state_set_tid(struct cli_state *cli, uint16_t tid);
185 uint16_t cli_state_get_uid(struct cli_state *cli);
186 uint16_t cli_state_set_uid(struct cli_state *cli, uint16_t uid);
187 bool cli_set_case_sensitive(struct cli_state *cli, bool case_sensitive);
188 enum protocol_types cli_state_protocol(struct cli_state *cli);
189 uint32_t cli_state_capabilities(struct cli_state *cli);
190 uint32_t cli_state_available_size(struct cli_state *cli, uint32_t ofs);
191 uint16_t cli_state_max_requests(struct cli_state *cli);
192 const uint8_t *cli_state_server_challenge(struct cli_state *cli);
193 const DATA_BLOB *cli_state_server_gss_blob(struct cli_state *cli);
194 uint16_t cli_state_security_mode(struct cli_state *cli);
195 int cli_state_server_time_zone(struct cli_state *cli);
196 time_t cli_state_server_time(struct cli_state *cli);
197 struct tevent_req *cli_echo_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
198 struct cli_state *cli, uint16_t num_echos,
200 NTSTATUS cli_echo_recv(struct tevent_req *req);
201 NTSTATUS cli_echo(struct cli_state *cli, uint16_t num_echos, DATA_BLOB data);
202 bool cli_ucs2(struct cli_state *cli);
203 bool is_andx_req(uint8_t cmd);
204 NTSTATUS cli_smb(TALLOC_CTX *mem_ctx, struct cli_state *cli,
205 uint8_t smb_command, uint8_t additional_flags,
206 uint8_t wct, uint16_t *vwv,
207 uint32_t num_bytes, const uint8_t *bytes,
208 struct tevent_req **result_parent,
209 uint8_t min_wct, uint8_t *pwct, uint16_t **pvwv,
210 uint32_t *pnum_bytes, uint8_t **pbytes);
212 /* The following definitions come from libsmb/clierror.c */
214 const char *cli_errstr(struct cli_state *cli);
215 NTSTATUS cli_nt_error(struct cli_state *cli);
216 void cli_dos_error(struct cli_state *cli, uint8 *eclass, uint32 *ecode);
217 int cli_errno(struct cli_state *cli);
218 bool cli_is_error(struct cli_state *cli);
219 bool cli_is_nt_error(struct cli_state *cli);
220 bool cli_is_dos_error(struct cli_state *cli);
221 bool cli_state_is_connected(struct cli_state *cli);
222 void cli_state_disconnect(struct cli_state *cli);
224 /* The following definitions come from libsmb/clifile.c */
226 struct tevent_req *cli_setpathinfo_send(TALLOC_CTX *mem_ctx,
227 struct tevent_context *ev,
228 struct cli_state *cli,
233 NTSTATUS cli_setpathinfo_recv(struct tevent_req *req);
234 NTSTATUS cli_setpathinfo(struct cli_state *cli,
240 struct tevent_req *cli_posix_symlink_send(TALLOC_CTX *mem_ctx,
241 struct event_context *ev,
242 struct cli_state *cli,
244 const char *newname);
245 NTSTATUS cli_posix_symlink_recv(struct tevent_req *req);
246 NTSTATUS cli_posix_symlink(struct cli_state *cli,
248 const char *newname);
249 struct tevent_req *cli_posix_readlink_send(TALLOC_CTX *mem_ctx,
250 struct event_context *ev,
251 struct cli_state *cli,
254 NTSTATUS cli_posix_readlink_recv(struct tevent_req *req, struct cli_state *cli,
255 char *retpath, size_t len);
256 NTSTATUS cli_posix_readlink(struct cli_state *cli, const char *fname,
257 char *linkpath, size_t len);
258 struct tevent_req *cli_posix_hardlink_send(TALLOC_CTX *mem_ctx,
259 struct event_context *ev,
260 struct cli_state *cli,
262 const char *newname);
263 NTSTATUS cli_posix_hardlink_recv(struct tevent_req *req);
264 NTSTATUS cli_posix_hardlink(struct cli_state *cli,
266 const char *newname);
267 uint32_t unix_perms_to_wire(mode_t perms);
268 mode_t wire_perms_to_unix(uint32_t perms);
269 struct tevent_req *cli_posix_getfacl_send(TALLOC_CTX *mem_ctx,
270 struct event_context *ev,
271 struct cli_state *cli,
273 NTSTATUS cli_posix_getfacl_recv(struct tevent_req *req,
277 NTSTATUS cli_posix_getfacl(struct cli_state *cli,
282 struct tevent_req *cli_posix_stat_send(TALLOC_CTX *mem_ctx,
283 struct event_context *ev,
284 struct cli_state *cli,
286 NTSTATUS cli_posix_stat_recv(struct tevent_req *req,
287 SMB_STRUCT_STAT *sbuf);
288 NTSTATUS cli_posix_stat(struct cli_state *cli,
290 SMB_STRUCT_STAT *sbuf);
291 struct tevent_req *cli_posix_chmod_send(TALLOC_CTX *mem_ctx,
292 struct event_context *ev,
293 struct cli_state *cli,
296 NTSTATUS cli_posix_chmod_recv(struct tevent_req *req);
297 NTSTATUS cli_posix_chmod(struct cli_state *cli, const char *fname, mode_t mode);
298 struct tevent_req *cli_posix_chown_send(TALLOC_CTX *mem_ctx,
299 struct event_context *ev,
300 struct cli_state *cli,
304 NTSTATUS cli_posix_chown_recv(struct tevent_req *req);
305 NTSTATUS cli_posix_chown(struct cli_state *cli,
309 struct tevent_req *cli_rename_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_rename_recv(struct tevent_req *req);
315 NTSTATUS cli_rename(struct cli_state *cli, const char *fname_src, const char *fname_dst);
316 struct tevent_req *cli_ntrename_send(TALLOC_CTX *mem_ctx,
317 struct event_context *ev,
318 struct cli_state *cli,
319 const char *fname_src,
320 const char *fname_dst);
321 NTSTATUS cli_ntrename_recv(struct tevent_req *req);
322 NTSTATUS cli_ntrename(struct cli_state *cli, const char *fname_src, const char *fname_dst);
324 struct tevent_req *cli_nt_hardlink_send(TALLOC_CTX *mem_ctx,
325 struct event_context *ev,
326 struct cli_state *cli,
327 const char *fname_src,
328 const char *fname_dst);
329 NTSTATUS cli_nt_hardlink_recv(struct tevent_req *req);
330 NTSTATUS cli_nt_hardlink(struct cli_state *cli, const char *fname_src, const char *fname_dst);
332 struct tevent_req *cli_unlink_send(TALLOC_CTX *mem_ctx,
333 struct event_context *ev,
334 struct cli_state *cli,
336 uint16_t mayhave_attrs);
337 NTSTATUS cli_unlink_recv(struct tevent_req *req);
338 NTSTATUS cli_unlink(struct cli_state *cli, const char *fname, uint16_t mayhave_attrs);
340 struct tevent_req *cli_mkdir_send(TALLOC_CTX *mem_ctx,
341 struct event_context *ev,
342 struct cli_state *cli,
344 NTSTATUS cli_mkdir_recv(struct tevent_req *req);
345 NTSTATUS cli_mkdir(struct cli_state *cli, const char *dname);
346 struct tevent_req *cli_rmdir_send(TALLOC_CTX *mem_ctx,
347 struct event_context *ev,
348 struct cli_state *cli,
350 NTSTATUS cli_rmdir_recv(struct tevent_req *req);
351 NTSTATUS cli_rmdir(struct cli_state *cli, const char *dname);
352 struct tevent_req *cli_nt_delete_on_close_send(TALLOC_CTX *mem_ctx,
353 struct event_context *ev,
354 struct cli_state *cli,
357 NTSTATUS cli_nt_delete_on_close_recv(struct tevent_req *req);
358 NTSTATUS cli_nt_delete_on_close(struct cli_state *cli, uint16_t fnum, bool flag);
359 struct tevent_req *cli_ntcreate_send(TALLOC_CTX *mem_ctx,
360 struct event_context *ev,
361 struct cli_state *cli,
364 uint32_t DesiredAccess,
365 uint32_t FileAttributes,
366 uint32_t ShareAccess,
367 uint32_t CreateDisposition,
368 uint32_t CreateOptions,
369 uint8_t SecurityFlags);
370 NTSTATUS cli_ntcreate_recv(struct tevent_req *req, uint16_t *pfnum);
371 NTSTATUS cli_ntcreate(struct cli_state *cli,
374 uint32_t DesiredAccess,
375 uint32_t FileAttributes,
376 uint32_t ShareAccess,
377 uint32_t CreateDisposition,
378 uint32_t CreateOptions,
379 uint8_t SecurityFlags,
381 uint8_t *smb_bytes_push_str(uint8_t *buf, bool ucs2, const char *str,
382 size_t str_len, size_t *pconverted_size);
383 uint8_t *smb_bytes_push_bytes(uint8_t *buf, uint8_t prefix,
384 const uint8_t *bytes, size_t num_bytes);
385 uint8_t *trans2_bytes_push_str(uint8_t *buf, bool ucs2,
386 const char *str, size_t str_len,
387 size_t *pconverted_size);
388 uint8_t *trans2_bytes_push_bytes(uint8_t *buf,
389 const uint8_t *bytes, size_t num_bytes);
390 struct tevent_req *cli_openx_create(TALLOC_CTX *mem_ctx,
391 struct event_context *ev,
392 struct cli_state *cli, const char *fname,
393 int flags, int share_mode,
394 struct tevent_req **psmbreq);
395 struct tevent_req *cli_openx_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
396 struct cli_state *cli, const char *fname,
397 int flags, int share_mode);
398 NTSTATUS cli_openx_recv(struct tevent_req *req, uint16_t *fnum);
399 NTSTATUS cli_openx(struct cli_state *cli, const char *fname, int flags, int share_mode, uint16_t *pfnum);
400 NTSTATUS cli_open(struct cli_state *cli, const char *fname, int flags, int share_mode, uint16_t *pfnum);
401 struct tevent_req *cli_close_create(TALLOC_CTX *mem_ctx,
402 struct event_context *ev,
403 struct cli_state *cli, uint16_t fnum,
404 struct tevent_req **psubreq);
405 struct tevent_req *cli_close_send(TALLOC_CTX *mem_ctx,
406 struct event_context *ev,
407 struct cli_state *cli, uint16_t fnum);
408 NTSTATUS cli_close_recv(struct tevent_req *req);
409 NTSTATUS cli_close(struct cli_state *cli, uint16_t fnum);
410 struct tevent_req *cli_ftruncate_send(TALLOC_CTX *mem_ctx,
411 struct event_context *ev,
412 struct cli_state *cli,
415 NTSTATUS cli_ftruncate_recv(struct tevent_req *req);
416 NTSTATUS cli_ftruncate(struct cli_state *cli, uint16_t fnum, uint64_t size);
417 NTSTATUS cli_locktype(struct cli_state *cli, uint16_t fnum,
418 uint32_t offset, uint32_t len,
419 int timeout, unsigned char locktype);
420 NTSTATUS cli_lock32(struct cli_state *cli, uint16_t fnum, uint32_t offset,
421 uint32_t len, int timeout, enum brl_type lock_type);
422 struct tevent_req *cli_unlock_send(TALLOC_CTX *mem_ctx,
423 struct event_context *ev,
424 struct cli_state *cli,
428 NTSTATUS cli_unlock_recv(struct tevent_req *req);
429 NTSTATUS cli_unlock(struct cli_state *cli, uint16_t fnum, uint32_t offset, uint32_t len);
430 NTSTATUS cli_lock64(struct cli_state *cli, uint16_t fnum,
431 uint64_t offset, uint64_t len, int timeout,
432 enum brl_type lock_type);
433 struct tevent_req *cli_unlock64_send(TALLOC_CTX *mem_ctx,
434 struct event_context *ev,
435 struct cli_state *cli,
439 NTSTATUS cli_unlock64_recv(struct tevent_req *req);
440 NTSTATUS cli_unlock64(struct cli_state *cli, uint16_t fnum, uint64_t offset, uint64_t len);
441 struct tevent_req *cli_posix_lock_send(TALLOC_CTX *mem_ctx,
442 struct event_context *ev,
443 struct cli_state *cli,
448 enum brl_type lock_type);
449 NTSTATUS cli_posix_lock_recv(struct tevent_req *req);
450 NTSTATUS cli_posix_lock(struct cli_state *cli, uint16_t fnum,
451 uint64_t offset, uint64_t len,
452 bool wait_lock, enum brl_type lock_type);
453 struct tevent_req *cli_posix_unlock_send(TALLOC_CTX *mem_ctx,
454 struct event_context *ev,
455 struct cli_state *cli,
459 NTSTATUS cli_posix_unlock_recv(struct tevent_req *req);
460 NTSTATUS cli_posix_unlock(struct cli_state *cli, uint16_t fnum, uint64_t offset, uint64_t len);
461 struct tevent_req *cli_getattrE_send(TALLOC_CTX *mem_ctx,
462 struct event_context *ev,
463 struct cli_state *cli,
465 NTSTATUS cli_getattrE_recv(struct tevent_req *req,
471 NTSTATUS cli_getattrE(struct cli_state *cli,
478 struct tevent_req *cli_setattrE_send(TALLOC_CTX *mem_ctx,
479 struct event_context *ev,
480 struct cli_state *cli,
485 NTSTATUS cli_setattrE_recv(struct tevent_req *req);
486 NTSTATUS cli_setattrE(struct cli_state *cli,
491 struct tevent_req *cli_getatr_send(TALLOC_CTX *mem_ctx,
492 struct event_context *ev,
493 struct cli_state *cli,
495 NTSTATUS cli_getatr_recv(struct tevent_req *req,
499 NTSTATUS cli_getatr(struct cli_state *cli,
504 struct tevent_req *cli_setatr_send(TALLOC_CTX *mem_ctx,
505 struct event_context *ev,
506 struct cli_state *cli,
510 NTSTATUS cli_setatr_recv(struct tevent_req *req);
511 NTSTATUS cli_setatr(struct cli_state *cli,
515 struct tevent_req *cli_chkpath_send(TALLOC_CTX *mem_ctx,
516 struct event_context *ev,
517 struct cli_state *cli,
519 NTSTATUS cli_chkpath_recv(struct tevent_req *req);
520 NTSTATUS cli_chkpath(struct cli_state *cli, const char *path);
521 struct tevent_req *cli_dskattr_send(TALLOC_CTX *mem_ctx,
522 struct event_context *ev,
523 struct cli_state *cli);
524 NTSTATUS cli_dskattr_recv(struct tevent_req *req, int *bsize, int *total,
526 NTSTATUS cli_dskattr(struct cli_state *cli, int *bsize, int *total, int *avail);
527 struct tevent_req *cli_ctemp_send(TALLOC_CTX *mem_ctx,
528 struct event_context *ev,
529 struct cli_state *cli,
531 NTSTATUS cli_ctemp_recv(struct tevent_req *req,
535 NTSTATUS cli_ctemp(struct cli_state *cli,
540 NTSTATUS cli_raw_ioctl(struct cli_state *cli, uint16_t fnum, uint32_t code, DATA_BLOB *blob);
541 NTSTATUS cli_set_ea_path(struct cli_state *cli, const char *path,
542 const char *ea_name, const char *ea_val,
544 NTSTATUS cli_set_ea_fnum(struct cli_state *cli, uint16_t fnum,
545 const char *ea_name, const char *ea_val,
547 struct tevent_req *cli_get_ea_list_path_send(TALLOC_CTX *mem_ctx,
548 struct tevent_context *ev,
549 struct cli_state *cli,
551 NTSTATUS cli_get_ea_list_path_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
552 size_t *pnum_eas, struct ea_struct **peas);
553 NTSTATUS cli_get_ea_list_path(struct cli_state *cli, const char *path,
556 struct ea_struct **pea_list);
557 struct tevent_req *cli_posix_open_send(TALLOC_CTX *mem_ctx,
558 struct event_context *ev,
559 struct cli_state *cli,
563 NTSTATUS cli_posix_open_recv(struct tevent_req *req, uint16_t *pfnum);
564 NTSTATUS cli_posix_open(struct cli_state *cli, const char *fname,
565 int flags, mode_t mode, uint16_t *fnum);
566 struct tevent_req *cli_posix_mkdir_send(TALLOC_CTX *mem_ctx,
567 struct event_context *ev,
568 struct cli_state *cli,
571 NTSTATUS cli_posix_mkdir_recv(struct tevent_req *req);
572 NTSTATUS cli_posix_mkdir(struct cli_state *cli, const char *fname, mode_t mode);
574 struct tevent_req *cli_posix_unlink_send(TALLOC_CTX *mem_ctx,
575 struct event_context *ev,
576 struct cli_state *cli,
578 NTSTATUS cli_posix_unlink_recv(struct tevent_req *req);
579 NTSTATUS cli_posix_unlink(struct cli_state *cli, const char *fname);
581 struct tevent_req *cli_posix_rmdir_send(TALLOC_CTX *mem_ctx,
582 struct event_context *ev,
583 struct cli_state *cli,
585 NTSTATUS cli_posix_rmdir_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx);
586 NTSTATUS cli_posix_rmdir(struct cli_state *cli, const char *fname);
587 struct tevent_req *cli_notify_send(TALLOC_CTX *mem_ctx,
588 struct tevent_context *ev,
589 struct cli_state *cli, uint16_t fnum,
590 uint32_t buffer_size,
591 uint32_t completion_filter, bool recursive);
592 NTSTATUS cli_notify_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
593 uint32_t *pnum_changes,
594 struct notify_change **pchanges);
595 NTSTATUS cli_notify(struct cli_state *cli, uint16_t fnum, uint32_t buffer_size,
596 uint32_t completion_filter, bool recursive,
597 TALLOC_CTX *mem_ctx, uint32_t *pnum_changes,
598 struct notify_change **pchanges);
600 struct tevent_req *cli_nttrans_create_send(TALLOC_CTX *mem_ctx,
601 struct event_context *ev,
602 struct cli_state *cli,
605 uint32_t DesiredAccess,
606 uint32_t FileAttributes,
607 uint32_t ShareAccess,
608 uint32_t CreateDisposition,
609 uint32_t CreateOptions,
610 uint8_t SecurityFlags,
611 struct security_descriptor *secdesc,
612 struct ea_struct *eas,
614 NTSTATUS cli_nttrans_create_recv(struct tevent_req *req, uint16_t *fnum);
615 NTSTATUS cli_nttrans_create(struct cli_state *cli,
618 uint32_t DesiredAccess,
619 uint32_t FileAttributes,
620 uint32_t ShareAccess,
621 uint32_t CreateDisposition,
622 uint32_t CreateOptions,
623 uint8_t SecurityFlags,
624 struct security_descriptor *secdesc,
625 struct ea_struct *eas,
629 /* The following definitions come from libsmb/clifsinfo.c */
631 struct tevent_req *cli_unix_extensions_version_send(TALLOC_CTX *mem_ctx,
632 struct tevent_context *ev,
633 struct cli_state *cli);
634 NTSTATUS cli_unix_extensions_version_recv(struct tevent_req *req,
635 uint16_t *pmajor, uint16_t *pminor,
638 NTSTATUS cli_unix_extensions_version(struct cli_state *cli, uint16 *pmajor,
639 uint16 *pminor, uint32 *pcaplow,
641 struct tevent_req *cli_set_unix_extensions_capabilities_send(
642 TALLOC_CTX *mem_ctx, struct tevent_context *ev, struct cli_state *cli,
643 uint16_t major, uint16_t minor, uint32_t caplow, uint32_t caphigh);
644 NTSTATUS cli_set_unix_extensions_capabilities_recv(struct tevent_req *req);
645 NTSTATUS cli_set_unix_extensions_capabilities(struct cli_state *cli,
646 uint16 major, uint16 minor,
647 uint32 caplow, uint32 caphigh);
648 struct tevent_req *cli_get_fs_attr_info_send(TALLOC_CTX *mem_ctx,
649 struct tevent_context *ev,
650 struct cli_state *cli);
651 NTSTATUS cli_get_fs_attr_info_recv(struct tevent_req *req, uint32_t *fs_attr);
652 NTSTATUS cli_get_fs_attr_info(struct cli_state *cli, uint32_t *fs_attr);
653 NTSTATUS cli_get_fs_volume_info(struct cli_state *cli,
654 TALLOC_CTX *mem_ctx, char **volume_name,
655 uint32 *pserial_number, time_t *pdate);
656 NTSTATUS cli_get_fs_full_size_info(struct cli_state *cli,
657 uint64_t *total_allocation_units,
658 uint64_t *caller_allocation_units,
659 uint64_t *actual_allocation_units,
660 uint64_t *sectors_per_allocation_unit,
661 uint64_t *bytes_per_sector);
662 NTSTATUS cli_get_posix_fs_info(struct cli_state *cli,
663 uint32 *optimal_transfer_size,
665 uint64_t *total_blocks,
666 uint64_t *blocks_available,
667 uint64_t *user_blocks_available,
668 uint64_t *total_file_nodes,
669 uint64_t *free_file_nodes,
670 uint64_t *fs_identifier);
671 NTSTATUS cli_raw_ntlm_smb_encryption_start(struct cli_state *cli,
675 NTSTATUS cli_gss_smb_encryption_start(struct cli_state *cli);
676 NTSTATUS cli_force_encryption(struct cli_state *c,
677 const char *username,
678 const char *password,
681 /* The following definitions come from libsmb/clilist.c */
683 NTSTATUS cli_list_old(struct cli_state *cli,const char *Mask,uint16 attribute,
684 NTSTATUS (*fn)(const char *, struct file_info *,
685 const char *, void *), void *state);
686 NTSTATUS cli_list_trans(struct cli_state *cli, const char *mask,
687 uint16_t attribute, int info_level,
688 NTSTATUS (*fn)(const char *mnt, struct file_info *finfo,
689 const char *mask, void *private_data),
691 struct tevent_req *cli_list_send(TALLOC_CTX *mem_ctx,
692 struct tevent_context *ev,
693 struct cli_state *cli,
696 uint16_t info_level);
697 NTSTATUS cli_list_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
698 struct file_info **finfo, size_t *num_finfo);
699 NTSTATUS cli_list(struct cli_state *cli,const char *Mask,uint16 attribute,
700 NTSTATUS (*fn)(const char *, struct file_info *, const char *,
701 void *), void *state);
703 /* The following definitions come from libsmb/climessage.c */
705 struct tevent_req *cli_message_send(TALLOC_CTX *mem_ctx,
706 struct tevent_context *ev,
707 struct cli_state *cli,
708 const char *host, const char *username,
709 const char *message);
710 NTSTATUS cli_message_recv(struct tevent_req *req);
711 NTSTATUS cli_message(struct cli_state *cli, const char *host,
712 const char *username, const char *message);
714 /* The following definitions come from libsmb/clioplock.c */
716 struct tevent_req *cli_smb_oplock_break_waiter_send(TALLOC_CTX *mem_ctx,
717 struct event_context *ev,
718 struct cli_state *cli);
719 NTSTATUS cli_smb_oplock_break_waiter_recv(struct tevent_req *req,
723 struct tevent_req *cli_oplock_ack_send(TALLOC_CTX *mem_ctx,
724 struct tevent_context *ev,
725 struct cli_state *cli,
726 uint16_t fnum, uint8_t level);
727 NTSTATUS cli_oplock_ack_recv(struct tevent_req *req);
729 /* The following definitions come from libsmb/cliprint.c */
731 int cli_print_queue(struct cli_state *cli,
732 void (*fn)(struct print_job_info *));
733 int cli_printjob_del(struct cli_state *cli, int job);
735 /* The following definitions come from libsmb/cliquota.c */
737 NTSTATUS cli_get_quota_handle(struct cli_state *cli, uint16_t *quota_fnum);
738 void free_ntquota_list(SMB_NTQUOTA_LIST **qt_list);
739 NTSTATUS cli_get_user_quota(struct cli_state *cli, int quota_fnum,
740 SMB_NTQUOTA_STRUCT *pqt);
741 NTSTATUS cli_set_user_quota(struct cli_state *cli, int quota_fnum,
742 SMB_NTQUOTA_STRUCT *pqt);
743 NTSTATUS cli_list_user_quota(struct cli_state *cli, int quota_fnum,
744 SMB_NTQUOTA_LIST **pqt_list);
745 NTSTATUS cli_get_fs_quota_info(struct cli_state *cli, int quota_fnum,
746 SMB_NTQUOTA_STRUCT *pqt);
747 NTSTATUS cli_set_fs_quota_info(struct cli_state *cli, int quota_fnum,
748 SMB_NTQUOTA_STRUCT *pqt);
750 /* The following definitions come from libsmb/clireadwrite.c */
752 struct tevent_req *cli_read_andx_create(TALLOC_CTX *mem_ctx,
753 struct event_context *ev,
754 struct cli_state *cli, uint16_t fnum,
755 off_t offset, size_t size,
756 struct tevent_req **psmbreq);
757 struct tevent_req *cli_read_andx_send(TALLOC_CTX *mem_ctx,
758 struct event_context *ev,
759 struct cli_state *cli, uint16_t fnum,
760 off_t offset, size_t size);
761 NTSTATUS cli_read_andx_recv(struct tevent_req *req, ssize_t *received,
763 struct tevent_req *cli_pull_send(TALLOC_CTX *mem_ctx,
764 struct event_context *ev,
765 struct cli_state *cli,
766 uint16_t fnum, off_t start_offset,
767 off_t size, size_t window_size,
768 NTSTATUS (*sink)(char *buf, size_t n,
771 NTSTATUS cli_pull_recv(struct tevent_req *req, off_t *received);
772 NTSTATUS cli_pull(struct cli_state *cli, uint16_t fnum,
773 off_t start_offset, off_t size, size_t window_size,
774 NTSTATUS (*sink)(char *buf, size_t n, void *priv),
775 void *priv, off_t *received);
776 NTSTATUS cli_read(struct cli_state *cli, uint16_t fnum,
777 char *buf, off_t offset, size_t size,
779 NTSTATUS cli_smbwrite(struct cli_state *cli, uint16_t fnum, char *buf,
780 off_t offset, size_t size1, size_t *ptotal);
781 struct tevent_req *cli_write_andx_create(TALLOC_CTX *mem_ctx,
782 struct event_context *ev,
783 struct cli_state *cli, uint16_t fnum,
784 uint16_t mode, const uint8_t *buf,
785 off_t offset, size_t size,
786 struct tevent_req **reqs_before,
788 struct tevent_req **psmbreq);
789 struct tevent_req *cli_write_andx_send(TALLOC_CTX *mem_ctx,
790 struct event_context *ev,
791 struct cli_state *cli, uint16_t fnum,
792 uint16_t mode, const uint8_t *buf,
793 off_t offset, size_t size);
794 NTSTATUS cli_write_andx_recv(struct tevent_req *req, size_t *pwritten);
796 NTSTATUS cli_writeall(struct cli_state *cli, uint16_t fnum, uint16_t mode,
797 const uint8_t *buf, off_t offset, size_t size,
800 struct tevent_req *cli_push_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
801 struct cli_state *cli,
802 uint16_t fnum, uint16_t mode,
803 off_t start_offset, size_t window_size,
804 size_t (*source)(uint8_t *buf, size_t n,
807 NTSTATUS cli_push_recv(struct tevent_req *req);
808 NTSTATUS cli_push(struct cli_state *cli, uint16_t fnum, uint16_t mode,
809 off_t start_offset, size_t window_size,
810 size_t (*source)(uint8_t *buf, size_t n, void *priv),
813 /* The following definitions come from libsmb/clisecdesc.c */
815 NTSTATUS cli_query_secdesc(struct cli_state *cli, uint16_t fnum,
816 TALLOC_CTX *mem_ctx, struct security_descriptor **sd);
817 NTSTATUS cli_set_secdesc(struct cli_state *cli, uint16_t fnum,
818 const struct security_descriptor *sd);
820 /* The following definitions come from libsmb/clistr.c */
822 size_t clistr_pull_talloc(TALLOC_CTX *ctx,
830 /* The following definitions come from libsmb/clitrans.c */
832 struct tevent_req *cli_trans_send(
833 TALLOC_CTX *mem_ctx, struct tevent_context *ev,
834 struct cli_state *cli, uint8_t cmd,
835 const char *pipe_name, uint16_t fid, uint16_t function, int flags,
836 uint16_t *setup, uint8_t num_setup, uint8_t max_setup,
837 uint8_t *param, uint32_t num_param, uint32_t max_param,
838 uint8_t *data, uint32_t num_data, uint32_t max_data);
839 NTSTATUS cli_trans_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
840 uint16_t *recv_flags2,
841 uint16_t **setup, uint8_t min_setup,
843 uint8_t **param, uint32_t min_param,
845 uint8_t **data, uint32_t min_data,
847 NTSTATUS cli_trans(TALLOC_CTX *mem_ctx, struct cli_state *cli,
849 const char *pipe_name, uint16_t fid, uint16_t function,
851 uint16_t *setup, uint8_t num_setup, uint8_t max_setup,
852 uint8_t *param, uint32_t num_param, uint32_t max_param,
853 uint8_t *data, uint32_t num_data, uint32_t max_data,
854 uint16_t *recv_flags2,
855 uint16_t **rsetup, uint8_t min_rsetup, uint8_t *num_rsetup,
856 uint8_t **rparam, uint32_t min_rparam, uint32_t *num_rparam,
857 uint8_t **rdata, uint32_t min_rdata, uint32_t *num_rdata);
859 /* The following definitions come from libsmb/clisigning.c */
861 bool cli_simple_set_signing(struct cli_state *cli,
862 const DATA_BLOB user_session_key,
863 const DATA_BLOB response);
864 bool cli_check_sign_mac(struct cli_state *cli, const char *buf, uint32_t seqnum);
865 bool client_is_signing_on(struct cli_state *cli);
867 /* The following definitions come from libsmb/reparse_symlink.c */
869 bool symlink_reparse_buffer_marshall(
870 const char *substitute, const char *printname, uint32_t flags,
871 TALLOC_CTX *mem_ctx, uint8_t **pdst, size_t *pdstlen);
872 bool symlink_reparse_buffer_parse(
873 const uint8_t *src, size_t srclen, TALLOC_CTX *mem_ctx,
874 char **psubstitute_name, char **pprint_name, uint32_t *pflags);
876 /* The following definitions come from libsmb/clisymlink.c */
878 struct tevent_req *cli_symlink_send(TALLOC_CTX *mem_ctx,
879 struct tevent_context *ev,
880 struct cli_state *cli,
884 NTSTATUS cli_symlink_recv(struct tevent_req *req);
885 NTSTATUS cli_symlink(struct cli_state *cli, const char *oldname,
886 const char *newname, uint32_t flags);
888 struct tevent_req *cli_readlink_send(TALLOC_CTX *mem_ctx,
889 struct tevent_context *ev,
890 struct cli_state *cli,
892 NTSTATUS cli_readlink_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
893 char **psubstitute_name, char **pprint_name,
895 NTSTATUS cli_readlink(struct cli_state *cli, const char *fname,
896 TALLOC_CTX *mem_ctx, char **psubstitute_name,
897 char **pprint_name, uint32_t *pflags);
899 #endif /* _LIBSMB_PROTO_H_ */