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