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