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