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