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_
30 #include "auth_info.h"
32 struct smb_trans_enc_state
;
34 /* The following definitions come from libsmb/cliconnect.c */
36 struct tevent_req
*cli_session_setup_send(TALLOC_CTX
*mem_ctx
,
37 struct tevent_context
*ev
,
38 struct cli_state
*cli
,
41 const char *workgroup
);
42 NTSTATUS
cli_session_setup_recv(struct tevent_req
*req
);
43 NTSTATUS
cli_session_setup(struct cli_state
*cli
,
46 const char *workgroup
);
47 struct tevent_req
*cli_session_setup_guest_create(TALLOC_CTX
*mem_ctx
,
48 struct tevent_context
*ev
,
49 struct cli_state
*cli
,
50 struct tevent_req
**psmbreq
);
51 struct tevent_req
*cli_session_setup_guest_send(TALLOC_CTX
*mem_ctx
,
52 struct tevent_context
*ev
,
53 struct cli_state
*cli
);
54 NTSTATUS
cli_session_setup_guest_recv(struct tevent_req
*req
);
55 NTSTATUS
cli_ulogoff(struct cli_state
*cli
);
56 struct tevent_req
*cli_tcon_andx_create(TALLOC_CTX
*mem_ctx
,
57 struct tevent_context
*ev
,
58 struct cli_state
*cli
,
59 const char *share
, const char *dev
,
60 const char *pass
, int passlen
,
61 struct tevent_req
**psmbreq
);
62 struct tevent_req
*cli_tcon_andx_send(TALLOC_CTX
*mem_ctx
,
63 struct tevent_context
*ev
,
64 struct cli_state
*cli
,
65 const char *share
, const char *dev
,
66 const char *pass
, int passlen
);
67 NTSTATUS
cli_tcon_andx_recv(struct tevent_req
*req
);
68 NTSTATUS
cli_tcon_andx(struct cli_state
*cli
, const char *share
,
69 const char *dev
, const char *pass
, int passlen
);
70 NTSTATUS
cli_tree_connect(struct cli_state
*cli
, const char *share
,
71 const char *dev
, const char *pass
, int passlen
);
72 NTSTATUS
cli_tdis(struct cli_state
*cli
);
73 NTSTATUS
cli_connect_nb(const char *host
, const struct sockaddr_storage
*dest_ss
,
74 uint16_t port
, int name_type
, const char *myname
,
75 int signing_state
, int flags
, struct cli_state
**pcli
);
76 NTSTATUS
cli_start_connection(struct cli_state
**output_cli
,
78 const char *dest_host
,
79 const struct sockaddr_storage
*dest_ss
, int port
,
80 int signing_state
, int flags
);
81 struct tevent_req
*cli_full_connection_send(
82 TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
83 const char *my_name
, const char *dest_host
,
84 const 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
, int signing_state
);
88 NTSTATUS
cli_full_connection_recv(struct tevent_req
*req
,
89 struct cli_state
**output_cli
);
90 NTSTATUS
cli_full_connection(struct cli_state
**output_cli
,
92 const char *dest_host
,
93 const struct sockaddr_storage
*dest_ss
, int port
,
94 const char *service
, const char *service_type
,
95 const char *user
, const char *domain
,
96 const char *password
, int flags
,
98 NTSTATUS
cli_raw_tcon(struct cli_state
*cli
,
99 const char *service
, const char *pass
, const char *dev
,
100 uint16_t *max_xmit
, uint16_t *tid
);
101 struct cli_state
*get_ipc_connect(char *server
,
102 struct sockaddr_storage
*server_ss
,
103 const struct user_auth_info
*user_info
);
104 struct cli_state
*get_ipc_connect_master_ip(TALLOC_CTX
*ctx
,
105 struct sockaddr_storage
*mb_ip
,
106 const struct user_auth_info
*user_info
,
107 char **pp_workgroup_out
);
108 struct cli_state
*get_ipc_connect_master_ip_bcast(TALLOC_CTX
*ctx
,
109 const struct user_auth_info
*user_info
,
110 char **pp_workgroup_out
);
112 /* The following definitions come from libsmb/clidfs.c */
114 NTSTATUS
cli_cm_force_encryption(struct cli_state
*c
,
115 const char *username
,
116 const char *password
,
118 const char *sharename
);
119 NTSTATUS
cli_cm_open(TALLOC_CTX
*ctx
,
120 struct cli_state
*referring_cli
,
123 const struct user_auth_info
*auth_info
,
129 struct cli_state
**pcli
);
130 void cli_cm_display(struct cli_state
*c
);
131 struct client_dfs_referral
;
132 NTSTATUS
cli_dfs_get_referral(TALLOC_CTX
*ctx
,
133 struct cli_state
*cli
,
135 struct client_dfs_referral
**refs
,
138 NTSTATUS
cli_resolve_path(TALLOC_CTX
*ctx
,
140 const struct user_auth_info
*dfs_auth_info
,
141 struct cli_state
*rootcli
,
143 struct cli_state
**targetcli
,
144 char **pp_targetpath
);
146 bool cli_check_msdfs_proxy(TALLOC_CTX
*ctx
,
147 struct cli_state
*cli
,
148 const char *sharename
,
152 const char *username
,
153 const char *password
,
156 /* The following definitions come from libsmb/clientgen.c */
158 int cli_set_message(char *buf
,int num_words
,int num_bytes
,bool zero
);
159 unsigned int cli_set_timeout(struct cli_state
*cli
, unsigned int timeout
);
160 bool cli_set_backup_intent(struct cli_state
*cli
, bool flag
);
161 void cli_setup_packet_buf(struct cli_state
*cli
, char *buf
);
162 extern struct GUID cli_state_client_guid
;
163 struct cli_state
*cli_state_create(TALLOC_CTX
*mem_ctx
,
165 const char *remote_name
,
166 const char *remote_realm
,
169 void cli_nt_pipes_close(struct cli_state
*cli
);
170 void cli_shutdown(struct cli_state
*cli
);
171 const char *cli_state_remote_realm(struct cli_state
*cli
);
172 uint16_t cli_state_get_vc_num(struct cli_state
*cli
);
173 uint32_t cli_setpid(struct cli_state
*cli
, uint32_t pid
);
174 uint32_t cli_getpid(struct cli_state
*cli
);
175 bool cli_state_has_tcon(struct cli_state
*cli
);
176 uint16_t cli_state_get_tid(struct cli_state
*cli
);
177 uint16_t cli_state_set_tid(struct cli_state
*cli
, uint16_t tid
);
178 uint16_t cli_state_get_uid(struct cli_state
*cli
);
179 uint16_t cli_state_set_uid(struct cli_state
*cli
, uint16_t uid
);
180 bool cli_set_case_sensitive(struct cli_state
*cli
, bool case_sensitive
);
181 uint32_t cli_state_available_size(struct cli_state
*cli
, uint32_t ofs
);
182 time_t cli_state_server_time(struct cli_state
*cli
);
183 struct tevent_req
*cli_echo_send(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
184 struct cli_state
*cli
, uint16_t num_echos
,
186 NTSTATUS
cli_echo_recv(struct tevent_req
*req
);
187 NTSTATUS
cli_echo(struct cli_state
*cli
, uint16_t num_echos
, DATA_BLOB data
);
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_t *eclass
, uint32_t *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
);
208 /* The following definitions come from libsmb/clifile.c */
210 struct tevent_req
*cli_setpathinfo_send(TALLOC_CTX
*mem_ctx
,
211 struct tevent_context
*ev
,
212 struct cli_state
*cli
,
217 NTSTATUS
cli_setpathinfo_recv(struct tevent_req
*req
);
218 NTSTATUS
cli_setpathinfo(struct cli_state
*cli
,
224 struct tevent_req
*cli_posix_symlink_send(TALLOC_CTX
*mem_ctx
,
225 struct tevent_context
*ev
,
226 struct cli_state
*cli
,
228 const char *newname
);
229 NTSTATUS
cli_posix_symlink_recv(struct tevent_req
*req
);
230 NTSTATUS
cli_posix_symlink(struct cli_state
*cli
,
232 const char *newname
);
233 struct tevent_req
*cli_posix_readlink_send(TALLOC_CTX
*mem_ctx
,
234 struct tevent_context
*ev
,
235 struct cli_state
*cli
,
238 NTSTATUS
cli_posix_readlink_recv(struct tevent_req
*req
, struct cli_state
*cli
,
239 char *retpath
, size_t len
);
240 NTSTATUS
cli_posix_readlink(struct cli_state
*cli
, const char *fname
,
241 char *linkpath
, size_t len
);
242 struct tevent_req
*cli_posix_hardlink_send(TALLOC_CTX
*mem_ctx
,
243 struct tevent_context
*ev
,
244 struct cli_state
*cli
,
246 const char *newname
);
247 NTSTATUS
cli_posix_hardlink_recv(struct tevent_req
*req
);
248 NTSTATUS
cli_posix_hardlink(struct cli_state
*cli
,
250 const char *newname
);
251 uint32_t unix_perms_to_wire(mode_t perms
);
252 mode_t
wire_perms_to_unix(uint32_t perms
);
253 struct tevent_req
*cli_posix_getacl_send(TALLOC_CTX
*mem_ctx
,
254 struct tevent_context
*ev
,
255 struct cli_state
*cli
,
257 NTSTATUS
cli_posix_getacl_recv(struct tevent_req
*req
,
261 NTSTATUS
cli_posix_getacl(struct cli_state
*cli
,
266 struct tevent_req
*cli_posix_setacl_send(TALLOC_CTX
*mem_ctx
,
267 struct tevent_context
*ev
,
268 struct cli_state
*cli
,
271 size_t acl_buf_size
);
272 NTSTATUS
cli_posix_setacl_recv(struct tevent_req
*req
);
273 NTSTATUS
cli_posix_setacl(struct cli_state
*cli
,
276 size_t acl_buf_size
);
277 struct tevent_req
*cli_posix_stat_send(TALLOC_CTX
*mem_ctx
,
278 struct tevent_context
*ev
,
279 struct cli_state
*cli
,
281 NTSTATUS
cli_posix_stat_recv(struct tevent_req
*req
,
282 SMB_STRUCT_STAT
*sbuf
);
283 NTSTATUS
cli_posix_stat(struct cli_state
*cli
,
285 SMB_STRUCT_STAT
*sbuf
);
286 struct tevent_req
*cli_posix_chmod_send(TALLOC_CTX
*mem_ctx
,
287 struct tevent_context
*ev
,
288 struct cli_state
*cli
,
291 NTSTATUS
cli_posix_chmod_recv(struct tevent_req
*req
);
292 NTSTATUS
cli_posix_chmod(struct cli_state
*cli
, const char *fname
, mode_t mode
);
293 struct tevent_req
*cli_posix_chown_send(TALLOC_CTX
*mem_ctx
,
294 struct tevent_context
*ev
,
295 struct cli_state
*cli
,
299 NTSTATUS
cli_posix_chown_recv(struct tevent_req
*req
);
300 NTSTATUS
cli_posix_chown(struct cli_state
*cli
,
304 struct tevent_req
*cli_rename_send(TALLOC_CTX
*mem_ctx
,
305 struct tevent_context
*ev
,
306 struct cli_state
*cli
,
307 const char *fname_src
,
308 const char *fname_dst
);
309 NTSTATUS
cli_rename_recv(struct tevent_req
*req
);
310 NTSTATUS
cli_rename(struct cli_state
*cli
, const char *fname_src
, const char *fname_dst
);
311 struct tevent_req
*cli_ntrename_send(TALLOC_CTX
*mem_ctx
,
312 struct tevent_context
*ev
,
313 struct cli_state
*cli
,
314 const char *fname_src
,
315 const char *fname_dst
);
316 NTSTATUS
cli_ntrename_recv(struct tevent_req
*req
);
317 NTSTATUS
cli_ntrename(struct cli_state
*cli
, const char *fname_src
, const char *fname_dst
);
319 struct tevent_req
*cli_nt_hardlink_send(TALLOC_CTX
*mem_ctx
,
320 struct tevent_context
*ev
,
321 struct cli_state
*cli
,
322 const char *fname_src
,
323 const char *fname_dst
);
324 NTSTATUS
cli_nt_hardlink_recv(struct tevent_req
*req
);
325 NTSTATUS
cli_nt_hardlink(struct cli_state
*cli
, const char *fname_src
, const char *fname_dst
);
327 struct tevent_req
*cli_unlink_send(TALLOC_CTX
*mem_ctx
,
328 struct tevent_context
*ev
,
329 struct cli_state
*cli
,
331 uint16_t mayhave_attrs
);
332 NTSTATUS
cli_unlink_recv(struct tevent_req
*req
);
333 NTSTATUS
cli_unlink(struct cli_state
*cli
, const char *fname
, uint16_t mayhave_attrs
);
335 struct tevent_req
*cli_mkdir_send(TALLOC_CTX
*mem_ctx
,
336 struct tevent_context
*ev
,
337 struct cli_state
*cli
,
339 NTSTATUS
cli_mkdir_recv(struct tevent_req
*req
);
340 NTSTATUS
cli_mkdir(struct cli_state
*cli
, const char *dname
);
341 struct tevent_req
*cli_rmdir_send(TALLOC_CTX
*mem_ctx
,
342 struct tevent_context
*ev
,
343 struct cli_state
*cli
,
345 NTSTATUS
cli_rmdir_recv(struct tevent_req
*req
);
346 NTSTATUS
cli_rmdir(struct cli_state
*cli
, const char *dname
);
347 struct tevent_req
*cli_nt_delete_on_close_send(TALLOC_CTX
*mem_ctx
,
348 struct tevent_context
*ev
,
349 struct cli_state
*cli
,
352 NTSTATUS
cli_nt_delete_on_close_recv(struct tevent_req
*req
);
353 NTSTATUS
cli_nt_delete_on_close(struct cli_state
*cli
, uint16_t fnum
, bool flag
);
354 struct tevent_req
*cli_ntcreate_send(TALLOC_CTX
*mem_ctx
,
355 struct tevent_context
*ev
,
356 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
);
365 NTSTATUS
cli_ntcreate_recv(struct tevent_req
*req
,
367 struct smb_create_returns
*cr
);
368 NTSTATUS
cli_ntcreate(struct cli_state
*cli
,
371 uint32_t DesiredAccess
,
372 uint32_t FileAttributes
,
373 uint32_t ShareAccess
,
374 uint32_t CreateDisposition
,
375 uint32_t CreateOptions
,
376 uint8_t SecurityFlags
,
378 struct smb_create_returns
*cr
);
379 struct tevent_req
*cli_openx_create(TALLOC_CTX
*mem_ctx
,
380 struct tevent_context
*ev
,
381 struct cli_state
*cli
, const char *fname
,
382 int flags
, int share_mode
,
383 struct tevent_req
**psmbreq
);
384 struct tevent_req
*cli_openx_send(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
385 struct cli_state
*cli
, const char *fname
,
386 int flags
, int share_mode
);
387 NTSTATUS
cli_openx_recv(struct tevent_req
*req
, uint16_t *fnum
);
388 NTSTATUS
cli_openx(struct cli_state
*cli
, const char *fname
, int flags
, int share_mode
, uint16_t *pfnum
);
389 NTSTATUS
cli_open(struct cli_state
*cli
, const char *fname
, int flags
, int share_mode
, uint16_t *pfnum
);
390 struct tevent_req
*cli_close_create(TALLOC_CTX
*mem_ctx
,
391 struct tevent_context
*ev
,
392 struct cli_state
*cli
, uint16_t fnum
,
393 struct tevent_req
**psubreq
);
394 struct tevent_req
*cli_close_send(TALLOC_CTX
*mem_ctx
,
395 struct tevent_context
*ev
,
396 struct cli_state
*cli
, uint16_t fnum
);
397 NTSTATUS
cli_close_recv(struct tevent_req
*req
);
398 NTSTATUS
cli_close(struct cli_state
*cli
, uint16_t fnum
);
399 struct tevent_req
*cli_ftruncate_send(TALLOC_CTX
*mem_ctx
,
400 struct tevent_context
*ev
,
401 struct cli_state
*cli
,
404 NTSTATUS
cli_ftruncate_recv(struct tevent_req
*req
);
405 NTSTATUS
cli_ftruncate(struct cli_state
*cli
, uint16_t fnum
, uint64_t size
);
406 NTSTATUS
cli_locktype(struct cli_state
*cli
, uint16_t fnum
,
407 uint32_t offset
, uint32_t len
,
408 int timeout
, unsigned char locktype
);
409 NTSTATUS
cli_lock32(struct cli_state
*cli
, uint16_t fnum
, uint32_t offset
,
410 uint32_t len
, int timeout
, enum brl_type lock_type
);
411 struct tevent_req
*cli_unlock_send(TALLOC_CTX
*mem_ctx
,
412 struct tevent_context
*ev
,
413 struct cli_state
*cli
,
417 NTSTATUS
cli_unlock_recv(struct tevent_req
*req
);
418 NTSTATUS
cli_unlock(struct cli_state
*cli
, uint16_t fnum
, uint32_t offset
, uint32_t len
);
419 NTSTATUS
cli_lock64(struct cli_state
*cli
, uint16_t fnum
,
420 uint64_t offset
, uint64_t len
, int timeout
,
421 enum brl_type lock_type
);
422 struct tevent_req
*cli_unlock64_send(TALLOC_CTX
*mem_ctx
,
423 struct tevent_context
*ev
,
424 struct cli_state
*cli
,
428 NTSTATUS
cli_unlock64_recv(struct tevent_req
*req
);
429 NTSTATUS
cli_unlock64(struct cli_state
*cli
, uint16_t fnum
, uint64_t offset
, uint64_t len
);
430 struct tevent_req
*cli_posix_lock_send(TALLOC_CTX
*mem_ctx
,
431 struct tevent_context
*ev
,
432 struct cli_state
*cli
,
437 enum brl_type lock_type
);
438 NTSTATUS
cli_posix_lock_recv(struct tevent_req
*req
);
439 NTSTATUS
cli_posix_lock(struct cli_state
*cli
, uint16_t fnum
,
440 uint64_t offset
, uint64_t len
,
441 bool wait_lock
, enum brl_type lock_type
);
442 struct tevent_req
*cli_posix_unlock_send(TALLOC_CTX
*mem_ctx
,
443 struct tevent_context
*ev
,
444 struct cli_state
*cli
,
448 NTSTATUS
cli_posix_unlock_recv(struct tevent_req
*req
);
449 NTSTATUS
cli_posix_unlock(struct cli_state
*cli
, uint16_t fnum
, uint64_t offset
, uint64_t len
);
450 struct tevent_req
*cli_getattrE_send(TALLOC_CTX
*mem_ctx
,
451 struct tevent_context
*ev
,
452 struct cli_state
*cli
,
454 NTSTATUS
cli_getattrE_recv(struct tevent_req
*req
,
460 NTSTATUS
cli_getattrE(struct cli_state
*cli
,
467 struct tevent_req
*cli_setattrE_send(TALLOC_CTX
*mem_ctx
,
468 struct tevent_context
*ev
,
469 struct cli_state
*cli
,
474 NTSTATUS
cli_setattrE_recv(struct tevent_req
*req
);
475 NTSTATUS
cli_setattrE(struct cli_state
*cli
,
480 struct tevent_req
*cli_getatr_send(TALLOC_CTX
*mem_ctx
,
481 struct tevent_context
*ev
,
482 struct cli_state
*cli
,
484 NTSTATUS
cli_getatr_recv(struct tevent_req
*req
,
488 NTSTATUS
cli_getatr(struct cli_state
*cli
,
493 struct tevent_req
*cli_setatr_send(TALLOC_CTX
*mem_ctx
,
494 struct tevent_context
*ev
,
495 struct cli_state
*cli
,
499 NTSTATUS
cli_setatr_recv(struct tevent_req
*req
);
500 NTSTATUS
cli_setatr(struct cli_state
*cli
,
504 struct tevent_req
*cli_chkpath_send(TALLOC_CTX
*mem_ctx
,
505 struct tevent_context
*ev
,
506 struct cli_state
*cli
,
508 NTSTATUS
cli_chkpath_recv(struct tevent_req
*req
);
509 NTSTATUS
cli_chkpath(struct cli_state
*cli
, const char *path
);
510 struct tevent_req
*cli_dskattr_send(TALLOC_CTX
*mem_ctx
,
511 struct tevent_context
*ev
,
512 struct cli_state
*cli
);
513 NTSTATUS
cli_dskattr_recv(struct tevent_req
*req
, int *bsize
, int *total
,
515 NTSTATUS
cli_dskattr(struct cli_state
*cli
, int *bsize
, int *total
, int *avail
);
516 NTSTATUS
cli_disk_size(struct cli_state
*cli
, const char *path
, uint64_t *bsize
,
517 uint64_t *total
, uint64_t *avail
);
518 struct tevent_req
*cli_ctemp_send(TALLOC_CTX
*mem_ctx
,
519 struct tevent_context
*ev
,
520 struct cli_state
*cli
,
522 NTSTATUS
cli_ctemp_recv(struct tevent_req
*req
,
526 NTSTATUS
cli_ctemp(struct cli_state
*cli
,
531 NTSTATUS
cli_raw_ioctl(struct cli_state
*cli
, uint16_t fnum
, uint32_t code
, DATA_BLOB
*blob
);
532 NTSTATUS
cli_set_ea_path(struct cli_state
*cli
, const char *path
,
533 const char *ea_name
, const char *ea_val
,
535 NTSTATUS
cli_set_ea_fnum(struct cli_state
*cli
, uint16_t fnum
,
536 const char *ea_name
, const char *ea_val
,
538 struct tevent_req
*cli_get_ea_list_path_send(TALLOC_CTX
*mem_ctx
,
539 struct tevent_context
*ev
,
540 struct cli_state
*cli
,
542 NTSTATUS
cli_get_ea_list_path_recv(struct tevent_req
*req
, TALLOC_CTX
*mem_ctx
,
543 size_t *pnum_eas
, struct ea_struct
**peas
);
544 NTSTATUS
cli_get_ea_list_path(struct cli_state
*cli
, const char *path
,
547 struct ea_struct
**pea_list
);
548 struct tevent_req
*cli_posix_open_send(TALLOC_CTX
*mem_ctx
,
549 struct tevent_context
*ev
,
550 struct cli_state
*cli
,
554 NTSTATUS
cli_posix_open_recv(struct tevent_req
*req
, uint16_t *pfnum
);
555 NTSTATUS
cli_posix_open(struct cli_state
*cli
, const char *fname
,
556 int flags
, mode_t mode
, uint16_t *fnum
);
557 struct tevent_req
*cli_posix_mkdir_send(TALLOC_CTX
*mem_ctx
,
558 struct tevent_context
*ev
,
559 struct cli_state
*cli
,
562 NTSTATUS
cli_posix_mkdir_recv(struct tevent_req
*req
);
563 NTSTATUS
cli_posix_mkdir(struct cli_state
*cli
, const char *fname
, mode_t mode
);
565 struct tevent_req
*cli_posix_unlink_send(TALLOC_CTX
*mem_ctx
,
566 struct tevent_context
*ev
,
567 struct cli_state
*cli
,
569 NTSTATUS
cli_posix_unlink_recv(struct tevent_req
*req
);
570 NTSTATUS
cli_posix_unlink(struct cli_state
*cli
, const char *fname
);
572 struct tevent_req
*cli_posix_rmdir_send(TALLOC_CTX
*mem_ctx
,
573 struct tevent_context
*ev
,
574 struct cli_state
*cli
,
576 NTSTATUS
cli_posix_rmdir_recv(struct tevent_req
*req
, TALLOC_CTX
*mem_ctx
);
577 NTSTATUS
cli_posix_rmdir(struct cli_state
*cli
, const char *fname
);
578 struct tevent_req
*cli_notify_send(TALLOC_CTX
*mem_ctx
,
579 struct tevent_context
*ev
,
580 struct cli_state
*cli
, uint16_t fnum
,
581 uint32_t buffer_size
,
582 uint32_t completion_filter
, bool recursive
);
583 NTSTATUS
cli_notify_recv(struct tevent_req
*req
, TALLOC_CTX
*mem_ctx
,
584 uint32_t *pnum_changes
,
585 struct notify_change
**pchanges
);
586 NTSTATUS
cli_notify(struct cli_state
*cli
, uint16_t fnum
, uint32_t buffer_size
,
587 uint32_t completion_filter
, bool recursive
,
588 TALLOC_CTX
*mem_ctx
, uint32_t *pnum_changes
,
589 struct notify_change
**pchanges
);
591 struct tevent_req
*cli_nttrans_create_send(TALLOC_CTX
*mem_ctx
,
592 struct tevent_context
*ev
,
593 struct cli_state
*cli
,
596 uint32_t DesiredAccess
,
597 uint32_t FileAttributes
,
598 uint32_t ShareAccess
,
599 uint32_t CreateDisposition
,
600 uint32_t CreateOptions
,
601 uint8_t SecurityFlags
,
602 struct security_descriptor
*secdesc
,
603 struct ea_struct
*eas
,
605 NTSTATUS
cli_nttrans_create_recv(struct tevent_req
*req
,
607 struct smb_create_returns
*cr
);
608 NTSTATUS
cli_nttrans_create(struct cli_state
*cli
,
611 uint32_t DesiredAccess
,
612 uint32_t FileAttributes
,
613 uint32_t ShareAccess
,
614 uint32_t CreateDisposition
,
615 uint32_t CreateOptions
,
616 uint8_t SecurityFlags
,
617 struct security_descriptor
*secdesc
,
618 struct ea_struct
*eas
,
621 struct smb_create_returns
*cr
);
623 /* The following definitions come from libsmb/clifsinfo.c */
625 struct tevent_req
*cli_unix_extensions_version_send(TALLOC_CTX
*mem_ctx
,
626 struct tevent_context
*ev
,
627 struct cli_state
*cli
);
628 NTSTATUS
cli_unix_extensions_version_recv(struct tevent_req
*req
,
629 uint16_t *pmajor
, uint16_t *pminor
,
632 NTSTATUS
cli_unix_extensions_version(struct cli_state
*cli
, uint16_t *pmajor
,
633 uint16_t *pminor
, uint32_t *pcaplow
,
635 struct tevent_req
*cli_set_unix_extensions_capabilities_send(
636 TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
, struct cli_state
*cli
,
637 uint16_t major
, uint16_t minor
, uint32_t caplow
, uint32_t caphigh
);
638 NTSTATUS
cli_set_unix_extensions_capabilities_recv(struct tevent_req
*req
);
639 NTSTATUS
cli_set_unix_extensions_capabilities(struct cli_state
*cli
,
640 uint16_t major
, uint16_t minor
,
641 uint32_t caplow
, uint32_t caphigh
);
642 struct tevent_req
*cli_get_fs_attr_info_send(TALLOC_CTX
*mem_ctx
,
643 struct tevent_context
*ev
,
644 struct cli_state
*cli
);
645 NTSTATUS
cli_get_fs_attr_info_recv(struct tevent_req
*req
, uint32_t *fs_attr
);
646 NTSTATUS
cli_get_fs_attr_info(struct cli_state
*cli
, uint32_t *fs_attr
);
647 NTSTATUS
cli_get_fs_volume_info(struct cli_state
*cli
,
648 TALLOC_CTX
*mem_ctx
, char **volume_name
,
649 uint32_t *pserial_number
, time_t *pdate
);
650 NTSTATUS
cli_get_fs_full_size_info(struct cli_state
*cli
,
651 uint64_t *total_allocation_units
,
652 uint64_t *caller_allocation_units
,
653 uint64_t *actual_allocation_units
,
654 uint64_t *sectors_per_allocation_unit
,
655 uint64_t *bytes_per_sector
);
656 NTSTATUS
cli_get_posix_fs_info(struct cli_state
*cli
,
657 uint32_t *optimal_transfer_size
,
658 uint32_t *block_size
,
659 uint64_t *total_blocks
,
660 uint64_t *blocks_available
,
661 uint64_t *user_blocks_available
,
662 uint64_t *total_file_nodes
,
663 uint64_t *free_file_nodes
,
664 uint64_t *fs_identifier
);
665 NTSTATUS
cli_raw_ntlm_smb_encryption_start(struct cli_state
*cli
,
669 NTSTATUS
cli_gss_smb_encryption_start(struct cli_state
*cli
);
670 NTSTATUS
cli_force_encryption(struct cli_state
*c
,
671 const char *username
,
672 const char *password
,
674 struct tevent_req
*cli_posix_whoami_send(TALLOC_CTX
*mem_ctx
,
675 struct tevent_context
*ev
,
676 struct cli_state
*cli
);
677 NTSTATUS
cli_posix_whoami_recv(struct tevent_req
*req
,
684 struct dom_sid
**psids
,
686 NTSTATUS
cli_posix_whoami(struct cli_state
*cli
,
693 struct dom_sid
**sids
,
696 /* The following definitions come from libsmb/clilist.c */
698 NTSTATUS
cli_list_old(struct cli_state
*cli
,const char *Mask
,uint16_t attribute
,
699 NTSTATUS (*fn
)(const char *, struct file_info
*,
700 const char *, void *), void *state
);
701 NTSTATUS
cli_list_trans(struct cli_state
*cli
, const char *mask
,
702 uint16_t attribute
, int info_level
,
703 NTSTATUS (*fn
)(const char *mnt
, struct file_info
*finfo
,
704 const char *mask
, void *private_data
),
706 struct tevent_req
*cli_list_send(TALLOC_CTX
*mem_ctx
,
707 struct tevent_context
*ev
,
708 struct cli_state
*cli
,
711 uint16_t info_level
);
712 NTSTATUS
cli_list_recv(struct tevent_req
*req
, TALLOC_CTX
*mem_ctx
,
713 struct file_info
**finfo
, size_t *num_finfo
);
714 NTSTATUS
cli_list(struct cli_state
*cli
,const char *Mask
,uint16_t attribute
,
715 NTSTATUS (*fn
)(const char *, struct file_info
*, const char *,
716 void *), void *state
);
718 /* The following definitions come from libsmb/climessage.c */
720 struct tevent_req
*cli_message_send(TALLOC_CTX
*mem_ctx
,
721 struct tevent_context
*ev
,
722 struct cli_state
*cli
,
723 const char *host
, const char *username
,
724 const char *message
);
725 NTSTATUS
cli_message_recv(struct tevent_req
*req
);
726 NTSTATUS
cli_message(struct cli_state
*cli
, const char *host
,
727 const char *username
, const char *message
);
729 /* The following definitions come from libsmb/clioplock.c */
731 struct tevent_req
*cli_smb_oplock_break_waiter_send(TALLOC_CTX
*mem_ctx
,
732 struct tevent_context
*ev
,
733 struct cli_state
*cli
);
734 NTSTATUS
cli_smb_oplock_break_waiter_recv(struct tevent_req
*req
,
738 struct tevent_req
*cli_oplock_ack_send(TALLOC_CTX
*mem_ctx
,
739 struct tevent_context
*ev
,
740 struct cli_state
*cli
,
741 uint16_t fnum
, uint8_t level
);
742 NTSTATUS
cli_oplock_ack_recv(struct tevent_req
*req
);
744 /* The following definitions come from libsmb/cliprint.c */
746 int cli_print_queue(struct cli_state
*cli
,
747 void (*fn
)(struct print_job_info
*));
748 int cli_printjob_del(struct cli_state
*cli
, int job
);
750 /* The following definitions come from libsmb/cliquota.c */
752 NTSTATUS
cli_get_quota_handle(struct cli_state
*cli
, uint16_t *quota_fnum
);
753 void free_ntquota_list(SMB_NTQUOTA_LIST
**qt_list
);
754 bool parse_user_quota_record(const uint8_t *rdata
,
755 unsigned int rdata_count
,
756 unsigned int *offset
,
757 SMB_NTQUOTA_STRUCT
*pqt
);
758 bool add_record_to_ntquota_list(TALLOC_CTX
*mem_ctx
,
759 SMB_NTQUOTA_STRUCT
*pqt
,
760 SMB_NTQUOTA_LIST
**pqt_list
);
761 NTSTATUS
parse_user_quota_list(const uint8_t *curdata
,
762 uint32_t curdata_size
,
764 SMB_NTQUOTA_LIST
**pqt_list
);
765 NTSTATUS
parse_fs_quota_buffer(const uint8_t *rdata
,
766 unsigned int rdata_count
,
767 SMB_NTQUOTA_STRUCT
*pqt
);
768 NTSTATUS
build_user_quota_buffer(SMB_NTQUOTA_LIST
*qt_list
,
772 SMB_NTQUOTA_LIST
**end_ptr
);
773 NTSTATUS
build_fs_quota_buffer(TALLOC_CTX
*mem_ctx
,
774 const SMB_NTQUOTA_STRUCT
*pqt
,
777 NTSTATUS
cli_get_user_quota(struct cli_state
*cli
, int quota_fnum
,
778 SMB_NTQUOTA_STRUCT
*pqt
);
779 NTSTATUS
cli_set_user_quota(struct cli_state
*cli
,
781 SMB_NTQUOTA_LIST
*qtl
);
782 NTSTATUS
cli_list_user_quota(struct cli_state
*cli
, int quota_fnum
,
783 SMB_NTQUOTA_LIST
**pqt_list
);
784 NTSTATUS
cli_get_fs_quota_info(struct cli_state
*cli
, int quota_fnum
,
785 SMB_NTQUOTA_STRUCT
*pqt
);
786 NTSTATUS
cli_set_fs_quota_info(struct cli_state
*cli
, int quota_fnum
,
787 SMB_NTQUOTA_STRUCT
*pqt
);
789 /* The following definitions come from libsmb/clireadwrite.c */
791 struct tevent_req
*cli_read_andx_create(TALLOC_CTX
*mem_ctx
,
792 struct tevent_context
*ev
,
793 struct cli_state
*cli
, uint16_t fnum
,
794 off_t offset
, size_t size
,
795 struct tevent_req
**psmbreq
);
796 struct tevent_req
*cli_read_andx_send(TALLOC_CTX
*mem_ctx
,
797 struct tevent_context
*ev
,
798 struct cli_state
*cli
, uint16_t fnum
,
799 off_t offset
, size_t size
);
800 NTSTATUS
cli_read_andx_recv(struct tevent_req
*req
, ssize_t
*received
,
802 struct tevent_req
*cli_pull_send(TALLOC_CTX
*mem_ctx
,
803 struct tevent_context
*ev
,
804 struct cli_state
*cli
,
805 uint16_t fnum
, off_t start_offset
,
806 off_t size
, size_t window_size
,
807 NTSTATUS (*sink
)(char *buf
, size_t n
,
810 NTSTATUS
cli_pull_recv(struct tevent_req
*req
, off_t
*received
);
811 NTSTATUS
cli_pull(struct cli_state
*cli
, uint16_t fnum
,
812 off_t start_offset
, off_t size
, size_t window_size
,
813 NTSTATUS (*sink
)(char *buf
, size_t n
, void *priv
),
814 void *priv
, off_t
*received
);
815 NTSTATUS
cli_read(struct cli_state
*cli
, uint16_t fnum
,
816 char *buf
, off_t offset
, size_t size
,
818 NTSTATUS
cli_smbwrite(struct cli_state
*cli
, uint16_t fnum
, char *buf
,
819 off_t offset
, size_t size1
, size_t *ptotal
);
820 struct tevent_req
*cli_write_andx_create(TALLOC_CTX
*mem_ctx
,
821 struct tevent_context
*ev
,
822 struct cli_state
*cli
, uint16_t fnum
,
823 uint16_t mode
, const uint8_t *buf
,
824 off_t offset
, size_t size
,
825 struct tevent_req
**reqs_before
,
827 struct tevent_req
**psmbreq
);
828 struct tevent_req
*cli_write_andx_send(TALLOC_CTX
*mem_ctx
,
829 struct tevent_context
*ev
,
830 struct cli_state
*cli
, uint16_t fnum
,
831 uint16_t mode
, const uint8_t *buf
,
832 off_t offset
, size_t size
);
833 NTSTATUS
cli_write_andx_recv(struct tevent_req
*req
, size_t *pwritten
);
835 NTSTATUS
cli_writeall(struct cli_state
*cli
, uint16_t fnum
, uint16_t mode
,
836 const uint8_t *buf
, off_t offset
, size_t size
,
839 struct tevent_req
*cli_push_send(TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
840 struct cli_state
*cli
,
841 uint16_t fnum
, uint16_t mode
,
842 off_t start_offset
, size_t window_size
,
843 size_t (*source
)(uint8_t *buf
, size_t n
,
846 NTSTATUS
cli_push_recv(struct tevent_req
*req
);
847 NTSTATUS
cli_push(struct cli_state
*cli
, uint16_t fnum
, uint16_t mode
,
848 off_t start_offset
, size_t window_size
,
849 size_t (*source
)(uint8_t *buf
, size_t n
, void *priv
),
852 NTSTATUS
cli_splice(struct cli_state
*srccli
, struct cli_state
*dstcli
,
853 uint16_t src_fnum
, uint16_t dst_fnum
,
855 off_t src_offset
, off_t dst_offset
,
857 int (*splice_cb
)(off_t n
, void *priv
), void *priv
);
859 /* The following definitions come from libsmb/clisecdesc.c */
861 NTSTATUS
cli_query_security_descriptor(struct cli_state
*cli
,
865 struct security_descriptor
**sd
);
866 NTSTATUS
cli_query_secdesc(struct cli_state
*cli
, uint16_t fnum
,
867 TALLOC_CTX
*mem_ctx
, struct security_descriptor
**sd
);
868 NTSTATUS
cli_set_security_descriptor(struct cli_state
*cli
,
871 const struct security_descriptor
*sd
);
872 NTSTATUS
cli_set_secdesc(struct cli_state
*cli
, uint16_t fnum
,
873 const struct security_descriptor
*sd
);
875 /* The following definitions come from libsmb/clistr.c */
877 size_t clistr_pull_talloc(TALLOC_CTX
*ctx
,
884 bool clistr_is_previous_version_path(const char *path
,
889 /* The following definitions come from libsmb/clitrans.c */
891 struct tevent_req
*cli_trans_send(
892 TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
,
893 struct cli_state
*cli
, uint16_t additional_flags2
, uint8_t cmd
,
894 const char *pipe_name
, uint16_t fid
, uint16_t function
, int flags
,
895 uint16_t *setup
, uint8_t num_setup
, uint8_t max_setup
,
896 uint8_t *param
, uint32_t num_param
, uint32_t max_param
,
897 uint8_t *data
, uint32_t num_data
, uint32_t max_data
);
898 NTSTATUS
cli_trans_recv(struct tevent_req
*req
, TALLOC_CTX
*mem_ctx
,
899 uint16_t *recv_flags2
,
900 uint16_t **setup
, uint8_t min_setup
,
902 uint8_t **param
, uint32_t min_param
,
904 uint8_t **data
, uint32_t min_data
,
906 NTSTATUS
cli_trans(TALLOC_CTX
*mem_ctx
, struct cli_state
*cli
,
908 const char *pipe_name
, uint16_t fid
, uint16_t function
,
910 uint16_t *setup
, uint8_t num_setup
, uint8_t max_setup
,
911 uint8_t *param
, uint32_t num_param
, uint32_t max_param
,
912 uint8_t *data
, uint32_t num_data
, uint32_t max_data
,
913 uint16_t *recv_flags2
,
914 uint16_t **rsetup
, uint8_t min_rsetup
, uint8_t *num_rsetup
,
915 uint8_t **rparam
, uint32_t min_rparam
, uint32_t *num_rparam
,
916 uint8_t **rdata
, uint32_t min_rdata
, uint32_t *num_rdata
);
918 /* The following definitions come from libsmb/reparse_symlink.c */
920 bool symlink_reparse_buffer_marshall(
921 const char *substitute
, const char *printname
, uint32_t flags
,
922 TALLOC_CTX
*mem_ctx
, uint8_t **pdst
, size_t *pdstlen
);
923 bool symlink_reparse_buffer_parse(
924 const uint8_t *src
, size_t srclen
, TALLOC_CTX
*mem_ctx
,
925 char **psubstitute_name
, char **pprint_name
, uint32_t *pflags
);
927 /* The following definitions come from libsmb/clisymlink.c */
929 struct tevent_req
*cli_symlink_send(TALLOC_CTX
*mem_ctx
,
930 struct tevent_context
*ev
,
931 struct cli_state
*cli
,
935 NTSTATUS
cli_symlink_recv(struct tevent_req
*req
);
936 NTSTATUS
cli_symlink(struct cli_state
*cli
, const char *oldname
,
937 const char *newname
, uint32_t flags
);
939 struct tevent_req
*cli_readlink_send(TALLOC_CTX
*mem_ctx
,
940 struct tevent_context
*ev
,
941 struct cli_state
*cli
,
943 NTSTATUS
cli_readlink_recv(struct tevent_req
*req
, TALLOC_CTX
*mem_ctx
,
944 char **psubstitute_name
, char **pprint_name
,
946 NTSTATUS
cli_readlink(struct cli_state
*cli
, const char *fname
,
947 TALLOC_CTX
*mem_ctx
, char **psubstitute_name
,
948 char **pprint_name
, uint32_t *pflags
);
950 #endif /* _LIBSMB_PROTO_H_ */