s3:idmap_ad: add support for ADS_AUTH_SASL_{STARTTLS,LDAPS}
[Samba.git] / source3 / libsmb / cli_smb2_fnum.h
blobabac569385ddedca21f7e10502b5549ee13484ce
1 /*
2 Unix SMB/CIFS implementation.
3 smb2 wrapper client routines
4 Copyright (C) Jeremy Allison 2013
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.
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.
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/>.
20 #ifndef __SMB2CLI_FNUM_H__
21 #define __SMB2CLI_FNUM_H__
23 struct smbXcli_conn;
24 struct smbXcli_session;
25 struct cli_state;
26 struct file_info;
27 struct symlink_reparse_struct;
29 struct cli_smb2_create_flags {
30 bool batch_oplock:1;
31 bool exclusive_oplock:1;
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);
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 NTSTATUS cli_smb2_list_recv(
111 struct tevent_req *req,
112 TALLOC_CTX *mem_ctx,
113 struct file_info **pfinfo);
114 NTSTATUS cli_smb2_qpathinfo_basic(struct cli_state *cli,
115 const char *name,
116 SMB_STRUCT_STAT *sbuf,
117 uint32_t *attributes);
118 struct tevent_req *cli_smb2_qpathinfo_send(TALLOC_CTX *mem_ctx,
119 struct tevent_context *ev,
120 struct cli_state *cli,
121 const char *fname,
122 uint16_t level,
123 uint32_t min_rdata,
124 uint32_t max_rdata);
125 NTSTATUS cli_smb2_qpathinfo_recv(struct tevent_req *req,
126 TALLOC_CTX *mem_ctx,
127 uint8_t **rdata,
128 uint32_t *num_rdata);
129 struct tevent_req *cli_smb2_query_info_fnum_send(
130 TALLOC_CTX *mem_ctx,
131 struct tevent_context *ev,
132 struct cli_state *cli,
133 uint16_t fnum,
134 uint8_t in_info_type,
135 uint8_t in_info_class,
136 uint32_t in_max_output_length,
137 const DATA_BLOB *in_input_buffer,
138 uint32_t in_additional_info,
139 uint32_t in_flags);
140 NTSTATUS cli_smb2_query_info_fnum_recv(
141 struct tevent_req *req, TALLOC_CTX *mem_ctx, DATA_BLOB *outbuf);
142 struct tevent_req *cli_smb2_set_info_fnum_send(
143 TALLOC_CTX *mem_ctx,
144 struct tevent_context *ev,
145 struct cli_state *cli,
146 uint16_t fnum,
147 uint8_t in_info_type,
148 uint8_t in_info_class,
149 const DATA_BLOB *in_input_buffer,
150 uint32_t in_additional_info);
151 NTSTATUS cli_smb2_set_info_fnum_recv(struct tevent_req *req);
152 NTSTATUS cli_smb2_set_info_fnum(
153 struct cli_state *cli,
154 uint16_t fnum,
155 uint8_t in_info_type,
156 uint8_t in_info_class,
157 const DATA_BLOB *in_input_buffer,
158 uint32_t in_additional_info);
159 NTSTATUS cli_smb2_query_info_fnum(
160 struct cli_state *cli,
161 uint16_t fnum,
162 uint8_t in_info_type,
163 uint8_t in_info_class,
164 uint32_t in_max_output_length,
165 const DATA_BLOB *in_input_buffer,
166 uint32_t in_additional_info,
167 uint32_t in_flags,
168 TALLOC_CTX *mem_ctx,
169 DATA_BLOB *outbuf);
170 NTSTATUS cli_smb2_setpathinfo(struct cli_state *cli,
171 const char *name,
172 uint8_t in_info_type,
173 uint8_t in_file_info_class,
174 const DATA_BLOB *p_in_data);
175 NTSTATUS cli_smb2_setatr(struct cli_state *cli,
176 const char *fname,
177 uint32_t attr,
178 time_t mtime);
179 NTSTATUS cli_smb2_setattrE(struct cli_state *cli,
180 uint16_t fnum,
181 time_t change_time,
182 time_t access_time,
183 time_t write_time);
184 NTSTATUS cli_smb2_dskattr(struct cli_state *cli,
185 const char *path,
186 uint64_t *bsize,
187 uint64_t *total,
188 uint64_t *avail);
189 NTSTATUS cli_smb2_get_fs_attr_info(struct cli_state *cli, uint32_t *fs_attr);
190 NTSTATUS cli_smb2_get_fs_full_size_info(struct cli_state *cli,
191 uint64_t *total_allocation_units,
192 uint64_t *caller_allocation_units,
193 uint64_t *actual_allocation_units,
194 uint64_t *sectors_per_allocation_unit,
195 uint64_t *bytes_per_sector);
196 NTSTATUS cli_smb2_get_fs_volume_info(struct cli_state *cli,
197 TALLOC_CTX *mem_ctx,
198 char **_volume_name,
199 uint32_t *pserial_number,
200 time_t *pdate);
201 struct tevent_req *cli_smb2_query_mxac_send(TALLOC_CTX *mem_ctx,
202 struct tevent_context *ev,
203 struct cli_state *cli,
204 const char *fname);
205 NTSTATUS cli_smb2_query_mxac_recv(struct tevent_req *req,
206 uint32_t *mxac);
207 NTSTATUS cli_smb2_query_mxac(struct cli_state *cli,
208 const char *fname,
209 uint32_t *mxac);
210 struct tevent_req *cli_smb2_rename_send(
211 TALLOC_CTX *mem_ctx,
212 struct tevent_context *ev,
213 struct cli_state *cli,
214 const char *fname_src,
215 const char *fname_dst,
216 bool replace);
217 NTSTATUS cli_smb2_rename_recv(struct tevent_req *req);
218 NTSTATUS cli_smb2_set_ea_fnum(struct cli_state *cli,
219 uint16_t fnum,
220 const char *ea_name,
221 const char *ea_val,
222 size_t ea_len);
223 NTSTATUS cli_smb2_get_ea_list_path(struct cli_state *cli,
224 const char *name,
225 TALLOC_CTX *ctx,
226 size_t *pnum_eas,
227 struct ea_struct **pea_list);
228 NTSTATUS cli_smb2_set_ea_path(struct cli_state *cli,
229 const char *name,
230 const char *ea_name,
231 const char *ea_val,
232 size_t ea_len);
233 NTSTATUS cli_smb2_get_user_quota(struct cli_state *cli,
234 int quota_fnum,
235 SMB_NTQUOTA_STRUCT *pqt);
236 NTSTATUS cli_smb2_list_user_quota_step(struct cli_state *cli,
237 TALLOC_CTX *mem_ctx,
238 int quota_fnum,
239 SMB_NTQUOTA_LIST **pqt_list,
240 bool first);
241 NTSTATUS cli_smb2_get_fs_quota_info(struct cli_state *cli,
242 int quota_fnum,
243 SMB_NTQUOTA_STRUCT *pqt);
244 NTSTATUS cli_smb2_set_user_quota(struct cli_state *cli,
245 int quota_fnum,
246 SMB_NTQUOTA_LIST *qtl);
247 NTSTATUS cli_smb2_set_fs_quota_info(struct cli_state *cli,
248 int quota_fnum,
249 SMB_NTQUOTA_STRUCT *pqt);
250 struct tevent_req *cli_smb2_read_send(TALLOC_CTX *mem_ctx,
251 struct tevent_context *ev,
252 struct cli_state *cli,
253 uint16_t fnum,
254 off_t offset,
255 size_t size);
256 NTSTATUS cli_smb2_read_recv(struct tevent_req *req,
257 ssize_t *received,
258 uint8_t **rcvbuf);
259 struct tevent_req *cli_smb2_write_send(TALLOC_CTX *mem_ctx,
260 struct tevent_context *ev,
261 struct cli_state *cli,
262 uint16_t fnum,
263 uint16_t mode,
264 const uint8_t *buf,
265 off_t offset,
266 size_t size);
267 NTSTATUS cli_smb2_write_recv(struct tevent_req *req,
268 size_t *pwritten);
269 struct tevent_req *cli_smb2_writeall_send(TALLOC_CTX *mem_ctx,
270 struct tevent_context *ev,
271 struct cli_state *cli,
272 uint16_t fnum,
273 uint16_t mode,
274 const uint8_t *buf,
275 off_t offset,
276 size_t size);
277 NTSTATUS cli_smb2_writeall_recv(struct tevent_req *req,
278 size_t *pwritten);
279 struct tevent_req *cli_smb2_splice_send(TALLOC_CTX *mem_ctx,
280 struct tevent_context *ev,
281 struct cli_state *cli,
282 uint16_t src_fnum, uint16_t dst_fnum,
283 off_t size, off_t src_offset, off_t dst_offset,
284 int (*splice_cb)(off_t n, void *priv), void *priv);
285 NTSTATUS cli_smb2_splice_recv(struct tevent_req *req, off_t *written);
286 NTSTATUS cli_smb2_shadow_copy_data(TALLOC_CTX *mem_ctx,
287 struct cli_state *cli,
288 uint16_t fnum,
289 bool get_names,
290 char ***pnames,
291 int *pnum_names);
292 NTSTATUS cli_smb2_ftruncate(struct cli_state *cli,
293 uint16_t fnum,
294 uint64_t newsize);
295 struct tevent_req *cli_smb2_notify_send(
296 TALLOC_CTX *mem_ctx,
297 struct tevent_context *ev,
298 struct cli_state *cli,
299 uint16_t fnum,
300 uint32_t buffer_size,
301 uint32_t completion_filter,
302 bool recursive);
303 NTSTATUS cli_smb2_notify_recv(struct tevent_req *req,
304 TALLOC_CTX *mem_ctx,
305 struct notify_change **pchanges,
306 uint32_t *pnum_changes);
307 NTSTATUS cli_smb2_notify(struct cli_state *cli, uint16_t fnum,
308 uint32_t buffer_size, uint32_t completion_filter,
309 bool recursive, TALLOC_CTX *mem_ctx,
310 struct notify_change **pchanges,
311 uint32_t *pnum_changes);
313 struct tevent_req *cli_smb2_fsctl_send(
314 TALLOC_CTX *mem_ctx,
315 struct tevent_context *ev,
316 struct cli_state *cli,
317 uint16_t fnum,
318 uint32_t ctl_code,
319 const DATA_BLOB *in,
320 uint32_t max_out);
321 NTSTATUS cli_smb2_fsctl_recv(
322 struct tevent_req *req, TALLOC_CTX *mem_ctx, DATA_BLOB *out);
324 #endif /* __SMB2CLI_FNUM_H__ */