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