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