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