ctdb-scripts: Quote some variable expansions
[Samba.git] / source3 / libsmb / proto.h
blobc5e74c932eda669c52385e61926671ac51b65768
1 /*
2 Unix SMB/CIFS implementation.
4 Copyright (C) Andrew Bartlett 2001-2003
5 Copyright (C) Andrew Tridgell 1994-1998,2000-2001
6 Copyright (C) Gerald (Jerry) Carter 2004
7 Copyright (C) Jelmer Vernooij 2003
8 Copyright (C) Jeremy Allison 2001-2009,2011
9 Copyright (C) Stefan Metzmacher 2003,2009
10 Copyright (C) Volker Lendecke 2011
12 This program is free software; you can redistribute it and/or modify
13 it under the terms of the GNU General Public License as published by
14 the Free Software Foundation; either version 3 of the License, or
15 (at your option) any later version.
17 This program is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License for more details.
22 You should have received a copy of the GNU General Public License
23 along with this program. If not, see <http://www.gnu.org/licenses/>.
26 #ifndef _LIBSMB_PROTO_H_
27 #define _LIBSMB_PROTO_H_
29 #include "ads.h"
30 #include "auth_info.h"
32 struct smb_trans_enc_state;
34 /* The following definitions come from libsmb/cliconnect.c */
36 struct tevent_req *cli_session_setup_send(TALLOC_CTX *mem_ctx,
37 struct tevent_context *ev,
38 struct cli_state *cli,
39 const char *user,
40 const char *pass, int passlen,
41 const char *ntpass, int ntpasslen,
42 const char *workgroup);
43 NTSTATUS cli_session_setup_recv(struct tevent_req *req);
44 NTSTATUS cli_session_setup(struct cli_state *cli,
45 const char *user,
46 const char *pass, int passlen,
47 const char *ntpass, int ntpasslen,
48 const char *workgroup);
49 struct tevent_req *cli_session_setup_guest_create(TALLOC_CTX *mem_ctx,
50 struct tevent_context *ev,
51 struct cli_state *cli,
52 struct tevent_req **psmbreq);
53 struct tevent_req *cli_session_setup_guest_send(TALLOC_CTX *mem_ctx,
54 struct tevent_context *ev,
55 struct cli_state *cli);
56 NTSTATUS cli_session_setup_guest_recv(struct tevent_req *req);
57 NTSTATUS cli_ulogoff(struct cli_state *cli);
58 struct tevent_req *cli_tcon_andx_create(TALLOC_CTX *mem_ctx,
59 struct tevent_context *ev,
60 struct cli_state *cli,
61 const char *share, const char *dev,
62 const char *pass, int passlen,
63 struct tevent_req **psmbreq);
64 struct tevent_req *cli_tcon_andx_send(TALLOC_CTX *mem_ctx,
65 struct tevent_context *ev,
66 struct cli_state *cli,
67 const char *share, const char *dev,
68 const char *pass, int passlen);
69 NTSTATUS cli_tcon_andx_recv(struct tevent_req *req);
70 NTSTATUS cli_tcon_andx(struct cli_state *cli, const char *share,
71 const char *dev, const char *pass, int passlen);
72 NTSTATUS cli_tree_connect(struct cli_state *cli, const char *share,
73 const char *dev, const char *pass, int passlen);
74 NTSTATUS cli_tdis(struct cli_state *cli);
75 NTSTATUS cli_connect_nb(const char *host, const struct sockaddr_storage *dest_ss,
76 uint16_t port, int name_type, const char *myname,
77 int signing_state, int flags, struct cli_state **pcli);
78 NTSTATUS cli_start_connection(struct cli_state **output_cli,
79 const char *my_name,
80 const char *dest_host,
81 const struct sockaddr_storage *dest_ss, int port,
82 int signing_state, int flags);
83 struct tevent_req *cli_full_connection_send(
84 TALLOC_CTX *mem_ctx, struct tevent_context *ev,
85 const char *my_name, const char *dest_host,
86 const struct sockaddr_storage *dest_ss, int port,
87 const char *service, const char *service_type,
88 const char *user, const char *domain,
89 const char *password, int flags, int signing_state);
90 NTSTATUS cli_full_connection_recv(struct tevent_req *req,
91 struct cli_state **output_cli);
92 NTSTATUS cli_full_connection(struct cli_state **output_cli,
93 const char *my_name,
94 const char *dest_host,
95 const struct sockaddr_storage *dest_ss, int port,
96 const char *service, const char *service_type,
97 const char *user, const char *domain,
98 const char *password, int flags,
99 int signing_state);
100 NTSTATUS cli_raw_tcon(struct cli_state *cli,
101 const char *service, const char *pass, const char *dev,
102 uint16_t *max_xmit, uint16_t *tid);
103 struct cli_state *get_ipc_connect(char *server,
104 struct sockaddr_storage *server_ss,
105 const struct user_auth_info *user_info);
106 struct cli_state *get_ipc_connect_master_ip(TALLOC_CTX *ctx,
107 struct sockaddr_storage *mb_ip,
108 const struct user_auth_info *user_info,
109 char **pp_workgroup_out);
110 struct cli_state *get_ipc_connect_master_ip_bcast(TALLOC_CTX *ctx,
111 const struct user_auth_info *user_info,
112 char **pp_workgroup_out);
114 /* The following definitions come from libsmb/clidfs.c */
116 NTSTATUS cli_cm_force_encryption(struct cli_state *c,
117 const char *username,
118 const char *password,
119 const char *domain,
120 const char *sharename);
121 NTSTATUS cli_cm_open(TALLOC_CTX *ctx,
122 struct cli_state *referring_cli,
123 const char *server,
124 const char *share,
125 const struct user_auth_info *auth_info,
126 bool show_hdr,
127 bool force_encrypt,
128 int max_protocol,
129 int port,
130 int name_type,
131 struct cli_state **pcli);
132 void cli_cm_display(struct cli_state *c);
133 struct client_dfs_referral;
134 NTSTATUS cli_dfs_get_referral(TALLOC_CTX *ctx,
135 struct cli_state *cli,
136 const char *path,
137 struct client_dfs_referral **refs,
138 size_t *num_refs,
139 size_t *consumed);
140 NTSTATUS cli_resolve_path(TALLOC_CTX *ctx,
141 const char *mountpt,
142 const struct user_auth_info *dfs_auth_info,
143 struct cli_state *rootcli,
144 const char *path,
145 struct cli_state **targetcli,
146 char **pp_targetpath);
148 bool cli_check_msdfs_proxy(TALLOC_CTX *ctx,
149 struct cli_state *cli,
150 const char *sharename,
151 char **pp_newserver,
152 char **pp_newshare,
153 bool force_encrypt,
154 const char *username,
155 const char *password,
156 const char *domain);
158 /* The following definitions come from libsmb/clientgen.c */
160 int cli_set_message(char *buf,int num_words,int num_bytes,bool zero);
161 unsigned int cli_set_timeout(struct cli_state *cli, unsigned int timeout);
162 bool cli_set_backup_intent(struct cli_state *cli, bool flag);
163 void cli_setup_packet_buf(struct cli_state *cli, char *buf);
164 extern struct GUID cli_state_client_guid;
165 struct cli_state *cli_state_create(TALLOC_CTX *mem_ctx,
166 int fd,
167 const char *remote_name,
168 const char *remote_realm,
169 int signing_state,
170 int flags);
171 void cli_nt_pipes_close(struct cli_state *cli);
172 void cli_shutdown(struct cli_state *cli);
173 const char *cli_state_remote_realm(struct cli_state *cli);
174 uint16_t cli_state_get_vc_num(struct cli_state *cli);
175 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 uint8_t *smb_bytes_push_str(uint8_t *buf, bool ucs2, const char *str,
382 size_t str_len, size_t *pconverted_size);
383 uint8_t *smb_bytes_push_bytes(uint8_t *buf, uint8_t prefix,
384 const uint8_t *bytes, size_t num_bytes);
385 uint8_t *trans2_bytes_push_str(uint8_t *buf, bool ucs2,
386 const char *str, size_t str_len,
387 size_t *pconverted_size);
388 uint8_t *trans2_bytes_push_bytes(uint8_t *buf,
389 const uint8_t *bytes, size_t num_bytes);
390 struct tevent_req *cli_openx_create(TALLOC_CTX *mem_ctx,
391 struct tevent_context *ev,
392 struct cli_state *cli, const char *fname,
393 int flags, int share_mode,
394 struct tevent_req **psmbreq);
395 struct tevent_req *cli_openx_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
396 struct cli_state *cli, const char *fname,
397 int flags, int share_mode);
398 NTSTATUS cli_openx_recv(struct tevent_req *req, uint16_t *fnum);
399 NTSTATUS cli_openx(struct cli_state *cli, const char *fname, int flags, int share_mode, uint16_t *pfnum);
400 NTSTATUS cli_open(struct cli_state *cli, const char *fname, int flags, int share_mode, uint16_t *pfnum);
401 struct tevent_req *cli_close_create(TALLOC_CTX *mem_ctx,
402 struct tevent_context *ev,
403 struct cli_state *cli, uint16_t fnum,
404 struct tevent_req **psubreq);
405 struct tevent_req *cli_close_send(TALLOC_CTX *mem_ctx,
406 struct tevent_context *ev,
407 struct cli_state *cli, uint16_t fnum);
408 NTSTATUS cli_close_recv(struct tevent_req *req);
409 NTSTATUS cli_close(struct cli_state *cli, uint16_t fnum);
410 struct tevent_req *cli_ftruncate_send(TALLOC_CTX *mem_ctx,
411 struct tevent_context *ev,
412 struct cli_state *cli,
413 uint16_t fnum,
414 uint64_t size);
415 NTSTATUS cli_ftruncate_recv(struct tevent_req *req);
416 NTSTATUS cli_ftruncate(struct cli_state *cli, uint16_t fnum, uint64_t size);
417 NTSTATUS cli_locktype(struct cli_state *cli, uint16_t fnum,
418 uint32_t offset, uint32_t len,
419 int timeout, unsigned char locktype);
420 NTSTATUS cli_lock32(struct cli_state *cli, uint16_t fnum, uint32_t offset,
421 uint32_t len, int timeout, enum brl_type lock_type);
422 struct tevent_req *cli_unlock_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_unlock_recv(struct tevent_req *req);
429 NTSTATUS cli_unlock(struct cli_state *cli, uint16_t fnum, uint32_t offset, uint32_t len);
430 NTSTATUS cli_lock64(struct cli_state *cli, uint16_t fnum,
431 uint64_t offset, uint64_t len, int timeout,
432 enum brl_type lock_type);
433 struct tevent_req *cli_unlock64_send(TALLOC_CTX *mem_ctx,
434 struct tevent_context *ev,
435 struct cli_state *cli,
436 uint16_t fnum,
437 uint64_t offset,
438 uint64_t len);
439 NTSTATUS cli_unlock64_recv(struct tevent_req *req);
440 NTSTATUS cli_unlock64(struct cli_state *cli, uint16_t fnum, uint64_t offset, uint64_t len);
441 struct tevent_req *cli_posix_lock_send(TALLOC_CTX *mem_ctx,
442 struct tevent_context *ev,
443 struct cli_state *cli,
444 uint16_t fnum,
445 uint64_t offset,
446 uint64_t len,
447 bool wait_lock,
448 enum brl_type lock_type);
449 NTSTATUS cli_posix_lock_recv(struct tevent_req *req);
450 NTSTATUS cli_posix_lock(struct cli_state *cli, uint16_t fnum,
451 uint64_t offset, uint64_t len,
452 bool wait_lock, enum brl_type lock_type);
453 struct tevent_req *cli_posix_unlock_send(TALLOC_CTX *mem_ctx,
454 struct tevent_context *ev,
455 struct cli_state *cli,
456 uint16_t fnum,
457 uint64_t offset,
458 uint64_t len);
459 NTSTATUS cli_posix_unlock_recv(struct tevent_req *req);
460 NTSTATUS cli_posix_unlock(struct cli_state *cli, uint16_t fnum, uint64_t offset, uint64_t len);
461 struct tevent_req *cli_getattrE_send(TALLOC_CTX *mem_ctx,
462 struct tevent_context *ev,
463 struct cli_state *cli,
464 uint16_t fnum);
465 NTSTATUS cli_getattrE_recv(struct tevent_req *req,
466 uint16_t *attr,
467 off_t *size,
468 time_t *change_time,
469 time_t *access_time,
470 time_t *write_time);
471 NTSTATUS cli_getattrE(struct cli_state *cli,
472 uint16_t fnum,
473 uint16_t *attr,
474 off_t *size,
475 time_t *change_time,
476 time_t *access_time,
477 time_t *write_time);
478 struct tevent_req *cli_setattrE_send(TALLOC_CTX *mem_ctx,
479 struct tevent_context *ev,
480 struct cli_state *cli,
481 uint16_t fnum,
482 time_t change_time,
483 time_t access_time,
484 time_t write_time);
485 NTSTATUS cli_setattrE_recv(struct tevent_req *req);
486 NTSTATUS cli_setattrE(struct cli_state *cli,
487 uint16_t fnum,
488 time_t change_time,
489 time_t access_time,
490 time_t write_time);
491 struct tevent_req *cli_getatr_send(TALLOC_CTX *mem_ctx,
492 struct tevent_context *ev,
493 struct cli_state *cli,
494 const char *fname);
495 NTSTATUS cli_getatr_recv(struct tevent_req *req,
496 uint16_t *attr,
497 off_t *size,
498 time_t *write_time);
499 NTSTATUS cli_getatr(struct cli_state *cli,
500 const char *fname,
501 uint16_t *attr,
502 off_t *size,
503 time_t *write_time);
504 struct tevent_req *cli_setatr_send(TALLOC_CTX *mem_ctx,
505 struct tevent_context *ev,
506 struct cli_state *cli,
507 const char *fname,
508 uint16_t attr,
509 time_t mtime);
510 NTSTATUS cli_setatr_recv(struct tevent_req *req);
511 NTSTATUS cli_setatr(struct cli_state *cli,
512 const char *fname,
513 uint16_t attr,
514 time_t mtime);
515 struct tevent_req *cli_chkpath_send(TALLOC_CTX *mem_ctx,
516 struct tevent_context *ev,
517 struct cli_state *cli,
518 const char *fname);
519 NTSTATUS cli_chkpath_recv(struct tevent_req *req);
520 NTSTATUS cli_chkpath(struct cli_state *cli, const char *path);
521 struct tevent_req *cli_dskattr_send(TALLOC_CTX *mem_ctx,
522 struct tevent_context *ev,
523 struct cli_state *cli);
524 NTSTATUS cli_dskattr_recv(struct tevent_req *req, int *bsize, int *total,
525 int *avail);
526 NTSTATUS cli_dskattr(struct cli_state *cli, int *bsize, int *total, int *avail);
527 NTSTATUS cli_disk_size(struct cli_state *cli, const char *path, uint64_t *bsize,
528 uint64_t *total, uint64_t *avail);
529 struct tevent_req *cli_ctemp_send(TALLOC_CTX *mem_ctx,
530 struct tevent_context *ev,
531 struct cli_state *cli,
532 const char *path);
533 NTSTATUS cli_ctemp_recv(struct tevent_req *req,
534 TALLOC_CTX *ctx,
535 uint16_t *pfnum,
536 char **outfile);
537 NTSTATUS cli_ctemp(struct cli_state *cli,
538 TALLOC_CTX *ctx,
539 const char *path,
540 uint16_t *pfnum,
541 char **out_path);
542 NTSTATUS cli_raw_ioctl(struct cli_state *cli, uint16_t fnum, uint32_t code, DATA_BLOB *blob);
543 NTSTATUS cli_set_ea_path(struct cli_state *cli, const char *path,
544 const char *ea_name, const char *ea_val,
545 size_t ea_len);
546 NTSTATUS cli_set_ea_fnum(struct cli_state *cli, uint16_t fnum,
547 const char *ea_name, const char *ea_val,
548 size_t ea_len);
549 struct tevent_req *cli_get_ea_list_path_send(TALLOC_CTX *mem_ctx,
550 struct tevent_context *ev,
551 struct cli_state *cli,
552 const char *fname);
553 NTSTATUS cli_get_ea_list_path_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
554 size_t *pnum_eas, struct ea_struct **peas);
555 NTSTATUS cli_get_ea_list_path(struct cli_state *cli, const char *path,
556 TALLOC_CTX *ctx,
557 size_t *pnum_eas,
558 struct ea_struct **pea_list);
559 struct tevent_req *cli_posix_open_send(TALLOC_CTX *mem_ctx,
560 struct tevent_context *ev,
561 struct cli_state *cli,
562 const char *fname,
563 int flags,
564 mode_t mode);
565 NTSTATUS cli_posix_open_recv(struct tevent_req *req, uint16_t *pfnum);
566 NTSTATUS cli_posix_open(struct cli_state *cli, const char *fname,
567 int flags, mode_t mode, uint16_t *fnum);
568 struct tevent_req *cli_posix_mkdir_send(TALLOC_CTX *mem_ctx,
569 struct tevent_context *ev,
570 struct cli_state *cli,
571 const char *fname,
572 mode_t mode);
573 NTSTATUS cli_posix_mkdir_recv(struct tevent_req *req);
574 NTSTATUS cli_posix_mkdir(struct cli_state *cli, const char *fname, mode_t mode);
576 struct tevent_req *cli_posix_unlink_send(TALLOC_CTX *mem_ctx,
577 struct tevent_context *ev,
578 struct cli_state *cli,
579 const char *fname);
580 NTSTATUS cli_posix_unlink_recv(struct tevent_req *req);
581 NTSTATUS cli_posix_unlink(struct cli_state *cli, const char *fname);
583 struct tevent_req *cli_posix_rmdir_send(TALLOC_CTX *mem_ctx,
584 struct tevent_context *ev,
585 struct cli_state *cli,
586 const char *fname);
587 NTSTATUS cli_posix_rmdir_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx);
588 NTSTATUS cli_posix_rmdir(struct cli_state *cli, const char *fname);
589 struct tevent_req *cli_notify_send(TALLOC_CTX *mem_ctx,
590 struct tevent_context *ev,
591 struct cli_state *cli, uint16_t fnum,
592 uint32_t buffer_size,
593 uint32_t completion_filter, bool recursive);
594 NTSTATUS cli_notify_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
595 uint32_t *pnum_changes,
596 struct notify_change **pchanges);
597 NTSTATUS cli_notify(struct cli_state *cli, uint16_t fnum, uint32_t buffer_size,
598 uint32_t completion_filter, bool recursive,
599 TALLOC_CTX *mem_ctx, uint32_t *pnum_changes,
600 struct notify_change **pchanges);
602 struct tevent_req *cli_nttrans_create_send(TALLOC_CTX *mem_ctx,
603 struct tevent_context *ev,
604 struct cli_state *cli,
605 const char *fname,
606 uint32_t CreatFlags,
607 uint32_t DesiredAccess,
608 uint32_t FileAttributes,
609 uint32_t ShareAccess,
610 uint32_t CreateDisposition,
611 uint32_t CreateOptions,
612 uint8_t SecurityFlags,
613 struct security_descriptor *secdesc,
614 struct ea_struct *eas,
615 int num_eas);
616 NTSTATUS cli_nttrans_create_recv(struct tevent_req *req,
617 uint16_t *fnum,
618 struct smb_create_returns *cr);
619 NTSTATUS cli_nttrans_create(struct cli_state *cli,
620 const char *fname,
621 uint32_t CreatFlags,
622 uint32_t DesiredAccess,
623 uint32_t FileAttributes,
624 uint32_t ShareAccess,
625 uint32_t CreateDisposition,
626 uint32_t CreateOptions,
627 uint8_t SecurityFlags,
628 struct security_descriptor *secdesc,
629 struct ea_struct *eas,
630 int num_eas,
631 uint16_t *pfid,
632 struct smb_create_returns *cr);
634 /* The following definitions come from libsmb/clifsinfo.c */
636 struct tevent_req *cli_unix_extensions_version_send(TALLOC_CTX *mem_ctx,
637 struct tevent_context *ev,
638 struct cli_state *cli);
639 NTSTATUS cli_unix_extensions_version_recv(struct tevent_req *req,
640 uint16_t *pmajor, uint16_t *pminor,
641 uint32_t *pcaplow,
642 uint32_t *pcaphigh);
643 NTSTATUS cli_unix_extensions_version(struct cli_state *cli, uint16_t *pmajor,
644 uint16_t *pminor, uint32_t *pcaplow,
645 uint32_t *pcaphigh);
646 struct tevent_req *cli_set_unix_extensions_capabilities_send(
647 TALLOC_CTX *mem_ctx, struct tevent_context *ev, struct cli_state *cli,
648 uint16_t major, uint16_t minor, uint32_t caplow, uint32_t caphigh);
649 NTSTATUS cli_set_unix_extensions_capabilities_recv(struct tevent_req *req);
650 NTSTATUS cli_set_unix_extensions_capabilities(struct cli_state *cli,
651 uint16_t major, uint16_t minor,
652 uint32_t caplow, uint32_t caphigh);
653 struct tevent_req *cli_get_fs_attr_info_send(TALLOC_CTX *mem_ctx,
654 struct tevent_context *ev,
655 struct cli_state *cli);
656 NTSTATUS cli_get_fs_attr_info_recv(struct tevent_req *req, uint32_t *fs_attr);
657 NTSTATUS cli_get_fs_attr_info(struct cli_state *cli, uint32_t *fs_attr);
658 NTSTATUS cli_get_fs_volume_info(struct cli_state *cli,
659 TALLOC_CTX *mem_ctx, char **volume_name,
660 uint32_t *pserial_number, time_t *pdate);
661 NTSTATUS cli_get_fs_full_size_info(struct cli_state *cli,
662 uint64_t *total_allocation_units,
663 uint64_t *caller_allocation_units,
664 uint64_t *actual_allocation_units,
665 uint64_t *sectors_per_allocation_unit,
666 uint64_t *bytes_per_sector);
667 NTSTATUS cli_get_posix_fs_info(struct cli_state *cli,
668 uint32_t *optimal_transfer_size,
669 uint32_t *block_size,
670 uint64_t *total_blocks,
671 uint64_t *blocks_available,
672 uint64_t *user_blocks_available,
673 uint64_t *total_file_nodes,
674 uint64_t *free_file_nodes,
675 uint64_t *fs_identifier);
676 NTSTATUS cli_raw_ntlm_smb_encryption_start(struct cli_state *cli,
677 const char *user,
678 const char *pass,
679 const char *domain);
680 NTSTATUS cli_gss_smb_encryption_start(struct cli_state *cli);
681 NTSTATUS cli_force_encryption(struct cli_state *c,
682 const char *username,
683 const char *password,
684 const char *domain);
685 struct tevent_req *cli_posix_whoami_send(TALLOC_CTX *mem_ctx,
686 struct tevent_context *ev,
687 struct cli_state *cli);
688 NTSTATUS cli_posix_whoami_recv(struct tevent_req *req,
689 TALLOC_CTX *mem_ctx,
690 uint64_t *puid,
691 uint64_t *pgid,
692 uint32_t *pnum_gids,
693 uint64_t **pgids,
694 uint32_t *pnum_sids,
695 struct dom_sid **psids,
696 bool *pguest);
697 NTSTATUS cli_posix_whoami(struct cli_state *cli,
698 TALLOC_CTX *mem_ctx,
699 uint64_t *puid,
700 uint64_t *pgid,
701 uint32_t *num_gids,
702 uint64_t **gids,
703 uint32_t *num_sids,
704 struct dom_sid **sids,
705 bool *pguest);
707 /* The following definitions come from libsmb/clilist.c */
709 NTSTATUS cli_list_old(struct cli_state *cli,const char *Mask,uint16_t attribute,
710 NTSTATUS (*fn)(const char *, struct file_info *,
711 const char *, void *), void *state);
712 NTSTATUS cli_list_trans(struct cli_state *cli, const char *mask,
713 uint16_t attribute, int info_level,
714 NTSTATUS (*fn)(const char *mnt, struct file_info *finfo,
715 const char *mask, void *private_data),
716 void *private_data);
717 struct tevent_req *cli_list_send(TALLOC_CTX *mem_ctx,
718 struct tevent_context *ev,
719 struct cli_state *cli,
720 const char *mask,
721 uint16_t attribute,
722 uint16_t info_level);
723 NTSTATUS cli_list_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
724 struct file_info **finfo, size_t *num_finfo);
725 NTSTATUS cli_list(struct cli_state *cli,const char *Mask,uint16_t attribute,
726 NTSTATUS (*fn)(const char *, struct file_info *, const char *,
727 void *), void *state);
729 /* The following definitions come from libsmb/climessage.c */
731 struct tevent_req *cli_message_send(TALLOC_CTX *mem_ctx,
732 struct tevent_context *ev,
733 struct cli_state *cli,
734 const char *host, const char *username,
735 const char *message);
736 NTSTATUS cli_message_recv(struct tevent_req *req);
737 NTSTATUS cli_message(struct cli_state *cli, const char *host,
738 const char *username, const char *message);
740 /* The following definitions come from libsmb/clioplock.c */
742 struct tevent_req *cli_smb_oplock_break_waiter_send(TALLOC_CTX *mem_ctx,
743 struct tevent_context *ev,
744 struct cli_state *cli);
745 NTSTATUS cli_smb_oplock_break_waiter_recv(struct tevent_req *req,
746 uint16_t *pfnum,
747 uint8_t *plevel);
749 struct tevent_req *cli_oplock_ack_send(TALLOC_CTX *mem_ctx,
750 struct tevent_context *ev,
751 struct cli_state *cli,
752 uint16_t fnum, uint8_t level);
753 NTSTATUS cli_oplock_ack_recv(struct tevent_req *req);
755 /* The following definitions come from libsmb/cliprint.c */
757 int cli_print_queue(struct cli_state *cli,
758 void (*fn)(struct print_job_info *));
759 int cli_printjob_del(struct cli_state *cli, int job);
761 /* The following definitions come from libsmb/cliquota.c */
763 NTSTATUS cli_get_quota_handle(struct cli_state *cli, uint16_t *quota_fnum);
764 void free_ntquota_list(SMB_NTQUOTA_LIST **qt_list);
765 NTSTATUS cli_get_user_quota(struct cli_state *cli, int quota_fnum,
766 SMB_NTQUOTA_STRUCT *pqt);
767 NTSTATUS cli_set_user_quota(struct cli_state *cli, int quota_fnum,
768 SMB_NTQUOTA_STRUCT *pqt);
769 NTSTATUS cli_list_user_quota(struct cli_state *cli, int quota_fnum,
770 SMB_NTQUOTA_LIST **pqt_list);
771 NTSTATUS cli_get_fs_quota_info(struct cli_state *cli, int quota_fnum,
772 SMB_NTQUOTA_STRUCT *pqt);
773 NTSTATUS cli_set_fs_quota_info(struct cli_state *cli, int quota_fnum,
774 SMB_NTQUOTA_STRUCT *pqt);
776 /* The following definitions come from libsmb/clireadwrite.c */
778 struct tevent_req *cli_read_andx_create(TALLOC_CTX *mem_ctx,
779 struct tevent_context *ev,
780 struct cli_state *cli, uint16_t fnum,
781 off_t offset, size_t size,
782 struct tevent_req **psmbreq);
783 struct tevent_req *cli_read_andx_send(TALLOC_CTX *mem_ctx,
784 struct tevent_context *ev,
785 struct cli_state *cli, uint16_t fnum,
786 off_t offset, size_t size);
787 NTSTATUS cli_read_andx_recv(struct tevent_req *req, ssize_t *received,
788 uint8_t **rcvbuf);
789 struct tevent_req *cli_pull_send(TALLOC_CTX *mem_ctx,
790 struct tevent_context *ev,
791 struct cli_state *cli,
792 uint16_t fnum, off_t start_offset,
793 off_t size, size_t window_size,
794 NTSTATUS (*sink)(char *buf, size_t n,
795 void *priv),
796 void *priv);
797 NTSTATUS cli_pull_recv(struct tevent_req *req, off_t *received);
798 NTSTATUS cli_pull(struct cli_state *cli, uint16_t fnum,
799 off_t start_offset, off_t size, size_t window_size,
800 NTSTATUS (*sink)(char *buf, size_t n, void *priv),
801 void *priv, off_t *received);
802 NTSTATUS cli_read(struct cli_state *cli, uint16_t fnum,
803 char *buf, off_t offset, size_t size,
804 size_t *nread);
805 NTSTATUS cli_smbwrite(struct cli_state *cli, uint16_t fnum, char *buf,
806 off_t offset, size_t size1, size_t *ptotal);
807 struct tevent_req *cli_write_andx_create(TALLOC_CTX *mem_ctx,
808 struct tevent_context *ev,
809 struct cli_state *cli, uint16_t fnum,
810 uint16_t mode, const uint8_t *buf,
811 off_t offset, size_t size,
812 struct tevent_req **reqs_before,
813 int num_reqs_before,
814 struct tevent_req **psmbreq);
815 struct tevent_req *cli_write_andx_send(TALLOC_CTX *mem_ctx,
816 struct tevent_context *ev,
817 struct cli_state *cli, uint16_t fnum,
818 uint16_t mode, const uint8_t *buf,
819 off_t offset, size_t size);
820 NTSTATUS cli_write_andx_recv(struct tevent_req *req, size_t *pwritten);
822 NTSTATUS cli_writeall(struct cli_state *cli, uint16_t fnum, uint16_t mode,
823 const uint8_t *buf, off_t offset, size_t size,
824 size_t *pwritten);
826 struct tevent_req *cli_push_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
827 struct cli_state *cli,
828 uint16_t fnum, uint16_t mode,
829 off_t start_offset, size_t window_size,
830 size_t (*source)(uint8_t *buf, size_t n,
831 void *priv),
832 void *priv);
833 NTSTATUS cli_push_recv(struct tevent_req *req);
834 NTSTATUS cli_push(struct cli_state *cli, uint16_t fnum, uint16_t mode,
835 off_t start_offset, size_t window_size,
836 size_t (*source)(uint8_t *buf, size_t n, void *priv),
837 void *priv);
839 NTSTATUS cli_splice(struct cli_state *srccli, struct cli_state *dstcli,
840 uint16_t src_fnum, uint16_t dst_fnum,
841 off_t size,
842 off_t src_offset, off_t dst_offset,
843 off_t *written,
844 int (*splice_cb)(off_t n, void *priv), void *priv);
846 /* The following definitions come from libsmb/clisecdesc.c */
848 NTSTATUS cli_query_security_descriptor(struct cli_state *cli,
849 uint16_t fnum,
850 uint32_t sec_info,
851 TALLOC_CTX *mem_ctx,
852 struct security_descriptor **sd);
853 NTSTATUS cli_query_secdesc(struct cli_state *cli, uint16_t fnum,
854 TALLOC_CTX *mem_ctx, struct security_descriptor **sd);
855 NTSTATUS cli_set_security_descriptor(struct cli_state *cli,
856 uint16_t fnum,
857 uint32_t sec_info,
858 const struct security_descriptor *sd);
859 NTSTATUS cli_set_secdesc(struct cli_state *cli, uint16_t fnum,
860 const struct security_descriptor *sd);
862 /* The following definitions come from libsmb/clistr.c */
864 size_t clistr_pull_talloc(TALLOC_CTX *ctx,
865 const char *base,
866 uint16_t flags2,
867 char **pp_dest,
868 const void *src,
869 int src_len,
870 int flags);
872 /* The following definitions come from libsmb/clitrans.c */
874 struct tevent_req *cli_trans_send(
875 TALLOC_CTX *mem_ctx, struct tevent_context *ev,
876 struct cli_state *cli, uint8_t cmd,
877 const char *pipe_name, uint16_t fid, uint16_t function, int flags,
878 uint16_t *setup, uint8_t num_setup, uint8_t max_setup,
879 uint8_t *param, uint32_t num_param, uint32_t max_param,
880 uint8_t *data, uint32_t num_data, uint32_t max_data);
881 NTSTATUS cli_trans_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
882 uint16_t *recv_flags2,
883 uint16_t **setup, uint8_t min_setup,
884 uint8_t *num_setup,
885 uint8_t **param, uint32_t min_param,
886 uint32_t *num_param,
887 uint8_t **data, uint32_t min_data,
888 uint32_t *num_data);
889 NTSTATUS cli_trans(TALLOC_CTX *mem_ctx, struct cli_state *cli,
890 uint8_t trans_cmd,
891 const char *pipe_name, uint16_t fid, uint16_t function,
892 int flags,
893 uint16_t *setup, uint8_t num_setup, uint8_t max_setup,
894 uint8_t *param, uint32_t num_param, uint32_t max_param,
895 uint8_t *data, uint32_t num_data, uint32_t max_data,
896 uint16_t *recv_flags2,
897 uint16_t **rsetup, uint8_t min_rsetup, uint8_t *num_rsetup,
898 uint8_t **rparam, uint32_t min_rparam, uint32_t *num_rparam,
899 uint8_t **rdata, uint32_t min_rdata, uint32_t *num_rdata);
901 /* The following definitions come from libsmb/reparse_symlink.c */
903 bool symlink_reparse_buffer_marshall(
904 const char *substitute, const char *printname, uint32_t flags,
905 TALLOC_CTX *mem_ctx, uint8_t **pdst, size_t *pdstlen);
906 bool symlink_reparse_buffer_parse(
907 const uint8_t *src, size_t srclen, TALLOC_CTX *mem_ctx,
908 char **psubstitute_name, char **pprint_name, uint32_t *pflags);
910 /* The following definitions come from libsmb/clisymlink.c */
912 struct tevent_req *cli_symlink_send(TALLOC_CTX *mem_ctx,
913 struct tevent_context *ev,
914 struct cli_state *cli,
915 const char *oldpath,
916 const char *newpath,
917 uint32_t flags);
918 NTSTATUS cli_symlink_recv(struct tevent_req *req);
919 NTSTATUS cli_symlink(struct cli_state *cli, const char *oldname,
920 const char *newname, uint32_t flags);
922 struct tevent_req *cli_readlink_send(TALLOC_CTX *mem_ctx,
923 struct tevent_context *ev,
924 struct cli_state *cli,
925 const char *fname);
926 NTSTATUS cli_readlink_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
927 char **psubstitute_name, char **pprint_name,
928 uint32_t *pflags);
929 NTSTATUS cli_readlink(struct cli_state *cli, const char *fname,
930 TALLOC_CTX *mem_ctx, char **psubstitute_name,
931 char **pprint_name, uint32_t *pflags);
933 #endif /* _LIBSMB_PROTO_H_ */