tdb: don't free old recovery area when expanding if already at EOF.
[mat/samba.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_session_setup_send(TALLOC_CTX *mem_ctx,
28                                 struct tevent_context *ev,
29                                 struct smbXcli_conn *conn,
30                                 uint32_t timeout_msec,
31                                 struct smbXcli_session *session,
32                                 uint8_t in_flags,
33                                 uint32_t in_capabilities,
34                                 uint32_t in_channel,
35                                 struct smbXcli_session *in_previous_session,
36                                 const DATA_BLOB *in_security_buffer);
37 NTSTATUS smb2cli_session_setup_recv(struct tevent_req *req,
38                                     TALLOC_CTX *mem_ctx,
39                                     struct iovec **recv_iov,
40                                     DATA_BLOB *out_security_buffer);
41
42 struct tevent_req *smb2cli_logoff_send(TALLOC_CTX *mem_ctx,
43                                        struct tevent_context *ev,
44                                        struct cli_state *cli);
45 NTSTATUS smb2cli_logoff_recv(struct tevent_req *req);
46 NTSTATUS smb2cli_logoff(struct cli_state *cli);
47
48 struct tevent_req *smb2cli_tcon_send(TALLOC_CTX *mem_ctx,
49                                      struct tevent_context *ev,
50                                      struct cli_state *cli,
51                                      const char *share);
52 NTSTATUS smb2cli_tcon_recv(struct tevent_req *req);
53 NTSTATUS smb2cli_tcon(struct cli_state *cli, const char *share);
54
55 struct tevent_req *smb2cli_tdis_send(TALLOC_CTX *mem_ctx,
56                                      struct tevent_context *ev,
57                                      struct cli_state *cli);
58 NTSTATUS smb2cli_tdis_recv(struct tevent_req *req);
59 NTSTATUS smb2cli_tdis(struct cli_state *cli);
60
61 struct tevent_req *smb2cli_create_send(
62         TALLOC_CTX *mem_ctx,
63         struct tevent_context *ev,
64         struct cli_state *cli,
65         const char *filename,
66         uint8_t  oplock_level,          /* SMB2_OPLOCK_LEVEL_* */
67         uint32_t impersonation_level,   /* SMB2_IMPERSONATION_* */
68         uint32_t desired_access,
69         uint32_t file_attributes,
70         uint32_t share_access,
71         uint32_t create_disposition,
72         uint32_t create_options,
73         struct smb2_create_blobs *blobs);
74 NTSTATUS smb2cli_create_recv(struct tevent_req *req,
75                              uint64_t *fid_persistent,
76                              uint64_t *fid_volatile);
77 NTSTATUS smb2cli_create(struct cli_state *cli,
78                         const char *filename,
79                         uint8_t  oplock_level,       /* SMB2_OPLOCK_LEVEL_* */
80                         uint32_t impersonation_level, /* SMB2_IMPERSONATION_* */
81                         uint32_t desired_access,
82                         uint32_t file_attributes,
83                         uint32_t share_access,
84                         uint32_t create_disposition,
85                         uint32_t create_options,
86                         struct smb2_create_blobs *blobs,
87                         uint64_t *fid_persistent,
88                         uint64_t *fid_volatile);
89
90 struct tevent_req *smb2cli_close_send(TALLOC_CTX *mem_ctx,
91                                       struct tevent_context *ev,
92                                       struct cli_state *cli,
93                                       uint16_t flags,
94                                       uint64_t fid_persistent,
95                                       uint64_t fid_volatile);
96 NTSTATUS smb2cli_close_recv(struct tevent_req *req);
97 NTSTATUS smb2cli_close(struct cli_state *cli, uint16_t flags,
98                         uint64_t fid_persistent, uint64_t fid_volatile);
99
100 struct tevent_req *smb2cli_flush_send(TALLOC_CTX *mem_ctx,
101                                       struct tevent_context *ev,
102                                       struct cli_state *cli,
103                                       uint64_t fid_persistent,
104                                       uint64_t fid_volatile);
105 NTSTATUS smb2cli_flush_recv(struct tevent_req *req);
106 NTSTATUS smb2cli_flush(struct cli_state *cli,
107                        uint64_t fid_persistent,
108                        uint64_t fid_volatile);
109
110 struct tevent_req *smb2cli_read_send(TALLOC_CTX *mem_ctx,
111                                      struct tevent_context *ev,
112                                      struct cli_state *cli,
113                                      uint32_t length,
114                                      uint64_t offset,
115                                      uint64_t fid_persistent,
116                                      uint64_t fid_volatile,
117                                      uint64_t minimum_count,
118                                      uint64_t remaining_bytes);
119 NTSTATUS smb2cli_read_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
120                            uint8_t **data, uint32_t *data_length);
121 NTSTATUS smb2cli_read(struct cli_state *cli,
122                       uint32_t length,
123                       uint64_t offset,
124                       uint64_t fid_persistent,
125                       uint64_t fid_volatile,
126                       uint64_t minimum_count,
127                       uint64_t remaining_bytes,
128                       TALLOC_CTX *mem_ctx,
129                       uint8_t **data,
130                       uint32_t *data_length);
131
132 struct tevent_req *smb2cli_write_send(TALLOC_CTX *mem_ctx,
133                                       struct tevent_context *ev,
134                                       struct cli_state *cli,
135                                       uint32_t length,
136                                       uint64_t offset,
137                                       uint64_t fid_persistent,
138                                       uint64_t fid_volatile,
139                                       uint32_t remaining_bytes,
140                                       uint32_t flags,
141                                       const uint8_t *data);
142 NTSTATUS smb2cli_write_recv(struct tevent_req *req);
143 NTSTATUS smb2cli_write(struct cli_state *cli,
144                        uint32_t length,
145                        uint64_t offset,
146                        uint64_t fid_persistent,
147                        uint64_t fid_volatile,
148                        uint32_t remaining_bytes,
149                        uint32_t flags,
150                        const uint8_t *data);
151
152 struct tevent_req *smb2cli_query_directory_send(TALLOC_CTX *mem_ctx,
153                                                 struct tevent_context *ev,
154                                                 struct cli_state *cli,
155                                                 uint8_t level,
156                                                 uint8_t flags,
157                                                 uint32_t file_index,
158                                                 uint64_t fid_persistent,
159                                                 uint64_t fid_volatile,
160                                                 const char *mask,
161                                                 uint32_t outbuf_len);
162 NTSTATUS smb2cli_query_directory_recv(struct tevent_req *req,
163                                       TALLOC_CTX *mem_ctx,
164                                       uint8_t **data,
165                                       uint32_t *data_length);
166 NTSTATUS smb2cli_query_directory(struct cli_state *cli,
167                                  uint8_t level,
168                                  uint8_t flags,
169                                  uint32_t file_index,
170                                  uint64_t fid_persistent,
171                                  uint64_t fid_volatile,
172                                  const char *mask,
173                                  uint32_t outbuf_len,
174                                  TALLOC_CTX *mem_ctx,
175                                  uint8_t **data,
176                                  uint32_t *data_length);
177
178 #endif /* __SMB2CLI_H__ */