s3:smbd/close: remove unused goto out from close_directory()
[Samba/gebeck_regimport.git] / source4 / libcli / smb_composite / smb_composite.h
bloba92c9612c6ac8854c54cecbadc446cc301184042
1 /*
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 {
41 struct {
42 const char *fname;
43 } in;
44 struct {
45 uint8_t *data;
46 uint32_t size;
47 } out;
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,
54 TALLOC_CTX *mem_ctx,
55 struct smb_composite_loadfile *io);
57 struct smb_composite_fetchfile {
58 struct {
59 const char *dest_host;
60 const char **ports;
61 const char *called_name;
62 const char *service;
63 const char *service_type;
64 const char *socket_options;
65 struct cli_credentials *credentials;
66 const char *workgroup;
67 const char *filename;
68 struct smbcli_options options;
69 struct smbcli_session_options session_options;
70 struct resolve_context *resolve_ctx;
71 struct gensec_settings *gensec_settings;
72 } in;
73 struct {
74 uint8_t *data;
75 uint32_t size;
76 } out;
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,
82 TALLOC_CTX *mem_ctx);
83 NTSTATUS smb_composite_fetchfile(struct smb_composite_fetchfile *io,
84 TALLOC_CTX *mem_ctx);
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 {
91 struct {
92 const char *fname;
93 uint8_t *data;
94 uint32_t size;
95 } in;
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
108 - session request
109 - negprot
110 - session setup (if credentials are not NULL)
111 - tree connect (if service is not NULL)
113 struct smb_composite_connect {
114 struct {
115 const char *dest_host;
116 const char **dest_ports;
117 const char *socket_options;
118 const char *called_name;
119 const char *service;
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;
127 } in;
128 struct {
129 struct smbcli_tree *tree;
130 bool anonymous_fallback_done;
131 } out;
134 struct composite_context *smb_composite_connect_send(struct smb_composite_connect *io,
135 TALLOC_CTX *mem_ctx,
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 {
149 struct {
150 uint32_t sesskey;
151 uint32_t capabilities;
152 struct cli_credentials *credentials;
153 const char *workgroup;
154 struct gensec_settings *gensec_settings;
155 } in;
156 struct {
157 uint16_t vuid;
158 } out;
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 {
170 struct {
171 const char *dest_host;
172 const char **dest_ports;
173 const char *socket_options;
174 const char *called_name;
175 const char *service;
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;
181 } in;
183 struct {
184 union smb_fsinfo *fsinfo;
185 } out;
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,
194 TALLOC_CTX *mem_ctx,
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
201 new full acl
204 struct smb_composite_appendacl {
205 struct {
206 const char *fname;
208 const struct security_descriptor *sd;
209 } in;
211 struct {
212 struct security_descriptor *sd;
213 } out;
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,
220 TALLOC_CTX *mem_ctx,
221 struct smb_composite_appendacl *io);
224 a composite API to fire connect() calls to multiple targets, picking the
225 first one.
228 struct smb_composite_connectmulti {
229 struct {
230 int num_dests;
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 */
235 } in;
236 struct {
237 struct smbcli_socket *socket;
238 } out;
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__ */