r26646: libcli/smb_composite: Allow specifying SMB parameters in smb_composite_connec...
[metze/old/samba4-sync/samba4-sync.git/.git] / source / 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                 const char **ports;
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                 const char **dest_ports;
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                 bool use_spnego;
95                 bool ntstatus_support;
96                 bool unicode;
97                 int max_xmit;
98                 int max_mux;
99                 int max_protocol;
100         } in;
101         struct {
102                 struct smbcli_tree *tree;
103                 bool anonymous_fallback_done;
104         } out;
105 };
106
107
108 /*
109   generic session setup interface that takes care of which
110   session setup varient to use
111 */
112 struct smb_composite_sesssetup {
113         struct {
114                 uint32_t sesskey;
115                 uint32_t capabilities;
116                 struct cli_credentials *credentials;
117                 const char *workgroup;
118         } in;
119         struct {
120                 uint16_t vuid;
121         } out;          
122 };
123
124 /*
125   query file system info
126 */
127 struct smb_composite_fsinfo {
128         struct {
129                 const char *dest_host;
130                 const char **dest_ports;
131                 const char *called_name;
132                 const char *service;
133                 const char *service_type;
134                 struct cli_credentials *credentials;
135                 const char *workgroup;
136                 enum smb_fsinfo_level level;
137         } in;
138         
139         struct {
140                 union smb_fsinfo *fsinfo;
141         } out;
142 };
143
144 /*
145   composite call for appending new acl to the file's security descriptor and get 
146   new full acl
147 */
148
149 struct smb_composite_appendacl {
150         struct {
151                 const char *fname;
152
153                 const struct security_descriptor *sd;
154         } in;
155         
156         struct {
157                 struct security_descriptor *sd;
158         } out;
159 };
160
161 /*
162   a composite API to fire connect() calls to multiple targets, picking the
163   first one.
164 */
165
166 struct smb_composite_connectmulti {
167         struct {
168                 int num_dests;
169                 const char **hostnames;
170                 const char **addresses;
171                 int *ports;     /* Either NULL for lp_smb_ports() per
172                                  * destination or a list of explicit ports */
173         } in;
174         struct {
175                 struct smbcli_socket *socket;
176         } out;
177 };
178
179 struct smbcli_session;
180 struct resolve_context;
181
182 #include "libcli/smb_composite/proto.h"