62ae093862fbaff55b27913526473b99e4cb49fd
[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
28 struct tevent_req *cli_smb2_create_fnum_send(
29         TALLOC_CTX *mem_ctx,
30         struct tevent_context *ev,
31         struct cli_state *cli,
32         const char *fname,
33         uint32_t create_flags,
34         uint32_t impersonation_level,
35         uint32_t desired_access,
36         uint32_t file_attributes,
37         uint32_t share_access,
38         uint32_t create_disposition,
39         uint32_t create_options,
40         const struct smb2_create_blobs *in_cblobs);
41 NTSTATUS cli_smb2_create_fnum_recv(
42         struct tevent_req *req,
43         uint16_t *pfnum,
44         struct smb_create_returns *cr,
45         TALLOC_CTX *mem_ctx,
46         struct smb2_create_blobs *out_cblobs);
47 NTSTATUS cli_smb2_create_fnum(
48         struct cli_state *cli,
49         const char *fname,
50         uint32_t create_flags,
51         uint32_t impersonation_level,
52         uint32_t desired_access,
53         uint32_t file_attributes,
54         uint32_t share_access,
55         uint32_t create_disposition,
56         uint32_t create_options,
57         const struct smb2_create_blobs *in_cblobs,
58         uint16_t *pfid,
59         struct smb_create_returns *cr,
60         TALLOC_CTX *mem_ctx,
61         struct smb2_create_blobs *out_cblobs);
62
63 struct tevent_req *cli_smb2_close_fnum_send(TALLOC_CTX *mem_ctx,
64                                             struct tevent_context *ev,
65                                             struct cli_state *cli,
66                                             uint16_t fnum);
67 NTSTATUS cli_smb2_close_fnum_recv(struct tevent_req *req);
68 NTSTATUS cli_smb2_close_fnum(struct cli_state *cli, uint16_t fnum);
69 struct tevent_req *cli_smb2_delete_on_close_send(TALLOC_CTX *mem_ctx,
70                                         struct tevent_context *ev,
71                                         struct cli_state *cli,
72                                         uint16_t fnum,
73                                         bool flag);
74 NTSTATUS cli_smb2_delete_on_close_recv(struct tevent_req *req);
75 NTSTATUS cli_smb2_delete_on_close(struct cli_state *cli, uint16_t fnum, bool flag);
76 NTSTATUS cli_smb2_mkdir(struct cli_state *cli, const char *dirname);
77 struct tevent_req *cli_smb2_rmdir_send(TALLOC_CTX *mem_ctx,
78                                        struct tevent_context *ev,
79                                        struct cli_state *cli,
80                                        const char *dname);
81 NTSTATUS cli_smb2_rmdir_recv(struct tevent_req *req);
82 NTSTATUS cli_smb2_rmdir(struct cli_state *cli, const char *dirname);
83 NTSTATUS cli_smb2_unlink(struct cli_state *cli,const char *fname);
84 NTSTATUS cli_smb2_list(struct cli_state *cli,
85                         const char *pathname,
86                         uint16_t attribute,
87                         NTSTATUS (*fn)(const char *,
88                                 struct file_info *,
89                                 const char *,
90                                 void *),
91                         void *state);
92 NTSTATUS cli_smb2_qpathinfo_basic(struct cli_state *cli,
93                         const char *name,
94                         SMB_STRUCT_STAT *sbuf,
95                         uint32_t *attributes);
96 NTSTATUS cli_smb2_qpathinfo_alt_name(struct cli_state *cli,
97                         const char *name,
98                         fstring alt_name);
99 NTSTATUS cli_smb2_chkpath(struct cli_state *cli,
100                         const char *name);
101 NTSTATUS cli_smb2_qfileinfo_basic(struct cli_state *cli,
102                         uint16_t fnum,
103                         uint16_t *mode,
104                         off_t *size,
105                         struct timespec *create_time,
106                         struct timespec *access_time,
107                         struct timespec *write_time,
108                         struct timespec *change_time,
109                         SMB_INO_T *ino);
110 NTSTATUS cli_smb2_getattrE(struct cli_state *cli,
111                         uint16_t fnum,
112                         uint16_t *attr,
113                         off_t *size,
114                         time_t *change_time,
115                         time_t *access_time,
116                         time_t *write_time);
117 NTSTATUS cli_smb2_getatr(struct cli_state *cli,
118                         const char *name,
119                         uint16_t *attr,
120                         off_t *size,
121                         time_t *write_time);
122 NTSTATUS cli_smb2_qpathinfo2(struct cli_state *cli,
123                         const char *fname,
124                         struct timespec *create_time,
125                         struct timespec *access_time,
126                         struct timespec *write_time,
127                         struct timespec *change_time,
128                         off_t *size,
129                         uint16_t *mode,
130                         SMB_INO_T *ino);
131 NTSTATUS cli_smb2_qpathinfo_streams(struct cli_state *cli,
132                         const char *name,
133                         TALLOC_CTX *mem_ctx,
134                         unsigned int *pnum_streams,
135                         struct stream_struct **pstreams);
136 NTSTATUS cli_smb2_setpathinfo(struct cli_state *cli,
137                         const char *name,
138                         uint8_t in_info_type,
139                         uint8_t in_file_info_class,
140                         const DATA_BLOB *p_in_data);
141 NTSTATUS cli_smb2_setatr(struct cli_state *cli,
142                         const char *fname,
143                         uint16_t attr,
144                         time_t mtime);
145 NTSTATUS cli_smb2_setattrE(struct cli_state *cli,
146                         uint16_t fnum,
147                         time_t change_time,
148                         time_t access_time,
149                         time_t write_time);
150 NTSTATUS cli_smb2_dskattr(struct cli_state *cli,
151                         const char *path,
152                         uint64_t *bsize,
153                         uint64_t *total,
154                         uint64_t *avail);
155 NTSTATUS cli_smb2_get_fs_attr_info(struct cli_state *cli, uint32_t *fs_attr);
156 NTSTATUS cli_smb2_get_fs_full_size_info(struct cli_state *cli,
157                         uint64_t *total_allocation_units,
158                         uint64_t *caller_allocation_units,
159                         uint64_t *actual_allocation_units,
160                         uint64_t *sectors_per_allocation_unit,
161                         uint64_t *bytes_per_sector);
162 NTSTATUS cli_smb2_get_fs_volume_info(struct cli_state *cli,
163                         TALLOC_CTX *mem_ctx,
164                         char **_volume_name,
165                         uint32_t *pserial_number,
166                         time_t *pdate);
167 NTSTATUS cli_smb2_query_security_descriptor(struct cli_state *cli,
168                         uint16_t fnum,
169                         uint32_t sec_info,
170                         TALLOC_CTX *mem_ctx,
171                         struct security_descriptor **ppsd);
172 NTSTATUS cli_smb2_set_security_descriptor(struct cli_state *cli,
173                         uint16_t fnum,
174                         uint32_t sec_info,
175                         const struct security_descriptor *sd);
176 NTSTATUS cli_smb2_rename(struct cli_state *cli,
177                          const char *fname_src,
178                          const char *fname_dst,
179                          bool replace);
180 NTSTATUS cli_smb2_set_ea_fnum(struct cli_state *cli,
181                         uint16_t fnum,
182                         const char *ea_name,
183                         const char *ea_val,
184                         size_t ea_len);
185 NTSTATUS cli_smb2_get_ea_list_path(struct cli_state *cli,
186                         const char *name,
187                         TALLOC_CTX *ctx,
188                         size_t *pnum_eas,
189                         struct ea_struct **pea_list);
190 NTSTATUS cli_smb2_set_ea_path(struct cli_state *cli,
191                         const char *name,
192                         const char *ea_name,
193                         const char *ea_val,
194                         size_t ea_len);
195 NTSTATUS cli_smb2_get_user_quota(struct cli_state *cli,
196                                  int quota_fnum,
197                                  SMB_NTQUOTA_STRUCT *pqt);
198 NTSTATUS cli_smb2_list_user_quota_step(struct cli_state *cli,
199                                        TALLOC_CTX *mem_ctx,
200                                        int quota_fnum,
201                                        SMB_NTQUOTA_LIST **pqt_list,
202                                        bool first);
203 NTSTATUS cli_smb2_get_fs_quota_info(struct cli_state *cli,
204                                     int quota_fnum,
205                                     SMB_NTQUOTA_STRUCT *pqt);
206 NTSTATUS cli_smb2_set_user_quota(struct cli_state *cli,
207                                  int quota_fnum,
208                                  SMB_NTQUOTA_LIST *qtl);
209 NTSTATUS cli_smb2_set_fs_quota_info(struct cli_state *cli,
210                                     int quota_fnum,
211                                     SMB_NTQUOTA_STRUCT *pqt);
212 struct tevent_req *cli_smb2_read_send(TALLOC_CTX *mem_ctx,
213                                 struct tevent_context *ev,
214                                 struct cli_state *cli,
215                                 uint16_t fnum,
216                                 off_t offset,
217                                 size_t size);
218 NTSTATUS cli_smb2_read_recv(struct tevent_req *req,
219                                 ssize_t *received,
220                                 uint8_t **rcvbuf);
221 struct tevent_req *cli_smb2_write_send(TALLOC_CTX *mem_ctx,
222                                         struct tevent_context *ev,
223                                         struct cli_state *cli,
224                                         uint16_t fnum,
225                                         uint16_t mode,
226                                         const uint8_t *buf,
227                                         off_t offset,
228                                         size_t size);
229 NTSTATUS cli_smb2_write_recv(struct tevent_req *req,
230                              size_t *pwritten);
231 struct tevent_req *cli_smb2_writeall_send(TALLOC_CTX *mem_ctx,
232                         struct tevent_context *ev,
233                         struct cli_state *cli,
234                         uint16_t fnum,
235                         uint16_t mode,
236                         const uint8_t *buf,
237                         off_t offset,
238                         size_t size);
239 NTSTATUS cli_smb2_writeall_recv(struct tevent_req *req,
240                         size_t *pwritten);
241 struct tevent_req *cli_smb2_splice_send(TALLOC_CTX *mem_ctx,
242                         struct tevent_context *ev,
243                         struct cli_state *cli,
244                         uint16_t src_fnum, uint16_t dst_fnum,
245                         off_t size, off_t src_offset, off_t dst_offset,
246                         int (*splice_cb)(off_t n, void *priv), void *priv);
247 NTSTATUS cli_smb2_splice_recv(struct tevent_req *req, off_t *written);
248 NTSTATUS cli_smb2_shadow_copy_data(TALLOC_CTX *mem_ctx,
249                         struct cli_state *cli,
250                         uint16_t fnum,
251                         bool get_names,
252                         char ***pnames,
253                         int *pnum_names);
254 NTSTATUS cli_smb2_ftruncate(struct cli_state *cli,
255                         uint16_t fnum,
256                         uint64_t newsize);
257 struct tevent_req *cli_smb2_notify_send(
258         TALLOC_CTX *mem_ctx,
259         struct tevent_context *ev,
260         struct cli_state *cli,
261         uint16_t fnum,
262         uint32_t buffer_size,
263         uint32_t completion_filter,
264         bool recursive);
265 NTSTATUS cli_smb2_notify_recv(struct tevent_req *req,
266                               TALLOC_CTX *mem_ctx,
267                               struct notify_change **pchanges,
268                               uint32_t *pnum_changes);
269 NTSTATUS cli_smb2_notify(struct cli_state *cli, uint16_t fnum,
270                          uint32_t buffer_size, uint32_t completion_filter,
271                          bool recursive, TALLOC_CTX *mem_ctx,
272                          struct notify_change **pchanges,
273                          uint32_t *pnum_changes);
274 struct tevent_req *cli_smb2_set_reparse_point_fnum_send(
275                         TALLOC_CTX *mem_ctx,
276                         struct tevent_context *ev,
277                         struct cli_state *cli,
278                         uint16_t fnum,
279                         DATA_BLOB in_buf);
280 NTSTATUS cli_smb2_set_reparse_point_fnum_recv(struct tevent_req *req);
281
282 struct tevent_req *cli_smb2_get_reparse_point_fnum_send(
283                         TALLOC_CTX *mem_ctx,
284                         struct tevent_context *ev,
285                         struct cli_state *cli,
286                         uint16_t fnum);
287 NTSTATUS cli_smb2_get_reparse_point_fnum_recv(struct tevent_req *req,
288                         TALLOC_CTX *mem_ctx,
289                         DATA_BLOB *output);
290
291 #endif /* __SMB2CLI_FNUM_H__ */