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