summaryrefslogtreecommitdiffstats
path: root/librpc/idl/ioctl.idl
blob: b2f3aec54d95dd5b3a13d1906dfc3783826cc06d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
#include "idl_types.h"
[
	pointer_default(unique)
]
interface copychunk
{
	typedef [public] struct {
		uint8 resume_key[24];
		uint32 context_len;
		/* <56> Windows sends 4 bytes of zero for the context field. */
		uint8 context[4];
	} req_resume_key_rsp;

	const uint32 COPYCHUNK_MAX_CHUNKS = 256; /* 2k8r2 & win8 = 256 */
	const uint32 COPYCHUNK_MAX_CHUNK_LEN = 1048576; /* 2k8r2 & win8 = 1048576 */
	const uint32 COPYCHUNK_MAX_TOTAL_LEN = 16777216; /* 2k8r2 & win8 = 16777216 */

	typedef struct {
		hyper source_off;
		hyper target_off;
		uint32 length;
		uint32 reserved;
	} srv_copychunk;

	typedef [public] struct {
		uint8 source_key[24];
		uint32 chunk_count;
		uint32 reserved;
		srv_copychunk chunks[chunk_count];
	} srv_copychunk_copy;

	typedef [public] struct {
		uint32 chunks_written;
		uint32 chunk_bytes_written;
		uint32 total_bytes_written;
	} srv_copychunk_rsp;

	typedef [public] struct {
		uint32 version;
		uint32 size;
		uint32 maximum_token_lifetime;
		uint32 default_token_lifetime;
		hyper maximum_xfer_size;
		hyper optimal_xfer_count;
		uint32 maximum_data_descriptors;
		uint32 maximum_xfer_length_per_descriptor;
		uint32 optimal_xfer_length_per_descriptor;
		uint16 optimal_xfer_length_granularity;
		uint8 reserved[2];
	} device_copy_offload_descriptor;

	const uint32 STORAGE_OFFLOAD_TOKEN_TYPE_ZERO_DATA = 0xffff0001;

	typedef [public] struct {
		uint32 token_type;
		uint8 reserved[2];
		uint16 token_id_len;
	        uint8 token[token_id_len];
	} storage_offload_token;

	typedef [public] struct {
		uint32 size;
		uint32 flags;
		uint32 token_time_to_live;
		uint32 reserved;
		hyper file_offset;
		hyper length;
	} fsctl_offload_read_input;

	typedef [public,bitmap32bit] bitmap {
		OFFLOAD_READ_FLAG_FILE_TOO_SMALL = 0x01,
		OFFLOAD_READ_FLAG_ALL_ZERO_BEYOND_RANGE = 0x02,
		OFFLOAD_READ_FLAG_CANNOT_OFFLOAD_BEYOND_RANGE = 0x04
	} offload_flags;

	typedef [public] struct {
		uint32 size;
		offload_flags flags;
		hyper xfer_length;
		storage_offload_token token;
	} fsctl_offload_read_output;

	typedef [public] struct {
		uint32 size;
		offload_flags flags;
		hyper file_offset;
		hyper copy_length;
		hyper xfer_offset;
		storage_offload_token token;
	} fsctl_offload_write_input;

	typedef [public] struct {
		uint32 size;
		uint32 flags;
		hyper length_written;
	} fsctl_offload_write_output;

	typedef [public] struct {
		uint8 source_fid[16];
		hyper source_off;
		hyper target_off;
		hyper byte_count;
	} fsctl_dup_extents_to_file;
}

interface compression
{
	const uint16 COMPRESSION_FORMAT_NONE = 0x0000;
	const uint16 COMPRESSION_FORMAT_DEFAULT = 0x0001;
	const uint16 COMPRESSION_FORMAT_LZNT1 = 0x0002;

	typedef [public] struct {
		uint16 format;
	} compression_state;
}

interface netinterface
{
	typedef [bitmap32bit] bitmap {
		FSCTL_NET_IFACE_NONE_CAPABLE = 0x00000000,
		FSCTL_NET_IFACE_RSS_CAPABLE = 0x00000001,
		FSCTL_NET_IFACE_RDMA_CAPABLE = 0x00000002
	} fsctl_net_iface_capability;

