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