libsmb: Add "flags" to cli_smb2_close_fnum_send()
[samba.git] / source3 / libsmb / cli_smb2_fnum.h
1 /*
2    Unix SMB/CIFS implementation.
3    smb2 wrapper client routines
4    Copyright (C) Jeremy Allison 2013
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 __SMB2CLI_FNUM_H__
21 #define __SMB2CLI_FNUM_H__
22
23 struct smbXcli_conn;
24 struct smbXcli_session;
25 struct cli_state;
26 struct file_info;
27 struct symlink_reparse_struct;
28
29 struct cli_smb2_create_flags {
30         bool batch_oplock:1;
31         bool exclusive_oplock:1;
32 };
33
34 struct tevent_req *cli_smb2_create_fnum_send(
35         TALLOC_CTX *mem_ctx,
36         struct tevent_context *ev,
37         struct cli_state *cli,
38         const char *fname,
39         struct cli_smb2_create_flags create_flags,
40         uint32_t impersonation_level,
41         uint32_t desired_access,
42         uint32_t file_attributes,
43         uint32_t share_access,
44         uint32_t create_disposition,
45         uint32_t create_options,
46         const struct smb2_create_blobs *in_cblobs);
47 NTSTATUS cli_smb2_create_fnum_recv(
48         struct tevent_req *req,
49         uint16_t *pfnum,
50         struct smb_create_returns *cr,
51         TALLOC_CTX *mem_ctx,
52         struct smb2_create_blobs *out_cblobs,
53         struct symlink_reparse_struct **symlink);
54 NTSTATUS cli_smb2_create_fnum(
55         struct cli_state *cli,
56         const char *fname,
57         struct cli_smb2_create_flags create_flags,
58         uint32_t impersonation_level,
59         uint32_t desired_access,
60         uint32_t file_attributes,
61         uint32_t share_access,
62         uint32_t create_disposition,
63         uint32_t create_options,
64         const struct smb2_create_blobs *in_cblobs,
65         uint16_t *pfid,
66         struct smb_create_returns *cr,
67         TALLOC_CTX *mem_ctx,
68         struct smb2_create_blobs *out_cblobs);
69
70 struct tevent_req *cli_smb2_close_fnum_send(TALLOC_CTX *mem_ctx,
71                                             struct tevent_context *ev,
72                                             struct cli_state *cli,
73                                             uint16_t fnum,
74                                             uint16_t flags);
75 NTSTATUS cli_smb2_close_fnum_recv(struct tevent_req *req);
76 NTSTATUS cli_smb2_close_fnum(struct cli_state *cli, uint16_t fnum);
77 struct tevent_req *cli_smb2_delete_on_close_send(TALLOC_CTX *mem_ctx,
78                                         struct tevent_context *ev,
79                                         struct cli_state *cli,
80                                         uint16_t fnum,
81                                         bool flag);
82 NTSTATUS cli_smb2_delete_on_close_recv(struct tevent_req *req);
83 NTSTATUS cli_smb2_delete_on_close(struct cli_state *cli, uint16_t fnum, bool flag);
84 struct tevent_req *cli_smb2_mkdir_send(
85         TALLOC_CTX *mem_ctx,
86         struct tevent_context *ev,
87         struct cli_state *cli,
88         const char *name);
89 NTSTATUS cli_smb2_mkdir_recv(struct tevent_req *req);
90 struct tevent_req *cli_smb2_rmdir_send(
91         TALLOC_CTX *mem_ctx,
92         struct tevent_context *ev,
93         struct cli_state *cli,
94         const char *dname,
95         const struct smb2_create_blobs *in_cblobs);
96 NTSTATUS cli_smb2_rmdir_recv(struct tevent_req *req);
97 struct tevent_req *cli_smb2_unlink_send(
98         TALLOC_CTX *mem_ctx,
99         struct tevent_context *ev,
100         struct cli_state *cli,
101         const char *fname,
102         const struct smb2_create_blobs *in_cblobs);
103 NTSTATUS cli_smb2_unlink_recv(struct tevent_req *req);
104 struct tevent_req *cli_smb2_list_send(
105         TALLOC_CTX *mem_ctx,
106         struct tevent_context *ev,
107         struct cli_state *cli,
108         const char *pathname,
109         unsigned int info_level,
110         bool posix);
111 NTSTATUS cli_smb2_list_recv(
112         struct tevent_req *req,
113         TALLOC_CTX *mem_ctx,
114         struct file_info **pfinfo);
115 NTSTATUS cli_smb2_qpathinfo_basic(struct cli_state *cli,
116                         const char *name,
117                         SMB_STRUCT_STAT *sbuf,
118                         uint32_t *attributes);
119 NTSTATUS cli_smb2_qpathinfo_alt_name(struct cli_state *cli,
120                         const char *name,
121                         fstring alt_name);
122 struct tevent_req *cli_smb2_qpathinfo_send(TALLOC_CTX *mem_ctx,
123                                            struct tevent_context *ev,
124                                            struct cli_state *cli,
125                                            const char *fname,
126                                            uint16_t level,
127                                            uint32_t min_rdata,
128                                            uint32_t max_rdata);
129 NTSTATUS cli_smb2_qpathinfo_recv(struct tevent_req *req,
130                                  TALLOC_CTX *mem_ctx,
131                                  uint8_t **rdata,
132                                  uint32_t *num_rdata);
133 struct tevent_req *cli_smb2_query_info_fnum_send(
134         TALLOC_CTX *mem_ctx,
135         struct tevent_context *ev,
136         struct cli_state *cli,
137         uint16_t fnum,
138         uint8_t in_info_type,
139         uint8_t in_info_class,
140         uint32_t in_max_output_length,
141         const DATA_BLOB *in_input_buffer,
142         uint32_t in_additional_info,
143         uint32_t in_flags);
144 NTSTATUS cli_smb2_query_info_fnum_recv(
145         struct tevent_req *req, TALLOC_CTX *mem_ctx, DATA_BLOB *outbuf);
146 struct tevent_req *cli_smb2_set_info_fnum_send(
147         TALLOC_CTX *mem_ctx,
148         struct tevent_context *ev,
149         struct cli_state *cli,
150         uint16_t fnum,
151         uint8_t in_info_type,
152         uint8_t in_info_class,
153         const DATA_BLOB *in_input_buffer,
154         uint32_t in_additional_info);
155 NTSTATUS cli_smb2_set_info_fnum_recv(struct tevent_req *req);
156 NTSTATUS cli_smb2_set_info_fnum(
157         struct cli_state *cli,
158         uint16_t fnum,
159         uint8_t in_info_type,
160         uint8_t in_info_class,
161         const DATA_BLOB *in_input_buffer,
162         uint32_t in_additional_info);
163 NTSTATUS cli_smb2_query_info_fnum(
164         struct cli_state *cli,
165         uint16_t fnum,
166         uint8_t in_info_type,
167         uint8_t in_info_class,
168         uint32_t in_max_output_length,
169         const DATA_BLOB *in_input_buffer,
170         uint32_t in_additional_info,
171         uint32_t in_flags,
172         TALLOC_CTX *mem_ctx,
173         DATA_BLOB *outbuf);
174 NTSTATUS cli_smb2_setpathinfo(struct cli_state *cli,
175                         const char *name,
176                         uint8_t in_info_type,
177                         uint8_t in_file_info_class,
178                         const DATA_BLOB *p_in_data);
179 NTSTATUS cli_smb2_setatr(struct cli_state *cli,
180                         const char *fname,
181                         uint32_t attr,
182                         time_t mtime);
183 NTSTATUS cli_smb2_setattrE(struct cli_state *cli,
184                         uint16_t fnum,
185                         time_t change_time,
186                         time_t access_time,
187                         time_t write_time);
188 NTSTATUS cli_smb2_dskattr(struct cli_state *cli,
189                         const char *path,
190                         uint64_t *bsize,
191                         uint64_t *total,
192                         uint64_t *avail);
193 NTSTATUS cli_smb2_get_fs_attr_info(struct cli_state *cli, uint32_t *fs_attr);
194 NTSTATUS cli_smb2_get_fs_full_size_info(struct cli_state *cli,
195                         uint64_t *total_allocation_units,
196                         uint64_t *caller_allocation_units,
197                         uint64_t *actual_allocation_units,
198                         uint64_t *sectors_per_allocation_unit,
199                         uint64_t *bytes_per_sector);
200 NTSTATUS cli_smb2_get_fs_volume_info(struct cli_state *cli,
201                         TALLOC_CTX *mem_ctx,
202                         char **_volume_name,
203                         uint32_t *pserial_number,
204                         time_t *pdate);
205 struct tevent_req *cli_smb2_query_mxac_send(TALLOC_CTX *mem_ctx,
206                                             struct tevent_context *ev,
207                                             struct cli_state *cli,
208                                             const char *fname);
209 NTSTATUS cli_smb2_query_mxac_recv(struct tevent_req *req,
210                                   uint32_t *mxac);
211 NTSTATUS cli_smb2_query_mxac(struct cli_state *cli,
212                              const char *fname,
213                              uint32_t *mxac);
214 struct tevent_req *cli_smb2_rename_send(
215         TALLOC_CTX *mem_ctx,
216         struct tevent_context *ev,
217         struct cli_state *cli,
218         const char *fname_src,
219         const char *fname_dst,
220         bool replace);
221 NTSTATUS cli_smb2_rename_recv(struct tevent_req *req);
222 NTSTATUS cli_smb2_set_ea_fnum(struct cli_state *cli,
223                         uint16_t fnum,
224                         const char *ea_name,
225                         const char *ea_val,
226                         size_t ea_len);
227 NTSTATUS cli_smb2_get_ea_list_path(struct cli_state *cli,
228                         const char *name,
229                         TALLOC_CTX *ctx,
230                         size_t *pnum_eas,
231                         struct ea_struct **pea_list);
232 NTSTATUS cli_smb2_set_ea_path(struct cli_state *cli,
233                         const char *name,
234                         const char *ea_name,
235                         const char *ea_val,
236                         size_t ea_len);
237 NTSTATUS cli_smb2_get_user_quota(struct cli_state *cli,
238                                  int quota_fnum,
239                                  SMB_NTQUOTA_STRUCT *pqt);
240 NTSTATUS cli_smb2_list_user_quota_step(struct cli_state *cli,
241                                        TALLOC_CTX *mem_ctx,
242                                        int quota_fnum,
243                                        SMB_NTQUOTA_LIST **pqt_list,
244                                        bool first);
245 NTSTATUS cli_smb2_get_fs_quota_info(struct cli_state *cli,
246                                     int quota_fnum,
247                                     SMB_NTQUOTA_STRUCT *pqt);
248 NTSTATUS cli_smb2_set_user_quota(struct cli_state *cli,
249                                  int quota_fnum,
250                                  SMB_NTQUOTA_LIST *qtl);
251 NTSTATUS cli_smb2_set_fs_quota_info(struct cli_state *cli,
252                                     int quota_fnum,
253                                     SMB_NTQUOTA_STRUCT *pqt);
254 struct tevent_req *cli_smb2_read_send(TALLOC_CTX *mem_ctx,
255                                 struct tevent_context *ev,
256                                 struct cli_state *cli,
257                                 uint16_t fnum,
258                                 off_t offset,
259                                 size_t size);
260 NTSTATUS cli_smb2_read_recv(struct tevent_req *req,
261                                 ssize_t *received,
262                                 uint8_t **rcvbuf);
263 struct tevent_req *cli_smb2_write_send(TALLOC_CTX *mem_ctx,
264                                         struct tevent_context *ev,
265                                         struct cli_state *cli,
266                                         uint16_t fnum,
267                                         uint16_t mode,
268                                         const uint8_t *buf,
269                                         off_t offset,
270                                         size_t size);
271 NTSTATUS cli_smb2_write_recv(struct tevent_req *req,
272                              size_t *pwritten);
273 struct tevent_req *cli_smb2_writeall_send(TALLOC_CTX *mem_ctx,
274                         struct tevent_context *ev,
275                         struct cli_state *cli,
276                         uint16_t fnum,
277                         uint16_t mode,
278                         const uint8_t *buf,
279                         off_t offset,
280                         size_t size);
281 NTSTATUS cli_smb2_writeall_recv(struct tevent_req *req,
282                         size_t *pwritten);
283 struct tevent_req *cli_smb2_splice_send(TALLOC_CTX *mem_ctx,
284                         struct tevent_context *ev,
285                         struct cli_state *cli,
286                         uint16_t src_fnum, uint16_t dst_fnum,
287                         off_t size, off_t src_offset, off_t dst_offset,
288                         int (*splice_cb)(off_t n, void *priv), void *priv);
289 NTSTATUS cli_smb2_splice_recv(struct tevent_req *req, off_t *written);
290 NTSTATUS cli_smb2_shadow_copy_data(TALLOC_CTX *mem_ctx,
291                         struct cli_state *cli,
292                         uint16_t fnum,
293                         bool get_names,
294                         char ***pnames,
295                         int *pnum_names);
296 NTSTATUS cli_smb2_ftruncate(struct cli_state *cli,
297                         uint16_t fnum,
298                         uint64_t newsize);
299 struct tevent_req *cli_smb2_notify_send(
300         TALLOC_CTX *mem_ctx,
301         struct tevent_context *ev,
302         struct cli_state *cli,
303         uint16_t fnum,
304         uint32_t buffer_size,
305         uint32_t completion_filter,
306         bool recursive);
307 NTSTATUS cli_smb2_notify_recv(struct tevent_req *req,
308                               TALLOC_CTX *mem_ctx,
309                               struct notify_change **pchanges,
310                               uint32_t *pnum_changes);
311 NTSTATUS cli_smb2_notify(struct cli_state *cli, uint16_t fnum,
312                          uint32_t buffer_size, uint32_t completion_filter,
313                          bool recursive, TALLOC_CTX *mem_ctx,
314                          struct notify_change **pchanges,
315                          uint32_t *pnum_changes);
316
317 struct tevent_req *cli_smb2_fsctl_send(
318         TALLOC_CTX *mem_ctx,
319         struct tevent_context *ev,
320         struct cli_state *cli,
321         uint16_t fnum,
322         uint32_t ctl_code,
323         const DATA_BLOB *in,
324         uint32_t max_out);
325 NTSTATUS cli_smb2_fsctl_recv(
326         struct tevent_req *req, TALLOC_CTX *mem_ctx, DATA_BLOB *out);
327
328 #endif /* __SMB2CLI_FNUM_H__ */