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