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