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