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