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 full connection to a remote server. Includes
107 - socket establishment
110 - session setup (if credentials are not NULL)
111 - tree connect (if service is not NULL)
113 struct smb_composite_connect
{
115 const char *dest_host
;
116 const char **dest_ports
;
117 const char *socket_options
;
118 const char *called_name
;
120 const char *service_type
;
121 struct cli_credentials
*credentials
;
122 bool fallback_to_anonymous
;
123 const char *workgroup
;
124 struct smbcli_options options
;
125 struct smbcli_session_options session_options
;
126 struct gensec_settings
*gensec_settings
;
129 struct smbcli_tree
*tree
;
130 bool anonymous_fallback_done
;
134 struct composite_context
*smb_composite_connect_send(struct smb_composite_connect
*io
,
136 struct resolve_context
*resolve_ctx
,
137 struct tevent_context
*event_ctx
);
138 NTSTATUS
smb_composite_connect_recv(struct composite_context
*c
, TALLOC_CTX
*mem_ctx
);
139 NTSTATUS
smb_composite_connect(struct smb_composite_connect
*io
, TALLOC_CTX
*mem_ctx
,
140 struct resolve_context
*resolve_ctx
,
141 struct tevent_context
*ev
);
145 generic session setup interface that takes care of which
146 session setup varient to use
148 struct smb_composite_sesssetup
{
151 uint32_t capabilities
;
152 struct cli_credentials
*credentials
;
153 const char *workgroup
;
154 struct gensec_settings
*gensec_settings
;
161 struct composite_context
*smb_composite_sesssetup_send(struct smbcli_session
*session
,
162 struct smb_composite_sesssetup
*io
);
163 NTSTATUS
smb_composite_sesssetup_recv(struct composite_context
*c
);
164 NTSTATUS
smb_composite_sesssetup(struct smbcli_session
*session
, struct smb_composite_sesssetup
*io
);
167 query file system info
169 struct smb_composite_fsinfo
{
171 const char *dest_host
;
172 const char **dest_ports
;
173 const char *socket_options
;
174 const char *called_name
;
176 const char *service_type
;
177 struct cli_credentials
*credentials
;
178 const char *workgroup
;
179 enum smb_fsinfo_level level
;
180 struct gensec_settings
*gensec_settings
;
184 union smb_fsinfo
*fsinfo
;
188 struct composite_context
*smb_composite_fsinfo_send(struct smbcli_tree
*tree
,
189 struct smb_composite_fsinfo
*io
,
190 struct resolve_context
*resolve_ctx
,
191 struct tevent_context
*event_ctx
);
192 NTSTATUS
smb_composite_fsinfo_recv(struct composite_context
*c
, TALLOC_CTX
*mem_ctx
);
193 NTSTATUS
smb_composite_fsinfo(struct smbcli_tree
*tree
,
195 struct smb_composite_fsinfo
*io
,
196 struct resolve_context
*resolve_ctx
,
197 struct tevent_context
*ev
);
200 composite call for appending new acl to the file's security descriptor and get
204 struct smb_composite_appendacl
{
208 const struct security_descriptor
*sd
;
212 struct security_descriptor
*sd
;
216 struct composite_context
*smb_composite_appendacl_send(struct smbcli_tree
*tree
,
217 struct smb_composite_appendacl
*io
);
218 NTSTATUS
smb_composite_appendacl_recv(struct composite_context
*c
, TALLOC_CTX
*mem_ctx
);
219 NTSTATUS
smb_composite_appendacl(struct smbcli_tree
*tree
,
221 struct smb_composite_appendacl
*io
);
224 a composite API to fire connect() calls to multiple targets, picking the
228 struct smb_composite_connectmulti
{
231 const char **hostnames
;
232 const char **addresses
;
233 int *ports
; /* Either NULL for lpcfg_smb_ports() per
234 * destination or a list of explicit ports */
237 struct smbcli_socket
*socket
;
241 struct smbcli_session
;
242 struct resolve_context
;
244 struct composite_context
*smb2_composite_unlink_send(struct smb2_tree
*tree
,
245 union smb_unlink
*io
);
246 NTSTATUS
smb2_composite_unlink(struct smb2_tree
*tree
, union smb_unlink
*io
);
247 struct composite_context
*smb2_composite_mkdir_send(struct smb2_tree
*tree
,
248 union smb_mkdir
*io
);
249 NTSTATUS
smb2_composite_mkdir(struct smb2_tree
*tree
, union smb_mkdir
*io
);
250 struct composite_context
*smb2_composite_rmdir_send(struct smb2_tree
*tree
,
251 struct smb_rmdir
*io
);
252 NTSTATUS
smb2_composite_rmdir(struct smb2_tree
*tree
, struct smb_rmdir
*io
);
253 struct tevent_req
*smb2_composite_setpathinfo_send(TALLOC_CTX
*mem_ctx
,
254 struct tevent_context
*ev
,
255 struct smb2_tree
*tree
,
256 const union smb_setfileinfo
*io
);
257 NTSTATUS
smb2_composite_setpathinfo_recv(struct tevent_req
*req
);
258 NTSTATUS
smb2_composite_setpathinfo(struct smb2_tree
*tree
, union smb_setfileinfo
*io
);
260 #endif /* __SMB_COMPOSITE_H__ */