s3: Remove unused cli_setup_bcc
[Samba.git] / source3 / libsmb / proto.h
blob2da632ec36b6491458c0d59a8bc165b8025114d7
1 /*
2 Unix SMB/CIFS implementation.
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 3 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>.
18 #ifndef _LIBSMB_PROTO_H_
19 #define _LIBSMB_PROTO_H_
21 #include "ads.h"
23 /* The following definitions come from libsmb/cliconnect.c */
25 ADS_STATUS cli_session_setup_spnego(struct cli_state *cli, const char *user,
26 const char *pass, const char *user_domain,
27 const char * dest_realm);
29 NTSTATUS cli_session_setup(struct cli_state *cli,
30 const char *user,
31 const char *pass, int passlen,
32 const char *ntpass, int ntpasslen,
33 const char *workgroup);
34 struct tevent_req *cli_session_setup_guest_create(TALLOC_CTX *mem_ctx,
35 struct event_context *ev,
36 struct cli_state *cli,
37 struct tevent_req **psmbreq);
38 struct tevent_req *cli_session_setup_guest_send(TALLOC_CTX *mem_ctx,
39 struct event_context *ev,
40 struct cli_state *cli);
41 NTSTATUS cli_session_setup_guest_recv(struct tevent_req *req);
42 struct tevent_req *cli_ulogoff_send(TALLOC_CTX *mem_ctx,
43 struct tevent_context *ev,
44 struct cli_state *cli);
45 NTSTATUS cli_ulogoff_recv(struct tevent_req *req);
46 NTSTATUS cli_ulogoff(struct cli_state *cli);
47 struct tevent_req *cli_tcon_andx_create(TALLOC_CTX *mem_ctx,
48 struct event_context *ev,
49 struct cli_state *cli,
50 const char *share, const char *dev,
51 const char *pass, int passlen,
52 struct tevent_req **psmbreq);
53 struct tevent_req *cli_tcon_andx_send(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 NTSTATUS cli_tcon_andx_recv(struct tevent_req *req);
59 NTSTATUS cli_tcon_andx(struct cli_state *cli, const char *share,
60 const char *dev, const char *pass, int passlen);
61 struct tevent_req *cli_tdis_send(TALLOC_CTX *mem_ctx,
62 struct tevent_context *ev,
63 struct cli_state *cli);
64 NTSTATUS cli_tdis_recv(struct tevent_req *req);
65 NTSTATUS cli_tdis(struct cli_state *cli);
66 NTSTATUS cli_negprot(struct cli_state *cli);
67 struct tevent_req *cli_negprot_send(TALLOC_CTX *mem_ctx,
68 struct event_context *ev,
69 struct cli_state *cli);
70 NTSTATUS cli_negprot_recv(struct tevent_req *req);
71 bool cli_session_request(struct cli_state *cli,
72 struct nmb_name *calling, struct nmb_name *called);
73 NTSTATUS cli_connect(struct cli_state *cli,
74 const char *host,
75 struct sockaddr_storage *dest_ss);
76 NTSTATUS cli_start_connection(struct cli_state **output_cli,
77 const char *my_name,
78 const char *dest_host,
79 struct sockaddr_storage *dest_ss, int port,
80 int signing_state, int flags);
81 NTSTATUS cli_full_connection(struct cli_state **output_cli,
82 const char *my_name,
83 const char *dest_host,
84 struct sockaddr_storage *dest_ss, int port,
85 const char *service, const char *service_type,
86 const char *user, const char *domain,
87 const char *password, int flags,
88 int signing_state);
89 bool attempt_netbios_session_request(struct cli_state **ppcli, const char *srchost, const char *desthost,
90 struct sockaddr_storage *pdest_ss);
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 struct cli_state *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 void cli_cm_display(const struct cli_state *c);
123 struct client_dfs_referral;
124 NTSTATUS cli_dfs_get_referral(TALLOC_CTX *ctx,
125 struct cli_state *cli,
126 const char *path,
127 struct client_dfs_referral **refs,
128 size_t *num_refs,
129 size_t *consumed);
130 bool cli_resolve_path(TALLOC_CTX *ctx,
131 const char *mountpt,
132 const struct user_auth_info *dfs_auth_info,
133 struct cli_state *rootcli,
134 const char *path,
135 struct cli_state **targetcli,
136 char **pp_targetpath);
138 bool cli_check_msdfs_proxy(TALLOC_CTX *ctx,
139 struct cli_state *cli,
140 const char *sharename,
141 char **pp_newserver,
142 char **pp_newshare,
143 bool force_encrypt,
144 const char *username,
145 const char *password,
146 const char *domain);
148 /* The following definitions come from libsmb/clientgen.c */
150 int cli_set_message(char *buf,int num_words,int num_bytes,bool zero);
151 unsigned int cli_set_timeout(struct cli_state *cli, unsigned int timeout);
152 void cli_set_port(struct cli_state *cli, int port);
153 bool cli_state_seqnum_persistent(struct cli_state *cli,
154 uint16_t mid);
155 bool cli_state_seqnum_remove(struct cli_state *cli,
156 uint16_t mid);
157 bool cli_receive_smb(struct cli_state *cli);
158 bool cli_send_smb(struct cli_state *cli);
159 void cli_setup_packet_buf(struct cli_state *cli, char *buf);
160 NTSTATUS cli_set_domain(struct cli_state *cli, const char *domain);
161 NTSTATUS cli_set_username(struct cli_state *cli, const char *username);
162 NTSTATUS cli_set_password(struct cli_state *cli, const char *password);
163 NTSTATUS cli_init_creds(struct cli_state *cli, const char *username, const char *domain, const char *password);
164 struct cli_state *cli_initialise(void);
165 struct cli_state *cli_initialise_ex(int signing_state);
166 void cli_nt_pipes_close(struct cli_state *cli);
167 void cli_shutdown(struct cli_state *cli);
168 void cli_sockopt(struct cli_state *cli, const char *options);
169 uint16 cli_setpid(struct cli_state *cli, uint16 pid);
170 bool cli_set_case_sensitive(struct cli_state *cli, bool case_sensitive);
171 struct tevent_req *cli_echo_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
172 struct cli_state *cli, uint16_t num_echos,
173 DATA_BLOB data);
174 NTSTATUS cli_echo_recv(struct tevent_req *req);
175 NTSTATUS cli_echo(struct cli_state *cli, uint16_t num_echos, DATA_BLOB data);
176 bool cli_ucs2(struct cli_state *cli);
177 bool is_andx_req(uint8_t cmd);
178 NTSTATUS cli_smb(TALLOC_CTX *mem_ctx, struct cli_state *cli,
179 uint8_t smb_command, uint8_t additional_flags,
180 uint8_t wct, uint16_t *vwv,
181 uint32_t num_bytes, const uint8_t *bytes,
182 struct tevent_req **result_parent,
183 uint8_t min_wct, uint8_t *pwct, uint16_t **pvwv,
184 uint32_t *pnum_bytes, uint8_t **pbytes);
186 /* The following definitions come from libsmb/clierror.c */
188 const char *cli_errstr(struct cli_state *cli);
189 NTSTATUS cli_nt_error(struct cli_state *cli);
190 void cli_dos_error(struct cli_state *cli, uint8 *eclass, uint32 *ecode);
191 int cli_errno(struct cli_state *cli);
192 bool cli_is_error(struct cli_state *cli);
193 bool cli_is_nt_error(struct cli_state *cli);
194 bool cli_is_dos_error(struct cli_state *cli);
195 NTSTATUS cli_get_nt_error(struct cli_state *cli);
196 void cli_set_nt_error(struct cli_state *cli, NTSTATUS status);
197 void cli_reset_error(struct cli_state *cli);
198 bool cli_state_is_connected(struct cli_state *cli);
200 /* The following definitions come from libsmb/clifile.c */
202 struct tevent_req *cli_setpathinfo_send(TALLOC_CTX *mem_ctx,
203 struct tevent_context *ev,
204 struct cli_state *cli,
205 uint16_t level,
206 const char *path,
207 uint8_t *data,
208 size_t data_len);
209 NTSTATUS cli_setpathinfo_recv(struct tevent_req *req);
210 NTSTATUS cli_setpathinfo(struct cli_state *cli,
211 uint16_t level,
212 const char *path,
213 uint8_t *data,
214 size_t data_len);
216 struct tevent_req *cli_posix_symlink_send(TALLOC_CTX *mem_ctx,
217 struct event_context *ev,
218 struct cli_state *cli,
219 const char *oldname,
220 const char *newname);
221 NTSTATUS cli_posix_symlink_recv(struct tevent_req *req);
222 NTSTATUS cli_posix_symlink(struct cli_state *cli,
223 const char *oldname,
224 const char *newname);
225 struct tevent_req *cli_posix_readlink_send(TALLOC_CTX *mem_ctx,
226 struct event_context *ev,
227 struct cli_state *cli,
228 const char *fname,
229 size_t len);
230 NTSTATUS cli_posix_readlink_recv(struct tevent_req *req, struct cli_state *cli,
231 char *retpath, size_t len);
232 NTSTATUS cli_posix_readlink(struct cli_state *cli, const char *fname,
233 char *linkpath, size_t len);
234 struct tevent_req *cli_posix_hardlink_send(TALLOC_CTX *mem_ctx,
235 struct event_context *ev,
236 struct cli_state *cli,
237 const char *oldname,
238 const char *newname);
239 NTSTATUS cli_posix_hardlink_recv(struct tevent_req *req);
240 NTSTATUS cli_posix_hardlink(struct cli_state *cli,
241 const char *oldname,
242 const char *newname);
243 uint32_t unix_perms_to_wire(mode_t perms);
244 mode_t wire_perms_to_unix(uint32_t perms);
245 struct tevent_req *cli_posix_getfacl_send(TALLOC_CTX *mem_ctx,
246 struct event_context *ev,
247 struct cli_state *cli,
248 const char *fname);
249 NTSTATUS cli_posix_getfacl_recv(struct tevent_req *req,
250 TALLOC_CTX *mem_ctx,
251 size_t *prb_size,
252 char **retbuf);
253 NTSTATUS cli_posix_getfacl(struct cli_state *cli,
254 const char *fname,
255 TALLOC_CTX *mem_ctx,
256 size_t *prb_size,
257 char **retbuf);
258 struct tevent_req *cli_posix_stat_send(TALLOC_CTX *mem_ctx,
259 struct event_context *ev,
260 struct cli_state *cli,
261 const char *fname);
262 NTSTATUS cli_posix_stat_recv(struct tevent_req *req,
263 SMB_STRUCT_STAT *sbuf);
264 NTSTATUS cli_posix_stat(struct cli_state *cli,
265 const char *fname,
266 SMB_STRUCT_STAT *sbuf);
267 struct tevent_req *cli_posix_chmod_send(TALLOC_CTX *mem_ctx,
268 struct event_context *ev,
269 struct cli_state *cli,
270 const char *fname,
271 mode_t mode);
272 NTSTATUS cli_posix_chmod_recv(struct tevent_req *req);
273 NTSTATUS cli_posix_chmod(struct cli_state *cli, const char *fname, mode_t mode);
274 struct tevent_req *cli_posix_chown_send(TALLOC_CTX *mem_ctx,
275 struct event_context *ev,
276 struct cli_state *cli,
277 const char *fname,
278 uid_t uid,
279 gid_t gid);
280 NTSTATUS cli_posix_chown_recv(struct tevent_req *req);
281 NTSTATUS cli_posix_chown(struct cli_state *cli,
282 const char *fname,
283 uid_t uid,
284 gid_t gid);
285 struct tevent_req *cli_rename_send(TALLOC_CTX *mem_ctx,
286 struct event_context *ev,
287 struct cli_state *cli,
288 const char *fname_src,
289 const char *fname_dst);
290 NTSTATUS cli_rename_recv(struct tevent_req *req);
291 NTSTATUS cli_rename(struct cli_state *cli, const char *fname_src, const char *fname_dst);
292 struct tevent_req *cli_ntrename_send(TALLOC_CTX *mem_ctx,
293 struct event_context *ev,
294 struct cli_state *cli,
295 const char *fname_src,
296 const char *fname_dst);
297 NTSTATUS cli_ntrename_recv(struct tevent_req *req);
298 NTSTATUS cli_ntrename(struct cli_state *cli, const char *fname_src, const char *fname_dst);
300 struct tevent_req *cli_nt_hardlink_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_nt_hardlink_recv(struct tevent_req *req);
306 NTSTATUS cli_nt_hardlink(struct cli_state *cli, const char *fname_src, const char *fname_dst);
308 struct tevent_req *cli_unlink_send(TALLOC_CTX *mem_ctx,
309 struct event_context *ev,
310 struct cli_state *cli,
311 const char *fname,
312 uint16_t mayhave_attrs);
313 NTSTATUS cli_unlink_recv(struct tevent_req *req);
314 NTSTATUS cli_unlink(struct cli_state *cli, const char *fname, uint16_t mayhave_attrs);
316 struct tevent_req *cli_mkdir_send(TALLOC_CTX *mem_ctx,
317 struct event_context *ev,
318 struct cli_state *cli,
319 const char *dname);
320 NTSTATUS cli_mkdir_recv(struct tevent_req *req);
321 NTSTATUS cli_mkdir(struct cli_state *cli, const char *dname);
322 struct tevent_req *cli_rmdir_send(TALLOC_CTX *mem_ctx,
323 struct event_context *ev,
324 struct cli_state *cli,
325 const char *dname);
326 NTSTATUS cli_rmdir_recv(struct tevent_req *req);
327 NTSTATUS cli_rmdir(struct cli_state *cli, const char *dname);
328 struct tevent_req *cli_nt_delete_on_close_send(TALLOC_CTX *mem_ctx,
329 struct event_context *ev,
330 struct cli_state *cli,
331 uint16_t fnum,
332 bool flag);
333 NTSTATUS cli_nt_delete_on_close_recv(struct tevent_req *req);
334 NTSTATUS cli_nt_delete_on_close(struct cli_state *cli, uint16_t fnum, bool flag);
335 struct tevent_req *cli_ntcreate_send(TALLOC_CTX *mem_ctx,
336 struct event_context *ev,
337 struct cli_state *cli,
338 const char *fname,
339 uint32_t CreatFlags,
340 uint32_t DesiredAccess,
341 uint32_t FileAttributes,
342 uint32_t ShareAccess,
343 uint32_t CreateDisposition,
344 uint32_t CreateOptions,
345 uint8_t SecurityFlags);
346 NTSTATUS cli_ntcreate_recv(struct tevent_req *req, uint16_t *pfnum);
347 NTSTATUS cli_ntcreate(struct cli_state *cli,
348 const char *fname,
349 uint32_t CreatFlags,
350 uint32_t DesiredAccess,
351 uint32_t FileAttributes,
352 uint32_t ShareAccess,
353 uint32_t CreateDisposition,
354 uint32_t CreateOptions,
355 uint8_t SecurityFlags,
356 uint16_t *pfid);
357 uint8_t *smb_bytes_push_str(uint8_t *buf, bool ucs2, const char *str,
358 size_t str_len, size_t *pconverted_size);
359 uint8_t *smb_bytes_push_bytes(uint8_t *buf, uint8_t prefix,
360 const uint8_t *bytes, size_t num_bytes);
361 struct tevent_req *cli_open_create(TALLOC_CTX *mem_ctx,
362 struct event_context *ev,
363 struct cli_state *cli, const char *fname,
364 int flags, int share_mode,
365 struct tevent_req **psmbreq);
366 struct tevent_req *cli_open_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
367 struct cli_state *cli, const char *fname,
368 int flags, int share_mode);
369 NTSTATUS cli_open_recv(struct tevent_req *req, uint16_t *fnum);
370 NTSTATUS cli_open(struct cli_state *cli, const char *fname, int flags, int share_mode, uint16_t *pfnum);
371 struct tevent_req *cli_close_create(TALLOC_CTX *mem_ctx,
372 struct event_context *ev,
373 struct cli_state *cli, uint16_t fnum,
374 struct tevent_req **psubreq);
375 struct tevent_req *cli_close_send(TALLOC_CTX *mem_ctx,
376 struct event_context *ev,
377 struct cli_state *cli, uint16_t fnum);
378 NTSTATUS cli_close_recv(struct tevent_req *req);
379 NTSTATUS cli_close(struct cli_state *cli, uint16_t fnum);
380 struct tevent_req *cli_ftruncate_send(TALLOC_CTX *mem_ctx,
381 struct event_context *ev,
382 struct cli_state *cli,
383 uint16_t fnum,
384 uint64_t size);
385 NTSTATUS cli_ftruncate_recv(struct tevent_req *req);
386 NTSTATUS cli_ftruncate(struct cli_state *cli, uint16_t fnum, uint64_t size);
387 NTSTATUS cli_locktype(struct cli_state *cli, uint16_t fnum,
388 uint32_t offset, uint32_t len,
389 int timeout, unsigned char locktype);
390 bool cli_lock(struct cli_state *cli, uint16_t fnum,
391 uint32_t offset, uint32_t len, int timeout, enum brl_type lock_type);
392 struct tevent_req *cli_unlock_send(TALLOC_CTX *mem_ctx,
393 struct event_context *ev,
394 struct cli_state *cli,
395 uint16_t fnum,
396 uint64_t offset,
397 uint64_t len);
398 NTSTATUS cli_unlock_recv(struct tevent_req *req);
399 NTSTATUS cli_unlock(struct cli_state *cli, uint16_t fnum, uint32_t offset, uint32_t len);
400 bool cli_lock64(struct cli_state *cli, uint16_t fnum,
401 uint64_t offset, uint64_t len, int timeout, enum brl_type lock_type);
402 struct tevent_req *cli_unlock64_send(TALLOC_CTX *mem_ctx,
403 struct event_context *ev,
404 struct cli_state *cli,
405 uint16_t fnum,
406 uint64_t offset,
407 uint64_t len);
408 NTSTATUS cli_unlock64_recv(struct tevent_req *req);
409 NTSTATUS cli_unlock64(struct cli_state *cli, uint16_t fnum, uint64_t offset, uint64_t len);
410 struct tevent_req *cli_posix_lock_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 bool wait_lock,
417 enum brl_type lock_type);
418 NTSTATUS cli_posix_lock_recv(struct tevent_req *req);
419 NTSTATUS cli_posix_lock(struct cli_state *cli, uint16_t fnum,
420 uint64_t offset, uint64_t len,
421 bool wait_lock, enum brl_type lock_type);
422 struct tevent_req *cli_posix_unlock_send(TALLOC_CTX *mem_ctx,
423 struct event_context *ev,
424 struct cli_state *cli,
425 uint16_t fnum,
426 uint64_t offset,
427 uint64_t len);
428 NTSTATUS cli_posix_unlock_recv(struct tevent_req *req);
429 NTSTATUS cli_posix_unlock(struct cli_state *cli, uint16_t fnum, uint64_t offset, uint64_t len);
430 struct tevent_req *cli_getattrE_send(TALLOC_CTX *mem_ctx,
431 struct event_context *ev,
432 struct cli_state *cli,
433 uint16_t fnum);
434 NTSTATUS cli_getattrE_recv(struct tevent_req *req,
435 uint16_t *attr,
436 SMB_OFF_T *size,
437 time_t *change_time,
438 time_t *access_time,
439 time_t *write_time);
440 NTSTATUS cli_getattrE(struct cli_state *cli,
441 uint16_t fnum,
442 uint16_t *attr,
443 SMB_OFF_T *size,
444 time_t *change_time,
445 time_t *access_time,
446 time_t *write_time);
447 struct tevent_req *cli_setattrE_send(TALLOC_CTX *mem_ctx,
448 struct event_context *ev,
449 struct cli_state *cli,
450 uint16_t fnum,
451 time_t change_time,
452 time_t access_time,
453 time_t write_time);
454 NTSTATUS cli_setattrE_recv(struct tevent_req *req);
455 NTSTATUS cli_setattrE(struct cli_state *cli,
456 uint16_t fnum,
457 time_t change_time,
458 time_t access_time,
459 time_t write_time);
460 struct tevent_req *cli_getatr_send(TALLOC_CTX *mem_ctx,
461 struct event_context *ev,
462 struct cli_state *cli,
463 const char *fname);
464 NTSTATUS cli_getatr_recv(struct tevent_req *req,
465 uint16_t *attr,
466 SMB_OFF_T *size,
467 time_t *write_time);
468 NTSTATUS cli_getatr(struct cli_state *cli,
469 const char *fname,
470 uint16_t *attr,
471 SMB_OFF_T *size,
472 time_t *write_time);
473 struct tevent_req *cli_setatr_send(TALLOC_CTX *mem_ctx,
474 struct event_context *ev,
475 struct cli_state *cli,
476 const char *fname,
477 uint16_t attr,
478 time_t mtime);
479 NTSTATUS cli_setatr_recv(struct tevent_req *req);
480 NTSTATUS cli_setatr(struct cli_state *cli,
481 const char *fname,
482 uint16_t attr,
483 time_t mtime);
484 struct tevent_req *cli_chkpath_send(TALLOC_CTX *mem_ctx,
485 struct event_context *ev,
486 struct cli_state *cli,
487 const char *fname);
488 NTSTATUS cli_chkpath_recv(struct tevent_req *req);
489 NTSTATUS cli_chkpath(struct cli_state *cli, const char *path);
490 struct tevent_req *cli_dskattr_send(TALLOC_CTX *mem_ctx,
491 struct event_context *ev,
492 struct cli_state *cli);
493 NTSTATUS cli_dskattr_recv(struct tevent_req *req, int *bsize, int *total,
494 int *avail);
495 NTSTATUS cli_dskattr(struct cli_state *cli, int *bsize, int *total, int *avail);
496 struct tevent_req *cli_ctemp_send(TALLOC_CTX *mem_ctx,
497 struct event_context *ev,
498 struct cli_state *cli,
499 const char *path);
500 NTSTATUS cli_ctemp_recv(struct tevent_req *req,
501 TALLOC_CTX *ctx,
502 uint16_t *pfnum,
503 char **outfile);
504 NTSTATUS cli_ctemp(struct cli_state *cli,
505 TALLOC_CTX *ctx,
506 const char *path,
507 uint16_t *pfnum,
508 char **out_path);
509 NTSTATUS cli_raw_ioctl(struct cli_state *cli, uint16_t fnum, uint32_t code, DATA_BLOB *blob);
510 NTSTATUS cli_set_ea_path(struct cli_state *cli, const char *path,
511 const char *ea_name, const char *ea_val,
512 size_t ea_len);
513 NTSTATUS cli_set_ea_fnum(struct cli_state *cli, uint16_t fnum,
514 const char *ea_name, const char *ea_val,
515 size_t ea_len);
516 struct tevent_req *cli_get_ea_list_path_send(TALLOC_CTX *mem_ctx,
517 struct tevent_context *ev,
518 struct cli_state *cli,
519 const char *fname);
520 NTSTATUS cli_get_ea_list_path_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
521 size_t *pnum_eas, struct ea_struct **peas);
522 NTSTATUS cli_get_ea_list_path(struct cli_state *cli, const char *path,
523 TALLOC_CTX *ctx,
524 size_t *pnum_eas,
525 struct ea_struct **pea_list);
526 struct tevent_req *cli_posix_open_send(TALLOC_CTX *mem_ctx,
527 struct event_context *ev,
528 struct cli_state *cli,
529 const char *fname,
530 int flags,
531 mode_t mode);
532 NTSTATUS cli_posix_open_recv(struct tevent_req *req, uint16_t *pfnum);
533 NTSTATUS cli_posix_open(struct cli_state *cli, const char *fname,
534 int flags, mode_t mode, uint16_t *fnum);
535 struct tevent_req *cli_posix_mkdir_send(TALLOC_CTX *mem_ctx,
536 struct event_context *ev,
537 struct cli_state *cli,
538 const char *fname,
539 mode_t mode);
540 NTSTATUS cli_posix_mkdir_recv(struct tevent_req *req);
541 NTSTATUS cli_posix_mkdir(struct cli_state *cli, const char *fname, mode_t mode);
543 struct tevent_req *cli_posix_unlink_send(TALLOC_CTX *mem_ctx,
544 struct event_context *ev,
545 struct cli_state *cli,
546 const char *fname);
547 NTSTATUS cli_posix_unlink_recv(struct tevent_req *req);
548 NTSTATUS cli_posix_unlink(struct cli_state *cli, const char *fname);
550 struct tevent_req *cli_posix_rmdir_send(TALLOC_CTX *mem_ctx,
551 struct event_context *ev,
552 struct cli_state *cli,
553 const char *fname);
554 NTSTATUS cli_posix_rmdir_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx);
555 NTSTATUS cli_posix_rmdir(struct cli_state *cli, const char *fname);
556 struct tevent_req *cli_notify_send(TALLOC_CTX *mem_ctx,
557 struct tevent_context *ev,
558 struct cli_state *cli, uint16_t fnum,
559 uint32_t buffer_size,
560 uint32_t completion_filter, bool recursive);
561 NTSTATUS cli_notify_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
562 uint32_t *pnum_changes,
563 struct notify_change **pchanges);
565 /* The following definitions come from libsmb/clifsinfo.c */
567 struct tevent_req *cli_unix_extensions_version_send(TALLOC_CTX *mem_ctx,
568 struct tevent_context *ev,
569 struct cli_state *cli);
570 NTSTATUS cli_unix_extensions_version_recv(struct tevent_req *req,
571 uint16_t *pmajor, uint16_t *pminor,
572 uint32_t *pcaplow,
573 uint32_t *pcaphigh);
574 NTSTATUS cli_unix_extensions_version(struct cli_state *cli, uint16 *pmajor,
575 uint16 *pminor, uint32 *pcaplow,
576 uint32 *pcaphigh);
577 struct tevent_req *cli_set_unix_extensions_capabilities_send(
578 TALLOC_CTX *mem_ctx, struct tevent_context *ev, struct cli_state *cli,
579 uint16_t major, uint16_t minor, uint32_t caplow, uint32_t caphigh);
580 NTSTATUS cli_set_unix_extensions_capabilities_recv(struct tevent_req *req);
581 NTSTATUS cli_set_unix_extensions_capabilities(struct cli_state *cli,
582 uint16 major, uint16 minor,
583 uint32 caplow, uint32 caphigh);
584 struct tevent_req *cli_get_fs_attr_info_send(TALLOC_CTX *mem_ctx,
585 struct tevent_context *ev,
586 struct cli_state *cli);
587 NTSTATUS cli_get_fs_attr_info_recv(struct tevent_req *req, uint32_t *fs_attr);
588 NTSTATUS cli_get_fs_attr_info(struct cli_state *cli, uint32_t *fs_attr);
589 NTSTATUS cli_get_fs_volume_info(struct cli_state *cli, fstring volume_name,
590 uint32 *pserial_number, time_t *pdate);
591 NTSTATUS cli_get_fs_full_size_info(struct cli_state *cli,
592 uint64_t *total_allocation_units,
593 uint64_t *caller_allocation_units,
594 uint64_t *actual_allocation_units,
595 uint64_t *sectors_per_allocation_unit,
596 uint64_t *bytes_per_sector);
597 NTSTATUS cli_get_posix_fs_info(struct cli_state *cli,
598 uint32 *optimal_transfer_size,
599 uint32 *block_size,
600 uint64_t *total_blocks,
601 uint64_t *blocks_available,
602 uint64_t *user_blocks_available,
603 uint64_t *total_file_nodes,
604 uint64_t *free_file_nodes,
605 uint64_t *fs_identifier);
606 NTSTATUS cli_raw_ntlm_smb_encryption_start(struct cli_state *cli,
607 const char *user,
608 const char *pass,
609 const char *domain);
610 NTSTATUS cli_gss_smb_encryption_start(struct cli_state *cli);
611 NTSTATUS cli_force_encryption(struct cli_state *c,
612 const char *username,
613 const char *password,
614 const char *domain);
616 /* The following definitions come from libsmb/clilist.c */
618 NTSTATUS cli_list_old(struct cli_state *cli,const char *Mask,uint16 attribute,
619 NTSTATUS (*fn)(const char *, struct file_info *,
620 const char *, void *), void *state);
621 NTSTATUS cli_list_trans(struct cli_state *cli, const char *mask,
622 uint16_t attribute, int info_level,
623 NTSTATUS (*fn)(const char *mnt, struct file_info *finfo,
624 const char *mask, void *private_data),
625 void *private_data);
626 struct tevent_req *cli_list_send(TALLOC_CTX *mem_ctx,
627 struct tevent_context *ev,
628 struct cli_state *cli,
629 const char *mask,
630 uint16_t attribute,
631 uint16_t info_level);
632 NTSTATUS cli_list_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
633 struct file_info **finfo, size_t *num_finfo);
634 NTSTATUS cli_list(struct cli_state *cli,const char *Mask,uint16 attribute,
635 NTSTATUS (*fn)(const char *, struct file_info *, const char *,
636 void *), void *state);
638 /* The following definitions come from libsmb/climessage.c */
640 struct tevent_req *cli_message_send(TALLOC_CTX *mem_ctx,
641 struct tevent_context *ev,
642 struct cli_state *cli,
643 const char *host, const char *username,
644 const char *message);
645 NTSTATUS cli_message_recv(struct tevent_req *req);
646 NTSTATUS cli_message(struct cli_state *cli, const char *host,
647 const char *username, const char *message);
649 /* The following definitions come from libsmb/clioplock.c */
651 struct tevent_req *cli_oplock_ack_send(TALLOC_CTX *mem_ctx,
652 struct tevent_context *ev,
653 struct cli_state *cli,
654 uint16_t fnum, uint8_t level);
655 NTSTATUS cli_oplock_ack_recv(struct tevent_req *req);
656 NTSTATUS cli_oplock_ack(struct cli_state *cli, uint16_t fnum, unsigned char level);
657 void cli_oplock_handler(struct cli_state *cli,
658 NTSTATUS (*handler)(struct cli_state *, uint16_t, unsigned char));
660 /* The following definitions come from libsmb/cliprint.c */
662 int cli_print_queue(struct cli_state *cli,
663 void (*fn)(struct print_job_info *));
664 int cli_printjob_del(struct cli_state *cli, int job);
666 /* The following definitions come from libsmb/cliquota.c */
668 NTSTATUS cli_get_quota_handle(struct cli_state *cli, uint16_t *quota_fnum);
669 void free_ntquota_list(SMB_NTQUOTA_LIST **qt_list);
670 NTSTATUS cli_get_user_quota(struct cli_state *cli, int quota_fnum,
671 SMB_NTQUOTA_STRUCT *pqt);
672 NTSTATUS cli_set_user_quota(struct cli_state *cli, int quota_fnum,
673 SMB_NTQUOTA_STRUCT *pqt);
674 NTSTATUS cli_list_user_quota(struct cli_state *cli, int quota_fnum,
675 SMB_NTQUOTA_LIST **pqt_list);
676 NTSTATUS cli_get_fs_quota_info(struct cli_state *cli, int quota_fnum,
677 SMB_NTQUOTA_STRUCT *pqt);
678 NTSTATUS cli_set_fs_quota_info(struct cli_state *cli, int quota_fnum,
679 SMB_NTQUOTA_STRUCT *pqt);
681 /* The following definitions come from libsmb/clireadwrite.c */
683 struct tevent_req *cli_read_andx_create(TALLOC_CTX *mem_ctx,
684 struct event_context *ev,
685 struct cli_state *cli, uint16_t fnum,
686 off_t offset, size_t size,
687 struct tevent_req **psmbreq);
688 struct tevent_req *cli_read_andx_send(TALLOC_CTX *mem_ctx,
689 struct event_context *ev,
690 struct cli_state *cli, uint16_t fnum,
691 off_t offset, size_t size);
692 NTSTATUS cli_read_andx_recv(struct tevent_req *req, ssize_t *received,
693 uint8_t **rcvbuf);
694 struct tevent_req *cli_pull_send(TALLOC_CTX *mem_ctx,
695 struct event_context *ev,
696 struct cli_state *cli,
697 uint16_t fnum, off_t start_offset,
698 SMB_OFF_T size, size_t window_size,
699 NTSTATUS (*sink)(char *buf, size_t n,
700 void *priv),
701 void *priv);
702 NTSTATUS cli_pull_recv(struct tevent_req *req, SMB_OFF_T *received);
703 NTSTATUS cli_pull(struct cli_state *cli, uint16_t fnum,
704 off_t start_offset, SMB_OFF_T size, size_t window_size,
705 NTSTATUS (*sink)(char *buf, size_t n, void *priv),
706 void *priv, SMB_OFF_T *received);
707 ssize_t cli_read(struct cli_state *cli, uint16_t fnum, char *buf,
708 off_t offset, size_t size);
709 NTSTATUS cli_smbwrite(struct cli_state *cli, uint16_t fnum, char *buf,
710 off_t offset, size_t size1, size_t *ptotal);
711 struct tevent_req *cli_write_andx_create(TALLOC_CTX *mem_ctx,
712 struct event_context *ev,
713 struct cli_state *cli, uint16_t fnum,
714 uint16_t mode, const uint8_t *buf,
715 off_t offset, size_t size,
716 struct tevent_req **reqs_before,
717 int num_reqs_before,
718 struct tevent_req **psmbreq);
719 struct tevent_req *cli_write_andx_send(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 NTSTATUS cli_write_andx_recv(struct tevent_req *req, size_t *pwritten);
726 NTSTATUS cli_writeall(struct cli_state *cli, uint16_t fnum, uint16_t mode,
727 const uint8_t *buf, off_t offset, size_t size,
728 size_t *pwritten);
730 struct tevent_req *cli_push_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
731 struct cli_state *cli,
732 uint16_t fnum, uint16_t mode,
733 off_t start_offset, size_t window_size,
734 size_t (*source)(uint8_t *buf, size_t n,
735 void *priv),
736 void *priv);
737 NTSTATUS cli_push_recv(struct tevent_req *req);
738 NTSTATUS cli_push(struct cli_state *cli, uint16_t fnum, uint16_t mode,
739 off_t start_offset, size_t window_size,
740 size_t (*source)(uint8_t *buf, size_t n, void *priv),
741 void *priv);
743 /* The following definitions come from libsmb/clisecdesc.c */
745 struct security_descriptor *cli_query_secdesc(struct cli_state *cli, uint16_t fnum,
746 TALLOC_CTX *mem_ctx);
747 NTSTATUS cli_set_secdesc(struct cli_state *cli, uint16_t fnum,
748 struct security_descriptor *sd);
750 /* The following definitions come from libsmb/clistr.c */
752 size_t clistr_push_fn(struct cli_state *cli,
753 void *dest,
754 const char *src,
755 int dest_len,
756 int flags);
757 size_t clistr_pull_fn(const char *inbuf,
758 char *dest,
759 const void *src,
760 int dest_len,
761 int src_len,
762 int flags);
763 size_t clistr_pull_talloc(TALLOC_CTX *ctx,
764 const char *base,
765 uint16_t flags2,
766 char **pp_dest,
767 const void *src,
768 int src_len,
769 int flags);
770 size_t clistr_align_out(struct cli_state *cli, const void *p, int flags);
772 /* The following definitions come from libsmb/clitrans.c */
774 struct tevent_req *cli_trans_send(
775 TALLOC_CTX *mem_ctx, struct event_context *ev,
776 struct cli_state *cli, uint8_t cmd,
777 const char *pipe_name, uint16_t fid, uint16_t function, int flags,
778 uint16_t *setup, uint8_t num_setup, uint8_t max_setup,
779 uint8_t *param, uint32_t num_param, uint32_t max_param,
780 uint8_t *data, uint32_t num_data, uint32_t max_data);
781 NTSTATUS cli_trans_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
782 uint16_t *recv_flags2,
783 uint16_t **setup, uint8_t min_setup,
784 uint8_t *num_setup,
785 uint8_t **param, uint32_t min_param,
786 uint32_t *num_param,
787 uint8_t **data, uint32_t min_data,
788 uint32_t *num_data);
789 NTSTATUS cli_trans(TALLOC_CTX *mem_ctx, struct cli_state *cli,
790 uint8_t trans_cmd,
791 const char *pipe_name, uint16_t fid, uint16_t function,
792 int flags,
793 uint16_t *setup, uint8_t num_setup, uint8_t max_setup,
794 uint8_t *param, uint32_t num_param, uint32_t max_param,
795 uint8_t *data, uint32_t num_data, uint32_t max_data,
796 uint16_t *recv_flags2,
797 uint16_t **rsetup, uint8_t min_rsetup, uint8_t *num_rsetup,
798 uint8_t **rparam, uint32_t min_rparam, uint32_t *num_rparam,
799 uint8_t **rdata, uint32_t min_rdata, uint32_t *num_rdata);
801 /* The following definitions come from libsmb/smb_seal.c */
803 NTSTATUS get_enc_ctx_num(const uint8_t *buf, uint16 *p_enc_ctx_num);
804 bool common_encryption_on(struct smb_trans_enc_state *es);
805 NTSTATUS common_ntlm_decrypt_buffer(struct ntlmssp_state *ntlmssp_state, char *buf);
806 NTSTATUS common_ntlm_encrypt_buffer(struct ntlmssp_state *ntlmssp_state,
807 uint16 enc_ctx_num,
808 char *buf,
809 char **ppbuf_out);
810 NTSTATUS common_encrypt_buffer(struct smb_trans_enc_state *es, char *buffer, char **buf_out);
811 NTSTATUS common_decrypt_buffer(struct smb_trans_enc_state *es, char *buf);
812 void common_free_encryption_state(struct smb_trans_enc_state **pp_es);
813 void common_free_enc_buffer(struct smb_trans_enc_state *es, char *buf);
814 bool cli_encryption_on(struct cli_state *cli);
815 void cli_free_encryption_context(struct cli_state *cli);
816 void cli_free_enc_buffer(struct cli_state *cli, char *buf);
817 NTSTATUS cli_decrypt_message(struct cli_state *cli);
818 NTSTATUS cli_encrypt_message(struct cli_state *cli, char *buf, char **buf_out);
820 /* The following definitions come from libsmb/clisigning.c */
822 bool cli_simple_set_signing(struct cli_state *cli,
823 const DATA_BLOB user_session_key,
824 const DATA_BLOB response);
825 bool cli_temp_set_signing(struct cli_state *cli);
826 void cli_calculate_sign_mac(struct cli_state *cli, char *buf, uint32_t *seqnum);
827 bool cli_check_sign_mac(struct cli_state *cli, const char *buf, uint32_t seqnum);
828 bool client_is_signing_on(struct cli_state *cli);
829 bool client_is_signing_allowed(struct cli_state *cli);
830 bool client_is_signing_mandatory(struct cli_state *cli);
831 void cli_set_signing_negotiated(struct cli_state *cli);
833 #endif /* _LIBSMB_PROTO_H_ */