2 Unix SMB/CIFS implementation.
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 3 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>.
18 #ifndef _LIBSMB_PROTO_H_
19 #define _LIBSMB_PROTO_H_
21 /* The following definitions come from libsmb/cliconnect.c */
23 ADS_STATUS
cli_session_setup_spnego(struct cli_state
*cli
, const char *user
,
24 const char *pass
, const char *user_domain
,
25 const char * dest_realm
);
27 NTSTATUS
cli_session_setup(struct cli_state
*cli
,
29 const char *pass
, int passlen
,
30 const char *ntpass
, int ntpasslen
,
31 const char *workgroup
);
32 struct tevent_req
*cli_session_setup_guest_create(TALLOC_CTX
*mem_ctx
,
33 struct event_context
*ev
,
34 struct cli_state
*cli
,
35 struct tevent_req
**psmbreq
);
36 struct tevent_req
*cli_session_setup_guest_send(TALLOC_CTX
*mem_ctx
,
37 struct event_context
*ev
,
38 struct cli_state
*cli
);
39 NTSTATUS
cli_session_setup_guest_recv(struct tevent_req
*req
);
40 struct tevent_req
*cli_ulogoff_send(TALLOC_CTX
*mem_ctx
,
41 struct tevent_context
*ev
,
42 struct cli_state
*cli
);
43 NTSTATUS
cli_ulogoff_recv(struct tevent_req
*req
);
44 NTSTATUS
cli_ulogoff(struct cli_state
*cli
);
45 struct tevent_req
*cli_tcon_andx_create(TALLOC_CTX
*mem_ctx
,
46 struct event_context
*ev
,
47 struct cli_state
*cli
,
48 const char *share
, const char *dev
,
49 const char *pass
, int passlen
,
50 struct tevent_req
**psmbreq
);
51 struct tevent_req
*cli_tcon_andx_send(TALLOC_CTX
*mem_ctx
,
52 struct event_context
*ev
,
53 struct cli_state
*cli
,
54 const char *share
, const char *dev
,
55 const char *pass
, int passlen
);
56 NTSTATUS
cli_tcon_andx_recv(struct tevent_req
*req
);
57 NTSTATUS
cli_tcon_andx(struct cli_state
*cli
, const char *share
,
58 const char *dev
, const char *pass
, int passlen
);
59 struct tevent_req
*cli_tdis_send(TALLOC_CTX
*mem_ctx
,
60 struct tevent_context
*ev
,
61 struct cli_state
*cli
);
62 NTSTATUS
cli_tdis_recv(struct tevent_req
*req
);
63 NTSTATUS
cli_tdis(struct cli_state
*cli
);
64 NTSTATUS
cli_negprot(struct cli_state
*cli
);
65 struct tevent_req
*cli_negprot_send(TALLOC_CTX
*mem_ctx
,
66 struct event_context
*ev
,
67 struct cli_state
*cli
);
68 NTSTATUS
cli_negprot_recv(struct tevent_req
*req
);
69 bool cli_session_request(struct cli_state
*cli
,
70 struct nmb_name
*calling
, struct nmb_name
*called
);
71 NTSTATUS
cli_connect(struct cli_state
*cli
,
73 struct sockaddr_storage
*dest_ss
);
74 NTSTATUS
cli_start_connection(struct cli_state
**output_cli
,
76 const char *dest_host
,
77 struct sockaddr_storage
*dest_ss
, int port
,
78 int signing_state
, int flags
);
79 NTSTATUS
cli_full_connection(struct cli_state
**output_cli
,
81 const char *dest_host
,
82 struct sockaddr_storage
*dest_ss
, int port
,
83 const char *service
, const char *service_type
,
84 const char *user
, const char *domain
,
85 const char *password
, int flags
,
87 bool attempt_netbios_session_request(struct cli_state
**ppcli
, const char *srchost
, const char *desthost
,
88 struct sockaddr_storage
*pdest_ss
);
89 NTSTATUS
cli_raw_tcon(struct cli_state
*cli
,
90 const char *service
, const char *pass
, const char *dev
,
91 uint16
*max_xmit
, uint16
*tid
);
92 struct cli_state
*get_ipc_connect(char *server
,
93 struct sockaddr_storage
*server_ss
,
94 const struct user_auth_info
*user_info
);
95 struct cli_state
*get_ipc_connect_master_ip(TALLOC_CTX
*ctx
,
96 struct sockaddr_storage
*mb_ip
,
97 const struct user_auth_info
*user_info
,
98 char **pp_workgroup_out
);
99 struct cli_state
*get_ipc_connect_master_ip_bcast(TALLOC_CTX
*ctx
,
100 const struct user_auth_info
*user_info
,
101 char **pp_workgroup_out
);
103 /* The following definitions come from libsmb/clidfs.c */
105 NTSTATUS
cli_cm_force_encryption(struct cli_state
*c
,
106 const char *username
,
107 const char *password
,
109 const char *sharename
);
110 struct cli_state
*cli_cm_open(TALLOC_CTX
*ctx
,
111 struct cli_state
*referring_cli
,
114 const struct user_auth_info
*auth_info
,
120 void cli_cm_display(const struct cli_state
*c
);
121 struct client_dfs_referral
;
122 NTSTATUS
cli_dfs_get_referral(TALLOC_CTX
*ctx
,
123 struct cli_state
*cli
,
125 struct client_dfs_referral
**refs
,
128 bool cli_resolve_path(TALLOC_CTX
*ctx
,
130 const struct user_auth_info
*dfs_auth_info
,
131 struct cli_state
*rootcli
,
133 struct cli_state
**targetcli
,
134 char **pp_targetpath
);
136 bool cli_check_msdfs_proxy(TALLOC_CTX
*ctx
,
137 struct cli_state
*cli
,
138 const char *sharename
,
142 const char *username
,
143 const char *password
,
146 /* The following definitions come from libsmb/clientgen.c */
148 int cli_set_message(char *buf
,int num_words
,int num_bytes
,bool zero
);
149 unsigned int cli_set_timeout(struct cli_state
*cli
, unsigned int timeout
);
150 void cli_set_port(struct cli_state
*cli
, int port
);
151 bool cli_state_seqnum_persistent(struct cli_state
*cli
,
153 bool cli_state_seqnum_remove(struct cli_state
*cli
,
155 bool cli_receive_smb(struct cli_state
*cli
);
156 bool cli_send_smb(struct cli_state
*cli
);
157 void cli_setup_packet_buf(struct cli_state
*cli
, char *buf
);
158 void cli_setup_packet(struct cli_state
*cli
);
159 void cli_setup_bcc(struct cli_state
*cli
, void *p
);
160 NTSTATUS
cli_set_domain(struct cli_state
*cli
, const char *domain
);
161 NTSTATUS
cli_set_username(struct cli_state
*cli
, const char *username
);
162 NTSTATUS
cli_set_password(struct cli_state
*cli
, const char *password
);
163 NTSTATUS
cli_init_creds(struct cli_state
*cli
, const char *username
, const char *domain
, const char *password
);
164 struct cli_state
*cli_initialise(void);
165 struct cli_state
*cli_initialise_ex(int signing_state
);
166 void cli_nt_pipes_close(struct cli_state
*cli
);
167 void cli_shutdown(struct cli_state
*cli
);
168 void cli_sockopt(struct cli_state
*cli
, const char *options
);
169 uint16
cli_setpid(struct cli_state
*cli
, uint16 pid
);
170 bool cli_set_case_sensitive(struct cli_state
*cli
, bool case_sensitive
);
171 struct tevent_req
*cli_echo_send(TALLOC_CTX
*mem_ctx
, struct event_context
*ev
,
172 struct cli_state
*cli
, uint16_t num_echos
,
174 NTSTATUS
cli_echo_recv(struct tevent_req
*req
);
175 NTSTATUS
cli_echo(struct cli_state
*cli
, uint16_t num_echos
, DATA_BLOB data
);
176 bool cli_ucs2(struct cli_state
*cli
);
177 bool is_andx_req(uint8_t cmd
);
178 NTSTATUS
cli_smb(TALLOC_CTX
*mem_ctx
, struct cli_state
*cli
,
179 uint8_t smb_command
, uint8_t additional_flags
,
180 uint8_t wct
, uint16_t *vwv
,
181 uint32_t num_bytes
, const uint8_t *bytes
,
182 struct tevent_req
**result_parent
,
183 uint8_t min_wct
, uint8_t *pwct
, uint16_t **pvwv
,
184 uint32_t *pnum_bytes
, uint8_t **pbytes
);
186 /* The following definitions come from libsmb/clierror.c */
188 const char *cli_errstr(struct cli_state
*cli
);
189 NTSTATUS
cli_nt_error(struct cli_state
*cli
);
190 void cli_dos_error(struct cli_state
*cli
, uint8
*eclass
, uint32
*ecode
);
191 int cli_errno(struct cli_state
*cli
);
192 bool cli_is_error(struct cli_state
*cli
);
193 bool cli_is_nt_error(struct cli_state
*cli
);
194 bool cli_is_dos_error(struct cli_state
*cli
);
195 NTSTATUS
cli_get_nt_error(struct cli_state
*cli
);
196 void cli_set_nt_error(struct cli_state
*cli
, NTSTATUS status
);
197 void cli_reset_error(struct cli_state
*cli
);
198 bool cli_state_is_connected(struct cli_state
*cli
);
200 /* The following definitions come from libsmb/clifile.c */
202 struct tevent_req
*cli_setpathinfo_send(TALLOC_CTX
*mem_ctx
,
203 struct tevent_context
*ev
,
204 struct cli_state
*cli
,
209 NTSTATUS
cli_setpathinfo_recv(struct tevent_req
*req
);
210 NTSTATUS
cli_setpathinfo(struct cli_state
*cli
,
216 struct tevent_req
*cli_posix_symlink_send(TALLOC_CTX
*mem_ctx
,
217 struct event_context
*ev
,
218 struct cli_state
*cli
,
220 const char *newname
);
221 NTSTATUS
cli_posix_symlink_recv(struct tevent_req
*req
);
222 NTSTATUS
cli_posix_symlink(struct cli_state
*cli
,
224 const char *newname
);
225 struct tevent_req
*cli_posix_readlink_send(TALLOC_CTX
*mem_ctx
,
226 struct event_context
*ev
,
227 struct cli_state
*cli
,
230 NTSTATUS
cli_posix_readlink_recv(struct tevent_req
*req
, struct cli_state
*cli
,
231 char *retpath
, size_t len
);
232 NTSTATUS
cli_posix_readlink(struct cli_state
*cli
, const char *fname
,
233 char *linkpath
, size_t len
);
234 struct tevent_req
*cli_posix_hardlink_send(TALLOC_CTX
*mem_ctx
,
235 struct event_context
*ev
,
236 struct cli_state
*cli
,
238 const char *newname
);
239 NTSTATUS
cli_posix_hardlink_recv(struct tevent_req
*req
);
240 NTSTATUS
cli_posix_hardlink(struct cli_state
*cli
,
242 const char *newname
);
243 uint32_t unix_perms_to_wire(mode_t perms
);
244 mode_t
wire_perms_to_unix(uint32_t perms
);
245 struct tevent_req
*cli_posix_getfacl_send(TALLOC_CTX
*mem_ctx
,
246 struct event_context
*ev
,
247 struct cli_state
*cli
,
249 NTSTATUS
cli_posix_getfacl_recv(struct tevent_req
*req
,
253 NTSTATUS
cli_posix_getfacl(struct cli_state
*cli
,
258 struct tevent_req
*cli_posix_stat_send(TALLOC_CTX
*mem_ctx
,
259 struct event_context
*ev
,
260 struct cli_state
*cli
,
262 NTSTATUS
cli_posix_stat_recv(struct tevent_req
*req
,
263 SMB_STRUCT_STAT
*sbuf
);
264 NTSTATUS
cli_posix_stat(struct cli_state
*cli
,
266 SMB_STRUCT_STAT
*sbuf
);
267 struct tevent_req
*cli_posix_chmod_send(TALLOC_CTX
*mem_ctx
,
268 struct event_context
*ev
,
269 struct cli_state
*cli
,
272 NTSTATUS
cli_posix_chmod_recv(struct tevent_req
*req
);
273 NTSTATUS
cli_posix_chmod(struct cli_state
*cli
, const char *fname
, mode_t mode
);
274 struct tevent_req
*cli_posix_chown_send(TALLOC_CTX
*mem_ctx
,
275 struct event_context
*ev
,
276 struct cli_state
*cli
,
280 NTSTATUS
cli_posix_chown_recv(struct tevent_req
*req
);
281 NTSTATUS
cli_posix_chown(struct cli_state
*cli
,
285 struct tevent_req
*cli_rename_send(TALLOC_CTX
*mem_ctx
,
286 struct event_context
*ev
,
287 struct cli_state
*cli
,
288 const char *fname_src
,
289 const char *fname_dst
);
290 NTSTATUS
cli_rename_recv(struct tevent_req
*req
);
291 NTSTATUS
cli_rename(struct cli_state
*cli
, const char *fname_src
, const char *fname_dst
);
292 struct tevent_req
*cli_ntrename_send(TALLOC_CTX
*mem_ctx
,
293 struct event_context
*ev
,
294 struct cli_state
*cli
,
295 const char *fname_src
,
296 const char *fname_dst
);
297 NTSTATUS
cli_ntrename_recv(struct tevent_req
*req
);
298 NTSTATUS
cli_ntrename(struct cli_state
*cli
, const char *fname_src
, const char *fname_dst
);
300 struct tevent_req
*cli_nt_hardlink_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_nt_hardlink_recv(struct tevent_req
*req
);
306 NTSTATUS
cli_nt_hardlink(struct cli_state
*cli
, const char *fname_src
, const char *fname_dst
);
308 struct tevent_req
*cli_unlink_send(TALLOC_CTX
*mem_ctx
,
309 struct event_context
*ev
,
310 struct cli_state
*cli
,
312 uint16_t mayhave_attrs
);
313 NTSTATUS
cli_unlink_recv(struct tevent_req
*req
);
314 NTSTATUS
cli_unlink(struct cli_state
*cli
, const char *fname
, uint16_t mayhave_attrs
);
316 struct tevent_req
*cli_mkdir_send(TALLOC_CTX
*mem_ctx
,
317 struct event_context
*ev
,
318 struct cli_state
*cli
,
320 NTSTATUS
cli_mkdir_recv(struct tevent_req
*req
);
321 NTSTATUS
cli_mkdir(struct cli_state
*cli
, const char *dname
);
322 struct tevent_req
*cli_rmdir_send(TALLOC_CTX
*mem_ctx
,
323 struct event_context
*ev
,
324 struct cli_state
*cli
,
326 NTSTATUS
cli_rmdir_recv(struct tevent_req
*req
);
327 NTSTATUS
cli_rmdir(struct cli_state
*cli
, const char *dname
);
328 struct tevent_req
*cli_nt_delete_on_close_send(TALLOC_CTX
*mem_ctx
,
329 struct event_context
*ev
,
330 struct cli_state
*cli
,
333 NTSTATUS
cli_nt_delete_on_close_recv(struct tevent_req
*req
);
334 NTSTATUS
cli_nt_delete_on_close(struct cli_state
*cli
, uint16_t fnum
, bool flag
);
335 struct tevent_req
*cli_ntcreate_send(TALLOC_CTX
*mem_ctx
,
336 struct event_context
*ev
,
337 struct cli_state
*cli
,
340 uint32_t DesiredAccess
,
341 uint32_t FileAttributes
,
342 uint32_t ShareAccess
,
343 uint32_t CreateDisposition
,
344 uint32_t CreateOptions
,
345 uint8_t SecurityFlags
);
346 NTSTATUS
cli_ntcreate_recv(struct tevent_req
*req
, uint16_t *pfnum
);
347 NTSTATUS
cli_ntcreate(struct cli_state
*cli
,
350 uint32_t DesiredAccess
,
351 uint32_t FileAttributes
,
352 uint32_t ShareAccess
,
353 uint32_t CreateDisposition
,
354 uint32_t CreateOptions
,
355 uint8_t SecurityFlags
,
357 uint8_t *smb_bytes_push_str(uint8_t *buf
, bool ucs2
, const char *str
,
358 size_t str_len
, size_t *pconverted_size
);
359 uint8_t *smb_bytes_push_bytes(uint8_t *buf
, uint8_t prefix
,
360 const uint8_t *bytes
, size_t num_bytes
);
361 struct tevent_req
*cli_open_create(TALLOC_CTX
*mem_ctx
,
362 struct event_context
*ev
,
363 struct cli_state
*cli
, const char *fname
,
364 int flags
, int share_mode
,
365 struct tevent_req
**psmbreq
);
366 struct tevent_req
*cli_open_send(TALLOC_CTX
*mem_ctx
, struct event_context
*ev
,
367 struct cli_state
*cli
, const char *fname
,
368 int flags
, int share_mode
);
369 NTSTATUS
cli_open_recv(struct tevent_req
*req
, uint16_t *fnum
);
370 NTSTATUS
cli_open(struct cli_state
*cli
, const char *fname
, int flags
, int share_mode
, uint16_t *pfnum
);
371 struct tevent_req
*cli_close_create(TALLOC_CTX
*mem_ctx
,
372 struct event_context
*ev
,
373 struct cli_state
*cli
, uint16_t fnum
,
374 struct tevent_req
**psubreq
);
375 struct tevent_req
*cli_close_send(TALLOC_CTX
*mem_ctx
,
376 struct event_context
*ev
,
377 struct cli_state
*cli
, uint16_t fnum
);
378 NTSTATUS
cli_close_recv(struct tevent_req
*req
);
379 NTSTATUS
cli_close(struct cli_state
*cli
, uint16_t fnum
);
380 struct tevent_req
*cli_ftruncate_send(TALLOC_CTX
*mem_ctx
,
381 struct event_context
*ev
,
382 struct cli_state
*cli
,
385 NTSTATUS
cli_ftruncate_recv(struct tevent_req
*req
);
386 NTSTATUS
cli_ftruncate(struct cli_state
*cli
, uint16_t fnum
, uint64_t size
);
387 NTSTATUS
cli_locktype(struct cli_state
*cli
, uint16_t fnum
,
388 uint32_t offset
, uint32_t len
,
389 int timeout
, unsigned char locktype
);
390 bool cli_lock(struct cli_state
*cli
, uint16_t fnum
,
391 uint32_t offset
, uint32_t len
, int timeout
, enum brl_type lock_type
);
392 struct tevent_req
*cli_unlock_send(TALLOC_CTX
*mem_ctx
,
393 struct event_context
*ev
,
394 struct cli_state
*cli
,
398 NTSTATUS
cli_unlock_recv(struct tevent_req
*req
);
399 NTSTATUS
cli_unlock(struct cli_state
*cli
, uint16_t fnum
, uint32_t offset
, uint32_t len
);
400 bool cli_lock64(struct cli_state
*cli
, uint16_t fnum
,
401 uint64_t offset
, uint64_t len
, int timeout
, enum brl_type lock_type
);
402 struct tevent_req
*cli_unlock64_send(TALLOC_CTX
*mem_ctx
,
403 struct event_context
*ev
,
404 struct cli_state
*cli
,
408 NTSTATUS
cli_unlock64_recv(struct tevent_req
*req
);
409 NTSTATUS
cli_unlock64(struct cli_state
*cli
, uint16_t fnum
, uint64_t offset
, uint64_t len
);
410 struct tevent_req
*cli_posix_lock_send(TALLOC_CTX
*mem_ctx
,
411 struct event_context
*ev
,
412 struct cli_state
*cli
,
417 enum brl_type lock_type
);
418 NTSTATUS
cli_posix_lock_recv(struct tevent_req
*req
);
419 NTSTATUS
cli_posix_lock(struct cli_state
*cli
, uint16_t fnum
,
420 uint64_t offset
, uint64_t len
,
421 bool wait_lock
, enum brl_type lock_type
);
422 struct tevent_req
*cli_posix_unlock_send(TALLOC_CTX
*mem_ctx
,
423 struct event_context
*ev
,
424 struct cli_state
*cli
,
428 NTSTATUS
cli_posix_unlock_recv(struct tevent_req
*req
);
429 NTSTATUS
cli_posix_unlock(struct cli_state
*cli
, uint16_t fnum
, uint64_t offset
, uint64_t len
);
430 struct tevent_req
*cli_getattrE_send(TALLOC_CTX
*mem_ctx
,
431 struct event_context
*ev
,
432 struct cli_state
*cli
,
434 NTSTATUS
cli_getattrE_recv(struct tevent_req
*req
,
440 NTSTATUS
cli_getattrE(struct cli_state
*cli
,
447 struct tevent_req
*cli_setattrE_send(TALLOC_CTX
*mem_ctx
,
448 struct event_context
*ev
,
449 struct cli_state
*cli
,
454 NTSTATUS
cli_setattrE_recv(struct tevent_req
*req
);
455 NTSTATUS
cli_setattrE(struct cli_state
*cli
,
460 struct tevent_req
*cli_getatr_send(TALLOC_CTX
*mem_ctx
,
461 struct event_context
*ev
,
462 struct cli_state
*cli
,
464 NTSTATUS
cli_getatr_recv(struct tevent_req
*req
,
468 NTSTATUS
cli_getatr(struct cli_state
*cli
,
473 struct tevent_req
*cli_setatr_send(TALLOC_CTX
*mem_ctx
,
474 struct event_context
*ev
,
475 struct cli_state
*cli
,
479 NTSTATUS
cli_setatr_recv(struct tevent_req
*req
);
480 NTSTATUS
cli_setatr(struct cli_state
*cli
,
484 struct tevent_req
*cli_chkpath_send(TALLOC_CTX
*mem_ctx
,
485 struct event_context
*ev
,
486 struct cli_state
*cli
,
488 NTSTATUS
cli_chkpath_recv(struct tevent_req
*req
);
489 NTSTATUS
cli_chkpath(struct cli_state
*cli
, const char *path
);
490 struct tevent_req
*cli_dskattr_send(TALLOC_CTX
*mem_ctx
,
491 struct event_context
*ev
,
492 struct cli_state
*cli
);
493 NTSTATUS
cli_dskattr_recv(struct tevent_req
*req
, int *bsize
, int *total
,
495 NTSTATUS
cli_dskattr(struct cli_state
*cli
, int *bsize
, int *total
, int *avail
);
496 struct tevent_req
*cli_ctemp_send(TALLOC_CTX
*mem_ctx
,
497 struct event_context
*ev
,
498 struct cli_state
*cli
,
500 NTSTATUS
cli_ctemp_recv(struct tevent_req
*req
,
504 NTSTATUS
cli_ctemp(struct cli_state
*cli
,
509 NTSTATUS
cli_raw_ioctl(struct cli_state
*cli
, uint16_t fnum
, uint32_t code
, DATA_BLOB
*blob
);
510 NTSTATUS
cli_set_ea_path(struct cli_state
*cli
, const char *path
,
511 const char *ea_name
, const char *ea_val
,
513 NTSTATUS
cli_set_ea_fnum(struct cli_state
*cli
, uint16_t fnum
,
514 const char *ea_name
, const char *ea_val
,
516 struct tevent_req
*cli_get_ea_list_path_send(TALLOC_CTX
*mem_ctx
,
517 struct tevent_context
*ev
,
518 struct cli_state
*cli
,
520 NTSTATUS
cli_get_ea_list_path_recv(struct tevent_req
*req
, TALLOC_CTX
*mem_ctx
,
521 size_t *pnum_eas
, struct ea_struct
**peas
);
522 NTSTATUS
cli_get_ea_list_path(struct cli_state
*cli
, const char *path
,
525 struct ea_struct
**pea_list
);
526 struct tevent_req
*cli_posix_open_send(TALLOC_CTX
*mem_ctx
,
527 struct event_context
*ev
,
528 struct cli_state
*cli
,
532 NTSTATUS
cli_posix_open_recv(struct tevent_req
*req
, uint16_t *pfnum
);
533 NTSTATUS
cli_posix_open(struct cli_state
*cli
, const char *fname
,
534 int flags
, mode_t mode
, uint16_t *fnum
);
535 struct tevent_req
*cli_posix_mkdir_send(TALLOC_CTX
*mem_ctx
,
536 struct event_context
*ev
,
537 struct cli_state
*cli
,
540 NTSTATUS
cli_posix_mkdir_recv(struct tevent_req
*req
);
541 NTSTATUS
cli_posix_mkdir(struct cli_state
*cli
, const char *fname
, mode_t mode
);
543 struct tevent_req
*cli_posix_unlink_send(TALLOC_CTX
*mem_ctx
,
544 struct event_context
*ev
,
545 struct cli_state
*cli
,
547 NTSTATUS
cli_posix_unlink_recv(struct tevent_req
*req
);
548 NTSTATUS
cli_posix_unlink(struct cli_state
*cli
, const char *fname
);
550 struct tevent_req
*cli_posix_rmdir_send(TALLOC_CTX
*mem_ctx
,
551 struct event_context
*ev
,
552 struct cli_state
*cli
,
554 NTSTATUS
cli_posix_rmdir_recv(struct tevent_req
*req
, TALLOC_CTX
*mem_ctx
);
555 NTSTATUS
cli_posix_rmdir(struct cli_state
*cli
, const char *fname
);
556 struct tevent_req
*cli_notify_send(TALLOC_CTX
*mem_ctx
,
557 struct tevent_context
*ev
,
558 struct cli_state
*cli
, uint16_t fnum
,
559 uint32_t buffer_size
,
560 uint32_t completion_filter
, bool recursive
);
561 NTSTATUS
cli_notify_recv(struct tevent_req
*req
, TALLOC_CTX
*mem_ctx
,
562 uint32_t *pnum_changes
,
563 struct notify_change
**pchanges
);
565 /* The following definitions come from libsmb/clifsinfo.c */
567 struct tevent_req
*cli_unix_extensions_version_send(TALLOC_CTX
*mem_ctx
,
568 struct tevent_context
*ev
,
569 struct cli_state
*cli
);
570 NTSTATUS
cli_unix_extensions_version_recv(struct tevent_req
*req
,
571 uint16_t *pmajor
, uint16_t *pminor
,
574 NTSTATUS
cli_unix_extensions_version(struct cli_state
*cli
, uint16
*pmajor
,
575 uint16
*pminor
, uint32
*pcaplow
,
577 struct tevent_req
*cli_set_unix_extensions_capabilities_send(
578 TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
, struct cli_state
*cli
,
579 uint16_t major
, uint16_t minor
, uint32_t caplow
, uint32_t caphigh
);
580 NTSTATUS
cli_set_unix_extensions_capabilities_recv(struct tevent_req
*req
);
581 NTSTATUS
cli_set_unix_extensions_capabilities(struct cli_state
*cli
,
582 uint16 major
, uint16 minor
,
583 uint32 caplow
, uint32 caphigh
);
584 struct tevent_req
*cli_get_fs_attr_info_send(TALLOC_CTX
*mem_ctx
,
585 struct tevent_context
*ev
,
586 struct cli_state
*cli
);
587 NTSTATUS
cli_get_fs_attr_info_recv(struct tevent_req
*req
, uint32_t *fs_attr
);
588 NTSTATUS
cli_get_fs_attr_info(struct cli_state
*cli
, uint32_t *fs_attr
);
589 NTSTATUS
cli_get_fs_volume_info(struct cli_state
*cli
, fstring volume_name
,
590 uint32
*pserial_number
, time_t *pdate
);
591 NTSTATUS
cli_get_fs_full_size_info(struct cli_state
*cli
,
592 uint64_t *total_allocation_units
,
593 uint64_t *caller_allocation_units
,
594 uint64_t *actual_allocation_units
,
595 uint64_t *sectors_per_allocation_unit
,
596 uint64_t *bytes_per_sector
);
597 NTSTATUS
cli_get_posix_fs_info(struct cli_state
*cli
,
598 uint32
*optimal_transfer_size
,
600 uint64_t *total_blocks
,
601 uint64_t *blocks_available
,
602 uint64_t *user_blocks_available
,
603 uint64_t *total_file_nodes
,
604 uint64_t *free_file_nodes
,
605 uint64_t *fs_identifier
);
606 NTSTATUS
cli_raw_ntlm_smb_encryption_start(struct cli_state
*cli
,
610 NTSTATUS
cli_gss_smb_encryption_start(struct cli_state
*cli
);
611 NTSTATUS
cli_force_encryption(struct cli_state
*c
,
612 const char *username
,
613 const char *password
,
616 /* The following definitions come from libsmb/clilist.c */
618 NTSTATUS
cli_list_old(struct cli_state
*cli
,const char *Mask
,uint16 attribute
,
619 NTSTATUS (*fn
)(const char *, struct file_info
*,
620 const char *, void *), void *state
);
621 NTSTATUS
cli_list_trans(struct cli_state
*cli
, const char *mask
,
622 uint16_t attribute
, int info_level
,
623 NTSTATUS (*fn
)(const char *mnt
, struct file_info
*finfo
,
624 const char *mask
, void *private_data
),
626 struct tevent_req
*cli_list_send(TALLOC_CTX
*mem_ctx
,
627 struct tevent_context
*ev
,
628 struct cli_state
*cli
,
631 uint16_t info_level
);
632 NTSTATUS
cli_list_recv(struct tevent_req
*req
, TALLOC_CTX
*mem_ctx
,
633 struct file_info
**finfo
, size_t *num_finfo
);
634 NTSTATUS
cli_list(struct cli_state
*cli
,const char *Mask
,uint16 attribute
,
635 NTSTATUS (*fn
)(const char *, struct file_info
*, const char *,
636 void *), void *state
);
638 /* The following definitions come from libsmb/climessage.c */
640 struct tevent_req
*cli_message_send(TALLOC_CTX
*mem_ctx
,
641 struct tevent_context
*ev
,
642 struct cli_state
*cli
,
643 const char *host
, const char *username
,
644 const char *message
);
645 NTSTATUS
cli_message_recv(struct tevent_req
*req
);
646 NTSTATUS
cli_message(struct cli_state
*cli
, const char *host
,
647 const char *username
, const char *message
);
649 /* The following definitions come from libsmb/clioplock.c */
651 struct tevent_req
*cli_oplock_ack_send(TALLOC_CTX
*mem_ctx
,
652 struct tevent_context
*ev
,
653 struct cli_state
*cli
,
654 uint16_t fnum
, uint8_t level
);
655 NTSTATUS
cli_oplock_ack_recv(struct tevent_req
*req
);
656 NTSTATUS
cli_oplock_ack(struct cli_state
*cli
, uint16_t fnum
, unsigned char level
);
657 void cli_oplock_handler(struct cli_state
*cli
,
658 NTSTATUS (*handler
)(struct cli_state
*, uint16_t, unsigned char));
660 /* The following definitions come from libsmb/cliprint.c */
662 int cli_print_queue(struct cli_state
*cli
,
663 void (*fn
)(struct print_job_info
*));
664 int cli_printjob_del(struct cli_state
*cli
, int job
);
666 /* The following definitions come from libsmb/cliquota.c */
668 NTSTATUS
cli_get_quota_handle(struct cli_state
*cli
, uint16_t *quota_fnum
);
669 void free_ntquota_list(SMB_NTQUOTA_LIST
**qt_list
);
670 NTSTATUS
cli_get_user_quota(struct cli_state
*cli
, int quota_fnum
,
671 SMB_NTQUOTA_STRUCT
*pqt
);
672 NTSTATUS
cli_set_user_quota(struct cli_state
*cli
, int quota_fnum
,
673 SMB_NTQUOTA_STRUCT
*pqt
);
674 NTSTATUS
cli_list_user_quota(struct cli_state
*cli
, int quota_fnum
,
675 SMB_NTQUOTA_LIST
**pqt_list
);
676 NTSTATUS
cli_get_fs_quota_info(struct cli_state
*cli
, int quota_fnum
,
677 SMB_NTQUOTA_STRUCT
*pqt
);
678 NTSTATUS
cli_set_fs_quota_info(struct cli_state
*cli
, int quota_fnum
,
679 SMB_NTQUOTA_STRUCT
*pqt
);
681 /* The following definitions come from libsmb/clireadwrite.c */
683 struct tevent_req
*cli_read_andx_create(TALLOC_CTX
*mem_ctx
,
684 struct event_context
*ev
,
685 struct cli_state
*cli
, uint16_t fnum
,
686 off_t offset
, size_t size
,
687 struct tevent_req
**psmbreq
);
688 struct tevent_req
*cli_read_andx_send(TALLOC_CTX
*mem_ctx
,
689 struct event_context
*ev
,
690 struct cli_state
*cli
, uint16_t fnum
,
691 off_t offset
, size_t size
);
692 NTSTATUS
cli_read_andx_recv(struct tevent_req
*req
, ssize_t
*received
,
694 struct tevent_req
*cli_pull_send(TALLOC_CTX
*mem_ctx
,
695 struct event_context
*ev
,
696 struct cli_state
*cli
,
697 uint16_t fnum
, off_t start_offset
,
698 SMB_OFF_T size
, size_t window_size
,
699 NTSTATUS (*sink
)(char *buf
, size_t n
,
702 NTSTATUS
cli_pull_recv(struct tevent_req
*req
, SMB_OFF_T
*received
);
703 NTSTATUS
cli_pull(struct cli_state
*cli
, uint16_t fnum
,
704 off_t start_offset
, SMB_OFF_T size
, size_t window_size
,
705 NTSTATUS (*sink
)(char *buf
, size_t n
, void *priv
),
706 void *priv
, SMB_OFF_T
*received
);
707 ssize_t
cli_read(struct cli_state
*cli
, uint16_t fnum
, char *buf
,
708 off_t offset
, size_t size
);
709 NTSTATUS
cli_smbwrite(struct cli_state
*cli
, uint16_t fnum
, char *buf
,
710 off_t offset
, size_t size1
, size_t *ptotal
);
711 struct tevent_req
*cli_write_andx_create(TALLOC_CTX
*mem_ctx
,
712 struct event_context
*ev
,
713 struct cli_state
*cli
, uint16_t fnum
,
714 uint16_t mode
, const uint8_t *buf
,
715 off_t offset
, size_t size
,
716 struct tevent_req
**reqs_before
,
718 struct tevent_req
**psmbreq
);
719 struct tevent_req
*cli_write_andx_send(TALLOC_CTX
*mem_ctx
,
720 struct event_context
*ev
,
721 struct cli_state
*cli
, uint16_t fnum
,
722 uint16_t mode
, const uint8_t *buf
,
723 off_t offset
, size_t size
);
724 NTSTATUS
cli_write_andx_recv(struct tevent_req
*req
, size_t *pwritten
);
726 NTSTATUS
cli_writeall(struct cli_state
*cli
, uint16_t fnum
, uint16_t mode
,
727 const uint8_t *buf
, off_t offset
, size_t size
,
730 struct tevent_req
*cli_push_send(TALLOC_CTX
*mem_ctx
, struct event_context
*ev
,
731 struct cli_state
*cli
,
732 uint16_t fnum
, uint16_t mode
,
733 off_t start_offset
, size_t window_size
,
734 size_t (*source
)(uint8_t *buf
, size_t n
,
737 NTSTATUS
cli_push_recv(struct tevent_req
*req
);
738 NTSTATUS
cli_push(struct cli_state
*cli
, uint16_t fnum
, uint16_t mode
,
739 off_t start_offset
, size_t window_size
,
740 size_t (*source
)(uint8_t *buf
, size_t n
, void *priv
),
743 /* The following definitions come from libsmb/clisecdesc.c */
745 struct security_descriptor
*cli_query_secdesc(struct cli_state
*cli
, uint16_t fnum
,
746 TALLOC_CTX
*mem_ctx
);
747 NTSTATUS
cli_set_secdesc(struct cli_state
*cli
, uint16_t fnum
,
748 struct security_descriptor
*sd
);
750 /* The following definitions come from libsmb/clistr.c */
752 size_t clistr_push_fn(const char *function
,
754 struct cli_state
*cli
,
759 size_t clistr_pull_fn(const char *function
,
767 size_t clistr_pull_talloc_fn(const char *function
,
776 size_t clistr_align_out(struct cli_state
*cli
, const void *p
, int flags
);
778 /* The following definitions come from libsmb/clitrans.c */
780 struct tevent_req
*cli_trans_send(
781 TALLOC_CTX
*mem_ctx
, struct event_context
*ev
,
782 struct cli_state
*cli
, uint8_t cmd
,
783 const char *pipe_name
, uint16_t fid
, uint16_t function
, int flags
,
784 uint16_t *setup
, uint8_t num_setup
, uint8_t max_setup
,
785 uint8_t *param
, uint32_t num_param
, uint32_t max_param
,
786 uint8_t *data
, uint32_t num_data
, uint32_t max_data
);
787 NTSTATUS
cli_trans_recv(struct tevent_req
*req
, TALLOC_CTX
*mem_ctx
,
788 uint16_t *recv_flags2
,
789 uint16_t **setup
, uint8_t min_setup
,
791 uint8_t **param
, uint32_t min_param
,
793 uint8_t **data
, uint32_t min_data
,
795 NTSTATUS
cli_trans(TALLOC_CTX
*mem_ctx
, struct cli_state
*cli
,
797 const char *pipe_name
, uint16_t fid
, uint16_t function
,
799 uint16_t *setup
, uint8_t num_setup
, uint8_t max_setup
,
800 uint8_t *param
, uint32_t num_param
, uint32_t max_param
,
801 uint8_t *data
, uint32_t num_data
, uint32_t max_data
,
802 uint16_t *recv_flags2
,
803 uint16_t **rsetup
, uint8_t min_rsetup
, uint8_t *num_rsetup
,
804 uint8_t **rparam
, uint32_t min_rparam
, uint32_t *num_rparam
,
805 uint8_t **rdata
, uint32_t min_rdata
, uint32_t *num_rdata
);
807 /* The following definitions come from libsmb/smb_seal.c */
809 NTSTATUS
get_enc_ctx_num(const uint8_t *buf
, uint16
*p_enc_ctx_num
);
810 bool common_encryption_on(struct smb_trans_enc_state
*es
);
811 NTSTATUS
common_ntlm_decrypt_buffer(struct ntlmssp_state
*ntlmssp_state
, char *buf
);
812 NTSTATUS
common_ntlm_encrypt_buffer(struct ntlmssp_state
*ntlmssp_state
,
816 NTSTATUS
common_encrypt_buffer(struct smb_trans_enc_state
*es
, char *buffer
, char **buf_out
);
817 NTSTATUS
common_decrypt_buffer(struct smb_trans_enc_state
*es
, char *buf
);
818 void common_free_encryption_state(struct smb_trans_enc_state
**pp_es
);
819 void common_free_enc_buffer(struct smb_trans_enc_state
*es
, char *buf
);
820 bool cli_encryption_on(struct cli_state
*cli
);
821 void cli_free_encryption_context(struct cli_state
*cli
);
822 void cli_free_enc_buffer(struct cli_state
*cli
, char *buf
);
823 NTSTATUS
cli_decrypt_message(struct cli_state
*cli
);
824 NTSTATUS
cli_encrypt_message(struct cli_state
*cli
, char *buf
, char **buf_out
);
826 /* The following definitions come from libsmb/clisigning.c */
828 bool cli_simple_set_signing(struct cli_state
*cli
,
829 const DATA_BLOB user_session_key
,
830 const DATA_BLOB response
);
831 bool cli_temp_set_signing(struct cli_state
*cli
);
832 void cli_calculate_sign_mac(struct cli_state
*cli
, char *buf
, uint32_t *seqnum
);
833 bool cli_check_sign_mac(struct cli_state
*cli
, const char *buf
, uint32_t seqnum
);
834 bool client_is_signing_on(struct cli_state
*cli
);
835 bool client_is_signing_allowed(struct cli_state
*cli
);
836 bool client_is_signing_mandatory(struct cli_state
*cli
);
837 void cli_set_signing_negotiated(struct cli_state
*cli
);
839 #endif /* _LIBSMB_PROTO_H_ */