2 Unix SMB/CIFS implementation.
4 Copyright (C) Andrew Bartlett 2001-2003
5 Copyright (C) Andrew Tridgell 1994-1998,2000-2001
6 Copyright (C) Gerald (Jerry) Carter 2004
7 Copyright (C) Jelmer Vernooij 2003
8 Copyright (C) Jeremy Allison 2001-2009,2011
9 Copyright (C) Stefan Metzmacher 2003,2009
10 Copyright (C) Volker Lendecke 2011
12 This program is free software; you can redistribute it and/or modify
13 it under the terms of the GNU General Public License as published by
14 the Free Software Foundation; either version 3 of the License, or
15 (at your option) any later version.
17 This program is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License for more details.
22 You should have received a copy of the GNU General Public License
23 along with this program. If not, see <http://www.gnu.org/licenses/>.
26 #ifndef _LIBSMB_PROTO_H_
27 #define _LIBSMB_PROTO_H_
31 /* The following definitions come from libsmb/cliconnect.c */
33 NTSTATUS cli_session_setup(struct cli_state *cli,
35 const char *pass, int passlen,
36 const char *ntpass, int ntpasslen,
37 const char *workgroup);
38 struct tevent_req *cli_session_setup_guest_create(TALLOC_CTX *mem_ctx,
39 struct event_context *ev,
40 struct cli_state *cli,
41 struct tevent_req **psmbreq);
42 struct tevent_req *cli_session_setup_guest_send(TALLOC_CTX *mem_ctx,
43 struct event_context *ev,
44 struct cli_state *cli);
45 NTSTATUS cli_session_setup_guest_recv(struct tevent_req *req);
46 struct tevent_req *cli_ulogoff_send(TALLOC_CTX *mem_ctx,
47 struct tevent_context *ev,
48 struct cli_state *cli);
49 NTSTATUS cli_ulogoff_recv(struct tevent_req *req);
50 NTSTATUS cli_ulogoff(struct cli_state *cli);
51 struct tevent_req *cli_tcon_andx_create(TALLOC_CTX *mem_ctx,
52 struct event_context *ev,
53 struct cli_state *cli,
54 const char *share, const char *dev,
55 const char *pass, int passlen,
56 struct tevent_req **psmbreq);
57 struct tevent_req *cli_tcon_andx_send(TALLOC_CTX *mem_ctx,
58 struct event_context *ev,
59 struct cli_state *cli,
60 const char *share, const char *dev,
61 const char *pass, int passlen);
62 NTSTATUS cli_tcon_andx_recv(struct tevent_req *req);
63 NTSTATUS cli_tcon_andx(struct cli_state *cli, const char *share,
64 const char *dev, const char *pass, int passlen);
65 struct tevent_req *cli_tdis_send(TALLOC_CTX *mem_ctx,
66 struct tevent_context *ev,
67 struct cli_state *cli);
68 NTSTATUS cli_tdis_recv(struct tevent_req *req);
69 NTSTATUS cli_tdis(struct cli_state *cli);
70 NTSTATUS cli_negprot(struct cli_state *cli);
71 struct tevent_req *cli_negprot_send(TALLOC_CTX *mem_ctx,
72 struct event_context *ev,
73 struct cli_state *cli);
74 NTSTATUS cli_negprot_recv(struct tevent_req *req);
75 NTSTATUS cli_connect_nb(const char *host, const struct sockaddr_storage *dest_ss,
76 uint16_t port, int name_type, const char *myname,
77 int signing_state, int flags, struct cli_state **pcli);
78 NTSTATUS cli_start_connection(struct cli_state **output_cli,
80 const char *dest_host,
81 const struct sockaddr_storage *dest_ss, int port,
82 int signing_state, int flags);
83 NTSTATUS cli_full_connection(struct cli_state **output_cli,
85 const char *dest_host,
86 const struct sockaddr_storage *dest_ss, int port,
87 const char *service, const char *service_type,
88 const char *user, const char *domain,
89 const char *password, int flags,
91 NTSTATUS cli_raw_tcon(struct cli_state *cli,
92 const char *service, const char *pass, const char *dev,
93 uint16 *max_xmit, uint16 *tid);
94 struct cli_state *get_ipc_connect(char *server,
95 struct sockaddr_storage *server_ss,
96 const struct user_auth_info *user_info);
97 struct cli_state *get_ipc_connect_master_ip(TALLOC_CTX *ctx,
98 struct sockaddr_storage *mb_ip,
99 const struct user_auth_info *user_info,
100 char **pp_workgroup_out);
101 struct cli_state *get_ipc_connect_master_ip_bcast(TALLOC_CTX *ctx,
102 const struct user_auth_info *user_info,
103 char **pp_workgroup_out);
105 /* The following definitions come from libsmb/clidfs.c */
107 NTSTATUS cli_cm_force_encryption(struct cli_state *c,
108 const char *username,
109 const char *password,
111 const char *sharename);
112 NTSTATUS cli_cm_open(TALLOC_CTX *ctx,
113 struct cli_state *referring_cli,
116 const struct user_auth_info *auth_info,
122 struct cli_state **pcli);
123 void cli_cm_display(struct cli_state *c);
124 struct client_dfs_referral;
125 NTSTATUS cli_dfs_get_referral(TALLOC_CTX *ctx,
126 struct cli_state *cli,
128 struct client_dfs_referral **refs,
131 NTSTATUS cli_resolve_path(TALLOC_CTX *ctx,
133 const struct user_auth_info *dfs_auth_info,
134 struct cli_state *rootcli,
136 struct cli_state **targetcli,
137 char **pp_targetpath);
139 bool cli_check_msdfs_proxy(TALLOC_CTX *ctx,
140 struct cli_state *cli,
141 const char *sharename,
145 const char *username,
146 const char *password,
149 /* The following definitions come from libsmb/clientgen.c */
151 int cli_set_message(char *buf,int num_words,int num_bytes,bool zero);
152 unsigned int cli_set_timeout(struct cli_state *cli, unsigned int timeout);
153 void cli_setup_packet_buf(struct cli_state *cli, char *buf);
154 NTSTATUS cli_set_domain(struct cli_state *cli, const char *domain);
155 NTSTATUS cli_set_username(struct cli_state *cli, const char *username);
156 NTSTATUS cli_set_password(struct cli_state *cli, const char *password);
157 NTSTATUS cli_init_creds(struct cli_state *cli, const char *username, const char *domain, const char *password);
158 struct cli_state *cli_state_create(TALLOC_CTX *mem_ctx,
160 const char *remote_name,
161 const char *remote_realm,
164 bool cli_state_encryption_on(struct cli_state *cli);
165 void cli_nt_pipes_close(struct cli_state *cli);
166 void cli_shutdown(struct cli_state *cli);
167 void cli_sockopt(struct cli_state *cli, const char *options);
168 const struct sockaddr_storage *cli_state_local_sockaddr(struct cli_state *cli);
169 const struct sockaddr_storage *cli_state_remote_sockaddr(struct cli_state *cli);
170 const char *cli_state_remote_name(struct cli_state *cli);
171 const char *cli_state_remote_realm(struct cli_state *cli);
172 uint16_t cli_state_get_vc_num(struct cli_state *cli);
173 uint32_t cli_state_server_session_key(struct cli_state *cli);
174 uint16 cli_setpid(struct cli_state *cli, uint16 pid);
175 uint16_t cli_getpid(struct cli_state *cli);
176 bool cli_state_has_tcon(struct cli_state *cli);
177 uint16_t cli_state_get_tid(struct cli_state *cli);
178 uint16_t cli_state_set_tid(struct cli_state *cli, uint16_t tid);
179 uint16_t cli_state_get_uid(struct cli_state *cli);
180 uint16_t cli_state_set_uid(struct cli_state *cli, uint16_t uid);
181 bool cli_set_case_sensitive(struct cli_state *cli, bool case_sensitive);
182 enum protocol_types cli_state_protocol(struct cli_state *cli);
183 uint32_t cli_state_capabilities(struct cli_state *cli);
184 uint32_t cli_state_available_size(struct cli_state *cli, uint32_t ofs);
185 uint16_t cli_state_max_requests(struct cli_state *cli);
186 uint16_t cli_state_security_mode(struct cli_state *cli);
187 int cli_state_server_time_zone(struct cli_state *cli);
188 struct tevent_req *cli_echo_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
189 struct cli_state *cli, uint16_t num_echos,
191 NTSTATUS cli_echo_recv(struct tevent_req *req);
192 NTSTATUS cli_echo(struct cli_state *cli, uint16_t num_echos, DATA_BLOB data);
193 bool cli_ucs2(struct cli_state *cli);
194 bool is_andx_req(uint8_t cmd);
195 NTSTATUS cli_smb(TALLOC_CTX *mem_ctx, struct cli_state *cli,
196 uint8_t smb_command, uint8_t additional_flags,
197 uint8_t wct, uint16_t *vwv,
198 uint32_t num_bytes, const uint8_t *bytes,
199 struct tevent_req **result_parent,
200 uint8_t min_wct, uint8_t *pwct, uint16_t **pvwv,
201 uint32_t *pnum_bytes, uint8_t **pbytes);
203 /* The following definitions come from libsmb/clierror.c */
205 const char *cli_errstr(struct cli_state *cli);
206 NTSTATUS cli_nt_error(struct cli_state *cli);
207 void cli_dos_error(struct cli_state *cli, uint8 *eclass, uint32 *ecode);
208 int cli_errno(struct cli_state *cli);
209 bool cli_is_error(struct cli_state *cli);
210 bool cli_is_nt_error(struct cli_state *cli);
211 bool cli_is_dos_error(struct cli_state *cli);
212 bool cli_state_is_connected(struct cli_state *cli);
213 void cli_state_disconnect(struct cli_state *cli);
215 /* The following definitions come from libsmb/clifile.c */
217 struct tevent_req *cli_setpathinfo_send(TALLOC_CTX *mem_ctx,
218 struct tevent_context *ev,
219 struct cli_state *cli,
224 NTSTATUS cli_setpathinfo_recv(struct tevent_req *req);
225 NTSTATUS cli_setpathinfo(struct cli_state *cli,
231 struct tevent_req *cli_posix_symlink_send(TALLOC_CTX *mem_ctx,
232 struct event_context *ev,
233 struct cli_state *cli,
235 const char *newname);
236 NTSTATUS cli_posix_symlink_recv(struct tevent_req *req);
237 NTSTATUS cli_posix_symlink(struct cli_state *cli,
239 const char *newname);
240 struct tevent_req *cli_posix_readlink_send(TALLOC_CTX *mem_ctx,
241 struct event_context *ev,
242 struct cli_state *cli,
245 NTSTATUS cli_posix_readlink_recv(struct tevent_req *req, struct cli_state *cli,
246 char *retpath, size_t len);
247 NTSTATUS cli_posix_readlink(struct cli_state *cli, const char *fname,
248 char *linkpath, size_t len);
249 struct tevent_req *cli_posix_hardlink_send(TALLOC_CTX *mem_ctx,
250 struct event_context *ev,
251 struct cli_state *cli,
253 const char *newname);
254 NTSTATUS cli_posix_hardlink_recv(struct tevent_req *req);
255 NTSTATUS cli_posix_hardlink(struct cli_state *cli,
257 const char *newname);
258 uint32_t unix_perms_to_wire(mode_t perms);
259 mode_t wire_perms_to_unix(uint32_t perms);
260 struct tevent_req *cli_posix_getfacl_send(TALLOC_CTX *mem_ctx,
261 struct event_context *ev,
262 struct cli_state *cli,
264 NTSTATUS cli_posix_getfacl_recv(struct tevent_req *req,
268 NTSTATUS cli_posix_getfacl(struct cli_state *cli,
273 struct tevent_req *cli_posix_stat_send(TALLOC_CTX *mem_ctx,
274 struct event_context *ev,
275 struct cli_state *cli,
277 NTSTATUS cli_posix_stat_recv(struct tevent_req *req,
278 SMB_STRUCT_STAT *sbuf);
279 NTSTATUS cli_posix_stat(struct cli_state *cli,
281 SMB_STRUCT_STAT *sbuf);
282 struct tevent_req *cli_posix_chmod_send(TALLOC_CTX *mem_ctx,
283 struct event_context *ev,
284 struct cli_state *cli,
287 NTSTATUS cli_posix_chmod_recv(struct tevent_req *req);
288 NTSTATUS cli_posix_chmod(struct cli_state *cli, const char *fname, mode_t mode);
289 struct tevent_req *cli_posix_chown_send(TALLOC_CTX *mem_ctx,
290 struct event_context *ev,
291 struct cli_state *cli,
295 NTSTATUS cli_posix_chown_recv(struct tevent_req *req);
296 NTSTATUS cli_posix_chown(struct cli_state *cli,
300 struct tevent_req *cli_rename_send(TALLOC_CTX *mem_ctx,
301 struct event_context *ev,
302 struct cli_state *cli,
303 const char *fname_src,
304 const char *fname_dst);
305 NTSTATUS cli_rename_recv(struct tevent_req *req);
306 NTSTATUS cli_rename(struct cli_state *cli, const char *fname_src, const char *fname_dst);
307 struct tevent_req *cli_ntrename_send(TALLOC_CTX *mem_ctx,
308 struct event_context *ev,
309 struct cli_state *cli,
310 const char *fname_src,
311 const char *fname_dst);
312 NTSTATUS cli_ntrename_recv(struct tevent_req *req);
313 NTSTATUS cli_ntrename(struct cli_state *cli, const char *fname_src, const char *fname_dst);
315 struct tevent_req *cli_nt_hardlink_send(TALLOC_CTX *mem_ctx,
316 struct event_context *ev,
317 struct cli_state *cli,
318 const char *fname_src,
319 const char *fname_dst);
320 NTSTATUS cli_nt_hardlink_recv(struct tevent_req *req);
321 NTSTATUS cli_nt_hardlink(struct cli_state *cli, const char *fname_src, const char *fname_dst);
323 struct tevent_req *cli_unlink_send(TALLOC_CTX *mem_ctx,
324 struct event_context *ev,
325 struct cli_state *cli,
327 uint16_t mayhave_attrs);
328 NTSTATUS cli_unlink_recv(struct tevent_req *req);
329 NTSTATUS cli_unlink(struct cli_state *cli, const char *fname, uint16_t mayhave_attrs);
331 struct tevent_req *cli_mkdir_send(TALLOC_CTX *mem_ctx,
332 struct event_context *ev,
333 struct cli_state *cli,
335 NTSTATUS cli_mkdir_recv(struct tevent_req *req);
336 NTSTATUS cli_mkdir(struct cli_state *cli, const char *dname);
337 struct tevent_req *cli_rmdir_send(TALLOC_CTX *mem_ctx,
338 struct event_context *ev,
339 struct cli_state *cli,
341 NTSTATUS cli_rmdir_recv(struct tevent_req *req);
342 NTSTATUS cli_rmdir(struct cli_state *cli, const char *dname);
343 struct tevent_req *cli_nt_delete_on_close_send(TALLOC_CTX *mem_ctx,
344 struct event_context *ev,
345 struct cli_state *cli,
348 NTSTATUS cli_nt_delete_on_close_recv(struct tevent_req *req);
349 NTSTATUS cli_nt_delete_on_close(struct cli_state *cli, uint16_t fnum, bool flag);
350 struct tevent_req *cli_ntcreate_send(TALLOC_CTX *mem_ctx,
351 struct event_context *ev,
352 struct cli_state *cli,
355 uint32_t DesiredAccess,
356 uint32_t FileAttributes,
357 uint32_t ShareAccess,
358 uint32_t CreateDisposition,
359 uint32_t CreateOptions,
360 uint8_t SecurityFlags);
361 NTSTATUS cli_ntcreate_recv(struct tevent_req *req, uint16_t *pfnum);
362 NTSTATUS cli_ntcreate(struct cli_state *cli,
365 uint32_t DesiredAccess,
366 uint32_t FileAttributes,
367 uint32_t ShareAccess,
368 uint32_t CreateDisposition,
369 uint32_t CreateOptions,
370 uint8_t SecurityFlags,
372 uint8_t *smb_bytes_push_str(uint8_t *buf, bool ucs2, const char *str,
373 size_t str_len, size_t *pconverted_size);
374 uint8_t *smb_bytes_push_bytes(uint8_t *buf, uint8_t prefix,
375 const uint8_t *bytes, size_t num_bytes);
376 uint8_t *trans2_bytes_push_str(uint8_t *buf, bool ucs2,
377 const char *str, size_t str_len,
378 size_t *pconverted_size);
379 uint8_t *trans2_bytes_push_bytes(uint8_t *buf,
380 const uint8_t *bytes, size_t num_bytes);
381 struct tevent_req *cli_open_create(TALLOC_CTX *mem_ctx,
382 struct event_context *ev,
383 struct cli_state *cli, const char *fname,
384 int flags, int share_mode,
385 struct tevent_req **psmbreq);
386 struct tevent_req *cli_open_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
387 struct cli_state *cli, const char *fname,
388 int flags, int share_mode);
389 NTSTATUS cli_open_recv(struct tevent_req *req, uint16_t *fnum);
390 NTSTATUS cli_open(struct cli_state *cli, const char *fname, int flags, int share_mode, uint16_t *pfnum);
391 struct tevent_req *cli_close_create(TALLOC_CTX *mem_ctx,
392 struct event_context *ev,
393 struct cli_state *cli, uint16_t fnum,
394 struct tevent_req **psubreq);
395 struct tevent_req *cli_close_send(TALLOC_CTX *mem_ctx,
396 struct event_context *ev,
397 struct cli_state *cli, uint16_t fnum);
398 NTSTATUS cli_close_recv(struct tevent_req *req);
399 NTSTATUS cli_close(struct cli_state *cli, uint16_t fnum);
400 struct tevent_req *cli_ftruncate_send(TALLOC_CTX *mem_ctx,
401 struct event_context *ev,
402 struct cli_state *cli,
405 NTSTATUS cli_ftruncate_recv(struct tevent_req *req);
406 NTSTATUS cli_ftruncate(struct cli_state *cli, uint16_t fnum, uint64_t size);
407 NTSTATUS cli_locktype(struct cli_state *cli, uint16_t fnum,
408 uint32_t offset, uint32_t len,
409 int timeout, unsigned char locktype);
410 NTSTATUS cli_lock32(struct cli_state *cli, uint16_t fnum, uint32_t offset,
411 uint32_t len, int timeout, enum brl_type lock_type);
412 struct tevent_req *cli_unlock_send(TALLOC_CTX *mem_ctx,
413 struct event_context *ev,
414 struct cli_state *cli,
418 NTSTATUS cli_unlock_recv(struct tevent_req *req);
419 NTSTATUS cli_unlock(struct cli_state *cli, uint16_t fnum, uint32_t offset, uint32_t len);
420 NTSTATUS cli_lock64(struct cli_state *cli, uint16_t fnum,
421 uint64_t offset, uint64_t len, int timeout,
422 enum brl_type lock_type);
423 struct tevent_req *cli_unlock64_send(TALLOC_CTX *mem_ctx,
424 struct event_context *ev,
425 struct cli_state *cli,
429 NTSTATUS cli_unlock64_recv(struct tevent_req *req);
430 NTSTATUS cli_unlock64(struct cli_state *cli, uint16_t fnum, uint64_t offset, uint64_t len);
431 struct tevent_req *cli_posix_lock_send(TALLOC_CTX *mem_ctx,
432 struct event_context *ev,
433 struct cli_state *cli,
438 enum brl_type lock_type);
439 NTSTATUS cli_posix_lock_recv(struct tevent_req *req);
440 NTSTATUS cli_posix_lock(struct cli_state *cli, uint16_t fnum,
441 uint64_t offset, uint64_t len,
442 bool wait_lock, enum brl_type lock_type);
443 struct tevent_req *cli_posix_unlock_send(TALLOC_CTX *mem_ctx,
444 struct event_context *ev,
445 struct cli_state *cli,
449 NTSTATUS cli_posix_unlock_recv(struct tevent_req *req);
450 NTSTATUS cli_posix_unlock(struct cli_state *cli, uint16_t fnum, uint64_t offset, uint64_t len);
451 struct tevent_req *cli_getattrE_send(TALLOC_CTX *mem_ctx,
452 struct event_context *ev,
453 struct cli_state *cli,
455 NTSTATUS cli_getattrE_recv(struct tevent_req *req,
461 NTSTATUS cli_getattrE(struct cli_state *cli,
468 struct tevent_req *cli_setattrE_send(TALLOC_CTX *mem_ctx,
469 struct event_context *ev,
470 struct cli_state *cli,
475 NTSTATUS cli_setattrE_recv(struct tevent_req *req);
476 NTSTATUS cli_setattrE(struct cli_state *cli,
481 struct tevent_req *cli_getatr_send(TALLOC_CTX *mem_ctx,
482 struct event_context *ev,
483 struct cli_state *cli,
485 NTSTATUS cli_getatr_recv(struct tevent_req *req,
489 NTSTATUS cli_getatr(struct cli_state *cli,
494 struct tevent_req *cli_setatr_send(TALLOC_CTX *mem_ctx,
495 struct event_context *ev,
496 struct cli_state *cli,
500 NTSTATUS cli_setatr_recv(struct tevent_req *req);
501 NTSTATUS cli_setatr(struct cli_state *cli,
505 struct tevent_req *cli_chkpath_send(TALLOC_CTX *mem_ctx,
506 struct event_context *ev,
507 struct cli_state *cli,
509 NTSTATUS cli_chkpath_recv(struct tevent_req *req);
510 NTSTATUS cli_chkpath(struct cli_state *cli, const char *path);
511 struct tevent_req *cli_dskattr_send(TALLOC_CTX *mem_ctx,
512 struct event_context *ev,
513 struct cli_state *cli);
514 NTSTATUS cli_dskattr_recv(struct tevent_req *req, int *bsize, int *total,
516 NTSTATUS cli_dskattr(struct cli_state *cli, int *bsize, int *total, int *avail);
517 struct tevent_req *cli_ctemp_send(TALLOC_CTX *mem_ctx,
518 struct event_context *ev,
519 struct cli_state *cli,
521 NTSTATUS cli_ctemp_recv(struct tevent_req *req,
525 NTSTATUS cli_ctemp(struct cli_state *cli,
530 NTSTATUS cli_raw_ioctl(struct cli_state *cli, uint16_t fnum, uint32_t code, DATA_BLOB *blob);
531 NTSTATUS cli_set_ea_path(struct cli_state *cli, const char *path,
532 const char *ea_name, const char *ea_val,
534 NTSTATUS cli_set_ea_fnum(struct cli_state *cli, uint16_t fnum,
535 const char *ea_name, const char *ea_val,
537 struct tevent_req *cli_get_ea_list_path_send(TALLOC_CTX *mem_ctx,
538 struct tevent_context *ev,
539 struct cli_state *cli,
541 NTSTATUS cli_get_ea_list_path_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
542 size_t *pnum_eas, struct ea_struct **peas);
543 NTSTATUS cli_get_ea_list_path(struct cli_state *cli, const char *path,
546 struct ea_struct **pea_list);
547 struct tevent_req *cli_posix_open_send(TALLOC_CTX *mem_ctx,
548 struct event_context *ev,
549 struct cli_state *cli,
553 NTSTATUS cli_posix_open_recv(struct tevent_req *req, uint16_t *pfnum);
554 NTSTATUS cli_posix_open(struct cli_state *cli, const char *fname,
555 int flags, mode_t mode, uint16_t *fnum);
556 struct tevent_req *cli_posix_mkdir_send(TALLOC_CTX *mem_ctx,
557 struct event_context *ev,
558 struct cli_state *cli,
561 NTSTATUS cli_posix_mkdir_recv(struct tevent_req *req);
562 NTSTATUS cli_posix_mkdir(struct cli_state *cli, const char *fname, mode_t mode);
564 struct tevent_req *cli_posix_unlink_send(TALLOC_CTX *mem_ctx,
565 struct event_context *ev,
566 struct cli_state *cli,
568 NTSTATUS cli_posix_unlink_recv(struct tevent_req *req);
569 NTSTATUS cli_posix_unlink(struct cli_state *cli, const char *fname);
571 struct tevent_req *cli_posix_rmdir_send(TALLOC_CTX *mem_ctx,
572 struct event_context *ev,
573 struct cli_state *cli,
575 NTSTATUS cli_posix_rmdir_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx);
576 NTSTATUS cli_posix_rmdir(struct cli_state *cli, const char *fname);
577 struct tevent_req *cli_notify_send(TALLOC_CTX *mem_ctx,
578 struct tevent_context *ev,
579 struct cli_state *cli, uint16_t fnum,
580 uint32_t buffer_size,
581 uint32_t completion_filter, bool recursive);
582 NTSTATUS cli_notify_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
583 uint32_t *pnum_changes,
584 struct notify_change **pchanges);
586 struct tevent_req *cli_nttrans_create_send(TALLOC_CTX *mem_ctx,
587 struct event_context *ev,
588 struct cli_state *cli,
591 uint32_t DesiredAccess,
592 uint32_t FileAttributes,
593 uint32_t ShareAccess,
594 uint32_t CreateDisposition,
595 uint32_t CreateOptions,
596 uint8_t SecurityFlags,
597 struct security_descriptor *secdesc,
598 struct ea_struct *eas,
600 NTSTATUS cli_nttrans_create_recv(struct tevent_req *req, uint16_t *fnum);
601 NTSTATUS cli_nttrans_create(struct cli_state *cli,
604 uint32_t DesiredAccess,
605 uint32_t FileAttributes,
606 uint32_t ShareAccess,
607 uint32_t CreateDisposition,
608 uint32_t CreateOptions,
609 uint8_t SecurityFlags,
610 struct security_descriptor *secdesc,
611 struct ea_struct *eas,
615 /* The following definitions come from libsmb/clifsinfo.c */
617 struct tevent_req *cli_unix_extensions_version_send(TALLOC_CTX *mem_ctx,
618 struct tevent_context *ev,
619 struct cli_state *cli);
620 NTSTATUS cli_unix_extensions_version_recv(struct tevent_req *req,
621 uint16_t *pmajor, uint16_t *pminor,
624 NTSTATUS cli_unix_extensions_version(struct cli_state *cli, uint16 *pmajor,
625 uint16 *pminor, uint32 *pcaplow,
627 struct tevent_req *cli_set_unix_extensions_capabilities_send(
628 TALLOC_CTX *mem_ctx, struct tevent_context *ev, struct cli_state *cli,
629 uint16_t major, uint16_t minor, uint32_t caplow, uint32_t caphigh);
630 NTSTATUS cli_set_unix_extensions_capabilities_recv(struct tevent_req *req);
631 NTSTATUS cli_set_unix_extensions_capabilities(struct cli_state *cli,
632 uint16 major, uint16 minor,
633 uint32 caplow, uint32 caphigh);
634 struct tevent_req *cli_get_fs_attr_info_send(TALLOC_CTX *mem_ctx,
635 struct tevent_context *ev,
636 struct cli_state *cli);
637 NTSTATUS cli_get_fs_attr_info_recv(struct tevent_req *req, uint32_t *fs_attr);
638 NTSTATUS cli_get_fs_attr_info(struct cli_state *cli, uint32_t *fs_attr);
639 NTSTATUS cli_get_fs_volume_info(struct cli_state *cli,
640 TALLOC_CTX *mem_ctx, char **volume_name,
641 uint32 *pserial_number, time_t *pdate);
642 NTSTATUS cli_get_fs_full_size_info(struct cli_state *cli,
643 uint64_t *total_allocation_units,
644 uint64_t *caller_allocation_units,
645 uint64_t *actual_allocation_units,
646 uint64_t *sectors_per_allocation_unit,
647 uint64_t *bytes_per_sector);
648 NTSTATUS cli_get_posix_fs_info(struct cli_state *cli,
649 uint32 *optimal_transfer_size,
651 uint64_t *total_blocks,
652 uint64_t *blocks_available,
653 uint64_t *user_blocks_available,
654 uint64_t *total_file_nodes,
655 uint64_t *free_file_nodes,
656 uint64_t *fs_identifier);
657 NTSTATUS cli_raw_ntlm_smb_encryption_start(struct cli_state *cli,
661 NTSTATUS cli_gss_smb_encryption_start(struct cli_state *cli);
662 NTSTATUS cli_force_encryption(struct cli_state *c,
663 const char *username,
664 const char *password,
667 /* The following definitions come from libsmb/clilist.c */
669 NTSTATUS cli_list_old(struct cli_state *cli,const char *Mask,uint16 attribute,
670 NTSTATUS (*fn)(const char *, struct file_info *,
671 const char *, void *), void *state);
672 NTSTATUS cli_list_trans(struct cli_state *cli, const char *mask,
673 uint16_t attribute, int info_level,
674 NTSTATUS (*fn)(const char *mnt, struct file_info *finfo,
675 const char *mask, void *private_data),
677 struct tevent_req *cli_list_send(TALLOC_CTX *mem_ctx,
678 struct tevent_context *ev,
679 struct cli_state *cli,
682 uint16_t info_level);
683 NTSTATUS cli_list_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
684 struct file_info **finfo, size_t *num_finfo);
685 NTSTATUS cli_list(struct cli_state *cli,const char *Mask,uint16 attribute,
686 NTSTATUS (*fn)(const char *, struct file_info *, const char *,
687 void *), void *state);
689 /* The following definitions come from libsmb/climessage.c */
691 struct tevent_req *cli_message_send(TALLOC_CTX *mem_ctx,
692 struct tevent_context *ev,
693 struct cli_state *cli,
694 const char *host, const char *username,
695 const char *message);
696 NTSTATUS cli_message_recv(struct tevent_req *req);
697 NTSTATUS cli_message(struct cli_state *cli, const char *host,
698 const char *username, const char *message);
700 /* The following definitions come from libsmb/clioplock.c */
702 struct tevent_req *cli_smb_oplock_break_waiter_send(TALLOC_CTX *mem_ctx,
703 struct event_context *ev,
704 struct cli_state *cli);
705 NTSTATUS cli_smb_oplock_break_waiter_recv(struct tevent_req *req,
709 struct tevent_req *cli_oplock_ack_send(TALLOC_CTX *mem_ctx,
710 struct tevent_context *ev,
711 struct cli_state *cli,
712 uint16_t fnum, uint8_t level);
713 NTSTATUS cli_oplock_ack_recv(struct tevent_req *req);
715 /* The following definitions come from libsmb/cliprint.c */
717 int cli_print_queue(struct cli_state *cli,
718 void (*fn)(struct print_job_info *));
719 int cli_printjob_del(struct cli_state *cli, int job);
721 /* The following definitions come from libsmb/cliquota.c */
723 NTSTATUS cli_get_quota_handle(struct cli_state *cli, uint16_t *quota_fnum);
724 void free_ntquota_list(SMB_NTQUOTA_LIST **qt_list);
725 NTSTATUS cli_get_user_quota(struct cli_state *cli, int quota_fnum,
726 SMB_NTQUOTA_STRUCT *pqt);
727 NTSTATUS cli_set_user_quota(struct cli_state *cli, int quota_fnum,
728 SMB_NTQUOTA_STRUCT *pqt);
729 NTSTATUS cli_list_user_quota(struct cli_state *cli, int quota_fnum,
730 SMB_NTQUOTA_LIST **pqt_list);
731 NTSTATUS cli_get_fs_quota_info(struct cli_state *cli, int quota_fnum,
732 SMB_NTQUOTA_STRUCT *pqt);
733 NTSTATUS cli_set_fs_quota_info(struct cli_state *cli, int quota_fnum,
734 SMB_NTQUOTA_STRUCT *pqt);
736 /* The following definitions come from libsmb/clireadwrite.c */
738 struct tevent_req *cli_read_andx_create(TALLOC_CTX *mem_ctx,
739 struct event_context *ev,
740 struct cli_state *cli, uint16_t fnum,
741 off_t offset, size_t size,
742 struct tevent_req **psmbreq);
743 struct tevent_req *cli_read_andx_send(TALLOC_CTX *mem_ctx,
744 struct event_context *ev,
745 struct cli_state *cli, uint16_t fnum,
746 off_t offset, size_t size);
747 NTSTATUS cli_read_andx_recv(struct tevent_req *req, ssize_t *received,
749 struct tevent_req *cli_pull_send(TALLOC_CTX *mem_ctx,
750 struct event_context *ev,
751 struct cli_state *cli,
752 uint16_t fnum, off_t start_offset,
753 SMB_OFF_T size, size_t window_size,
754 NTSTATUS (*sink)(char *buf, size_t n,
757 NTSTATUS cli_pull_recv(struct tevent_req *req, SMB_OFF_T *received);
758 NTSTATUS cli_pull(struct cli_state *cli, uint16_t fnum,
759 off_t start_offset, SMB_OFF_T size, size_t window_size,
760 NTSTATUS (*sink)(char *buf, size_t n, void *priv),
761 void *priv, SMB_OFF_T *received);
762 NTSTATUS cli_read(struct cli_state *cli, uint16_t fnum,
763 char *buf, off_t offset, size_t size,
765 NTSTATUS cli_smbwrite(struct cli_state *cli, uint16_t fnum, char *buf,
766 off_t offset, size_t size1, size_t *ptotal);
767 struct tevent_req *cli_write_andx_create(TALLOC_CTX *mem_ctx,
768 struct event_context *ev,
769 struct cli_state *cli, uint16_t fnum,
770 uint16_t mode, const uint8_t *buf,
771 off_t offset, size_t size,
772 struct tevent_req **reqs_before,
774 struct tevent_req **psmbreq);
775 struct tevent_req *cli_write_andx_send(TALLOC_CTX *mem_ctx,
776 struct event_context *ev,
777 struct cli_state *cli, uint16_t fnum,
778 uint16_t mode, const uint8_t *buf,
779 off_t offset, size_t size);
780 NTSTATUS cli_write_andx_recv(struct tevent_req *req, size_t *pwritten);
782 NTSTATUS cli_writeall(struct cli_state *cli, uint16_t fnum, uint16_t mode,
783 const uint8_t *buf, off_t offset, size_t size,
786 struct tevent_req *cli_push_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
787 struct cli_state *cli,
788 uint16_t fnum, uint16_t mode,
789 off_t start_offset, size_t window_size,
790 size_t (*source)(uint8_t *buf, size_t n,
793 NTSTATUS cli_push_recv(struct tevent_req *req);
794 NTSTATUS cli_push(struct cli_state *cli, uint16_t fnum, uint16_t mode,
795 off_t start_offset, size_t window_size,
796 size_t (*source)(uint8_t *buf, size_t n, void *priv),
799 /* The following definitions come from libsmb/clisecdesc.c */
801 NTSTATUS cli_query_secdesc(struct cli_state *cli, uint16_t fnum,
802 TALLOC_CTX *mem_ctx, struct security_descriptor **sd);
803 NTSTATUS cli_set_secdesc(struct cli_state *cli, uint16_t fnum,
804 const struct security_descriptor *sd);
806 /* The following definitions come from libsmb/clistr.c */
808 size_t clistr_pull_talloc(TALLOC_CTX *ctx,
816 /* The following definitions come from libsmb/clitrans.c */
818 struct tevent_req *cli_trans_send(
819 TALLOC_CTX *mem_ctx, struct event_context *ev,
820 struct cli_state *cli, uint8_t cmd,
821 const char *pipe_name, uint16_t fid, uint16_t function, int flags,
822 uint16_t *setup, uint8_t num_setup, uint8_t max_setup,
823 uint8_t *param, uint32_t num_param, uint32_t max_param,
824 uint8_t *data, uint32_t num_data, uint32_t max_data);
825 NTSTATUS cli_trans_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
826 uint16_t *recv_flags2,
827 uint16_t **setup, uint8_t min_setup,
829 uint8_t **param, uint32_t min_param,
831 uint8_t **data, uint32_t min_data,
833 NTSTATUS cli_trans(TALLOC_CTX *mem_ctx, struct cli_state *cli,
835 const char *pipe_name, uint16_t fid, uint16_t function,
837 uint16_t *setup, uint8_t num_setup, uint8_t max_setup,
838 uint8_t *param, uint32_t num_param, uint32_t max_param,
839 uint8_t *data, uint32_t num_data, uint32_t max_data,
840 uint16_t *recv_flags2,
841 uint16_t **rsetup, uint8_t min_rsetup, uint8_t *num_rsetup,
842 uint8_t **rparam, uint32_t min_rparam, uint32_t *num_rparam,
843 uint8_t **rdata, uint32_t min_rdata, uint32_t *num_rdata);
845 /* The following definitions come from libsmb/smb_seal.c */
847 NTSTATUS get_enc_ctx_num(const uint8_t *buf, uint16 *p_enc_ctx_num);
848 bool common_encryption_on(struct smb_trans_enc_state *es);
849 NTSTATUS common_ntlm_decrypt_buffer(struct auth_ntlmssp_state *auth_ntlmssp_state, char *buf);
850 NTSTATUS common_ntlm_encrypt_buffer(struct auth_ntlmssp_state *auth_ntlmssp_state,
854 NTSTATUS common_encrypt_buffer(struct smb_trans_enc_state *es, char *buffer, char **buf_out);
855 NTSTATUS common_decrypt_buffer(struct smb_trans_enc_state *es, char *buf);
856 void common_free_encryption_state(struct smb_trans_enc_state **pp_es);
857 void common_free_enc_buffer(struct smb_trans_enc_state *es, char *buf);
858 bool cli_encryption_on(struct cli_state *cli);
859 void cli_free_encryption_context(struct cli_state *cli);
860 void cli_free_enc_buffer(struct cli_state *cli, char *buf);
862 /* The following definitions come from libsmb/clisigning.c */
864 bool cli_simple_set_signing(struct cli_state *cli,
865 const DATA_BLOB user_session_key,
866 const DATA_BLOB response);
867 bool cli_temp_set_signing(struct cli_state *cli);
868 void cli_calculate_sign_mac(struct cli_state *cli, char *buf, uint32_t *seqnum);
869 bool cli_check_sign_mac(struct cli_state *cli, const char *buf, uint32_t seqnum);
870 bool client_is_signing_on(struct cli_state *cli);
871 bool client_is_signing_allowed(struct cli_state *cli);
872 bool client_is_signing_mandatory(struct cli_state *cli);
873 void cli_set_signing_negotiated(struct cli_state *cli);
875 /* The following definitions come from libsmb/reparse_symlink.c */
877 bool symlink_reparse_buffer_marshall(
878 const char *substitute, const char *printname, uint32_t flags,
879 TALLOC_CTX *mem_ctx, uint8_t **pdst, size_t *pdstlen);
880 bool symlink_reparse_buffer_parse(
881 const uint8_t *src, size_t srclen, TALLOC_CTX *mem_ctx,
882 char **psubstitute_name, char **pprint_name, uint32_t *pflags);
884 /* The following definitions come from libsmb/clisymlink.c */
886 struct tevent_req *cli_symlink_send(TALLOC_CTX *mem_ctx,
887 struct tevent_context *ev,
888 struct cli_state *cli,
892 NTSTATUS cli_symlink_recv(struct tevent_req *req);
893 NTSTATUS cli_symlink(struct cli_state *cli, const char *oldname,
894 const char *newname, uint32_t flags);
896 struct tevent_req *cli_readlink_send(TALLOC_CTX *mem_ctx,
897 struct tevent_context *ev,
898 struct cli_state *cli,
900 NTSTATUS cli_readlink_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
901 char **psubstitute_name, char **pprint_name,
903 NTSTATUS cli_readlink(struct cli_state *cli, const char *fname,
904 TALLOC_CTX *mem_ctx, char **psubstitute_name,
905 char **pprint_name, uint32_t *pflags);
907 #endif /* _LIBSMB_PROTO_H_ */