2 Unix SMB/CIFS implementation.
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 3 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>.
18 #ifndef _LIBSMB_PROTO_H_
19 #define _LIBSMB_PROTO_H_
23 /* The following definitions come from libsmb/cliconnect.c */
25 ADS_STATUS
cli_session_setup_spnego(struct cli_state
*cli
, const char *user
,
26 const char *pass
, const char *user_domain
,
27 const char * dest_realm
);
29 NTSTATUS
cli_session_setup(struct cli_state
*cli
,
31 const char *pass
, int passlen
,
32 const char *ntpass
, int ntpasslen
,
33 const char *workgroup
);
34 struct tevent_req
*cli_session_setup_guest_create(TALLOC_CTX
*mem_ctx
,
35 struct event_context
*ev
,
36 struct cli_state
*cli
,
37 struct tevent_req
**psmbreq
);
38 struct tevent_req
*cli_session_setup_guest_send(TALLOC_CTX
*mem_ctx
,
39 struct event_context
*ev
,
40 struct cli_state
*cli
);
41 NTSTATUS
cli_session_setup_guest_recv(struct tevent_req
*req
);
42 struct tevent_req
*cli_ulogoff_send(TALLOC_CTX
*mem_ctx
,
43 struct tevent_context
*ev
,
44 struct cli_state
*cli
);
45 NTSTATUS
cli_ulogoff_recv(struct tevent_req
*req
);
46 NTSTATUS
cli_ulogoff(struct cli_state
*cli
);
47 struct tevent_req
*cli_tcon_andx_create(TALLOC_CTX
*mem_ctx
,
48 struct event_context
*ev
,
49 struct cli_state
*cli
,
50 const char *share
, const char *dev
,
51 const char *pass
, int passlen
,
52 struct tevent_req
**psmbreq
);
53 struct tevent_req
*cli_tcon_andx_send(TALLOC_CTX
*mem_ctx
,
54 struct event_context
*ev
,
55 struct cli_state
*cli
,
56 const char *share
, const char *dev
,
57 const char *pass
, int passlen
);
58 NTSTATUS
cli_tcon_andx_recv(struct tevent_req
*req
);
59 NTSTATUS
cli_tcon_andx(struct cli_state
*cli
, const char *share
,
60 const char *dev
, const char *pass
, int passlen
);
61 struct tevent_req
*cli_tdis_send(TALLOC_CTX
*mem_ctx
,
62 struct tevent_context
*ev
,
63 struct cli_state
*cli
);
64 NTSTATUS
cli_tdis_recv(struct tevent_req
*req
);
65 NTSTATUS
cli_tdis(struct cli_state
*cli
);
66 NTSTATUS
cli_negprot(struct cli_state
*cli
);
67 struct tevent_req
*cli_negprot_send(TALLOC_CTX
*mem_ctx
,
68 struct event_context
*ev
,
69 struct cli_state
*cli
);
70 NTSTATUS
cli_negprot_recv(struct tevent_req
*req
);
71 bool cli_session_request(struct cli_state
*cli
,
72 struct nmb_name
*calling
, struct nmb_name
*called
);
73 NTSTATUS
cli_connect(struct cli_state
*cli
,
75 struct sockaddr_storage
*dest_ss
);
76 NTSTATUS
cli_start_connection(struct cli_state
**output_cli
,
78 const char *dest_host
,
79 struct sockaddr_storage
*dest_ss
, int port
,
80 int signing_state
, int flags
);
81 NTSTATUS
cli_full_connection(struct cli_state
**output_cli
,
83 const char *dest_host
,
84 struct sockaddr_storage
*dest_ss
, int port
,
85 const char *service
, const char *service_type
,
86 const char *user
, const char *domain
,
87 const char *password
, int flags
,
89 bool attempt_netbios_session_request(struct cli_state
**ppcli
, const char *srchost
, const char *desthost
,
90 struct sockaddr_storage
*pdest_ss
);
91 NTSTATUS
cli_raw_tcon(struct cli_state
*cli
,
92 const char *service
, const char *pass
, const char *dev
,
93 uint16
*max_xmit
, uint16
*tid
);
94 struct cli_state
*get_ipc_connect(char *server
,
95 struct sockaddr_storage
*server_ss
,
96 const struct user_auth_info
*user_info
);
97 struct cli_state
*get_ipc_connect_master_ip(TALLOC_CTX
*ctx
,
98 struct sockaddr_storage
*mb_ip
,
99 const struct user_auth_info
*user_info
,
100 char **pp_workgroup_out
);
101 struct cli_state
*get_ipc_connect_master_ip_bcast(TALLOC_CTX
*ctx
,
102 const struct user_auth_info
*user_info
,
103 char **pp_workgroup_out
);
105 /* The following definitions come from libsmb/clidfs.c */
107 NTSTATUS
cli_cm_force_encryption(struct cli_state
*c
,
108 const char *username
,
109 const char *password
,
111 const char *sharename
);
112 struct cli_state
*cli_cm_open(TALLOC_CTX
*ctx
,
113 struct cli_state
*referring_cli
,
116 const struct user_auth_info
*auth_info
,
122 void cli_cm_display(const struct cli_state
*c
);
123 struct client_dfs_referral
;
124 NTSTATUS
cli_dfs_get_referral(TALLOC_CTX
*ctx
,
125 struct cli_state
*cli
,
127 struct client_dfs_referral
**refs
,
130 bool cli_resolve_path(TALLOC_CTX
*ctx
,
132 const struct user_auth_info
*dfs_auth_info
,
133 struct cli_state
*rootcli
,
135 struct cli_state
**targetcli
,
136 char **pp_targetpath
);
138 bool cli_check_msdfs_proxy(TALLOC_CTX
*ctx
,
139 struct cli_state
*cli
,
140 const char *sharename
,
144 const char *username
,
145 const char *password
,
148 /* The following definitions come from libsmb/clientgen.c */
150 int cli_set_message(char *buf
,int num_words
,int num_bytes
,bool zero
);
151 unsigned int cli_set_timeout(struct cli_state
*cli
, unsigned int timeout
);
152 void cli_set_port(struct cli_state
*cli
, int port
);
153 bool cli_state_seqnum_persistent(struct cli_state
*cli
,
155 bool cli_state_seqnum_remove(struct cli_state
*cli
,
157 bool cli_receive_smb(struct cli_state
*cli
);
158 bool cli_send_smb(struct cli_state
*cli
);
159 void cli_setup_packet_buf(struct cli_state
*cli
, char *buf
);
160 void cli_setup_packet(struct cli_state
*cli
);
161 void cli_setup_bcc(struct cli_state
*cli
, void *p
);
162 NTSTATUS
cli_set_domain(struct cli_state
*cli
, const char *domain
);
163 NTSTATUS
cli_set_username(struct cli_state
*cli
, const char *username
);
164 NTSTATUS
cli_set_password(struct cli_state
*cli
, const char *password
);
165 NTSTATUS
cli_init_creds(struct cli_state
*cli
, const char *username
, const char *domain
, const char *password
);
166 struct cli_state
*cli_initialise(void);
167 struct cli_state
*cli_initialise_ex(int signing_state
);
168 void cli_nt_pipes_close(struct cli_state
*cli
);
169 void cli_shutdown(struct cli_state
*cli
);
170 void cli_sockopt(struct cli_state
*cli
, const char *options
);
171 uint16
cli_setpid(struct cli_state
*cli
, uint16 pid
);
172 bool cli_set_case_sensitive(struct cli_state
*cli
, bool case_sensitive
);
173 struct tevent_req
*cli_echo_send(TALLOC_CTX
*mem_ctx
, struct event_context
*ev
,
174 struct cli_state
*cli
, uint16_t num_echos
,
176 NTSTATUS
cli_echo_recv(struct tevent_req
*req
);
177 NTSTATUS
cli_echo(struct cli_state
*cli
, uint16_t num_echos
, DATA_BLOB data
);
178 bool cli_ucs2(struct cli_state
*cli
);
179 bool is_andx_req(uint8_t cmd
);
180 NTSTATUS
cli_smb(TALLOC_CTX
*mem_ctx
, struct cli_state
*cli
,
181 uint8_t smb_command
, uint8_t additional_flags
,
182 uint8_t wct
, uint16_t *vwv
,
183 uint32_t num_bytes
, const uint8_t *bytes
,
184 struct tevent_req
**result_parent
,
185 uint8_t min_wct
, uint8_t *pwct
, uint16_t **pvwv
,
186 uint32_t *pnum_bytes
, uint8_t **pbytes
);
188 /* The following definitions come from libsmb/clierror.c */
190 const char *cli_errstr(struct cli_state
*cli
);
191 NTSTATUS
cli_nt_error(struct cli_state
*cli
);
192 void cli_dos_error(struct cli_state
*cli
, uint8
*eclass
, uint32
*ecode
);
193 int cli_errno(struct cli_state
*cli
);
194 bool cli_is_error(struct cli_state
*cli
);
195 bool cli_is_nt_error(struct cli_state
*cli
);
196 bool cli_is_dos_error(struct cli_state
*cli
);
197 NTSTATUS
cli_get_nt_error(struct cli_state
*cli
);
198 void cli_set_nt_error(struct cli_state
*cli
, NTSTATUS status
);
199 void cli_reset_error(struct cli_state
*cli
);
200 bool cli_state_is_connected(struct cli_state
*cli
);
202 /* The following definitions come from libsmb/clifile.c */
204 struct tevent_req
*cli_setpathinfo_send(TALLOC_CTX
*mem_ctx
,
205 struct tevent_context
*ev
,
206 struct cli_state
*cli
,
211 NTSTATUS
cli_setpathinfo_recv(struct tevent_req
*req
);
212 NTSTATUS
cli_setpathinfo(struct cli_state
*cli
,
218 struct tevent_req
*cli_posix_symlink_send(TALLOC_CTX
*mem_ctx
,
219 struct event_context
*ev
,
220 struct cli_state
*cli
,
222 const char *newname
);
223 NTSTATUS
cli_posix_symlink_recv(struct tevent_req
*req
);
224 NTSTATUS
cli_posix_symlink(struct cli_state
*cli
,
226 const char *newname
);
227 struct tevent_req
*cli_posix_readlink_send(TALLOC_CTX
*mem_ctx
,
228 struct event_context
*ev
,
229 struct cli_state
*cli
,
232 NTSTATUS
cli_posix_readlink_recv(struct tevent_req
*req
, struct cli_state
*cli
,
233 char *retpath
, size_t len
);
234 NTSTATUS
cli_posix_readlink(struct cli_state
*cli
, const char *fname
,
235 char *linkpath
, size_t len
);
236 struct tevent_req
*cli_posix_hardlink_send(TALLOC_CTX
*mem_ctx
,
237 struct event_context
*ev
,
238 struct cli_state
*cli
,
240 const char *newname
);
241 NTSTATUS
cli_posix_hardlink_recv(struct tevent_req
*req
);
242 NTSTATUS
cli_posix_hardlink(struct cli_state
*cli
,
244 const char *newname
);
245 uint32_t unix_perms_to_wire(mode_t perms
);
246 mode_t
wire_perms_to_unix(uint32_t perms
);
247 struct tevent_req
*cli_posix_getfacl_send(TALLOC_CTX
*mem_ctx
,
248 struct event_context
*ev
,
249 struct cli_state
*cli
,
251 NTSTATUS
cli_posix_getfacl_recv(struct tevent_req
*req
,
255 NTSTATUS
cli_posix_getfacl(struct cli_state
*cli
,
260 struct tevent_req
*cli_posix_stat_send(TALLOC_CTX
*mem_ctx
,
261 struct event_context
*ev
,
262 struct cli_state
*cli
,
264 NTSTATUS
cli_posix_stat_recv(struct tevent_req
*req
,
265 SMB_STRUCT_STAT
*sbuf
);
266 NTSTATUS
cli_posix_stat(struct cli_state
*cli
,
268 SMB_STRUCT_STAT
*sbuf
);
269 struct tevent_req
*cli_posix_chmod_send(TALLOC_CTX
*mem_ctx
,
270 struct event_context
*ev
,
271 struct cli_state
*cli
,
274 NTSTATUS
cli_posix_chmod_recv(struct tevent_req
*req
);
275 NTSTATUS
cli_posix_chmod(struct cli_state
*cli
, const char *fname
, mode_t mode
);
276 struct tevent_req
*cli_posix_chown_send(TALLOC_CTX
*mem_ctx
,
277 struct event_context
*ev
,
278 struct cli_state
*cli
,
282 NTSTATUS
cli_posix_chown_recv(struct tevent_req
*req
);
283 NTSTATUS
cli_posix_chown(struct cli_state
*cli
,
287 struct tevent_req
*cli_rename_send(TALLOC_CTX
*mem_ctx
,
288 struct event_context
*ev
,
289 struct cli_state
*cli
,
290 const char *fname_src
,
291 const char *fname_dst
);
292 NTSTATUS
cli_rename_recv(struct tevent_req
*req
);
293 NTSTATUS
cli_rename(struct cli_state
*cli
, const char *fname_src
, const char *fname_dst
);
294 struct tevent_req
*cli_ntrename_send(TALLOC_CTX
*mem_ctx
,
295 struct event_context
*ev
,
296 struct cli_state
*cli
,
297 const char *fname_src
,
298 const char *fname_dst
);
299 NTSTATUS
cli_ntrename_recv(struct tevent_req
*req
);
300 NTSTATUS
cli_ntrename(struct cli_state
*cli
, const char *fname_src
, const char *fname_dst
);
302 struct tevent_req
*cli_nt_hardlink_send(TALLOC_CTX
*mem_ctx
,
303 struct event_context
*ev
,
304 struct cli_state
*cli
,
305 const char *fname_src
,
306 const char *fname_dst
);
307 NTSTATUS
cli_nt_hardlink_recv(struct tevent_req
*req
);
308 NTSTATUS
cli_nt_hardlink(struct cli_state
*cli
, const char *fname_src
, const char *fname_dst
);
310 struct tevent_req
*cli_unlink_send(TALLOC_CTX
*mem_ctx
,
311 struct event_context
*ev
,
312 struct cli_state
*cli
,
314 uint16_t mayhave_attrs
);
315 NTSTATUS
cli_unlink_recv(struct tevent_req
*req
);
316 NTSTATUS
cli_unlink(struct cli_state
*cli
, const char *fname
, uint16_t mayhave_attrs
);
318 struct tevent_req
*cli_mkdir_send(TALLOC_CTX
*mem_ctx
,
319 struct event_context
*ev
,
320 struct cli_state
*cli
,
322 NTSTATUS
cli_mkdir_recv(struct tevent_req
*req
);
323 NTSTATUS
cli_mkdir(struct cli_state
*cli
, const char *dname
);
324 struct tevent_req
*cli_rmdir_send(TALLOC_CTX
*mem_ctx
,
325 struct event_context
*ev
,
326 struct cli_state
*cli
,
328 NTSTATUS
cli_rmdir_recv(struct tevent_req
*req
);
329 NTSTATUS
cli_rmdir(struct cli_state
*cli
, const char *dname
);
330 struct tevent_req
*cli_nt_delete_on_close_send(TALLOC_CTX
*mem_ctx
,
331 struct event_context
*ev
,
332 struct cli_state
*cli
,
335 NTSTATUS
cli_nt_delete_on_close_recv(struct tevent_req
*req
);
336 NTSTATUS
cli_nt_delete_on_close(struct cli_state
*cli
, uint16_t fnum
, bool flag
);
337 struct tevent_req
*cli_ntcreate_send(TALLOC_CTX
*mem_ctx
,
338 struct event_context
*ev
,
339 struct cli_state
*cli
,
342 uint32_t DesiredAccess
,
343 uint32_t FileAttributes
,
344 uint32_t ShareAccess
,
345 uint32_t CreateDisposition
,
346 uint32_t CreateOptions
,
347 uint8_t SecurityFlags
);
348 NTSTATUS
cli_ntcreate_recv(struct tevent_req
*req
, uint16_t *pfnum
);
349 NTSTATUS
cli_ntcreate(struct cli_state
*cli
,
352 uint32_t DesiredAccess
,
353 uint32_t FileAttributes
,
354 uint32_t ShareAccess
,
355 uint32_t CreateDisposition
,
356 uint32_t CreateOptions
,
357 uint8_t SecurityFlags
,
359 uint8_t *smb_bytes_push_str(uint8_t *buf
, bool ucs2
, const char *str
,
360 size_t str_len
, size_t *pconverted_size
);
361 uint8_t *smb_bytes_push_bytes(uint8_t *buf
, uint8_t prefix
,
362 const uint8_t *bytes
, size_t num_bytes
);
363 struct tevent_req
*cli_open_create(TALLOC_CTX
*mem_ctx
,
364 struct event_context
*ev
,
365 struct cli_state
*cli
, const char *fname
,
366 int flags
, int share_mode
,
367 struct tevent_req
**psmbreq
);
368 struct tevent_req
*cli_open_send(TALLOC_CTX
*mem_ctx
, struct event_context
*ev
,
369 struct cli_state
*cli
, const char *fname
,
370 int flags
, int share_mode
);
371 NTSTATUS
cli_open_recv(struct tevent_req
*req
, uint16_t *fnum
);
372 NTSTATUS
cli_open(struct cli_state
*cli
, const char *fname
, int flags
, int share_mode
, uint16_t *pfnum
);
373 struct tevent_req
*cli_close_create(TALLOC_CTX
*mem_ctx
,
374 struct event_context
*ev
,
375 struct cli_state
*cli
, uint16_t fnum
,
376 struct tevent_req
**psubreq
);
377 struct tevent_req
*cli_close_send(TALLOC_CTX
*mem_ctx
,
378 struct event_context
*ev
,
379 struct cli_state
*cli
, uint16_t fnum
);
380 NTSTATUS
cli_close_recv(struct tevent_req
*req
);
381 NTSTATUS
cli_close(struct cli_state
*cli
, uint16_t fnum
);
382 struct tevent_req
*cli_ftruncate_send(TALLOC_CTX
*mem_ctx
,
383 struct event_context
*ev
,
384 struct cli_state
*cli
,
387 NTSTATUS
cli_ftruncate_recv(struct tevent_req
*req
);
388 NTSTATUS
cli_ftruncate(struct cli_state
*cli
, uint16_t fnum
, uint64_t size
);
389 NTSTATUS
cli_locktype(struct cli_state
*cli
, uint16_t fnum
,
390 uint32_t offset
, uint32_t len
,
391 int timeout
, unsigned char locktype
);
392 bool cli_lock(struct cli_state
*cli
, uint16_t fnum
,
393 uint32_t offset
, uint32_t len
, int timeout
, enum brl_type lock_type
);
394 struct tevent_req
*cli_unlock_send(TALLOC_CTX
*mem_ctx
,
395 struct event_context
*ev
,
396 struct cli_state
*cli
,
400 NTSTATUS
cli_unlock_recv(struct tevent_req
*req
);
401 NTSTATUS
cli_unlock(struct cli_state
*cli
, uint16_t fnum
, uint32_t offset
, uint32_t len
);
402 bool cli_lock64(struct cli_state
*cli
, uint16_t fnum
,
403 uint64_t offset
, uint64_t len
, int timeout
, enum brl_type lock_type
);
404 struct tevent_req
*cli_unlock64_send(TALLOC_CTX
*mem_ctx
,
405 struct event_context
*ev
,
406 struct cli_state
*cli
,
410 NTSTATUS
cli_unlock64_recv(struct tevent_req
*req
);
411 NTSTATUS
cli_unlock64(struct cli_state
*cli
, uint16_t fnum
, uint64_t offset
, uint64_t len
);
412 struct tevent_req
*cli_posix_lock_send(TALLOC_CTX
*mem_ctx
,
413 struct event_context
*ev
,
414 struct cli_state
*cli
,
419 enum brl_type lock_type
);
420 NTSTATUS
cli_posix_lock_recv(struct tevent_req
*req
);
421 NTSTATUS
cli_posix_lock(struct cli_state
*cli
, uint16_t fnum
,
422 uint64_t offset
, uint64_t len
,
423 bool wait_lock
, enum brl_type lock_type
);
424 struct tevent_req
*cli_posix_unlock_send(TALLOC_CTX
*mem_ctx
,
425 struct event_context
*ev
,
426 struct cli_state
*cli
,
430 NTSTATUS
cli_posix_unlock_recv(struct tevent_req
*req
);
431 NTSTATUS
cli_posix_unlock(struct cli_state
*cli
, uint16_t fnum
, uint64_t offset
, uint64_t len
);
432 struct tevent_req
*cli_getattrE_send(TALLOC_CTX
*mem_ctx
,
433 struct event_context
*ev
,
434 struct cli_state
*cli
,
436 NTSTATUS
cli_getattrE_recv(struct tevent_req
*req
,
442 NTSTATUS
cli_getattrE(struct cli_state
*cli
,
449 struct tevent_req
*cli_setattrE_send(TALLOC_CTX
*mem_ctx
,
450 struct event_context
*ev
,
451 struct cli_state
*cli
,
456 NTSTATUS
cli_setattrE_recv(struct tevent_req
*req
);
457 NTSTATUS
cli_setattrE(struct cli_state
*cli
,
462 struct tevent_req
*cli_getatr_send(TALLOC_CTX
*mem_ctx
,
463 struct event_context
*ev
,
464 struct cli_state
*cli
,
466 NTSTATUS
cli_getatr_recv(struct tevent_req
*req
,
470 NTSTATUS
cli_getatr(struct cli_state
*cli
,
475 struct tevent_req
*cli_setatr_send(TALLOC_CTX
*mem_ctx
,
476 struct event_context
*ev
,
477 struct cli_state
*cli
,
481 NTSTATUS
cli_setatr_recv(struct tevent_req
*req
);
482 NTSTATUS
cli_setatr(struct cli_state
*cli
,
486 struct tevent_req
*cli_chkpath_send(TALLOC_CTX
*mem_ctx
,
487 struct event_context
*ev
,
488 struct cli_state
*cli
,
490 NTSTATUS
cli_chkpath_recv(struct tevent_req
*req
);
491 NTSTATUS
cli_chkpath(struct cli_state
*cli
, const char *path
);
492 struct tevent_req
*cli_dskattr_send(TALLOC_CTX
*mem_ctx
,
493 struct event_context
*ev
,
494 struct cli_state
*cli
);
495 NTSTATUS
cli_dskattr_recv(struct tevent_req
*req
, int *bsize
, int *total
,
497 NTSTATUS
cli_dskattr(struct cli_state
*cli
, int *bsize
, int *total
, int *avail
);
498 struct tevent_req
*cli_ctemp_send(TALLOC_CTX
*mem_ctx
,
499 struct event_context
*ev
,
500 struct cli_state
*cli
,
502 NTSTATUS
cli_ctemp_recv(struct tevent_req
*req
,
506 NTSTATUS
cli_ctemp(struct cli_state
*cli
,
511 NTSTATUS
cli_raw_ioctl(struct cli_state
*cli
, uint16_t fnum
, uint32_t code
, DATA_BLOB
*blob
);
512 NTSTATUS
cli_set_ea_path(struct cli_state
*cli
, const char *path
,
513 const char *ea_name
, const char *ea_val
,
515 NTSTATUS
cli_set_ea_fnum(struct cli_state
*cli
, uint16_t fnum
,
516 const char *ea_name
, const char *ea_val
,
518 struct tevent_req
*cli_get_ea_list_path_send(TALLOC_CTX
*mem_ctx
,
519 struct tevent_context
*ev
,
520 struct cli_state
*cli
,
522 NTSTATUS
cli_get_ea_list_path_recv(struct tevent_req
*req
, TALLOC_CTX
*mem_ctx
,
523 size_t *pnum_eas
, struct ea_struct
**peas
);
524 NTSTATUS
cli_get_ea_list_path(struct cli_state
*cli
, const char *path
,
527 struct ea_struct
**pea_list
);
528 struct tevent_req
*cli_posix_open_send(TALLOC_CTX
*mem_ctx
,
529 struct event_context
*ev
,
530 struct cli_state
*cli
,
534 NTSTATUS
cli_posix_open_recv(struct tevent_req
*req
, uint16_t *pfnum
);
535 NTSTATUS
cli_posix_open(struct cli_state
*cli
, const char *fname
,
536 int flags
, mode_t mode
, uint16_t *fnum
);
537 struct tevent_req
*cli_posix_mkdir_send(TALLOC_CTX
*mem_ctx
,
538 struct event_context
*ev
,
539 struct cli_state
*cli
,
542 NTSTATUS
cli_posix_mkdir_recv(struct tevent_req
*req
);
543 NTSTATUS
cli_posix_mkdir(struct cli_state
*cli
, const char *fname
, mode_t mode
);
545 struct tevent_req
*cli_posix_unlink_send(TALLOC_CTX
*mem_ctx
,
546 struct event_context
*ev
,
547 struct cli_state
*cli
,
549 NTSTATUS
cli_posix_unlink_recv(struct tevent_req
*req
);
550 NTSTATUS
cli_posix_unlink(struct cli_state
*cli
, const char *fname
);
552 struct tevent_req
*cli_posix_rmdir_send(TALLOC_CTX
*mem_ctx
,
553 struct event_context
*ev
,
554 struct cli_state
*cli
,
556 NTSTATUS
cli_posix_rmdir_recv(struct tevent_req
*req
, TALLOC_CTX
*mem_ctx
);
557 NTSTATUS
cli_posix_rmdir(struct cli_state
*cli
, const char *fname
);
558 struct tevent_req
*cli_notify_send(TALLOC_CTX
*mem_ctx
,
559 struct tevent_context
*ev
,
560 struct cli_state
*cli
, uint16_t fnum
,
561 uint32_t buffer_size
,
562 uint32_t completion_filter
, bool recursive
);
563 NTSTATUS
cli_notify_recv(struct tevent_req
*req
, TALLOC_CTX
*mem_ctx
,
564 uint32_t *pnum_changes
,
565 struct notify_change
**pchanges
);
567 /* The following definitions come from libsmb/clifsinfo.c */
569 struct tevent_req
*cli_unix_extensions_version_send(TALLOC_CTX
*mem_ctx
,
570 struct tevent_context
*ev
,
571 struct cli_state
*cli
);
572 NTSTATUS
cli_unix_extensions_version_recv(struct tevent_req
*req
,
573 uint16_t *pmajor
, uint16_t *pminor
,
576 NTSTATUS
cli_unix_extensions_version(struct cli_state
*cli
, uint16
*pmajor
,
577 uint16
*pminor
, uint32
*pcaplow
,
579 struct tevent_req
*cli_set_unix_extensions_capabilities_send(
580 TALLOC_CTX
*mem_ctx
, struct tevent_context
*ev
, struct cli_state
*cli
,
581 uint16_t major
, uint16_t minor
, uint32_t caplow
, uint32_t caphigh
);
582 NTSTATUS
cli_set_unix_extensions_capabilities_recv(struct tevent_req
*req
);
583 NTSTATUS
cli_set_unix_extensions_capabilities(struct cli_state
*cli
,
584 uint16 major
, uint16 minor
,
585 uint32 caplow
, uint32 caphigh
);
586 struct tevent_req
*cli_get_fs_attr_info_send(TALLOC_CTX
*mem_ctx
,
587 struct tevent_context
*ev
,
588 struct cli_state
*cli
);
589 NTSTATUS
cli_get_fs_attr_info_recv(struct tevent_req
*req
, uint32_t *fs_attr
);
590 NTSTATUS
cli_get_fs_attr_info(struct cli_state
*cli
, uint32_t *fs_attr
);
591 NTSTATUS
cli_get_fs_volume_info(struct cli_state
*cli
, fstring volume_name
,
592 uint32
*pserial_number
, time_t *pdate
);
593 NTSTATUS
cli_get_fs_full_size_info(struct cli_state
*cli
,
594 uint64_t *total_allocation_units
,
595 uint64_t *caller_allocation_units
,
596 uint64_t *actual_allocation_units
,
597 uint64_t *sectors_per_allocation_unit
,
598 uint64_t *bytes_per_sector
);
599 NTSTATUS
cli_get_posix_fs_info(struct cli_state
*cli
,
600 uint32
*optimal_transfer_size
,
602 uint64_t *total_blocks
,
603 uint64_t *blocks_available
,
604 uint64_t *user_blocks_available
,
605 uint64_t *total_file_nodes
,
606 uint64_t *free_file_nodes
,
607 uint64_t *fs_identifier
);
608 NTSTATUS
cli_raw_ntlm_smb_encryption_start(struct cli_state
*cli
,
612 NTSTATUS
cli_gss_smb_encryption_start(struct cli_state
*cli
);
613 NTSTATUS
cli_force_encryption(struct cli_state
*c
,
614 const char *username
,
615 const char *password
,
618 /* The following definitions come from libsmb/clilist.c */
620 NTSTATUS
cli_list_old(struct cli_state
*cli
,const char *Mask
,uint16 attribute
,
621 NTSTATUS (*fn
)(const char *, struct file_info
*,
622 const char *, void *), void *state
);
623 NTSTATUS
cli_list_trans(struct cli_state
*cli
, const char *mask
,
624 uint16_t attribute
, int info_level
,
625 NTSTATUS (*fn
)(const char *mnt
, struct file_info
*finfo
,
626 const char *mask
, void *private_data
),
628 struct tevent_req
*cli_list_send(TALLOC_CTX
*mem_ctx
,
629 struct tevent_context
*ev
,
630 struct cli_state
*cli
,
633 uint16_t info_level
);
634 NTSTATUS
cli_list_recv(struct tevent_req
*req
, TALLOC_CTX
*mem_ctx
,
635 struct file_info
**finfo
, size_t *num_finfo
);
636 NTSTATUS
cli_list(struct cli_state
*cli
,const char *Mask
,uint16 attribute
,
637 NTSTATUS (*fn
)(const char *, struct file_info
*, const char *,
638 void *), void *state
);
640 /* The following definitions come from libsmb/climessage.c */
642 struct tevent_req
*cli_message_send(TALLOC_CTX
*mem_ctx
,
643 struct tevent_context
*ev
,
644 struct cli_state
*cli
,
645 const char *host
, const char *username
,
646 const char *message
);
647 NTSTATUS
cli_message_recv(struct tevent_req
*req
);
648 NTSTATUS
cli_message(struct cli_state
*cli
, const char *host
,
649 const char *username
, const char *message
);
651 /* The following definitions come from libsmb/clioplock.c */
653 struct tevent_req
*cli_oplock_ack_send(TALLOC_CTX
*mem_ctx
,
654 struct tevent_context
*ev
,
655 struct cli_state
*cli
,
656 uint16_t fnum
, uint8_t level
);
657 NTSTATUS
cli_oplock_ack_recv(struct tevent_req
*req
);
658 NTSTATUS
cli_oplock_ack(struct cli_state
*cli
, uint16_t fnum
, unsigned char level
);
659 void cli_oplock_handler(struct cli_state
*cli
,
660 NTSTATUS (*handler
)(struct cli_state
*, uint16_t, unsigned char));
662 /* The following definitions come from libsmb/cliprint.c */
664 int cli_print_queue(struct cli_state
*cli
,
665 void (*fn
)(struct print_job_info
*));
666 int cli_printjob_del(struct cli_state
*cli
, int job
);
668 /* The following definitions come from libsmb/cliquota.c */
670 NTSTATUS
cli_get_quota_handle(struct cli_state
*cli
, uint16_t *quota_fnum
);
671 void free_ntquota_list(SMB_NTQUOTA_LIST
**qt_list
);
672 NTSTATUS
cli_get_user_quota(struct cli_state
*cli
, int quota_fnum
,
673 SMB_NTQUOTA_STRUCT
*pqt
);
674 NTSTATUS
cli_set_user_quota(struct cli_state
*cli
, int quota_fnum
,
675 SMB_NTQUOTA_STRUCT
*pqt
);
676 NTSTATUS
cli_list_user_quota(struct cli_state
*cli
, int quota_fnum
,
677 SMB_NTQUOTA_LIST
**pqt_list
);
678 NTSTATUS
cli_get_fs_quota_info(struct cli_state
*cli
, int quota_fnum
,
679 SMB_NTQUOTA_STRUCT
*pqt
);
680 NTSTATUS
cli_set_fs_quota_info(struct cli_state
*cli
, int quota_fnum
,
681 SMB_NTQUOTA_STRUCT
*pqt
);
683 /* The following definitions come from libsmb/clireadwrite.c */
685 struct tevent_req
*cli_read_andx_create(TALLOC_CTX
*mem_ctx
,
686 struct event_context
*ev
,
687 struct cli_state
*cli
, uint16_t fnum
,
688 off_t offset
, size_t size
,
689 struct tevent_req
**psmbreq
);
690 struct tevent_req
*cli_read_andx_send(TALLOC_CTX
*mem_ctx
,
691 struct event_context
*ev
,
692 struct cli_state
*cli
, uint16_t fnum
,
693 off_t offset
, size_t size
);
694 NTSTATUS
cli_read_andx_recv(struct tevent_req
*req
, ssize_t
*received
,
696 struct tevent_req
*cli_pull_send(TALLOC_CTX
*mem_ctx
,
697 struct event_context
*ev
,
698 struct cli_state
*cli
,
699 uint16_t fnum
, off_t start_offset
,
700 SMB_OFF_T size
, size_t window_size
,
701 NTSTATUS (*sink
)(char *buf
, size_t n
,
704 NTSTATUS
cli_pull_recv(struct tevent_req
*req
, SMB_OFF_T
*received
);
705 NTSTATUS
cli_pull(struct cli_state
*cli
, uint16_t fnum
,
706 off_t start_offset
, SMB_OFF_T size
, size_t window_size
,
707 NTSTATUS (*sink
)(char *buf
, size_t n
, void *priv
),
708 void *priv
, SMB_OFF_T
*received
);
709 ssize_t
cli_read(struct cli_state
*cli
, uint16_t fnum
, char *buf
,
710 off_t offset
, size_t size
);
711 NTSTATUS
cli_smbwrite(struct cli_state
*cli
, uint16_t fnum
, char *buf
,
712 off_t offset
, size_t size1
, size_t *ptotal
);
713 struct tevent_req
*cli_write_andx_create(TALLOC_CTX
*mem_ctx
,
714 struct event_context
*ev
,
715 struct cli_state
*cli
, uint16_t fnum
,
716 uint16_t mode
, const uint8_t *buf
,
717 off_t offset
, size_t size
,
718 struct tevent_req
**reqs_before
,
720 struct tevent_req
**psmbreq
);
721 struct tevent_req
*cli_write_andx_send(TALLOC_CTX
*mem_ctx
,
722 struct event_context
*ev
,
723 struct cli_state
*cli
, uint16_t fnum
,
724 uint16_t mode
, const uint8_t *buf
,
725 off_t offset
, size_t size
);
726 NTSTATUS
cli_write_andx_recv(struct tevent_req
*req
, size_t *pwritten
);
728 NTSTATUS
cli_writeall(struct cli_state
*cli
, uint16_t fnum
, uint16_t mode
,
729 const uint8_t *buf
, off_t offset
, size_t size
,
732 struct tevent_req
*cli_push_send(TALLOC_CTX
*mem_ctx
, struct event_context
*ev
,
733 struct cli_state
*cli
,
734 uint16_t fnum
, uint16_t mode
,
735 off_t start_offset
, size_t window_size
,
736 size_t (*source
)(uint8_t *buf
, size_t n
,
739 NTSTATUS
cli_push_recv(struct tevent_req
*req
);
740 NTSTATUS
cli_push(struct cli_state
*cli
, uint16_t fnum
, uint16_t mode
,
741 off_t start_offset
, size_t window_size
,
742 size_t (*source
)(uint8_t *buf
, size_t n
, void *priv
),
745 /* The following definitions come from libsmb/clisecdesc.c */
747 struct security_descriptor
*cli_query_secdesc(struct cli_state
*cli
, uint16_t fnum
,
748 TALLOC_CTX
*mem_ctx
);
749 NTSTATUS
cli_set_secdesc(struct cli_state
*cli
, uint16_t fnum
,
750 struct security_descriptor
*sd
);
752 /* The following definitions come from libsmb/clistr.c */
754 size_t clistr_push_fn(struct cli_state
*cli
,
759 size_t clistr_pull_fn(const char *inbuf
,
765 size_t clistr_pull_talloc(TALLOC_CTX
*ctx
,
772 size_t clistr_align_out(struct cli_state
*cli
, const void *p
, int flags
);
774 /* The following definitions come from libsmb/clitrans.c */
776 struct tevent_req
*cli_trans_send(
777 TALLOC_CTX
*mem_ctx
, struct event_context
*ev
,
778 struct cli_state
*cli
, uint8_t cmd
,
779 const char *pipe_name
, uint16_t fid
, uint16_t function
, int flags
,
780 uint16_t *setup
, uint8_t num_setup
, uint8_t max_setup
,
781 uint8_t *param
, uint32_t num_param
, uint32_t max_param
,
782 uint8_t *data
, uint32_t num_data
, uint32_t max_data
);
783 NTSTATUS
cli_trans_recv(struct tevent_req
*req
, TALLOC_CTX
*mem_ctx
,
784 uint16_t *recv_flags2
,
785 uint16_t **setup
, uint8_t min_setup
,
787 uint8_t **param
, uint32_t min_param
,
789 uint8_t **data
, uint32_t min_data
,
791 NTSTATUS
cli_trans(TALLOC_CTX
*mem_ctx
, struct cli_state
*cli
,
793 const char *pipe_name
, uint16_t fid
, uint16_t function
,
795 uint16_t *setup
, uint8_t num_setup
, uint8_t max_setup
,
796 uint8_t *param
, uint32_t num_param
, uint32_t max_param
,
797 uint8_t *data
, uint32_t num_data
, uint32_t max_data
,
798 uint16_t *recv_flags2
,
799 uint16_t **rsetup
, uint8_t min_rsetup
, uint8_t *num_rsetup
,
800 uint8_t **rparam
, uint32_t min_rparam
, uint32_t *num_rparam
,
801 uint8_t **rdata
, uint32_t min_rdata
, uint32_t *num_rdata
);
803 /* The following definitions come from libsmb/smb_seal.c */
805 NTSTATUS
get_enc_ctx_num(const uint8_t *buf
, uint16
*p_enc_ctx_num
);
806 bool common_encryption_on(struct smb_trans_enc_state
*es
);
807 NTSTATUS
common_ntlm_decrypt_buffer(struct ntlmssp_state
*ntlmssp_state
, char *buf
);
808 NTSTATUS
common_ntlm_encrypt_buffer(struct ntlmssp_state
*ntlmssp_state
,
812 NTSTATUS
common_encrypt_buffer(struct smb_trans_enc_state
*es
, char *buffer
, char **buf_out
);
813 NTSTATUS
common_decrypt_buffer(struct smb_trans_enc_state
*es
, char *buf
);
814 void common_free_encryption_state(struct smb_trans_enc_state
**pp_es
);
815 void common_free_enc_buffer(struct smb_trans_enc_state
*es
, char *buf
);
816 bool cli_encryption_on(struct cli_state
*cli
);
817 void cli_free_encryption_context(struct cli_state
*cli
);
818 void cli_free_enc_buffer(struct cli_state
*cli
, char *buf
);
819 NTSTATUS
cli_decrypt_message(struct cli_state
*cli
);
820 NTSTATUS
cli_encrypt_message(struct cli_state
*cli
, char *buf
, char **buf_out
);
822 /* The following definitions come from libsmb/clisigning.c */
824 bool cli_simple_set_signing(struct cli_state
*cli
,
825 const DATA_BLOB user_session_key
,
826 const DATA_BLOB response
);
827 bool cli_temp_set_signing(struct cli_state
*cli
);
828 void cli_calculate_sign_mac(struct cli_state
*cli
, char *buf
, uint32_t *seqnum
);
829 bool cli_check_sign_mac(struct cli_state
*cli
, const char *buf
, uint32_t seqnum
);
830 bool client_is_signing_on(struct cli_state
*cli
);
831 bool client_is_signing_allowed(struct cli_state
*cli
);
832 bool client_is_signing_mandatory(struct cli_state
*cli
);
833 void cli_set_signing_negotiated(struct cli_state
*cli
);
835 #endif /* _LIBSMB_PROTO_H_ */