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