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 ADS_STATUS cli_session_setup_spnego(struct cli_state *cli, const char *user,
34 const char *pass, const char *user_domain,
35 const char * dest_realm);
37 NTSTATUS cli_session_setup(struct cli_state *cli,
39 const char *pass, int passlen,
40 const char *ntpass, int ntpasslen,
41 const char *workgroup);
42 struct tevent_req *cli_session_setup_guest_create(TALLOC_CTX *mem_ctx,
43 struct event_context *ev,
44 struct cli_state *cli,
45 struct tevent_req **psmbreq);
46 struct tevent_req *cli_session_setup_guest_send(TALLOC_CTX *mem_ctx,
47 struct event_context *ev,
48 struct cli_state *cli);
49 NTSTATUS cli_session_setup_guest_recv(struct tevent_req *req);
50 struct tevent_req *cli_ulogoff_send(TALLOC_CTX *mem_ctx,
51 struct tevent_context *ev,
52 struct cli_state *cli);
53 NTSTATUS cli_ulogoff_recv(struct tevent_req *req);
54 NTSTATUS cli_ulogoff(struct cli_state *cli);
55 struct tevent_req *cli_tcon_andx_create(TALLOC_CTX *mem_ctx,
56 struct event_context *ev,
57 struct cli_state *cli,
58 const char *share, const char *dev,
59 const char *pass, int passlen,
60 struct tevent_req **psmbreq);
61 struct tevent_req *cli_tcon_andx_send(TALLOC_CTX *mem_ctx,
62 struct event_context *ev,
63 struct cli_state *cli,
64 const char *share, const char *dev,
65 const char *pass, int passlen);
66 NTSTATUS cli_tcon_andx_recv(struct tevent_req *req);
67 NTSTATUS cli_tcon_andx(struct cli_state *cli, const char *share,
68 const char *dev, const char *pass, int passlen);
69 struct tevent_req *cli_tdis_send(TALLOC_CTX *mem_ctx,
70 struct tevent_context *ev,
71 struct cli_state *cli);
72 NTSTATUS cli_tdis_recv(struct tevent_req *req);
73 NTSTATUS cli_tdis(struct cli_state *cli);
74 NTSTATUS cli_negprot(struct cli_state *cli);
75 struct tevent_req *cli_negprot_send(TALLOC_CTX *mem_ctx,
76 struct event_context *ev,
77 struct cli_state *cli);
78 NTSTATUS cli_negprot_recv(struct tevent_req *req);
79 NTSTATUS cli_connect_nb(const char *host, struct sockaddr_storage *pss,
80 uint16_t port, int name_type, const char *myname,
81 int signing_state, struct cli_state **pcli);
82 NTSTATUS cli_start_connection(struct cli_state **output_cli,
84 const char *dest_host,
85 struct sockaddr_storage *dest_ss, int port,
86 int signing_state, int flags);
87 NTSTATUS cli_full_connection(struct cli_state **output_cli,
89 const char *dest_host,
90 struct sockaddr_storage *dest_ss, int port,
91 const char *service, const char *service_type,
92 const char *user, const char *domain,
93 const char *password, int flags,
95 NTSTATUS cli_raw_tcon(struct cli_state *cli,
96 const char *service, const char *pass, const char *dev,
97 uint16 *max_xmit, uint16 *tid);
98 struct cli_state *get_ipc_connect(char *server,
99 struct sockaddr_storage *server_ss,
100 const struct user_auth_info *user_info);
101 struct cli_state *get_ipc_connect_master_ip(TALLOC_CTX *ctx,
102 struct sockaddr_storage *mb_ip,
103 const struct user_auth_info *user_info,
104 char **pp_workgroup_out);
105 struct cli_state *get_ipc_connect_master_ip_bcast(TALLOC_CTX *ctx,
106 const struct user_auth_info *user_info,
107 char **pp_workgroup_out);
109 /* The following definitions come from libsmb/clidfs.c */
111 NTSTATUS cli_cm_force_encryption(struct cli_state *c,
112 const char *username,
113 const char *password,
115 const char *sharename);
116 NTSTATUS cli_cm_open(TALLOC_CTX *ctx,
117 struct cli_state *referring_cli,
120 const struct user_auth_info *auth_info,
126 struct cli_state **pcli);
127 void cli_cm_display(const struct cli_state *c);
128 struct client_dfs_referral;
129 NTSTATUS cli_dfs_get_referral(TALLOC_CTX *ctx,
130 struct cli_state *cli,
132 struct client_dfs_referral **refs,
135 NTSTATUS cli_resolve_path(TALLOC_CTX *ctx,
137 const struct user_auth_info *dfs_auth_info,
138 struct cli_state *rootcli,
140 struct cli_state **targetcli,
141 char **pp_targetpath);
143 bool cli_check_msdfs_proxy(TALLOC_CTX *ctx,
144 struct cli_state *cli,
145 const char *sharename,
149 const char *username,
150 const char *password,
153 /* The following definitions come from libsmb/clientgen.c */
155 int cli_set_message(char *buf,int num_words,int num_bytes,bool zero);
156 unsigned int cli_set_timeout(struct cli_state *cli, unsigned int timeout);
157 void cli_setup_packet_buf(struct cli_state *cli, char *buf);
158 NTSTATUS cli_set_domain(struct cli_state *cli, const char *domain);
159 NTSTATUS cli_set_username(struct cli_state *cli, const char *username);
160 NTSTATUS cli_set_password(struct cli_state *cli, const char *password);
161 NTSTATUS cli_init_creds(struct cli_state *cli, const char *username, const char *domain, const char *password);
162 struct cli_state *cli_state_create(TALLOC_CTX *mem_ctx,
164 const char *desthost,
166 bool cli_state_encryption_on(struct cli_state *cli);
167 void cli_nt_pipes_close(struct cli_state *cli);
168 void cli_shutdown(struct cli_state *cli);
169 void cli_sockopt(struct cli_state *cli, const char *options);
170 uint16_t cli_state_get_vc_num(struct cli_state *cli);
171 uint16 cli_setpid(struct cli_state *cli, uint16 pid);
172 uint16_t cli_getpid(struct cli_state *cli);
173 bool cli_state_has_tcon(struct cli_state *cli);
174 uint16_t cli_state_get_tid(struct cli_state *cli);
175 uint16_t cli_state_set_tid(struct cli_state *cli, uint16_t tid);
176 uint16_t cli_state_get_uid(struct cli_state *cli);
177 uint16_t cli_state_set_uid(struct cli_state *cli, uint16_t uid);
178 bool cli_set_case_sensitive(struct cli_state *cli, bool case_sensitive);
179 struct tevent_req *cli_echo_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
180 struct cli_state *cli, uint16_t num_echos,
182 NTSTATUS cli_echo_recv(struct tevent_req *req);
183 NTSTATUS cli_echo(struct cli_state *cli, uint16_t num_echos, DATA_BLOB data);
184 bool cli_ucs2(struct cli_state *cli);
185 bool is_andx_req(uint8_t cmd);
186 NTSTATUS cli_smb(TALLOC_CTX *mem_ctx, struct cli_state *cli,
187 uint8_t smb_command, uint8_t additional_flags,
188 uint8_t wct, uint16_t *vwv,
189 uint32_t num_bytes, const uint8_t *bytes,
190 struct tevent_req **result_parent,
191 uint8_t min_wct, uint8_t *pwct, uint16_t **pvwv,
192 uint32_t *pnum_bytes, uint8_t **pbytes);
194 /* The following definitions come from libsmb/clierror.c */
196 const char *cli_errstr(struct cli_state *cli);
197 NTSTATUS cli_nt_error(struct cli_state *cli);
198 void cli_dos_error(struct cli_state *cli, uint8 *eclass, uint32 *ecode);
199 int cli_errno(struct cli_state *cli);
200 bool cli_is_error(struct cli_state *cli);
201 bool cli_is_nt_error(struct cli_state *cli);
202 bool cli_is_dos_error(struct cli_state *cli);
203 bool cli_state_is_connected(struct cli_state *cli);
204 void cli_state_disconnect(struct cli_state *cli);
206 /* The following definitions come from libsmb/clifile.c */
208 struct tevent_req *cli_setpathinfo_send(TALLOC_CTX *mem_ctx,
209 struct tevent_context *ev,
210 struct cli_state *cli,
215 NTSTATUS cli_setpathinfo_recv(struct tevent_req *req);
216 NTSTATUS cli_setpathinfo(struct cli_state *cli,
222 struct tevent_req *cli_posix_symlink_send(TALLOC_CTX *mem_ctx,
223 struct event_context *ev,
224 struct cli_state *cli,
226 const char *newname);
227 NTSTATUS cli_posix_symlink_recv(struct tevent_req *req);
228 NTSTATUS cli_posix_symlink(struct cli_state *cli,
230 const char *newname);
231 struct tevent_req *cli_posix_readlink_send(TALLOC_CTX *mem_ctx,
232 struct event_context *ev,
233 struct cli_state *cli,
236 NTSTATUS cli_posix_readlink_recv(struct tevent_req *req, struct cli_state *cli,
237 char *retpath, size_t len);
238 NTSTATUS cli_posix_readlink(struct cli_state *cli, const char *fname,
239 char *linkpath, size_t len);
240 struct tevent_req *cli_posix_hardlink_send(TALLOC_CTX *mem_ctx,
241 struct event_context *ev,
242 struct cli_state *cli,
244 const char *newname);
245 NTSTATUS cli_posix_hardlink_recv(struct tevent_req *req);
246 NTSTATUS cli_posix_hardlink(struct cli_state *cli,
248 const char *newname);
249 uint32_t unix_perms_to_wire(mode_t perms);
250 mode_t wire_perms_to_unix(uint32_t perms);
251 struct tevent_req *cli_posix_getfacl_send(TALLOC_CTX *mem_ctx,
252 struct event_context *ev,
253 struct cli_state *cli,
255 NTSTATUS cli_posix_getfacl_recv(struct tevent_req *req,
259 NTSTATUS cli_posix_getfacl(struct cli_state *cli,
264 struct tevent_req *cli_posix_stat_send(TALLOC_CTX *mem_ctx,
265 struct event_context *ev,
266 struct cli_state *cli,
268 NTSTATUS cli_posix_stat_recv(struct tevent_req *req,
269 SMB_STRUCT_STAT *sbuf);
270 NTSTATUS cli_posix_stat(struct cli_state *cli,
272 SMB_STRUCT_STAT *sbuf);
273 struct tevent_req *cli_posix_chmod_send(TALLOC_CTX *mem_ctx,
274 struct event_context *ev,
275 struct cli_state *cli,
278 NTSTATUS cli_posix_chmod_recv(struct tevent_req *req);
279 NTSTATUS cli_posix_chmod(struct cli_state *cli, const char *fname, mode_t mode);
280 struct tevent_req *cli_posix_chown_send(TALLOC_CTX *mem_ctx,
281 struct event_context *ev,
282 struct cli_state *cli,
286 NTSTATUS cli_posix_chown_recv(struct tevent_req *req);
287 NTSTATUS cli_posix_chown(struct cli_state *cli,
291 struct tevent_req *cli_rename_send(TALLOC_CTX *mem_ctx,
292 struct event_context *ev,
293 struct cli_state *cli,
294 const char *fname_src,
295 const char *fname_dst);
296 NTSTATUS cli_rename_recv(struct tevent_req *req);
297 NTSTATUS cli_rename(struct cli_state *cli, const char *fname_src, const char *fname_dst);
298 struct tevent_req *cli_ntrename_send(TALLOC_CTX *mem_ctx,
299 struct event_context *ev,
300 struct cli_state *cli,
301 const char *fname_src,
302 const char *fname_dst);
303 NTSTATUS cli_ntrename_recv(struct tevent_req *req);
304 NTSTATUS cli_ntrename(struct cli_state *cli, const char *fname_src, const char *fname_dst);
306 struct tevent_req *cli_nt_hardlink_send(TALLOC_CTX *mem_ctx,
307 struct event_context *ev,
308 struct cli_state *cli,
309 const char *fname_src,
310 const char *fname_dst);
311 NTSTATUS cli_nt_hardlink_recv(struct tevent_req *req);
312 NTSTATUS cli_nt_hardlink(struct cli_state *cli, const char *fname_src, const char *fname_dst);
314 struct tevent_req *cli_unlink_send(TALLOC_CTX *mem_ctx,
315 struct event_context *ev,
316 struct cli_state *cli,
318 uint16_t mayhave_attrs);
319 NTSTATUS cli_unlink_recv(struct tevent_req *req);
320 NTSTATUS cli_unlink(struct cli_state *cli, const char *fname, uint16_t mayhave_attrs);
322 struct tevent_req *cli_mkdir_send(TALLOC_CTX *mem_ctx,
323 struct event_context *ev,
324 struct cli_state *cli,
326 NTSTATUS cli_mkdir_recv(struct tevent_req *req);
327 NTSTATUS cli_mkdir(struct cli_state *cli, const char *dname);
328 struct tevent_req *cli_rmdir_send(TALLOC_CTX *mem_ctx,
329 struct event_context *ev,
330 struct cli_state *cli,
332 NTSTATUS cli_rmdir_recv(struct tevent_req *req);
333 NTSTATUS cli_rmdir(struct cli_state *cli, const char *dname);
334 struct tevent_req *cli_nt_delete_on_close_send(TALLOC_CTX *mem_ctx,
335 struct event_context *ev,
336 struct cli_state *cli,
339 NTSTATUS cli_nt_delete_on_close_recv(struct tevent_req *req);
340 NTSTATUS cli_nt_delete_on_close(struct cli_state *cli, uint16_t fnum, bool flag);
341 struct tevent_req *cli_ntcreate_send(TALLOC_CTX *mem_ctx,
342 struct event_context *ev,
343 struct cli_state *cli,
346 uint32_t DesiredAccess,
347 uint32_t FileAttributes,
348 uint32_t ShareAccess,
349 uint32_t CreateDisposition,
350 uint32_t CreateOptions,
351 uint8_t SecurityFlags);
352 NTSTATUS cli_ntcreate_recv(struct tevent_req *req, uint16_t *pfnum);
353 NTSTATUS cli_ntcreate(struct cli_state *cli,
356 uint32_t DesiredAccess,
357 uint32_t FileAttributes,
358 uint32_t ShareAccess,
359 uint32_t CreateDisposition,
360 uint32_t CreateOptions,
361 uint8_t SecurityFlags,
363 uint8_t *smb_bytes_push_str(uint8_t *buf, bool ucs2, const char *str,
364 size_t str_len, size_t *pconverted_size);
365 uint8_t *smb_bytes_push_bytes(uint8_t *buf, uint8_t prefix,
366 const uint8_t *bytes, size_t num_bytes);
367 uint8_t *trans2_bytes_push_str(uint8_t *buf, bool ucs2,
368 const char *str, size_t str_len,
369 size_t *pconverted_size);
370 uint8_t *trans2_bytes_push_bytes(uint8_t *buf,
371 const uint8_t *bytes, size_t num_bytes);
372 struct tevent_req *cli_open_create(TALLOC_CTX *mem_ctx,
373 struct event_context *ev,
374 struct cli_state *cli, const char *fname,
375 int flags, int share_mode,
376 struct tevent_req **psmbreq);
377 struct tevent_req *cli_open_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
378 struct cli_state *cli, const char *fname,
379 int flags, int share_mode);
380 NTSTATUS cli_open_recv(struct tevent_req *req, uint16_t *fnum);
381 NTSTATUS cli_open(struct cli_state *cli, const char *fname, int flags, int share_mode, uint16_t *pfnum);
382 struct tevent_req *cli_close_create(TALLOC_CTX *mem_ctx,
383 struct event_context *ev,
384 struct cli_state *cli, uint16_t fnum,
385 struct tevent_req **psubreq);
386 struct tevent_req *cli_close_send(TALLOC_CTX *mem_ctx,
387 struct event_context *ev,
388 struct cli_state *cli, uint16_t fnum);
389 NTSTATUS cli_close_recv(struct tevent_req *req);
390 NTSTATUS cli_close(struct cli_state *cli, uint16_t fnum);
391 struct tevent_req *cli_ftruncate_send(TALLOC_CTX *mem_ctx,
392 struct event_context *ev,
393 struct cli_state *cli,
396 NTSTATUS cli_ftruncate_recv(struct tevent_req *req);
397 NTSTATUS cli_ftruncate(struct cli_state *cli, uint16_t fnum, uint64_t size);
398 NTSTATUS cli_locktype(struct cli_state *cli, uint16_t fnum,
399 uint32_t offset, uint32_t len,
400 int timeout, unsigned char locktype);
401 NTSTATUS cli_lock32(struct cli_state *cli, uint16_t fnum, uint32_t offset,
402 uint32_t len, int timeout, enum brl_type lock_type);
403 struct tevent_req *cli_unlock_send(TALLOC_CTX *mem_ctx,
404 struct event_context *ev,
405 struct cli_state *cli,
409 NTSTATUS cli_unlock_recv(struct tevent_req *req);
410 NTSTATUS cli_unlock(struct cli_state *cli, uint16_t fnum, uint32_t offset, uint32_t len);
411 NTSTATUS cli_lock64(struct cli_state *cli, uint16_t fnum,
412 uint64_t offset, uint64_t len, int timeout,
413 enum brl_type lock_type);
414 struct tevent_req *cli_unlock64_send(TALLOC_CTX *mem_ctx,
415 struct event_context *ev,
416 struct cli_state *cli,
420 NTSTATUS cli_unlock64_recv(struct tevent_req *req);
421 NTSTATUS cli_unlock64(struct cli_state *cli, uint16_t fnum, uint64_t offset, uint64_t len);
422 struct tevent_req *cli_posix_lock_send(TALLOC_CTX *mem_ctx,
423 struct event_context *ev,
424 struct cli_state *cli,
429 enum brl_type lock_type);
430 NTSTATUS cli_posix_lock_recv(struct tevent_req *req);
431 NTSTATUS cli_posix_lock(struct cli_state *cli, uint16_t fnum,
432 uint64_t offset, uint64_t len,
433 bool wait_lock, enum brl_type lock_type);
434 struct tevent_req *cli_posix_unlock_send(TALLOC_CTX *mem_ctx,
435 struct event_context *ev,
436 struct cli_state *cli,
440 NTSTATUS cli_posix_unlock_recv(struct tevent_req *req);
441 NTSTATUS cli_posix_unlock(struct cli_state *cli, uint16_t fnum, uint64_t offset, uint64_t len);
442 struct tevent_req *cli_getattrE_send(TALLOC_CTX *mem_ctx,
443 struct event_context *ev,
444 struct cli_state *cli,
446 NTSTATUS cli_getattrE_recv(struct tevent_req *req,
452 NTSTATUS cli_getattrE(struct cli_state *cli,
459 struct tevent_req *cli_setattrE_send(TALLOC_CTX *mem_ctx,
460 struct event_context *ev,
461 struct cli_state *cli,
466 NTSTATUS cli_setattrE_recv(struct tevent_req *req);
467 NTSTATUS cli_setattrE(struct cli_state *cli,
472 struct tevent_req *cli_getatr_send(TALLOC_CTX *mem_ctx,
473 struct event_context *ev,
474 struct cli_state *cli,
476 NTSTATUS cli_getatr_recv(struct tevent_req *req,
480 NTSTATUS cli_getatr(struct cli_state *cli,
485 struct tevent_req *cli_setatr_send(TALLOC_CTX *mem_ctx,
486 struct event_context *ev,
487 struct cli_state *cli,
491 NTSTATUS cli_setatr_recv(struct tevent_req *req);
492 NTSTATUS cli_setatr(struct cli_state *cli,
496 struct tevent_req *cli_chkpath_send(TALLOC_CTX *mem_ctx,
497 struct event_context *ev,
498 struct cli_state *cli,
500 NTSTATUS cli_chkpath_recv(struct tevent_req *req);
501 NTSTATUS cli_chkpath(struct cli_state *cli, const char *path);
502 struct tevent_req *cli_dskattr_send(TALLOC_CTX *mem_ctx,
503 struct event_context *ev,
504 struct cli_state *cli);
505 NTSTATUS cli_dskattr_recv(struct tevent_req *req, int *bsize, int *total,
507 NTSTATUS cli_dskattr(struct cli_state *cli, int *bsize, int *total, int *avail);
508 struct tevent_req *cli_ctemp_send(TALLOC_CTX *mem_ctx,
509 struct event_context *ev,
510 struct cli_state *cli,
512 NTSTATUS cli_ctemp_recv(struct tevent_req *req,
516 NTSTATUS cli_ctemp(struct cli_state *cli,
521 NTSTATUS cli_raw_ioctl(struct cli_state *cli, uint16_t fnum, uint32_t code, DATA_BLOB *blob);
522 NTSTATUS cli_set_ea_path(struct cli_state *cli, const char *path,
523 const char *ea_name, const char *ea_val,
525 NTSTATUS cli_set_ea_fnum(struct cli_state *cli, uint16_t fnum,
526 const char *ea_name, const char *ea_val,
528 struct tevent_req *cli_get_ea_list_path_send(TALLOC_CTX *mem_ctx,
529 struct tevent_context *ev,
530 struct cli_state *cli,
532 NTSTATUS cli_get_ea_list_path_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
533 size_t *pnum_eas, struct ea_struct **peas);
534 NTSTATUS cli_get_ea_list_path(struct cli_state *cli, const char *path,
537 struct ea_struct **pea_list);
538 struct tevent_req *cli_posix_open_send(TALLOC_CTX *mem_ctx,
539 struct event_context *ev,
540 struct cli_state *cli,
544 NTSTATUS cli_posix_open_recv(struct tevent_req *req, uint16_t *pfnum);
545 NTSTATUS cli_posix_open(struct cli_state *cli, const char *fname,
546 int flags, mode_t mode, uint16_t *fnum);
547 struct tevent_req *cli_posix_mkdir_send(TALLOC_CTX *mem_ctx,
548 struct event_context *ev,
549 struct cli_state *cli,
552 NTSTATUS cli_posix_mkdir_recv(struct tevent_req *req);
553 NTSTATUS cli_posix_mkdir(struct cli_state *cli, const char *fname, mode_t mode);
555 struct tevent_req *cli_posix_unlink_send(TALLOC_CTX *mem_ctx,
556 struct event_context *ev,
557 struct cli_state *cli,
559 NTSTATUS cli_posix_unlink_recv(struct tevent_req *req);
560 NTSTATUS cli_posix_unlink(struct cli_state *cli, const char *fname);
562 struct tevent_req *cli_posix_rmdir_send(TALLOC_CTX *mem_ctx,
563 struct event_context *ev,
564 struct cli_state *cli,
566 NTSTATUS cli_posix_rmdir_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx);
567 NTSTATUS cli_posix_rmdir(struct cli_state *cli, const char *fname);
568 struct tevent_req *cli_notify_send(TALLOC_CTX *mem_ctx,
569 struct tevent_context *ev,
570 struct cli_state *cli, uint16_t fnum,
571 uint32_t buffer_size,
572 uint32_t completion_filter, bool recursive);
573 NTSTATUS cli_notify_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
574 uint32_t *pnum_changes,
575 struct notify_change **pchanges);
577 struct tevent_req *cli_nttrans_create_send(TALLOC_CTX *mem_ctx,
578 struct event_context *ev,
579 struct cli_state *cli,
582 uint32_t DesiredAccess,
583 uint32_t FileAttributes,
584 uint32_t ShareAccess,
585 uint32_t CreateDisposition,
586 uint32_t CreateOptions,
587 uint8_t SecurityFlags,
588 struct security_descriptor *secdesc,
589 struct ea_struct *eas,
591 NTSTATUS cli_nttrans_create_recv(struct tevent_req *req, uint16_t *fnum);
592 NTSTATUS cli_nttrans_create(struct cli_state *cli,
595 uint32_t DesiredAccess,
596 uint32_t FileAttributes,
597 uint32_t ShareAccess,
598 uint32_t CreateDisposition,
599 uint32_t CreateOptions,
600 uint8_t SecurityFlags,
601 struct security_descriptor *secdesc,
602 struct ea_struct *eas,
606 /* The following definitions come from libsmb/clifsinfo.c */
608 struct tevent_req *cli_unix_extensions_version_send(TALLOC_CTX *mem_ctx,
609 struct tevent_context *ev,
610 struct cli_state *cli);
611 NTSTATUS cli_unix_extensions_version_recv(struct tevent_req *req,
612 uint16_t *pmajor, uint16_t *pminor,
615 NTSTATUS cli_unix_extensions_version(struct cli_state *cli, uint16 *pmajor,
616 uint16 *pminor, uint32 *pcaplow,
618 struct tevent_req *cli_set_unix_extensions_capabilities_send(
619 TALLOC_CTX *mem_ctx, struct tevent_context *ev, struct cli_state *cli,
620 uint16_t major, uint16_t minor, uint32_t caplow, uint32_t caphigh);
621 NTSTATUS cli_set_unix_extensions_capabilities_recv(struct tevent_req *req);
622 NTSTATUS cli_set_unix_extensions_capabilities(struct cli_state *cli,
623 uint16 major, uint16 minor,
624 uint32 caplow, uint32 caphigh);
625 struct tevent_req *cli_get_fs_attr_info_send(TALLOC_CTX *mem_ctx,
626 struct tevent_context *ev,
627 struct cli_state *cli);
628 NTSTATUS cli_get_fs_attr_info_recv(struct tevent_req *req, uint32_t *fs_attr);
629 NTSTATUS cli_get_fs_attr_info(struct cli_state *cli, uint32_t *fs_attr);
630 NTSTATUS cli_get_fs_volume_info(struct cli_state *cli,
631 TALLOC_CTX *mem_ctx, char **volume_name,
632 uint32 *pserial_number, time_t *pdate);
633 NTSTATUS cli_get_fs_full_size_info(struct cli_state *cli,
634 uint64_t *total_allocation_units,
635 uint64_t *caller_allocation_units,
636 uint64_t *actual_allocation_units,
637 uint64_t *sectors_per_allocation_unit,
638 uint64_t *bytes_per_sector);
639 NTSTATUS cli_get_posix_fs_info(struct cli_state *cli,
640 uint32 *optimal_transfer_size,
642 uint64_t *total_blocks,
643 uint64_t *blocks_available,
644 uint64_t *user_blocks_available,
645 uint64_t *total_file_nodes,
646 uint64_t *free_file_nodes,
647 uint64_t *fs_identifier);
648 NTSTATUS cli_raw_ntlm_smb_encryption_start(struct cli_state *cli,
652 NTSTATUS cli_gss_smb_encryption_start(struct cli_state *cli);
653 NTSTATUS cli_force_encryption(struct cli_state *c,
654 const char *username,
655 const char *password,
658 /* The following definitions come from libsmb/clilist.c */
660 NTSTATUS cli_list_old(struct cli_state *cli,const char *Mask,uint16 attribute,
661 NTSTATUS (*fn)(const char *, struct file_info *,
662 const char *, void *), void *state);
663 NTSTATUS cli_list_trans(struct cli_state *cli, const char *mask,
664 uint16_t attribute, int info_level,
665 NTSTATUS (*fn)(const char *mnt, struct file_info *finfo,
666 const char *mask, void *private_data),
668 struct tevent_req *cli_list_send(TALLOC_CTX *mem_ctx,
669 struct tevent_context *ev,
670 struct cli_state *cli,
673 uint16_t info_level);
674 NTSTATUS cli_list_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
675 struct file_info **finfo, size_t *num_finfo);
676 NTSTATUS cli_list(struct cli_state *cli,const char *Mask,uint16 attribute,
677 NTSTATUS (*fn)(const char *, struct file_info *, const char *,
678 void *), void *state);
680 /* The following definitions come from libsmb/climessage.c */
682 struct tevent_req *cli_message_send(TALLOC_CTX *mem_ctx,
683 struct tevent_context *ev,
684 struct cli_state *cli,
685 const char *host, const char *username,
686 const char *message);
687 NTSTATUS cli_message_recv(struct tevent_req *req);
688 NTSTATUS cli_message(struct cli_state *cli, const char *host,
689 const char *username, const char *message);
691 /* The following definitions come from libsmb/clioplock.c */
693 struct tevent_req *cli_oplock_ack_send(TALLOC_CTX *mem_ctx,
694 struct tevent_context *ev,
695 struct cli_state *cli,
696 uint16_t fnum, uint8_t level);
697 NTSTATUS cli_oplock_ack_recv(struct tevent_req *req);
699 /* The following definitions come from libsmb/cliprint.c */
701 int cli_print_queue(struct cli_state *cli,
702 void (*fn)(struct print_job_info *));
703 int cli_printjob_del(struct cli_state *cli, int job);
705 /* The following definitions come from libsmb/cliquota.c */
707 NTSTATUS cli_get_quota_handle(struct cli_state *cli, uint16_t *quota_fnum);
708 void free_ntquota_list(SMB_NTQUOTA_LIST **qt_list);
709 NTSTATUS cli_get_user_quota(struct cli_state *cli, int quota_fnum,
710 SMB_NTQUOTA_STRUCT *pqt);
711 NTSTATUS cli_set_user_quota(struct cli_state *cli, int quota_fnum,
712 SMB_NTQUOTA_STRUCT *pqt);
713 NTSTATUS cli_list_user_quota(struct cli_state *cli, int quota_fnum,
714 SMB_NTQUOTA_LIST **pqt_list);
715 NTSTATUS cli_get_fs_quota_info(struct cli_state *cli, int quota_fnum,
716 SMB_NTQUOTA_STRUCT *pqt);
717 NTSTATUS cli_set_fs_quota_info(struct cli_state *cli, int quota_fnum,
718 SMB_NTQUOTA_STRUCT *pqt);
720 /* The following definitions come from libsmb/clireadwrite.c */
722 struct tevent_req *cli_read_andx_create(TALLOC_CTX *mem_ctx,
723 struct event_context *ev,
724 struct cli_state *cli, uint16_t fnum,
725 off_t offset, size_t size,
726 struct tevent_req **psmbreq);
727 struct tevent_req *cli_read_andx_send(TALLOC_CTX *mem_ctx,
728 struct event_context *ev,
729 struct cli_state *cli, uint16_t fnum,
730 off_t offset, size_t size);
731 NTSTATUS cli_read_andx_recv(struct tevent_req *req, ssize_t *received,
733 struct tevent_req *cli_pull_send(TALLOC_CTX *mem_ctx,
734 struct event_context *ev,
735 struct cli_state *cli,
736 uint16_t fnum, off_t start_offset,
737 SMB_OFF_T size, size_t window_size,
738 NTSTATUS (*sink)(char *buf, size_t n,
741 NTSTATUS cli_pull_recv(struct tevent_req *req, SMB_OFF_T *received);
742 NTSTATUS cli_pull(struct cli_state *cli, uint16_t fnum,
743 off_t start_offset, SMB_OFF_T size, size_t window_size,
744 NTSTATUS (*sink)(char *buf, size_t n, void *priv),
745 void *priv, SMB_OFF_T *received);
746 ssize_t cli_read_old(struct cli_state *cli, uint16_t fnum, char *buf,
747 off_t offset, size_t size);
748 NTSTATUS cli_read(struct cli_state *cli, uint16_t fnum,
749 char *buf, off_t offset, size_t size,
751 NTSTATUS cli_smbwrite(struct cli_state *cli, uint16_t fnum, char *buf,
752 off_t offset, size_t size1, size_t *ptotal);
753 struct tevent_req *cli_write_andx_create(TALLOC_CTX *mem_ctx,
754 struct event_context *ev,
755 struct cli_state *cli, uint16_t fnum,
756 uint16_t mode, const uint8_t *buf,
757 off_t offset, size_t size,
758 struct tevent_req **reqs_before,
760 struct tevent_req **psmbreq);
761 struct tevent_req *cli_write_andx_send(TALLOC_CTX *mem_ctx,
762 struct event_context *ev,
763 struct cli_state *cli, uint16_t fnum,
764 uint16_t mode, const uint8_t *buf,
765 off_t offset, size_t size);
766 NTSTATUS cli_write_andx_recv(struct tevent_req *req, size_t *pwritten);
768 NTSTATUS cli_writeall(struct cli_state *cli, uint16_t fnum, uint16_t mode,
769 const uint8_t *buf, off_t offset, size_t size,
772 struct tevent_req *cli_push_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
773 struct cli_state *cli,
774 uint16_t fnum, uint16_t mode,
775 off_t start_offset, size_t window_size,
776 size_t (*source)(uint8_t *buf, size_t n,
779 NTSTATUS cli_push_recv(struct tevent_req *req);
780 NTSTATUS cli_push(struct cli_state *cli, uint16_t fnum, uint16_t mode,
781 off_t start_offset, size_t window_size,
782 size_t (*source)(uint8_t *buf, size_t n, void *priv),
785 /* The following definitions come from libsmb/clisecdesc.c */
787 struct security_descriptor *cli_query_secdesc(struct cli_state *cli, uint16_t fnum,
788 TALLOC_CTX *mem_ctx);
789 NTSTATUS cli_set_secdesc(struct cli_state *cli, uint16_t fnum,
790 struct security_descriptor *sd);
792 /* The following definitions come from libsmb/clistr.c */
794 size_t clistr_pull_talloc(TALLOC_CTX *ctx,
802 /* The following definitions come from libsmb/clitrans.c */
804 struct tevent_req *cli_trans_send(
805 TALLOC_CTX *mem_ctx, struct event_context *ev,
806 struct cli_state *cli, uint8_t cmd,
807 const char *pipe_name, uint16_t fid, uint16_t function, int flags,
808 uint16_t *setup, uint8_t num_setup, uint8_t max_setup,
809 uint8_t *param, uint32_t num_param, uint32_t max_param,
810 uint8_t *data, uint32_t num_data, uint32_t max_data);
811 NTSTATUS cli_trans_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
812 uint16_t *recv_flags2,
813 uint16_t **setup, uint8_t min_setup,
815 uint8_t **param, uint32_t min_param,
817 uint8_t **data, uint32_t min_data,
819 NTSTATUS cli_trans(TALLOC_CTX *mem_ctx, struct cli_state *cli,
821 const char *pipe_name, uint16_t fid, uint16_t function,
823 uint16_t *setup, uint8_t num_setup, uint8_t max_setup,
824 uint8_t *param, uint32_t num_param, uint32_t max_param,
825 uint8_t *data, uint32_t num_data, uint32_t max_data,
826 uint16_t *recv_flags2,
827 uint16_t **rsetup, uint8_t min_rsetup, uint8_t *num_rsetup,
828 uint8_t **rparam, uint32_t min_rparam, uint32_t *num_rparam,
829 uint8_t **rdata, uint32_t min_rdata, uint32_t *num_rdata);
831 /* The following definitions come from libsmb/smb_seal.c */
833 NTSTATUS get_enc_ctx_num(const uint8_t *buf, uint16 *p_enc_ctx_num);
834 bool common_encryption_on(struct smb_trans_enc_state *es);
835 NTSTATUS common_ntlm_decrypt_buffer(struct ntlmssp_state *ntlmssp_state, char *buf);
836 NTSTATUS common_ntlm_encrypt_buffer(struct ntlmssp_state *ntlmssp_state,
840 NTSTATUS common_encrypt_buffer(struct smb_trans_enc_state *es, char *buffer, char **buf_out);
841 NTSTATUS common_decrypt_buffer(struct smb_trans_enc_state *es, char *buf);
842 void common_free_encryption_state(struct smb_trans_enc_state **pp_es);
843 void common_free_enc_buffer(struct smb_trans_enc_state *es, char *buf);
844 bool cli_encryption_on(struct cli_state *cli);
845 void cli_free_encryption_context(struct cli_state *cli);
846 void cli_free_enc_buffer(struct cli_state *cli, char *buf);
848 /* The following definitions come from libsmb/clisigning.c */
850 bool cli_simple_set_signing(struct cli_state *cli,
851 const DATA_BLOB user_session_key,
852 const DATA_BLOB response);
853 bool cli_temp_set_signing(struct cli_state *cli);
854 void cli_calculate_sign_mac(struct cli_state *cli, char *buf, uint32_t *seqnum);
855 bool cli_check_sign_mac(struct cli_state *cli, const char *buf, uint32_t seqnum);
856 bool client_is_signing_on(struct cli_state *cli);
857 bool client_is_signing_allowed(struct cli_state *cli);
858 bool client_is_signing_mandatory(struct cli_state *cli);
859 void cli_set_signing_negotiated(struct cli_state *cli);
861 /* The following definitions come from libsmb/reparse_symlink.c */
863 bool symlink_reparse_buffer_marshall(
864 const char *substitute, const char *printname, uint32_t flags,
865 TALLOC_CTX *mem_ctx, uint8_t **pdst, size_t *pdstlen);
866 bool symlink_reparse_buffer_parse(
867 const uint8_t *src, size_t srclen, TALLOC_CTX *mem_ctx,
868 char **psubstitute_name, char **pprint_name, uint32_t *pflags);
870 /* The following definitions come from libsmb/clisymlink.c */
872 struct tevent_req *cli_symlink_send(TALLOC_CTX *mem_ctx,
873 struct tevent_context *ev,
874 struct cli_state *cli,
878 NTSTATUS cli_symlink_recv(struct tevent_req *req);
879 NTSTATUS cli_symlink(struct cli_state *cli, const char *oldname,
880 const char *newname, uint32_t flags);
882 struct tevent_req *cli_readlink_send(TALLOC_CTX *mem_ctx,
883 struct tevent_context *ev,
884 struct cli_state *cli,
886 NTSTATUS cli_readlink_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
887 char **psubstitute_name, char **pprint_name,
889 NTSTATUS cli_readlink(struct cli_state *cli, const char *fname,
890 TALLOC_CTX *mem_ctx, char **psubstitute_name,
891 char **pprint_name, uint32_t *pflags);
893 #endif /* _LIBSMB_PROTO_H_ */