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, enum protocol_types max_protocol);
71 struct tevent_req *cli_negprot_send(TALLOC_CTX *mem_ctx,
72 struct event_context *ev,
73 struct cli_state *cli,
74 enum protocol_types max_protocol);
75 NTSTATUS cli_negprot_recv(struct tevent_req *req);
76 NTSTATUS cli_connect_nb(const char *host, const struct sockaddr_storage *dest_ss,
77 uint16_t port, int name_type, const char *myname,
78 int signing_state, int flags, struct cli_state **pcli);
79 NTSTATUS cli_start_connection(struct cli_state **output_cli,
81 const char *dest_host,
82 const struct sockaddr_storage *dest_ss, int port,
83 int signing_state, int flags);
84 NTSTATUS cli_full_connection(struct cli_state **output_cli,
86 const char *dest_host,
87 const struct sockaddr_storage *dest_ss, int port,
88 const char *service, const char *service_type,
89 const char *user, const char *domain,
90 const char *password, int flags,
92 NTSTATUS cli_raw_tcon(struct cli_state *cli,
93 const char *service, const char *pass, const char *dev,
94 uint16 *max_xmit, uint16 *tid);
95 struct cli_state *get_ipc_connect(char *server,
96 struct sockaddr_storage *server_ss,
97 const struct user_auth_info *user_info);
98 struct cli_state *get_ipc_connect_master_ip(TALLOC_CTX *ctx,
99 struct sockaddr_storage *mb_ip,
100 const struct user_auth_info *user_info,
101 char **pp_workgroup_out);
102 struct cli_state *get_ipc_connect_master_ip_bcast(TALLOC_CTX *ctx,
103 const struct user_auth_info *user_info,
104 char **pp_workgroup_out);
106 /* The following definitions come from libsmb/clidfs.c */
108 NTSTATUS cli_cm_force_encryption(struct cli_state *c,
109 const char *username,
110 const char *password,
112 const char *sharename);
113 NTSTATUS cli_cm_open(TALLOC_CTX *ctx,
114 struct cli_state *referring_cli,
117 const struct user_auth_info *auth_info,
123 struct cli_state **pcli);
124 void cli_cm_display(struct cli_state *c);
125 struct client_dfs_referral;
126 NTSTATUS cli_dfs_get_referral(TALLOC_CTX *ctx,
127 struct cli_state *cli,
129 struct client_dfs_referral **refs,
132 NTSTATUS cli_resolve_path(TALLOC_CTX *ctx,
134 const struct user_auth_info *dfs_auth_info,
135 struct cli_state *rootcli,
137 struct cli_state **targetcli,
138 char **pp_targetpath);
140 bool cli_check_msdfs_proxy(TALLOC_CTX *ctx,
141 struct cli_state *cli,
142 const char *sharename,
146 const char *username,
147 const char *password,
150 /* The following definitions come from libsmb/clientgen.c */
152 int cli_set_message(char *buf,int num_words,int num_bytes,bool zero);
153 unsigned int cli_set_timeout(struct cli_state *cli, unsigned int timeout);
154 void cli_setup_packet_buf(struct cli_state *cli, char *buf);
155 NTSTATUS cli_set_domain(struct cli_state *cli, const char *domain);
156 NTSTATUS cli_set_username(struct cli_state *cli, const char *username);
157 NTSTATUS cli_set_password(struct cli_state *cli, const char *password);
158 NTSTATUS cli_init_creds(struct cli_state *cli, const char *username, const char *domain, const char *password);
159 struct cli_state *cli_state_create(TALLOC_CTX *mem_ctx,
161 const char *remote_name,
162 const char *remote_realm,
165 bool cli_state_encryption_on(struct cli_state *cli);
166 void cli_nt_pipes_close(struct cli_state *cli);
167 void cli_shutdown(struct cli_state *cli);
168 void cli_sockopt(struct cli_state *cli, const char *options);
169 const struct sockaddr_storage *cli_state_local_sockaddr(struct cli_state *cli);
170 const struct sockaddr_storage *cli_state_remote_sockaddr(struct cli_state *cli);
171 const char *cli_state_remote_name(struct cli_state *cli);
172 const char *cli_state_remote_realm(struct cli_state *cli);
173 uint16_t cli_state_get_vc_num(struct cli_state *cli);
174 uint32_t cli_state_server_session_key(struct cli_state *cli);
175 uint16 cli_setpid(struct cli_state *cli, uint16 pid);
176 uint16_t cli_getpid(struct cli_state *cli);
177 bool cli_state_has_tcon(struct cli_state *cli);
178 uint16_t cli_state_get_tid(struct cli_state *cli);
179 uint16_t cli_state_set_tid(struct cli_state *cli, uint16_t tid);
180 uint16_t cli_state_get_uid(struct cli_state *cli);
181 uint16_t cli_state_set_uid(struct cli_state *cli, uint16_t uid);
182 bool cli_set_case_sensitive(struct cli_state *cli, bool case_sensitive);
183 enum protocol_types cli_state_protocol(struct cli_state *cli);
184 uint32_t cli_state_capabilities(struct cli_state *cli);
185 uint32_t cli_state_available_size(struct cli_state *cli, uint32_t ofs);
186 uint16_t cli_state_max_requests(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_open_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_open_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_open_recv(struct tevent_req *req, uint16_t *fnum);
392 NTSTATUS cli_open(struct cli_state *cli, const char *fname, int flags, int share_mode, uint16_t *pfnum);
393 struct tevent_req *cli_close_create(TALLOC_CTX *mem_ctx,
394 struct event_context *ev,
395 struct cli_state *cli, uint16_t fnum,
396 struct tevent_req **psubreq);
397 struct tevent_req *cli_close_send(TALLOC_CTX *mem_ctx,
398 struct event_context *ev,
399 struct cli_state *cli, uint16_t fnum);
400 NTSTATUS cli_close_recv(struct tevent_req *req);
401 NTSTATUS cli_close(struct cli_state *cli, uint16_t fnum);
402 struct tevent_req *cli_ftruncate_send(TALLOC_CTX *mem_ctx,
403 struct event_context *ev,
404 struct cli_state *cli,
407 NTSTATUS cli_ftruncate_recv(struct tevent_req *req);
408 NTSTATUS cli_ftruncate(struct cli_state *cli, uint16_t fnum, uint64_t size);
409 NTSTATUS cli_locktype(struct cli_state *cli, uint16_t fnum,
410 uint32_t offset, uint32_t len,
411 int timeout, unsigned char locktype);
412 NTSTATUS cli_lock32(struct cli_state *cli, uint16_t fnum, uint32_t offset,
413 uint32_t len, int timeout, enum brl_type lock_type);
414 struct tevent_req *cli_unlock_send(TALLOC_CTX *mem_ctx,
415 struct event_context *ev,
416 struct cli_state *cli,
420 NTSTATUS cli_unlock_recv(struct tevent_req *req);
421 NTSTATUS cli_unlock(struct cli_state *cli, uint16_t fnum, uint32_t offset, uint32_t len);
422 NTSTATUS cli_lock64(struct cli_state *cli, uint16_t fnum,
423 uint64_t offset, uint64_t len, int timeout,
424 enum brl_type lock_type);
425 struct tevent_req *cli_unlock64_send(TALLOC_CTX *mem_ctx,
426 struct event_context *ev,
427 struct cli_state *cli,
431 NTSTATUS cli_unlock64_recv(struct tevent_req *req);
432 NTSTATUS cli_unlock64(struct cli_state *cli, uint16_t fnum, uint64_t offset, uint64_t len);
433 struct tevent_req *cli_posix_lock_send(TALLOC_CTX *mem_ctx,
434 struct event_context *ev,
435 struct cli_state *cli,
440 enum brl_type lock_type);
441 NTSTATUS cli_posix_lock_recv(struct tevent_req *req);
442 NTSTATUS cli_posix_lock(struct cli_state *cli, uint16_t fnum,
443 uint64_t offset, uint64_t len,
444 bool wait_lock, enum brl_type lock_type);
445 struct tevent_req *cli_posix_unlock_send(TALLOC_CTX *mem_ctx,
446 struct event_context *ev,
447 struct cli_state *cli,
451 NTSTATUS cli_posix_unlock_recv(struct tevent_req *req);
452 NTSTATUS cli_posix_unlock(struct cli_state *cli, uint16_t fnum, uint64_t offset, uint64_t len);
453 struct tevent_req *cli_getattrE_send(TALLOC_CTX *mem_ctx,
454 struct event_context *ev,
455 struct cli_state *cli,
457 NTSTATUS cli_getattrE_recv(struct tevent_req *req,
463 NTSTATUS cli_getattrE(struct cli_state *cli,
470 struct tevent_req *cli_setattrE_send(TALLOC_CTX *mem_ctx,
471 struct event_context *ev,
472 struct cli_state *cli,
477 NTSTATUS cli_setattrE_recv(struct tevent_req *req);
478 NTSTATUS cli_setattrE(struct cli_state *cli,
483 struct tevent_req *cli_getatr_send(TALLOC_CTX *mem_ctx,
484 struct event_context *ev,
485 struct cli_state *cli,
487 NTSTATUS cli_getatr_recv(struct tevent_req *req,
491 NTSTATUS cli_getatr(struct cli_state *cli,
496 struct tevent_req *cli_setatr_send(TALLOC_CTX *mem_ctx,
497 struct event_context *ev,
498 struct cli_state *cli,
502 NTSTATUS cli_setatr_recv(struct tevent_req *req);
503 NTSTATUS cli_setatr(struct cli_state *cli,
507 struct tevent_req *cli_chkpath_send(TALLOC_CTX *mem_ctx,
508 struct event_context *ev,
509 struct cli_state *cli,
511 NTSTATUS cli_chkpath_recv(struct tevent_req *req);
512 NTSTATUS cli_chkpath(struct cli_state *cli, const char *path);
513 struct tevent_req *cli_dskattr_send(TALLOC_CTX *mem_ctx,
514 struct event_context *ev,
515 struct cli_state *cli);
516 NTSTATUS cli_dskattr_recv(struct tevent_req *req, int *bsize, int *total,
518 NTSTATUS cli_dskattr(struct cli_state *cli, int *bsize, int *total, int *avail);
519 struct tevent_req *cli_ctemp_send(TALLOC_CTX *mem_ctx,
520 struct event_context *ev,
521 struct cli_state *cli,
523 NTSTATUS cli_ctemp_recv(struct tevent_req *req,
527 NTSTATUS cli_ctemp(struct cli_state *cli,
532 NTSTATUS cli_raw_ioctl(struct cli_state *cli, uint16_t fnum, uint32_t code, DATA_BLOB *blob);
533 NTSTATUS cli_set_ea_path(struct cli_state *cli, const char *path,
534 const char *ea_name, const char *ea_val,
536 NTSTATUS cli_set_ea_fnum(struct cli_state *cli, uint16_t fnum,
537 const char *ea_name, const char *ea_val,
539 struct tevent_req *cli_get_ea_list_path_send(TALLOC_CTX *mem_ctx,
540 struct tevent_context *ev,
541 struct cli_state *cli,
543 NTSTATUS cli_get_ea_list_path_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
544 size_t *pnum_eas, struct ea_struct **peas);
545 NTSTATUS cli_get_ea_list_path(struct cli_state *cli, const char *path,
548 struct ea_struct **pea_list);
549 struct tevent_req *cli_posix_open_send(TALLOC_CTX *mem_ctx,
550 struct event_context *ev,
551 struct cli_state *cli,
555 NTSTATUS cli_posix_open_recv(struct tevent_req *req, uint16_t *pfnum);
556 NTSTATUS cli_posix_open(struct cli_state *cli, const char *fname,
557 int flags, mode_t mode, uint16_t *fnum);
558 struct tevent_req *cli_posix_mkdir_send(TALLOC_CTX *mem_ctx,
559 struct event_context *ev,
560 struct cli_state *cli,
563 NTSTATUS cli_posix_mkdir_recv(struct tevent_req *req);
564 NTSTATUS cli_posix_mkdir(struct cli_state *cli, const char *fname, mode_t mode);
566 struct tevent_req *cli_posix_unlink_send(TALLOC_CTX *mem_ctx,
567 struct event_context *ev,
568 struct cli_state *cli,
570 NTSTATUS cli_posix_unlink_recv(struct tevent_req *req);
571 NTSTATUS cli_posix_unlink(struct cli_state *cli, const char *fname);
573 struct tevent_req *cli_posix_rmdir_send(TALLOC_CTX *mem_ctx,
574 struct event_context *ev,
575 struct cli_state *cli,
577 NTSTATUS cli_posix_rmdir_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx);
578 NTSTATUS cli_posix_rmdir(struct cli_state *cli, const char *fname);
579 struct tevent_req *cli_notify_send(TALLOC_CTX *mem_ctx,
580 struct tevent_context *ev,
581 struct cli_state *cli, uint16_t fnum,
582 uint32_t buffer_size,
583 uint32_t completion_filter, bool recursive);
584 NTSTATUS cli_notify_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
585 uint32_t *pnum_changes,
586 struct notify_change **pchanges);
588 struct tevent_req *cli_nttrans_create_send(TALLOC_CTX *mem_ctx,
589 struct event_context *ev,
590 struct cli_state *cli,
593 uint32_t DesiredAccess,
594 uint32_t FileAttributes,
595 uint32_t ShareAccess,
596 uint32_t CreateDisposition,
597 uint32_t CreateOptions,
598 uint8_t SecurityFlags,
599 struct security_descriptor *secdesc,
600 struct ea_struct *eas,
602 NTSTATUS cli_nttrans_create_recv(struct tevent_req *req, uint16_t *fnum);
603 NTSTATUS cli_nttrans_create(struct cli_state *cli,
606 uint32_t DesiredAccess,
607 uint32_t FileAttributes,
608 uint32_t ShareAccess,
609 uint32_t CreateDisposition,
610 uint32_t CreateOptions,
611 uint8_t SecurityFlags,
612 struct security_descriptor *secdesc,
613 struct ea_struct *eas,
617 /* The following definitions come from libsmb/clifsinfo.c */
619 struct tevent_req *cli_unix_extensions_version_send(TALLOC_CTX *mem_ctx,
620 struct tevent_context *ev,
621 struct cli_state *cli);
622 NTSTATUS cli_unix_extensions_version_recv(struct tevent_req *req,
623 uint16_t *pmajor, uint16_t *pminor,
626 NTSTATUS cli_unix_extensions_version(struct cli_state *cli, uint16 *pmajor,
627 uint16 *pminor, uint32 *pcaplow,
629 struct tevent_req *cli_set_unix_extensions_capabilities_send(
630 TALLOC_CTX *mem_ctx, struct tevent_context *ev, struct cli_state *cli,
631 uint16_t major, uint16_t minor, uint32_t caplow, uint32_t caphigh);
632 NTSTATUS cli_set_unix_extensions_capabilities_recv(struct tevent_req *req);
633 NTSTATUS cli_set_unix_extensions_capabilities(struct cli_state *cli,
634 uint16 major, uint16 minor,
635 uint32 caplow, uint32 caphigh);
636 struct tevent_req *cli_get_fs_attr_info_send(TALLOC_CTX *mem_ctx,
637 struct tevent_context *ev,
638 struct cli_state *cli);
639 NTSTATUS cli_get_fs_attr_info_recv(struct tevent_req *req, uint32_t *fs_attr);
640 NTSTATUS cli_get_fs_attr_info(struct cli_state *cli, uint32_t *fs_attr);
641 NTSTATUS cli_get_fs_volume_info(struct cli_state *cli,
642 TALLOC_CTX *mem_ctx, char **volume_name,
643 uint32 *pserial_number, time_t *pdate);
644 NTSTATUS cli_get_fs_full_size_info(struct cli_state *cli,
645 uint64_t *total_allocation_units,
646 uint64_t *caller_allocation_units,
647 uint64_t *actual_allocation_units,
648 uint64_t *sectors_per_allocation_unit,
649 uint64_t *bytes_per_sector);
650 NTSTATUS cli_get_posix_fs_info(struct cli_state *cli,
651 uint32 *optimal_transfer_size,
653 uint64_t *total_blocks,
654 uint64_t *blocks_available,
655 uint64_t *user_blocks_available,
656 uint64_t *total_file_nodes,
657 uint64_t *free_file_nodes,
658 uint64_t *fs_identifier);
659 NTSTATUS cli_raw_ntlm_smb_encryption_start(struct cli_state *cli,
663 NTSTATUS cli_gss_smb_encryption_start(struct cli_state *cli);
664 NTSTATUS cli_force_encryption(struct cli_state *c,
665 const char *username,
666 const char *password,
669 /* The following definitions come from libsmb/clilist.c */
671 NTSTATUS cli_list_old(struct cli_state *cli,const char *Mask,uint16 attribute,
672 NTSTATUS (*fn)(const char *, struct file_info *,
673 const char *, void *), void *state);
674 NTSTATUS cli_list_trans(struct cli_state *cli, const char *mask,
675 uint16_t attribute, int info_level,
676 NTSTATUS (*fn)(const char *mnt, struct file_info *finfo,
677 const char *mask, void *private_data),
679 struct tevent_req *cli_list_send(TALLOC_CTX *mem_ctx,
680 struct tevent_context *ev,
681 struct cli_state *cli,
684 uint16_t info_level);
685 NTSTATUS cli_list_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
686 struct file_info **finfo, size_t *num_finfo);
687 NTSTATUS cli_list(struct cli_state *cli,const char *Mask,uint16 attribute,
688 NTSTATUS (*fn)(const char *, struct file_info *, const char *,
689 void *), void *state);
691 /* The following definitions come from libsmb/climessage.c */
693 struct tevent_req *cli_message_send(TALLOC_CTX *mem_ctx,
694 struct tevent_context *ev,
695 struct cli_state *cli,
696 const char *host, const char *username,
697 const char *message);
698 NTSTATUS cli_message_recv(struct tevent_req *req);
699 NTSTATUS cli_message(struct cli_state *cli, const char *host,
700 const char *username, const char *message);
702 /* The following definitions come from libsmb/clioplock.c */
704 struct tevent_req *cli_smb_oplock_break_waiter_send(TALLOC_CTX *mem_ctx,
705 struct event_context *ev,
706 struct cli_state *cli);
707 NTSTATUS cli_smb_oplock_break_waiter_recv(struct tevent_req *req,
711 struct tevent_req *cli_oplock_ack_send(TALLOC_CTX *mem_ctx,
712 struct tevent_context *ev,
713 struct cli_state *cli,
714 uint16_t fnum, uint8_t level);
715 NTSTATUS cli_oplock_ack_recv(struct tevent_req *req);
717 /* The following definitions come from libsmb/cliprint.c */
719 int cli_print_queue(struct cli_state *cli,
720 void (*fn)(struct print_job_info *));
721 int cli_printjob_del(struct cli_state *cli, int job);
723 /* The following definitions come from libsmb/cliquota.c */
725 NTSTATUS cli_get_quota_handle(struct cli_state *cli, uint16_t *quota_fnum);
726 void free_ntquota_list(SMB_NTQUOTA_LIST **qt_list);
727 NTSTATUS cli_get_user_quota(struct cli_state *cli, int quota_fnum,
728 SMB_NTQUOTA_STRUCT *pqt);
729 NTSTATUS cli_set_user_quota(struct cli_state *cli, int quota_fnum,
730 SMB_NTQUOTA_STRUCT *pqt);
731 NTSTATUS cli_list_user_quota(struct cli_state *cli, int quota_fnum,
732 SMB_NTQUOTA_LIST **pqt_list);
733 NTSTATUS cli_get_fs_quota_info(struct cli_state *cli, int quota_fnum,
734 SMB_NTQUOTA_STRUCT *pqt);
735 NTSTATUS cli_set_fs_quota_info(struct cli_state *cli, int quota_fnum,
736 SMB_NTQUOTA_STRUCT *pqt);
738 /* The following definitions come from libsmb/clireadwrite.c */
740 struct tevent_req *cli_read_andx_create(TALLOC_CTX *mem_ctx,
741 struct event_context *ev,
742 struct cli_state *cli, uint16_t fnum,
743 off_t offset, size_t size,
744 struct tevent_req **psmbreq);
745 struct tevent_req *cli_read_andx_send(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 NTSTATUS cli_read_andx_recv(struct tevent_req *req, ssize_t *received,
751 struct tevent_req *cli_pull_send(TALLOC_CTX *mem_ctx,
752 struct event_context *ev,
753 struct cli_state *cli,
754 uint16_t fnum, off_t start_offset,
755 SMB_OFF_T size, size_t window_size,
756 NTSTATUS (*sink)(char *buf, size_t n,
759 NTSTATUS cli_pull_recv(struct tevent_req *req, SMB_OFF_T *received);
760 NTSTATUS cli_pull(struct cli_state *cli, uint16_t fnum,
761 off_t start_offset, SMB_OFF_T size, size_t window_size,
762 NTSTATUS (*sink)(char *buf, size_t n, void *priv),
763 void *priv, SMB_OFF_T *received);
764 NTSTATUS cli_read(struct cli_state *cli, uint16_t fnum,
765 char *buf, off_t offset, size_t size,
767 NTSTATUS cli_smbwrite(struct cli_state *cli, uint16_t fnum, char *buf,
768 off_t offset, size_t size1, size_t *ptotal);
769 struct tevent_req *cli_write_andx_create(TALLOC_CTX *mem_ctx,
770 struct event_context *ev,
771 struct cli_state *cli, uint16_t fnum,
772 uint16_t mode, const uint8_t *buf,
773 off_t offset, size_t size,
774 struct tevent_req **reqs_before,
776 struct tevent_req **psmbreq);
777 struct tevent_req *cli_write_andx_send(TALLOC_CTX *mem_ctx,
778 struct event_context *ev,
779 struct cli_state *cli, uint16_t fnum,
780 uint16_t mode, const uint8_t *buf,
781 off_t offset, size_t size);
782 NTSTATUS cli_write_andx_recv(struct tevent_req *req, size_t *pwritten);
784 NTSTATUS cli_writeall(struct cli_state *cli, uint16_t fnum, uint16_t mode,
785 const uint8_t *buf, off_t offset, size_t size,
788 struct tevent_req *cli_push_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
789 struct cli_state *cli,
790 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,
795 NTSTATUS cli_push_recv(struct tevent_req *req);
796 NTSTATUS cli_push(struct cli_state *cli, uint16_t fnum, uint16_t mode,
797 off_t start_offset, size_t window_size,
798 size_t (*source)(uint8_t *buf, size_t n, void *priv),
801 /* The following definitions come from libsmb/clisecdesc.c */
803 NTSTATUS cli_query_secdesc(struct cli_state *cli, uint16_t fnum,
804 TALLOC_CTX *mem_ctx, struct security_descriptor **sd);
805 NTSTATUS cli_set_secdesc(struct cli_state *cli, uint16_t fnum,
806 const struct security_descriptor *sd);
808 /* The following definitions come from libsmb/clistr.c */
810 size_t clistr_pull_talloc(TALLOC_CTX *ctx,
818 /* The following definitions come from libsmb/clitrans.c */
820 struct tevent_req *cli_trans_send(
821 TALLOC_CTX *mem_ctx, struct event_context *ev,
822 struct cli_state *cli, uint8_t cmd,
823 const char *pipe_name, uint16_t fid, uint16_t function, int flags,
824 uint16_t *setup, uint8_t num_setup, uint8_t max_setup,
825 uint8_t *param, uint32_t num_param, uint32_t max_param,
826 uint8_t *data, uint32_t num_data, uint32_t max_data);
827 NTSTATUS cli_trans_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
828 uint16_t *recv_flags2,
829 uint16_t **setup, uint8_t min_setup,
831 uint8_t **param, uint32_t min_param,
833 uint8_t **data, uint32_t min_data,
835 NTSTATUS cli_trans(TALLOC_CTX *mem_ctx, struct cli_state *cli,
837 const char *pipe_name, uint16_t fid, uint16_t function,
839 uint16_t *setup, uint8_t num_setup, uint8_t max_setup,
840 uint8_t *param, uint32_t num_param, uint32_t max_param,
841 uint8_t *data, uint32_t num_data, uint32_t max_data,
842 uint16_t *recv_flags2,
843 uint16_t **rsetup, uint8_t min_rsetup, uint8_t *num_rsetup,
844 uint8_t **rparam, uint32_t min_rparam, uint32_t *num_rparam,
845 uint8_t **rdata, uint32_t min_rdata, uint32_t *num_rdata);
847 /* The following definitions come from libsmb/smb_seal.c */
849 NTSTATUS get_enc_ctx_num(const uint8_t *buf, uint16 *p_enc_ctx_num);
850 bool common_encryption_on(struct smb_trans_enc_state *es);
851 NTSTATUS common_ntlm_decrypt_buffer(struct auth_ntlmssp_state *auth_ntlmssp_state, char *buf);
852 NTSTATUS common_ntlm_encrypt_buffer(struct auth_ntlmssp_state *auth_ntlmssp_state,
856 NTSTATUS common_encrypt_buffer(struct smb_trans_enc_state *es, char *buffer, char **buf_out);
857 NTSTATUS common_decrypt_buffer(struct smb_trans_enc_state *es, char *buf);
858 void common_free_encryption_state(struct smb_trans_enc_state **pp_es);
859 void common_free_enc_buffer(struct smb_trans_enc_state *es, char *buf);
860 bool cli_encryption_on(struct cli_state *cli);
861 void cli_free_encryption_context(struct cli_state *cli);
862 void cli_free_enc_buffer(struct cli_state *cli, char *buf);
864 /* The following definitions come from libsmb/clisigning.c */
866 bool cli_simple_set_signing(struct cli_state *cli,
867 const DATA_BLOB user_session_key,
868 const DATA_BLOB response);
869 void cli_calculate_sign_mac(struct cli_state *cli, char *buf, uint32_t *seqnum);
870 bool cli_check_sign_mac(struct cli_state *cli, const char *buf, uint32_t seqnum);
871 bool client_is_signing_on(struct cli_state *cli);
872 bool client_is_signing_allowed(struct cli_state *cli);
873 bool client_is_signing_mandatory(struct cli_state *cli);
874 bool cli_set_signing_negotiated(struct cli_state *cli,
875 bool allowed, bool mandatory);
877 /* The following definitions come from libsmb/reparse_symlink.c */
879 bool symlink_reparse_buffer_marshall(
880 const char *substitute, const char *printname, uint32_t flags,
881 TALLOC_CTX *mem_ctx, uint8_t **pdst, size_t *pdstlen);
882 bool symlink_reparse_buffer_parse(
883 const uint8_t *src, size_t srclen, TALLOC_CTX *mem_ctx,
884 char **psubstitute_name, char **pprint_name, uint32_t *pflags);
886 /* The following definitions come from libsmb/clisymlink.c */
888 struct tevent_req *cli_symlink_send(TALLOC_CTX *mem_ctx,
889 struct tevent_context *ev,
890 struct cli_state *cli,
894 NTSTATUS cli_symlink_recv(struct tevent_req *req);
895 NTSTATUS cli_symlink(struct cli_state *cli, const char *oldname,
896 const char *newname, uint32_t flags);
898 struct tevent_req *cli_readlink_send(TALLOC_CTX *mem_ctx,
899 struct tevent_context *ev,
900 struct cli_state *cli,
902 NTSTATUS cli_readlink_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
903 char **psubstitute_name, char **pprint_name,
905 NTSTATUS cli_readlink(struct cli_state *cli, const char *fname,
906 TALLOC_CTX *mem_ctx, char **psubstitute_name,
907 char **pprint_name, uint32_t *pflags);
909 #endif /* _LIBSMB_PROTO_H_ */