s3: libsmb: Add cli_smb2_setpathinfo(), to be called by cli_setpathinfo_basic().
[Samba.git] / source3 / libsmb / cli_smb2_fnum.h
blob8e240c6bc5b3fabf7d6141f38ea8385daaca080d
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_qfileinfo_basic(struct cli_state *cli,
83 uint16_t fnum,
84 uint16_t *mode,
85 off_t *size,
86 struct timespec *create_time,
87 struct timespec *access_time,
88 struct timespec *write_time,
89 struct timespec *change_time,
90 SMB_INO_T *ino);
91 NTSTATUS cli_smb2_getattrE(struct cli_state *cli,
92 uint16_t fnum,
93 uint16_t *attr,
94 off_t *size,
95 time_t *change_time,
96 time_t *access_time,
97 time_t *write_time);
98 NTSTATUS cli_smb2_getatr(struct cli_state *cli,
99 const char *name,
100 uint16_t *attr,
101 off_t *size,
102 time_t *write_time);
103 NTSTATUS cli_smb2_qpathinfo2(struct cli_state *cli,
104 const char *fname,
105 struct timespec *create_time,
106 struct timespec *access_time,
107 struct timespec *write_time,
108 struct timespec *change_time,
109 off_t *size,
110 uint16_t *mode,
111 SMB_INO_T *ino);
112 NTSTATUS cli_smb2_qpathinfo_streams(struct cli_state *cli,
113 const char *name,
114 TALLOC_CTX *mem_ctx,
115 unsigned int *pnum_streams,
116 struct stream_struct **pstreams);
117 NTSTATUS cli_smb2_setpathinfo(struct cli_state *cli,
118 const char *name,
119 uint8_t in_info_type,
120 uint8_t in_file_info_class,
121 const DATA_BLOB *p_in_data);
122 NTSTATUS cli_smb2_setatr(struct cli_state *cli,
123 const char *fname,
124 uint16_t attr,
125 time_t mtime);
126 NTSTATUS cli_smb2_setattrE(struct cli_state *cli,
127 uint16_t fnum,
128 time_t change_time,
129 time_t access_time,
130 time_t write_time);
131 NTSTATUS cli_smb2_dskattr(struct cli_state *cli,
132 const char *path,
133 uint64_t *bsize,
134 uint64_t *total,
135 uint64_t *avail);
136 NTSTATUS cli_smb2_get_fs_attr_info(struct cli_state *cli, uint32_t *fs_attr);
137 NTSTATUS cli_smb2_query_security_descriptor(struct cli_state *cli,
138 uint16_t fnum,
139 uint32_t sec_info,
140 TALLOC_CTX *mem_ctx,
141 struct security_descriptor **ppsd);
142 NTSTATUS cli_smb2_set_security_descriptor(struct cli_state *cli,
143 uint16_t fnum,
144 uint32_t sec_info,
145 const struct security_descriptor *sd);
146 NTSTATUS cli_smb2_rename(struct cli_state *cli,
147 const char *fname_src,
148 const char *fname_dst,
149 bool replace);
150 NTSTATUS cli_smb2_set_ea_fnum(struct cli_state *cli,
151 uint16_t fnum,
152 const char *ea_name,
153 const char *ea_val,
154 size_t ea_len);
155 NTSTATUS cli_smb2_get_ea_list_path(struct cli_state *cli,
156 const char *name,
157 TALLOC_CTX *ctx,
158 size_t *pnum_eas,
159 struct ea_struct **pea_list);
160 NTSTATUS cli_smb2_set_ea_path(struct cli_state *cli,
161 const char *name,
162 const char *ea_name,
163 const char *ea_val,
164 size_t ea_len);
165 NTSTATUS cli_smb2_get_user_quota(struct cli_state *cli,
166 int quota_fnum,
167 SMB_NTQUOTA_STRUCT *pqt);
168 NTSTATUS cli_smb2_list_user_quota_step(struct cli_state *cli,
169 TALLOC_CTX *mem_ctx,
170 int quota_fnum,
171 SMB_NTQUOTA_LIST **pqt_list,
172 bool first);
173 NTSTATUS cli_smb2_get_fs_quota_info(struct cli_state *cli,
174 int quota_fnum,
175 SMB_NTQUOTA_STRUCT *pqt);
176 NTSTATUS cli_smb2_set_user_quota(struct cli_state *cli,
177 int quota_fnum,
178 SMB_NTQUOTA_LIST *qtl);
179 NTSTATUS cli_smb2_set_fs_quota_info(struct cli_state *cli,
180 int quota_fnum,
181 SMB_NTQUOTA_STRUCT *pqt);
182 struct tevent_req *cli_smb2_read_send(TALLOC_CTX *mem_ctx,
183 struct tevent_context *ev,
184 struct cli_state *cli,
185 uint16_t fnum,
186 off_t offset,
187 size_t size);
188 NTSTATUS cli_smb2_read_recv(struct tevent_req *req,
189 ssize_t *received,
190 uint8_t **rcvbuf);
191 struct tevent_req *cli_smb2_write_send(TALLOC_CTX *mem_ctx,
192 struct tevent_context *ev,
193 struct cli_state *cli,
194 uint16_t fnum,
195 uint16_t mode,
196 const uint8_t *buf,
197 off_t offset,
198 size_t size);
199 NTSTATUS cli_smb2_write_recv(struct tevent_req *req,
200 size_t *pwritten);
201 struct tevent_req *cli_smb2_writeall_send(TALLOC_CTX *mem_ctx,
202 struct tevent_context *ev,
203 struct cli_state *cli,
204 uint16_t fnum,
205 uint16_t mode,
206 const uint8_t *buf,
207 off_t offset,
208 size_t size);
209 NTSTATUS cli_smb2_writeall_recv(struct tevent_req *req,
210 size_t *pwritten);
211 struct tevent_req *cli_smb2_splice_send(TALLOC_CTX *mem_ctx,
212 struct tevent_context *ev,
213 struct cli_state *cli,
214 uint16_t src_fnum, uint16_t dst_fnum,
215 off_t size, off_t src_offset, off_t dst_offset,
216 int (*splice_cb)(off_t n, void *priv), void *priv);
217 NTSTATUS cli_smb2_splice_recv(struct tevent_req *req, off_t *written);
218 NTSTATUS cli_smb2_shadow_copy_data(TALLOC_CTX *mem_ctx,
219 struct cli_state *cli,
220 uint16_t fnum,
221 bool get_names,
222 char ***pnames,
223 int *pnum_names);
224 NTSTATUS cli_smb2_ftruncate(struct cli_state *cli,
225 uint16_t fnum,
226 uint64_t newsize);
227 #endif /* __SMB2CLI_FNUM_H__ */