libgpo: apply some const.
[kai/samba-autobuild/.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 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);
50
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 NTSTATUS cli_smb2_mkdir(struct cli_state *cli, const char *dirname);
58 NTSTATUS cli_smb2_rmdir(struct cli_state *cli, const char *dirname);
59 NTSTATUS cli_smb2_unlink(struct cli_state *cli,const char *fname);
60 NTSTATUS cli_smb2_list(struct cli_state *cli,
61                         const char *pathname,
62                         uint16_t attribute,
63                         NTSTATUS (*fn)(const char *,
64                                 struct file_info *,
65                                 const char *,
66                                 void *),
67                         void *state);
68 NTSTATUS cli_smb2_qpathinfo_basic(struct cli_state *cli,
69                         const char *name,
70                         SMB_STRUCT_STAT *sbuf,
71                         uint32_t *attributes);
72 NTSTATUS cli_smb2_qpathinfo_alt_name(struct cli_state *cli,
73                         const char *name,
74                         fstring alt_name);
75 NTSTATUS cli_smb2_qfileinfo_basic(struct cli_state *cli,
76                         uint16_t fnum,
77                         uint16_t *mode,
78                         off_t *size,
79                         struct timespec *create_time,
80                         struct timespec *access_time,
81                         struct timespec *write_time,
82                         struct timespec *change_time,
83                         SMB_INO_T *ino);
84 NTSTATUS cli_smb2_getattrE(struct cli_state *cli,
85                         uint16_t fnum,
86                         uint16_t *attr,
87                         off_t *size,
88                         time_t *change_time,
89                         time_t *access_time,
90                         time_t *write_time);
91 NTSTATUS cli_smb2_getatr(struct cli_state *cli,
92                         const char *name,
93                         uint16_t *attr,
94                         off_t *size,
95                         time_t *write_time);
96 NTSTATUS cli_smb2_qpathinfo2(struct cli_state *cli,
97                         const char *fname,
98                         struct timespec *create_time,
99                         struct timespec *access_time,
100                         struct timespec *write_time,
101                         struct timespec *change_time,
102                         off_t *size,
103                         uint16_t *mode,
104                         SMB_INO_T *ino);
105 NTSTATUS cli_smb2_qpathinfo_streams(struct cli_state *cli,
106                         const char *name,
107                         TALLOC_CTX *mem_ctx,
108                         unsigned int *pnum_streams,
109                         struct stream_struct **pstreams);
110 NTSTATUS cli_smb2_setatr(struct cli_state *cli,
111                         const char *fname,
112                         uint16_t attr,
113                         time_t mtime);
114 NTSTATUS cli_smb2_setattrE(struct cli_state *cli,
115                         uint16_t fnum,
116                         time_t change_time,
117                         time_t access_time,
118                         time_t write_time);
119 NTSTATUS cli_smb2_dskattr(struct cli_state *cli,
120                         const char *path,
121                         uint64_t *bsize,
122                         uint64_t *total,
123                         uint64_t *avail);
124 NTSTATUS cli_smb2_get_fs_attr_info(struct cli_state *cli, uint32_t *fs_attr);
125 NTSTATUS cli_smb2_query_security_descriptor(struct cli_state *cli,
126                         uint16_t fnum,
127                         uint32_t sec_info,
128                         TALLOC_CTX *mem_ctx,
129                         struct security_descriptor **ppsd);
130 NTSTATUS cli_smb2_set_security_descriptor(struct cli_state *cli,
131                         uint16_t fnum,
132                         uint32_t sec_info,
133                         const struct security_descriptor *sd);
134 NTSTATUS cli_smb2_rename(struct cli_state *cli,
135                         const char *fname_src,
136                         const char *fname_dst);
137 NTSTATUS cli_smb2_set_ea_fnum(struct cli_state *cli,
138                         uint16_t fnum,
139                         const char *ea_name,
140                         const char *ea_val,
141                         size_t ea_len);
142 NTSTATUS cli_smb2_get_ea_list_path(struct cli_state *cli,
143                         const char *name,
144                         TALLOC_CTX *ctx,
145                         size_t *pnum_eas,
146                         struct ea_struct **pea_list);
147 NTSTATUS cli_smb2_set_ea_path(struct cli_state *cli,
148                         const char *name,
149                         const char *ea_name,
150                         const char *ea_val,
151                         size_t ea_len);
152 NTSTATUS cli_smb2_get_user_quota(struct cli_state *cli,
153                                  int quota_fnum,
154                                  SMB_NTQUOTA_STRUCT *pqt);
155 NTSTATUS cli_smb2_list_user_quota_step(struct cli_state *cli,
156                                        TALLOC_CTX *mem_ctx,
157                                        int quota_fnum,
158                                        SMB_NTQUOTA_LIST **pqt_list,
159                                        bool first);
160 NTSTATUS cli_smb2_get_fs_quota_info(struct cli_state *cli,
161                                     int quota_fnum,
162                                     SMB_NTQUOTA_STRUCT *pqt);
163 NTSTATUS cli_smb2_set_user_quota(struct cli_state *cli,
164                                  int quota_fnum,
165                                  SMB_NTQUOTA_LIST *qtl);
166 NTSTATUS cli_smb2_set_fs_quota_info(struct cli_state *cli,
167                                     int quota_fnum,
168                                     SMB_NTQUOTA_STRUCT *pqt);
169 struct tevent_req *cli_smb2_read_send(TALLOC_CTX *mem_ctx,
170                                 struct tevent_context *ev,
171                                 struct cli_state *cli,
172                                 uint16_t fnum,
173                                 off_t offset,
174                                 size_t size);
175 NTSTATUS cli_smb2_read_recv(struct tevent_req *req,
176                                 ssize_t *received,
177                                 uint8_t **rcvbuf);
178 struct tevent_req *cli_smb2_write_send(TALLOC_CTX *mem_ctx,
179                                         struct tevent_context *ev,
180                                         struct cli_state *cli,
181                                         uint16_t fnum,
182                                         uint16_t mode,
183                                         const uint8_t *buf,
184                                         off_t offset,
185                                         size_t size);
186 NTSTATUS cli_smb2_write_recv(struct tevent_req *req,
187                              size_t *pwritten);
188 struct tevent_req *cli_smb2_writeall_send(TALLOC_CTX *mem_ctx,
189                         struct tevent_context *ev,
190                         struct cli_state *cli,
191                         uint16_t fnum,
192                         uint16_t mode,
193                         const uint8_t *buf,
194                         off_t offset,
195                         size_t size);
196 NTSTATUS cli_smb2_writeall_recv(struct tevent_req *req,
197                         size_t *pwritten);
198 struct tevent_req *cli_smb2_splice_send(TALLOC_CTX *mem_ctx,
199                         struct tevent_context *ev,
200                         struct cli_state *cli,
201                         uint16_t src_fnum, uint16_t dst_fnum,
202                         off_t size, off_t src_offset, off_t dst_offset,
203                         int (*splice_cb)(off_t n, void *priv), void *priv);
204 NTSTATUS cli_smb2_splice_recv(struct tevent_req *req, off_t *written);
205 NTSTATUS cli_smb2_shadow_copy_data(TALLOC_CTX *mem_ctx,
206                         struct cli_state *cli,
207                         uint16_t fnum,
208                         bool get_names,
209                         char ***pnames,
210                         int *pnum_names);
211 NTSTATUS cli_smb2_ftruncate(struct cli_state *cli,
212                         uint16_t fnum,
213                         uint64_t newsize);
214 #endif /* __SMB2CLI_FNUM_H__ */