backupkey: Handle more clearly the case where we find the secret, but it has no value
[Samba.git] / source3 / libsmb / proto.h
blobf392a35f4c3a6b1e138e7f01c1623fa35a7ae152
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 *max_xmit, uint16 *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 cli_setpid(struct cli_state *cli, uint16 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 *eclass, uint32 *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_getfacl_send(TALLOC_CTX *mem_ctx,
256 struct tevent_context *ev,
257 struct cli_state *cli,
258 const char *fname);
259 NTSTATUS cli_posix_getfacl_recv(struct tevent_req *req,
260 TALLOC_CTX *mem_ctx,
261 size_t *prb_size,
262 char **retbuf);
263 NTSTATUS cli_posix_getfacl(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, uint64_t *bsize, uint64_t *total, uint64_t *avail);
517 struct tevent_req *cli_ctemp_send(TALLOC_CTX *mem_ctx,
518 struct tevent_context *ev,
519 struct cli_state *cli,
520 const char *path);
521 NTSTATUS cli_ctemp_recv(struct tevent_req *req,
522 TALLOC_CTX *ctx,
523 uint16_t *pfnum,
524 char **outfile);
525 NTSTATUS cli_ctemp(struct cli_state *cli,
526 TALLOC_CTX *ctx,
527 const char *path,
528 uint16_t *pfnum,
529 char **out_path);
530 NTSTATUS cli_raw_ioctl(struct cli_state *cli, uint16_t fnum, uint32_t code, DATA_BLOB *blob);
531 NTSTATUS cli_set_ea_path(struct cli_state *cli, const char *path,
532 const char *ea_name, const char *ea_val,
533 size_t ea_len);
534 NTSTATUS cli_set_ea_fnum(struct cli_state *cli, uint16_t fnum,
535 const char *ea_name, const char *ea_val,
536 size_t ea_len);
537 struct tevent_req *cli_get_ea_list_path_send(TALLOC_CTX *mem_ctx,
538 struct tevent_context *ev,
539 struct cli_state *cli,
540 const char *fname);
541 NTSTATUS cli_get_ea_list_path_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
542 size_t *pnum_eas, struct ea_struct **peas);
543 NTSTATUS cli_get_ea_list_path(struct cli_state *cli, const char *path,
544 TALLOC_CTX *ctx,
545 size_t *pnum_eas,
546 struct ea_struct **pea_list);
547 struct tevent_req *cli_posix_open_send(TALLOC_CTX *mem_ctx,
548 struct tevent_context *ev,
549 struct cli_state *cli,
550 const char *fname,
551 int flags,
552 mode_t mode);
553 NTSTATUS cli_posix_open_recv(struct tevent_req *req, uint16_t *pfnum);
554 NTSTATUS cli_posix_open(struct cli_state *cli, const char *fname,
555 int flags, mode_t mode, uint16_t *fnum);
556 struct tevent_req *cli_posix_mkdir_send(TALLOC_CTX *mem_ctx,
557 struct tevent_context *ev,
558 struct cli_state *cli,
559 const char *fname,
560 mode_t mode);
561 NTSTATUS cli_posix_mkdir_recv(struct tevent_req *req);
562 NTSTATUS cli_posix_mkdir(struct cli_state *cli, const char *fname, mode_t mode);
564 struct tevent_req *cli_posix_unlink_send(TALLOC_CTX *mem_ctx,
565 struct tevent_context *ev,
566 struct cli_state *cli,
567 const char *fname);
568 NTSTATUS cli_posix_unlink_recv(struct tevent_req *req);
569 NTSTATUS cli_posix_unlink(struct cli_state *cli, const char *fname);
571 struct tevent_req *cli_posix_rmdir_send(TALLOC_CTX *mem_ctx,
572 struct tevent_context *ev,
573 struct cli_state *cli,
574 const char *fname);
575 NTSTATUS cli_posix_rmdir_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx);
576 NTSTATUS cli_posix_rmdir(struct cli_state *cli, const char *fname);
577 struct tevent_req *cli_notify_send(TALLOC_CTX *mem_ctx,
578 struct tevent_context *ev,
579 struct cli_state *cli, uint16_t fnum,
580 uint32_t buffer_size,
581 uint32_t completion_filter, bool recursive);
582 NTSTATUS cli_notify_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
583 uint32_t *pnum_changes,
584 struct notify_change **pchanges);
585 NTSTATUS cli_notify(struct cli_state *cli, uint16_t fnum, uint32_t buffer_size,
586 uint32_t completion_filter, bool recursive,
587 TALLOC_CTX *mem_ctx, uint32_t *pnum_changes,
588 struct notify_change **pchanges);
590 struct tevent_req *cli_nttrans_create_send(TALLOC_CTX *mem_ctx,
591 struct tevent_context *ev,
592 struct cli_state *cli,
593 const char *fname,
594 uint32_t CreatFlags,
595 uint32_t DesiredAccess,
596 uint32_t FileAttributes,
597 uint32_t ShareAccess,
598 uint32_t CreateDisposition,
599 uint32_t CreateOptions,
600 uint8_t SecurityFlags,
601 struct security_descriptor *secdesc,
602 struct ea_struct *eas,
603 int num_eas);
604 NTSTATUS cli_nttrans_create_recv(struct tevent_req *req,
605 uint16_t *fnum,
606 struct smb_create_returns *cr);
607 NTSTATUS cli_nttrans_create(struct cli_state *cli,
608 const char *fname,
609 uint32_t CreatFlags,
610 uint32_t DesiredAccess,
611 uint32_t FileAttributes,
612 uint32_t ShareAccess,
613 uint32_t CreateDisposition,
614 uint32_t CreateOptions,
615 uint8_t SecurityFlags,
616 struct security_descriptor *secdesc,
617 struct ea_struct *eas,
618 int num_eas,
619 uint16_t *pfid,
620 struct smb_create_returns *cr);
622 /* The following definitions come from libsmb/clifsinfo.c */
624 struct tevent_req *cli_unix_extensions_version_send(TALLOC_CTX *mem_ctx,
625 struct tevent_context *ev,
626 struct cli_state *cli);
627 NTSTATUS cli_unix_extensions_version_recv(struct tevent_req *req,
628 uint16_t *pmajor, uint16_t *pminor,
629 uint32_t *pcaplow,
630 uint32_t *pcaphigh);
631 NTSTATUS cli_unix_extensions_version(struct cli_state *cli, uint16 *pmajor,
632 uint16 *pminor, uint32 *pcaplow,
633 uint32 *pcaphigh);
634 struct tevent_req *cli_set_unix_extensions_capabilities_send(
635 TALLOC_CTX *mem_ctx, struct tevent_context *ev, struct cli_state *cli,
636 uint16_t major, uint16_t minor, uint32_t caplow, uint32_t caphigh);
637 NTSTATUS cli_set_unix_extensions_capabilities_recv(struct tevent_req *req);
638 NTSTATUS cli_set_unix_extensions_capabilities(struct cli_state *cli,
639 uint16 major, uint16 minor,
640 uint32 caplow, uint32 caphigh);
641 struct tevent_req *cli_get_fs_attr_info_send(TALLOC_CTX *mem_ctx,
642 struct tevent_context *ev,
643 struct cli_state *cli);
644 NTSTATUS cli_get_fs_attr_info_recv(struct tevent_req *req, uint32_t *fs_attr);
645 NTSTATUS cli_get_fs_attr_info(struct cli_state *cli, uint32_t *fs_attr);
646 NTSTATUS cli_get_fs_volume_info(struct cli_state *cli,
647 TALLOC_CTX *mem_ctx, char **volume_name,
648 uint32 *pserial_number, time_t *pdate);
649 NTSTATUS cli_get_fs_full_size_info(struct cli_state *cli,
650 uint64_t *total_allocation_units,
651 uint64_t *caller_allocation_units,
652 uint64_t *actual_allocation_units,
653 uint64_t *sectors_per_allocation_unit,
654 uint64_t *bytes_per_sector);
655 NTSTATUS cli_get_posix_fs_info(struct cli_state *cli,
656 uint32 *optimal_transfer_size,
657 uint32 *block_size,
658 uint64_t *total_blocks,
659 uint64_t *blocks_available,
660 uint64_t *user_blocks_available,
661 uint64_t *total_file_nodes,
662 uint64_t *free_file_nodes,
663 uint64_t *fs_identifier);
664 NTSTATUS cli_raw_ntlm_smb_encryption_start(struct cli_state *cli,
665 const char *user,
666 const char *pass,
667 const char *domain);
668 NTSTATUS cli_gss_smb_encryption_start(struct cli_state *cli);
669 NTSTATUS cli_force_encryption(struct cli_state *c,
670 const char *username,
671 const char *password,
672 const char *domain);
674 /* The following definitions come from libsmb/clilist.c */
676 NTSTATUS cli_list_old(struct cli_state *cli,const char *Mask,uint16 attribute,
677 NTSTATUS (*fn)(const char *, struct file_info *,
678 const char *, void *), void *state);
679 NTSTATUS cli_list_trans(struct cli_state *cli, const char *mask,
680 uint16_t attribute, int info_level,
681 NTSTATUS (*fn)(const char *mnt, struct file_info *finfo,
682 const char *mask, void *private_data),
683 void *private_data);
684 struct tevent_req *cli_list_send(TALLOC_CTX *mem_ctx,
685 struct tevent_context *ev,
686 struct cli_state *cli,
687 const char *mask,
688 uint16_t attribute,
689 uint16_t info_level);
690 NTSTATUS cli_list_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
691 struct file_info **finfo, size_t *num_finfo);
692 NTSTATUS cli_list(struct cli_state *cli,const char *Mask,uint16 attribute,
693 NTSTATUS (*fn)(const char *, struct file_info *, const char *,
694 void *), void *state);
696 /* The following definitions come from libsmb/climessage.c */
698 struct tevent_req *cli_message_send(TALLOC_CTX *mem_ctx,
699 struct tevent_context *ev,
700 struct cli_state *cli,
701 const char *host, const char *username,
702 const char *message);
703 NTSTATUS cli_message_recv(struct tevent_req *req);
704 NTSTATUS cli_message(struct cli_state *cli, const char *host,
705 const char *username, const char *message);
707 /* The following definitions come from libsmb/clioplock.c */
709 struct tevent_req *cli_smb_oplock_break_waiter_send(TALLOC_CTX *mem_ctx,
710 struct tevent_context *ev,
711 struct cli_state *cli);
712 NTSTATUS cli_smb_oplock_break_waiter_recv(struct tevent_req *req,
713 uint16_t *pfnum,
714 uint8_t *plevel);
716 struct tevent_req *cli_oplock_ack_send(TALLOC_CTX *mem_ctx,
717 struct tevent_context *ev,
718 struct cli_state *cli,
719 uint16_t fnum, uint8_t level);
720 NTSTATUS cli_oplock_ack_recv(struct tevent_req *req);
722 /* The following definitions come from libsmb/cliprint.c */
724 int cli_print_queue(struct cli_state *cli,
725 void (*fn)(struct print_job_info *));
726 int cli_printjob_del(struct cli_state *cli, int job);
728 /* The following definitions come from libsmb/cliquota.c */
730 NTSTATUS cli_get_quota_handle(struct cli_state *cli, uint16_t *quota_fnum);
731 void free_ntquota_list(SMB_NTQUOTA_LIST **qt_list);
732 NTSTATUS cli_get_user_quota(struct cli_state *cli, int quota_fnum,
733 SMB_NTQUOTA_STRUCT *pqt);
734 NTSTATUS cli_set_user_quota(struct cli_state *cli, int quota_fnum,
735 SMB_NTQUOTA_STRUCT *pqt);
736 NTSTATUS cli_list_user_quota(struct cli_state *cli, int quota_fnum,
737 SMB_NTQUOTA_LIST **pqt_list);
738 NTSTATUS cli_get_fs_quota_info(struct cli_state *cli, int quota_fnum,
739 SMB_NTQUOTA_STRUCT *pqt);
740 NTSTATUS cli_set_fs_quota_info(struct cli_state *cli, int quota_fnum,
741 SMB_NTQUOTA_STRUCT *pqt);
743 /* The following definitions come from libsmb/clireadwrite.c */
745 struct tevent_req *cli_read_andx_create(TALLOC_CTX *mem_ctx,
746 struct tevent_context *ev,
747 struct cli_state *cli, uint16_t fnum,
748 off_t offset, size_t size,
749 struct tevent_req **psmbreq);
750 struct tevent_req *cli_read_andx_send(TALLOC_CTX *mem_ctx,
751 struct tevent_context *ev,
752 struct cli_state *cli, uint16_t fnum,
753 off_t offset, size_t size);
754 NTSTATUS cli_read_andx_recv(struct tevent_req *req, ssize_t *received,
755 uint8_t **rcvbuf);
756 struct tevent_req *cli_pull_send(TALLOC_CTX *mem_ctx,
757 struct tevent_context *ev,
758 struct cli_state *cli,
759 uint16_t fnum, off_t start_offset,
760 off_t size, size_t window_size,
761 NTSTATUS (*sink)(char *buf, size_t n,
762 void *priv),
763 void *priv);
764 NTSTATUS cli_pull_recv(struct tevent_req *req, off_t *received);
765 NTSTATUS cli_pull(struct cli_state *cli, uint16_t fnum,
766 off_t start_offset, off_t size, size_t window_size,
767 NTSTATUS (*sink)(char *buf, size_t n, void *priv),
768 void *priv, off_t *received);
769 NTSTATUS cli_read(struct cli_state *cli, uint16_t fnum,
770 char *buf, off_t offset, size_t size,
771 size_t *nread);
772 NTSTATUS cli_smbwrite(struct cli_state *cli, uint16_t fnum, char *buf,
773 off_t offset, size_t size1, size_t *ptotal);
774 struct tevent_req *cli_write_andx_create(TALLOC_CTX *mem_ctx,
775 struct tevent_context *ev,
776 struct cli_state *cli, uint16_t fnum,
777 uint16_t mode, const uint8_t *buf,
778 off_t offset, size_t size,
779 struct tevent_req **reqs_before,
780 int num_reqs_before,
781 struct tevent_req **psmbreq);
782 struct tevent_req *cli_write_andx_send(TALLOC_CTX *mem_ctx,
783 struct tevent_context *ev,
784 struct cli_state *cli, uint16_t fnum,
785 uint16_t mode, const uint8_t *buf,
786 off_t offset, size_t size);
787 NTSTATUS cli_write_andx_recv(struct tevent_req *req, size_t *pwritten);
789 NTSTATUS cli_writeall(struct cli_state *cli, uint16_t fnum, uint16_t mode,
790 const uint8_t *buf, off_t offset, size_t size,
791 size_t *pwritten);
793 struct tevent_req *cli_push_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
794 struct cli_state *cli,
795 uint16_t fnum, uint16_t mode,
796 off_t start_offset, size_t window_size,
797 size_t (*source)(uint8_t *buf, size_t n,
798 void *priv),
799 void *priv);
800 NTSTATUS cli_push_recv(struct tevent_req *req);
801 NTSTATUS cli_push(struct cli_state *cli, uint16_t fnum, uint16_t mode,
802 off_t start_offset, size_t window_size,
803 size_t (*source)(uint8_t *buf, size_t n, void *priv),
804 void *priv);
806 /* The following definitions come from libsmb/clisecdesc.c */
808 NTSTATUS cli_query_security_descriptor(struct cli_state *cli,
809 uint16_t fnum,
810 uint32_t sec_info,
811 TALLOC_CTX *mem_ctx,
812 struct security_descriptor **sd);
813 NTSTATUS cli_query_secdesc(struct cli_state *cli, uint16_t fnum,
814 TALLOC_CTX *mem_ctx, struct security_descriptor **sd);
815 NTSTATUS cli_set_security_descriptor(struct cli_state *cli,
816 uint16_t fnum,
817 uint32_t sec_info,
818 const struct security_descriptor *sd);
819 NTSTATUS cli_set_secdesc(struct cli_state *cli, uint16_t fnum,
820 const struct security_descriptor *sd);
822 /* The following definitions come from libsmb/clistr.c */
824 size_t clistr_pull_talloc(TALLOC_CTX *ctx,
825 const char *base,
826 uint16_t flags2,
827 char **pp_dest,
828 const void *src,
829 int src_len,
830 int flags);
832 /* The following definitions come from libsmb/clitrans.c */
834 struct tevent_req *cli_trans_send(
835 TALLOC_CTX *mem_ctx, struct tevent_context *ev,
836 struct cli_state *cli, uint8_t cmd,
837 const char *pipe_name, uint16_t fid, uint16_t function, int flags,
838 uint16_t *setup, uint8_t num_setup, uint8_t max_setup,
839 uint8_t *param, uint32_t num_param, uint32_t max_param,
840 uint8_t *data, uint32_t num_data, uint32_t max_data);
841 NTSTATUS cli_trans_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
842 uint16_t *recv_flags2,
843 uint16_t **setup, uint8_t min_setup,
844 uint8_t *num_setup,
845 uint8_t **param, uint32_t min_param,
846 uint32_t *num_param,
847 uint8_t **data, uint32_t min_data,
848 uint32_t *num_data);
849 NTSTATUS cli_trans(TALLOC_CTX *mem_ctx, struct cli_state *cli,
850 uint8_t trans_cmd,
851 const char *pipe_name, uint16_t fid, uint16_t function,
852 int flags,
853 uint16_t *setup, uint8_t num_setup, uint8_t max_setup,
854 uint8_t *param, uint32_t num_param, uint32_t max_param,
855 uint8_t *data, uint32_t num_data, uint32_t max_data,
856 uint16_t *recv_flags2,
857 uint16_t **rsetup, uint8_t min_rsetup, uint8_t *num_rsetup,
858 uint8_t **rparam, uint32_t min_rparam, uint32_t *num_rparam,
859 uint8_t **rdata, uint32_t min_rdata, uint32_t *num_rdata);
861 /* The following definitions come from libsmb/reparse_symlink.c */
863 bool symlink_reparse_buffer_marshall(
864 const char *substitute, const char *printname, uint32_t flags,
865 TALLOC_CTX *mem_ctx, uint8_t **pdst, size_t *pdstlen);
866 bool symlink_reparse_buffer_parse(
867 const uint8_t *src, size_t srclen, TALLOC_CTX *mem_ctx,
868 char **psubstitute_name, char **pprint_name, uint32_t *pflags);
870 /* The following definitions come from libsmb/clisymlink.c */
872 struct tevent_req *cli_symlink_send(TALLOC_CTX *mem_ctx,
873 struct tevent_context *ev,
874 struct cli_state *cli,
875 const char *oldpath,
876 const char *newpath,
877 uint32_t flags);
878 NTSTATUS cli_symlink_recv(struct tevent_req *req);
879 NTSTATUS cli_symlink(struct cli_state *cli, const char *oldname,
880 const char *newname, uint32_t flags);
882 struct tevent_req *cli_readlink_send(TALLOC_CTX *mem_ctx,
883 struct tevent_context *ev,
884 struct cli_state *cli,
885 const char *fname);
886 NTSTATUS cli_readlink_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
887 char **psubstitute_name, char **pprint_name,
888 uint32_t *pflags);
889 NTSTATUS cli_readlink(struct cli_state *cli, const char *fname,
890 TALLOC_CTX *mem_ctx, char **psubstitute_name,
891 char **pprint_name, uint32_t *pflags);
893 #endif /* _LIBSMB_PROTO_H_ */