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