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