s3:libsmb: add cli_session_setup_anon()
[Samba.git] / source3 / libsmb / proto.h
blob93fbc4baee2b1c8910f169063ab815daa1b88f31
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;
33 struct cli_credentials;
35 /* The following definitions come from libsmb/cliconnect.c */
37 struct tevent_req *cli_session_setup_creds_send(TALLOC_CTX *mem_ctx,
38 struct tevent_context *ev,
39 struct cli_state *cli,
40 struct cli_credentials *creds);
41 NTSTATUS cli_session_setup_creds_recv(struct tevent_req *req);
42 NTSTATUS cli_session_setup_creds(struct cli_state *cli,
43 struct cli_credentials *creds);
44 NTSTATUS cli_session_setup_anon(struct cli_state *cli);
45 NTSTATUS cli_session_setup(struct cli_state *cli,
46 const char *user,
47 const char *pass,
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 uint32_t cli_setpid(struct cli_state *cli, uint32_t pid);
176 uint32_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_setacl_send(TALLOC_CTX *mem_ctx,
269 struct tevent_context *ev,
270 struct cli_state *cli,
271 const char *fname,
272 const void *acl_buf,
273 size_t acl_buf_size);
274 NTSTATUS cli_posix_setacl_recv(struct tevent_req *req);
275 NTSTATUS cli_posix_setacl(struct cli_state *cli,
276 const char *fname,
277 const void *acl_buf,
278 size_t acl_buf_size);
279 struct tevent_req *cli_posix_stat_send(TALLOC_CTX *mem_ctx,
280 struct tevent_context *ev,
281 struct cli_state *cli,
282 const char *fname);
283 NTSTATUS cli_posix_stat_recv(struct tevent_req *req,
284 SMB_STRUCT_STAT *sbuf);
285 NTSTATUS cli_posix_stat(struct cli_state *cli,
286 const char *fname,
287 SMB_STRUCT_STAT *sbuf);
288 struct tevent_req *cli_posix_chmod_send(TALLOC_CTX *mem_ctx,
289 struct tevent_context *ev,
290 struct cli_state *cli,
291 const char *fname,
292 mode_t mode);
293 NTSTATUS cli_posix_chmod_recv(struct tevent_req *req);
294 NTSTATUS cli_posix_chmod(struct cli_state *cli, const char *fname, mode_t mode);
295 struct tevent_req *cli_posix_chown_send(TALLOC_CTX *mem_ctx,
296 struct tevent_context *ev,
297 struct cli_state *cli,
298 const char *fname,
299 uid_t uid,
300 gid_t gid);
301 NTSTATUS cli_posix_chown_recv(struct tevent_req *req);
302 NTSTATUS cli_posix_chown(struct cli_state *cli,
303 const char *fname,
304 uid_t uid,
305 gid_t gid);
306 struct tevent_req *cli_rename_send(TALLOC_CTX *mem_ctx,
307 struct tevent_context *ev,
308 struct cli_state *cli,
309 const char *fname_src,
310 const char *fname_dst);
311 NTSTATUS cli_rename_recv(struct tevent_req *req);
312 NTSTATUS cli_rename(struct cli_state *cli, const char *fname_src, const char *fname_dst);
313 struct tevent_req *cli_ntrename_send(TALLOC_CTX *mem_ctx,
314 struct tevent_context *ev,
315 struct cli_state *cli,
316 const char *fname_src,
317 const char *fname_dst);
318 NTSTATUS cli_ntrename_recv(struct tevent_req *req);
319 NTSTATUS cli_ntrename(struct cli_state *cli, const char *fname_src, const char *fname_dst);
321 struct tevent_req *cli_nt_hardlink_send(TALLOC_CTX *mem_ctx,
322 struct tevent_context *ev,
323 struct cli_state *cli,
324 const char *fname_src,
325 const char *fname_dst);
326 NTSTATUS cli_nt_hardlink_recv(struct tevent_req *req);
327 NTSTATUS cli_nt_hardlink(struct cli_state *cli, const char *fname_src, const char *fname_dst);
329 struct tevent_req *cli_unlink_send(TALLOC_CTX *mem_ctx,
330 struct tevent_context *ev,
331 struct cli_state *cli,
332 const char *fname,
333 uint16_t mayhave_attrs);
334 NTSTATUS cli_unlink_recv(struct tevent_req *req);
335 NTSTATUS cli_unlink(struct cli_state *cli, const char *fname, uint16_t mayhave_attrs);
337 struct tevent_req *cli_mkdir_send(TALLOC_CTX *mem_ctx,
338 struct tevent_context *ev,
339 struct cli_state *cli,
340 const char *dname);
341 NTSTATUS cli_mkdir_recv(struct tevent_req *req);
342 NTSTATUS cli_mkdir(struct cli_state *cli, const char *dname);
343 struct tevent_req *cli_rmdir_send(TALLOC_CTX *mem_ctx,
344 struct tevent_context *ev,
345 struct cli_state *cli,
346 const char *dname);
347 NTSTATUS cli_rmdir_recv(struct tevent_req *req);
348 NTSTATUS cli_rmdir(struct cli_state *cli, const char *dname);
349 struct tevent_req *cli_nt_delete_on_close_send(TALLOC_CTX *mem_ctx,
350 struct tevent_context *ev,
351 struct cli_state *cli,
352 uint16_t fnum,
353 bool flag);
354 NTSTATUS cli_nt_delete_on_close_recv(struct tevent_req *req);
355 NTSTATUS cli_nt_delete_on_close(struct cli_state *cli, uint16_t fnum, bool flag);
356 struct tevent_req *cli_ntcreate_send(TALLOC_CTX *mem_ctx,
357 struct tevent_context *ev,
358 struct cli_state *cli,
359 const char *fname,
360 uint32_t CreatFlags,
361 uint32_t DesiredAccess,
362 uint32_t FileAttributes,
363 uint32_t ShareAccess,
364 uint32_t CreateDisposition,
365 uint32_t CreateOptions,
366 uint8_t SecurityFlags);
367 NTSTATUS cli_ntcreate_recv(struct tevent_req *req,
368 uint16_t *pfnum,
369 struct smb_create_returns *cr);
370 NTSTATUS cli_ntcreate(struct cli_state *cli,
371 const char *fname,
372 uint32_t CreatFlags,
373 uint32_t DesiredAccess,
374 uint32_t FileAttributes,
375 uint32_t ShareAccess,
376 uint32_t CreateDisposition,
377 uint32_t CreateOptions,
378 uint8_t SecurityFlags,
379 uint16_t *pfid,
380 struct smb_create_returns *cr);
381 struct tevent_req *cli_openx_create(TALLOC_CTX *mem_ctx,
382 struct tevent_context *ev,
383 struct cli_state *cli, const char *fname,
384 int flags, int share_mode,
385 struct tevent_req **psmbreq);
386 struct tevent_req *cli_openx_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
387 struct cli_state *cli, const char *fname,
388 int flags, int share_mode);
389 NTSTATUS cli_openx_recv(struct tevent_req *req, uint16_t *fnum);
390 NTSTATUS cli_openx(struct cli_state *cli, const char *fname, int flags, int share_mode, uint16_t *pfnum);
391 NTSTATUS cli_open(struct cli_state *cli, const char *fname, int flags, int share_mode, uint16_t *pfnum);
392 struct tevent_req *cli_close_create(TALLOC_CTX *mem_ctx,
393 struct tevent_context *ev,
394 struct cli_state *cli, uint16_t fnum,
395 struct tevent_req **psubreq);
396 struct tevent_req *cli_close_send(TALLOC_CTX *mem_ctx,
397 struct tevent_context *ev,
398 struct cli_state *cli, uint16_t fnum);
399 NTSTATUS cli_close_recv(struct tevent_req *req);
400 NTSTATUS cli_close(struct cli_state *cli, uint16_t fnum);
401 struct tevent_req *cli_ftruncate_send(TALLOC_CTX *mem_ctx,
402 struct tevent_context *ev,
403 struct cli_state *cli,
404 uint16_t fnum,
405 uint64_t size);
406 NTSTATUS cli_ftruncate_recv(struct tevent_req *req);
407 NTSTATUS cli_ftruncate(struct cli_state *cli, uint16_t fnum, uint64_t size);
408 NTSTATUS cli_locktype(struct cli_state *cli, uint16_t fnum,
409 uint32_t offset, uint32_t len,
410 int timeout, unsigned char locktype);
411 NTSTATUS cli_lock32(struct cli_state *cli, uint16_t fnum, uint32_t offset,
412 uint32_t len, int timeout, enum brl_type lock_type);
413 struct tevent_req *cli_unlock_send(TALLOC_CTX *mem_ctx,
414 struct tevent_context *ev,
415 struct cli_state *cli,
416 uint16_t fnum,
417 uint64_t offset,
418 uint64_t len);
419 NTSTATUS cli_unlock_recv(struct tevent_req *req);
420 NTSTATUS cli_unlock(struct cli_state *cli, uint16_t fnum, uint32_t offset, uint32_t len);
421 NTSTATUS cli_lock64(struct cli_state *cli, uint16_t fnum,
422 uint64_t offset, uint64_t len, int timeout,
423 enum brl_type lock_type);
424 struct tevent_req *cli_unlock64_send(TALLOC_CTX *mem_ctx,
425 struct tevent_context *ev,
426 struct cli_state *cli,
427 uint16_t fnum,
428 uint64_t offset,
429 uint64_t len);
430 NTSTATUS cli_unlock64_recv(struct tevent_req *req);
431 NTSTATUS cli_unlock64(struct cli_state *cli, uint16_t fnum, uint64_t offset, uint64_t len);
432 struct tevent_req *cli_posix_lock_send(TALLOC_CTX *mem_ctx,
433 struct tevent_context *ev,
434 struct cli_state *cli,
435 uint16_t fnum,
436 uint64_t offset,
437 uint64_t len,
438 bool wait_lock,
439 enum brl_type lock_type);
440 NTSTATUS cli_posix_lock_recv(struct tevent_req *req);
441 NTSTATUS cli_posix_lock(struct cli_state *cli, uint16_t fnum,
442 uint64_t offset, uint64_t len,
443 bool wait_lock, enum brl_type lock_type);
444 struct tevent_req *cli_posix_unlock_send(TALLOC_CTX *mem_ctx,
445 struct tevent_context *ev,
446 struct cli_state *cli,
447 uint16_t fnum,
448 uint64_t offset,
449 uint64_t len);
450 NTSTATUS cli_posix_unlock_recv(struct tevent_req *req);
451 NTSTATUS cli_posix_unlock(struct cli_state *cli, uint16_t fnum, uint64_t offset, uint64_t len);
452 struct tevent_req *cli_getattrE_send(TALLOC_CTX *mem_ctx,
453 struct tevent_context *ev,
454 struct cli_state *cli,
455 uint16_t fnum);
456 NTSTATUS cli_getattrE_recv(struct tevent_req *req,
457 uint16_t *attr,
458 off_t *size,
459 time_t *change_time,
460 time_t *access_time,
461 time_t *write_time);
462 NTSTATUS cli_getattrE(struct cli_state *cli,
463 uint16_t fnum,
464 uint16_t *attr,
465 off_t *size,
466 time_t *change_time,
467 time_t *access_time,
468 time_t *write_time);
469 struct tevent_req *cli_setattrE_send(TALLOC_CTX *mem_ctx,
470 struct tevent_context *ev,
471 struct cli_state *cli,
472 uint16_t fnum,
473 time_t change_time,
474 time_t access_time,
475 time_t write_time);
476 NTSTATUS cli_setattrE_recv(struct tevent_req *req);
477 NTSTATUS cli_setattrE(struct cli_state *cli,
478 uint16_t fnum,
479 time_t change_time,
480 time_t access_time,
481 time_t write_time);
482 struct tevent_req *cli_getatr_send(TALLOC_CTX *mem_ctx,
483 struct tevent_context *ev,
484 struct cli_state *cli,
485 const char *fname);
486 NTSTATUS cli_getatr_recv(struct tevent_req *req,
487 uint16_t *attr,
488 off_t *size,
489 time_t *write_time);
490 NTSTATUS cli_getatr(struct cli_state *cli,
491 const char *fname,
492 uint16_t *attr,
493 off_t *size,
494 time_t *write_time);
495 struct tevent_req *cli_setatr_send(TALLOC_CTX *mem_ctx,
496 struct tevent_context *ev,
497 struct cli_state *cli,
498 const char *fname,
499 uint16_t attr,
500 time_t mtime);
501 NTSTATUS cli_setatr_recv(struct tevent_req *req);
502 NTSTATUS cli_setatr(struct cli_state *cli,
503 const char *fname,
504 uint16_t attr,
505 time_t mtime);
506 struct tevent_req *cli_chkpath_send(TALLOC_CTX *mem_ctx,
507 struct tevent_context *ev,
508 struct cli_state *cli,
509 const char *fname);
510 NTSTATUS cli_chkpath_recv(struct tevent_req *req);
511 NTSTATUS cli_chkpath(struct cli_state *cli, const char *path);
512 struct tevent_req *cli_dskattr_send(TALLOC_CTX *mem_ctx,
513 struct tevent_context *ev,
514 struct cli_state *cli);
515 NTSTATUS cli_dskattr_recv(struct tevent_req *req, int *bsize, int *total,
516 int *avail);
517 NTSTATUS cli_dskattr(struct cli_state *cli, int *bsize, int *total, int *avail);
518 NTSTATUS cli_disk_size(struct cli_state *cli, const char *path, uint64_t *bsize,
519 uint64_t *total, uint64_t *avail);
520 struct tevent_req *cli_ctemp_send(TALLOC_CTX *mem_ctx,
521 struct tevent_context *ev,
522 struct cli_state *cli,
523 const char *path);
524 NTSTATUS cli_ctemp_recv(struct tevent_req *req,
525 TALLOC_CTX *ctx,
526 uint16_t *pfnum,
527 char **outfile);
528 NTSTATUS cli_ctemp(struct cli_state *cli,
529 TALLOC_CTX *ctx,
530 const char *path,
531 uint16_t *pfnum,
532 char **out_path);
533 NTSTATUS cli_raw_ioctl(struct cli_state *cli, uint16_t fnum, uint32_t code, DATA_BLOB *blob);
534 NTSTATUS cli_set_ea_path(struct cli_state *cli, const char *path,
535 const char *ea_name, const char *ea_val,
536 size_t ea_len);
537 NTSTATUS cli_set_ea_fnum(struct cli_state *cli, uint16_t fnum,
538 const char *ea_name, const char *ea_val,
539 size_t ea_len);
540 struct tevent_req *cli_get_ea_list_path_send(TALLOC_CTX *mem_ctx,
541 struct tevent_context *ev,
542 struct cli_state *cli,
543 const char *fname);
544 NTSTATUS cli_get_ea_list_path_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
545 size_t *pnum_eas, struct ea_struct **peas);
546 NTSTATUS cli_get_ea_list_path(struct cli_state *cli, const char *path,
547 TALLOC_CTX *ctx,
548 size_t *pnum_eas,
549 struct ea_struct **pea_list);
550 struct tevent_req *cli_posix_open_send(TALLOC_CTX *mem_ctx,
551 struct tevent_context *ev,
552 struct cli_state *cli,
553 const char *fname,
554 int flags,
555 mode_t mode);
556 NTSTATUS cli_posix_open_recv(struct tevent_req *req, uint16_t *pfnum);
557 NTSTATUS cli_posix_open(struct cli_state *cli, const char *fname,
558 int flags, mode_t mode, uint16_t *fnum);
559 struct tevent_req *cli_posix_mkdir_send(TALLOC_CTX *mem_ctx,
560 struct tevent_context *ev,
561 struct cli_state *cli,
562 const char *fname,
563 mode_t mode);
564 NTSTATUS cli_posix_mkdir_recv(struct tevent_req *req);
565 NTSTATUS cli_posix_mkdir(struct cli_state *cli, const char *fname, mode_t mode);
567 struct tevent_req *cli_posix_unlink_send(TALLOC_CTX *mem_ctx,
568 struct tevent_context *ev,
569 struct cli_state *cli,
570 const char *fname);
571 NTSTATUS cli_posix_unlink_recv(struct tevent_req *req);
572 NTSTATUS cli_posix_unlink(struct cli_state *cli, const char *fname);
574 struct tevent_req *cli_posix_rmdir_send(TALLOC_CTX *mem_ctx,
575 struct tevent_context *ev,
576 struct cli_state *cli,
577 const char *fname);
578 NTSTATUS cli_posix_rmdir_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx);
579 NTSTATUS cli_posix_rmdir(struct cli_state *cli, const char *fname);
580 struct tevent_req *cli_notify_send(TALLOC_CTX *mem_ctx,
581 struct tevent_context *ev,
582 struct cli_state *cli, uint16_t fnum,
583 uint32_t buffer_size,
584 uint32_t completion_filter, bool recursive);
585 NTSTATUS cli_notify_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
586 uint32_t *pnum_changes,
587 struct notify_change **pchanges);
588 NTSTATUS cli_notify(struct cli_state *cli, uint16_t fnum, uint32_t buffer_size,
589 uint32_t completion_filter, bool recursive,
590 TALLOC_CTX *mem_ctx, uint32_t *pnum_changes,
591 struct notify_change **pchanges);
593 struct tevent_req *cli_nttrans_create_send(TALLOC_CTX *mem_ctx,
594 struct tevent_context *ev,
595 struct cli_state *cli,
596 const char *fname,
597 uint32_t CreatFlags,
598 uint32_t DesiredAccess,
599 uint32_t FileAttributes,
600 uint32_t ShareAccess,
601 uint32_t CreateDisposition,
602 uint32_t CreateOptions,
603 uint8_t SecurityFlags,
604 struct security_descriptor *secdesc,
605 struct ea_struct *eas,
606 int num_eas);
607 NTSTATUS cli_nttrans_create_recv(struct tevent_req *req,
608 uint16_t *fnum,
609 struct smb_create_returns *cr);
610 NTSTATUS cli_nttrans_create(struct cli_state *cli,
611 const char *fname,
612 uint32_t CreatFlags,
613 uint32_t DesiredAccess,
614 uint32_t FileAttributes,
615 uint32_t ShareAccess,
616 uint32_t CreateDisposition,
617 uint32_t CreateOptions,
618 uint8_t SecurityFlags,
619 struct security_descriptor *secdesc,
620 struct ea_struct *eas,
621 int num_eas,
622 uint16_t *pfid,
623 struct smb_create_returns *cr);
625 /* The following definitions come from libsmb/clifsinfo.c */
627 struct tevent_req *cli_unix_extensions_version_send(TALLOC_CTX *mem_ctx,
628 struct tevent_context *ev,
629 struct cli_state *cli);
630 NTSTATUS cli_unix_extensions_version_recv(struct tevent_req *req,
631 uint16_t *pmajor, uint16_t *pminor,
632 uint32_t *pcaplow,
633 uint32_t *pcaphigh);
634 NTSTATUS cli_unix_extensions_version(struct cli_state *cli, uint16_t *pmajor,
635 uint16_t *pminor, uint32_t *pcaplow,
636 uint32_t *pcaphigh);
637 struct tevent_req *cli_set_unix_extensions_capabilities_send(
638 TALLOC_CTX *mem_ctx, struct tevent_context *ev, struct cli_state *cli,
639 uint16_t major, uint16_t minor, uint32_t caplow, uint32_t caphigh);
640 NTSTATUS cli_set_unix_extensions_capabilities_recv(struct tevent_req *req);
641 NTSTATUS cli_set_unix_extensions_capabilities(struct cli_state *cli,
642 uint16_t major, uint16_t minor,
643 uint32_t caplow, uint32_t caphigh);
644 struct tevent_req *cli_get_fs_attr_info_send(TALLOC_CTX *mem_ctx,
645 struct tevent_context *ev,
646 struct cli_state *cli);
647 NTSTATUS cli_get_fs_attr_info_recv(struct tevent_req *req, uint32_t *fs_attr);
648 NTSTATUS cli_get_fs_attr_info(struct cli_state *cli, uint32_t *fs_attr);
649 NTSTATUS cli_get_fs_volume_info(struct cli_state *cli,
650 TALLOC_CTX *mem_ctx, char **volume_name,
651 uint32_t *pserial_number, time_t *pdate);
652 NTSTATUS cli_get_fs_full_size_info(struct cli_state *cli,
653 uint64_t *total_allocation_units,
654 uint64_t *caller_allocation_units,
655 uint64_t *actual_allocation_units,
656 uint64_t *sectors_per_allocation_unit,
657 uint64_t *bytes_per_sector);
658 NTSTATUS cli_get_posix_fs_info(struct cli_state *cli,
659 uint32_t *optimal_transfer_size,
660 uint32_t *block_size,
661 uint64_t *total_blocks,
662 uint64_t *blocks_available,
663 uint64_t *user_blocks_available,
664 uint64_t *total_file_nodes,
665 uint64_t *free_file_nodes,
666 uint64_t *fs_identifier);
667 NTSTATUS cli_raw_ntlm_smb_encryption_start(struct cli_state *cli,
668 const char *user,
669 const char *pass,
670 const char *domain);
671 NTSTATUS cli_gss_smb_encryption_start(struct cli_state *cli);
672 NTSTATUS cli_force_encryption(struct cli_state *c,
673 const char *username,
674 const char *password,
675 const char *domain);
676 struct tevent_req *cli_posix_whoami_send(TALLOC_CTX *mem_ctx,
677 struct tevent_context *ev,
678 struct cli_state *cli);
679 NTSTATUS cli_posix_whoami_recv(struct tevent_req *req,
680 TALLOC_CTX *mem_ctx,
681 uint64_t *puid,
682 uint64_t *pgid,
683 uint32_t *pnum_gids,
684 uint64_t **pgids,
685 uint32_t *pnum_sids,
686 struct dom_sid **psids,
687 bool *pguest);
688 NTSTATUS cli_posix_whoami(struct cli_state *cli,
689 TALLOC_CTX *mem_ctx,
690 uint64_t *puid,
691 uint64_t *pgid,
692 uint32_t *num_gids,
693 uint64_t **gids,
694 uint32_t *num_sids,
695 struct dom_sid **sids,
696 bool *pguest);
698 /* The following definitions come from libsmb/clilist.c */
700 NTSTATUS cli_list_old(struct cli_state *cli,const char *Mask,uint16_t attribute,
701 NTSTATUS (*fn)(const char *, struct file_info *,
702 const char *, void *), void *state);
703 NTSTATUS cli_list_trans(struct cli_state *cli, const char *mask,
704 uint16_t attribute, int info_level,
705 NTSTATUS (*fn)(const char *mnt, struct file_info *finfo,
706 const char *mask, void *private_data),
707 void *private_data);
708 struct tevent_req *cli_list_send(TALLOC_CTX *mem_ctx,
709 struct tevent_context *ev,
710 struct cli_state *cli,
711 const char *mask,
712 uint16_t attribute,
713 uint16_t info_level);
714 NTSTATUS cli_list_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
715 struct file_info **finfo, size_t *num_finfo);
716 NTSTATUS cli_list(struct cli_state *cli,const char *Mask,uint16_t attribute,
717 NTSTATUS (*fn)(const char *, struct file_info *, const char *,
718 void *), void *state);
720 /* The following definitions come from libsmb/climessage.c */
722 struct tevent_req *cli_message_send(TALLOC_CTX *mem_ctx,
723 struct tevent_context *ev,
724 struct cli_state *cli,
725 const char *host, const char *username,
726 const char *message);
727 NTSTATUS cli_message_recv(struct tevent_req *req);
728 NTSTATUS cli_message(struct cli_state *cli, const char *host,
729 const char *username, const char *message);
731 /* The following definitions come from libsmb/clioplock.c */
733 struct tevent_req *cli_smb_oplock_break_waiter_send(TALLOC_CTX *mem_ctx,
734 struct tevent_context *ev,
735 struct cli_state *cli);
736 NTSTATUS cli_smb_oplock_break_waiter_recv(struct tevent_req *req,
737 uint16_t *pfnum,
738 uint8_t *plevel);
740 struct tevent_req *cli_oplock_ack_send(TALLOC_CTX *mem_ctx,
741 struct tevent_context *ev,
742 struct cli_state *cli,
743 uint16_t fnum, uint8_t level);
744 NTSTATUS cli_oplock_ack_recv(struct tevent_req *req);
746 /* The following definitions come from libsmb/cliprint.c */
748 int cli_print_queue(struct cli_state *cli,
749 void (*fn)(struct print_job_info *));
750 int cli_printjob_del(struct cli_state *cli, int job);
752 /* The following definitions come from libsmb/cliquota.c */
754 NTSTATUS cli_get_quota_handle(struct cli_state *cli, uint16_t *quota_fnum);
755 void free_ntquota_list(SMB_NTQUOTA_LIST **qt_list);
756 bool parse_user_quota_record(const uint8_t *rdata,
757 unsigned int rdata_count,
758 unsigned int *offset,
759 SMB_NTQUOTA_STRUCT *pqt);
760 bool add_record_to_ntquota_list(TALLOC_CTX *mem_ctx,
761 SMB_NTQUOTA_STRUCT *pqt,
762 SMB_NTQUOTA_LIST **pqt_list);
763 NTSTATUS parse_user_quota_list(const uint8_t *curdata,
764 uint32_t curdata_size,
765 TALLOC_CTX *mem_ctx,
766 SMB_NTQUOTA_LIST **pqt_list);
767 NTSTATUS parse_fs_quota_buffer(const uint8_t *rdata,
768 unsigned int rdata_count,
769 SMB_NTQUOTA_STRUCT *pqt);
770 NTSTATUS build_user_quota_buffer(SMB_NTQUOTA_LIST *qt_list,
771 uint32_t maxlen,
772 TALLOC_CTX *mem_ctx,
773 DATA_BLOB *outbuf,
774 SMB_NTQUOTA_LIST **end_ptr);
775 NTSTATUS build_fs_quota_buffer(TALLOC_CTX *mem_ctx,
776 const SMB_NTQUOTA_STRUCT *pqt,
777 DATA_BLOB *blob,
778 uint32_t maxlen);
779 NTSTATUS cli_get_user_quota(struct cli_state *cli, int quota_fnum,
780 SMB_NTQUOTA_STRUCT *pqt);
781 NTSTATUS cli_set_user_quota(struct cli_state *cli,
782 int quota_fnum,
783 SMB_NTQUOTA_LIST *qtl);
784 NTSTATUS cli_list_user_quota(struct cli_state *cli, int quota_fnum,
785 SMB_NTQUOTA_LIST **pqt_list);
786 NTSTATUS cli_get_fs_quota_info(struct cli_state *cli, int quota_fnum,
787 SMB_NTQUOTA_STRUCT *pqt);
788 NTSTATUS cli_set_fs_quota_info(struct cli_state *cli, int quota_fnum,
789 SMB_NTQUOTA_STRUCT *pqt);
791 /* The following definitions come from libsmb/clireadwrite.c */
793 struct tevent_req *cli_read_andx_create(TALLOC_CTX *mem_ctx,
794 struct tevent_context *ev,
795 struct cli_state *cli, uint16_t fnum,
796 off_t offset, size_t size,
797 struct tevent_req **psmbreq);
798 struct tevent_req *cli_read_andx_send(TALLOC_CTX *mem_ctx,
799 struct tevent_context *ev,
800 struct cli_state *cli, uint16_t fnum,
801 off_t offset, size_t size);
802 NTSTATUS cli_read_andx_recv(struct tevent_req *req, ssize_t *received,
803 uint8_t **rcvbuf);
804 struct tevent_req *cli_pull_send(TALLOC_CTX *mem_ctx,
805 struct tevent_context *ev,
806 struct cli_state *cli,
807 uint16_t fnum, off_t start_offset,
808 off_t size, size_t window_size,
809 NTSTATUS (*sink)(char *buf, size_t n,
810 void *priv),
811 void *priv);
812 NTSTATUS cli_pull_recv(struct tevent_req *req, off_t *received);
813 NTSTATUS cli_pull(struct cli_state *cli, uint16_t fnum,
814 off_t start_offset, off_t size, size_t window_size,
815 NTSTATUS (*sink)(char *buf, size_t n, void *priv),
816 void *priv, off_t *received);
817 NTSTATUS cli_read(struct cli_state *cli, uint16_t fnum,
818 char *buf, off_t offset, size_t size,
819 size_t *nread);
820 NTSTATUS cli_smbwrite(struct cli_state *cli, uint16_t fnum, char *buf,
821 off_t offset, size_t size1, size_t *ptotal);
822 struct tevent_req *cli_write_andx_create(TALLOC_CTX *mem_ctx,
823 struct tevent_context *ev,
824 struct cli_state *cli, uint16_t fnum,
825 uint16_t mode, const uint8_t *buf,
826 off_t offset, size_t size,
827 struct tevent_req **reqs_before,
828 int num_reqs_before,
829 struct tevent_req **psmbreq);
830 struct tevent_req *cli_write_andx_send(TALLOC_CTX *mem_ctx,
831 struct tevent_context *ev,
832 struct cli_state *cli, uint16_t fnum,
833 uint16_t mode, const uint8_t *buf,
834 off_t offset, size_t size);
835 NTSTATUS cli_write_andx_recv(struct tevent_req *req, size_t *pwritten);
837 NTSTATUS cli_writeall(struct cli_state *cli, uint16_t fnum, uint16_t mode,
838 const uint8_t *buf, off_t offset, size_t size,
839 size_t *pwritten);
841 struct tevent_req *cli_push_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
842 struct cli_state *cli,
843 uint16_t fnum, uint16_t mode,
844 off_t start_offset, size_t window_size,
845 size_t (*source)(uint8_t *buf, size_t n,
846 void *priv),
847 void *priv);
848 NTSTATUS cli_push_recv(struct tevent_req *req);
849 NTSTATUS cli_push(struct cli_state *cli, uint16_t fnum, uint16_t mode,
850 off_t start_offset, size_t window_size,
851 size_t (*source)(uint8_t *buf, size_t n, void *priv),
852 void *priv);
854 NTSTATUS cli_splice(struct cli_state *srccli, struct cli_state *dstcli,
855 uint16_t src_fnum, uint16_t dst_fnum,
856 off_t size,
857 off_t src_offset, off_t dst_offset,
858 off_t *written,
859 int (*splice_cb)(off_t n, void *priv), void *priv);
861 /* The following definitions come from libsmb/clisecdesc.c */
863 NTSTATUS cli_query_security_descriptor(struct cli_state *cli,
864 uint16_t fnum,
865 uint32_t sec_info,
866 TALLOC_CTX *mem_ctx,
867 struct security_descriptor **sd);
868 NTSTATUS cli_query_secdesc(struct cli_state *cli, uint16_t fnum,
869 TALLOC_CTX *mem_ctx, struct security_descriptor **sd);
870 NTSTATUS cli_set_security_descriptor(struct cli_state *cli,
871 uint16_t fnum,
872 uint32_t sec_info,
873 const struct security_descriptor *sd);
874 NTSTATUS cli_set_secdesc(struct cli_state *cli, uint16_t fnum,
875 const struct security_descriptor *sd);
877 /* The following definitions come from libsmb/clistr.c */
879 size_t clistr_pull_talloc(TALLOC_CTX *ctx,
880 const char *base,
881 uint16_t flags2,
882 char **pp_dest,
883 const void *src,
884 int src_len,
885 int flags);
886 bool clistr_is_previous_version_path(const char *path,
887 const char **startp,
888 const char **endp,
889 time_t *ptime);
891 /* The following definitions come from libsmb/clitrans.c */
893 struct tevent_req *cli_trans_send(
894 TALLOC_CTX *mem_ctx, struct tevent_context *ev,
895 struct cli_state *cli, uint16_t additional_flags2, uint8_t cmd,
896 const char *pipe_name, uint16_t fid, uint16_t function, int flags,
897 uint16_t *setup, uint8_t num_setup, uint8_t max_setup,
898 uint8_t *param, uint32_t num_param, uint32_t max_param,
899 uint8_t *data, uint32_t num_data, uint32_t max_data);
900 NTSTATUS cli_trans_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
901 uint16_t *recv_flags2,
902 uint16_t **setup, uint8_t min_setup,
903 uint8_t *num_setup,
904 uint8_t **param, uint32_t min_param,
905 uint32_t *num_param,
906 uint8_t **data, uint32_t min_data,
907 uint32_t *num_data);
908 NTSTATUS cli_trans(TALLOC_CTX *mem_ctx, struct cli_state *cli,
909 uint8_t trans_cmd,
910 const char *pipe_name, uint16_t fid, uint16_t function,
911 int flags,
912 uint16_t *setup, uint8_t num_setup, uint8_t max_setup,
913 uint8_t *param, uint32_t num_param, uint32_t max_param,
914 uint8_t *data, uint32_t num_data, uint32_t max_data,
915 uint16_t *recv_flags2,
916 uint16_t **rsetup, uint8_t min_rsetup, uint8_t *num_rsetup,
917 uint8_t **rparam, uint32_t min_rparam, uint32_t *num_rparam,
918 uint8_t **rdata, uint32_t min_rdata, uint32_t *num_rdata);
920 /* The following definitions come from libsmb/reparse_symlink.c */
922 bool symlink_reparse_buffer_marshall(
923 const char *substitute, const char *printname, uint32_t flags,
924 TALLOC_CTX *mem_ctx, uint8_t **pdst, size_t *pdstlen);
925 bool symlink_reparse_buffer_parse(
926 const uint8_t *src, size_t srclen, TALLOC_CTX *mem_ctx,
927 char **psubstitute_name, char **pprint_name, uint32_t *pflags);
929 /* The following definitions come from libsmb/clisymlink.c */
931 struct tevent_req *cli_symlink_send(TALLOC_CTX *mem_ctx,
932 struct tevent_context *ev,
933 struct cli_state *cli,
934 const char *oldpath,
935 const char *newpath,
936 uint32_t flags);
937 NTSTATUS cli_symlink_recv(struct tevent_req *req);
938 NTSTATUS cli_symlink(struct cli_state *cli, const char *oldname,
939 const char *newname, uint32_t flags);
941 struct tevent_req *cli_readlink_send(TALLOC_CTX *mem_ctx,
942 struct tevent_context *ev,
943 struct cli_state *cli,
944 const char *fname);
945 NTSTATUS cli_readlink_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
946 char **psubstitute_name, char **pprint_name,
947 uint32_t *pflags);
948 NTSTATUS cli_readlink(struct cli_state *cli, const char *fname,
949 TALLOC_CTX *mem_ctx, char **psubstitute_name,
950 char **pprint_name, uint32_t *pflags);
952 #endif /* _LIBSMB_PROTO_H_ */