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