libcli/smb: move smb2cli_close.c from source3 to the toplevel
[gd/samba-autobuild/.git] / source3 / libsmb / smb2cli.h
1 /*
2    Unix SMB/CIFS implementation.
3    smb2 client routines
4    Copyright (C) Volker Lendecke 2011
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_H__
21 #define __SMB2CLI_H__
22
23 struct smbXcli_conn;
24 struct smbXcli_session;
25 struct cli_state;
26
27 struct tevent_req *smb2cli_tcon_send(TALLOC_CTX *mem_ctx,
28                                      struct tevent_context *ev,
29                                      struct cli_state *cli,
30                                      const char *share);
31 NTSTATUS smb2cli_tcon_recv(struct tevent_req *req);
32 NTSTATUS smb2cli_tcon(struct cli_state *cli, const char *share);
33
34 struct tevent_req *smb2cli_tdis_send(TALLOC_CTX *mem_ctx,
35                                      struct tevent_context *ev,
36                                      struct cli_state *cli);
37 NTSTATUS smb2cli_tdis_recv(struct tevent_req *req);
38 NTSTATUS smb2cli_tdis(struct cli_state *cli);
39
40 struct tevent_req *smb2cli_flush_send(TALLOC_CTX *mem_ctx,
41                                       struct tevent_context *ev,
42                                       struct smbXcli_conn *conn,
43                                       uint32_t timeout_msec,
44                                       struct smbXcli_session *session,
45                                       uint32_t tcon_id,
46                                       uint64_t fid_persistent,
47                                       uint64_t fid_volatile);
48 NTSTATUS smb2cli_flush_recv(struct tevent_req *req);
49 NTSTATUS smb2cli_flush(struct smbXcli_conn *conn,
50                        uint32_t timeout_msec,
51                        struct smbXcli_session *session,
52                        uint32_t tcon_id,
53                        uint64_t fid_persistent,
54                        uint64_t fid_volatile);
55
56 struct tevent_req *smb2cli_read_send(TALLOC_CTX *mem_ctx,
57                                      struct tevent_context *ev,
58                                      struct smbXcli_conn *conn,
59                                      uint32_t timeout_msec,
60                                      struct smbXcli_session *session,
61                                      uint32_t tcon_id,
62                                      uint32_t length,
63                                      uint64_t offset,
64                                      uint64_t fid_persistent,
65                                      uint64_t fid_volatile,
66                                      uint64_t minimum_count,
67                                      uint64_t remaining_bytes);
68 NTSTATUS smb2cli_read_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
69                            uint8_t **data, uint32_t *data_length);
70 NTSTATUS smb2cli_read(struct smbXcli_conn *conn,
71                       uint32_t timeout_msec,
72                       struct smbXcli_session *session,
73                       uint32_t tcon_id,
74                       uint32_t length,
75                       uint64_t offset,
76                       uint64_t fid_persistent,
77                       uint64_t fid_volatile,
78                       uint64_t minimum_count,
79                       uint64_t remaining_bytes,
80                       TALLOC_CTX *mem_ctx,
81                       uint8_t **data,
82                       uint32_t *data_length);
83
84 struct tevent_req *smb2cli_write_send(TALLOC_CTX *mem_ctx,
85                                       struct tevent_context *ev,
86                                       struct smbXcli_conn *conn,
87                                       uint32_t timeout_msec,
88                                       struct smbXcli_session *session,
89                                       uint32_t tcon_id,
90                                       uint32_t length,
91                                       uint64_t offset,
92                                       uint64_t fid_persistent,
93                                       uint64_t fid_volatile,
94                                       uint32_t remaining_bytes,
95                                       uint32_t flags,
96                                       const uint8_t *data);
97 NTSTATUS smb2cli_write_recv(struct tevent_req *req);
98 NTSTATUS smb2cli_write(struct smbXcli_conn *conn,
99                        uint32_t timeout_msec,
100                        struct smbXcli_session *session,
101                        uint32_t tcon_id,
102                        uint32_t length,
103                        uint64_t offset,
104                        uint64_t fid_persistent,
105                        uint64_t fid_volatile,
106                        uint32_t remaining_bytes,
107                        uint32_t flags,
108                        const uint8_t *data);
109
110 struct tevent_req *smb2cli_query_directory_send(TALLOC_CTX *mem_ctx,
111                                                 struct tevent_context *ev,
112                                                 struct smbXcli_conn *conn,
113                                                 uint32_t timeout_msec,
114                                                 struct smbXcli_session *session,
115                                                 uint32_t tcon_id,
116                                                 uint8_t level,
117                                                 uint8_t flags,
118                                                 uint32_t file_index,
119                                                 uint64_t fid_persistent,
120                                                 uint64_t fid_volatile,
121                                                 const char *mask,
122                                                 uint32_t outbuf_len);
123 NTSTATUS smb2cli_query_directory_recv(struct tevent_req *req,
124                                       TALLOC_CTX *mem_ctx,
125                                       uint8_t **data,
126                                       uint32_t *data_length);
127 NTSTATUS smb2cli_query_directory(struct smbXcli_conn *conn,
128                                  uint32_t timeout_msec,
129                                  struct smbXcli_session *session,
130                                  uint32_t tcon_id,
131                                  uint8_t level,
132                                  uint8_t flags,
133                                  uint32_t file_index,
134                                  uint64_t fid_persistent,
135                                  uint64_t fid_volatile,
136                                  const char *mask,
137                                  uint32_t outbuf_len,
138                                  TALLOC_CTX *mem_ctx,
139                                  uint8_t **data,
140                                  uint32_t *data_length);
141
142 struct tevent_req *smb2cli_ioctl_send(TALLOC_CTX *mem_ctx,
143                                       struct tevent_context *ev,
144                                       struct smbXcli_conn *conn,
145                                       uint32_t timeout_msec,
146                                       struct smbXcli_session *session,
147                                       uint32_t tcon_id,
148                                       uint64_t in_fid_persistent,
149                                       uint64_t in_fid_volatile,
150                                       uint32_t in_ctl_code,
151                                       uint32_t in_max_input_length,
152                                       const DATA_BLOB *in_input_buffer,
153                                       uint32_t in_max_output_length,
154                                       const DATA_BLOB *in_output_buffer,
155                                       uint32_t in_flags);
156 NTSTATUS smb2cli_ioctl_recv(struct tevent_req *req,
157                             TALLOC_CTX *mem_ctx,
158                             DATA_BLOB *out_input_buffer,
159                             DATA_BLOB *out_output_buffer);
160 NTSTATUS smb2cli_ioctl(struct smbXcli_conn *conn,
161                        uint32_t timeout_msec,
162                        struct smbXcli_session *session,
163                        uint32_t tcon_id,
164                        uint64_t in_fid_persistent,
165                        uint64_t in_fid_volatile,
166                        uint32_t in_ctl_code,
167                        uint32_t in_max_input_length,
168                        const DATA_BLOB *in_input_buffer,
169                        uint32_t in_max_output_length,
170                        const DATA_BLOB *in_output_buffer,
171                        uint32_t in_flags,
172                        TALLOC_CTX *mem_ctx,
173                        DATA_BLOB *out_input_buffer,
174                        DATA_BLOB *out_output_buffer);
175
176 struct tevent_req *smb2cli_query_info_send(TALLOC_CTX *mem_ctx,
177                                            struct tevent_context *ev,
178                                            struct smbXcli_conn *conn,
179                                            uint32_t timeout_msec,
180                                            struct smbXcli_session *session,
181                                            uint32_t tcon_id,
182                                            uint8_t in_info_type,
183                                            uint8_t in_file_info_class,
184                                            uint32_t in_max_output_length,
185                                            const DATA_BLOB *in_input_buffer,
186                                            uint32_t in_additional_info,
187                                            uint32_t in_flags,
188                                            uint64_t in_fid_persistent,
189                                            uint64_t in_fid_volatile);
190 NTSTATUS smb2cli_query_info_recv(struct tevent_req *req,
191                                  TALLOC_CTX *mem_ctx,
192                                  DATA_BLOB *out_output_buffer);
193 NTSTATUS smb2cli_query_info(struct smbXcli_conn *conn,
194                             uint32_t timeout_msec,
195                             struct smbXcli_session *session,
196                             uint32_t tcon_id,
197                             uint8_t in_info_type,
198                             uint8_t in_file_info_class,
199                             uint32_t in_max_output_length,
200                             const DATA_BLOB *in_input_buffer,
201                             uint32_t in_additional_info,
202                             uint32_t in_flags,
203                             uint64_t in_fid_persistent,
204                             uint64_t in_fid_volatile,
205                             TALLOC_CTX *mem_ctx,
206                             DATA_BLOB *out_output_buffer);
207
208 struct tevent_req *smb2cli_set_info_send(TALLOC_CTX *mem_ctx,
209                                          struct tevent_context *ev,
210                                          struct smbXcli_conn *conn,
211                                          uint32_t timeout_msec,
212                                          struct smbXcli_session *session,
213                                          uint32_t tcon_id,
214                                          uint8_t in_info_type,
215                                          uint8_t in_file_info_class,
216                                          const DATA_BLOB *in_input_buffer,
217                                          uint32_t in_additional_info,
218                                          uint64_t in_fid_persistent,
219                                          uint64_t in_fid_volatile);
220 NTSTATUS smb2cli_set_info_recv(struct tevent_req *req);
221 NTSTATUS smb2cli_set_info(struct smbXcli_conn *conn,
222                             uint32_t timeout_msec,
223                             struct smbXcli_session *session,
224                             uint32_t tcon_id,
225                             uint8_t in_info_type,
226                             uint8_t in_file_info_class,
227                             const DATA_BLOB *in_input_buffer,
228                             uint32_t in_additional_info,
229                             uint64_t in_fid_persistent,
230                             uint64_t in_fid_volatile);
231
232 #endif /* __SMB2CLI_H__ */