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
, const struct sockaddr_storage
*dest_ss
,
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 const 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 const 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(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 *remote_name
,
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 const struct sockaddr_storage
*cli_state_local_sockaddr(struct cli_state
*cli
);
171 const struct sockaddr_storage
*cli_state_remote_sockaddr(struct cli_state
*cli
);
172 const char *cli_state_remote_name(struct cli_state
*cli
);
173 uint16_t cli_state_get_vc_num(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 struct tevent_req
*cli_echo_send(TALLOC_CTX
*mem_ctx
, struct event_context
*ev
,
183 struct cli_state
*cli
, uint16_t num_echos
,
185 NTSTATUS
cli_echo_recv(struct tevent_req
*req
);
186 NTSTATUS
cli_echo(struct cli_state
*cli
, uint16_t num_echos
, DATA_BLOB data
);
187 bool cli_ucs2(struct cli_state
*cli
);
188 bool is_andx_req(uint8_t cmd
);
189 NTSTATUS
cli_smb(TALLOC_CTX
*mem_ctx
, struct cli_state
*cli
,
190 uint8_t smb_command
, uint8_t additional_flags
,
191 uint8_t wct
, uint16_t *vwv
,
192 uint32_t num_bytes
, const uint8_t *bytes
,
193 struct tevent_req
**result_parent
,
194 uint8_t min_wct
, uint8_t *pwct
, uint16_t **pvwv
,
195 uint32_t *pnum_bytes
, uint8_t **pbytes
);
197 /* The following definitions come from libsmb/clierror.c */
199 const char *cli_errstr(struct cli_state
*cli
);
200 NTSTATUS
cli_nt_error(struct cli_state
*cli
);
201 void cli_dos_error(struct cli_state
*cli
, uint8
*eclass
, uint32
*ecode
);
202 int cli_errno(struct cli_state
*cli
);
203 bool cli_is_error(struct cli_state
*cli
);
204 bool cli_is_nt_error(struct cli_state
*cli
);
205 bool cli_is_dos_error(struct cli_state
*cli
);
206 bool cli_state_is_connected(struct cli_state
*cli
);
207 void cli_state_disconnect(struct cli_state
*cli
);
209 /* The following definitions come from libsmb/clifile.c */
211 struct tevent_req
*cli_setpathinfo_send(TALLOC_CTX
*mem_ctx
,
212 struct tevent_context
*ev
,
213 struct cli_state
*cli
,
218 NTSTATUS
cli_setpathinfo_recv(struct tevent_req
*req
);
219 NTSTATUS
cli_setpathinfo(struct cli_state
*cli
,
225 struct tevent_req
*cli_posix_symlink_send(TALLOC_CTX
*mem_ctx
,
226 struct event_context
*ev
,
227 struct cli_state
*cli
,
229 const char *newname
);
230 NTSTATUS
cli_posix_symlink_recv(struct tevent_req
*req
);
231 NTSTATUS
cli_posix_symlink(struct cli_state
*cli
,
233 const char *newname
);
234 struct tevent_req
*cli_posix_readlink_send(TALLOC_CTX
*mem_ctx
,
235 struct event_context
*ev
,
236 struct cli_state
*cli
,
239 NTSTATUS
cli_posix_readlink_recv(struct tevent_req
*req
, struct cli_state
*cli
,
240 char *retpath
, size_t len
);
241 NTSTATUS
cli_posix_readlink(struct cli_state
*cli
, const char *fname
,
242 char *linkpath
, size_t len
);
243 struct tevent_req
*cli_posix_hardlink_send(TALLOC_CTX
*mem_ctx
,
244 struct event_context
*ev
,
245 struct cli_state
*cli
,
247 const char *newname
);
248 NTSTATUS
cli_posix_hardlink_recv(struct tevent_req
*req
);
249 NTSTATUS
cli_posix_hardlink(struct cli_state
*cli
,
251 const char *newname
);
252 uint32_t unix_perms_to_wire(mode_t perms
);
253 mode_t
wire_perms_to_unix(uint32_t perms
);
254 struct tevent_req
*cli_posix_getfacl_send(TALLOC_CTX
*mem_ctx
,
255 struct event_context
*ev
,
256 struct cli_state
*cli
,
258 NTSTATUS
cli_posix_getfacl_recv(struct tevent_req
*req
,
262 NTSTATUS
cli_posix_getfacl(struct cli_state
*cli
,
267 struct tevent_req
*cli_posix_stat_send(TALLOC_CTX
*mem_ctx
,
268 struct event_context
*ev
,
269 struct cli_state
*cli
,
271 NTSTATUS
cli_posix_stat_recv(struct tevent_req
*req
,
272 SMB_STRUCT_STAT
*sbuf
);
273 NTSTATUS
cli_posix_stat(struct cli_state
*cli
,
275 SMB_STRUCT_STAT
*sbuf
);
276 struct tevent_req
*cli_posix_chmod_send(TALLOC_CTX
*mem_ctx
,
277 struct event_context
*ev
,
278 struct cli_state
*cli
,
281 NTSTATUS
cli_posix_chmod_recv(struct tevent_req
*req
);
282 NTSTATUS
cli_posix_chmod(struct cli_state
*cli
, const char *fname
, mode_t mode
);
283 struct tevent_req
*cli_posix_chown_send(TALLOC_CTX
*mem_ctx
,
284 struct event_context
*ev
,
285 struct cli_state
*cli
,
289 NTSTATUS
cli_posix_chown_recv(struct tevent_req
*req
);
290 NTSTATUS
cli_posix_chown(struct cli_state
*cli
,
294 struct tevent_req
*cli_rename_send(TALLOC_CTX
*mem_ctx
,
295 struct event_context
*ev
,
296 struct cli_state
*cli
,
297 const char *fname_src
,
298 const char *fname_dst
);
299 NTSTATUS
cli_rename_recv(struct tevent_req
*req
);
300 NTSTATUS
cli_rename(struct cli_state
*cli
, const char *fname_src
, const char *fname_dst
);
301 struct tevent_req
*cli_ntrename_send(TALLOC_CTX
*mem_ctx
,
302 struct event_context
*ev
,
303 struct cli_state
*cli
,
304 const char *fname_src
,
305 const char *fname_dst
);
306 NTSTATUS
cli_ntrename_recv(struct tevent_req
*req
);
307 NTSTATUS
cli_ntrename(struct cli_state
*cli
, const char *fname_src
, const char *fname_dst
);
309 struct tevent_req
*cli_nt_hardlink_send(TALLOC_CTX
*mem_ctx
,
310 struct event_context
*ev
,
311 struct cli_state
*cli
,
312 const char *fname_src
,
313 const char *fname_dst
);
314 NTSTATUS
cli_nt_hardlink_recv(struct tevent_req
*req
);
315 NTSTATUS
cli_nt_hardlink(struct cli_state
*cli
, const char *fname_src
, const char *fname_dst
);
317 struct tevent_req
*cli_unlink_send(TALLOC_CTX
*mem_ctx
,
318 struct event_context
*ev
,
319 struct cli_state
*cli
,
321 uint16_t mayhave_attrs
);
322 NTSTATUS
cli_unlink_recv(struct tevent_req
*req
);
323 NTSTATUS
cli_unlink(struct cli_state
*cli
, const char *fname
, uint16_t mayhave_attrs
);
325 struct tevent_req
*cli_mkdir_send(TALLOC_CTX
*mem_ctx
,
326 struct event_context
*ev
,
327 struct cli_state
*cli
,
329 NTSTATUS
cli_mkdir_recv(struct tevent_req
*req
);
330 NTSTATUS
cli_mkdir(struct cli_state
*cli
, const char *dname
);
331 struct tevent_req
*cli_rmdir_send(TALLOC_CTX
*mem_ctx
,
332 struct event_context
*ev
,
333 struct cli_state
*cli
,
335 NTSTATUS
cli_rmdir_recv(struct tevent_req
*req
);
336 NTSTATUS
cli_rmdir(struct cli_state
*cli
, const char *dname
);
337 struct tevent_req
*cli_nt_delete_on_close_send(TALLOC_CTX
*mem_ctx
,
338 struct event_context
*ev
,
339 struct cli_state
*cli
,
342 NTSTATUS
cli_nt_delete_on_close_recv(struct tevent_req
*req
);
343 NTSTATUS
cli_nt_delete_on_close(struct cli_state
*cli
, uint16_t fnum
, bool flag
);
344 struct tevent_req
*cli_ntcreate_send(TALLOC_CTX
*mem_ctx
,
345 struct event_context
*ev
,
346 struct cli_state
*cli
,
349 uint32_t DesiredAccess
,
350 uint32_t FileAttributes
,
351 uint32_t ShareAccess
,
352 uint32_t CreateDisposition
,
353 uint32_t CreateOptions
,
354 uint8_t SecurityFlags
);
355 NTSTATUS
cli_ntcreate_recv(struct tevent_req
*req
, uint16_t *pfnum
);
356 NTSTATUS
cli_ntcreate(struct cli_state
*cli
,
359 uint32_t DesiredAccess
,
360 uint32_t FileAttributes
,
361 uint32_t ShareAccess
,
362 uint32_t CreateDisposition
,
363 uint32_t CreateOptions
,
364 uint8_t SecurityFlags
,
366 uint8_t *smb_bytes_push_str(uint8_t *buf
, bool ucs2
, const char *str
,
367 size_t str_len
, size_t *pconverted_size
);
368 uint8_t *smb_bytes_push_bytes(uint8_t *buf
, uint8_t prefix
,
369 const uint8_t *bytes
, size_t num_bytes
);
370 uint8_t *trans2_bytes_push_str(uint8_t *buf
, bool ucs2
,
371 const char *str
, size_t str_len
,
372 size_t *pconverted_size
);
373 uint8_t *trans2_bytes_push_bytes(uint8_t *buf
,
374 const uint8_t *bytes
, size_t num_bytes
);
375 struct tevent_req
*cli_open_create(TALLOC_CTX
*mem_ctx
,
376 struct event_context
*ev
,
377 struct cli_state
*cli
, const char *fname
,
378 int flags
, int share_mode
,
379 struct tevent_req
**psmbreq
);
380 struct tevent_req
*cli_open_send(TALLOC_CTX
*mem_ctx
, struct event_context
*ev
,
381 struct cli_state
*cli
, const char *fname
,
382 int flags
, int share_mode
);
383 NTSTATUS
cli_open_recv(struct tevent_req
*req
, uint16_t *fnum
);
384 NTSTATUS
cli_open(struct cli_state
*cli
, const char *fname
, int flags
, int share_mode
, uint16_t *pfnum
);
385 struct tevent_req
*cli_close_create(TALLOC_CTX
*mem_ctx
,
386 struct event_context
*ev
,
387 struct cli_state
*cli
, uint16_t fnum
,
388 struct tevent_req
**psubreq
);
389 struct tevent_req
*cli_close_send(TALLOC_CTX
*mem_ctx
,
390 struct event_context
*ev
,
391 struct cli_state
*cli
, uint16_t fnum
);
392 NTSTATUS
cli_close_recv(struct tevent_req
*req
);
393 NTSTATUS
cli_close(struct cli_state
*cli
, uint16_t fnum
);
394 struct tevent_req
*cli_ftruncate_send(TALLOC_CTX
*mem_ctx
,
395 struct event_context
*ev
,
396 struct cli_state
*cli
,
399 NTSTATUS
cli_ftruncate_recv(struct tevent_req
*req
);
400 NTSTATUS
cli_ftruncate(struct cli_state
*cli
, uint16_t fnum
, uint64_t size
);
401 NTSTATUS
cli_locktype(struct cli_state
*cli
, uint16_t fnum
,
402 uint32_t offset
, uint32_t len
,
403 int timeout
, unsigned char locktype
);
404 NTSTATUS
cli_lock32(struct cli_state
*cli
, uint16_t fnum
, uint32_t offset
,
405 uint32_t len
, int timeout
, enum brl_type lock_type
);
406 struct tevent_req
*cli_unlock_send(TALLOC_CTX
*mem_ctx
,
407 struct event_context
*ev
,
408 struct cli_state
*cli
,
412 NTSTATUS
cli_unlock_recv(struct tevent_req
*req
);
413 NTSTATUS
cli_unlock(struct cli_state
*cli
, uint16_t fnum
, uint32_t offset
, uint32_t len
);
414 NTSTATUS
cli_lock64(struct cli_state
*cli
, uint16_t fnum
,
415 uint64_t offset
, uint64_t len
, int timeout
,
416 enum brl_type lock_type
);
417 struct tevent_req
*cli_unlock64_send(TALLOC_CTX
*mem_ctx
,
418 struct event_context
*ev
,
419 struct cli_state
*cli
,
423 NTSTATUS
cli_unlock64_recv(struct tevent_req
*req
);
424 NTSTATUS
cli_unlock64(struct cli_state
*cli
, uint16_t fnum
, uint64_t offset
, uint64_t len
);
425 struct tevent_req
*cli_posix_lock_send(TALLOC_CTX
*mem_ctx
,
426 struct event_context
*ev
,
427 struct cli_state
*cli
,
432 enum brl_type lock_type
);
433 NTSTATUS
cli_posix_lock_recv(struct tevent_req
*req
);
434 NTSTATUS
cli_posix_lock(struct cli_state
*cli
, uint16_t fnum
,
435 uint64_t offset
, uint64_t len
,
436 bool wait_lock
, enum brl_type lock_type
);
437 struct tevent_req
*cli_posix_unlock_send(TALLOC_CTX
*mem_ctx
,
438 struct event_context
*ev
,
439 struct cli_state
*cli
,
443 NTSTATUS
cli_posix_unlock_recv(struct tevent_req
*req
);
444 NTSTATUS
cli_posix_unlock(struct cli_state
*cli
, uint16_t fnum
, uint64_t offset
, uint64_t len
);
445 struct tevent_req
*cli_getattrE_send(TALLOC_CTX
*mem_ctx
,
446 struct event_context
*ev
,
447 struct cli_state
*cli
,
449 NTSTATUS
cli_getattrE_recv(struct tevent_req
*req
,
455 NTSTATUS
cli_getattrE(struct cli_state
*cli
,
462 struct tevent_req
*cli_setattrE_send(TALLOC_CTX
*mem_ctx
,
463 struct event_context
*ev
,
464 struct cli_state
*cli
,
469 NTSTATUS
cli_setattrE_recv(struct tevent_req
*req
);
470 NTSTATUS
cli_setattrE(struct cli_state
*cli
,
475 struct tevent_req
*cli_getatr_send(TALLOC_CTX
*mem_ctx
,
476 struct event_context
*ev
,
477 struct cli_state
*cli
,
479 NTSTATUS
cli_getatr_recv(struct tevent_req
*req
,
483 NTSTATUS
cli_getatr(struct cli_state
*cli
,
488 struct tevent_req
*cli_setatr_send(TALLOC_CTX
*mem_ctx
,
489 struct event_context
*ev
,
490 struct cli_state
*cli
,
494 NTSTATUS
cli_setatr_recv(struct tevent_req
*req
);
495 NTSTATUS
cli_setatr(struct cli_state
*cli
,
499 struct tevent_req
*cli_chkpath_send(TALLOC_CTX
*mem_ctx
,
500 struct event_context
*ev
,
501 struct cli_state
*cli
,
503 NTSTATUS
cli_chkpath_recv(struct tevent_req
*req
);
504 NTSTATUS
cli_chkpath(struct cli_state
*cli
, const char *path
);
505 struct tevent_req
*cli_dskattr_send(TALLOC_CTX
*mem_ctx
,
506 struct event_context
*ev
,
507 struct cli_state
*cli
);
508 NTSTATUS
cli_dskattr_recv(struct tevent_req
*req
, int *bsize
, int *total
,
510 NTSTATUS
cli_dskattr(struct cli_state
*cli
, int *bsize
, int *total
, int *avail
);
511 struct tevent_req
*cli_ctemp_send(TALLOC_CTX
*mem_ctx
,
512 struct event_context
*ev
,
513 struct cli_state
*cli
,
515 NTSTATUS
cli_ctemp_recv(struct tevent_req
*req
,
519 NTSTATUS
cli_ctemp(struct cli_state
*cli
,
524 NTSTATUS
cli_raw_ioctl(struct cli_state
*cli
, uint16_t fnum
, uint32_t code
, DATA_BLOB
*blob
);
525 NTSTATUS
cli_set_ea_path(struct cli_state
*cli
, const char *path
,
526 const char *ea_name
, const char *ea_val
,
528 NTSTATUS
cli_set_ea_fnum(struct cli_state
*cli
, uint16_t fnum
,
529 const char *ea_name
, const char *ea_val
,
531 struct tevent_req
*cli_get_ea_list_path_send(TALLOC_CTX
*mem_ctx
,
532 struct tevent_context
*ev
,
533 struct cli_state
*cli
,
535 NTSTATUS
cli_get_ea_list_path_recv(struct tevent_req
*req
, TALLOC_CTX
*mem_ctx
,
536 size_t *pnum_eas
, struct ea_struct
**peas
);
537 NTSTATUS
cli_get_ea_list_path(struct cli_state
*cli
, const char *path
,
540 struct ea_struct
**pea_list
);
541 struct tevent_req
*cli_posix_open_send(TALLOC_CTX
*mem_ctx
,
542 struct event_context
*ev
,
543 struct cli_state
*cli
,
547 NTSTATUS
cli_posix_open_recv(struct tevent_req
*req
, uint16_t *pfnum
);
548 NTSTATUS
cli_posix_open(struct cli_state
*cli
, const char *fname
,
549 int flags
, mode_t mode
, uint16_t *fnum
);
550 struct tevent_req
*cli_posix_mkdir_send(TALLOC_CTX
*mem_ctx
,
551 struct event_context
*ev
,
552 struct cli_state
*cli
,
555 NTSTATUS
cli_posix_mkdir_recv(struct tevent_req
*req
);
556 NTSTATUS
cli_posix_mkdir(struct cli_state
*cli
, const char *fname
, mode_t mode
);
558 struct tevent_req
*cli_posix_unlink_send(TALLOC_CTX
*mem_ctx
,
559 struct event_context
*ev
,
560 struct cli_state
*cli
,
562 NTSTATUS
cli_posix_unlink_recv(struct tevent_req
*req
);
563 NTSTATUS
cli_posix_unlink(struct cli_state
*cli
, const char *fname
);
565 struct tevent_req
*cli_posix_rmdir_send(TALLOC_CTX
*mem_ctx
,
566 struct event_context
*ev
,
567 struct cli_state
*cli
,
569 NTSTATUS
cli_posix_rmdir_recv(struct tevent_req
*req
, TALLOC_CTX
*mem_ctx
);
570 NTSTATUS
cli_posix_rmdir(struct cli_state
*cli
, const char *fname
);
571 struct tevent_req
*cli_notify_send(TALLOC_CTX
*mem_ctx
,
572 struct tevent_context
*ev
,
573 struct cli_state
*cli
, uint16_t fnum
,
574 uint32_t buffer_size
,
575 uint32_t completion_filter
, bool recursive
);
576 NTSTATUS
cli_notify_recv(struct tevent_req
*req
, TALLOC_CTX
*mem_ctx
,
577 uint32_t *pnum_changes
,
578 struct notify_change
**pchanges
);
580 struct tevent_req
*cli_nttrans_create_send(TALLOC_CTX
*mem_ctx
,
581 struct event_context
*ev
,
582 struct cli_state
*cli
,
585 uint32_t DesiredAccess
,
586 uint32_t FileAttributes
,
587 uint32_t ShareAccess
,
588 uint32_t CreateDisposition
,
589 uint32_t CreateOptions
,
590 uint8_t SecurityFlags
,
591 struct security_descriptor
*secdesc
,
592 struct ea_struct
*eas
,
594 NTSTATUS
cli_nttrans_create_recv(struct tevent_req
*req
, uint16_t *fnum
);
595 NTSTATUS
cli_nttrans_create(struct cli_state
*cli
,
598 uint32_t DesiredAccess
,
599 uint32_t FileAttributes
,
600 uint32_t ShareAccess
,
601 uint32_t CreateDisposition
,
602 uint32_t CreateOptions
,
603 uint8_t SecurityFlags
,
604 struct security_descriptor
*secdesc
,
605 struct ea_struct
*eas
,
609 /* The following definitions come from libsmb/clifsinfo.c */
611 struct tevent_req
*cli_unix_extensions_version_send(TALLOC_CTX
*mem_ctx
,
612 struct tevent_context
*ev
,
613 struct cli_state
*cli
);
614 NTSTATUS
cli_unix_extensions_version_recv(struct tevent_req
*req
,
615 uint16_t *pmajor
, uint16_t *pminor
,
618 NTSTATUS
cli_unix_extensions_version(struct cli_state
*cli
, uint16
*pmajor
,
619 uint16
*pminor
, uint32
*pcaplow
,
621 struct tevent_req
*cli_set_unix_extensions_capabilities_send(
622 TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
, struct cli_state
*cli
,
623 uint16_t major
, uint16_t minor
, uint32_t caplow
, uint32_t caphigh
);
624 NTSTATUS
cli_set_unix_extensions_capabilities_recv(struct tevent_req
*req
);
625 NTSTATUS
cli_set_unix_extensions_capabilities(struct cli_state
*cli
,
626 uint16 major
, uint16 minor
,
627 uint32 caplow
, uint32 caphigh
);
628 struct tevent_req
*cli_get_fs_attr_info_send(TALLOC_CTX
*mem_ctx
,
629 struct tevent_context
*ev
,
630 struct cli_state
*cli
);
631 NTSTATUS
cli_get_fs_attr_info_recv(struct tevent_req
*req
, uint32_t *fs_attr
);
632 NTSTATUS
cli_get_fs_attr_info(struct cli_state
*cli
, uint32_t *fs_attr
);
633 NTSTATUS
cli_get_fs_volume_info(struct cli_state
*cli
,
634 TALLOC_CTX
*mem_ctx
, char **volume_name
,
635 uint32
*pserial_number
, time_t *pdate
);
636 NTSTATUS
cli_get_fs_full_size_info(struct cli_state
*cli
,
637 uint64_t *total_allocation_units
,
638 uint64_t *caller_allocation_units
,
639 uint64_t *actual_allocation_units
,
640 uint64_t *sectors_per_allocation_unit
,
641 uint64_t *bytes_per_sector
);
642 NTSTATUS
cli_get_posix_fs_info(struct cli_state
*cli
,
643 uint32
*optimal_transfer_size
,
645 uint64_t *total_blocks
,
646 uint64_t *blocks_available
,
647 uint64_t *user_blocks_available
,
648 uint64_t *total_file_nodes
,
649 uint64_t *free_file_nodes
,
650 uint64_t *fs_identifier
);
651 NTSTATUS
cli_raw_ntlm_smb_encryption_start(struct cli_state
*cli
,
655 NTSTATUS
cli_gss_smb_encryption_start(struct cli_state
*cli
);
656 NTSTATUS
cli_force_encryption(struct cli_state
*c
,
657 const char *username
,
658 const char *password
,
661 /* The following definitions come from libsmb/clilist.c */
663 NTSTATUS
cli_list_old(struct cli_state
*cli
,const char *Mask
,uint16 attribute
,
664 NTSTATUS (*fn
)(const char *, struct file_info
*,
665 const char *, void *), void *state
);
666 NTSTATUS
cli_list_trans(struct cli_state
*cli
, const char *mask
,
667 uint16_t attribute
, int info_level
,
668 NTSTATUS (*fn
)(const char *mnt
, struct file_info
*finfo
,
669 const char *mask
, void *private_data
),
671 struct tevent_req
*cli_list_send(TALLOC_CTX
*mem_ctx
,
672 struct tevent_context
*ev
,
673 struct cli_state
*cli
,
676 uint16_t info_level
);
677 NTSTATUS
cli_list_recv(struct tevent_req
*req
, TALLOC_CTX
*mem_ctx
,
678 struct file_info
**finfo
, size_t *num_finfo
);
679 NTSTATUS
cli_list(struct cli_state
*cli
,const char *Mask
,uint16 attribute
,
680 NTSTATUS (*fn
)(const char *, struct file_info
*, const char *,
681 void *), void *state
);
683 /* The following definitions come from libsmb/climessage.c */
685 struct tevent_req
*cli_message_send(TALLOC_CTX
*mem_ctx
,
686 struct tevent_context
*ev
,
687 struct cli_state
*cli
,
688 const char *host
, const char *username
,
689 const char *message
);
690 NTSTATUS
cli_message_recv(struct tevent_req
*req
);
691 NTSTATUS
cli_message(struct cli_state
*cli
, const char *host
,
692 const char *username
, const char *message
);
694 /* The following definitions come from libsmb/clioplock.c */
696 struct tevent_req
*cli_oplock_ack_send(TALLOC_CTX
*mem_ctx
,
697 struct tevent_context
*ev
,
698 struct cli_state
*cli
,
699 uint16_t fnum
, uint8_t level
);
700 NTSTATUS
cli_oplock_ack_recv(struct tevent_req
*req
);
702 /* The following definitions come from libsmb/cliprint.c */
704 int cli_print_queue(struct cli_state
*cli
,
705 void (*fn
)(struct print_job_info
*));
706 int cli_printjob_del(struct cli_state
*cli
, int job
);
708 /* The following definitions come from libsmb/cliquota.c */
710 NTSTATUS
cli_get_quota_handle(struct cli_state
*cli
, uint16_t *quota_fnum
);
711 void free_ntquota_list(SMB_NTQUOTA_LIST
**qt_list
);
712 NTSTATUS
cli_get_user_quota(struct cli_state
*cli
, int quota_fnum
,
713 SMB_NTQUOTA_STRUCT
*pqt
);
714 NTSTATUS
cli_set_user_quota(struct cli_state
*cli
, int quota_fnum
,
715 SMB_NTQUOTA_STRUCT
*pqt
);
716 NTSTATUS
cli_list_user_quota(struct cli_state
*cli
, int quota_fnum
,
717 SMB_NTQUOTA_LIST
**pqt_list
);
718 NTSTATUS
cli_get_fs_quota_info(struct cli_state
*cli
, int quota_fnum
,
719 SMB_NTQUOTA_STRUCT
*pqt
);
720 NTSTATUS
cli_set_fs_quota_info(struct cli_state
*cli
, int quota_fnum
,
721 SMB_NTQUOTA_STRUCT
*pqt
);
723 /* The following definitions come from libsmb/clireadwrite.c */
725 struct tevent_req
*cli_read_andx_create(TALLOC_CTX
*mem_ctx
,
726 struct event_context
*ev
,
727 struct cli_state
*cli
, uint16_t fnum
,
728 off_t offset
, size_t size
,
729 struct tevent_req
**psmbreq
);
730 struct tevent_req
*cli_read_andx_send(TALLOC_CTX
*mem_ctx
,
731 struct event_context
*ev
,
732 struct cli_state
*cli
, uint16_t fnum
,
733 off_t offset
, size_t size
);
734 NTSTATUS
cli_read_andx_recv(struct tevent_req
*req
, ssize_t
*received
,
736 struct tevent_req
*cli_pull_send(TALLOC_CTX
*mem_ctx
,
737 struct event_context
*ev
,
738 struct cli_state
*cli
,
739 uint16_t fnum
, off_t start_offset
,
740 SMB_OFF_T size
, size_t window_size
,
741 NTSTATUS (*sink
)(char *buf
, size_t n
,
744 NTSTATUS
cli_pull_recv(struct tevent_req
*req
, SMB_OFF_T
*received
);
745 NTSTATUS
cli_pull(struct cli_state
*cli
, uint16_t fnum
,
746 off_t start_offset
, SMB_OFF_T size
, size_t window_size
,
747 NTSTATUS (*sink
)(char *buf
, size_t n
, void *priv
),
748 void *priv
, SMB_OFF_T
*received
);
749 NTSTATUS
cli_read(struct cli_state
*cli
, uint16_t fnum
,
750 char *buf
, off_t offset
, size_t size
,
752 NTSTATUS
cli_smbwrite(struct cli_state
*cli
, uint16_t fnum
, char *buf
,
753 off_t offset
, size_t size1
, size_t *ptotal
);
754 struct tevent_req
*cli_write_andx_create(TALLOC_CTX
*mem_ctx
,
755 struct event_context
*ev
,
756 struct cli_state
*cli
, uint16_t fnum
,
757 uint16_t mode
, const uint8_t *buf
,
758 off_t offset
, size_t size
,
759 struct tevent_req
**reqs_before
,
761 struct tevent_req
**psmbreq
);
762 struct tevent_req
*cli_write_andx_send(TALLOC_CTX
*mem_ctx
,
763 struct event_context
*ev
,
764 struct cli_state
*cli
, uint16_t fnum
,
765 uint16_t mode
, const uint8_t *buf
,
766 off_t offset
, size_t size
);
767 NTSTATUS
cli_write_andx_recv(struct tevent_req
*req
, size_t *pwritten
);
769 NTSTATUS
cli_writeall(struct cli_state
*cli
, uint16_t fnum
, uint16_t mode
,
770 const uint8_t *buf
, off_t offset
, size_t size
,
773 struct tevent_req
*cli_push_send(TALLOC_CTX
*mem_ctx
, struct event_context
*ev
,
774 struct cli_state
*cli
,
775 uint16_t fnum
, uint16_t mode
,
776 off_t start_offset
, size_t window_size
,
777 size_t (*source
)(uint8_t *buf
, size_t n
,
780 NTSTATUS
cli_push_recv(struct tevent_req
*req
);
781 NTSTATUS
cli_push(struct cli_state
*cli
, uint16_t fnum
, uint16_t mode
,
782 off_t start_offset
, size_t window_size
,
783 size_t (*source
)(uint8_t *buf
, size_t n
, void *priv
),
786 /* The following definitions come from libsmb/clisecdesc.c */
788 struct security_descriptor
*cli_query_secdesc(struct cli_state
*cli
, uint16_t fnum
,
789 TALLOC_CTX
*mem_ctx
);
790 NTSTATUS
cli_set_secdesc(struct cli_state
*cli
, uint16_t fnum
,
791 struct security_descriptor
*sd
);
793 /* The following definitions come from libsmb/clistr.c */
795 size_t clistr_pull_talloc(TALLOC_CTX
*ctx
,
803 /* The following definitions come from libsmb/clitrans.c */
805 struct tevent_req
*cli_trans_send(
806 TALLOC_CTX
*mem_ctx
, struct event_context
*ev
,
807 struct cli_state
*cli
, uint8_t cmd
,
808 const char *pipe_name
, uint16_t fid
, uint16_t function
, int flags
,
809 uint16_t *setup
, uint8_t num_setup
, uint8_t max_setup
,
810 uint8_t *param
, uint32_t num_param
, uint32_t max_param
,
811 uint8_t *data
, uint32_t num_data
, uint32_t max_data
);
812 NTSTATUS
cli_trans_recv(struct tevent_req
*req
, TALLOC_CTX
*mem_ctx
,
813 uint16_t *recv_flags2
,
814 uint16_t **setup
, uint8_t min_setup
,
816 uint8_t **param
, uint32_t min_param
,
818 uint8_t **data
, uint32_t min_data
,
820 NTSTATUS
cli_trans(TALLOC_CTX
*mem_ctx
, struct cli_state
*cli
,
822 const char *pipe_name
, uint16_t fid
, uint16_t function
,
824 uint16_t *setup
, uint8_t num_setup
, uint8_t max_setup
,
825 uint8_t *param
, uint32_t num_param
, uint32_t max_param
,
826 uint8_t *data
, uint32_t num_data
, uint32_t max_data
,
827 uint16_t *recv_flags2
,
828 uint16_t **rsetup
, uint8_t min_rsetup
, uint8_t *num_rsetup
,
829 uint8_t **rparam
, uint32_t min_rparam
, uint32_t *num_rparam
,
830 uint8_t **rdata
, uint32_t min_rdata
, uint32_t *num_rdata
);
832 /* The following definitions come from libsmb/smb_seal.c */
834 NTSTATUS
get_enc_ctx_num(const uint8_t *buf
, uint16
*p_enc_ctx_num
);
835 bool common_encryption_on(struct smb_trans_enc_state
*es
);
836 NTSTATUS
common_ntlm_decrypt_buffer(struct ntlmssp_state
*ntlmssp_state
, char *buf
);
837 NTSTATUS
common_ntlm_encrypt_buffer(struct ntlmssp_state
*ntlmssp_state
,
841 NTSTATUS
common_encrypt_buffer(struct smb_trans_enc_state
*es
, char *buffer
, char **buf_out
);
842 NTSTATUS
common_decrypt_buffer(struct smb_trans_enc_state
*es
, char *buf
);
843 void common_free_encryption_state(struct smb_trans_enc_state
**pp_es
);
844 void common_free_enc_buffer(struct smb_trans_enc_state
*es
, char *buf
);
845 bool cli_encryption_on(struct cli_state
*cli
);
846 void cli_free_encryption_context(struct cli_state
*cli
);
847 void cli_free_enc_buffer(struct cli_state
*cli
, char *buf
);
849 /* The following definitions come from libsmb/clisigning.c */
851 bool cli_simple_set_signing(struct cli_state
*cli
,
852 const DATA_BLOB user_session_key
,
853 const DATA_BLOB response
);
854 bool cli_temp_set_signing(struct cli_state
*cli
);
855 void cli_calculate_sign_mac(struct cli_state
*cli
, char *buf
, uint32_t *seqnum
);
856 bool cli_check_sign_mac(struct cli_state
*cli
, const char *buf
, uint32_t seqnum
);
857 bool client_is_signing_on(struct cli_state
*cli
);
858 bool client_is_signing_allowed(struct cli_state
*cli
);
859 bool client_is_signing_mandatory(struct cli_state
*cli
);
860 void cli_set_signing_negotiated(struct cli_state
*cli
);
862 /* The following definitions come from libsmb/reparse_symlink.c */
864 bool symlink_reparse_buffer_marshall(
865 const char *substitute
, const char *printname
, uint32_t flags
,
866 TALLOC_CTX
*mem_ctx
, uint8_t **pdst
, size_t *pdstlen
);
867 bool symlink_reparse_buffer_parse(
868 const uint8_t *src
, size_t srclen
, TALLOC_CTX
*mem_ctx
,
869 char **psubstitute_name
, char **pprint_name
, uint32_t *pflags
);
871 /* The following definitions come from libsmb/clisymlink.c */
873 struct tevent_req
*cli_symlink_send(TALLOC_CTX
*mem_ctx
,
874 struct tevent_context
*ev
,
875 struct cli_state
*cli
,
879 NTSTATUS
cli_symlink_recv(struct tevent_req
*req
);
880 NTSTATUS
cli_symlink(struct cli_state
*cli
, const char *oldname
,
881 const char *newname
, uint32_t flags
);
883 struct tevent_req
*cli_readlink_send(TALLOC_CTX
*mem_ctx
,
884 struct tevent_context
*ev
,
885 struct cli_state
*cli
,
887 NTSTATUS
cli_readlink_recv(struct tevent_req
*req
, TALLOC_CTX
*mem_ctx
,
888 char **psubstitute_name
, char **pprint_name
,
890 NTSTATUS
cli_readlink(struct cli_state
*cli
, const char *fname
,
891 TALLOC_CTX
*mem_ctx
, char **psubstitute_name
,
892 char **pprint_name
, uint32_t *pflags
);
894 #endif /* _LIBSMB_PROTO_H_ */