s3:smb2cli: ignore the NBT/Length header in smb2cli_inbuf_parse_compound()
[Samba/gebeck_regimport.git] / source3 / libsmb / proto.h
blobe1f2c3e6336f55140001b7c484fb84aa0e3e1a44
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"
31 struct smb_trans_enc_state;
33 /* The following definitions come from libsmb/cliconnect.c */
35 NTSTATUS cli_session_setup(struct cli_state *cli,
36 const char *user,
37 const char *pass, int passlen,
38 const char *ntpass, int ntpasslen,
39 const char *workgroup);
40 struct tevent_req *cli_session_setup_guest_create(TALLOC_CTX *mem_ctx,
41 struct event_context *ev,
42 struct cli_state *cli,
43 struct tevent_req **psmbreq);
44 struct tevent_req *cli_session_setup_guest_send(TALLOC_CTX *mem_ctx,
45 struct event_context *ev,
46 struct cli_state *cli);
47 NTSTATUS cli_session_setup_guest_recv(struct tevent_req *req);
48 struct tevent_req *cli_ulogoff_send(TALLOC_CTX *mem_ctx,
49 struct tevent_context *ev,
50 struct cli_state *cli);
51 NTSTATUS cli_ulogoff_recv(struct tevent_req *req);
52 NTSTATUS cli_ulogoff(struct cli_state *cli);
53 struct tevent_req *cli_tcon_andx_create(TALLOC_CTX *mem_ctx,
54 struct event_context *ev,
55 struct cli_state *cli,
56 const char *share, const char *dev,
57 const char *pass, int passlen,
58 struct tevent_req **psmbreq);
59 struct tevent_req *cli_tcon_andx_send(TALLOC_CTX *mem_ctx,
60 struct event_context *ev,
61 struct cli_state *cli,
62 const char *share, const char *dev,
63 const char *pass, int passlen);
64 NTSTATUS cli_tcon_andx_recv(struct tevent_req *req);
65 NTSTATUS cli_tcon_andx(struct cli_state *cli, const char *share,
66 const char *dev, const char *pass, int passlen);
67 struct tevent_req *cli_tdis_send(TALLOC_CTX *mem_ctx,
68 struct tevent_context *ev,
69 struct cli_state *cli);
70 NTSTATUS cli_tdis_recv(struct tevent_req *req);
71 NTSTATUS cli_tdis(struct cli_state *cli);
72 NTSTATUS cli_negprot(struct cli_state *cli, enum protocol_types max_protocol);
73 struct tevent_req *cli_negprot_send(TALLOC_CTX *mem_ctx,
74 struct event_context *ev,
75 struct cli_state *cli,
76 enum protocol_types max_protocol);
77 NTSTATUS cli_negprot_recv(struct tevent_req *req);
78 NTSTATUS cli_connect_nb(const char *host, const struct sockaddr_storage *dest_ss,
79 uint16_t port, int name_type, const char *myname,
80 int signing_state, int flags, struct cli_state **pcli);
81 NTSTATUS cli_start_connection(struct cli_state **output_cli,
82 const char *my_name,
83 const char *dest_host,
84 const struct sockaddr_storage *dest_ss, int port,
85 int signing_state, int flags);
86 NTSTATUS cli_full_connection(struct cli_state **output_cli,
87 const char *my_name,
88 const char *dest_host,
89 const struct sockaddr_storage *dest_ss, int port,
90 const char *service, const char *service_type,
91 const char *user, const char *domain,
92 const char *password, int flags,
93 int signing_state);
94 NTSTATUS cli_raw_tcon(struct cli_state *cli,
95 const char *service, const char *pass, const char *dev,
96 uint16 *max_xmit, uint16 *tid);
97 struct cli_state *get_ipc_connect(char *server,
98 struct sockaddr_storage *server_ss,
99 const struct user_auth_info *user_info);
100 struct cli_state *get_ipc_connect_master_ip(TALLOC_CTX *ctx,
101 struct sockaddr_storage *mb_ip,
102 const struct user_auth_info *user_info,
103 char **pp_workgroup_out);
104 struct cli_state *get_ipc_connect_master_ip_bcast(TALLOC_CTX *ctx,
105 const struct user_auth_info *user_info,
106 char **pp_workgroup_out);
108 /* The following definitions come from libsmb/clidfs.c */
110 NTSTATUS cli_cm_force_encryption(struct cli_state *c,
111 const char *username,
112 const char *password,
113 const char *domain,
114 const char *sharename);
115 NTSTATUS cli_cm_open(TALLOC_CTX *ctx,
116 struct cli_state *referring_cli,
117 const char *server,
118 const char *share,
119 const struct user_auth_info *auth_info,
120 bool show_hdr,
121 bool force_encrypt,
122 int max_protocol,
123 int port,
124 int name_type,
125 struct cli_state **pcli);
126 void cli_cm_display(struct cli_state *c);
127 struct client_dfs_referral;
128 NTSTATUS cli_dfs_get_referral(TALLOC_CTX *ctx,
129 struct cli_state *cli,
130 const char *path,
131 struct client_dfs_referral **refs,
132 size_t *num_refs,
133 size_t *consumed);
134 NTSTATUS cli_resolve_path(TALLOC_CTX *ctx,
135 const char *mountpt,
136 const struct user_auth_info *dfs_auth_info,
137 struct cli_state *rootcli,
138 const char *path,
139 struct cli_state **targetcli,
140 char **pp_targetpath);
142 bool cli_check_msdfs_proxy(TALLOC_CTX *ctx,
143 struct cli_state *cli,
144 const char *sharename,
145 char **pp_newserver,
146 char **pp_newshare,
147 bool force_encrypt,
148 const char *username,
149 const char *password,
150 const char *domain);
152 /* The following definitions come from libsmb/clientgen.c */
154 int cli_set_message(char *buf,int num_words,int num_bytes,bool zero);
155 unsigned int cli_set_timeout(struct cli_state *cli, unsigned int timeout);
156 void cli_setup_packet_buf(struct cli_state *cli, char *buf);
157 NTSTATUS cli_set_domain(struct cli_state *cli, const char *domain);
158 NTSTATUS cli_set_username(struct cli_state *cli, const char *username);
159 NTSTATUS cli_set_password(struct cli_state *cli, const char *password);
160 NTSTATUS cli_init_creds(struct cli_state *cli, const char *username, const char *domain, const char *password);
161 struct cli_state *cli_state_create(TALLOC_CTX *mem_ctx,
162 int fd,
163 const char *remote_name,
164 const char *remote_realm,
165 int signing_state,
166 int flags);
167 bool cli_state_encryption_on(struct cli_state *cli);
168 void cli_nt_pipes_close(struct cli_state *cli);
169 void cli_shutdown(struct cli_state *cli);
170 void cli_sockopt(struct cli_state *cli, const char *options);
171 const struct sockaddr_storage *cli_state_local_sockaddr(struct cli_state *cli);
172 const struct sockaddr_storage *cli_state_remote_sockaddr(struct cli_state *cli);
173 const char *cli_state_remote_name(struct cli_state *cli);
174 const char *cli_state_remote_realm(struct cli_state *cli);
175 uint16_t cli_state_get_vc_num(struct cli_state *cli);
176 uint32_t cli_state_server_session_key(struct cli_state *cli);
177 uint16 cli_setpid(struct cli_state *cli, uint16 pid);
178 uint16_t cli_getpid(struct cli_state *cli);
179 bool cli_state_has_tcon(struct cli_state *cli);
180 uint16_t cli_state_get_tid(struct cli_state *cli);
181 uint16_t cli_state_set_tid(struct cli_state *cli, uint16_t tid);
182 uint16_t cli_state_get_uid(struct cli_state *cli);
183 uint16_t cli_state_set_uid(struct cli_state *cli, uint16_t uid);
184 bool cli_set_case_sensitive(struct cli_state *cli, bool case_sensitive);
185 enum protocol_types cli_state_protocol(struct cli_state *cli);
186 uint32_t cli_state_capabilities(struct cli_state *cli);
187 uint32_t cli_state_available_size(struct cli_state *cli, uint32_t ofs);
188 uint16_t cli_state_max_requests(struct cli_state *cli);
189 const uint8_t *cli_state_server_challenge(struct cli_state *cli);
190 const DATA_BLOB *cli_state_server_gss_blob(struct cli_state *cli);
191 uint16_t cli_state_security_mode(struct cli_state *cli);
192 int cli_state_server_time_zone(struct cli_state *cli);
193 time_t cli_state_server_time(struct cli_state *cli);
194 struct tevent_req *cli_echo_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
195 struct cli_state *cli, uint16_t num_echos,
196 DATA_BLOB data);
197 NTSTATUS cli_echo_recv(struct tevent_req *req);
198 NTSTATUS cli_echo(struct cli_state *cli, uint16_t num_echos, DATA_BLOB data);
199 bool cli_ucs2(struct cli_state *cli);
200 bool is_andx_req(uint8_t cmd);
201 NTSTATUS cli_smb(TALLOC_CTX *mem_ctx, struct cli_state *cli,
202 uint8_t smb_command, uint8_t additional_flags,
203 uint8_t wct, uint16_t *vwv,
204 uint32_t num_bytes, const uint8_t *bytes,
205 struct tevent_req **result_parent,
206 uint8_t min_wct, uint8_t *pwct, uint16_t **pvwv,
207 uint32_t *pnum_bytes, uint8_t **pbytes);
209 /* The following definitions come from libsmb/clierror.c */
211 const char *cli_errstr(struct cli_state *cli);
212 NTSTATUS cli_nt_error(struct cli_state *cli);
213 void cli_dos_error(struct cli_state *cli, uint8 *eclass, uint32 *ecode);
214 int cli_errno(struct cli_state *cli);
215 bool cli_is_error(struct cli_state *cli);
216 bool cli_is_nt_error(struct cli_state *cli);
217 bool cli_is_dos_error(struct cli_state *cli);
218 bool cli_state_is_connected(struct cli_state *cli);
219 void cli_state_disconnect(struct cli_state *cli);
221 /* The following definitions come from libsmb/clifile.c */
223 struct tevent_req *cli_setpathinfo_send(TALLOC_CTX *mem_ctx,
224 struct tevent_context *ev,
225 struct cli_state *cli,
226 uint16_t level,
227 const char *path,
228 uint8_t *data,
229 size_t data_len);
230 NTSTATUS cli_setpathinfo_recv(struct tevent_req *req);
231 NTSTATUS cli_setpathinfo(struct cli_state *cli,
232 uint16_t level,
233 const char *path,
234 uint8_t *data,
235 size_t data_len);
237 struct tevent_req *cli_posix_symlink_send(TALLOC_CTX *mem_ctx,
238 struct event_context *ev,
239 struct cli_state *cli,
240 const char *oldname,
241 const char *newname);
242 NTSTATUS cli_posix_symlink_recv(struct tevent_req *req);
243 NTSTATUS cli_posix_symlink(struct cli_state *cli,
244 const char *oldname,
245 const char *newname);
246 struct tevent_req *cli_posix_readlink_send(TALLOC_CTX *mem_ctx,
247 struct event_context *ev,
248 struct cli_state *cli,
249 const char *fname,
250 size_t len);
251 NTSTATUS cli_posix_readlink_recv(struct tevent_req *req, struct cli_state *cli,
252 char *retpath, size_t len);
253 NTSTATUS cli_posix_readlink(struct cli_state *cli, const char *fname,
254 char *linkpath, size_t len);
255 struct tevent_req *cli_posix_hardlink_send(TALLOC_CTX *mem_ctx,
256 struct event_context *ev,
257 struct cli_state *cli,
258 const char *oldname,
259 const char *newname);
260 NTSTATUS cli_posix_hardlink_recv(struct tevent_req *req);
261 NTSTATUS cli_posix_hardlink(struct cli_state *cli,
262 const char *oldname,
263 const char *newname);
264 uint32_t unix_perms_to_wire(mode_t perms);
265 mode_t wire_perms_to_unix(uint32_t perms);
266 struct tevent_req *cli_posix_getfacl_send(TALLOC_CTX *mem_ctx,
267 struct event_context *ev,
268 struct cli_state *cli,
269 const char *fname);
270 NTSTATUS cli_posix_getfacl_recv(struct tevent_req *req,
271 TALLOC_CTX *mem_ctx,
272 size_t *prb_size,
273 char **retbuf);
274 NTSTATUS cli_posix_getfacl(struct cli_state *cli,
275 const char *fname,
276 TALLOC_CTX *mem_ctx,
277 size_t *prb_size,
278 char **retbuf);
279 struct tevent_req *cli_posix_stat_send(TALLOC_CTX *mem_ctx,
280 struct event_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 event_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 event_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 event_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 event_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 event_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 event_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 event_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 event_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 event_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 event_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, uint16_t *pfnum);
368 NTSTATUS cli_ntcreate(struct cli_state *cli,
369 const char *fname,
370 uint32_t CreatFlags,
371 uint32_t DesiredAccess,
372 uint32_t FileAttributes,
373 uint32_t ShareAccess,
374 uint32_t CreateDisposition,
375 uint32_t CreateOptions,
376 uint8_t SecurityFlags,
377 uint16_t *pfid);
378 uint8_t *smb_bytes_push_str(uint8_t *buf, bool ucs2, const char *str,
379 size_t str_len, size_t *pconverted_size);
380 uint8_t *smb_bytes_push_bytes(uint8_t *buf, uint8_t prefix,
381 const uint8_t *bytes, size_t num_bytes);
382 uint8_t *trans2_bytes_push_str(uint8_t *buf, bool ucs2,
383 const char *str, size_t str_len,
384 size_t *pconverted_size);
385 uint8_t *trans2_bytes_push_bytes(uint8_t *buf,
386 const uint8_t *bytes, size_t num_bytes);
387 struct tevent_req *cli_open_create(TALLOC_CTX *mem_ctx,
388 struct event_context *ev,
389 struct cli_state *cli, const char *fname,
390 int flags, int share_mode,
391 struct tevent_req **psmbreq);
392 struct tevent_req *cli_open_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
393 struct cli_state *cli, const char *fname,
394 int flags, int share_mode);
395 NTSTATUS cli_open_recv(struct tevent_req *req, uint16_t *fnum);
396 NTSTATUS cli_open(struct cli_state *cli, const char *fname, int flags, int share_mode, uint16_t *pfnum);
397 struct tevent_req *cli_close_create(TALLOC_CTX *mem_ctx,
398 struct event_context *ev,
399 struct cli_state *cli, uint16_t fnum,
400 struct tevent_req **psubreq);
401 struct tevent_req *cli_close_send(TALLOC_CTX *mem_ctx,
402 struct event_context *ev,
403 struct cli_state *cli, uint16_t fnum);
404 NTSTATUS cli_close_recv(struct tevent_req *req);
405 NTSTATUS cli_close(struct cli_state *cli, uint16_t fnum);
406 struct tevent_req *cli_ftruncate_send(TALLOC_CTX *mem_ctx,
407 struct event_context *ev,
408 struct cli_state *cli,
409 uint16_t fnum,
410 uint64_t size);
411 NTSTATUS cli_ftruncate_recv(struct tevent_req *req);
412 NTSTATUS cli_ftruncate(struct cli_state *cli, uint16_t fnum, uint64_t size);
413 NTSTATUS cli_locktype(struct cli_state *cli, uint16_t fnum,
414 uint32_t offset, uint32_t len,
415 int timeout, unsigned char locktype);
416 NTSTATUS cli_lock32(struct cli_state *cli, uint16_t fnum, uint32_t offset,
417 uint32_t len, int timeout, enum brl_type lock_type);
418 struct tevent_req *cli_unlock_send(TALLOC_CTX *mem_ctx,
419 struct event_context *ev,
420 struct cli_state *cli,
421 uint16_t fnum,
422 uint64_t offset,
423 uint64_t len);
424 NTSTATUS cli_unlock_recv(struct tevent_req *req);
425 NTSTATUS cli_unlock(struct cli_state *cli, uint16_t fnum, uint32_t offset, uint32_t len);
426 NTSTATUS cli_lock64(struct cli_state *cli, uint16_t fnum,
427 uint64_t offset, uint64_t len, int timeout,
428 enum brl_type lock_type);
429 struct tevent_req *cli_unlock64_send(TALLOC_CTX *mem_ctx,
430 struct event_context *ev,
431 struct cli_state *cli,
432 uint16_t fnum,
433 uint64_t offset,
434 uint64_t len);
435 NTSTATUS cli_unlock64_recv(struct tevent_req *req);
436 NTSTATUS cli_unlock64(struct cli_state *cli, uint16_t fnum, uint64_t offset, uint64_t len);
437 struct tevent_req *cli_posix_lock_send(TALLOC_CTX *mem_ctx,
438 struct event_context *ev,
439 struct cli_state *cli,
440 uint16_t fnum,
441 uint64_t offset,
442 uint64_t len,
443 bool wait_lock,
444 enum brl_type lock_type);
445 NTSTATUS cli_posix_lock_recv(struct tevent_req *req);
446 NTSTATUS cli_posix_lock(struct cli_state *cli, uint16_t fnum,
447 uint64_t offset, uint64_t len,
448 bool wait_lock, enum brl_type lock_type);
449 struct tevent_req *cli_posix_unlock_send(TALLOC_CTX *mem_ctx,
450 struct event_context *ev,
451 struct cli_state *cli,
452 uint16_t fnum,
453 uint64_t offset,
454 uint64_t len);
455 NTSTATUS cli_posix_unlock_recv(struct tevent_req *req);
456 NTSTATUS cli_posix_unlock(struct cli_state *cli, uint16_t fnum, uint64_t offset, uint64_t len);
457 struct tevent_req *cli_getattrE_send(TALLOC_CTX *mem_ctx,
458 struct event_context *ev,
459 struct cli_state *cli,
460 uint16_t fnum);
461 NTSTATUS cli_getattrE_recv(struct tevent_req *req,
462 uint16_t *attr,
463 SMB_OFF_T *size,
464 time_t *change_time,
465 time_t *access_time,
466 time_t *write_time);
467 NTSTATUS cli_getattrE(struct cli_state *cli,
468 uint16_t fnum,
469 uint16_t *attr,
470 SMB_OFF_T *size,
471 time_t *change_time,
472 time_t *access_time,
473 time_t *write_time);
474 struct tevent_req *cli_setattrE_send(TALLOC_CTX *mem_ctx,
475 struct event_context *ev,
476 struct cli_state *cli,
477 uint16_t fnum,
478 time_t change_time,
479 time_t access_time,
480 time_t write_time);
481 NTSTATUS cli_setattrE_recv(struct tevent_req *req);
482 NTSTATUS cli_setattrE(struct cli_state *cli,
483 uint16_t fnum,
484 time_t change_time,
485 time_t access_time,
486 time_t write_time);
487 struct tevent_req *cli_getatr_send(TALLOC_CTX *mem_ctx,
488 struct event_context *ev,
489 struct cli_state *cli,
490 const char *fname);
491 NTSTATUS cli_getatr_recv(struct tevent_req *req,
492 uint16_t *attr,
493 SMB_OFF_T *size,
494 time_t *write_time);
495 NTSTATUS cli_getatr(struct cli_state *cli,
496 const char *fname,
497 uint16_t *attr,
498 SMB_OFF_T *size,
499 time_t *write_time);
500 struct tevent_req *cli_setatr_send(TALLOC_CTX *mem_ctx,
501 struct event_context *ev,
502 struct cli_state *cli,
503 const char *fname,
504 uint16_t attr,
505 time_t mtime);
506 NTSTATUS cli_setatr_recv(struct tevent_req *req);
507 NTSTATUS cli_setatr(struct cli_state *cli,
508 const char *fname,
509 uint16_t attr,
510 time_t mtime);
511 struct tevent_req *cli_chkpath_send(TALLOC_CTX *mem_ctx,
512 struct event_context *ev,
513 struct cli_state *cli,
514 const char *fname);
515 NTSTATUS cli_chkpath_recv(struct tevent_req *req);
516 NTSTATUS cli_chkpath(struct cli_state *cli, const char *path);
517 struct tevent_req *cli_dskattr_send(TALLOC_CTX *mem_ctx,
518 struct event_context *ev,
519 struct cli_state *cli);
520 NTSTATUS cli_dskattr_recv(struct tevent_req *req, int *bsize, int *total,
521 int *avail);
522 NTSTATUS cli_dskattr(struct cli_state *cli, int *bsize, int *total, int *avail);
523 struct tevent_req *cli_ctemp_send(TALLOC_CTX *mem_ctx,
524 struct event_context *ev,
525 struct cli_state *cli,
526 const char *path);
527 NTSTATUS cli_ctemp_recv(struct tevent_req *req,
528 TALLOC_CTX *ctx,
529 uint16_t *pfnum,
530 char **outfile);
531 NTSTATUS cli_ctemp(struct cli_state *cli,
532 TALLOC_CTX *ctx,
533 const char *path,
534 uint16_t *pfnum,
535 char **out_path);
536 NTSTATUS cli_raw_ioctl(struct cli_state *cli, uint16_t fnum, uint32_t code, DATA_BLOB *blob);
537 NTSTATUS cli_set_ea_path(struct cli_state *cli, const char *path,
538 const char *ea_name, const char *ea_val,
539 size_t ea_len);
540 NTSTATUS cli_set_ea_fnum(struct cli_state *cli, uint16_t fnum,
541 const char *ea_name, const char *ea_val,
542 size_t ea_len);
543 struct tevent_req *cli_get_ea_list_path_send(TALLOC_CTX *mem_ctx,
544 struct tevent_context *ev,
545 struct cli_state *cli,
546 const char *fname);
547 NTSTATUS cli_get_ea_list_path_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
548 size_t *pnum_eas, struct ea_struct **peas);
549 NTSTATUS cli_get_ea_list_path(struct cli_state *cli, const char *path,
550 TALLOC_CTX *ctx,
551 size_t *pnum_eas,
552 struct ea_struct **pea_list);
553 struct tevent_req *cli_posix_open_send(TALLOC_CTX *mem_ctx,
554 struct event_context *ev,
555 struct cli_state *cli,
556 const char *fname,
557 int flags,
558 mode_t mode);
559 NTSTATUS cli_posix_open_recv(struct tevent_req *req, uint16_t *pfnum);
560 NTSTATUS cli_posix_open(struct cli_state *cli, const char *fname,
561 int flags, mode_t mode, uint16_t *fnum);
562 struct tevent_req *cli_posix_mkdir_send(TALLOC_CTX *mem_ctx,
563 struct event_context *ev,
564 struct cli_state *cli,
565 const char *fname,
566 mode_t mode);
567 NTSTATUS cli_posix_mkdir_recv(struct tevent_req *req);
568 NTSTATUS cli_posix_mkdir(struct cli_state *cli, const char *fname, mode_t mode);
570 struct tevent_req *cli_posix_unlink_send(TALLOC_CTX *mem_ctx,
571 struct event_context *ev,
572 struct cli_state *cli,
573 const char *fname);
574 NTSTATUS cli_posix_unlink_recv(struct tevent_req *req);
575 NTSTATUS cli_posix_unlink(struct cli_state *cli, const char *fname);
577 struct tevent_req *cli_posix_rmdir_send(TALLOC_CTX *mem_ctx,
578 struct event_context *ev,
579 struct cli_state *cli,
580 const char *fname);
581 NTSTATUS cli_posix_rmdir_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx);
582 NTSTATUS cli_posix_rmdir(struct cli_state *cli, const char *fname);
583 struct tevent_req *cli_notify_send(TALLOC_CTX *mem_ctx,
584 struct tevent_context *ev,
585 struct cli_state *cli, uint16_t fnum,
586 uint32_t buffer_size,
587 uint32_t completion_filter, bool recursive);
588 NTSTATUS cli_notify_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
589 uint32_t *pnum_changes,
590 struct notify_change **pchanges);
592 struct tevent_req *cli_nttrans_create_send(TALLOC_CTX *mem_ctx,
593 struct event_context *ev,
594 struct cli_state *cli,
595 const char *fname,
596 uint32_t CreatFlags,
597 uint32_t DesiredAccess,
598 uint32_t FileAttributes,
599 uint32_t ShareAccess,
600 uint32_t CreateDisposition,
601 uint32_t CreateOptions,
602 uint8_t SecurityFlags,
603 struct security_descriptor *secdesc,
604 struct ea_struct *eas,
605 int num_eas);
606 NTSTATUS cli_nttrans_create_recv(struct tevent_req *req, uint16_t *fnum);
607 NTSTATUS cli_nttrans_create(struct cli_state *cli,
608 const char *fname,
609 uint32_t CreatFlags,
610 uint32_t DesiredAccess,
611 uint32_t FileAttributes,
612 uint32_t ShareAccess,
613 uint32_t CreateDisposition,
614 uint32_t CreateOptions,
615 uint8_t SecurityFlags,
616 struct security_descriptor *secdesc,
617 struct ea_struct *eas,
618 int num_eas,
619 uint16_t *pfid);
621 /* The following definitions come from libsmb/clifsinfo.c */
623 struct tevent_req *cli_unix_extensions_version_send(TALLOC_CTX *mem_ctx,
624 struct tevent_context *ev,
625 struct cli_state *cli);
626 NTSTATUS cli_unix_extensions_version_recv(struct tevent_req *req,
627 uint16_t *pmajor, uint16_t *pminor,
628 uint32_t *pcaplow,
629 uint32_t *pcaphigh);
630 NTSTATUS cli_unix_extensions_version(struct cli_state *cli, uint16 *pmajor,
631 uint16 *pminor, uint32 *pcaplow,
632 uint32 *pcaphigh);
633 struct tevent_req *cli_set_unix_extensions_capabilities_send(
634 TALLOC_CTX *mem_ctx, struct tevent_context *ev, struct cli_state *cli,
635 uint16_t major, uint16_t minor, uint32_t caplow, uint32_t caphigh);
636 NTSTATUS cli_set_unix_extensions_capabilities_recv(struct tevent_req *req);
637 NTSTATUS cli_set_unix_extensions_capabilities(struct cli_state *cli,
638 uint16 major, uint16 minor,
639 uint32 caplow, uint32 caphigh);
640 struct tevent_req *cli_get_fs_attr_info_send(TALLOC_CTX *mem_ctx,
641 struct tevent_context *ev,
642 struct cli_state *cli);
643 NTSTATUS cli_get_fs_attr_info_recv(struct tevent_req *req, uint32_t *fs_attr);
644 NTSTATUS cli_get_fs_attr_info(struct cli_state *cli, uint32_t *fs_attr);
645 NTSTATUS cli_get_fs_volume_info(struct cli_state *cli,
646 TALLOC_CTX *mem_ctx, char **volume_name,
647 uint32 *pserial_number, time_t *pdate);
648 NTSTATUS cli_get_fs_full_size_info(struct cli_state *cli,
649 uint64_t *total_allocation_units,
650 uint64_t *caller_allocation_units,
651 uint64_t *actual_allocation_units,
652 uint64_t *sectors_per_allocation_unit,
653 uint64_t *bytes_per_sector);
654 NTSTATUS cli_get_posix_fs_info(struct cli_state *cli,
655 uint32 *optimal_transfer_size,
656 uint32 *block_size,
657 uint64_t *total_blocks,
658 uint64_t *blocks_available,
659 uint64_t *user_blocks_available,
660 uint64_t *total_file_nodes,
661 uint64_t *free_file_nodes,
662 uint64_t *fs_identifier);
663 NTSTATUS cli_raw_ntlm_smb_encryption_start(struct cli_state *cli,
664 const char *user,
665 const char *pass,
666 const char *domain);
667 NTSTATUS cli_gss_smb_encryption_start(struct cli_state *cli);
668 NTSTATUS cli_force_encryption(struct cli_state *c,
669 const char *username,
670 const char *password,
671 const char *domain);
673 /* The following definitions come from libsmb/clilist.c */
675 NTSTATUS cli_list_old(struct cli_state *cli,const char *Mask,uint16 attribute,
676 NTSTATUS (*fn)(const char *, struct file_info *,
677 const char *, void *), void *state);
678 NTSTATUS cli_list_trans(struct cli_state *cli, const char *mask,
679 uint16_t attribute, int info_level,
680 NTSTATUS (*fn)(const char *mnt, struct file_info *finfo,
681 const char *mask, void *private_data),
682 void *private_data);
683 struct tevent_req *cli_list_send(TALLOC_CTX *mem_ctx,
684 struct tevent_context *ev,
685 struct cli_state *cli,
686 const char *mask,
687 uint16_t attribute,
688 uint16_t info_level);
689 NTSTATUS cli_list_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
690 struct file_info **finfo, size_t *num_finfo);
691 NTSTATUS cli_list(struct cli_state *cli,const char *Mask,uint16 attribute,
692 NTSTATUS (*fn)(const char *, struct file_info *, const char *,
693 void *), void *state);
695 /* The following definitions come from libsmb/climessage.c */
697 struct tevent_req *cli_message_send(TALLOC_CTX *mem_ctx,
698 struct tevent_context *ev,
699 struct cli_state *cli,
700 const char *host, const char *username,
701 const char *message);
702 NTSTATUS cli_message_recv(struct tevent_req *req);
703 NTSTATUS cli_message(struct cli_state *cli, const char *host,
704 const char *username, const char *message);
706 /* The following definitions come from libsmb/clioplock.c */
708 struct tevent_req *cli_smb_oplock_break_waiter_send(TALLOC_CTX *mem_ctx,
709 struct event_context *ev,
710 struct cli_state *cli);
711 NTSTATUS cli_smb_oplock_break_waiter_recv(struct tevent_req *req,
712 uint16_t *pfnum,
713 uint8_t *plevel);
715 struct tevent_req *cli_oplock_ack_send(TALLOC_CTX *mem_ctx,
716 struct tevent_context *ev,
717 struct cli_state *cli,
718 uint16_t fnum, uint8_t level);
719 NTSTATUS cli_oplock_ack_recv(struct tevent_req *req);
721 /* The following definitions come from libsmb/cliprint.c */
723 int cli_print_queue(struct cli_state *cli,
724 void (*fn)(struct print_job_info *));
725 int cli_printjob_del(struct cli_state *cli, int job);
727 /* The following definitions come from libsmb/cliquota.c */
729 NTSTATUS cli_get_quota_handle(struct cli_state *cli, uint16_t *quota_fnum);
730 void free_ntquota_list(SMB_NTQUOTA_LIST **qt_list);
731 NTSTATUS cli_get_user_quota(struct cli_state *cli, int quota_fnum,
732 SMB_NTQUOTA_STRUCT *pqt);
733 NTSTATUS cli_set_user_quota(struct cli_state *cli, int quota_fnum,
734 SMB_NTQUOTA_STRUCT *pqt);
735 NTSTATUS cli_list_user_quota(struct cli_state *cli, int quota_fnum,
736 SMB_NTQUOTA_LIST **pqt_list);
737 NTSTATUS cli_get_fs_quota_info(struct cli_state *cli, int quota_fnum,
738 SMB_NTQUOTA_STRUCT *pqt);
739 NTSTATUS cli_set_fs_quota_info(struct cli_state *cli, int quota_fnum,
740 SMB_NTQUOTA_STRUCT *pqt);
742 /* The following definitions come from libsmb/clireadwrite.c */
744 struct tevent_req *cli_read_andx_create(TALLOC_CTX *mem_ctx,
745 struct event_context *ev,
746 struct cli_state *cli, uint16_t fnum,
747 off_t offset, size_t size,
748 struct tevent_req **psmbreq);
749 struct tevent_req *cli_read_andx_send(TALLOC_CTX *mem_ctx,
750 struct event_context *ev,
751 struct cli_state *cli, uint16_t fnum,
752 off_t offset, size_t size);
753 NTSTATUS cli_read_andx_recv(struct tevent_req *req, ssize_t *received,
754 uint8_t **rcvbuf);
755 struct tevent_req *cli_pull_send(TALLOC_CTX *mem_ctx,
756 struct event_context *ev,
757 struct cli_state *cli,
758 uint16_t fnum, off_t start_offset,
759 SMB_OFF_T size, size_t window_size,
760 NTSTATUS (*sink)(char *buf, size_t n,
761 void *priv),
762 void *priv);
763 NTSTATUS cli_pull_recv(struct tevent_req *req, SMB_OFF_T *received);
764 NTSTATUS cli_pull(struct cli_state *cli, uint16_t fnum,
765 off_t start_offset, SMB_OFF_T size, size_t window_size,
766 NTSTATUS (*sink)(char *buf, size_t n, void *priv),
767 void *priv, SMB_OFF_T *received);
768 NTSTATUS cli_read(struct cli_state *cli, uint16_t fnum,
769 char *buf, off_t offset, size_t size,
770 size_t *nread);
771 NTSTATUS cli_smbwrite(struct cli_state *cli, uint16_t fnum, char *buf,
772 off_t offset, size_t size1, size_t *ptotal);
773 struct tevent_req *cli_write_andx_create(TALLOC_CTX *mem_ctx,
774 struct event_context *ev,
775 struct cli_state *cli, uint16_t fnum,
776 uint16_t mode, const uint8_t *buf,
777 off_t offset, size_t size,
778 struct tevent_req **reqs_before,
779 int num_reqs_before,
780 struct tevent_req **psmbreq);
781 struct tevent_req *cli_write_andx_send(TALLOC_CTX *mem_ctx,
782 struct event_context *ev,
783 struct cli_state *cli, uint16_t fnum,
784 uint16_t mode, const uint8_t *buf,
785 off_t offset, size_t size);
786 NTSTATUS cli_write_andx_recv(struct tevent_req *req, size_t *pwritten);
788 NTSTATUS cli_writeall(struct cli_state *cli, uint16_t fnum, uint16_t mode,
789 const uint8_t *buf, off_t offset, size_t size,
790 size_t *pwritten);
792 struct tevent_req *cli_push_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
793 struct cli_state *cli,
794 uint16_t fnum, uint16_t mode,
795 off_t start_offset, size_t window_size,
796 size_t (*source)(uint8_t *buf, size_t n,
797 void *priv),
798 void *priv);
799 NTSTATUS cli_push_recv(struct tevent_req *req);
800 NTSTATUS cli_push(struct cli_state *cli, uint16_t fnum, uint16_t mode,
801 off_t start_offset, size_t window_size,
802 size_t (*source)(uint8_t *buf, size_t n, void *priv),
803 void *priv);
805 /* The following definitions come from libsmb/clisecdesc.c */
807 NTSTATUS cli_query_secdesc(struct cli_state *cli, uint16_t fnum,
808 TALLOC_CTX *mem_ctx, struct security_descriptor **sd);
809 NTSTATUS cli_set_secdesc(struct cli_state *cli, uint16_t fnum,
810 const struct security_descriptor *sd);
812 /* The following definitions come from libsmb/clistr.c */
814 size_t clistr_pull_talloc(TALLOC_CTX *ctx,
815 const char *base,
816 uint16_t flags2,
817 char **pp_dest,
818 const void *src,
819 int src_len,
820 int flags);
822 /* The following definitions come from libsmb/clitrans.c */
824 struct tevent_req *cli_trans_send(
825 TALLOC_CTX *mem_ctx, struct tevent_context *ev,
826 struct cli_state *cli, uint8_t cmd,
827 const char *pipe_name, uint16_t fid, uint16_t function, int flags,
828 uint16_t *setup, uint8_t num_setup, uint8_t max_setup,
829 uint8_t *param, uint32_t num_param, uint32_t max_param,
830 uint8_t *data, uint32_t num_data, uint32_t max_data);
831 NTSTATUS cli_trans_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
832 uint16_t *recv_flags2,
833 uint16_t **setup, uint8_t min_setup,
834 uint8_t *num_setup,
835 uint8_t **param, uint32_t min_param,
836 uint32_t *num_param,
837 uint8_t **data, uint32_t min_data,
838 uint32_t *num_data);
839 NTSTATUS cli_trans(TALLOC_CTX *mem_ctx, struct cli_state *cli,
840 uint8_t trans_cmd,
841 const char *pipe_name, uint16_t fid, uint16_t function,
842 int flags,
843 uint16_t *setup, uint8_t num_setup, uint8_t max_setup,
844 uint8_t *param, uint32_t num_param, uint32_t max_param,
845 uint8_t *data, uint32_t num_data, uint32_t max_data,
846 uint16_t *recv_flags2,
847 uint16_t **rsetup, uint8_t min_rsetup, uint8_t *num_rsetup,
848 uint8_t **rparam, uint32_t min_rparam, uint32_t *num_rparam,
849 uint8_t **rdata, uint32_t min_rdata, uint32_t *num_rdata);
851 /* The following definitions come from libsmb/clisigning.c */
853 bool cli_simple_set_signing(struct cli_state *cli,
854 const DATA_BLOB user_session_key,
855 const DATA_BLOB response);
856 void cli_calculate_sign_mac(struct cli_state *cli, char *buf, uint32_t *seqnum);
857 bool cli_check_sign_mac(struct cli_state *cli, const char *buf, uint32_t seqnum);
858 bool client_is_signing_on(struct cli_state *cli);
859 bool client_is_signing_allowed(struct cli_state *cli);
860 bool client_is_signing_mandatory(struct cli_state *cli);
861 bool cli_set_signing_negotiated(struct cli_state *cli,
862 bool allowed, bool mandatory);
864 /* The following definitions come from libsmb/reparse_symlink.c */
866 bool symlink_reparse_buffer_marshall(
867 const char *substitute, const char *printname, uint32_t flags,
868 TALLOC_CTX *mem_ctx, uint8_t **pdst, size_t *pdstlen);
869 bool symlink_reparse_buffer_parse(
870 const uint8_t *src, size_t srclen, TALLOC_CTX *mem_ctx,
871 char **psubstitute_name, char **pprint_name, uint32_t *pflags);
873 /* The following definitions come from libsmb/clisymlink.c */
875 struct tevent_req *cli_symlink_send(TALLOC_CTX *mem_ctx,
876 struct tevent_context *ev,
877 struct cli_state *cli,
878 const char *oldpath,
879 const char *newpath,
880 uint32_t flags);
881 NTSTATUS cli_symlink_recv(struct tevent_req *req);
882 NTSTATUS cli_symlink(struct cli_state *cli, const char *oldname,
883 const char *newname, uint32_t flags);
885 struct tevent_req *cli_readlink_send(TALLOC_CTX *mem_ctx,
886 struct tevent_context *ev,
887 struct cli_state *cli,
888 const char *fname);
889 NTSTATUS cli_readlink_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
890 char **psubstitute_name, char **pprint_name,
891 uint32_t *pflags);
892 NTSTATUS cli_readlink(struct cli_state *cli, const char *fname,
893 TALLOC_CTX *mem_ctx, char **psubstitute_name,
894 char **pprint_name, uint32_t *pflags);
896 #endif /* _LIBSMB_PROTO_H_ */