Merge branch 'v4-0-test' of ssh://git.samba.org/data/git/samba into v4-0-test
[gd/samba-autobuild/.git] / source4 / libcli / smb_composite / smb_composite.h
1 /* 
2    Unix SMB/CIFS implementation.
3
4    SMB composite request interfaces
5
6    Copyright (C) Andrew Tridgell 2005
7    
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.
12    
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.
17    
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/>.
20 */
21
22 /*
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
28 */
29
30 #include "libcli/raw/signing.h"
31 #include "libcli/raw/libcliraw.h"
32
33
34 /*
35   a composite open/read(s)/close request that loads a whole file
36   into memory. Used as a demo of the composite system.
37 */
38 struct smb_composite_loadfile {
39         struct {
40                 const char *fname;
41         } in;
42         struct {
43                 uint8_t *data;
44                 uint32_t size;
45         } out;
46 };
47
48 struct smb_composite_fetchfile {
49         struct {
50                 const char *dest_host;
51                 const char **ports;
52                 const char *called_name;
53                 const char *service;
54                 const char *service_type;
55                 struct cli_credentials *credentials;
56                 const char *workgroup;
57                 const char *filename;
58                 struct smbcli_options options;
59                 struct resolve_context *resolve_ctx;
60         } in;
61         struct {
62                 uint8_t *data;
63                 uint32_t size;
64         } out;
65 };
66
67 /*
68   a composite open/write(s)/close request that saves a whole file from
69   memory. Used as a demo of the composite system.
70 */
71 struct smb_composite_savefile {
72         struct {
73                 const char *fname;
74                 uint8_t *data;
75                 uint32_t size;
76         } in;
77 };
78
79
80 /*
81   a composite request for a full connection to a remote server. Includes
82
83     - socket establishment
84     - session request
85     - negprot
86     - session setup
87     - tree connect
88 */
89 struct smb_composite_connect {
90         struct {
91                 const char *dest_host;
92                 const char **dest_ports;
93                 const char *called_name;
94                 const char *service;
95                 const char *service_type;
96                 struct cli_credentials *credentials;
97                 bool fallback_to_anonymous;
98                 const char *workgroup;
99                 struct smbcli_options options;
100         } in;
101         struct {
102                 struct smbcli_tree *tree;
103                 bool anonymous_fallback_done;
104         } out;
105 };
106
107
108 /*
109   generic session setup interface that takes care of which
110   session setup varient to use
111 */
112 struct smb_composite_sesssetup {
113         struct {
114                 uint32_t sesskey;
115                 uint32_t capabilities;
116                 struct cli_credentials *credentials;
117                 const char *workgroup;
118         } in;
119         struct {
120                 uint16_t vuid;
121         } out;          
122 };
123
124 /*
125   query file system info
126 */
127 struct smb_composite_fsinfo {
128         struct {
129                 const char *dest_host;
130                 const char **dest_ports;
131                 const char *called_name;
132                 const char *service;
133                 const char *service_type;
134                 struct cli_credentials *credentials;
135                 const char *workgroup;
136                 enum smb_fsinfo_level level;
137         } in;
138         
139         struct {
140                 union smb_fsinfo *fsinfo;
141         } out;
142 };
143
144 /*
145   composite call for appending new acl to the file's security descriptor and get 
146   new full acl
147 */
148
149 struct smb_composite_appendacl {
150         struct {
151                 const char *fname;
152
153                 const struct security_descriptor *sd;
154         } in;
155         
156         struct {
157                 struct security_descriptor *sd;
158         } out;
159 };
160
161 /*
162   a composite API to fire connect() calls to multiple targets, picking the
163   first one.
164 */
165
166 struct smb_composite_connectmulti {
167         struct {
168                 int num_dests;
169                 const char **hostnames;
170                 const char **addresses;
171                 int *ports;     /* Either NULL for lp_smb_ports() per
172                                  * destination or a list of explicit ports */
173         } in;
174         struct {
175                 struct smbcli_socket *socket;
176         } out;
177 };
178
179 struct smbcli_session;
180 struct resolve_context;
181
182 #include "libcli/smb_composite/proto.h"