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