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