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