libsmb: Make cli_smb2_create_fnum async
[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 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 NTSTATUS cli_smb2_close_fnum(struct cli_state *cli, uint16_t fnum);
52 NTSTATUS cli_smb2_mkdir(struct cli_state *cli, const char *dirname);
53 NTSTATUS cli_smb2_rmdir(struct cli_state *cli, const char *dirname);
54 NTSTATUS cli_smb2_unlink(struct cli_state *cli,const char *fname);
55 NTSTATUS cli_smb2_list(struct cli_state *cli,
56                         const char *pathname,
57                         uint16_t attribute,
58                         NTSTATUS (*fn)(const char *,
59                                 struct file_info *,
60                                 const char *,
61                                 void *),
62                         void *state);
63 NTSTATUS cli_smb2_qpathinfo_basic(struct cli_state *cli,
64                         const char *name,
65                         SMB_STRUCT_STAT *sbuf,
66                         uint32_t *attributes);
67 NTSTATUS cli_smb2_qpathinfo_alt_name(struct cli_state *cli,
68                         const char *name,
69                         fstring alt_name);
70 NTSTATUS cli_smb2_qfileinfo_basic(struct cli_state *cli,
71                         uint16_t fnum,
72                         uint16_t *mode,
73                         off_t *size,
74                         struct timespec *create_time,
75                         struct timespec *access_time,
76                         struct timespec *write_time,
77                         struct timespec *change_time,
78                         SMB_INO_T *ino);
79 NTSTATUS cli_smb2_getattrE(struct cli_state *cli,
80                         uint16_t fnum,
81                         uint16_t *attr,
82                         off_t *size,
83                         time_t *change_time,
84                         time_t *access_time,
85                         time_t *write_time);
86 NTSTATUS cli_smb2_getatr(struct cli_state *cli,
87                         const char *name,
88                         uint16_t *attr,
89                         off_t *size,
90                         time_t *write_time);
91 NTSTATUS cli_smb2_qpathinfo2(struct cli_state *cli,
92                         const char *fname,
93                         struct timespec *create_time,
94                         struct timespec *access_time,
95                         struct timespec *write_time,
96                         struct timespec *change_time,
97                         off_t *size,
98                         uint16_t *mode,
99                         SMB_INO_T *ino);
100 NTSTATUS cli_smb2_qpathinfo_streams(struct cli_state *cli,
101                         const char *name,
102                         TALLOC_CTX *mem_ctx,
103                         unsigned int *pnum_streams,
104                         struct stream_struct **pstreams);
105 NTSTATUS cli_smb2_setatr(struct cli_state *cli,
106                         const char *fname,
107                         uint16_t attr,
108                         time_t mtime);
109 NTSTATUS cli_smb2_setattrE(struct cli_state *cli,
110                         uint16_t fnum,
111                         time_t change_time,
112                         time_t access_time,
113                         time_t write_time);
114 NTSTATUS cli_smb2_dskattr(struct cli_state *cli,
115                         uint64_t *bsize,
116                         uint64_t *total,
117                         uint64_t *avail);
118 NTSTATUS cli_smb2_query_security_descriptor(struct cli_state *cli,
119                         uint16_t fnum,
120                         uint32_t sec_info,
121                         TALLOC_CTX *mem_ctx,
122                         struct security_descriptor **ppsd);
123 NTSTATUS cli_smb2_set_security_descriptor(struct cli_state *cli,
124                         uint16_t fnum,
125                         uint32_t sec_info,
126                         const struct security_descriptor *sd);
127 NTSTATUS cli_smb2_rename(struct cli_state *cli,
128                         const char *fname_src,
129                         const char *fname_dst);
130 NTSTATUS cli_smb2_set_ea_fnum(struct cli_state *cli,
131                         uint16_t fnum,
132                         const char *ea_name,
133                         const char *ea_val,
134                         size_t ea_len);
135 NTSTATUS cli_smb2_get_ea_list_path(struct cli_state *cli,
136                         const char *name,
137                         TALLOC_CTX *ctx,
138                         size_t *pnum_eas,
139                         struct ea_struct **pea_list);
140 NTSTATUS cli_smb2_set_ea_path(struct cli_state *cli,
141                         const char *name,
142                         const char *ea_name,
143                         const char *ea_val,
144                         size_t ea_len);
145 struct tevent_req *cli_smb2_read_send(TALLOC_CTX *mem_ctx,
146                                 struct tevent_context *ev,
147                                 struct cli_state *cli,
148                                 uint16_t fnum,
149                                 off_t offset,
150                                 size_t size);
151 NTSTATUS cli_smb2_read_recv(struct tevent_req *req,
152                                 ssize_t *received,
153                                 uint8_t **rcvbuf);
154 struct tevent_req *cli_smb2_write_send(TALLOC_CTX *mem_ctx,
155                                         struct tevent_context *ev,
156                                         struct cli_state *cli,
157                                         uint16_t fnum,
158                                         uint16_t mode,
159                                         const uint8_t *buf,
160                                         off_t offset,
161                                         size_t size);
162 NTSTATUS cli_smb2_write_recv(struct tevent_req *req,
163                              size_t *pwritten);
164 struct tevent_req *cli_smb2_writeall_send(TALLOC_CTX *mem_ctx,
165                         struct tevent_context *ev,
166                         struct cli_state *cli,
167                         uint16_t fnum,
168                         uint16_t mode,
169                         const uint8_t *buf,
170                         off_t offset,
171                         size_t size);
172 NTSTATUS cli_smb2_writeall_recv(struct tevent_req *req,
173                         size_t *pwritten);
174 #endif /* __SMB2CLI_FNUM_H__ */