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(const struct cli_state
*c
);
128 struct client_dfs_referral
;
129 NTSTATUS
cli_dfs_get_referral(TALLOC_CTX
*ctx
,
130 struct cli_state
*cli
,
132 struct client_dfs_referral
**refs
,
135 NTSTATUS
cli_resolve_path(TALLOC_CTX
*ctx
,
137 const struct user_auth_info
*dfs_auth_info
,
138 struct cli_state
*rootcli
,
140 struct cli_state
**targetcli
,
141 char **pp_targetpath
);
143 bool cli_check_msdfs_proxy(TALLOC_CTX
*ctx
,
144 struct cli_state
*cli
,
145 const char *sharename
,
149 const char *username
,
150 const char *password
,
153 /* The following definitions come from libsmb/clientgen.c */
155 int cli_set_message(char *buf
,int num_words
,int num_bytes
,bool zero
);
156 unsigned int cli_set_timeout(struct cli_state
*cli
, unsigned int timeout
);
157 void cli_setup_packet_buf(struct cli_state
*cli
, char *buf
);
158 NTSTATUS
cli_set_domain(struct cli_state
*cli
, const char *domain
);
159 NTSTATUS
cli_set_username(struct cli_state
*cli
, const char *username
);
160 NTSTATUS
cli_set_password(struct cli_state
*cli
, const char *password
);
161 NTSTATUS
cli_init_creds(struct cli_state
*cli
, const char *username
, const char *domain
, const char *password
);
162 struct cli_state
*cli_state_create(TALLOC_CTX
*mem_ctx
,
164 const char *desthost
,
166 bool cli_state_encryption_on(struct cli_state
*cli
);
167 void cli_nt_pipes_close(struct cli_state
*cli
);
168 void cli_shutdown(struct cli_state
*cli
);
169 void cli_sockopt(struct cli_state
*cli
, const char *options
);
170 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 uint16_t cli_state_get_vc_num(struct cli_state
*cli
);
173 uint16
cli_setpid(struct cli_state
*cli
, uint16 pid
);
174 uint16_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 struct tevent_req
*cli_echo_send(TALLOC_CTX
*mem_ctx
, struct event_context
*ev
,
182 struct cli_state
*cli
, uint16_t num_echos
,
184 NTSTATUS
cli_echo_recv(struct tevent_req
*req
);
185 NTSTATUS
cli_echo(struct cli_state
*cli
, uint16_t num_echos
, DATA_BLOB data
);
186 bool cli_ucs2(struct cli_state
*cli
);
187 bool is_andx_req(uint8_t cmd
);
188 NTSTATUS
cli_smb(TALLOC_CTX
*mem_ctx
, struct cli_state
*cli
,
189 uint8_t smb_command
, uint8_t additional_flags
,
190 uint8_t wct
, uint16_t *vwv
,
191 uint32_t num_bytes
, const uint8_t *bytes
,
192 struct tevent_req
**result_parent
,
193 uint8_t min_wct
, uint8_t *pwct
, uint16_t **pvwv
,
194 uint32_t *pnum_bytes
, uint8_t **pbytes
);
196 /* The following definitions come from libsmb/clierror.c */
198 const char *cli_errstr(struct cli_state
*cli
);
199 NTSTATUS
cli_nt_error(struct cli_state
*cli
);
200 void cli_dos_error(struct cli_state
*cli
, uint8
*eclass
, uint32
*ecode
);
201 int cli_errno(struct cli_state
*cli
);
202 bool cli_is_error(struct cli_state
*cli
);
203 bool cli_is_nt_error(struct cli_state
*cli
);
204 bool cli_is_dos_error(struct cli_state
*cli
);
205 bool cli_state_is_connected(struct cli_state
*cli
);
206 void cli_state_disconnect(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 event_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 event_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 event_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_getfacl_send(TALLOC_CTX
*mem_ctx
,
254 struct event_context
*ev
,
255 struct cli_state
*cli
,
257 NTSTATUS
cli_posix_getfacl_recv(struct tevent_req
*req
,
261 NTSTATUS
cli_posix_getfacl(struct cli_state
*cli
,
266 struct tevent_req
*cli_posix_stat_send(TALLOC_CTX
*mem_ctx
,
267 struct event_context
*ev
,
268 struct cli_state
*cli
,
270 NTSTATUS
cli_posix_stat_recv(struct tevent_req
*req
,
271 SMB_STRUCT_STAT
*sbuf
);
272 NTSTATUS
cli_posix_stat(struct cli_state
*cli
,
274 SMB_STRUCT_STAT
*sbuf
);
275 struct tevent_req
*cli_posix_chmod_send(TALLOC_CTX
*mem_ctx
,
276 struct event_context
*ev
,
277 struct cli_state
*cli
,
280 NTSTATUS
cli_posix_chmod_recv(struct tevent_req
*req
);
281 NTSTATUS
cli_posix_chmod(struct cli_state
*cli
, const char *fname
, mode_t mode
);
282 struct tevent_req
*cli_posix_chown_send(TALLOC_CTX
*mem_ctx
,
283 struct event_context
*ev
,
284 struct cli_state
*cli
,
288 NTSTATUS
cli_posix_chown_recv(struct tevent_req
*req
);
289 NTSTATUS
cli_posix_chown(struct cli_state
*cli
,
293 struct tevent_req
*cli_rename_send(TALLOC_CTX
*mem_ctx
,
294 struct event_context
*ev
,
295 struct cli_state
*cli
,
296 const char *fname_src
,
297 const char *fname_dst
);
298 NTSTATUS
cli_rename_recv(struct tevent_req
*req
);
299 NTSTATUS
cli_rename(struct cli_state
*cli
, const char *fname_src
, const char *fname_dst
);
300 struct tevent_req
*cli_ntrename_send(TALLOC_CTX
*mem_ctx
,
301 struct event_context
*ev
,
302 struct cli_state
*cli
,
303 const char *fname_src
,
304 const char *fname_dst
);
305 NTSTATUS
cli_ntrename_recv(struct tevent_req
*req
);
306 NTSTATUS
cli_ntrename(struct cli_state
*cli
, const char *fname_src
, const char *fname_dst
);
308 struct tevent_req
*cli_nt_hardlink_send(TALLOC_CTX
*mem_ctx
,
309 struct event_context
*ev
,
310 struct cli_state
*cli
,
311 const char *fname_src
,
312 const char *fname_dst
);
313 NTSTATUS
cli_nt_hardlink_recv(struct tevent_req
*req
);
314 NTSTATUS
cli_nt_hardlink(struct cli_state
*cli
, const char *fname_src
, const char *fname_dst
);
316 struct tevent_req
*cli_unlink_send(TALLOC_CTX
*mem_ctx
,
317 struct event_context
*ev
,
318 struct cli_state
*cli
,
320 uint16_t mayhave_attrs
);
321 NTSTATUS
cli_unlink_recv(struct tevent_req
*req
);
322 NTSTATUS
cli_unlink(struct cli_state
*cli
, const char *fname
, uint16_t mayhave_attrs
);
324 struct tevent_req
*cli_mkdir_send(TALLOC_CTX
*mem_ctx
,
325 struct event_context
*ev
,
326 struct cli_state
*cli
,
328 NTSTATUS
cli_mkdir_recv(struct tevent_req
*req
);
329 NTSTATUS
cli_mkdir(struct cli_state
*cli
, const char *dname
);
330 struct tevent_req
*cli_rmdir_send(TALLOC_CTX
*mem_ctx
,
331 struct event_context
*ev
,
332 struct cli_state
*cli
,
334 NTSTATUS
cli_rmdir_recv(struct tevent_req
*req
);
335 NTSTATUS
cli_rmdir(struct cli_state
*cli
, const char *dname
);
336 struct tevent_req
*cli_nt_delete_on_close_send(TALLOC_CTX
*mem_ctx
,
337 struct event_context
*ev
,
338 struct cli_state
*cli
,
341 NTSTATUS
cli_nt_delete_on_close_recv(struct tevent_req
*req
);
342 NTSTATUS
cli_nt_delete_on_close(struct cli_state
*cli
, uint16_t fnum
, bool flag
);
343 struct tevent_req
*cli_ntcreate_send(TALLOC_CTX
*mem_ctx
,
344 struct event_context
*ev
,
345 struct cli_state
*cli
,
348 uint32_t DesiredAccess
,
349 uint32_t FileAttributes
,
350 uint32_t ShareAccess
,
351 uint32_t CreateDisposition
,
352 uint32_t CreateOptions
,
353 uint8_t SecurityFlags
);
354 NTSTATUS
cli_ntcreate_recv(struct tevent_req
*req
, uint16_t *pfnum
);
355 NTSTATUS
cli_ntcreate(struct cli_state
*cli
,
358 uint32_t DesiredAccess
,
359 uint32_t FileAttributes
,
360 uint32_t ShareAccess
,
361 uint32_t CreateDisposition
,
362 uint32_t CreateOptions
,
363 uint8_t SecurityFlags
,
365 uint8_t *smb_bytes_push_str(uint8_t *buf
, bool ucs2
, const char *str
,
366 size_t str_len
, size_t *pconverted_size
);
367 uint8_t *smb_bytes_push_bytes(uint8_t *buf
, uint8_t prefix
,
368 const uint8_t *bytes
, size_t num_bytes
);
369 uint8_t *trans2_bytes_push_str(uint8_t *buf
, bool ucs2
,
370 const char *str
, size_t str_len
,
371 size_t *pconverted_size
);
372 uint8_t *trans2_bytes_push_bytes(uint8_t *buf
,
373 const uint8_t *bytes
, size_t num_bytes
);
374 struct tevent_req
*cli_open_create(TALLOC_CTX
*mem_ctx
,
375 struct event_context
*ev
,
376 struct cli_state
*cli
, const char *fname
,
377 int flags
, int share_mode
,
378 struct tevent_req
**psmbreq
);
379 struct tevent_req
*cli_open_send(TALLOC_CTX
*mem_ctx
, struct event_context
*ev
,
380 struct cli_state
*cli
, const char *fname
,
381 int flags
, int share_mode
);
382 NTSTATUS
cli_open_recv(struct tevent_req
*req
, uint16_t *fnum
);
383 NTSTATUS
cli_open(struct cli_state
*cli
, const char *fname
, int flags
, int share_mode
, uint16_t *pfnum
);
384 struct tevent_req
*cli_close_create(TALLOC_CTX
*mem_ctx
,
385 struct event_context
*ev
,
386 struct cli_state
*cli
, uint16_t fnum
,
387 struct tevent_req
**psubreq
);
388 struct tevent_req
*cli_close_send(TALLOC_CTX
*mem_ctx
,
389 struct event_context
*ev
,
390 struct cli_state
*cli
, uint16_t fnum
);
391 NTSTATUS
cli_close_recv(struct tevent_req
*req
);
392 NTSTATUS
cli_close(struct cli_state
*cli
, uint16_t fnum
);
393 struct tevent_req
*cli_ftruncate_send(TALLOC_CTX
*mem_ctx
,
394 struct event_context
*ev
,
395 struct cli_state
*cli
,
398 NTSTATUS
cli_ftruncate_recv(struct tevent_req
*req
);
399 NTSTATUS
cli_ftruncate(struct cli_state
*cli
, uint16_t fnum
, uint64_t size
);
400 NTSTATUS
cli_locktype(struct cli_state
*cli
, uint16_t fnum
,
401 uint32_t offset
, uint32_t len
,
402 int timeout
, unsigned char locktype
);
403 NTSTATUS
cli_lock32(struct cli_state
*cli
, uint16_t fnum
, uint32_t offset
,
404 uint32_t len
, int timeout
, enum brl_type lock_type
);
405 struct tevent_req
*cli_unlock_send(TALLOC_CTX
*mem_ctx
,
406 struct event_context
*ev
,
407 struct cli_state
*cli
,
411 NTSTATUS
cli_unlock_recv(struct tevent_req
*req
);
412 NTSTATUS
cli_unlock(struct cli_state
*cli
, uint16_t fnum
, uint32_t offset
, uint32_t len
);
413 NTSTATUS
cli_lock64(struct cli_state
*cli
, uint16_t fnum
,
414 uint64_t offset
, uint64_t len
, int timeout
,
415 enum brl_type lock_type
);
416 struct tevent_req
*cli_unlock64_send(TALLOC_CTX
*mem_ctx
,
417 struct event_context
*ev
,
418 struct cli_state
*cli
,
422 NTSTATUS
cli_unlock64_recv(struct tevent_req
*req
);
423 NTSTATUS
cli_unlock64(struct cli_state
*cli
, uint16_t fnum
, uint64_t offset
, uint64_t len
);
424 struct tevent_req
*cli_posix_lock_send(TALLOC_CTX
*mem_ctx
,
425 struct event_context
*ev
,
426 struct cli_state
*cli
,
431 enum brl_type lock_type
);
432 NTSTATUS
cli_posix_lock_recv(struct tevent_req
*req
);
433 NTSTATUS
cli_posix_lock(struct cli_state
*cli
, uint16_t fnum
,
434 uint64_t offset
, uint64_t len
,
435 bool wait_lock
, enum brl_type lock_type
);
436 struct tevent_req
*cli_posix_unlock_send(TALLOC_CTX
*mem_ctx
,
437 struct event_context
*ev
,
438 struct cli_state
*cli
,
442 NTSTATUS
cli_posix_unlock_recv(struct tevent_req
*req
);
443 NTSTATUS
cli_posix_unlock(struct cli_state
*cli
, uint16_t fnum
, uint64_t offset
, uint64_t len
);
444 struct tevent_req
*cli_getattrE_send(TALLOC_CTX
*mem_ctx
,
445 struct event_context
*ev
,
446 struct cli_state
*cli
,
448 NTSTATUS
cli_getattrE_recv(struct tevent_req
*req
,
454 NTSTATUS
cli_getattrE(struct cli_state
*cli
,
461 struct tevent_req
*cli_setattrE_send(TALLOC_CTX
*mem_ctx
,
462 struct event_context
*ev
,
463 struct cli_state
*cli
,
468 NTSTATUS
cli_setattrE_recv(struct tevent_req
*req
);
469 NTSTATUS
cli_setattrE(struct cli_state
*cli
,
474 struct tevent_req
*cli_getatr_send(TALLOC_CTX
*mem_ctx
,
475 struct event_context
*ev
,
476 struct cli_state
*cli
,
478 NTSTATUS
cli_getatr_recv(struct tevent_req
*req
,
482 NTSTATUS
cli_getatr(struct cli_state
*cli
,
487 struct tevent_req
*cli_setatr_send(TALLOC_CTX
*mem_ctx
,
488 struct event_context
*ev
,
489 struct cli_state
*cli
,
493 NTSTATUS
cli_setatr_recv(struct tevent_req
*req
);
494 NTSTATUS
cli_setatr(struct cli_state
*cli
,
498 struct tevent_req
*cli_chkpath_send(TALLOC_CTX
*mem_ctx
,
499 struct event_context
*ev
,
500 struct cli_state
*cli
,
502 NTSTATUS
cli_chkpath_recv(struct tevent_req
*req
);
503 NTSTATUS
cli_chkpath(struct cli_state
*cli
, const char *path
);
504 struct tevent_req
*cli_dskattr_send(TALLOC_CTX
*mem_ctx
,
505 struct event_context
*ev
,
506 struct cli_state
*cli
);
507 NTSTATUS
cli_dskattr_recv(struct tevent_req
*req
, int *bsize
, int *total
,
509 NTSTATUS
cli_dskattr(struct cli_state
*cli
, int *bsize
, int *total
, int *avail
);
510 struct tevent_req
*cli_ctemp_send(TALLOC_CTX
*mem_ctx
,
511 struct event_context
*ev
,
512 struct cli_state
*cli
,
514 NTSTATUS
cli_ctemp_recv(struct tevent_req
*req
,
518 NTSTATUS
cli_ctemp(struct cli_state
*cli
,
523 NTSTATUS
cli_raw_ioctl(struct cli_state
*cli
, uint16_t fnum
, uint32_t code
, DATA_BLOB
*blob
);
524 NTSTATUS
cli_set_ea_path(struct cli_state
*cli
, const char *path
,
525 const char *ea_name
, const char *ea_val
,
527 NTSTATUS
cli_set_ea_fnum(struct cli_state
*cli
, uint16_t fnum
,
528 const char *ea_name
, const char *ea_val
,
530 struct tevent_req
*cli_get_ea_list_path_send(TALLOC_CTX
*mem_ctx
,
531 struct tevent_context
*ev
,
532 struct cli_state
*cli
,
534 NTSTATUS
cli_get_ea_list_path_recv(struct tevent_req
*req
, TALLOC_CTX
*mem_ctx
,
535 size_t *pnum_eas
, struct ea_struct
**peas
);
536 NTSTATUS
cli_get_ea_list_path(struct cli_state
*cli
, const char *path
,
539 struct ea_struct
**pea_list
);
540 struct tevent_req
*cli_posix_open_send(TALLOC_CTX
*mem_ctx
,
541 struct event_context
*ev
,
542 struct cli_state
*cli
,
546 NTSTATUS
cli_posix_open_recv(struct tevent_req
*req
, uint16_t *pfnum
);
547 NTSTATUS
cli_posix_open(struct cli_state
*cli
, const char *fname
,
548 int flags
, mode_t mode
, uint16_t *fnum
);
549 struct tevent_req
*cli_posix_mkdir_send(TALLOC_CTX
*mem_ctx
,
550 struct event_context
*ev
,
551 struct cli_state
*cli
,
554 NTSTATUS
cli_posix_mkdir_recv(struct tevent_req
*req
);
555 NTSTATUS
cli_posix_mkdir(struct cli_state
*cli
, const char *fname
, mode_t mode
);
557 struct tevent_req
*cli_posix_unlink_send(TALLOC_CTX
*mem_ctx
,
558 struct event_context
*ev
,
559 struct cli_state
*cli
,
561 NTSTATUS
cli_posix_unlink_recv(struct tevent_req
*req
);
562 NTSTATUS
cli_posix_unlink(struct cli_state
*cli
, const char *fname
);
564 struct tevent_req
*cli_posix_rmdir_send(TALLOC_CTX
*mem_ctx
,
565 struct event_context
*ev
,
566 struct cli_state
*cli
,
568 NTSTATUS
cli_posix_rmdir_recv(struct tevent_req
*req
, TALLOC_CTX
*mem_ctx
);
569 NTSTATUS
cli_posix_rmdir(struct cli_state
*cli
, const char *fname
);
570 struct tevent_req
*cli_notify_send(TALLOC_CTX
*mem_ctx
,
571 struct tevent_context
*ev
,
572 struct cli_state
*cli
, uint16_t fnum
,
573 uint32_t buffer_size
,
574 uint32_t completion_filter
, bool recursive
);
575 NTSTATUS
cli_notify_recv(struct tevent_req
*req
, TALLOC_CTX
*mem_ctx
,
576 uint32_t *pnum_changes
,
577 struct notify_change
**pchanges
);
579 struct tevent_req
*cli_nttrans_create_send(TALLOC_CTX
*mem_ctx
,
580 struct event_context
*ev
,
581 struct cli_state
*cli
,
584 uint32_t DesiredAccess
,
585 uint32_t FileAttributes
,
586 uint32_t ShareAccess
,
587 uint32_t CreateDisposition
,
588 uint32_t CreateOptions
,
589 uint8_t SecurityFlags
,
590 struct security_descriptor
*secdesc
,
591 struct ea_struct
*eas
,
593 NTSTATUS
cli_nttrans_create_recv(struct tevent_req
*req
, uint16_t *fnum
);
594 NTSTATUS
cli_nttrans_create(struct cli_state
*cli
,
597 uint32_t DesiredAccess
,
598 uint32_t FileAttributes
,
599 uint32_t ShareAccess
,
600 uint32_t CreateDisposition
,
601 uint32_t CreateOptions
,
602 uint8_t SecurityFlags
,
603 struct security_descriptor
*secdesc
,
604 struct ea_struct
*eas
,
608 /* The following definitions come from libsmb/clifsinfo.c */
610 struct tevent_req
*cli_unix_extensions_version_send(TALLOC_CTX
*mem_ctx
,
611 struct tevent_context
*ev
,
612 struct cli_state
*cli
);
613 NTSTATUS
cli_unix_extensions_version_recv(struct tevent_req
*req
,
614 uint16_t *pmajor
, uint16_t *pminor
,
617 NTSTATUS
cli_unix_extensions_version(struct cli_state
*cli
, uint16
*pmajor
,
618 uint16
*pminor
, uint32
*pcaplow
,
620 struct tevent_req
*cli_set_unix_extensions_capabilities_send(
621 TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
, struct cli_state
*cli
,
622 uint16_t major
, uint16_t minor
, uint32_t caplow
, uint32_t caphigh
);
623 NTSTATUS
cli_set_unix_extensions_capabilities_recv(struct tevent_req
*req
);
624 NTSTATUS
cli_set_unix_extensions_capabilities(struct cli_state
*cli
,
625 uint16 major
, uint16 minor
,
626 uint32 caplow
, uint32 caphigh
);
627 struct tevent_req
*cli_get_fs_attr_info_send(TALLOC_CTX
*mem_ctx
,
628 struct tevent_context
*ev
,
629 struct cli_state
*cli
);
630 NTSTATUS
cli_get_fs_attr_info_recv(struct tevent_req
*req
, uint32_t *fs_attr
);
631 NTSTATUS
cli_get_fs_attr_info(struct cli_state
*cli
, uint32_t *fs_attr
);
632 NTSTATUS
cli_get_fs_volume_info(struct cli_state
*cli
,
633 TALLOC_CTX
*mem_ctx
, char **volume_name
,
634 uint32
*pserial_number
, time_t *pdate
);
635 NTSTATUS
cli_get_fs_full_size_info(struct cli_state
*cli
,
636 uint64_t *total_allocation_units
,
637 uint64_t *caller_allocation_units
,
638 uint64_t *actual_allocation_units
,
639 uint64_t *sectors_per_allocation_unit
,
640 uint64_t *bytes_per_sector
);
641 NTSTATUS
cli_get_posix_fs_info(struct cli_state
*cli
,
642 uint32
*optimal_transfer_size
,
644 uint64_t *total_blocks
,
645 uint64_t *blocks_available
,
646 uint64_t *user_blocks_available
,
647 uint64_t *total_file_nodes
,
648 uint64_t *free_file_nodes
,
649 uint64_t *fs_identifier
);
650 NTSTATUS
cli_raw_ntlm_smb_encryption_start(struct cli_state
*cli
,
654 NTSTATUS
cli_gss_smb_encryption_start(struct cli_state
*cli
);
655 NTSTATUS
cli_force_encryption(struct cli_state
*c
,
656 const char *username
,
657 const char *password
,
660 /* The following definitions come from libsmb/clilist.c */
662 NTSTATUS
cli_list_old(struct cli_state
*cli
,const char *Mask
,uint16 attribute
,
663 NTSTATUS (*fn
)(const char *, struct file_info
*,
664 const char *, void *), void *state
);
665 NTSTATUS
cli_list_trans(struct cli_state
*cli
, const char *mask
,
666 uint16_t attribute
, int info_level
,
667 NTSTATUS (*fn
)(const char *mnt
, struct file_info
*finfo
,
668 const char *mask
, void *private_data
),
670 struct tevent_req
*cli_list_send(TALLOC_CTX
*mem_ctx
,
671 struct tevent_context
*ev
,
672 struct cli_state
*cli
,
675 uint16_t info_level
);
676 NTSTATUS
cli_list_recv(struct tevent_req
*req
, TALLOC_CTX
*mem_ctx
,
677 struct file_info
**finfo
, size_t *num_finfo
);
678 NTSTATUS
cli_list(struct cli_state
*cli
,const char *Mask
,uint16 attribute
,
679 NTSTATUS (*fn
)(const char *, struct file_info
*, const char *,
680 void *), void *state
);
682 /* The following definitions come from libsmb/climessage.c */
684 struct tevent_req
*cli_message_send(TALLOC_CTX
*mem_ctx
,
685 struct tevent_context
*ev
,
686 struct cli_state
*cli
,
687 const char *host
, const char *username
,
688 const char *message
);
689 NTSTATUS
cli_message_recv(struct tevent_req
*req
);
690 NTSTATUS
cli_message(struct cli_state
*cli
, const char *host
,
691 const char *username
, const char *message
);
693 /* The following definitions come from libsmb/clioplock.c */
695 struct tevent_req
*cli_oplock_ack_send(TALLOC_CTX
*mem_ctx
,
696 struct tevent_context
*ev
,
697 struct cli_state
*cli
,
698 uint16_t fnum
, uint8_t level
);
699 NTSTATUS
cli_oplock_ack_recv(struct tevent_req
*req
);
701 /* The following definitions come from libsmb/cliprint.c */
703 int cli_print_queue(struct cli_state
*cli
,
704 void (*fn
)(struct print_job_info
*));
705 int cli_printjob_del(struct cli_state
*cli
, int job
);
707 /* The following definitions come from libsmb/cliquota.c */
709 NTSTATUS
cli_get_quota_handle(struct cli_state
*cli
, uint16_t *quota_fnum
);
710 void free_ntquota_list(SMB_NTQUOTA_LIST
**qt_list
);
711 NTSTATUS
cli_get_user_quota(struct cli_state
*cli
, int quota_fnum
,
712 SMB_NTQUOTA_STRUCT
*pqt
);
713 NTSTATUS
cli_set_user_quota(struct cli_state
*cli
, int quota_fnum
,
714 SMB_NTQUOTA_STRUCT
*pqt
);
715 NTSTATUS
cli_list_user_quota(struct cli_state
*cli
, int quota_fnum
,
716 SMB_NTQUOTA_LIST
**pqt_list
);
717 NTSTATUS
cli_get_fs_quota_info(struct cli_state
*cli
, int quota_fnum
,
718 SMB_NTQUOTA_STRUCT
*pqt
);
719 NTSTATUS
cli_set_fs_quota_info(struct cli_state
*cli
, int quota_fnum
,
720 SMB_NTQUOTA_STRUCT
*pqt
);
722 /* The following definitions come from libsmb/clireadwrite.c */
724 struct tevent_req
*cli_read_andx_create(TALLOC_CTX
*mem_ctx
,
725 struct event_context
*ev
,
726 struct cli_state
*cli
, uint16_t fnum
,
727 off_t offset
, size_t size
,
728 struct tevent_req
**psmbreq
);
729 struct tevent_req
*cli_read_andx_send(TALLOC_CTX
*mem_ctx
,
730 struct event_context
*ev
,
731 struct cli_state
*cli
, uint16_t fnum
,
732 off_t offset
, size_t size
);
733 NTSTATUS
cli_read_andx_recv(struct tevent_req
*req
, ssize_t
*received
,
735 struct tevent_req
*cli_pull_send(TALLOC_CTX
*mem_ctx
,
736 struct event_context
*ev
,
737 struct cli_state
*cli
,
738 uint16_t fnum
, off_t start_offset
,
739 SMB_OFF_T size
, size_t window_size
,
740 NTSTATUS (*sink
)(char *buf
, size_t n
,
743 NTSTATUS
cli_pull_recv(struct tevent_req
*req
, SMB_OFF_T
*received
);
744 NTSTATUS
cli_pull(struct cli_state
*cli
, uint16_t fnum
,
745 off_t start_offset
, SMB_OFF_T size
, size_t window_size
,
746 NTSTATUS (*sink
)(char *buf
, size_t n
, void *priv
),
747 void *priv
, SMB_OFF_T
*received
);
748 ssize_t
cli_read_old(struct cli_state
*cli
, uint16_t fnum
, char *buf
,
749 off_t offset
, size_t size
);
750 NTSTATUS
cli_read(struct cli_state
*cli
, uint16_t fnum
,
751 char *buf
, off_t offset
, size_t size
,
753 NTSTATUS
cli_smbwrite(struct cli_state
*cli
, uint16_t fnum
, char *buf
,
754 off_t offset
, size_t size1
, size_t *ptotal
);
755 struct tevent_req
*cli_write_andx_create(TALLOC_CTX
*mem_ctx
,
756 struct event_context
*ev
,
757 struct cli_state
*cli
, uint16_t fnum
,
758 uint16_t mode
, const uint8_t *buf
,
759 off_t offset
, size_t size
,
760 struct tevent_req
**reqs_before
,
762 struct tevent_req
**psmbreq
);
763 struct tevent_req
*cli_write_andx_send(TALLOC_CTX
*mem_ctx
,
764 struct event_context
*ev
,
765 struct cli_state
*cli
, uint16_t fnum
,
766 uint16_t mode
, const uint8_t *buf
,
767 off_t offset
, size_t size
);
768 NTSTATUS
cli_write_andx_recv(struct tevent_req
*req
, size_t *pwritten
);
770 NTSTATUS
cli_writeall(struct cli_state
*cli
, uint16_t fnum
, uint16_t mode
,
771 const uint8_t *buf
, off_t offset
, size_t size
,
774 struct tevent_req
*cli_push_send(TALLOC_CTX
*mem_ctx
, struct event_context
*ev
,
775 struct cli_state
*cli
,
776 uint16_t fnum
, uint16_t mode
,
777 off_t start_offset
, size_t window_size
,
778 size_t (*source
)(uint8_t *buf
, size_t n
,
781 NTSTATUS
cli_push_recv(struct tevent_req
*req
);
782 NTSTATUS
cli_push(struct cli_state
*cli
, uint16_t fnum
, uint16_t mode
,
783 off_t start_offset
, size_t window_size
,
784 size_t (*source
)(uint8_t *buf
, size_t n
, void *priv
),
787 /* The following definitions come from libsmb/clisecdesc.c */
789 struct security_descriptor
*cli_query_secdesc(struct cli_state
*cli
, uint16_t fnum
,
790 TALLOC_CTX
*mem_ctx
);
791 NTSTATUS
cli_set_secdesc(struct cli_state
*cli
, uint16_t fnum
,
792 struct security_descriptor
*sd
);
794 /* The following definitions come from libsmb/clistr.c */
796 size_t clistr_pull_talloc(TALLOC_CTX
*ctx
,
804 /* The following definitions come from libsmb/clitrans.c */
806 struct tevent_req
*cli_trans_send(
807 TALLOC_CTX
*mem_ctx
, struct event_context
*ev
,
808 struct cli_state
*cli
, uint8_t cmd
,
809 const char *pipe_name
, uint16_t fid
, uint16_t function
, int flags
,
810 uint16_t *setup
, uint8_t num_setup
, uint8_t max_setup
,
811 uint8_t *param
, uint32_t num_param
, uint32_t max_param
,
812 uint8_t *data
, uint32_t num_data
, uint32_t max_data
);
813 NTSTATUS
cli_trans_recv(struct tevent_req
*req
, TALLOC_CTX
*mem_ctx
,
814 uint16_t *recv_flags2
,
815 uint16_t **setup
, uint8_t min_setup
,
817 uint8_t **param
, uint32_t min_param
,
819 uint8_t **data
, uint32_t min_data
,
821 NTSTATUS
cli_trans(TALLOC_CTX
*mem_ctx
, struct cli_state
*cli
,
823 const char *pipe_name
, uint16_t fid
, uint16_t function
,
825 uint16_t *setup
, uint8_t num_setup
, uint8_t max_setup
,
826 uint8_t *param
, uint32_t num_param
, uint32_t max_param
,
827 uint8_t *data
, uint32_t num_data
, uint32_t max_data
,
828 uint16_t *recv_flags2
,
829 uint16_t **rsetup
, uint8_t min_rsetup
, uint8_t *num_rsetup
,
830 uint8_t **rparam
, uint32_t min_rparam
, uint32_t *num_rparam
,
831 uint8_t **rdata
, uint32_t min_rdata
, uint32_t *num_rdata
);
833 /* The following definitions come from libsmb/smb_seal.c */
835 NTSTATUS
get_enc_ctx_num(const uint8_t *buf
, uint16
*p_enc_ctx_num
);
836 bool common_encryption_on(struct smb_trans_enc_state
*es
);
837 NTSTATUS
common_ntlm_decrypt_buffer(struct ntlmssp_state
*ntlmssp_state
, char *buf
);
838 NTSTATUS
common_ntlm_encrypt_buffer(struct ntlmssp_state
*ntlmssp_state
,
842 NTSTATUS
common_encrypt_buffer(struct smb_trans_enc_state
*es
, char *buffer
, char **buf_out
);
843 NTSTATUS
common_decrypt_buffer(struct smb_trans_enc_state
*es
, char *buf
);
844 void common_free_encryption_state(struct smb_trans_enc_state
**pp_es
);
845 void common_free_enc_buffer(struct smb_trans_enc_state
*es
, char *buf
);
846 bool cli_encryption_on(struct cli_state
*cli
);
847 void cli_free_encryption_context(struct cli_state
*cli
);
848 void cli_free_enc_buffer(struct cli_state
*cli
, char *buf
);
850 /* The following definitions come from libsmb/clisigning.c */
852 bool cli_simple_set_signing(struct cli_state
*cli
,
853 const DATA_BLOB user_session_key
,
854 const DATA_BLOB response
);
855 bool cli_temp_set_signing(struct cli_state
*cli
);
856 void cli_calculate_sign_mac(struct cli_state
*cli
, char *buf
, uint32_t *seqnum
);
857 bool cli_check_sign_mac(struct cli_state
*cli
, const char *buf
, uint32_t seqnum
);
858 bool client_is_signing_on(struct cli_state
*cli
);
859 bool client_is_signing_allowed(struct cli_state
*cli
);
860 bool client_is_signing_mandatory(struct cli_state
*cli
);
861 void cli_set_signing_negotiated(struct cli_state
*cli
);
863 /* The following definitions come from libsmb/reparse_symlink.c */
865 bool symlink_reparse_buffer_marshall(
866 const char *substitute
, const char *printname
, uint32_t flags
,
867 TALLOC_CTX
*mem_ctx
, uint8_t **pdst
, size_t *pdstlen
);
868 bool symlink_reparse_buffer_parse(
869 const uint8_t *src
, size_t srclen
, TALLOC_CTX
*mem_ctx
,
870 char **psubstitute_name
, char **pprint_name
, uint32_t *pflags
);
872 /* The following definitions come from libsmb/clisymlink.c */
874 struct tevent_req
*cli_symlink_send(TALLOC_CTX
*mem_ctx
,
875 struct tevent_context
*ev
,
876 struct cli_state
*cli
,
880 NTSTATUS
cli_symlink_recv(struct tevent_req
*req
);
881 NTSTATUS
cli_symlink(struct cli_state
*cli
, const char *oldname
,
882 const char *newname
, uint32_t flags
);
884 struct tevent_req
*cli_readlink_send(TALLOC_CTX
*mem_ctx
,
885 struct tevent_context
*ev
,
886 struct cli_state
*cli
,
888 NTSTATUS
cli_readlink_recv(struct tevent_req
*req
, TALLOC_CTX
*mem_ctx
,
889 char **psubstitute_name
, char **pprint_name
,
891 NTSTATUS
cli_readlink(struct cli_state
*cli
, const char *fname
,
892 TALLOC_CTX
*mem_ctx
, char **psubstitute_name
,
893 char **pprint_name
, uint32_t *pflags
);
895 #endif /* _LIBSMB_PROTO_H_ */