s4:auth: Enforce machine authentication policy for NTLM authentication
[Samba.git] / source3 / libsmb / cli_smb2_fnum.h
blob986db2c1b0fa51f1f93efe314cfb95c70b87cf7d
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 NTSTATUS cli_smb2_close_fnum_recv(struct tevent_req *req);
75 NTSTATUS cli_smb2_close_fnum(struct cli_state *cli, uint16_t fnum);
76 struct tevent_req *cli_smb2_delete_on_close_send(TALLOC_CTX *mem_ctx,
77 struct tevent_context *ev,
78 struct cli_state *cli,
79 uint16_t fnum,
80 bool flag);
81 NTSTATUS cli_smb2_delete_on_close_recv(struct tevent_req *req);
82 NTSTATUS cli_smb2_delete_on_close(struct cli_state *cli, uint16_t fnum, bool flag);
83 struct tevent_req *cli_smb2_mkdir_send(
84 TALLOC_CTX *mem_ctx,
85 struct tevent_context *ev,
86 struct cli_state *cli,
87 const char *name);
88 NTSTATUS cli_smb2_mkdir_recv(struct tevent_req *req);
89 struct tevent_req *cli_smb2_rmdir_send(
90 TALLOC_CTX *mem_ctx,
91 struct tevent_context *ev,
92 struct cli_state *cli,
93 const char *dname,
94 const struct smb2_create_blobs *in_cblobs);
95 NTSTATUS cli_smb2_rmdir_recv(struct tevent_req *req);
96 struct tevent_req *cli_smb2_unlink_send(
97 TALLOC_CTX *mem_ctx,
98 struct tevent_context *ev,
99 struct cli_state *cli,
100 const char *fname,
101 const struct smb2_create_blobs *in_cblobs);
102 NTSTATUS cli_smb2_unlink_recv(struct tevent_req *req);
103 struct tevent_req *cli_smb2_list_send(
104 TALLOC_CTX *mem_ctx,
105 struct tevent_context *ev,
106 struct cli_state *cli,
107 const char *pathname,
108 unsigned int info_level,
109 bool posix);
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 NTSTATUS cli_smb2_qpathinfo_alt_name(struct cli_state *cli,
119 const char *name,
120 fstring alt_name);
121 struct tevent_req *cli_smb2_query_info_fnum_send(
122 TALLOC_CTX *mem_ctx,
123 struct tevent_context *ev,
124 struct cli_state *cli,
125 uint16_t fnum,
126 uint8_t in_info_type,
127 uint8_t in_info_class,
128 uint32_t in_max_output_length,
129 const DATA_BLOB *in_input_buffer,
130 uint32_t in_additional_info,
131 uint32_t in_flags);
132 NTSTATUS cli_smb2_query_info_fnum_recv(
133 struct tevent_req *req, TALLOC_CTX *mem_ctx, DATA_BLOB *outbuf);
134 struct tevent_req *cli_smb2_set_info_fnum_send(
135 TALLOC_CTX *mem_ctx,
136 struct tevent_context *ev,
137 struct cli_state *cli,
138 uint16_t fnum,
139 uint8_t in_info_type,
140 uint8_t in_info_class,
141 const DATA_BLOB *in_input_buffer,
142 uint32_t in_additional_info);
143 NTSTATUS cli_smb2_set_info_fnum_recv(struct tevent_req *req);
144 NTSTATUS cli_smb2_set_info_fnum(
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_query_info_fnum(
152 struct cli_state *cli,
153 uint16_t fnum,
154 uint8_t in_info_type,
155 uint8_t in_info_class,
156 uint32_t in_max_output_length,
157 const DATA_BLOB *in_input_buffer,
158 uint32_t in_additional_info,
159 uint32_t in_flags,
160 TALLOC_CTX *mem_ctx,
161 DATA_BLOB *outbuf);
162 NTSTATUS cli_smb2_getatr(struct cli_state *cli,
163 const char *name,
164 uint32_t *pattr,
165 off_t *size,
166 time_t *write_time);
167 struct tevent_req *cli_smb2_qpathinfo2_send(TALLOC_CTX *mem_ctx,
168 struct tevent_context *ev,
169 struct cli_state *cli,
170 const char *fname);
171 NTSTATUS cli_smb2_qpathinfo2_recv(struct tevent_req *req,
172 struct timespec *create_time,
173 struct timespec *access_time,
174 struct timespec *write_time,
175 struct timespec *change_time,
176 off_t *size,
177 uint32_t *attr,
178 SMB_INO_T *ino);
179 NTSTATUS cli_smb2_qpathinfo_streams(struct cli_state *cli,
180 const char *name,
181 TALLOC_CTX *mem_ctx,
182 unsigned int *pnum_streams,
183 struct stream_struct **pstreams);
184 NTSTATUS cli_smb2_setpathinfo(struct cli_state *cli,
185 const char *name,
186 uint8_t in_info_type,
187 uint8_t in_file_info_class,
188 const DATA_BLOB *p_in_data);
189 NTSTATUS cli_smb2_setatr(struct cli_state *cli,
190 const char *fname,
191 uint32_t attr,
192 time_t mtime);
193 NTSTATUS cli_smb2_setattrE(struct cli_state *cli,
194 uint16_t fnum,
195 time_t change_time,
196 time_t access_time,
197 time_t write_time);
198 NTSTATUS cli_smb2_dskattr(struct cli_state *cli,
199 const char *path,
200 uint64_t *bsize,
201 uint64_t *total,
202 uint64_t *avail);
203 NTSTATUS cli_smb2_get_fs_attr_info(struct cli_state *cli, uint32_t *fs_attr);
204 NTSTATUS cli_smb2_get_fs_full_size_info(struct cli_state *cli,
205 uint64_t *total_allocation_units,
206 uint64_t *caller_allocation_units,
207 uint64_t *actual_allocation_units,
208 uint64_t *sectors_per_allocation_unit,
209 uint64_t *bytes_per_sector);
210 NTSTATUS cli_smb2_get_fs_volume_info(struct cli_state *cli,
211 TALLOC_CTX *mem_ctx,
212 char **_volume_name,
213 uint32_t *pserial_number,
214 time_t *pdate);
215 struct tevent_req *cli_smb2_query_mxac_send(TALLOC_CTX *mem_ctx,
216 struct tevent_context *ev,
217 struct cli_state *cli,
218 const char *fname);
219 NTSTATUS cli_smb2_query_mxac_recv(struct tevent_req *req,
220 uint32_t *mxac);
221 NTSTATUS cli_smb2_query_mxac(struct cli_state *cli,
222 const char *fname,
223 uint32_t *mxac);
224 struct tevent_req *cli_smb2_rename_send(
225 TALLOC_CTX *mem_ctx,
226 struct tevent_context *ev,
227 struct cli_state *cli,
228 const char *fname_src,
229 const char *fname_dst,
230 bool replace);
231 NTSTATUS cli_smb2_rename_recv(struct tevent_req *req);
232 NTSTATUS cli_smb2_set_ea_fnum(struct cli_state *cli,
233 uint16_t fnum,
234 const char *ea_name,
235 const char *ea_val,
236 size_t ea_len);
237 NTSTATUS cli_smb2_get_ea_list_path(struct cli_state *cli,
238 const char *name,
239 TALLOC_CTX *ctx,
240 size_t *pnum_eas,
241 struct ea_struct **pea_list);
242 NTSTATUS cli_smb2_set_ea_path(struct cli_state *cli,
243 const char *name,
244 const char *ea_name,
245 const char *ea_val,
246 size_t ea_len);
247 NTSTATUS cli_smb2_get_user_quota(struct cli_state *cli,
248 int quota_fnum,
249 SMB_NTQUOTA_STRUCT *pqt);
250 NTSTATUS cli_smb2_list_user_quota_step(struct cli_state *cli,
251 TALLOC_CTX *mem_ctx,
252 int quota_fnum,
253 SMB_NTQUOTA_LIST **pqt_list,
254 bool first);
255 NTSTATUS cli_smb2_get_fs_quota_info(struct cli_state *cli,
256 int quota_fnum,
257 SMB_NTQUOTA_STRUCT *pqt);
258 NTSTATUS cli_smb2_set_user_quota(struct cli_state *cli,
259 int quota_fnum,
260 SMB_NTQUOTA_LIST *qtl);
261 NTSTATUS cli_smb2_set_fs_quota_info(struct cli_state *cli,
262 int quota_fnum,
263 SMB_NTQUOTA_STRUCT *pqt);
264 struct tevent_req *cli_smb2_read_send(TALLOC_CTX *mem_ctx,
265 struct tevent_context *ev,
266 struct cli_state *cli,
267 uint16_t fnum,
268 off_t offset,
269 size_t size);
270 NTSTATUS cli_smb2_read_recv(struct tevent_req *req,
271 ssize_t *received,
272 uint8_t **rcvbuf);
273 struct tevent_req *cli_smb2_write_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_write_recv(struct tevent_req *req,
282 size_t *pwritten);
283 struct tevent_req *cli_smb2_writeall_send(TALLOC_CTX *mem_ctx,
284 struct tevent_context *ev,
285 struct cli_state *cli,
286 uint16_t fnum,
287 uint16_t mode,
288 const uint8_t *buf,
289 off_t offset,
290 size_t size);
291 NTSTATUS cli_smb2_writeall_recv(struct tevent_req *req,
292 size_t *pwritten);
293 struct tevent_req *cli_smb2_splice_send(TALLOC_CTX *mem_ctx,
294 struct tevent_context *ev,
295 struct cli_state *cli,
296 uint16_t src_fnum, uint16_t dst_fnum,
297 off_t size, off_t src_offset, off_t dst_offset,
298 int (*splice_cb)(off_t n, void *priv), void *priv);
299 NTSTATUS cli_smb2_splice_recv(struct tevent_req *req, off_t *written);
300 NTSTATUS cli_smb2_shadow_copy_data(TALLOC_CTX *mem_ctx,
301 struct cli_state *cli,
302 uint16_t fnum,
303 bool get_names,
304 char ***pnames,
305 int *pnum_names);
306 NTSTATUS cli_smb2_ftruncate(struct cli_state *cli,
307 uint16_t fnum,
308 uint64_t newsize);
309 struct tevent_req *cli_smb2_notify_send(
310 TALLOC_CTX *mem_ctx,
311 struct tevent_context *ev,
312 struct cli_state *cli,
313 uint16_t fnum,
314 uint32_t buffer_size,
315 uint32_t completion_filter,
316 bool recursive);
317 NTSTATUS cli_smb2_notify_recv(struct tevent_req *req,
318 TALLOC_CTX *mem_ctx,
319 struct notify_change **pchanges,
320 uint32_t *pnum_changes);
321 NTSTATUS cli_smb2_notify(struct cli_state *cli, uint16_t fnum,
322 uint32_t buffer_size, uint32_t completion_filter,
323 bool recursive, TALLOC_CTX *mem_ctx,
324 struct notify_change **pchanges,
325 uint32_t *pnum_changes);
327 struct tevent_req *cli_smb2_fsctl_send(
328 TALLOC_CTX *mem_ctx,
329 struct tevent_context *ev,
330 struct cli_state *cli,
331 uint16_t fnum,
332 uint32_t ctl_code,
333 const DATA_BLOB *in,
334 uint32_t max_out);
335 NTSTATUS cli_smb2_fsctl_recv(
336 struct tevent_req *req, TALLOC_CTX *mem_ctx, DATA_BLOB *out);
338 #endif /* __SMB2CLI_FNUM_H__ */