2 Unix SMB/CIFS implementation.
4 SMB composite request interfaces
6 Copyright (C) Andrew Tridgell 2005
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
23 this defines the structures associated with "composite"
24 requests. Composite requests are libcli requests that are internally
25 implemented as multiple libcli/raw/ calls, but can be treated as a
26 single call via these composite calls. The composite calls are
27 particularly designed to be used in async applications
30 #ifndef __SMB_COMPOSITE_H__
31 #define __SMB_COMPOSITE_H__
33 #include "libcli/raw/libcliraw.h"
34 #include "libcli/smb2/smb2.h"
37 a composite open/read(s)/close request that loads a whole file
38 into memory. Used as a demo of the composite system.
40 struct smb_composite_loadfile
{
50 struct composite_context
*smb_composite_loadfile_send(struct smbcli_tree
*tree
,
51 struct smb_composite_loadfile
*io
);
52 NTSTATUS
smb_composite_loadfile_recv(struct composite_context
*c
, TALLOC_CTX
*mem_ctx
);
53 NTSTATUS
smb_composite_loadfile(struct smbcli_tree
*tree
,
55 struct smb_composite_loadfile
*io
);
57 struct smb_composite_fetchfile
{
59 const char *dest_host
;
61 const char *called_name
;
63 const char *service_type
;
64 const char *socket_options
;
65 struct cli_credentials
*credentials
;
66 const char *workgroup
;
68 struct smbcli_options options
;
69 struct smbcli_session_options session_options
;
70 struct resolve_context
*resolve_ctx
;
71 struct gensec_settings
*gensec_settings
;
79 struct composite_context
*smb_composite_fetchfile_send(struct smb_composite_fetchfile
*io
,
80 struct tevent_context
*event_ctx
);
81 NTSTATUS
smb_composite_fetchfile_recv(struct composite_context
*c
,
83 NTSTATUS
smb_composite_fetchfile(struct smb_composite_fetchfile
*io
,
87 a composite open/write(s)/close request that saves a whole file from
88 memory. Used as a demo of the composite system.
90 struct smb_composite_savefile
{
98 struct composite_context
*smb_composite_savefile_send(struct smbcli_tree
*tree
,
99 struct smb_composite_savefile
*io
);
100 NTSTATUS
smb_composite_savefile_recv(struct composite_context
*c
);
101 NTSTATUS
smb_composite_savefile(struct smbcli_tree
*tree
,
102 struct smb_composite_savefile
*io
);
105 a composite request for a low level connection to a remote server. Includes
107 - socket establishment
111 struct tevent_req
*smb_connect_nego_send(TALLOC_CTX
*mem_ctx
,
112 struct tevent_context
*ev
,
113 struct resolve_context
*resolve_ctx
,
114 const struct smbcli_options
*options
,
115 const char *socket_options
,
116 const char *dest_hostname
,
117 const char *dest_address
, /* optional */
118 const char **dest_ports
,
119 const char *target_hostname
,
120 const char *called_name
,
121 const char *calling_name
);
122 NTSTATUS
smb_connect_nego_recv(struct tevent_req
*req
,
124 struct smbXcli_conn
**_conn
);
127 a composite request for a full connection to a remote server. Includes
129 - socket establishment
132 - session setup (if credentials are not NULL)
133 - tree connect (if service is not NULL)
135 struct smb_composite_connect
{
137 const char *dest_host
;
138 const char **dest_ports
;
139 const char *socket_options
;
140 const char *called_name
;
142 const char *service_type
;
143 struct smbXcli_conn
*existing_conn
; /* optional */
144 struct cli_credentials
*credentials
;
145 bool fallback_to_anonymous
;
146 const char *workgroup
;
147 struct smbcli_options options
;
148 struct smbcli_session_options session_options
;
149 struct gensec_settings
*gensec_settings
;
152 struct smbcli_tree
*tree
;
153 bool anonymous_fallback_done
;
157 struct composite_context
*smb_composite_connect_send(struct smb_composite_connect
*io
,
159 struct resolve_context
*resolve_ctx
,
160 struct tevent_context
*event_ctx
);
161 NTSTATUS
smb_composite_connect_recv(struct composite_context
*c
, TALLOC_CTX
*mem_ctx
);
162 NTSTATUS
smb_composite_connect(struct smb_composite_connect
*io
, TALLOC_CTX
*mem_ctx
,
163 struct resolve_context
*resolve_ctx
,
164 struct tevent_context
*ev
);
168 generic session setup interface that takes care of which
169 session setup varient to use
171 struct smb_composite_sesssetup
{
174 uint32_t capabilities
;
175 struct cli_credentials
*credentials
;
176 const char *workgroup
;
177 struct gensec_settings
*gensec_settings
;
184 struct composite_context
*smb_composite_sesssetup_send(struct smbcli_session
*session
,
185 struct smb_composite_sesssetup
*io
);
186 NTSTATUS
smb_composite_sesssetup_recv(struct composite_context
*c
);
187 NTSTATUS
smb_composite_sesssetup(struct smbcli_session
*session
, struct smb_composite_sesssetup
*io
);
190 query file system info
192 struct smb_composite_fsinfo
{
194 const char *dest_host
;
195 const char **dest_ports
;
196 const char *socket_options
;
197 const char *called_name
;
199 const char *service_type
;
200 struct cli_credentials
*credentials
;
201 const char *workgroup
;
202 enum smb_fsinfo_level level
;
203 struct gensec_settings
*gensec_settings
;
207 union smb_fsinfo
*fsinfo
;
211 struct composite_context
*smb_composite_fsinfo_send(struct smbcli_tree
*tree
,
212 struct smb_composite_fsinfo
*io
,
213 struct resolve_context
*resolve_ctx
,
214 struct tevent_context
*event_ctx
);
215 NTSTATUS
smb_composite_fsinfo_recv(struct composite_context
*c
, TALLOC_CTX
*mem_ctx
);
216 NTSTATUS
smb_composite_fsinfo(struct smbcli_tree
*tree
,
218 struct smb_composite_fsinfo
*io
,
219 struct resolve_context
*resolve_ctx
,
220 struct tevent_context
*ev
);
223 composite call for appending new acl to the file's security descriptor and get
227 struct smb_composite_appendacl
{
231 const struct security_descriptor
*sd
;
235 struct security_descriptor
*sd
;
239 struct composite_context
*smb_composite_appendacl_send(struct smbcli_tree
*tree
,
240 struct smb_composite_appendacl
*io
);
241 NTSTATUS
smb_composite_appendacl_recv(struct composite_context
*c
, TALLOC_CTX
*mem_ctx
);
242 NTSTATUS
smb_composite_appendacl(struct smbcli_tree
*tree
,
244 struct smb_composite_appendacl
*io
);
247 a composite API to fire connect() calls to multiple targets, picking the
251 struct smb_composite_connectmulti
{
254 const char **hostnames
;
255 const char **addresses
;
256 int *ports
; /* Either NULL for lpcfg_smb_ports() per
257 * destination or a list of explicit ports */
260 struct smbcli_socket
*socket
;
264 struct smbcli_session
;
265 struct resolve_context
;
267 struct composite_context
*smb2_composite_unlink_send(struct smb2_tree
*tree
,
268 union smb_unlink
*io
);
269 NTSTATUS
smb2_composite_unlink(struct smb2_tree
*tree
, union smb_unlink
*io
);
270 struct composite_context
*smb2_composite_mkdir_send(struct smb2_tree
*tree
,
271 union smb_mkdir
*io
);
272 NTSTATUS
smb2_composite_mkdir(struct smb2_tree
*tree
, union smb_mkdir
*io
);
273 struct composite_context
*smb2_composite_rmdir_send(struct smb2_tree
*tree
,
274 struct smb_rmdir
*io
);
275 NTSTATUS
smb2_composite_rmdir(struct smb2_tree
*tree
, struct smb_rmdir
*io
);
276 struct tevent_req
*smb2_composite_setpathinfo_send(TALLOC_CTX
*mem_ctx
,
277 struct tevent_context
*ev
,
278 struct smb2_tree
*tree
,
279 const union smb_setfileinfo
*io
);
280 NTSTATUS
smb2_composite_setpathinfo_recv(struct tevent_req
*req
);
281 NTSTATUS
smb2_composite_setpathinfo(struct smb2_tree
*tree
, union smb_setfileinfo
*io
);
283 #endif /* __SMB_COMPOSITE_H__ */