CVE-2015-7560: s3: libsmb: Rename cli_posix_getfaclXX() functions to cli_posix_getacl...
[Samba.git] / source3 / libsmb / proto.h
blobab5fd82b0cc176635d205ac8c47bf0b49dec9394
1 /*
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_
29 #include "ads.h"
30 #include "auth_info.h"
32 struct smb_trans_enc_state;
34 /* The following definitions come from libsmb/cliconnect.c */
36 struct tevent_req *cli_session_setup_send(TALLOC_CTX *mem_ctx,
37 struct tevent_context *ev,
38 struct cli_state *cli,
39 const char *user,
40 const char *pass, int passlen,
41 const char *ntpass, int ntpasslen,
42 const char *workgroup);
43 NTSTATUS cli_session_setup_recv(struct tevent_req *req);
44 NTSTATUS cli_session_setup(struct cli_state *cli,
45 const char *user,
46 const char *pass, int passlen,
47 const char *ntpass, int ntpasslen,
48 const char *workgroup);
49 struct tevent_req *cli_session_setup_guest_create(TALLOC_CTX *mem_ctx,
50 struct tevent_context *ev,
51 struct cli_state *cli,
52 struct tevent_req **psmbreq);
53 struct tevent_req *cli_session_setup_guest_send(TALLOC_CTX *mem_ctx,
54 struct tevent_context *ev,
55 struct cli_state *cli);
56 NTSTATUS cli_session_setup_guest_recv(struct tevent_req *req);
57 NTSTATUS cli_ulogoff(struct cli_state *cli);
58 struct tevent_req *cli_tcon_andx_create(TALLOC_CTX *mem_ctx,
59 struct tevent_context *ev,
60 struct cli_state *cli,
61 const char *share, const char *dev,
62 const char *pass, int passlen,
63 struct tevent_req **psmbreq);
64 struct tevent_req *cli_tcon_andx_send(TALLOC_CTX *mem_ctx,
65 struct tevent_context *ev,
66 struct cli_state *cli,
67 const char *share, const char *dev,
68 const char *pass, int passlen);
69 NTSTATUS cli_tcon_andx_recv(struct tevent_req *req);
70 NTSTATUS cli_tcon_andx(struct cli_state *cli, const char *share,
71 const char *dev, const char *pass, int passlen);
72 NTSTATUS cli_tree_connect(struct cli_state *cli, const char *share,
73 const char *dev, const char *pass, int passlen);
74 NTSTATUS cli_tdis(struct cli_state *cli);
75 NTSTATUS cli_connect_nb(const char *host, const struct sockaddr_storage *dest_ss,
76 uint16_t port, int name_type, const char *myname,
77 int signing_state, int flags, struct cli_state **pcli);
78 NTSTATUS cli_start_connection(struct cli_state **output_cli,
79 const char *my_name,
80 const char *dest_host,
81 const struct sockaddr_storage *dest_ss, int port,
82 int signing_state, int flags);
83 struct tevent_req *cli_full_connection_send(
84 TALLOC_CTX *mem_ctx, struct tevent_context *ev,
85 const char *my_name, const char *dest_host,
86 const struct sockaddr_storage *dest_ss, int port,
87 const char *service, const char *service_type,
88 const char *user, const char *domain,
89 const char *password, int flags, int signing_state);
90 NTSTATUS cli_full_connection_recv(struct tevent_req *req,
91 struct cli_state **output_cli);
92 NTSTATUS cli_full_connection(struct cli_state **output_cli,
93 const char *my_name,
94 const char *dest_host,
95 const struct sockaddr_storage *dest_ss, int port,
96 const char *service, const char *service_type,
97 const char *user, const char *domain,
98 const char *password, int flags,
99 int signing_state);
100 NTSTATUS cli_raw_tcon(struct cli_state *cli,
101 const char *service, const char *pass, const char *dev,
102 uint16_t *max_xmit, uint16_t *tid);
103 struct cli_state *get_ipc_connect(char *server,
104 struct sockaddr_storage *server_ss,
105 const struct user_auth_info *user_info);
106 struct cli_state *get_ipc_connect_master_ip(TALLOC_CTX *ctx,
107 struct sockaddr_storage *mb_ip,
108 const struct user_auth_info *user_info,
109 char **pp_workgroup_out);
110 struct cli_state *get_ipc_connect_master_ip_bcast(TALLOC_CTX *ctx,
111 const struct user_auth_info *user_info,
112 char **pp_workgroup_out);
114 /* The following definitions come from libsmb/clidfs.c */
116 NTSTATUS cli_cm_force_encryption(struct cli_state *c,
117 const char *username,
118 const char *password,
119 const char *domain,
120 const char *sharename);
121 NTSTATUS cli_cm_open(TALLOC_CTX *ctx,
122 struct cli_state *referring_cli,
123 const char *server,
124 const char *share,
125 const struct user_auth_info *auth_info,
126 bool show_hdr,
127 bool force_encrypt,
128 int max_protocol,
129 int port,
130 int name_type,
131 struct cli_state **pcli);
132 void cli_cm_display(struct cli_state *c);
133 struct client_dfs_referral;
134 NTSTATUS cli_dfs_get_referral(TALLOC_CTX *ctx,
135 struct cli_state *cli,
136 const char *path,
137 struct client_dfs_referral **refs,
138 size_t *num_refs,
139 size_t *consumed);
140 NTSTATUS cli_resolve_path(TALLOC_CTX *ctx,
141 const char *mountpt,
142 const struct user_auth_info *dfs_auth_info,
143 struct cli_state *rootcli,
144 const char *path,
145 struct cli_state **targetcli,
146 char **pp_targetpath);
148 bool cli_check_msdfs_proxy(TALLOC_CTX *ctx,
149 struct cli_state *cli,
150 const char *sharename,
151 char **pp_newserver,
152 char **pp_newshare,
153 bool force_encrypt,
154 const char *username,
155 const char *password,
156 const char *domain);
158 /* The following definitions come from libsmb/clientgen.c */
160 int cli_set_message(char *buf,int num_words,int num_bytes,bool zero);
161 unsigned int cli_set_timeout(struct cli_state *cli, unsigned int timeout);
162 bool cli_set_backup_intent(struct cli_state *cli, bool flag);
163 void cli_setup_packet_buf(struct cli_state *cli, char *buf);
164 extern struct GUID cli_state_client_guid;
165 struct cli_state *cli_state_create(TALLOC_CTX *mem_ctx,
166 int fd,
167 const char *remote_name,
168 const char *remote_realm,
169 int signing_state,
170 int flags);
171 void cli_nt_pipes_close(struct cli_state *cli);
172 void cli_shutdown(struct cli_state *cli);
173 const char *cli_state_remote_realm(struct cli_state *cli);
174 uint16_t cli_state_get_vc_num(struct cli_state *cli);
175 uint16_t cli_setpid(struct cli_state *cli, uint16_t pid);
176 uint16_t cli_getpid(struct cli_state *cli);
177 bool cli_state_has_tcon(struct cli_state *cli);
178 uint16_t cli_state_get_tid(struct cli_state *cli);
179 uint16_t cli_state_set_tid(struct cli_state *cli, uint16_t tid);
180 uint16_t cli_state_get_uid(struct cli_state *cli);
181 uint16_t cli_state_set_uid(struct cli_state *cli, uint16_t uid);
182 bool cli_set_case_sensitive(struct cli_state *cli, bool case_sensitive);
183 uint32_t cli_state_available_size(struct cli_state *cli, uint32_t ofs);
184 time_t cli_state_server_time(struct cli_state *cli);
185 struct tevent_req *cli_echo_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
186 struct cli_state *cli, uint16_t num_echos,
187 DATA_BLOB data);
188 NTSTATUS cli_echo_recv(struct tevent_req *req);
189 NTSTATUS cli_echo(struct cli_state *cli, uint16_t num_echos, DATA_BLOB data);
190 bool is_andx_req(uint8_t cmd);
191 NTSTATUS cli_smb(TALLOC_CTX *mem_ctx, struct cli_state *cli,
192 uint8_t smb_command, uint8_t additional_flags,
193 uint8_t wct, uint16_t *vwv,
194 uint32_t num_bytes, const uint8_t *bytes,
195 struct tevent_req **result_parent,
196 uint8_t min_wct, uint8_t *pwct, uint16_t **pvwv,
197 uint32_t *pnum_bytes, uint8_t **pbytes);
199 /* The following definitions come from libsmb/clierror.c */
201 const char *cli_errstr(struct cli_state *cli);
202 NTSTATUS cli_nt_error(struct cli_state *cli);
203 void cli_dos_error(struct cli_state *cli, uint8_t *eclass, uint32_t *ecode);
204 int cli_errno(struct cli_state *cli);
205 bool cli_is_error(struct cli_state *cli);
206 bool cli_is_nt_error(struct cli_state *cli);
207 bool cli_is_dos_error(struct cli_state *cli);
208 bool cli_state_is_connected(struct cli_state *cli);
210 /* The following definitions come from libsmb/clifile.c */
212 struct tevent_req *cli_setpathinfo_send(TALLOC_CTX *mem_ctx,
213 struct tevent_context *ev,
214 struct cli_state *cli,
215 uint16_t level,
216 const char *path,
217 uint8_t *data,
218 size_t data_len);
219 NTSTATUS cli_setpathinfo_recv(struct tevent_req *req);
220 NTSTATUS cli_setpathinfo(struct cli_state *cli,
221 uint16_t level,
222 const char *path,
223 uint8_t *data,
224 size_t data_len);
226 struct tevent_req *cli_posix_symlink_send(TALLOC_CTX *mem_ctx,
227 struct tevent_context *ev,
228 struct cli_state *cli,
229 const char *oldname,
230 const char *newname);
231 NTSTATUS cli_posix_symlink_recv(struct tevent_req *req);
232 NTSTATUS cli_posix_symlink(struct cli_state *cli,
233 const char *oldname,
234 const char *newname);
235 struct tevent_req *cli_posix_readlink_send(TALLOC_CTX *mem_ctx,
236 struct tevent_context *ev,
237 struct cli_state *cli,
238 const char *fname,
239 size_t len);
240 NTSTATUS cli_posix_readlink_recv(struct tevent_req *req, struct cli_state *cli,
241 char *retpath, size_t len);
242 NTSTATUS cli_posix_readlink(struct cli_state *cli, const char *fname,
243 char *linkpath, size_t len);
244 struct tevent_req *cli_posix_hardlink_send(TALLOC_CTX *mem_ctx,
245 struct tevent_context *ev,
246 struct cli_state *cli,
247 const char *oldname,
248 const char *newname);
249 NTSTATUS cli_posix_hardlink_recv(struct tevent_req *req);
250 NTSTATUS cli_posix_hardlink(struct cli_state *cli,
251 const char *oldname,
252 const char *newname);
253 uint32_t unix_perms_to_wire(mode_t perms);
254 mode_t wire_perms_to_unix(uint32_t perms);
255 struct tevent_req *cli_posix_getacl_send(TALLOC_CTX *mem_ctx,
256 struct tevent_context *ev,
257 struct cli_state *cli,
258 const char *fname);
259 NTSTATUS cli_posix_getacl_recv(struct tevent_req *req,
260 TALLOC_CTX *mem_ctx,
261 size_t *prb_size,
262 char **retbuf);
263 NTSTATUS cli_posix_getacl(struct cli_state *cli,
264 const char *fname,
265 TALLOC_CTX *mem_ctx,
266 size_t *prb_size,
267 char **retbuf);
268 struct tevent_req *cli_posix_stat_send(TALLOC_CTX *mem_ctx,
269 struct tevent_context *ev,
270 struct cli_state *cli,
271 const char *fname);
272 NTSTATUS cli_posix_stat_recv(struct tevent_req *req,
273 SMB_STRUCT_STAT *sbuf);
274 NTSTATUS cli_posix_stat(struct cli_state *cli,
275 const char *fname,
276 SMB_STRUCT_STAT *sbuf);
277 struct tevent_req *cli_posix_chmod_send(TALLOC_CTX *mem_ctx,
278 struct tevent_context *ev,
279 struct cli_state *cli,
280 const char *fname,
281 mode_t mode);
282 NTSTATUS cli_posix_chmod_recv(struct tevent_req *req);
283 NTSTATUS cli_posix_chmod(struct cli_state *cli, const char *fname, mode_t mode);
284 struct tevent_req *cli_posix_chown_send(TALLOC_CTX *mem_ctx,
285 struct tevent_context *ev,
286 struct cli_state *cli,
287 const char *fname,
288 uid_t uid,
289 gid_t gid);
290 NTSTATUS cli_posix_chown_recv(struct tevent_req *req);
291 NTSTATUS cli_posix_chown(struct cli_state *cli,
292 const char *fname,
293 uid_t uid,
294 gid_t gid);
295 struct tevent_req *cli_rename_send(TALLOC_CTX *mem_ctx,
296 struct tevent_context *ev,
297 struct cli_state *cli,
298 const char *fname_src,
299 const char *fname_dst);
300 NTSTATUS cli_rename_recv(struct tevent_req *req);
301 NTSTATUS cli_rename(struct cli_state *cli, const char *fname_src, const char *fname_dst);
302 struct tevent_req *cli_ntrename_send(TALLOC_CTX *mem_ctx,
303 struct tevent_context *ev,
304 struct cli_state *cli,
305 const char *fname_src,
306 const char *fname_dst);
307 NTSTATUS cli_ntrename_recv(struct tevent_req *req);
308 NTSTATUS cli_ntrename(struct cli_state *cli, const char *fname_src, const char *fname_dst);
310 struct tevent_req *cli_nt_hardlink_send(TALLOC_CTX *mem_ctx,
311 struct tevent_context *ev,
312 struct cli_state *cli,
313 const char *fname_src,
314 const char *fname_dst);
315 NTSTATUS cli_nt_hardlink_recv(struct tevent_req *req);
316 NTSTATUS cli_nt_hardlink(struct cli_state *cli, const char *fname_src, const char *fname_dst);
318 struct tevent_req *cli_unlink_send(TALLOC_CTX *mem_ctx,
319 struct tevent_context *ev,
320 struct cli_state *cli,
321 const char *fname,
322 uint16_t mayhave_attrs);
323 NTSTATUS cli_unlink_recv(struct tevent_req *req);
324 NTSTATUS cli_unlink(struct cli_state *cli, const char *fname, uint16_t mayhave_attrs);
326 struct tevent_req *cli_mkdir_send(TALLOC_CTX *mem_ctx,
327 struct tevent_context *ev,
328 struct cli_state *cli,
329 const char *dname);
330 NTSTATUS cli_mkdir_recv(struct tevent_req *req);
331 NTSTATUS cli_mkdir(struct cli_state *cli, const char *dname);
332 struct tevent_req *cli_rmdir_send(TALLOC_CTX *mem_ctx,
333 struct tevent_context *ev,
334 struct cli_state *cli,
335 const char *dname);
336 NTSTATUS cli_rmdir_recv(struct tevent_req *req);
337 NTSTATUS cli_rmdir(struct cli_state *cli, const char *dname);
338 struct tevent_req *cli_nt_delete_on_close_send(TALLOC_CTX *mem_ctx,
339 struct tevent_context *ev,
340 struct cli_state *cli,
341 uint16_t fnum,
342 bool flag);
343 NTSTATUS cli_nt_delete_on_close_recv(struct tevent_req *req);
344 NTSTATUS cli_nt_delete_on_close(struct cli_state *cli, uint16_t fnum, bool flag);
345 struct tevent_req *cli_ntcreate_send(TALLOC_CTX *mem_ctx,
346 struct tevent_context *ev,
347 struct cli_state *cli,
348 const char *fname,
349 uint32_t CreatFlags,
350 uint32_t DesiredAccess,
351 uint32_t FileAttributes,
352 uint32_t ShareAccess,
353 uint32_t CreateDisposition,
354 uint32_t CreateOptions,
355 uint8_t SecurityFlags);
356 NTSTATUS cli_ntcreate_recv(struct tevent_req *req,
357 uint16_t *pfnum,
358 struct smb_create_returns *cr);
359 NTSTATUS cli_ntcreate(struct cli_state *cli,
360 const char *fname,
361 uint32_t CreatFlags,
362 uint32_t DesiredAccess,
363 uint32_t FileAttributes,
364 uint32_t ShareAccess,
365 uint32_t CreateDisposition,
366 uint32_t CreateOptions,
367 uint8_t SecurityFlags,
368 uint16_t *pfid,
369 struct smb_create_returns *cr);
370 uint8_t *smb_bytes_push_str(uint8_t *buf, bool ucs2, const char *str,
371 size_t str_len, size_t *pconverted_size);
372 uint8_t *smb_bytes_push_bytes(uint8_t *buf, uint8_t prefix,
373 const uint8_t *bytes, size_t num_bytes);
374 uint8_t *trans2_bytes_push_str(uint8_t *buf, bool ucs2,
375 const char *str, size_t str_len,
376 size_t *pconverted_size);
377 uint8_t *trans2_bytes_push_bytes(uint8_t *buf,
378 const uint8_t *bytes, size_t num_bytes);
379 struct tevent_req *cli_openx_create(TALLOC_CTX *mem_ctx,
380 struct tevent_context *ev,
381 struct cli_state *cli, const char *fname,
382 int flags, int share_mode,
383 struct tevent_req **psmbreq);
384 struct tevent_req *cli_openx_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
385 struct cli_state *cli, const char *fname,
386 int flags, int share_mode);
387 NTSTATUS cli_openx_recv(struct tevent_req *req, uint16_t *fnum);
388 NTSTATUS cli_openx(struct cli_state *cli, const char *fname, int flags, int share_mode, uint16_t *pfnum);
389 NTSTATUS cli_open(struct cli_state *cli, const char *fname, int flags, int share_mode, uint16_t *pfnum);
390 struct tevent_req *cli_close_create(TALLOC_CTX *mem_ctx,
391 struct tevent_context *ev,
392 struct cli_state *cli, uint16_t fnum,
393 struct tevent_req **psubreq);
394 struct tevent_req *cli_close_send(TALLOC_CTX *mem_ctx,
395 struct tevent_context *ev,
396 struct cli_state *cli, uint16_t fnum);
397 NTSTATUS cli_close_recv(struct tevent_req *req);
398 NTSTATUS cli_close(struct cli_state *cli, uint16_t fnum);
399 struct tevent_req *cli_ftruncate_send(TALLOC_CTX *mem_ctx,
400 struct tevent_context *ev,
401 struct cli_state *cli,
402 uint16_t fnum,
403 uint64_t size);
404 NTSTATUS cli_ftruncate_recv(struct tevent_req *req);
405 NTSTATUS cli_ftruncate(struct cli_state *cli, uint16_t fnum, uint64_t size);
406 NTSTATUS cli_locktype(struct cli_state *cli, uint16_t fnum,
407 uint32_t offset, uint32_t len,
408 int timeout, unsigned char locktype);
409 NTSTATUS cli_lock32(struct cli_state *cli, uint16_t fnum, uint32_t offset,
410 uint32_t len, int timeout, enum brl_type lock_type);
411 struct tevent_req *cli_unlock_send(TALLOC_CTX *mem_ctx,
412 struct tevent_context *ev,
413 struct cli_state *cli,
414 uint16_t fnum,
415 uint64_t offset,
416 uint64_t len);
417 NTSTATUS cli_unlock_recv(struct tevent_req *req);
418 NTSTATUS cli_unlock(struct cli_state *cli, uint16_t fnum, uint32_t offset, uint32_t len);
419 NTSTATUS cli_lock64(struct cli_state *cli, uint16_t fnum,
420 uint64_t offset, uint64_t len, int timeout,
421 enum brl_type lock_type);
422 struct tevent_req *cli_unlock64_send(TALLOC_CTX *mem_ctx,
423 struct tevent_context *ev,
424 struct cli_state *cli,
425 uint16_t fnum,
426 uint64_t offset,
427 uint64_t len);
428 NTSTATUS cli_unlock64_recv(struct tevent_req *req);
429 NTSTATUS cli_unlock64(struct cli_state *cli, uint16_t fnum, uint64_t offset, uint64_t len);
430 struct tevent_req *cli_posix_lock_send(TALLOC_CTX *mem_ctx,
431 struct tevent_context *ev,
432 struct cli_state *cli,
433 uint16_t fnum,
434 uint64_t offset,
435 uint64_t len,
436 bool wait_lock,
437 enum brl_type lock_type);
438 NTSTATUS cli_posix_lock_recv(struct tevent_req *req);
439 NTSTATUS cli_posix_lock(struct cli_state *cli, uint16_t fnum,
440 uint64_t offset, uint64_t len,
441 bool wait_lock, enum brl_type lock_type);
442 struct tevent_req *cli_posix_unlock_send(TALLOC_CTX *mem_ctx,
443 struct tevent_context *ev,
444 struct cli_state *cli,
445 uint16_t fnum,
446 uint64_t offset,
447 uint64_t len);
448 NTSTATUS cli_posix_unlock_recv(struct tevent_req *req);
449 NTSTATUS cli_posix_unlock(struct cli_state *cli, uint16_t fnum, uint64_t offset, uint64_t len);
450 struct tevent_req *cli_getattrE_send(TALLOC_CTX *mem_ctx,
451 struct tevent_context *ev,
452 struct cli_state *cli,
453 uint16_t fnum);
454 NTSTATUS cli_getattrE_recv(struct tevent_req *req,
455 uint16_t *attr,
456 off_t *size,
457 time_t *change_time,
458 time_t *access_time,
459 time_t *write_time);
460 NTSTATUS cli_getattrE(struct cli_state *cli,
461 uint16_t fnum,
462 uint16_t *attr,
463 off_t *size,
464 time_t *change_time,
465 time_t *access_time,
466 time_t *write_time);
467 struct tevent_req *cli_setattrE_send(TALLOC_CTX *mem_ctx,
468 struct tevent_context *ev,
469 struct cli_state *cli,
470 uint16_t fnum,
471 time_t change_time,
472 time_t access_time,
473 time_t write_time);
474 NTSTATUS cli_setattrE_recv(struct tevent_req *req);
475 NTSTATUS cli_setattrE(struct cli_state *cli,
476 uint16_t fnum,
477 time_t change_time,
478 time_t access_time,
479 time_t write_time);
480 struct tevent_req *cli_getatr_send(TALLOC_CTX *mem_ctx,
481 struct tevent_context *ev,
482 struct cli_state *cli,
483 const char *fname);
484 NTSTATUS cli_getatr_recv(struct tevent_req *req,
485 uint16_t *attr,
486 off_t *size,
487 time_t *write_time);
488 NTSTATUS cli_getatr(struct cli_state *cli,
489 const char *fname,
490 uint16_t *attr,
491 off_t *size,
492 time_t *write_time);
493 struct tevent_req *cli_setatr_send(TALLOC_CTX *mem_ctx,
494 struct tevent_context *ev,
495 struct cli_state *cli,
496 const char *fname,
497 uint16_t attr,
498 time_t mtime);
499 NTSTATUS cli_setatr_recv(struct tevent_req *req);
500 NTSTATUS cli_setatr(struct cli_state *cli,
501 const char *fname,
502 uint16_t attr,
503 time_t mtime);
504 struct tevent_req *cli_chkpath_send(TALLOC_CTX *mem_ctx,
505 struct tevent_context *ev,
506 struct cli_state *cli,
507 const char *fname);
508 NTSTATUS cli_chkpath_recv(struct tevent_req *req);
509 NTSTATUS cli_chkpath(struct cli_state *cli, const char *path);
510 struct tevent_req *cli_dskattr_send(TALLOC_CTX *mem_ctx,
511 struct tevent_context *ev,
512 struct cli_state *cli);
513 NTSTATUS cli_dskattr_recv(struct tevent_req *req, int *bsize, int *total,
514 int *avail);
515 NTSTATUS cli_dskattr(struct cli_state *cli, int *bsize, int *total, int *avail);
516 NTSTATUS cli_disk_size(struct cli_state *cli, const char *path, uint64_t *bsize,
517 uint64_t *total, uint64_t *avail);
518 struct tevent_req *cli_ctemp_send(TALLOC_CTX *mem_ctx,
519 struct tevent_context *ev,
520 struct cli_state *cli,
521 const char *path);
522 NTSTATUS cli_ctemp_recv(struct tevent_req *req,
523 TALLOC_CTX *ctx,
524 uint16_t *pfnum,
525 char **outfile);
526 NTSTATUS cli_ctemp(struct cli_state *cli,
527 TALLOC_CTX *ctx,
528 const char *path,
529 uint16_t *pfnum,
530 char **out_path);
531 NTSTATUS cli_raw_ioctl(struct cli_state *cli, uint16_t fnum, uint32_t code, DATA_BLOB *blob);
532 NTSTATUS cli_set_ea_path(struct cli_state *cli, const char *path,
533 const char *ea_name, const char *ea_val,
534 size_t ea_len);
535 NTSTATUS cli_set_ea_fnum(struct cli_state *cli, uint16_t fnum,
536 const char *ea_name, const char *ea_val,
537 size_t ea_len);
538 struct tevent_req *cli_get_ea_list_path_send(TALLOC_CTX *mem_ctx,
539 struct tevent_context *ev,
540 struct cli_state *cli,
541 const char *fname);
542 NTSTATUS cli_get_ea_list_path_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
543 size_t *pnum_eas, struct ea_struct **peas);
544 NTSTATUS cli_get_ea_list_path(struct cli_state *cli, const char *path,
545 TALLOC_CTX *ctx,
546 size_t *pnum_eas,
547 struct ea_struct **pea_list);
548 struct tevent_req *cli_posix_open_send(TALLOC_CTX *mem_ctx,
549 struct tevent_context *ev,
550 struct cli_state *cli,
551 const char *fname,
552 int flags,
553 mode_t mode);
554 NTSTATUS cli_posix_open_recv(struct tevent_req *req, uint16_t *pfnum);
555 NTSTATUS cli_posix_open(struct cli_state *cli, const char *fname,
556 int flags, mode_t mode, uint16_t *fnum);
557 struct tevent_req *cli_posix_mkdir_send(TALLOC_CTX *mem_ctx,
558 struct tevent_context *ev,
559 struct cli_state *cli,
560 const char *fname,
561 mode_t mode);
562 NTSTATUS cli_posix_mkdir_recv(struct tevent_req *req);
563 NTSTATUS cli_posix_mkdir(struct cli_state *cli, const char *fname, mode_t mode);
565 struct tevent_req *cli_posix_unlink_send(TALLOC_CTX *mem_ctx,
566 struct tevent_context *ev,
567 struct cli_state *cli,
568 const char *fname);
569 NTSTATUS cli_posix_unlink_recv(struct tevent_req *req);
570 NTSTATUS cli_posix_unlink(struct cli_state *cli, const char *fname);
572 struct tevent_req *cli_posix_rmdir_send(TALLOC_CTX *mem_ctx,
573 struct tevent_context *ev,
574 struct cli_state *cli,
575 const char *fname);
576 NTSTATUS cli_posix_rmdir_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx);
577 NTSTATUS cli_posix_rmdir(struct cli_state *cli, const char *fname);
578 struct tevent_req *cli_notify_send(TALLOC_CTX *mem_ctx,
579 struct tevent_context *ev,
580 struct cli_state *cli, uint16_t fnum,
581 uint32_t buffer_size,
582 uint32_t completion_filter, bool recursive);
583 NTSTATUS cli_notify_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
584 uint32_t *pnum_changes,
585 struct notify_change **pchanges);
586 NTSTATUS cli_notify(struct cli_state *cli, uint16_t fnum, uint32_t buffer_size,
587 uint32_t completion_filter, bool recursive,
588 TALLOC_CTX *mem_ctx, uint32_t *pnum_changes,
589 struct notify_change **pchanges);
591 struct tevent_req *cli_nttrans_create_send(TALLOC_CTX *mem_ctx,
592 struct tevent_context *ev,
593 struct cli_state *cli,
594 const char *fname,
595 uint32_t CreatFlags,
596 uint32_t DesiredAccess,
597 uint32_t FileAttributes,
598 uint32_t ShareAccess,
599 uint32_t CreateDisposition,
600 uint32_t CreateOptions,
601 uint8_t SecurityFlags,
602 struct security_descriptor *secdesc,
603 struct ea_struct *eas,
604 int num_eas);
605 NTSTATUS cli_nttrans_create_recv(struct tevent_req *req,
606 uint16_t *fnum,
607 struct smb_create_returns *cr);
608 NTSTATUS cli_nttrans_create(struct cli_state *cli,
609 const char *fname,
610 uint32_t CreatFlags,
611 uint32_t DesiredAccess,
612 uint32_t FileAttributes,
613 uint32_t ShareAccess,
614 uint32_t CreateDisposition,
615 uint32_t CreateOptions,
616 uint8_t SecurityFlags,
617 struct security_descriptor *secdesc,
618 struct ea_struct *eas,
619 int num_eas,
620 uint16_t *pfid,
621 struct smb_create_returns *cr);
623 /* The following definitions come from libsmb/clifsinfo.c */
625 struct tevent_req *cli_unix_extensions_version_send(TALLOC_CTX *mem_ctx,
626 struct tevent_context *ev,
627 struct cli_state *cli);
628 NTSTATUS cli_unix_extensions_version_recv(struct tevent_req *req,
629 uint16_t *pmajor, uint16_t *pminor,
630 uint32_t *pcaplow,
631 uint32_t *pcaphigh);
632 NTSTATUS cli_unix_extensions_version(struct cli_state *cli, uint16_t *pmajor,
633 uint16_t *pminor, uint32_t *pcaplow,
634 uint32_t *pcaphigh);
635 struct tevent_req *cli_set_unix_extensions_capabilities_send(
636 TALLOC_CTX *mem_ctx, struct tevent_context *ev, struct cli_state *cli,
637 uint16_t major, uint16_t minor, uint32_t caplow, uint32_t caphigh);
638 NTSTATUS cli_set_unix_extensions_capabilities_recv(struct tevent_req *req);
639 NTSTATUS cli_set_unix_extensions_capabilities(struct cli_state *cli,
640 uint16_t major, uint16_t minor,
641 uint32_t caplow, uint32_t caphigh);
642 struct tevent_req *cli_get_fs_attr_info_send(TALLOC_CTX *mem_ctx,
643 struct tevent_context *ev,
644 struct cli_state *cli);
645 NTSTATUS cli_get_fs_attr_info_recv(struct tevent_req *req, uint32_t *fs_attr);
646 NTSTATUS cli_get_fs_attr_info(struct cli_state *cli, uint32_t *fs_attr);
647 NTSTATUS cli_get_fs_volume_info(struct cli_state *cli,
648 TALLOC_CTX *mem_ctx, char **volume_name,
649 uint32_t *pserial_number, time_t *pdate);
650 NTSTATUS cli_get_fs_full_size_info(struct cli_state *cli,
651 uint64_t *total_allocation_units,
652 uint64_t *caller_allocation_units,
653 uint64_t *actual_allocation_units,
654 uint64_t *sectors_per_allocation_unit,
655 uint64_t *bytes_per_sector);
656 NTSTATUS cli_get_posix_fs_info(struct cli_state *cli,
657 uint32_t *optimal_transfer_size,
658 uint32_t *block_size,
659 uint64_t *total_blocks,
660 uint64_t *blocks_available,
661 uint64_t *user_blocks_available,
662 uint64_t *total_file_nodes,
663 uint64_t *free_file_nodes,
664 uint64_t *fs_identifier);
665 NTSTATUS cli_raw_ntlm_smb_encryption_start(struct cli_state *cli,
666 const char *user,
667 const char *pass,
668 const char *domain);
669 NTSTATUS cli_gss_smb_encryption_start(struct cli_state *cli);
670 NTSTATUS cli_force_encryption(struct cli_state *c,
671 const char *username,
672 const char *password,
673 const char *domain);
675 /* The following definitions come from libsmb/clilist.c */
677 NTSTATUS cli_list_old(struct cli_state *cli,const char *Mask,uint16_t attribute,
678 NTSTATUS (*fn)(const char *, struct file_info *,
679 const char *, void *), void *state);
680 NTSTATUS cli_list_trans(struct cli_state *cli, const char *mask,
681 uint16_t attribute, int info_level,
682 NTSTATUS (*fn)(const char *mnt, struct file_info *finfo,
683 const char *mask, void *private_data),
684 void *private_data);
685 struct tevent_req *cli_list_send(TALLOC_CTX *mem_ctx,
686 struct tevent_context *ev,
687 struct cli_state *cli,
688 const char *mask,
689 uint16_t attribute,
690 uint16_t info_level);
691 NTSTATUS cli_list_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
692 struct file_info **finfo, size_t *num_finfo);
693 NTSTATUS cli_list(struct cli_state *cli,const char *Mask,uint16_t attribute,
694 NTSTATUS (*fn)(const char *, struct file_info *, const char *,
695 void *), void *state);
697 /* The following definitions come from libsmb/climessage.c */
699 struct tevent_req *cli_message_send(TALLOC_CTX *mem_ctx,
700 struct tevent_context *ev,
701 struct cli_state *cli,
702 const char *host, const char *username,
703 const char *message);
704 NTSTATUS cli_message_recv(struct tevent_req *req);
705 NTSTATUS cli_message(struct cli_state *cli, const char *host,
706 const char *username, const char *message);
708 /* The following definitions come from libsmb/clioplock.c */
710 struct tevent_req *cli_smb_oplock_break_waiter_send(TALLOC_CTX *mem_ctx,
711 struct tevent_context *ev,
712 struct cli_state *cli);
713 NTSTATUS cli_smb_oplock_break_waiter_recv(struct tevent_req *req,
714 uint16_t *pfnum,
715 uint8_t *plevel);
717 struct tevent_req *cli_oplock_ack_send(TALLOC_CTX *mem_ctx,
718 struct tevent_context *ev,
719 struct cli_state *cli,
720 uint16_t fnum, uint8_t level);
721 NTSTATUS cli_oplock_ack_recv(struct tevent_req *req);
723 /* The following definitions come from libsmb/cliprint.c */
725 int cli_print_queue(struct cli_state *cli,
726 void (*fn)(struct print_job_info *));
727 int cli_printjob_del(struct cli_state *cli, int job);
729 /* The following definitions come from libsmb/cliquota.c */
731 NTSTATUS cli_get_quota_handle(struct cli_state *cli, uint16_t *quota_fnum);
732 void free_ntquota_list(SMB_NTQUOTA_LIST **qt_list);
733 NTSTATUS cli_get_user_quota(struct cli_state *cli, int quota_fnum,
734 SMB_NTQUOTA_STRUCT *pqt);
735 NTSTATUS cli_set_user_quota(struct cli_state *cli, int quota_fnum,
736 SMB_NTQUOTA_STRUCT *pqt);
737 NTSTATUS cli_list_user_quota(struct cli_state *cli, int quota_fnum,
738 SMB_NTQUOTA_LIST **pqt_list);
739 NTSTATUS cli_get_fs_quota_info(struct cli_state *cli, int quota_fnum,
740 SMB_NTQUOTA_STRUCT *pqt);
741 NTSTATUS cli_set_fs_quota_info(struct cli_state *cli, int quota_fnum,
742 SMB_NTQUOTA_STRUCT *pqt);
744 /* The following definitions come from libsmb/clireadwrite.c */
746 struct tevent_req *cli_read_andx_create(TALLOC_CTX *mem_ctx,
747 struct tevent_context *ev,
748 struct cli_state *cli, uint16_t fnum,
749 off_t offset, size_t size,
750 struct tevent_req **psmbreq);
751 struct tevent_req *cli_read_andx_send(TALLOC_CTX *mem_ctx,
752 struct tevent_context *ev,
753 struct cli_state *cli, uint16_t fnum,
754 off_t offset, size_t size);
755 NTSTATUS cli_read_andx_recv(struct tevent_req *req, ssize_t *received,
756 uint8_t **rcvbuf);
757 struct tevent_req *cli_pull_send(TALLOC_CTX *mem_ctx,
758 struct tevent_context *ev,
759 struct cli_state *cli,
760 uint16_t fnum, off_t start_offset,
761 off_t size, size_t window_size,
762 NTSTATUS (*sink)(char *buf, size_t n,
763 void *priv),
764 void *priv);
765 NTSTATUS cli_pull_recv(struct tevent_req *req, off_t *received);
766 NTSTATUS cli_pull(struct cli_state *cli, uint16_t fnum,
767 off_t start_offset, off_t size, size_t window_size,
768 NTSTATUS (*sink)(char *buf, size_t n, void *priv),
769 void *priv, off_t *received);
770 NTSTATUS cli_read(struct cli_state *cli, uint16_t fnum,
771 char *buf, off_t offset, size_t size,
772 size_t *nread);
773 NTSTATUS cli_smbwrite(struct cli_state *cli, uint16_t fnum, char *buf,
774 off_t offset, size_t size1, size_t *ptotal);
775 struct tevent_req *cli_write_andx_create(TALLOC_CTX *mem_ctx,
776 struct tevent_context *ev,
777 struct cli_state *cli, uint16_t fnum,
778 uint16_t mode, const uint8_t *buf,
779 off_t offset, size_t size,
780 struct tevent_req **reqs_before,
781 int num_reqs_before,
782 struct tevent_req **psmbreq);
783 struct tevent_req *cli_write_andx_send(TALLOC_CTX *mem_ctx,
784 struct tevent_context *ev,
785 struct cli_state *cli, uint16_t fnum,
786 uint16_t mode, const uint8_t *buf,
787 off_t offset, size_t size);
788 NTSTATUS cli_write_andx_recv(struct tevent_req *req, size_t *pwritten);
790 NTSTATUS cli_writeall(struct cli_state *cli, uint16_t fnum, uint16_t mode,
791 const uint8_t *buf, off_t offset, size_t size,
792 size_t *pwritten);
794 struct tevent_req *cli_push_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
795 struct cli_state *cli,
796 uint16_t fnum, uint16_t mode,
797 off_t start_offset, size_t window_size,
798 size_t (*source)(uint8_t *buf, size_t n,
799 void *priv),
800 void *priv);
801 NTSTATUS cli_push_recv(struct tevent_req *req);
802 NTSTATUS cli_push(struct cli_state *cli, uint16_t fnum, uint16_t mode,
803 off_t start_offset, size_t window_size,
804 size_t (*source)(uint8_t *buf, size_t n, void *priv),
805 void *priv);
807 NTSTATUS cli_splice(struct cli_state *srccli, struct cli_state *dstcli,
808 uint16_t src_fnum, uint16_t dst_fnum,
809 off_t size,
810 off_t src_offset, off_t dst_offset,
811 off_t *written,
812 int (*splice_cb)(off_t n, void *priv), void *priv);
814 /* The following definitions come from libsmb/clisecdesc.c */
816 NTSTATUS cli_query_security_descriptor(struct cli_state *cli,
817 uint16_t fnum,
818 uint32_t sec_info,
819 TALLOC_CTX *mem_ctx,
820 struct security_descriptor **sd);
821 NTSTATUS cli_query_secdesc(struct cli_state *cli, uint16_t fnum,
822 TALLOC_CTX *mem_ctx, struct security_descriptor **sd);
823 NTSTATUS cli_set_security_descriptor(struct cli_state *cli,
824 uint16_t fnum,
825 uint32_t sec_info,
826 const struct security_descriptor *sd);
827 NTSTATUS cli_set_secdesc(struct cli_state *cli, uint16_t fnum,
828 const struct security_descriptor *sd);
830 /* The following definitions come from libsmb/clistr.c */
832 size_t clistr_pull_talloc(TALLOC_CTX *ctx,
833 const char *base,
834 uint16_t flags2,
835 char **pp_dest,
836 const void *src,
837 int src_len,
838 int flags);
840 /* The following definitions come from libsmb/clitrans.c */
842 struct tevent_req *cli_trans_send(
843 TALLOC_CTX *mem_ctx, struct tevent_context *ev,
844 struct cli_state *cli, uint8_t cmd,
845 const char *pipe_name, uint16_t fid, uint16_t function, int flags,
846 uint16_t *setup, uint8_t num_setup, uint8_t max_setup,
847 uint8_t *param, uint32_t num_param, uint32_t max_param,
848 uint8_t *data, uint32_t num_data, uint32_t max_data);
849 NTSTATUS cli_trans_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
850 uint16_t *recv_flags2,
851 uint16_t **setup, uint8_t min_setup,
852 uint8_t *num_setup,
853 uint8_t **param, uint32_t min_param,
854 uint32_t *num_param,
855 uint8_t **data, uint32_t min_data,
856 uint32_t *num_data);
857 NTSTATUS cli_trans(TALLOC_CTX *mem_ctx, struct cli_state *cli,
858 uint8_t trans_cmd,
859 const char *pipe_name, uint16_t fid, uint16_t function,
860 int flags,
861 uint16_t *setup, uint8_t num_setup, uint8_t max_setup,
862 uint8_t *param, uint32_t num_param, uint32_t max_param,
863 uint8_t *data, uint32_t num_data, uint32_t max_data,
864 uint16_t *recv_flags2,
865 uint16_t **rsetup, uint8_t min_rsetup, uint8_t *num_rsetup,
866 uint8_t **rparam, uint32_t min_rparam, uint32_t *num_rparam,
867 uint8_t **rdata, uint32_t min_rdata, uint32_t *num_rdata);
869 /* The following definitions come from libsmb/reparse_symlink.c */
871 bool symlink_reparse_buffer_marshall(
872 const char *substitute, const char *printname, uint32_t flags,
873 TALLOC_CTX *mem_ctx, uint8_t **pdst, size_t *pdstlen);
874 bool symlink_reparse_buffer_parse(
875 const uint8_t *src, size_t srclen, TALLOC_CTX *mem_ctx,
876 char **psubstitute_name, char **pprint_name, uint32_t *pflags);
878 /* The following definitions come from libsmb/clisymlink.c */
880 struct tevent_req *cli_symlink_send(TALLOC_CTX *mem_ctx,
881 struct tevent_context *ev,
882 struct cli_state *cli,
883 const char *oldpath,
884 const char *newpath,
885 uint32_t flags);
886 NTSTATUS cli_symlink_recv(struct tevent_req *req);
887 NTSTATUS cli_symlink(struct cli_state *cli, const char *oldname,
888 const char *newname, uint32_t flags);
890 struct tevent_req *cli_readlink_send(TALLOC_CTX *mem_ctx,
891 struct tevent_context *ev,
892 struct cli_state *cli,
893 const char *fname);
894 NTSTATUS cli_readlink_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
895 char **psubstitute_name, char **pprint_name,
896 uint32_t *pflags);
897 NTSTATUS cli_readlink(struct cli_state *cli, const char *fname,
898 TALLOC_CTX *mem_ctx, char **psubstitute_name,
899 char **pprint_name, uint32_t *pflags);
901 #endif /* _LIBSMB_PROTO_H_ */