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