2 Unix SMB/CIFS implementation.
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 3 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>.
18 #ifndef _LIBSMB_PROTO_H_
19 #define _LIBSMB_PROTO_H_
23 /* The following definitions come from libsmb/cliconnect.c */
25 ADS_STATUS cli_session_setup_spnego(struct cli_state *cli, const char *user,
26 const char *pass, const char *user_domain,
27 const char * dest_realm);
29 NTSTATUS cli_session_setup(struct cli_state *cli,
31 const char *pass, int passlen,
32 const char *ntpass, int ntpasslen,
33 const char *workgroup);
34 struct tevent_req *cli_session_setup_guest_create(TALLOC_CTX *mem_ctx,
35 struct event_context *ev,
36 struct cli_state *cli,
37 struct tevent_req **psmbreq);
38 struct tevent_req *cli_session_setup_guest_send(TALLOC_CTX *mem_ctx,
39 struct event_context *ev,
40 struct cli_state *cli);
41 NTSTATUS cli_session_setup_guest_recv(struct tevent_req *req);
42 struct tevent_req *cli_ulogoff_send(TALLOC_CTX *mem_ctx,
43 struct tevent_context *ev,
44 struct cli_state *cli);
45 NTSTATUS cli_ulogoff_recv(struct tevent_req *req);
46 NTSTATUS cli_ulogoff(struct cli_state *cli);
47 struct tevent_req *cli_tcon_andx_create(TALLOC_CTX *mem_ctx,
48 struct event_context *ev,
49 struct cli_state *cli,
50 const char *share, const char *dev,
51 const char *pass, int passlen,
52 struct tevent_req **psmbreq);
53 struct tevent_req *cli_tcon_andx_send(TALLOC_CTX *mem_ctx,
54 struct event_context *ev,
55 struct cli_state *cli,
56 const char *share, const char *dev,
57 const char *pass, int passlen);
58 NTSTATUS cli_tcon_andx_recv(struct tevent_req *req);
59 NTSTATUS cli_tcon_andx(struct cli_state *cli, const char *share,
60 const char *dev, const char *pass, int passlen);
61 struct tevent_req *cli_tdis_send(TALLOC_CTX *mem_ctx,
62 struct tevent_context *ev,
63 struct cli_state *cli);
64 NTSTATUS cli_tdis_recv(struct tevent_req *req);
65 NTSTATUS cli_tdis(struct cli_state *cli);
66 NTSTATUS cli_negprot(struct cli_state *cli);
67 struct tevent_req *cli_negprot_send(TALLOC_CTX *mem_ctx,
68 struct event_context *ev,
69 struct cli_state *cli);
70 NTSTATUS cli_negprot_recv(struct tevent_req *req);
71 bool cli_session_request(struct cli_state *cli,
72 struct nmb_name *calling, struct nmb_name *called);
73 NTSTATUS cli_connect(struct cli_state *cli,
75 struct sockaddr_storage *dest_ss);
76 NTSTATUS cli_start_connection(struct cli_state **output_cli,
78 const char *dest_host,
79 struct sockaddr_storage *dest_ss, int port,
80 int signing_state, int flags);
81 NTSTATUS cli_full_connection(struct cli_state **output_cli,
83 const char *dest_host,
84 struct sockaddr_storage *dest_ss, int port,
85 const char *service, const char *service_type,
86 const char *user, const char *domain,
87 const char *password, int flags,
89 bool attempt_netbios_session_request(struct cli_state **ppcli, const char *srchost, const char *desthost,
90 struct sockaddr_storage *pdest_ss);
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 struct cli_state *cli_cm_open(TALLOC_CTX *ctx,
113 struct cli_state *referring_cli,
116 const struct user_auth_info *auth_info,
122 void cli_cm_display(const struct cli_state *c);
123 struct client_dfs_referral;
124 NTSTATUS cli_dfs_get_referral(TALLOC_CTX *ctx,
125 struct cli_state *cli,
127 struct client_dfs_referral **refs,
130 bool cli_resolve_path(TALLOC_CTX *ctx,
132 const struct user_auth_info *dfs_auth_info,
133 struct cli_state *rootcli,
135 struct cli_state **targetcli,
136 char **pp_targetpath);
138 bool cli_check_msdfs_proxy(TALLOC_CTX *ctx,
139 struct cli_state *cli,
140 const char *sharename,
144 const char *username,
145 const char *password,
148 /* The following definitions come from libsmb/clientgen.c */
150 int cli_set_message(char *buf,int num_words,int num_bytes,bool zero);
151 unsigned int cli_set_timeout(struct cli_state *cli, unsigned int timeout);
152 void cli_set_port(struct cli_state *cli, int port);
153 bool cli_state_seqnum_persistent(struct cli_state *cli,
155 bool cli_state_seqnum_remove(struct cli_state *cli,
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_initialise(void);
163 struct cli_state *cli_initialise_ex(int signing_state);
164 void cli_nt_pipes_close(struct cli_state *cli);
165 void cli_shutdown(struct cli_state *cli);
166 void cli_sockopt(struct cli_state *cli, const char *options);
167 uint16 cli_setpid(struct cli_state *cli, uint16 pid);
168 bool cli_set_case_sensitive(struct cli_state *cli, bool case_sensitive);
169 struct tevent_req *cli_echo_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
170 struct cli_state *cli, uint16_t num_echos,
172 NTSTATUS cli_echo_recv(struct tevent_req *req);
173 NTSTATUS cli_echo(struct cli_state *cli, uint16_t num_echos, DATA_BLOB data);
174 bool cli_ucs2(struct cli_state *cli);
175 bool is_andx_req(uint8_t cmd);
176 NTSTATUS cli_smb(TALLOC_CTX *mem_ctx, struct cli_state *cli,
177 uint8_t smb_command, uint8_t additional_flags,
178 uint8_t wct, uint16_t *vwv,
179 uint32_t num_bytes, const uint8_t *bytes,
180 struct tevent_req **result_parent,
181 uint8_t min_wct, uint8_t *pwct, uint16_t **pvwv,
182 uint32_t *pnum_bytes, uint8_t **pbytes);
184 /* The following definitions come from libsmb/clierror.c */
186 const char *cli_errstr(struct cli_state *cli);
187 NTSTATUS cli_nt_error(struct cli_state *cli);
188 void cli_dos_error(struct cli_state *cli, uint8 *eclass, uint32 *ecode);
189 int cli_errno(struct cli_state *cli);
190 bool cli_is_error(struct cli_state *cli);
191 bool cli_is_nt_error(struct cli_state *cli);
192 bool cli_is_dos_error(struct cli_state *cli);
193 bool cli_state_is_connected(struct cli_state *cli);
195 /* The following definitions come from libsmb/clifile.c */
197 struct tevent_req *cli_setpathinfo_send(TALLOC_CTX *mem_ctx,
198 struct tevent_context *ev,
199 struct cli_state *cli,
204 NTSTATUS cli_setpathinfo_recv(struct tevent_req *req);
205 NTSTATUS cli_setpathinfo(struct cli_state *cli,
211 struct tevent_req *cli_posix_symlink_send(TALLOC_CTX *mem_ctx,
212 struct event_context *ev,
213 struct cli_state *cli,
215 const char *newname);
216 NTSTATUS cli_posix_symlink_recv(struct tevent_req *req);
217 NTSTATUS cli_posix_symlink(struct cli_state *cli,
219 const char *newname);
220 struct tevent_req *cli_posix_readlink_send(TALLOC_CTX *mem_ctx,
221 struct event_context *ev,
222 struct cli_state *cli,
225 NTSTATUS cli_posix_readlink_recv(struct tevent_req *req, struct cli_state *cli,
226 char *retpath, size_t len);
227 NTSTATUS cli_posix_readlink(struct cli_state *cli, const char *fname,
228 char *linkpath, size_t len);
229 struct tevent_req *cli_posix_hardlink_send(TALLOC_CTX *mem_ctx,
230 struct event_context *ev,
231 struct cli_state *cli,
233 const char *newname);
234 NTSTATUS cli_posix_hardlink_recv(struct tevent_req *req);
235 NTSTATUS cli_posix_hardlink(struct cli_state *cli,
237 const char *newname);
238 uint32_t unix_perms_to_wire(mode_t perms);
239 mode_t wire_perms_to_unix(uint32_t perms);
240 struct tevent_req *cli_posix_getfacl_send(TALLOC_CTX *mem_ctx,
241 struct event_context *ev,
242 struct cli_state *cli,
244 NTSTATUS cli_posix_getfacl_recv(struct tevent_req *req,
248 NTSTATUS cli_posix_getfacl(struct cli_state *cli,
253 struct tevent_req *cli_posix_stat_send(TALLOC_CTX *mem_ctx,
254 struct event_context *ev,
255 struct cli_state *cli,
257 NTSTATUS cli_posix_stat_recv(struct tevent_req *req,
258 SMB_STRUCT_STAT *sbuf);
259 NTSTATUS cli_posix_stat(struct cli_state *cli,
261 SMB_STRUCT_STAT *sbuf);
262 struct tevent_req *cli_posix_chmod_send(TALLOC_CTX *mem_ctx,
263 struct event_context *ev,
264 struct cli_state *cli,
267 NTSTATUS cli_posix_chmod_recv(struct tevent_req *req);
268 NTSTATUS cli_posix_chmod(struct cli_state *cli, const char *fname, mode_t mode);
269 struct tevent_req *cli_posix_chown_send(TALLOC_CTX *mem_ctx,
270 struct event_context *ev,
271 struct cli_state *cli,
275 NTSTATUS cli_posix_chown_recv(struct tevent_req *req);
276 NTSTATUS cli_posix_chown(struct cli_state *cli,
280 struct tevent_req *cli_rename_send(TALLOC_CTX *mem_ctx,
281 struct event_context *ev,
282 struct cli_state *cli,
283 const char *fname_src,
284 const char *fname_dst);
285 NTSTATUS cli_rename_recv(struct tevent_req *req);
286 NTSTATUS cli_rename(struct cli_state *cli, const char *fname_src, const char *fname_dst);
287 struct tevent_req *cli_ntrename_send(TALLOC_CTX *mem_ctx,
288 struct event_context *ev,
289 struct cli_state *cli,
290 const char *fname_src,
291 const char *fname_dst);
292 NTSTATUS cli_ntrename_recv(struct tevent_req *req);
293 NTSTATUS cli_ntrename(struct cli_state *cli, const char *fname_src, const char *fname_dst);
295 struct tevent_req *cli_nt_hardlink_send(TALLOC_CTX *mem_ctx,
296 struct event_context *ev,
297 struct cli_state *cli,
298 const char *fname_src,
299 const char *fname_dst);
300 NTSTATUS cli_nt_hardlink_recv(struct tevent_req *req);
301 NTSTATUS cli_nt_hardlink(struct cli_state *cli, const char *fname_src, const char *fname_dst);
303 struct tevent_req *cli_unlink_send(TALLOC_CTX *mem_ctx,
304 struct event_context *ev,
305 struct cli_state *cli,
307 uint16_t mayhave_attrs);
308 NTSTATUS cli_unlink_recv(struct tevent_req *req);
309 NTSTATUS cli_unlink(struct cli_state *cli, const char *fname, uint16_t mayhave_attrs);
311 struct tevent_req *cli_mkdir_send(TALLOC_CTX *mem_ctx,
312 struct event_context *ev,
313 struct cli_state *cli,
315 NTSTATUS cli_mkdir_recv(struct tevent_req *req);
316 NTSTATUS cli_mkdir(struct cli_state *cli, const char *dname);
317 struct tevent_req *cli_rmdir_send(TALLOC_CTX *mem_ctx,
318 struct event_context *ev,
319 struct cli_state *cli,
321 NTSTATUS cli_rmdir_recv(struct tevent_req *req);
322 NTSTATUS cli_rmdir(struct cli_state *cli, const char *dname);
323 struct tevent_req *cli_nt_delete_on_close_send(TALLOC_CTX *mem_ctx,
324 struct event_context *ev,
325 struct cli_state *cli,
328 NTSTATUS cli_nt_delete_on_close_recv(struct tevent_req *req);
329 NTSTATUS cli_nt_delete_on_close(struct cli_state *cli, uint16_t fnum, bool flag);
330 struct tevent_req *cli_ntcreate_send(TALLOC_CTX *mem_ctx,
331 struct event_context *ev,
332 struct cli_state *cli,
335 uint32_t DesiredAccess,
336 uint32_t FileAttributes,
337 uint32_t ShareAccess,
338 uint32_t CreateDisposition,
339 uint32_t CreateOptions,
340 uint8_t SecurityFlags);
341 NTSTATUS cli_ntcreate_recv(struct tevent_req *req, uint16_t *pfnum);
342 NTSTATUS cli_ntcreate(struct cli_state *cli,
345 uint32_t DesiredAccess,
346 uint32_t FileAttributes,
347 uint32_t ShareAccess,
348 uint32_t CreateDisposition,
349 uint32_t CreateOptions,
350 uint8_t SecurityFlags,
352 uint8_t *smb_bytes_push_str(uint8_t *buf, bool ucs2, const char *str,
353 size_t str_len, size_t *pconverted_size);
354 uint8_t *smb_bytes_push_bytes(uint8_t *buf, uint8_t prefix,
355 const uint8_t *bytes, size_t num_bytes);
356 struct tevent_req *cli_open_create(TALLOC_CTX *mem_ctx,
357 struct event_context *ev,
358 struct cli_state *cli, const char *fname,
359 int flags, int share_mode,
360 struct tevent_req **psmbreq);
361 struct tevent_req *cli_open_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
362 struct cli_state *cli, const char *fname,
363 int flags, int share_mode);
364 NTSTATUS cli_open_recv(struct tevent_req *req, uint16_t *fnum);
365 NTSTATUS cli_open(struct cli_state *cli, const char *fname, int flags, int share_mode, uint16_t *pfnum);
366 struct tevent_req *cli_close_create(TALLOC_CTX *mem_ctx,
367 struct event_context *ev,
368 struct cli_state *cli, uint16_t fnum,
369 struct tevent_req **psubreq);
370 struct tevent_req *cli_close_send(TALLOC_CTX *mem_ctx,
371 struct event_context *ev,
372 struct cli_state *cli, uint16_t fnum);
373 NTSTATUS cli_close_recv(struct tevent_req *req);
374 NTSTATUS cli_close(struct cli_state *cli, uint16_t fnum);
375 struct tevent_req *cli_ftruncate_send(TALLOC_CTX *mem_ctx,
376 struct event_context *ev,
377 struct cli_state *cli,
380 NTSTATUS cli_ftruncate_recv(struct tevent_req *req);
381 NTSTATUS cli_ftruncate(struct cli_state *cli, uint16_t fnum, uint64_t size);
382 NTSTATUS cli_locktype(struct cli_state *cli, uint16_t fnum,
383 uint32_t offset, uint32_t len,
384 int timeout, unsigned char locktype);
385 bool cli_lock(struct cli_state *cli, uint16_t fnum,
386 uint32_t offset, uint32_t len, int timeout, enum brl_type lock_type);
387 struct tevent_req *cli_unlock_send(TALLOC_CTX *mem_ctx,
388 struct event_context *ev,
389 struct cli_state *cli,
393 NTSTATUS cli_unlock_recv(struct tevent_req *req);
394 NTSTATUS cli_unlock(struct cli_state *cli, uint16_t fnum, uint32_t offset, uint32_t len);
395 bool cli_lock64(struct cli_state *cli, uint16_t fnum,
396 uint64_t offset, uint64_t len, int timeout, enum brl_type lock_type);
397 struct tevent_req *cli_unlock64_send(TALLOC_CTX *mem_ctx,
398 struct event_context *ev,
399 struct cli_state *cli,
403 NTSTATUS cli_unlock64_recv(struct tevent_req *req);
404 NTSTATUS cli_unlock64(struct cli_state *cli, uint16_t fnum, uint64_t offset, uint64_t len);
405 struct tevent_req *cli_posix_lock_send(TALLOC_CTX *mem_ctx,
406 struct event_context *ev,
407 struct cli_state *cli,
412 enum brl_type lock_type);
413 NTSTATUS cli_posix_lock_recv(struct tevent_req *req);
414 NTSTATUS cli_posix_lock(struct cli_state *cli, uint16_t fnum,
415 uint64_t offset, uint64_t len,
416 bool wait_lock, enum brl_type lock_type);
417 struct tevent_req *cli_posix_unlock_send(TALLOC_CTX *mem_ctx,
418 struct event_context *ev,
419 struct cli_state *cli,
423 NTSTATUS cli_posix_unlock_recv(struct tevent_req *req);
424 NTSTATUS cli_posix_unlock(struct cli_state *cli, uint16_t fnum, uint64_t offset, uint64_t len);
425 struct tevent_req *cli_getattrE_send(TALLOC_CTX *mem_ctx,
426 struct event_context *ev,
427 struct cli_state *cli,
429 NTSTATUS cli_getattrE_recv(struct tevent_req *req,
435 NTSTATUS cli_getattrE(struct cli_state *cli,
442 struct tevent_req *cli_setattrE_send(TALLOC_CTX *mem_ctx,
443 struct event_context *ev,
444 struct cli_state *cli,
449 NTSTATUS cli_setattrE_recv(struct tevent_req *req);
450 NTSTATUS cli_setattrE(struct cli_state *cli,
455 struct tevent_req *cli_getatr_send(TALLOC_CTX *mem_ctx,
456 struct event_context *ev,
457 struct cli_state *cli,
459 NTSTATUS cli_getatr_recv(struct tevent_req *req,
463 NTSTATUS cli_getatr(struct cli_state *cli,
468 struct tevent_req *cli_setatr_send(TALLOC_CTX *mem_ctx,
469 struct event_context *ev,
470 struct cli_state *cli,
474 NTSTATUS cli_setatr_recv(struct tevent_req *req);
475 NTSTATUS cli_setatr(struct cli_state *cli,
479 struct tevent_req *cli_chkpath_send(TALLOC_CTX *mem_ctx,
480 struct event_context *ev,
481 struct cli_state *cli,
483 NTSTATUS cli_chkpath_recv(struct tevent_req *req);
484 NTSTATUS cli_chkpath(struct cli_state *cli, const char *path);
485 struct tevent_req *cli_dskattr_send(TALLOC_CTX *mem_ctx,
486 struct event_context *ev,
487 struct cli_state *cli);
488 NTSTATUS cli_dskattr_recv(struct tevent_req *req, int *bsize, int *total,
490 NTSTATUS cli_dskattr(struct cli_state *cli, int *bsize, int *total, int *avail);
491 struct tevent_req *cli_ctemp_send(TALLOC_CTX *mem_ctx,
492 struct event_context *ev,
493 struct cli_state *cli,
495 NTSTATUS cli_ctemp_recv(struct tevent_req *req,
499 NTSTATUS cli_ctemp(struct cli_state *cli,
504 NTSTATUS cli_raw_ioctl(struct cli_state *cli, uint16_t fnum, uint32_t code, DATA_BLOB *blob);
505 NTSTATUS cli_set_ea_path(struct cli_state *cli, const char *path,
506 const char *ea_name, const char *ea_val,
508 NTSTATUS cli_set_ea_fnum(struct cli_state *cli, uint16_t fnum,
509 const char *ea_name, const char *ea_val,
511 struct tevent_req *cli_get_ea_list_path_send(TALLOC_CTX *mem_ctx,
512 struct tevent_context *ev,
513 struct cli_state *cli,
515 NTSTATUS cli_get_ea_list_path_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
516 size_t *pnum_eas, struct ea_struct **peas);
517 NTSTATUS cli_get_ea_list_path(struct cli_state *cli, const char *path,
520 struct ea_struct **pea_list);
521 struct tevent_req *cli_posix_open_send(TALLOC_CTX *mem_ctx,
522 struct event_context *ev,
523 struct cli_state *cli,
527 NTSTATUS cli_posix_open_recv(struct tevent_req *req, uint16_t *pfnum);
528 NTSTATUS cli_posix_open(struct cli_state *cli, const char *fname,
529 int flags, mode_t mode, uint16_t *fnum);
530 struct tevent_req *cli_posix_mkdir_send(TALLOC_CTX *mem_ctx,
531 struct event_context *ev,
532 struct cli_state *cli,
535 NTSTATUS cli_posix_mkdir_recv(struct tevent_req *req);
536 NTSTATUS cli_posix_mkdir(struct cli_state *cli, const char *fname, mode_t mode);
538 struct tevent_req *cli_posix_unlink_send(TALLOC_CTX *mem_ctx,
539 struct event_context *ev,
540 struct cli_state *cli,
542 NTSTATUS cli_posix_unlink_recv(struct tevent_req *req);
543 NTSTATUS cli_posix_unlink(struct cli_state *cli, const char *fname);
545 struct tevent_req *cli_posix_rmdir_send(TALLOC_CTX *mem_ctx,
546 struct event_context *ev,
547 struct cli_state *cli,
549 NTSTATUS cli_posix_rmdir_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx);
550 NTSTATUS cli_posix_rmdir(struct cli_state *cli, const char *fname);
551 struct tevent_req *cli_notify_send(TALLOC_CTX *mem_ctx,
552 struct tevent_context *ev,
553 struct cli_state *cli, uint16_t fnum,
554 uint32_t buffer_size,
555 uint32_t completion_filter, bool recursive);
556 NTSTATUS cli_notify_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
557 uint32_t *pnum_changes,
558 struct notify_change **pchanges);
560 /* The following definitions come from libsmb/clifsinfo.c */
562 struct tevent_req *cli_unix_extensions_version_send(TALLOC_CTX *mem_ctx,
563 struct tevent_context *ev,
564 struct cli_state *cli);
565 NTSTATUS cli_unix_extensions_version_recv(struct tevent_req *req,
566 uint16_t *pmajor, uint16_t *pminor,
569 NTSTATUS cli_unix_extensions_version(struct cli_state *cli, uint16 *pmajor,
570 uint16 *pminor, uint32 *pcaplow,
572 struct tevent_req *cli_set_unix_extensions_capabilities_send(
573 TALLOC_CTX *mem_ctx, struct tevent_context *ev, struct cli_state *cli,
574 uint16_t major, uint16_t minor, uint32_t caplow, uint32_t caphigh);
575 NTSTATUS cli_set_unix_extensions_capabilities_recv(struct tevent_req *req);
576 NTSTATUS cli_set_unix_extensions_capabilities(struct cli_state *cli,
577 uint16 major, uint16 minor,
578 uint32 caplow, uint32 caphigh);
579 struct tevent_req *cli_get_fs_attr_info_send(TALLOC_CTX *mem_ctx,
580 struct tevent_context *ev,
581 struct cli_state *cli);
582 NTSTATUS cli_get_fs_attr_info_recv(struct tevent_req *req, uint32_t *fs_attr);
583 NTSTATUS cli_get_fs_attr_info(struct cli_state *cli, uint32_t *fs_attr);
584 NTSTATUS cli_get_fs_volume_info(struct cli_state *cli, fstring volume_name,
585 uint32 *pserial_number, time_t *pdate);
586 NTSTATUS cli_get_fs_full_size_info(struct cli_state *cli,
587 uint64_t *total_allocation_units,
588 uint64_t *caller_allocation_units,
589 uint64_t *actual_allocation_units,
590 uint64_t *sectors_per_allocation_unit,
591 uint64_t *bytes_per_sector);
592 NTSTATUS cli_get_posix_fs_info(struct cli_state *cli,
593 uint32 *optimal_transfer_size,
595 uint64_t *total_blocks,
596 uint64_t *blocks_available,
597 uint64_t *user_blocks_available,
598 uint64_t *total_file_nodes,
599 uint64_t *free_file_nodes,
600 uint64_t *fs_identifier);
601 NTSTATUS cli_raw_ntlm_smb_encryption_start(struct cli_state *cli,
605 NTSTATUS cli_gss_smb_encryption_start(struct cli_state *cli);
606 NTSTATUS cli_force_encryption(struct cli_state *c,
607 const char *username,
608 const char *password,
611 /* The following definitions come from libsmb/clilist.c */
613 NTSTATUS cli_list_old(struct cli_state *cli,const char *Mask,uint16 attribute,
614 NTSTATUS (*fn)(const char *, struct file_info *,
615 const char *, void *), void *state);
616 NTSTATUS cli_list_trans(struct cli_state *cli, const char *mask,
617 uint16_t attribute, int info_level,
618 NTSTATUS (*fn)(const char *mnt, struct file_info *finfo,
619 const char *mask, void *private_data),
621 struct tevent_req *cli_list_send(TALLOC_CTX *mem_ctx,
622 struct tevent_context *ev,
623 struct cli_state *cli,
626 uint16_t info_level);
627 NTSTATUS cli_list_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
628 struct file_info **finfo, size_t *num_finfo);
629 NTSTATUS cli_list(struct cli_state *cli,const char *Mask,uint16 attribute,
630 NTSTATUS (*fn)(const char *, struct file_info *, const char *,
631 void *), void *state);
633 /* The following definitions come from libsmb/climessage.c */
635 struct tevent_req *cli_message_send(TALLOC_CTX *mem_ctx,
636 struct tevent_context *ev,
637 struct cli_state *cli,
638 const char *host, const char *username,
639 const char *message);
640 NTSTATUS cli_message_recv(struct tevent_req *req);
641 NTSTATUS cli_message(struct cli_state *cli, const char *host,
642 const char *username, const char *message);
644 /* The following definitions come from libsmb/clioplock.c */
646 struct tevent_req *cli_oplock_ack_send(TALLOC_CTX *mem_ctx,
647 struct tevent_context *ev,
648 struct cli_state *cli,
649 uint16_t fnum, uint8_t level);
650 NTSTATUS cli_oplock_ack_recv(struct tevent_req *req);
651 NTSTATUS cli_oplock_ack(struct cli_state *cli, uint16_t fnum, unsigned char level);
652 void cli_oplock_handler(struct cli_state *cli,
653 NTSTATUS (*handler)(struct cli_state *, uint16_t, unsigned char));
655 /* The following definitions come from libsmb/cliprint.c */
657 int cli_print_queue(struct cli_state *cli,
658 void (*fn)(struct print_job_info *));
659 int cli_printjob_del(struct cli_state *cli, int job);
661 /* The following definitions come from libsmb/cliquota.c */
663 NTSTATUS cli_get_quota_handle(struct cli_state *cli, uint16_t *quota_fnum);
664 void free_ntquota_list(SMB_NTQUOTA_LIST **qt_list);
665 NTSTATUS cli_get_user_quota(struct cli_state *cli, int quota_fnum,
666 SMB_NTQUOTA_STRUCT *pqt);
667 NTSTATUS cli_set_user_quota(struct cli_state *cli, int quota_fnum,
668 SMB_NTQUOTA_STRUCT *pqt);
669 NTSTATUS cli_list_user_quota(struct cli_state *cli, int quota_fnum,
670 SMB_NTQUOTA_LIST **pqt_list);
671 NTSTATUS cli_get_fs_quota_info(struct cli_state *cli, int quota_fnum,
672 SMB_NTQUOTA_STRUCT *pqt);
673 NTSTATUS cli_set_fs_quota_info(struct cli_state *cli, int quota_fnum,
674 SMB_NTQUOTA_STRUCT *pqt);
676 /* The following definitions come from libsmb/clireadwrite.c */
678 struct tevent_req *cli_read_andx_create(TALLOC_CTX *mem_ctx,
679 struct event_context *ev,
680 struct cli_state *cli, uint16_t fnum,
681 off_t offset, size_t size,
682 struct tevent_req **psmbreq);
683 struct tevent_req *cli_read_andx_send(TALLOC_CTX *mem_ctx,
684 struct event_context *ev,
685 struct cli_state *cli, uint16_t fnum,
686 off_t offset, size_t size);
687 NTSTATUS cli_read_andx_recv(struct tevent_req *req, ssize_t *received,
689 struct tevent_req *cli_pull_send(TALLOC_CTX *mem_ctx,
690 struct event_context *ev,
691 struct cli_state *cli,
692 uint16_t fnum, off_t start_offset,
693 SMB_OFF_T size, size_t window_size,
694 NTSTATUS (*sink)(char *buf, size_t n,
697 NTSTATUS cli_pull_recv(struct tevent_req *req, SMB_OFF_T *received);
698 NTSTATUS cli_pull(struct cli_state *cli, uint16_t fnum,
699 off_t start_offset, SMB_OFF_T size, size_t window_size,
700 NTSTATUS (*sink)(char *buf, size_t n, void *priv),
701 void *priv, SMB_OFF_T *received);
702 ssize_t cli_read(struct cli_state *cli, uint16_t fnum, char *buf,
703 off_t offset, size_t size);
704 NTSTATUS cli_smbwrite(struct cli_state *cli, uint16_t fnum, char *buf,
705 off_t offset, size_t size1, size_t *ptotal);
706 struct tevent_req *cli_write_andx_create(TALLOC_CTX *mem_ctx,
707 struct event_context *ev,
708 struct cli_state *cli, uint16_t fnum,
709 uint16_t mode, const uint8_t *buf,
710 off_t offset, size_t size,
711 struct tevent_req **reqs_before,
713 struct tevent_req **psmbreq);
714 struct tevent_req *cli_write_andx_send(TALLOC_CTX *mem_ctx,
715 struct event_context *ev,
716 struct cli_state *cli, uint16_t fnum,
717 uint16_t mode, const uint8_t *buf,
718 off_t offset, size_t size);
719 NTSTATUS cli_write_andx_recv(struct tevent_req *req, size_t *pwritten);
721 NTSTATUS cli_writeall(struct cli_state *cli, uint16_t fnum, uint16_t mode,
722 const uint8_t *buf, off_t offset, size_t size,
725 struct tevent_req *cli_push_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
726 struct cli_state *cli,
727 uint16_t fnum, uint16_t mode,
728 off_t start_offset, size_t window_size,
729 size_t (*source)(uint8_t *buf, size_t n,
732 NTSTATUS cli_push_recv(struct tevent_req *req);
733 NTSTATUS cli_push(struct cli_state *cli, uint16_t fnum, uint16_t mode,
734 off_t start_offset, size_t window_size,
735 size_t (*source)(uint8_t *buf, size_t n, void *priv),
738 /* The following definitions come from libsmb/clisecdesc.c */
740 struct security_descriptor *cli_query_secdesc(struct cli_state *cli, uint16_t fnum,
741 TALLOC_CTX *mem_ctx);
742 NTSTATUS cli_set_secdesc(struct cli_state *cli, uint16_t fnum,
743 struct security_descriptor *sd);
745 /* The following definitions come from libsmb/clistr.c */
747 size_t clistr_push_fn(struct cli_state *cli,
752 size_t clistr_pull_fn(const char *inbuf,
758 size_t clistr_pull_talloc(TALLOC_CTX *ctx,
766 /* The following definitions come from libsmb/clitrans.c */
768 struct tevent_req *cli_trans_send(
769 TALLOC_CTX *mem_ctx, struct event_context *ev,
770 struct cli_state *cli, uint8_t cmd,
771 const char *pipe_name, uint16_t fid, uint16_t function, int flags,
772 uint16_t *setup, uint8_t num_setup, uint8_t max_setup,
773 uint8_t *param, uint32_t num_param, uint32_t max_param,
774 uint8_t *data, uint32_t num_data, uint32_t max_data);
775 NTSTATUS cli_trans_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
776 uint16_t *recv_flags2,
777 uint16_t **setup, uint8_t min_setup,
779 uint8_t **param, uint32_t min_param,
781 uint8_t **data, uint32_t min_data,
783 NTSTATUS cli_trans(TALLOC_CTX *mem_ctx, struct cli_state *cli,
785 const char *pipe_name, uint16_t fid, uint16_t function,
787 uint16_t *setup, uint8_t num_setup, uint8_t max_setup,
788 uint8_t *param, uint32_t num_param, uint32_t max_param,
789 uint8_t *data, uint32_t num_data, uint32_t max_data,
790 uint16_t *recv_flags2,
791 uint16_t **rsetup, uint8_t min_rsetup, uint8_t *num_rsetup,
792 uint8_t **rparam, uint32_t min_rparam, uint32_t *num_rparam,
793 uint8_t **rdata, uint32_t min_rdata, uint32_t *num_rdata);
795 /* The following definitions come from libsmb/smb_seal.c */
797 NTSTATUS get_enc_ctx_num(const uint8_t *buf, uint16 *p_enc_ctx_num);
798 bool common_encryption_on(struct smb_trans_enc_state *es);
799 NTSTATUS common_ntlm_decrypt_buffer(struct ntlmssp_state *ntlmssp_state, char *buf);
800 NTSTATUS common_ntlm_encrypt_buffer(struct ntlmssp_state *ntlmssp_state,
804 NTSTATUS common_encrypt_buffer(struct smb_trans_enc_state *es, char *buffer, char **buf_out);
805 NTSTATUS common_decrypt_buffer(struct smb_trans_enc_state *es, char *buf);
806 void common_free_encryption_state(struct smb_trans_enc_state **pp_es);
807 void common_free_enc_buffer(struct smb_trans_enc_state *es, char *buf);
808 bool cli_encryption_on(struct cli_state *cli);
809 void cli_free_encryption_context(struct cli_state *cli);
810 void cli_free_enc_buffer(struct cli_state *cli, char *buf);
812 /* The following definitions come from libsmb/clisigning.c */
814 bool cli_simple_set_signing(struct cli_state *cli,
815 const DATA_BLOB user_session_key,
816 const DATA_BLOB response);
817 bool cli_temp_set_signing(struct cli_state *cli);
818 void cli_calculate_sign_mac(struct cli_state *cli, char *buf, uint32_t *seqnum);
819 bool cli_check_sign_mac(struct cli_state *cli, const char *buf, uint32_t seqnum);
820 bool client_is_signing_on(struct cli_state *cli);
821 bool client_is_signing_allowed(struct cli_state *cli);
822 bool client_is_signing_mandatory(struct cli_state *cli);
823 void cli_set_signing_negotiated(struct cli_state *cli);
825 #endif /* _LIBSMB_PROTO_H_ */