	typedef [enum16bit] enum {
		FSCTL_NET_IFACE_AF_INET = 0x0002,
		FSCTL_NET_IFACE_AF_INET6 = 0x0017
	} fsctl_sockaddr_af;

	typedef [flag(NDR_NOALIGN)] struct {
		[value(0)] uint16 port;
		[flag(NDR_BIG_ENDIAN)] ipv4address ipv4;
		[value(0)] hyper reserved;
	} fsctl_sockaddr_in;

	typedef [flag(NDR_NOALIGN)] struct {
		[value(0)] uint16 port;
		[value(0)] uint32 flowinfo;
		[flag(NDR_BIG_ENDIAN)] ipv6address ipv6;
		[value(0)] uint32 scopeid;
	} fsctl_sockaddr_in6;

	typedef [nodiscriminant,flag(NDR_NOALIGN)] union {
		[case (FSCTL_NET_IFACE_AF_INET)] fsctl_sockaddr_in saddr_in;
		[case (FSCTL_NET_IFACE_AF_INET6)] fsctl_sockaddr_in6 saddr_in6;
	} fsctl_sockaddr_union;

	typedef [flag(NDR_NOALIGN)] struct {
		fsctl_sockaddr_af family;
		[subcontext(0),subcontext_size(126),switch_is(family)] fsctl_sockaddr_union saddr;
	} fsctl_sockaddr_storage;

	typedef [public,relative_base,noprint] struct {
		[relative,max_recursion(20000)] fsctl_net_iface_info *next;
		uint32 ifindex;
		fsctl_net_iface_capability capability;
		[value(0)] uint32 reserved;
		hyper linkspeed;
		fsctl_sockaddr_storage sockaddr;
	} fsctl_net_iface_info;
}

interface sparse
{
	/* MS-FSCC 2.3.33 FSCTL_QUERY_ALLOCATED_RANGES Request */
	typedef [public] struct {
		hyper file_off;
		hyper len;
	} file_alloced_range_buf;

	typedef [public] struct {
		file_alloced_range_buf buf;
	} fsctl_query_alloced_ranges_req;

	/*
	 * 2.3.34 FSCTL_QUERY_ALLOCATED_RANGES Reply
	 * ...
	 * The number of FILE_ALLOCATED_RANGE_BUFFER elements returned is
	 * computed by dividing the size of the returned output buffer (from
	 * either SMB or SMB2, the lower-layer protocol that carries the FSCTL)
	 * by the size of the FILE_ALLOCATED_RANGE_BUFFER element.
	 *
	 * This logic can't (currently) be represented in pidl, so just use a
	 * blob. Perhaps in future we'll support:
	 *	[flag(NDR_REMAINING)] file_alloced_range_buf array[];
	 */
	typedef [public] struct {
		[flag(NDR_REMAINING)] DATA_BLOB far_buf_array;
	} fsctl_query_alloced_ranges_rsp;

	/* 2.3.65 FSCTL_SET_ZERO_DATA Request */
	typedef [public] struct {
		hyper file_off;
		hyper beyond_final_zero;
	} file_zero_data_info;

	typedef [public] struct {
		file_zero_data_info info;
	} fsctl_set_zero_data_req;
}

interface resiliency
{
	/* 2.2.31.3 NETWORK_RESILIENCY_REQUEST */
	typedef [public] struct {
		uint32 timeout;
		uint32 reserved;
	} network_resiliency_request;
}

interface trim
{
	/* MS-FSCC 2.3.73.1 FILE_LEVEL_TRIM_RANGE */
	typedef [public] struct {
		hyper off;
		hyper len;
	} file_level_trim_range;

	/* MS-FSCC 2.3.73 FSCTL_FILE_LEVEL_TRIM Request */
	typedef [public] struct {
		uint32 key;
		uint32 num_ranges;
		file_level_trim_range ranges[num_ranges];
	} fsctl_file_level_trim_req;

	/* MS-FSCC 2.3.74 FSCTL_FILE_LEVEL_TRIM Reply */
	typedef [public] struct {
		uint32 num_ranges_processed;
	} fsctl_file_level_trim_rsp;
}