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