spoolss: accept XPS_PASS datatype used by Windows 8
[Samba.git] / source3 / libsmb / proto.h
blob3b917a1bbc6747d0f7c23eb2cf6dc7fc42241ee0
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 /* The following definitions come from libsmb/cliconnect.c */
31 ADS_STATUS cli_session_setup_spnego(struct cli_state *cli, const char *user,
32 const char *pass, const char *user_domain,
33 const char * dest_realm);
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);
73 struct tevent_req *cli_negprot_send(TALLOC_CTX *mem_ctx,
74 struct event_context *ev,
75 struct cli_state *cli);
76 NTSTATUS cli_negprot_recv(struct tevent_req *req);
77 bool cli_session_request(struct cli_state *cli,
78 struct nmb_name *calling, struct nmb_name *called);
79 NTSTATUS cli_connect(struct cli_state *cli,
80 const char *host,
81 struct sockaddr_storage *dest_ss);
82 NTSTATUS cli_start_connection(struct cli_state **output_cli,
83 const char *my_name,
84 const char *dest_host,
85 struct sockaddr_storage *dest_ss, int port,
86 int signing_state, int flags);
87 NTSTATUS cli_full_connection(struct cli_state **output_cli,
88 const char *my_name,
89 const char *dest_host,
90 struct sockaddr_storage *dest_ss, int port,
91 const char *service, const char *service_type,
92 const char *user, const char *domain,
93 const char *password, int flags,
94 int signing_state);
95 bool attempt_netbios_session_request(struct cli_state **ppcli, const char *srchost, const char *desthost,
96 struct sockaddr_storage *pdest_ss);
97 NTSTATUS cli_raw_tcon(struct cli_state *cli,
98 const char *service, const char *pass, const char *dev,
99 uint16 *max_xmit, uint16 *tid);
100 struct cli_state *get_ipc_connect(char *server,
101 struct sockaddr_storage *server_ss,
102 const struct user_auth_info *user_info);
103 struct cli_state *get_ipc_connect_master_ip(TALLOC_CTX *ctx,
104 struct sockaddr_storage *mb_ip,
105 const struct user_auth_info *user_info,
106 char **pp_workgroup_out);
107 struct cli_state *get_ipc_connect_master_ip_bcast(TALLOC_CTX *ctx,
108 const struct user_auth_info *user_info,
109 char **pp_workgroup_out);
111 /* The following definitions come from libsmb/clidfs.c */
113 NTSTATUS cli_cm_force_encryption(struct cli_state *c,
114 const char *username,
115 const char *password,
116 const char *domain,
117 const char *sharename);
118 struct cli_state *cli_cm_open(TALLOC_CTX *ctx,
119 struct cli_state *referring_cli,
120 const char *server,
121 const char *share,
122 const struct user_auth_info *auth_info,
123 bool show_hdr,
124 bool force_encrypt,
125 int max_protocol,
126 int port,
127 int name_type);
128 void cli_cm_display(const struct cli_state *c);
129 struct client_dfs_referral;
130 NTSTATUS cli_dfs_get_referral(TALLOC_CTX *ctx,
131 struct cli_state *cli,
132 const char *path,
133 struct client_dfs_referral **refs,
134 size_t *num_refs,
135 size_t *consumed);
136 bool cli_resolve_path(TALLOC_CTX *ctx,
137 const char *mountpt,
138 const struct user_auth_info *dfs_auth_info,
139 struct cli_state *rootcli,
140 const char *path,
141 struct cli_state **targetcli,
142 char **pp_targetpath);
144 bool cli_check_msdfs_proxy(TALLOC_CTX *ctx,
145 struct cli_state *cli,
146 const char *sharename,
147 char **pp_newserver,
148 char **pp_newshare,
149 bool force_encrypt,
150 const char *username,
151 const char *password,
152 const char *domain);
154 /* The following definitions come from libsmb/clientgen.c */
156 int cli_set_message(char *buf,int num_words,int num_bytes,bool zero);
157 unsigned int cli_set_timeout(struct cli_state *cli, unsigned int timeout);
158 void cli_set_port(struct cli_state *cli, int port);
159 bool cli_state_seqnum_persistent(struct cli_state *cli,
160 uint16_t mid);
161 bool cli_state_seqnum_remove(struct cli_state *cli,
162 uint16_t mid);
163 bool cli_receive_smb(struct cli_state *cli);
164 bool cli_send_smb(struct cli_state *cli);
165 void cli_setup_packet_buf(struct cli_state *cli, char *buf);
166 void cli_setup_packet(struct cli_state *cli);
167 void cli_setup_bcc(struct cli_state *cli, void *p);
168 NTSTATUS cli_set_domain(struct cli_state *cli, const char *domain);
169 NTSTATUS cli_set_username(struct cli_state *cli, const char *username);
170 NTSTATUS cli_set_password(struct cli_state *cli, const char *password);
171 NTSTATUS cli_init_creds(struct cli_state *cli, const char *username, const char *domain, const char *password);
172 struct cli_state *cli_initialise(void);
173 struct cli_state *cli_initialise_ex(int signing_state);
174 void cli_nt_pipes_close(struct cli_state *cli);
175 void cli_shutdown(struct cli_state *cli);
176 void cli_sockopt(struct cli_state *cli, const char *options);
177 uint16 cli_setpid(struct cli_state *cli, uint16 pid);
178 bool cli_set_case_sensitive(struct cli_state *cli, bool case_sensitive);
179 struct tevent_req *cli_echo_send(TALLOC_CTX *mem_ctx, struct event_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 cli_ucs2(struct cli_state *cli);
185 bool is_andx_req(uint8_t cmd);
186 NTSTATUS cli_smb(TALLOC_CTX *mem_ctx, struct cli_state *cli,
187 uint8_t smb_command, uint8_t additional_flags,
188 uint8_t wct, uint16_t *vwv,
189 uint32_t num_bytes, const uint8_t *bytes,
190 struct tevent_req **result_parent,
191 uint8_t min_wct, uint8_t *pwct, uint16_t **pvwv,
192 uint32_t *pnum_bytes, uint8_t **pbytes);
194 /* The following definitions come from libsmb/clierror.c */
196 const char *cli_errstr(struct cli_state *cli);
197 NTSTATUS cli_nt_error(struct cli_state *cli);
198 void cli_dos_error(struct cli_state *cli, uint8 *eclass, uint32 *ecode);
199 int cli_errno(struct cli_state *cli);
200 bool cli_is_error(struct cli_state *cli);
201 bool cli_is_nt_error(struct cli_state *cli);
202 bool cli_is_dos_error(struct cli_state *cli);
203 NTSTATUS cli_get_nt_error(struct cli_state *cli);
204 void cli_set_nt_error(struct cli_state *cli, NTSTATUS status);
205 void cli_reset_error(struct cli_state *cli);
206 bool cli_state_is_connected(struct cli_state *cli);
208 /* The following definitions come from libsmb/clifile.c */
210 struct tevent_req *cli_setpathinfo_send(TALLOC_CTX *mem_ctx,
211 struct tevent_context *ev,
212 struct cli_state *cli,
213 uint16_t level,
214 const char *path,
215 uint8_t *data,
216 size_t data_len);
217 NTSTATUS cli_setpathinfo_recv(struct tevent_req *req);
218 NTSTATUS cli_setpathinfo(struct cli_state *cli,
219 uint16_t level,
220 const char *path,
221 uint8_t *data,
222 size_t data_len);
224 struct tevent_req *cli_posix_symlink_send(TALLOC_CTX *mem_ctx,
225 struct event_context *ev,
226 struct cli_state *cli,
227 const char *oldname,
228 const char *newname);
229 NTSTATUS cli_posix_symlink_recv(struct tevent_req *req);
230 NTSTATUS cli_posix_symlink(struct cli_state *cli,
231 const char *oldname,
232 const char *newname);
233 struct tevent_req *cli_posix_readlink_send(TALLOC_CTX *mem_ctx,
234 struct event_context *ev,
235 struct cli_state *cli,
236 const char *fname,
237 size_t len);
238 NTSTATUS cli_posix_readlink_recv(struct tevent_req *req, struct cli_state *cli,
239 char *retpath, size_t len);
240 NTSTATUS cli_posix_readlink(struct cli_state *cli, const char *fname,
241 char *linkpath, size_t len);
242 struct tevent_req *cli_posix_hardlink_send(TALLOC_CTX *mem_ctx,
243 struct event_context *ev,
244 struct cli_state *cli,
245 const char *oldname,
246 const char *newname);
247 NTSTATUS cli_posix_hardlink_recv(struct tevent_req *req);
248 NTSTATUS cli_posix_hardlink(struct cli_state *cli,
249 const char *oldname,
250 const char *newname);
251 uint32_t unix_perms_to_wire(mode_t perms);
252 mode_t wire_perms_to_unix(uint32_t perms);
253 struct tevent_req *cli_posix_getfacl_send(TALLOC_CTX *mem_ctx,
254 struct event_context *ev,
255 struct cli_state *cli,
256 const char *fname);
257 NTSTATUS cli_posix_getfacl_recv(struct tevent_req *req,
258 TALLOC_CTX *mem_ctx,
259 size_t *prb_size,
260 char **retbuf);
261 NTSTATUS cli_posix_getfacl(struct cli_state *cli,
262 const char *fname,
263 TALLOC_CTX *mem_ctx,
264 size_t *prb_size,
265 char **retbuf);
266 struct tevent_req *cli_posix_stat_send(TALLOC_CTX *mem_ctx,
267 struct event_context *ev,
268 struct cli_state *cli,
269 const char *fname);
270 NTSTATUS cli_posix_stat_recv(struct tevent_req *req,
271 SMB_STRUCT_STAT *sbuf);
272 NTSTATUS cli_posix_stat(struct cli_state *cli,
273 const char *fname,
274 SMB_STRUCT_STAT *sbuf);
275 struct tevent_req *cli_posix_chmod_send(TALLOC_CTX *mem_ctx,
276 struct event_context *ev,
277 struct cli_state *cli,
278 const char *fname,
279 mode_t mode);
280 NTSTATUS cli_posix_chmod_recv(struct tevent_req *req);
281 NTSTATUS cli_posix_chmod(struct cli_state *cli, const char *fname, mode_t mode);
282 struct tevent_req *cli_posix_chown_send(TALLOC_CTX *mem_ctx,
283 struct event_context *ev,
284 struct cli_state *cli,
285 const char *fname,
286 uid_t uid,
287 gid_t gid);
288 NTSTATUS cli_posix_chown_recv(struct tevent_req *req);
289 NTSTATUS cli_posix_chown(struct cli_state *cli,
290 const char *fname,
291 uid_t uid,
292 gid_t gid);
293 struct tevent_req *cli_rename_send(TALLOC_CTX *mem_ctx,
294 struct event_context *ev,
295 struct cli_state *cli,
296 const char *fname_src,
297 const char *fname_dst);
298 NTSTATUS cli_rename_recv(struct tevent_req *req);
299 NTSTATUS cli_rename(struct cli_state *cli, const char *fname_src, const char *fname_dst);
300 struct tevent_req *cli_ntrename_send(TALLOC_CTX *mem_ctx,
301 struct event_context *ev,
302 struct cli_state *cli,
303 const char *fname_src,
304 const char *fname_dst);
305 NTSTATUS cli_ntrename_recv(struct tevent_req *req);
306 NTSTATUS cli_ntrename(struct cli_state *cli, const char *fname_src, const char *fname_dst);
308 struct tevent_req *cli_nt_hardlink_send(TALLOC_CTX *mem_ctx,
309 struct event_context *ev,
310 struct cli_state *cli,
311 const char *fname_src,
312 const char *fname_dst);
313 NTSTATUS cli_nt_hardlink_recv(struct tevent_req *req);
314 NTSTATUS cli_nt_hardlink(struct cli_state *cli, const char *fname_src, const char *fname_dst);
316 struct tevent_req *cli_unlink_send(TALLOC_CTX *mem_ctx,
317 struct event_context *ev,
318 struct cli_state *cli,
319 const char *fname,
320 uint16_t mayhave_attrs);
321 NTSTATUS cli_unlink_recv(struct tevent_req *req);
322 NTSTATUS cli_unlink(struct cli_state *cli, const char *fname, uint16_t mayhave_attrs);
324 struct tevent_req *cli_mkdir_send(TALLOC_CTX *mem_ctx,
325 struct event_context *ev,
326 struct cli_state *cli,
327 const char *dname);
328 NTSTATUS cli_mkdir_recv(struct tevent_req *req);
329 NTSTATUS cli_mkdir(struct cli_state *cli, const char *dname);
330 struct tevent_req *cli_rmdir_send(TALLOC_CTX *mem_ctx,
331 struct event_context *ev,
332 struct cli_state *cli,
333 const char *dname);
334 NTSTATUS cli_rmdir_recv(struct tevent_req *req);
335 NTSTATUS cli_rmdir(struct cli_state *cli, const char *dname);
336 struct tevent_req *cli_nt_delete_on_close_send(TALLOC_CTX *mem_ctx,
337 struct event_context *ev,
338 struct cli_state *cli,
339 uint16_t fnum,
340 bool flag);
341 NTSTATUS cli_nt_delete_on_close_recv(struct tevent_req *req);
342 NTSTATUS cli_nt_delete_on_close(struct cli_state *cli, uint16_t fnum, bool flag);
343 struct tevent_req *cli_ntcreate_send(TALLOC_CTX *mem_ctx,
344 struct event_context *ev,
345 struct cli_state *cli,
346 const char *fname,
347 uint32_t CreatFlags,
348 uint32_t DesiredAccess,
349 uint32_t FileAttributes,
350 uint32_t ShareAccess,
351 uint32_t CreateDisposition,
352 uint32_t CreateOptions,
353 uint8_t SecurityFlags);
354 NTSTATUS cli_ntcreate_recv(struct tevent_req *req, uint16_t *pfnum);
355 NTSTATUS cli_ntcreate(struct cli_state *cli,
356 const char *fname,
357 uint32_t CreatFlags,
358 uint32_t DesiredAccess,
359 uint32_t FileAttributes,
360 uint32_t ShareAccess,
361 uint32_t CreateDisposition,
362 uint32_t CreateOptions,
363 uint8_t SecurityFlags,
364 uint16_t *pfid);
365 uint8_t *smb_bytes_push_str(uint8_t *buf, bool ucs2, const char *str,
366 size_t str_len, size_t *pconverted_size);
367 uint8_t *smb_bytes_push_bytes(uint8_t *buf, uint8_t prefix,
368 const uint8_t *bytes, size_t num_bytes);
369 struct tevent_req *cli_open_create(TALLOC_CTX *mem_ctx,
370 struct event_context *ev,
371 struct cli_state *cli, const char *fname,
372 int flags, int share_mode,
373 struct tevent_req **psmbreq);
374 struct tevent_req *cli_open_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
375 struct cli_state *cli, const char *fname,
376 int flags, int share_mode);
377 NTSTATUS cli_open_recv(struct tevent_req *req, uint16_t *fnum);
378 NTSTATUS cli_open(struct cli_state *cli, const char *fname, int flags, int share_mode, uint16_t *pfnum);
379 struct tevent_req *cli_close_create(TALLOC_CTX *mem_ctx,
380 struct event_context *ev,
381 struct cli_state *cli, uint16_t fnum,
382 struct tevent_req **psubreq);
383 struct tevent_req *cli_close_send(TALLOC_CTX *mem_ctx,
384 struct event_context *ev,
385 struct cli_state *cli, uint16_t fnum);
386 NTSTATUS cli_close_recv(struct tevent_req *req);
387 NTSTATUS cli_close(struct cli_state *cli, uint16_t fnum);
388 struct tevent_req *cli_ftruncate_send(TALLOC_CTX *mem_ctx,
389 struct event_context *ev,
390 struct cli_state *cli,
391 uint16_t fnum,
392 uint64_t size);
393 NTSTATUS cli_ftruncate_recv(struct tevent_req *req);
394 NTSTATUS cli_ftruncate(struct cli_state *cli, uint16_t fnum, uint64_t size);
395 NTSTATUS cli_locktype(struct cli_state *cli, uint16_t fnum,
396 uint32_t offset, uint32_t len,
397 int timeout, unsigned char locktype);
398 bool cli_lock(struct cli_state *cli, uint16_t fnum,
399 uint32_t offset, uint32_t len, int timeout, enum brl_type lock_type);
400 struct tevent_req *cli_unlock_send(TALLOC_CTX *mem_ctx,
401 struct event_context *ev,
402 struct cli_state *cli,
403 uint16_t fnum,
404 uint64_t offset,
405 uint64_t len);
406 NTSTATUS cli_unlock_recv(struct tevent_req *req);
407 NTSTATUS cli_unlock(struct cli_state *cli, uint16_t fnum, uint32_t offset, uint32_t len);
408 bool cli_lock64(struct cli_state *cli, uint16_t fnum,
409 uint64_t offset, uint64_t len, int timeout, enum brl_type lock_type);
410 struct tevent_req *cli_unlock64_send(TALLOC_CTX *mem_ctx,
411 struct event_context *ev,
412 struct cli_state *cli,
413 uint16_t fnum,
414 uint64_t offset,
415 uint64_t len);
416 NTSTATUS cli_unlock64_recv(struct tevent_req *req);
417 NTSTATUS cli_unlock64(struct cli_state *cli, uint16_t fnum, uint64_t offset, uint64_t len);
418 struct tevent_req *cli_posix_lock_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 bool wait_lock,
425 enum brl_type lock_type);
426 NTSTATUS cli_posix_lock_recv(struct tevent_req *req);
427 NTSTATUS cli_posix_lock(struct cli_state *cli, uint16_t fnum,
428 uint64_t offset, uint64_t len,
429 bool wait_lock, enum brl_type lock_type);
430 struct tevent_req *cli_posix_unlock_send(TALLOC_CTX *mem_ctx,
431 struct event_context *ev,
432 struct cli_state *cli,
433 uint16_t fnum,
434 uint64_t offset,
435 uint64_t len);
436 NTSTATUS cli_posix_unlock_recv(struct tevent_req *req);
437 NTSTATUS cli_posix_unlock(struct cli_state *cli, uint16_t fnum, uint64_t offset, uint64_t len);
438 struct tevent_req *cli_getattrE_send(TALLOC_CTX *mem_ctx,
439 struct event_context *ev,
440 struct cli_state *cli,
441 uint16_t fnum);
442 NTSTATUS cli_getattrE_recv(struct tevent_req *req,
443 uint16_t *attr,
444 SMB_OFF_T *size,
445 time_t *change_time,
446 time_t *access_time,
447 time_t *write_time);
448 NTSTATUS cli_getattrE(struct cli_state *cli,
449 uint16_t fnum,
450 uint16_t *attr,
451 SMB_OFF_T *size,
452 time_t *change_time,
453 time_t *access_time,
454 time_t *write_time);
455 struct tevent_req *cli_setattrE_send(TALLOC_CTX *mem_ctx,
456 struct event_context *ev,
457 struct cli_state *cli,
458 uint16_t fnum,
459 time_t change_time,
460 time_t access_time,
461 time_t write_time);
462 NTSTATUS cli_setattrE_recv(struct tevent_req *req);
463 NTSTATUS cli_setattrE(struct cli_state *cli,
464 uint16_t fnum,
465 time_t change_time,
466 time_t access_time,
467 time_t write_time);
468 struct tevent_req *cli_getatr_send(TALLOC_CTX *mem_ctx,
469 struct event_context *ev,
470 struct cli_state *cli,
471 const char *fname);
472 NTSTATUS cli_getatr_recv(struct tevent_req *req,
473 uint16_t *attr,
474 SMB_OFF_T *size,
475 time_t *write_time);
476 NTSTATUS cli_getatr(struct cli_state *cli,
477 const char *fname,
478 uint16_t *attr,
479 SMB_OFF_T *size,
480 time_t *write_time);
481 struct tevent_req *cli_setatr_send(TALLOC_CTX *mem_ctx,
482 struct event_context *ev,
483 struct cli_state *cli,
484 const char *fname,
485 uint16_t attr,
486 time_t mtime);
487 NTSTATUS cli_setatr_recv(struct tevent_req *req);
488 NTSTATUS cli_setatr(struct cli_state *cli,
489 const char *fname,
490 uint16_t attr,
491 time_t mtime);
492 struct tevent_req *cli_chkpath_send(TALLOC_CTX *mem_ctx,
493 struct event_context *ev,
494 struct cli_state *cli,
495 const char *fname);
496 NTSTATUS cli_chkpath_recv(struct tevent_req *req);
497 NTSTATUS cli_chkpath(struct cli_state *cli, const char *path);
498 struct tevent_req *cli_dskattr_send(TALLOC_CTX *mem_ctx,
499 struct event_context *ev,
500 struct cli_state *cli);
501 NTSTATUS cli_dskattr_recv(struct tevent_req *req, int *bsize, int *total,
502 int *avail);
503 NTSTATUS cli_dskattr(struct cli_state *cli, int *bsize, int *total, int *avail);
504 struct tevent_req *cli_ctemp_send(TALLOC_CTX *mem_ctx,
505 struct event_context *ev,
506 struct cli_state *cli,
507 const char *path);
508 NTSTATUS cli_ctemp_recv(struct tevent_req *req,
509 TALLOC_CTX *ctx,
510 uint16_t *pfnum,
511 char **outfile);
512 NTSTATUS cli_ctemp(struct cli_state *cli,
513 TALLOC_CTX *ctx,
514 const char *path,
515 uint16_t *pfnum,
516 char **out_path);
517 NTSTATUS cli_raw_ioctl(struct cli_state *cli, uint16_t fnum, uint32_t code, DATA_BLOB *blob);
518 NTSTATUS cli_set_ea_path(struct cli_state *cli, const char *path,
519 const char *ea_name, const char *ea_val,
520 size_t ea_len);
521 NTSTATUS cli_set_ea_fnum(struct cli_state *cli, uint16_t fnum,
522 const char *ea_name, const char *ea_val,
523 size_t ea_len);
524 struct tevent_req *cli_get_ea_list_path_send(TALLOC_CTX *mem_ctx,
525 struct tevent_context *ev,
526 struct cli_state *cli,
527 const char *fname);
528 NTSTATUS cli_get_ea_list_path_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
529 size_t *pnum_eas, struct ea_struct **peas);
530 NTSTATUS cli_get_ea_list_path(struct cli_state *cli, const char *path,
531 TALLOC_CTX *ctx,
532 size_t *pnum_eas,
533 struct ea_struct **pea_list);
534 struct tevent_req *cli_posix_open_send(TALLOC_CTX *mem_ctx,
535 struct event_context *ev,
536 struct cli_state *cli,
537 const char *fname,
538 int flags,
539 mode_t mode);
540 NTSTATUS cli_posix_open_recv(struct tevent_req *req, uint16_t *pfnum);
541 NTSTATUS cli_posix_open(struct cli_state *cli, const char *fname,
542 int flags, mode_t mode, uint16_t *fnum);
543 struct tevent_req *cli_posix_mkdir_send(TALLOC_CTX *mem_ctx,
544 struct event_context *ev,
545 struct cli_state *cli,
546 const char *fname,
547 mode_t mode);
548 NTSTATUS cli_posix_mkdir_recv(struct tevent_req *req);
549 NTSTATUS cli_posix_mkdir(struct cli_state *cli, const char *fname, mode_t mode);
551 struct tevent_req *cli_posix_unlink_send(TALLOC_CTX *mem_ctx,
552 struct event_context *ev,
553 struct cli_state *cli,
554 const char *fname);
555 NTSTATUS cli_posix_unlink_recv(struct tevent_req *req);
556 NTSTATUS cli_posix_unlink(struct cli_state *cli, const char *fname);
558 struct tevent_req *cli_posix_rmdir_send(TALLOC_CTX *mem_ctx,
559 struct event_context *ev,
560 struct cli_state *cli,
561 const char *fname);
562 NTSTATUS cli_posix_rmdir_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx);
563 NTSTATUS cli_posix_rmdir(struct cli_state *cli, const char *fname);
564 struct tevent_req *cli_notify_send(TALLOC_CTX *mem_ctx,
565 struct tevent_context *ev,
566 struct cli_state *cli, uint16_t fnum,
567 uint32_t buffer_size,
568 uint32_t completion_filter, bool recursive);
569 NTSTATUS cli_notify_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
570 uint32_t *pnum_changes,
571 struct notify_change **pchanges);
573 /* The following definitions come from libsmb/clifsinfo.c */
575 struct tevent_req *cli_unix_extensions_version_send(TALLOC_CTX *mem_ctx,
576 struct tevent_context *ev,
577 struct cli_state *cli);
578 NTSTATUS cli_unix_extensions_version_recv(struct tevent_req *req,
579 uint16_t *pmajor, uint16_t *pminor,
580 uint32_t *pcaplow,
581 uint32_t *pcaphigh);
582 NTSTATUS cli_unix_extensions_version(struct cli_state *cli, uint16 *pmajor,
583 uint16 *pminor, uint32 *pcaplow,
584 uint32 *pcaphigh);
585 struct tevent_req *cli_set_unix_extensions_capabilities_send(
586 TALLOC_CTX *mem_ctx, struct tevent_context *ev, struct cli_state *cli,
587 uint16_t major, uint16_t minor, uint32_t caplow, uint32_t caphigh);
588 NTSTATUS cli_set_unix_extensions_capabilities_recv(struct tevent_req *req);
589 NTSTATUS cli_set_unix_extensions_capabilities(struct cli_state *cli,
590 uint16 major, uint16 minor,
591 uint32 caplow, uint32 caphigh);
592 struct tevent_req *cli_get_fs_attr_info_send(TALLOC_CTX *mem_ctx,
593 struct tevent_context *ev,
594 struct cli_state *cli);
595 NTSTATUS cli_get_fs_attr_info_recv(struct tevent_req *req, uint32_t *fs_attr);
596 NTSTATUS cli_get_fs_attr_info(struct cli_state *cli, uint32_t *fs_attr);
597 NTSTATUS cli_get_fs_volume_info(struct cli_state *cli, fstring volume_name,
598 uint32 *pserial_number, time_t *pdate);
599 NTSTATUS cli_get_fs_full_size_info(struct cli_state *cli,
600 uint64_t *total_allocation_units,
601 uint64_t *caller_allocation_units,
602 uint64_t *actual_allocation_units,
603 uint64_t *sectors_per_allocation_unit,
604 uint64_t *bytes_per_sector);
605 NTSTATUS cli_get_posix_fs_info(struct cli_state *cli,
606 uint32 *optimal_transfer_size,
607 uint32 *block_size,
608 uint64_t *total_blocks,
609 uint64_t *blocks_available,
610 uint64_t *user_blocks_available,
611 uint64_t *total_file_nodes,
612 uint64_t *free_file_nodes,
613 uint64_t *fs_identifier);
614 NTSTATUS cli_raw_ntlm_smb_encryption_start(struct cli_state *cli,
615 const char *user,
616 const char *pass,
617 const char *domain);
618 NTSTATUS cli_gss_smb_encryption_start(struct cli_state *cli);
619 NTSTATUS cli_force_encryption(struct cli_state *c,
620 const char *username,
621 const char *password,
622 const char *domain);
624 /* The following definitions come from libsmb/clilist.c */
626 NTSTATUS cli_list_old(struct cli_state *cli,const char *Mask,uint16 attribute,
627 NTSTATUS (*fn)(const char *, struct file_info *,
628 const char *, void *), void *state);
629 NTSTATUS cli_list_trans(struct cli_state *cli, const char *mask,
630 uint16_t attribute, int info_level,
631 NTSTATUS (*fn)(const char *mnt, struct file_info *finfo,
632 const char *mask, void *private_data),
633 void *private_data);
634 struct tevent_req *cli_list_send(TALLOC_CTX *mem_ctx,
635 struct tevent_context *ev,
636 struct cli_state *cli,
637 const char *mask,
638 uint16_t attribute,
639 uint16_t info_level);
640 NTSTATUS cli_list_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
641 struct file_info **finfo, size_t *num_finfo);
642 NTSTATUS cli_list(struct cli_state *cli,const char *Mask,uint16 attribute,
643 NTSTATUS (*fn)(const char *, struct file_info *, const char *,
644 void *), void *state);
646 /* The following definitions come from libsmb/climessage.c */
648 struct tevent_req *cli_message_send(TALLOC_CTX *mem_ctx,
649 struct tevent_context *ev,
650 struct cli_state *cli,
651 const char *host, const char *username,
652 const char *message);
653 NTSTATUS cli_message_recv(struct tevent_req *req);
654 NTSTATUS cli_message(struct cli_state *cli, const char *host,
655 const char *username, const char *message);
657 /* The following definitions come from libsmb/clioplock.c */
659 struct tevent_req *cli_oplock_ack_send(TALLOC_CTX *mem_ctx,
660 struct tevent_context *ev,
661 struct cli_state *cli,
662 uint16_t fnum, uint8_t level);
663 NTSTATUS cli_oplock_ack_recv(struct tevent_req *req);
664 NTSTATUS cli_oplock_ack(struct cli_state *cli, uint16_t fnum, unsigned char level);
665 void cli_oplock_handler(struct cli_state *cli,
666 NTSTATUS (*handler)(struct cli_state *, uint16_t, unsigned char));
668 /* The following definitions come from libsmb/cliprint.c */
670 int cli_print_queue(struct cli_state *cli,
671 void (*fn)(struct print_job_info *));
672 int cli_printjob_del(struct cli_state *cli, int job);
674 /* The following definitions come from libsmb/cliquota.c */
676 NTSTATUS cli_get_quota_handle(struct cli_state *cli, uint16_t *quota_fnum);
677 void free_ntquota_list(SMB_NTQUOTA_LIST **qt_list);
678 NTSTATUS cli_get_user_quota(struct cli_state *cli, int quota_fnum,
679 SMB_NTQUOTA_STRUCT *pqt);
680 NTSTATUS cli_set_user_quota(struct cli_state *cli, int quota_fnum,
681 SMB_NTQUOTA_STRUCT *pqt);
682 NTSTATUS cli_list_user_quota(struct cli_state *cli, int quota_fnum,
683 SMB_NTQUOTA_LIST **pqt_list);
684 NTSTATUS cli_get_fs_quota_info(struct cli_state *cli, int quota_fnum,
685 SMB_NTQUOTA_STRUCT *pqt);
686 NTSTATUS cli_set_fs_quota_info(struct cli_state *cli, int quota_fnum,
687 SMB_NTQUOTA_STRUCT *pqt);
689 /* The following definitions come from libsmb/clireadwrite.c */
691 struct tevent_req *cli_read_andx_create(TALLOC_CTX *mem_ctx,
692 struct event_context *ev,
693 struct cli_state *cli, uint16_t fnum,
694 off_t offset, size_t size,
695 struct tevent_req **psmbreq);
696 struct tevent_req *cli_read_andx_send(TALLOC_CTX *mem_ctx,
697 struct event_context *ev,
698 struct cli_state *cli, uint16_t fnum,
699 off_t offset, size_t size);
700 NTSTATUS cli_read_andx_recv(struct tevent_req *req, ssize_t *received,
701 uint8_t **rcvbuf);
702 struct tevent_req *cli_pull_send(TALLOC_CTX *mem_ctx,
703 struct event_context *ev,
704 struct cli_state *cli,
705 uint16_t fnum, off_t start_offset,
706 SMB_OFF_T size, size_t window_size,
707 NTSTATUS (*sink)(char *buf, size_t n,
708 void *priv),
709 void *priv);
710 NTSTATUS cli_pull_recv(struct tevent_req *req, SMB_OFF_T *received);
711 NTSTATUS cli_pull(struct cli_state *cli, uint16_t fnum,
712 off_t start_offset, SMB_OFF_T size, size_t window_size,
713 NTSTATUS (*sink)(char *buf, size_t n, void *priv),
714 void *priv, SMB_OFF_T *received);
715 ssize_t cli_read(struct cli_state *cli, uint16_t fnum, char *buf,
716 off_t offset, size_t size);
717 NTSTATUS cli_smbwrite(struct cli_state *cli, uint16_t fnum, char *buf,
718 off_t offset, size_t size1, size_t *ptotal);
719 struct tevent_req *cli_write_andx_create(TALLOC_CTX *mem_ctx,
720 struct event_context *ev,
721 struct cli_state *cli, uint16_t fnum,
722 uint16_t mode, const uint8_t *buf,
723 off_t offset, size_t size,
724 struct tevent_req **reqs_before,
725 int num_reqs_before,
726 struct tevent_req **psmbreq);
727 struct tevent_req *cli_write_andx_send(TALLOC_CTX *mem_ctx,
728 struct event_context *ev,
729 struct cli_state *cli, uint16_t fnum,
730 uint16_t mode, const uint8_t *buf,
731 off_t offset, size_t size);
732 NTSTATUS cli_write_andx_recv(struct tevent_req *req, size_t *pwritten);
734 NTSTATUS cli_writeall(struct cli_state *cli, uint16_t fnum, uint16_t mode,
735 const uint8_t *buf, off_t offset, size_t size,
736 size_t *pwritten);
738 struct tevent_req *cli_push_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
739 struct cli_state *cli,
740 uint16_t fnum, uint16_t mode,
741 off_t start_offset, size_t window_size,
742 size_t (*source)(uint8_t *buf, size_t n,
743 void *priv),
744 void *priv);
745 NTSTATUS cli_push_recv(struct tevent_req *req);
746 NTSTATUS cli_push(struct cli_state *cli, uint16_t fnum, uint16_t mode,
747 off_t start_offset, size_t window_size,
748 size_t (*source)(uint8_t *buf, size_t n, void *priv),
749 void *priv);
751 /* The following definitions come from libsmb/clisecdesc.c */
753 struct security_descriptor *cli_query_secdesc(struct cli_state *cli, uint16_t fnum,
754 TALLOC_CTX *mem_ctx);
755 NTSTATUS cli_set_secdesc(struct cli_state *cli, uint16_t fnum,
756 struct security_descriptor *sd);
758 /* The following definitions come from libsmb/clistr.c */
760 size_t clistr_push_fn(const char *function,
761 unsigned int line,
762 struct cli_state *cli,
763 void *dest,
764 const char *src,
765 int dest_len,
766 int flags);
767 size_t clistr_pull_fn(const char *function,
768 unsigned int line,
769 const char *inbuf,
770 char *dest,
771 const void *src,
772 int dest_len,
773 int src_len,
774 int flags);
775 size_t clistr_pull_talloc_fn(const char *function,
776 unsigned int line,
777 TALLOC_CTX *ctx,
778 const char *base,
779 uint16_t flags2,
780 char **pp_dest,
781 const void *src,
782 int src_len,
783 int flags);
784 size_t clistr_align_out(struct cli_state *cli, const void *p, int flags);
786 /* The following definitions come from libsmb/clitrans.c */
788 struct tevent_req *cli_trans_send(
789 TALLOC_CTX *mem_ctx, struct event_context *ev,
790 struct cli_state *cli, uint8_t cmd,
791 const char *pipe_name, uint16_t fid, uint16_t function, int flags,
792 uint16_t *setup, uint8_t num_setup, uint8_t max_setup,
793 uint8_t *param, uint32_t num_param, uint32_t max_param,
794 uint8_t *data, uint32_t num_data, uint32_t max_data);
795 NTSTATUS cli_trans_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
796 uint16_t *recv_flags2,
797 uint16_t **setup, uint8_t min_setup,
798 uint8_t *num_setup,
799 uint8_t **param, uint32_t min_param,
800 uint32_t *num_param,
801 uint8_t **data, uint32_t min_data,
802 uint32_t *num_data);
803 NTSTATUS cli_trans(TALLOC_CTX *mem_ctx, struct cli_state *cli,
804 uint8_t trans_cmd,
805 const char *pipe_name, uint16_t fid, uint16_t function,
806 int flags,
807 uint16_t *setup, uint8_t num_setup, uint8_t max_setup,
808 uint8_t *param, uint32_t num_param, uint32_t max_param,
809 uint8_t *data, uint32_t num_data, uint32_t max_data,
810 uint16_t *recv_flags2,
811 uint16_t **rsetup, uint8_t min_rsetup, uint8_t *num_rsetup,
812 uint8_t **rparam, uint32_t min_rparam, uint32_t *num_rparam,
813 uint8_t **rdata, uint32_t min_rdata, uint32_t *num_rdata);
815 /* The following definitions come from libsmb/smb_seal.c */
817 NTSTATUS get_enc_ctx_num(const uint8_t *buf, uint16 *p_enc_ctx_num);
818 bool common_encryption_on(struct smb_trans_enc_state *es);
819 NTSTATUS common_ntlm_decrypt_buffer(struct ntlmssp_state *ntlmssp_state, char *buf);
820 NTSTATUS common_ntlm_encrypt_buffer(struct ntlmssp_state *ntlmssp_state,
821 uint16 enc_ctx_num,
822 char *buf,
823 char **ppbuf_out);
824 NTSTATUS common_encrypt_buffer(struct smb_trans_enc_state *es, char *buffer, char **buf_out);
825 NTSTATUS common_decrypt_buffer(struct smb_trans_enc_state *es, char *buf);
826 void common_free_encryption_state(struct smb_trans_enc_state **pp_es);
827 void common_free_enc_buffer(struct smb_trans_enc_state *es, char *buf);
828 bool cli_encryption_on(struct cli_state *cli);
829 void cli_free_encryption_context(struct cli_state *cli);
830 void cli_free_enc_buffer(struct cli_state *cli, char *buf);
831 NTSTATUS cli_decrypt_message(struct cli_state *cli);
832 NTSTATUS cli_encrypt_message(struct cli_state *cli, char *buf, char **buf_out);
834 /* The following definitions come from libsmb/clisigning.c */
836 bool cli_simple_set_signing(struct cli_state *cli,
837 const DATA_BLOB user_session_key,
838 const DATA_BLOB response);
839 bool cli_temp_set_signing(struct cli_state *cli);
840 void cli_calculate_sign_mac(struct cli_state *cli, char *buf, uint32_t *seqnum);
841 bool cli_check_sign_mac(struct cli_state *cli, const char *buf, uint32_t seqnum);
842 bool client_is_signing_on(struct cli_state *cli);
843 bool client_is_signing_allowed(struct cli_state *cli);
844 bool client_is_signing_mandatory(struct cli_state *cli);
845 void cli_set_signing_negotiated(struct cli_state *cli);
847 #endif /* _LIBSMB_PROTO_H_ */