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