]>
Commit | Line | Data |
---|---|---|
ddfbefbd SF |
1 | /* |
2 | * fs/cifs/smb2pdu.h | |
3 | * | |
be7457d3 | 4 | * Copyright (c) International Business Machines Corp., 2009, 2013 |
ddfbefbd SF |
5 | * Etersoft, 2012 |
6 | * Author(s): Steve French (sfrench@us.ibm.com) | |
7 | * Pavel Shilovsky (pshilovsky@samba.org) 2012 | |
8 | * | |
9 | * This library is free software; you can redistribute it and/or modify | |
10 | * it under the terms of the GNU Lesser General Public License as published | |
11 | * by the Free Software Foundation; either version 2.1 of the License, or | |
12 | * (at your option) any later version. | |
13 | * | |
14 | * This library is distributed in the hope that it will be useful, | |
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See | |
17 | * the GNU Lesser General Public License for more details. | |
18 | * | |
19 | * You should have received a copy of the GNU Lesser General Public License | |
20 | * along with this library; if not, write to the Free Software | |
21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
22 | */ | |
23 | ||
24 | #ifndef _SMB2PDU_H | |
25 | #define _SMB2PDU_H | |
26 | ||
27 | #include <net/sock.h> | |
28 | ||
2dc7e1c0 PS |
29 | /* |
30 | * Note that, due to trying to use names similar to the protocol specifications, | |
31 | * there are many mixed case field names in the structures below. Although | |
32 | * this does not match typical Linux kernel style, it is necessary to be | |
33 | * be able to match against the protocol specfication. | |
34 | * | |
35 | * SMB2 commands | |
36 | * Some commands have minimal (wct=0,bcc=0), or uninteresting, responses | |
37 | * (ie no useful data other than the SMB error code itself) and are marked such. | |
38 | * Knowing this helps avoid response buffer allocations and copy in some cases. | |
39 | */ | |
40 | ||
41 | /* List of commands in host endian */ | |
42 | #define SMB2_NEGOTIATE_HE 0x0000 | |
43 | #define SMB2_SESSION_SETUP_HE 0x0001 | |
44 | #define SMB2_LOGOFF_HE 0x0002 /* trivial request/resp */ | |
45 | #define SMB2_TREE_CONNECT_HE 0x0003 | |
46 | #define SMB2_TREE_DISCONNECT_HE 0x0004 /* trivial req/resp */ | |
47 | #define SMB2_CREATE_HE 0x0005 | |
48 | #define SMB2_CLOSE_HE 0x0006 | |
49 | #define SMB2_FLUSH_HE 0x0007 /* trivial resp */ | |
50 | #define SMB2_READ_HE 0x0008 | |
51 | #define SMB2_WRITE_HE 0x0009 | |
52 | #define SMB2_LOCK_HE 0x000A | |
53 | #define SMB2_IOCTL_HE 0x000B | |
54 | #define SMB2_CANCEL_HE 0x000C | |
55 | #define SMB2_ECHO_HE 0x000D | |
56 | #define SMB2_QUERY_DIRECTORY_HE 0x000E | |
57 | #define SMB2_CHANGE_NOTIFY_HE 0x000F | |
58 | #define SMB2_QUERY_INFO_HE 0x0010 | |
59 | #define SMB2_SET_INFO_HE 0x0011 | |
60 | #define SMB2_OPLOCK_BREAK_HE 0x0012 | |
61 | ||
62 | /* The same list in little endian */ | |
63 | #define SMB2_NEGOTIATE cpu_to_le16(SMB2_NEGOTIATE_HE) | |
64 | #define SMB2_SESSION_SETUP cpu_to_le16(SMB2_SESSION_SETUP_HE) | |
65 | #define SMB2_LOGOFF cpu_to_le16(SMB2_LOGOFF_HE) | |
66 | #define SMB2_TREE_CONNECT cpu_to_le16(SMB2_TREE_CONNECT_HE) | |
67 | #define SMB2_TREE_DISCONNECT cpu_to_le16(SMB2_TREE_DISCONNECT_HE) | |
68 | #define SMB2_CREATE cpu_to_le16(SMB2_CREATE_HE) | |
69 | #define SMB2_CLOSE cpu_to_le16(SMB2_CLOSE_HE) | |
70 | #define SMB2_FLUSH cpu_to_le16(SMB2_FLUSH_HE) | |
71 | #define SMB2_READ cpu_to_le16(SMB2_READ_HE) | |
72 | #define SMB2_WRITE cpu_to_le16(SMB2_WRITE_HE) | |
73 | #define SMB2_LOCK cpu_to_le16(SMB2_LOCK_HE) | |
74 | #define SMB2_IOCTL cpu_to_le16(SMB2_IOCTL_HE) | |
75 | #define SMB2_CANCEL cpu_to_le16(SMB2_CANCEL_HE) | |
76 | #define SMB2_ECHO cpu_to_le16(SMB2_ECHO_HE) | |
77 | #define SMB2_QUERY_DIRECTORY cpu_to_le16(SMB2_QUERY_DIRECTORY_HE) | |
78 | #define SMB2_CHANGE_NOTIFY cpu_to_le16(SMB2_CHANGE_NOTIFY_HE) | |
79 | #define SMB2_QUERY_INFO cpu_to_le16(SMB2_QUERY_INFO_HE) | |
80 | #define SMB2_SET_INFO cpu_to_le16(SMB2_SET_INFO_HE) | |
81 | #define SMB2_OPLOCK_BREAK cpu_to_le16(SMB2_OPLOCK_BREAK_HE) | |
82 | ||
83 | #define NUMBER_OF_SMB2_COMMANDS 0x0013 | |
84 | ||
85 | /* BB FIXME - analyze following length BB */ | |
86 | #define MAX_SMB2_HDR_SIZE 0x78 /* 4 len + 64 hdr + (2*24 wct) + 2 bct + 2 pad */ | |
87 | ||
093b2bda PS |
88 | #define SMB2_PROTO_NUMBER __constant_cpu_to_le32(0x424d53fe) |
89 | ||
ddfbefbd SF |
90 | /* |
91 | * SMB2 Header Definition | |
92 | * | |
93 | * "MBZ" : Must be Zero | |
94 | * "BB" : BugBug, Something to check/review/analyze later | |
95 | * "PDU" : "Protocol Data Unit" (ie a network "frame") | |
96 | * | |
97 | */ | |
74112860 | 98 | |
b2ede58e | 99 | #define SMB2_HEADER_STRUCTURE_SIZE __constant_cpu_to_le16(64) |
74112860 | 100 | |
ddfbefbd SF |
101 | struct smb2_hdr { |
102 | __be32 smb2_buf_length; /* big endian on wire */ | |
103 | /* length is only two or three bytes - with | |
104 | one or two byte type preceding it that MBZ */ | |
105 | __u8 ProtocolId[4]; /* 0xFE 'S' 'M' 'B' */ | |
106 | __le16 StructureSize; /* 64 */ | |
107 | __le16 CreditCharge; /* MBZ */ | |
108 | __le32 Status; /* Error from server */ | |
109 | __le16 Command; | |
110 | __le16 CreditRequest; /* CreditResponse */ | |
111 | __le32 Flags; | |
112 | __le32 NextCommand; | |
113 | __u64 MessageId; /* opaque - so can stay little endian */ | |
114 | __le32 ProcessId; | |
115 | __u32 TreeId; /* opaque - so do not make little endian */ | |
116 | __u64 SessionId; /* opaque - so do not make little endian */ | |
117 | __u8 Signature[16]; | |
118 | } __packed; | |
119 | ||
093b2bda PS |
120 | struct smb2_pdu { |
121 | struct smb2_hdr hdr; | |
122 | __le16 StructureSize2; /* size of wct area (varies, request specific) */ | |
123 | } __packed; | |
124 | ||
125 | /* | |
126 | * SMB2 flag definitions | |
127 | */ | |
128 | #define SMB2_FLAGS_SERVER_TO_REDIR __constant_cpu_to_le32(0x00000001) | |
129 | #define SMB2_FLAGS_ASYNC_COMMAND __constant_cpu_to_le32(0x00000002) | |
130 | #define SMB2_FLAGS_RELATED_OPERATIONS __constant_cpu_to_le32(0x00000004) | |
131 | #define SMB2_FLAGS_SIGNED __constant_cpu_to_le32(0x00000008) | |
132 | #define SMB2_FLAGS_DFS_OPERATIONS __constant_cpu_to_le32(0x10000000) | |
133 | ||
134 | /* | |
135 | * Definitions for SMB2 Protocol Data Units (network frames) | |
136 | * | |
137 | * See MS-SMB2.PDF specification for protocol details. | |
138 | * The Naming convention is the lower case version of the SMB2 | |
139 | * command code name for the struct. Note that structures must be packed. | |
140 | * | |
141 | */ | |
74112860 | 142 | |
b2ede58e | 143 | #define SMB2_ERROR_STRUCTURE_SIZE2 __constant_cpu_to_le16(9) |
74112860 | 144 | |
093b2bda PS |
145 | struct smb2_err_rsp { |
146 | struct smb2_hdr hdr; | |
147 | __le16 StructureSize; | |
148 | __le16 Reserved; /* MBZ */ | |
149 | __le32 ByteCount; /* even if zero, at least one byte follows */ | |
150 | __u8 ErrorData[1]; /* variable length */ | |
151 | } __packed; | |
152 | ||
b42bf888 PS |
153 | struct smb2_symlink_err_rsp { |
154 | __le32 SymLinkLength; | |
155 | __le32 SymLinkErrorTag; | |
156 | __le32 ReparseTag; | |
157 | __le16 ReparseDataLength; | |
158 | __le16 UnparsedPathLength; | |
159 | __le16 SubstituteNameOffset; | |
160 | __le16 SubstituteNameLength; | |
161 | __le16 PrintNameOffset; | |
162 | __le16 PrintNameLength; | |
163 | __le32 Flags; | |
164 | __u8 PathBuffer[0]; | |
165 | } __packed; | |
166 | ||
b8c32dbb PS |
167 | #define SMB2_CLIENT_GUID_SIZE 16 |
168 | ||
169 | extern __u8 cifs_client_guid[SMB2_CLIENT_GUID_SIZE]; | |
170 | ||
ec2e4523 PS |
171 | struct smb2_negotiate_req { |
172 | struct smb2_hdr hdr; | |
173 | __le16 StructureSize; /* Must be 36 */ | |
174 | __le16 DialectCount; | |
175 | __le16 SecurityMode; | |
176 | __le16 Reserved; /* MBZ */ | |
177 | __le32 Capabilities; | |
b8c32dbb | 178 | __u8 ClientGUID[SMB2_CLIENT_GUID_SIZE]; |
ec2e4523 | 179 | __le64 ClientStartTime; /* MBZ */ |
e4aa25e7 | 180 | __le16 Dialects[1]; /* One dialect (vers=) at a time for now */ |
ec2e4523 PS |
181 | } __packed; |
182 | ||
e4aa25e7 SF |
183 | /* Dialects */ |
184 | #define SMB20_PROT_ID 0x0202 | |
185 | #define SMB21_PROT_ID 0x0210 | |
186 | #define SMB30_PROT_ID 0x0300 | |
20b6d8b4 | 187 | #define SMB302_PROT_ID 0x0302 |
e4aa25e7 SF |
188 | #define BAD_PROT_ID 0xFFFF |
189 | ||
ec2e4523 PS |
190 | /* SecurityMode flags */ |
191 | #define SMB2_NEGOTIATE_SIGNING_ENABLED 0x0001 | |
192 | #define SMB2_NEGOTIATE_SIGNING_REQUIRED 0x0002 | |
193 | /* Capabilities flags */ | |
194 | #define SMB2_GLOBAL_CAP_DFS 0x00000001 | |
195 | #define SMB2_GLOBAL_CAP_LEASING 0x00000002 /* Resp only New to SMB2.1 */ | |
196 | #define SMB2_GLOBAL_CAP_LARGE_MTU 0X00000004 /* Resp only New to SMB2.1 */ | |
e4aa25e7 SF |
197 | #define SMB2_GLOBAL_CAP_MULTI_CHANNEL 0x00000008 /* New to SMB3 */ |
198 | #define SMB2_GLOBAL_CAP_PERSISTENT_HANDLES 0x00000010 /* New to SMB3 */ | |
199 | #define SMB2_GLOBAL_CAP_DIRECTORY_LEASING 0x00000020 /* New to SMB3 */ | |
200 | #define SMB2_GLOBAL_CAP_ENCRYPTION 0x00000040 /* New to SMB3 */ | |
29e20f9c PS |
201 | /* Internal types */ |
202 | #define SMB2_NT_FIND 0x00100000 | |
203 | #define SMB2_LARGE_FILES 0x00200000 | |
ec2e4523 PS |
204 | |
205 | struct smb2_negotiate_rsp { | |
206 | struct smb2_hdr hdr; | |
207 | __le16 StructureSize; /* Must be 65 */ | |
208 | __le16 SecurityMode; | |
209 | __le16 DialectRevision; | |
210 | __le16 Reserved; /* MBZ */ | |
211 | __u8 ServerGUID[16]; | |
212 | __le32 Capabilities; | |
213 | __le32 MaxTransactSize; | |
214 | __le32 MaxReadSize; | |
215 | __le32 MaxWriteSize; | |
216 | __le64 SystemTime; /* MBZ */ | |
217 | __le64 ServerStartTime; | |
218 | __le16 SecurityBufferOffset; | |
219 | __le16 SecurityBufferLength; | |
220 | __le32 Reserved2; /* may be any value, ignore */ | |
221 | __u8 Buffer[1]; /* variable length GSS security buffer */ | |
222 | } __packed; | |
223 | ||
5478f9ba PS |
224 | struct smb2_sess_setup_req { |
225 | struct smb2_hdr hdr; | |
226 | __le16 StructureSize; /* Must be 25 */ | |
227 | __u8 VcNumber; | |
228 | __u8 SecurityMode; | |
229 | __le32 Capabilities; | |
230 | __le32 Channel; | |
231 | __le16 SecurityBufferOffset; | |
232 | __le16 SecurityBufferLength; | |
233 | __le64 PreviousSessionId; | |
234 | __u8 Buffer[1]; /* variable length GSS security buffer */ | |
235 | } __packed; | |
236 | ||
237 | /* Currently defined SessionFlags */ | |
238 | #define SMB2_SESSION_FLAG_IS_GUEST 0x0001 | |
239 | #define SMB2_SESSION_FLAG_IS_NULL 0x0002 | |
240 | struct smb2_sess_setup_rsp { | |
241 | struct smb2_hdr hdr; | |
242 | __le16 StructureSize; /* Must be 9 */ | |
243 | __le16 SessionFlags; | |
244 | __le16 SecurityBufferOffset; | |
245 | __le16 SecurityBufferLength; | |
246 | __u8 Buffer[1]; /* variable length GSS security buffer */ | |
247 | } __packed; | |
248 | ||
249 | struct smb2_logoff_req { | |
250 | struct smb2_hdr hdr; | |
251 | __le16 StructureSize; /* Must be 4 */ | |
252 | __le16 Reserved; | |
253 | } __packed; | |
254 | ||
255 | struct smb2_logoff_rsp { | |
256 | struct smb2_hdr hdr; | |
257 | __le16 StructureSize; /* Must be 4 */ | |
258 | __le16 Reserved; | |
259 | } __packed; | |
260 | ||
faaf946a PS |
261 | struct smb2_tree_connect_req { |
262 | struct smb2_hdr hdr; | |
263 | __le16 StructureSize; /* Must be 9 */ | |
264 | __le16 Reserved; | |
265 | __le16 PathOffset; | |
266 | __le16 PathLength; | |
267 | __u8 Buffer[1]; /* variable length */ | |
268 | } __packed; | |
269 | ||
270 | struct smb2_tree_connect_rsp { | |
271 | struct smb2_hdr hdr; | |
272 | __le16 StructureSize; /* Must be 16 */ | |
273 | __u8 ShareType; /* see below */ | |
274 | __u8 Reserved; | |
275 | __le32 ShareFlags; /* see below */ | |
276 | __le32 Capabilities; /* see below */ | |
277 | __le32 MaximalAccess; | |
278 | } __packed; | |
279 | ||
280 | /* Possible ShareType values */ | |
281 | #define SMB2_SHARE_TYPE_DISK 0x01 | |
282 | #define SMB2_SHARE_TYPE_PIPE 0x02 | |
283 | #define SMB2_SHARE_TYPE_PRINT 0x03 | |
284 | ||
285 | /* | |
286 | * Possible ShareFlags - exactly one and only one of the first 4 caching flags | |
287 | * must be set (any of the remaining, SHI1005, flags may be set individually | |
288 | * or in combination. | |
289 | */ | |
290 | #define SMB2_SHAREFLAG_MANUAL_CACHING 0x00000000 | |
291 | #define SMB2_SHAREFLAG_AUTO_CACHING 0x00000010 | |
292 | #define SMB2_SHAREFLAG_VDO_CACHING 0x00000020 | |
293 | #define SMB2_SHAREFLAG_NO_CACHING 0x00000030 | |
294 | #define SHI1005_FLAGS_DFS 0x00000001 | |
295 | #define SHI1005_FLAGS_DFS_ROOT 0x00000002 | |
296 | #define SHI1005_FLAGS_RESTRICT_EXCLUSIVE_OPENS 0x00000100 | |
297 | #define SHI1005_FLAGS_FORCE_SHARED_DELETE 0x00000200 | |
298 | #define SHI1005_FLAGS_ALLOW_NAMESPACE_CACHING 0x00000400 | |
299 | #define SHI1005_FLAGS_ACCESS_BASED_DIRECTORY_ENUM 0x00000800 | |
300 | #define SHI1005_FLAGS_FORCE_LEVELII_OPLOCK 0x00001000 | |
c8664730 SF |
301 | #define SHI1005_FLAGS_ENABLE_HASH_V1 0x00002000 |
302 | #define SHI1005_FLAGS_ENABLE_HASH_V2 0x00004000 | |
303 | #define SHI1005_FLAGS_ENCRYPT_DATA 0x00008000 | |
304 | #define SHI1005_FLAGS_ALL 0x0000FF33 | |
faaf946a PS |
305 | |
306 | /* Possible share capabilities */ | |
2b5dc286 SF |
307 | #define SMB2_SHARE_CAP_DFS cpu_to_le32(0x00000008) /* all dialects */ |
308 | #define SMB2_SHARE_CAP_CONTINUOUS_AVAILABILITY cpu_to_le32(0x00000010) /* 3.0 */ | |
309 | #define SMB2_SHARE_CAP_SCALEOUT cpu_to_le32(0x00000020) /* 3.0 */ | |
310 | #define SMB2_SHARE_CAP_CLUSTER cpu_to_le32(0x00000040) /* 3.0 */ | |
311 | #define SMB2_SHARE_CAP_ASYMMETRIC cpu_to_le32(0x00000080) /* 3.02 */ | |
faaf946a PS |
312 | |
313 | struct smb2_tree_disconnect_req { | |
314 | struct smb2_hdr hdr; | |
315 | __le16 StructureSize; /* Must be 4 */ | |
316 | __le16 Reserved; | |
317 | } __packed; | |
318 | ||
319 | struct smb2_tree_disconnect_rsp { | |
320 | struct smb2_hdr hdr; | |
321 | __le16 StructureSize; /* Must be 4 */ | |
322 | __le16 Reserved; | |
323 | } __packed; | |
324 | ||
2503a0db PS |
325 | /* File Attrubutes */ |
326 | #define FILE_ATTRIBUTE_READONLY 0x00000001 | |
327 | #define FILE_ATTRIBUTE_HIDDEN 0x00000002 | |
328 | #define FILE_ATTRIBUTE_SYSTEM 0x00000004 | |
329 | #define FILE_ATTRIBUTE_DIRECTORY 0x00000010 | |
330 | #define FILE_ATTRIBUTE_ARCHIVE 0x00000020 | |
331 | #define FILE_ATTRIBUTE_NORMAL 0x00000080 | |
332 | #define FILE_ATTRIBUTE_TEMPORARY 0x00000100 | |
333 | #define FILE_ATTRIBUTE_SPARSE_FILE 0x00000200 | |
334 | #define FILE_ATTRIBUTE_REPARSE_POINT 0x00000400 | |
335 | #define FILE_ATTRIBUTE_COMPRESSED 0x00000800 | |
336 | #define FILE_ATTRIBUTE_OFFLINE 0x00001000 | |
337 | #define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000 | |
338 | #define FILE_ATTRIBUTE_ENCRYPTED 0x00004000 | |
339 | ||
340 | /* Oplock levels */ | |
341 | #define SMB2_OPLOCK_LEVEL_NONE 0x00 | |
342 | #define SMB2_OPLOCK_LEVEL_II 0x01 | |
343 | #define SMB2_OPLOCK_LEVEL_EXCLUSIVE 0x08 | |
344 | #define SMB2_OPLOCK_LEVEL_BATCH 0x09 | |
345 | #define SMB2_OPLOCK_LEVEL_LEASE 0xFF | |
b8c32dbb PS |
346 | /* Non-spec internal type */ |
347 | #define SMB2_OPLOCK_LEVEL_NOCHANGE 0x99 | |
2503a0db PS |
348 | |
349 | /* Desired Access Flags */ | |
350 | #define FILE_READ_DATA_LE cpu_to_le32(0x00000001) | |
351 | #define FILE_WRITE_DATA_LE cpu_to_le32(0x00000002) | |
352 | #define FILE_APPEND_DATA_LE cpu_to_le32(0x00000004) | |
353 | #define FILE_READ_EA_LE cpu_to_le32(0x00000008) | |
354 | #define FILE_WRITE_EA_LE cpu_to_le32(0x00000010) | |
355 | #define FILE_EXECUTE_LE cpu_to_le32(0x00000020) | |
356 | #define FILE_READ_ATTRIBUTES_LE cpu_to_le32(0x00000080) | |
357 | #define FILE_WRITE_ATTRIBUTES_LE cpu_to_le32(0x00000100) | |
358 | #define FILE_DELETE_LE cpu_to_le32(0x00010000) | |
359 | #define FILE_READ_CONTROL_LE cpu_to_le32(0x00020000) | |
360 | #define FILE_WRITE_DAC_LE cpu_to_le32(0x00040000) | |
361 | #define FILE_WRITE_OWNER_LE cpu_to_le32(0x00080000) | |
362 | #define FILE_SYNCHRONIZE_LE cpu_to_le32(0x00100000) | |
363 | #define FILE_ACCESS_SYSTEM_SECURITY_LE cpu_to_le32(0x01000000) | |
364 | #define FILE_MAXIMAL_ACCESS_LE cpu_to_le32(0x02000000) | |
365 | #define FILE_GENERIC_ALL_LE cpu_to_le32(0x10000000) | |
366 | #define FILE_GENERIC_EXECUTE_LE cpu_to_le32(0x20000000) | |
367 | #define FILE_GENERIC_WRITE_LE cpu_to_le32(0x40000000) | |
368 | #define FILE_GENERIC_READ_LE cpu_to_le32(0x80000000) | |
369 | ||
370 | /* ShareAccess Flags */ | |
371 | #define FILE_SHARE_READ_LE cpu_to_le32(0x00000001) | |
372 | #define FILE_SHARE_WRITE_LE cpu_to_le32(0x00000002) | |
373 | #define FILE_SHARE_DELETE_LE cpu_to_le32(0x00000004) | |
374 | #define FILE_SHARE_ALL_LE cpu_to_le32(0x00000007) | |
375 | ||
376 | /* CreateDisposition Flags */ | |
377 | #define FILE_SUPERSEDE_LE cpu_to_le32(0x00000000) | |
378 | #define FILE_OPEN_LE cpu_to_le32(0x00000001) | |
379 | #define FILE_CREATE_LE cpu_to_le32(0x00000002) | |
380 | #define FILE_OPEN_IF_LE cpu_to_le32(0x00000003) | |
381 | #define FILE_OVERWRITE_LE cpu_to_le32(0x00000004) | |
382 | #define FILE_OVERWRITE_IF_LE cpu_to_le32(0x00000005) | |
383 | ||
384 | /* CreateOptions Flags */ | |
385 | #define FILE_DIRECTORY_FILE_LE cpu_to_le32(0x00000001) | |
386 | /* same as #define CREATE_NOT_FILE_LE cpu_to_le32(0x00000001) */ | |
387 | #define FILE_WRITE_THROUGH_LE cpu_to_le32(0x00000002) | |
388 | #define FILE_SEQUENTIAL_ONLY_LE cpu_to_le32(0x00000004) | |
389 | #define FILE_NO_INTERMEDIATE_BUFFERRING_LE cpu_to_le32(0x00000008) | |
390 | #define FILE_SYNCHRONOUS_IO_ALERT_LE cpu_to_le32(0x00000010) | |
391 | #define FILE_SYNCHRONOUS_IO_NON_ALERT_LE cpu_to_le32(0x00000020) | |
392 | #define FILE_NON_DIRECTORY_FILE_LE cpu_to_le32(0x00000040) | |
393 | #define FILE_COMPLETE_IF_OPLOCKED_LE cpu_to_le32(0x00000100) | |
394 | #define FILE_NO_EA_KNOWLEDGE_LE cpu_to_le32(0x00000200) | |
395 | #define FILE_RANDOM_ACCESS_LE cpu_to_le32(0x00000800) | |
396 | #define FILE_DELETE_ON_CLOSE_LE cpu_to_le32(0x00001000) | |
397 | #define FILE_OPEN_BY_FILE_ID_LE cpu_to_le32(0x00002000) | |
398 | #define FILE_OPEN_FOR_BACKUP_INTENT_LE cpu_to_le32(0x00004000) | |
399 | #define FILE_NO_COMPRESSION_LE cpu_to_le32(0x00008000) | |
400 | #define FILE_RESERVE_OPFILTER_LE cpu_to_le32(0x00100000) | |
401 | #define FILE_OPEN_REPARSE_POINT_LE cpu_to_le32(0x00200000) | |
402 | #define FILE_OPEN_NO_RECALL_LE cpu_to_le32(0x00400000) | |
403 | #define FILE_OPEN_FOR_FREE_SPACE_QUERY_LE cpu_to_le32(0x00800000) | |
404 | ||
405 | #define FILE_READ_RIGHTS_LE (FILE_READ_DATA_LE | FILE_READ_EA_LE \ | |
406 | | FILE_READ_ATTRIBUTES_LE) | |
407 | #define FILE_WRITE_RIGHTS_LE (FILE_WRITE_DATA_LE | FILE_APPEND_DATA_LE \ | |
408 | | FILE_WRITE_EA_LE | FILE_WRITE_ATTRIBUTES_LE) | |
409 | #define FILE_EXEC_RIGHTS_LE (FILE_EXECUTE_LE) | |
410 | ||
411 | /* Impersonation Levels */ | |
412 | #define IL_ANONYMOUS cpu_to_le32(0x00000000) | |
413 | #define IL_IDENTIFICATION cpu_to_le32(0x00000001) | |
414 | #define IL_IMPERSONATION cpu_to_le32(0x00000002) | |
415 | #define IL_DELEGATE cpu_to_le32(0x00000003) | |
416 | ||
417 | /* Create Context Values */ | |
418 | #define SMB2_CREATE_EA_BUFFER "ExtA" /* extended attributes */ | |
419 | #define SMB2_CREATE_SD_BUFFER "SecD" /* security descriptor */ | |
420 | #define SMB2_CREATE_DURABLE_HANDLE_REQUEST "DHnQ" | |
421 | #define SMB2_CREATE_DURABLE_HANDLE_RECONNECT "DHnC" | |
422 | #define SMB2_CREATE_ALLOCATION_SIZE "AlSi" | |
423 | #define SMB2_CREATE_QUERY_MAXIMAL_ACCESS_REQUEST "MxAc" | |
424 | #define SMB2_CREATE_TIMEWARP_REQUEST "TWrp" | |
425 | #define SMB2_CREATE_QUERY_ON_DISK_ID "QFid" | |
426 | #define SMB2_CREATE_REQUEST_LEASE "RqLs" | |
427 | ||
428 | struct smb2_create_req { | |
429 | struct smb2_hdr hdr; | |
430 | __le16 StructureSize; /* Must be 57 */ | |
431 | __u8 SecurityFlags; | |
432 | __u8 RequestedOplockLevel; | |
433 | __le32 ImpersonationLevel; | |
434 | __le64 SmbCreateFlags; | |
435 | __le64 Reserved; | |
436 | __le32 DesiredAccess; | |
437 | __le32 FileAttributes; | |
438 | __le32 ShareAccess; | |
439 | __le32 CreateDisposition; | |
440 | __le32 CreateOptions; | |
441 | __le16 NameOffset; | |
442 | __le16 NameLength; | |
443 | __le32 CreateContextsOffset; | |
444 | __le32 CreateContextsLength; | |
59aa3718 | 445 | __u8 Buffer[0]; |
2503a0db PS |
446 | } __packed; |
447 | ||
448 | struct smb2_create_rsp { | |
449 | struct smb2_hdr hdr; | |
450 | __le16 StructureSize; /* Must be 89 */ | |
451 | __u8 OplockLevel; | |
452 | __u8 Reserved; | |
453 | __le32 CreateAction; | |
454 | __le64 CreationTime; | |
455 | __le64 LastAccessTime; | |
456 | __le64 LastWriteTime; | |
457 | __le64 ChangeTime; | |
458 | __le64 AllocationSize; | |
459 | __le64 EndofFile; | |
460 | __le32 FileAttributes; | |
461 | __le32 Reserved2; | |
462 | __u64 PersistentFileId; /* opaque endianness */ | |
463 | __u64 VolatileFileId; /* opaque endianness */ | |
464 | __le32 CreateContextsOffset; | |
465 | __le32 CreateContextsLength; | |
466 | __u8 Buffer[1]; | |
467 | } __packed; | |
468 | ||
b8c32dbb PS |
469 | struct create_context { |
470 | __le32 Next; | |
471 | __le16 NameOffset; | |
472 | __le16 NameLength; | |
473 | __le16 Reserved; | |
474 | __le16 DataOffset; | |
475 | __le32 DataLength; | |
476 | __u8 Buffer[0]; | |
477 | } __packed; | |
478 | ||
479 | #define SMB2_LEASE_NONE __constant_cpu_to_le32(0x00) | |
480 | #define SMB2_LEASE_READ_CACHING __constant_cpu_to_le32(0x01) | |
481 | #define SMB2_LEASE_HANDLE_CACHING __constant_cpu_to_le32(0x02) | |
482 | #define SMB2_LEASE_WRITE_CACHING __constant_cpu_to_le32(0x04) | |
483 | ||
484 | #define SMB2_LEASE_FLAG_BREAK_IN_PROGRESS __constant_cpu_to_le32(0x02) | |
485 | ||
486 | #define SMB2_LEASE_KEY_SIZE 16 | |
487 | ||
488 | struct lease_context { | |
489 | __le64 LeaseKeyLow; | |
490 | __le64 LeaseKeyHigh; | |
491 | __le32 LeaseState; | |
492 | __le32 LeaseFlags; | |
493 | __le64 LeaseDuration; | |
494 | } __packed; | |
495 | ||
496 | struct create_lease { | |
497 | struct create_context ccontext; | |
498 | __u8 Name[8]; | |
499 | struct lease_context lcontext; | |
500 | } __packed; | |
501 | ||
63eb3def PS |
502 | struct create_durable { |
503 | struct create_context ccontext; | |
504 | __u8 Name[8]; | |
9cbc0b73 PS |
505 | union { |
506 | __u8 Reserved[16]; | |
507 | struct { | |
508 | __u64 PersistentFileId; | |
509 | __u64 VolatileFileId; | |
510 | } Fid; | |
511 | } Data; | |
63eb3def PS |
512 | } __packed; |
513 | ||
be7457d3 SF |
514 | /* this goes in the ioctl buffer when doing a copychunk request */ |
515 | struct copychunk_ioctl { | |
516 | char SourceKey[24]; | |
517 | __le32 ChunkCount; /* we are only sending 1 */ | |
518 | __le32 Reserved; | |
519 | /* array will only be one chunk long for us */ | |
520 | __le64 SourceOffset; | |
521 | __le64 TargetOffset; | |
c8664730 | 522 | __le32 Length; /* how many bytes to copy */ |
be7457d3 SF |
523 | __u32 Reserved2; |
524 | } __packed; | |
525 | ||
4a72dafa SF |
526 | /* Response and Request are the same format */ |
527 | struct validate_negotiate_info { | |
528 | __le32 Capabilities; | |
529 | __u8 Guid[SMB2_CLIENT_GUID_SIZE]; | |
530 | __le16 SecurityMode; | |
531 | __le16 DialectCount; | |
532 | __le16 Dialect[1]; | |
533 | } __packed; | |
534 | ||
535 | #define RSS_CAPABLE 0x00000001 | |
536 | #define RDMA_CAPABLE 0x00000002 | |
537 | ||
538 | struct network_interface_info_ioctl_rsp { | |
539 | __le32 Next; /* next interface. zero if this is last one */ | |
540 | __le32 IfIndex; | |
541 | __le32 Capability; /* RSS or RDMA Capable */ | |
542 | __le32 Reserved; | |
543 | __le64 LinkSpeed; | |
544 | char SockAddr_Storage[128]; | |
545 | } __packed; | |
546 | ||
547 | #define NO_FILE_ID 0xFFFFFFFFFFFFFFFFULL /* general ioctls to srv not to file */ | |
548 | ||
be7457d3 SF |
549 | struct smb2_ioctl_req { |
550 | struct smb2_hdr hdr; | |
551 | __le16 StructureSize; /* Must be 57 */ | |
552 | __u16 Reserved; | |
553 | __le32 CtlCode; | |
554 | __u64 PersistentFileId; /* opaque endianness */ | |
555 | __u64 VolatileFileId; /* opaque endianness */ | |
556 | __le32 InputOffset; | |
557 | __le32 InputCount; | |
558 | __le32 MaxInputResponse; | |
559 | __le32 OutputOffset; | |
560 | __le32 OutputCount; | |
561 | __le32 MaxOutputResponse; | |
562 | __le32 Flags; | |
563 | __u32 Reserved2; | |
564 | char Buffer[0]; | |
565 | } __packed; | |
566 | ||
567 | struct smb2_ioctl_rsp { | |
568 | struct smb2_hdr hdr; | |
569 | __le16 StructureSize; /* Must be 57 */ | |
570 | __u16 Reserved; | |
571 | __le32 CtlCode; | |
572 | __u64 PersistentFileId; /* opaque endianness */ | |
573 | __u64 VolatileFileId; /* opaque endianness */ | |
574 | __le32 InputOffset; | |
575 | __le32 InputCount; | |
576 | __le32 OutputOffset; | |
577 | __le32 OutputCount; | |
578 | __le32 Flags; | |
579 | __u32 Reserved2; | |
580 | /* char * buffer[] */ | |
581 | } __packed; | |
582 | ||
2503a0db PS |
583 | /* Currently defined values for close flags */ |
584 | #define SMB2_CLOSE_FLAG_POSTQUERY_ATTRIB cpu_to_le16(0x0001) | |
585 | struct smb2_close_req { | |
586 | struct smb2_hdr hdr; | |
587 | __le16 StructureSize; /* Must be 24 */ | |
588 | __le16 Flags; | |
589 | __le32 Reserved; | |
590 | __u64 PersistentFileId; /* opaque endianness */ | |
591 | __u64 VolatileFileId; /* opaque endianness */ | |
592 | } __packed; | |
593 | ||
594 | struct smb2_close_rsp { | |
595 | struct smb2_hdr hdr; | |
596 | __le16 StructureSize; /* 60 */ | |
597 | __le16 Flags; | |
598 | __le32 Reserved; | |
599 | __le64 CreationTime; | |
600 | __le64 LastAccessTime; | |
601 | __le64 LastWriteTime; | |
602 | __le64 ChangeTime; | |
603 | __le64 AllocationSize; /* Beginning of FILE_STANDARD_INFO equivalent */ | |
604 | __le64 EndOfFile; | |
605 | __le32 Attributes; | |
606 | } __packed; | |
607 | ||
7a5cfb19 PS |
608 | struct smb2_flush_req { |
609 | struct smb2_hdr hdr; | |
610 | __le16 StructureSize; /* Must be 24 */ | |
611 | __le16 Reserved1; | |
612 | __le32 Reserved2; | |
613 | __u64 PersistentFileId; /* opaque endianness */ | |
614 | __u64 VolatileFileId; /* opaque endianness */ | |
615 | } __packed; | |
616 | ||
617 | struct smb2_flush_rsp { | |
618 | struct smb2_hdr hdr; | |
619 | __le16 StructureSize; | |
620 | __le16 Reserved; | |
621 | } __packed; | |
622 | ||
2b5dc286 SF |
623 | /* For read request Flags field below, following flag is defined for SMB3.02 */ |
624 | #define SMB2_READFLAG_READ_UNBUFFERED 0x01 | |
625 | ||
626 | /* Channel field for read and write: exactly one of following flags can be set*/ | |
627 | #define SMB2_CHANNEL_NONE 0x00000000 | |
628 | #define SMB2_CHANNEL_RDMA_V1 0x00000001 /* SMB3 or later */ | |
629 | #define SMB2_CHANNEL_RDMA_V1_INVALIDATE 0x00000001 /* SMB3.02 or later */ | |
630 | ||
09a4707e PS |
631 | struct smb2_read_req { |
632 | struct smb2_hdr hdr; | |
633 | __le16 StructureSize; /* Must be 49 */ | |
634 | __u8 Padding; /* offset from start of SMB2 header to place read */ | |
2b5dc286 | 635 | __u8 Flags; /* MBZ unless SMB3.02 or later */ |
09a4707e PS |
636 | __le32 Length; |
637 | __le64 Offset; | |
638 | __u64 PersistentFileId; /* opaque endianness */ | |
639 | __u64 VolatileFileId; /* opaque endianness */ | |
640 | __le32 MinimumCount; | |
2b5dc286 | 641 | __le32 Channel; /* MBZ except for SMB3 or later */ |
09a4707e PS |
642 | __le32 RemainingBytes; |
643 | __le16 ReadChannelInfoOffset; /* Reserved MBZ */ | |
644 | __le16 ReadChannelInfoLength; /* Reserved MBZ */ | |
645 | __u8 Buffer[1]; | |
646 | } __packed; | |
647 | ||
648 | struct smb2_read_rsp { | |
649 | struct smb2_hdr hdr; | |
650 | __le16 StructureSize; /* Must be 17 */ | |
651 | __u8 DataOffset; | |
33319141 PS |
652 | __u8 Reserved; |
653 | __le32 DataLength; | |
654 | __le32 DataRemaining; | |
655 | __u32 Reserved2; | |
656 | __u8 Buffer[1]; | |
657 | } __packed; | |
658 | ||
2b5dc286 SF |
659 | /* For write request Flags field below the following flags are defined: */ |
660 | #define SMB2_WRITEFLAG_WRITE_THROUGH 0x00000001 /* SMB2.1 or later */ | |
661 | #define SMB2_WRITEFLAG_WRITE_UNBUFFERED 0x00000002 /* SMB3.02 or later */ | |
33319141 PS |
662 | |
663 | struct smb2_write_req { | |
664 | struct smb2_hdr hdr; | |
665 | __le16 StructureSize; /* Must be 49 */ | |
666 | __le16 DataOffset; /* offset from start of SMB2 header to write data */ | |
667 | __le32 Length; | |
668 | __le64 Offset; | |
669 | __u64 PersistentFileId; /* opaque endianness */ | |
670 | __u64 VolatileFileId; /* opaque endianness */ | |
671 | __le32 Channel; /* Reserved MBZ */ | |
672 | __le32 RemainingBytes; | |
673 | __le16 WriteChannelInfoOffset; /* Reserved MBZ */ | |
674 | __le16 WriteChannelInfoLength; /* Reserved MBZ */ | |
675 | __le32 Flags; | |
676 | __u8 Buffer[1]; | |
677 | } __packed; | |
678 | ||
679 | struct smb2_write_rsp { | |
680 | struct smb2_hdr hdr; | |
681 | __le16 StructureSize; /* Must be 17 */ | |
682 | __u8 DataOffset; | |
09a4707e PS |
683 | __u8 Reserved; |
684 | __le32 DataLength; | |
685 | __le32 DataRemaining; | |
686 | __u32 Reserved2; | |
687 | __u8 Buffer[1]; | |
688 | } __packed; | |
689 | ||
027e8eec PS |
690 | #define SMB2_LOCKFLAG_SHARED_LOCK 0x0001 |
691 | #define SMB2_LOCKFLAG_EXCLUSIVE_LOCK 0x0002 | |
692 | #define SMB2_LOCKFLAG_UNLOCK 0x0004 | |
693 | #define SMB2_LOCKFLAG_FAIL_IMMEDIATELY 0x0010 | |
694 | ||
f7ba7fe6 PS |
695 | struct smb2_lock_element { |
696 | __le64 Offset; | |
697 | __le64 Length; | |
698 | __le32 Flags; | |
699 | __le32 Reserved; | |
700 | } __packed; | |
701 | ||
702 | struct smb2_lock_req { | |
703 | struct smb2_hdr hdr; | |
704 | __le16 StructureSize; /* Must be 48 */ | |
705 | __le16 LockCount; | |
706 | __le32 Reserved; | |
707 | __u64 PersistentFileId; /* opaque endianness */ | |
708 | __u64 VolatileFileId; /* opaque endianness */ | |
709 | /* Followed by at least one */ | |
710 | struct smb2_lock_element locks[1]; | |
711 | } __packed; | |
712 | ||
713 | struct smb2_lock_rsp { | |
714 | struct smb2_hdr hdr; | |
715 | __le16 StructureSize; /* Must be 4 */ | |
716 | __le16 Reserved; | |
717 | } __packed; | |
718 | ||
9094fad1 PS |
719 | struct smb2_echo_req { |
720 | struct smb2_hdr hdr; | |
721 | __le16 StructureSize; /* Must be 4 */ | |
722 | __u16 Reserved; | |
723 | } __packed; | |
724 | ||
725 | struct smb2_echo_rsp { | |
726 | struct smb2_hdr hdr; | |
727 | __le16 StructureSize; /* Must be 4 */ | |
728 | __u16 Reserved; | |
729 | } __packed; | |
730 | ||
d324f08d PS |
731 | /* search (query_directory) Flags field */ |
732 | #define SMB2_RESTART_SCANS 0x01 | |
733 | #define SMB2_RETURN_SINGLE_ENTRY 0x02 | |
734 | #define SMB2_INDEX_SPECIFIED 0x04 | |
735 | #define SMB2_REOPEN 0x10 | |
736 | ||
737 | struct smb2_query_directory_req { | |
738 | struct smb2_hdr hdr; | |
739 | __le16 StructureSize; /* Must be 33 */ | |
740 | __u8 FileInformationClass; | |
741 | __u8 Flags; | |
742 | __le32 FileIndex; | |
743 | __u64 PersistentFileId; /* opaque endianness */ | |
744 | __u64 VolatileFileId; /* opaque endianness */ | |
745 | __le16 FileNameOffset; | |
746 | __le16 FileNameLength; | |
747 | __le32 OutputBufferLength; | |
748 | __u8 Buffer[1]; | |
749 | } __packed; | |
750 | ||
751 | struct smb2_query_directory_rsp { | |
752 | struct smb2_hdr hdr; | |
753 | __le16 StructureSize; /* Must be 9 */ | |
754 | __le16 OutputBufferOffset; | |
755 | __le32 OutputBufferLength; | |
756 | __u8 Buffer[1]; | |
757 | } __packed; | |
758 | ||
be4cb9e3 PS |
759 | /* Possible InfoType values */ |
760 | #define SMB2_O_INFO_FILE 0x01 | |
761 | #define SMB2_O_INFO_FILESYSTEM 0x02 | |
762 | #define SMB2_O_INFO_SECURITY 0x03 | |
763 | #define SMB2_O_INFO_QUOTA 0x04 | |
764 | ||
765 | struct smb2_query_info_req { | |
766 | struct smb2_hdr hdr; | |
767 | __le16 StructureSize; /* Must be 41 */ | |
768 | __u8 InfoType; | |
769 | __u8 FileInfoClass; | |
770 | __le32 OutputBufferLength; | |
771 | __le16 InputBufferOffset; | |
772 | __u16 Reserved; | |
773 | __le32 InputBufferLength; | |
774 | __le32 AdditionalInformation; | |
775 | __le32 Flags; | |
776 | __u64 PersistentFileId; /* opaque endianness */ | |
777 | __u64 VolatileFileId; /* opaque endianness */ | |
778 | __u8 Buffer[1]; | |
779 | } __packed; | |
780 | ||
781 | struct smb2_query_info_rsp { | |
782 | struct smb2_hdr hdr; | |
783 | __le16 StructureSize; /* Must be 9 */ | |
784 | __le16 OutputBufferOffset; | |
785 | __le32 OutputBufferLength; | |
786 | __u8 Buffer[1]; | |
787 | } __packed; | |
788 | ||
35143eb5 PS |
789 | struct smb2_set_info_req { |
790 | struct smb2_hdr hdr; | |
791 | __le16 StructureSize; /* Must be 33 */ | |
792 | __u8 InfoType; | |
793 | __u8 FileInfoClass; | |
794 | __le32 BufferLength; | |
795 | __le16 BufferOffset; | |
796 | __u16 Reserved; | |
797 | __le32 AdditionalInformation; | |
798 | __u64 PersistentFileId; /* opaque endianness */ | |
799 | __u64 VolatileFileId; /* opaque endianness */ | |
800 | __u8 Buffer[1]; | |
801 | } __packed; | |
802 | ||
803 | struct smb2_set_info_rsp { | |
804 | struct smb2_hdr hdr; | |
805 | __le16 StructureSize; /* Must be 2 */ | |
806 | } __packed; | |
807 | ||
983c88a4 PS |
808 | struct smb2_oplock_break { |
809 | struct smb2_hdr hdr; | |
810 | __le16 StructureSize; /* Must be 24 */ | |
811 | __u8 OplockLevel; | |
812 | __u8 Reserved; | |
813 | __le32 Reserved2; | |
814 | __u64 PersistentFid; | |
815 | __u64 VolatileFid; | |
816 | } __packed; | |
817 | ||
0822f514 PS |
818 | #define SMB2_NOTIFY_BREAK_LEASE_FLAG_ACK_REQUIRED cpu_to_le32(0x01) |
819 | ||
820 | struct smb2_lease_break { | |
821 | struct smb2_hdr hdr; | |
822 | __le16 StructureSize; /* Must be 44 */ | |
823 | __le16 Reserved; | |
824 | __le32 Flags; | |
825 | __u8 LeaseKey[16]; | |
826 | __le32 CurrentLeaseState; | |
827 | __le32 NewLeaseState; | |
828 | __le32 BreakReason; | |
829 | __le32 AccessMaskHint; | |
830 | __le32 ShareMaskHint; | |
831 | } __packed; | |
832 | ||
833 | struct smb2_lease_ack { | |
834 | struct smb2_hdr hdr; | |
835 | __le16 StructureSize; /* Must be 36 */ | |
836 | __le16 Reserved; | |
837 | __le32 Flags; | |
838 | __u8 LeaseKey[16]; | |
839 | __le32 LeaseState; | |
840 | __le64 LeaseDuration; | |
841 | } __packed; | |
842 | ||
be4cb9e3 PS |
843 | /* |
844 | * PDU infolevel structure definitions | |
845 | * BB consider moving to a different header | |
846 | */ | |
847 | ||
6fc05c25 PS |
848 | /* File System Information Classes */ |
849 | #define FS_VOLUME_INFORMATION 1 /* Query */ | |
850 | #define FS_LABEL_INFORMATION 2 /* Set */ | |
851 | #define FS_SIZE_INFORMATION 3 /* Query */ | |
852 | #define FS_DEVICE_INFORMATION 4 /* Query */ | |
853 | #define FS_ATTRIBUTE_INFORMATION 5 /* Query */ | |
854 | #define FS_CONTROL_INFORMATION 6 /* Query, Set */ | |
855 | #define FS_FULL_SIZE_INFORMATION 7 /* Query */ | |
856 | #define FS_OBJECT_ID_INFORMATION 8 /* Query, Set */ | |
857 | #define FS_DRIVER_PATH_INFORMATION 9 /* Query */ | |
858 | ||
859 | struct smb2_fs_full_size_info { | |
860 | __le64 TotalAllocationUnits; | |
861 | __le64 CallerAvailableAllocationUnits; | |
862 | __le64 ActualAvailableAllocationUnits; | |
863 | __le32 SectorsPerAllocationUnit; | |
864 | __le32 BytesPerSector; | |
865 | } __packed; | |
866 | ||
be4cb9e3 PS |
867 | /* partial list of QUERY INFO levels */ |
868 | #define FILE_DIRECTORY_INFORMATION 1 | |
869 | #define FILE_FULL_DIRECTORY_INFORMATION 2 | |
870 | #define FILE_BOTH_DIRECTORY_INFORMATION 3 | |
871 | #define FILE_BASIC_INFORMATION 4 | |
872 | #define FILE_STANDARD_INFORMATION 5 | |
873 | #define FILE_INTERNAL_INFORMATION 6 | |
874 | #define FILE_EA_INFORMATION 7 | |
875 | #define FILE_ACCESS_INFORMATION 8 | |
876 | #define FILE_NAME_INFORMATION 9 | |
877 | #define FILE_RENAME_INFORMATION 10 | |
878 | #define FILE_LINK_INFORMATION 11 | |
879 | #define FILE_NAMES_INFORMATION 12 | |
880 | #define FILE_DISPOSITION_INFORMATION 13 | |
881 | #define FILE_POSITION_INFORMATION 14 | |
882 | #define FILE_FULL_EA_INFORMATION 15 | |
883 | #define FILE_MODE_INFORMATION 16 | |
884 | #define FILE_ALIGNMENT_INFORMATION 17 | |
885 | #define FILE_ALL_INFORMATION 18 | |
886 | #define FILE_ALLOCATION_INFORMATION 19 | |
887 | #define FILE_END_OF_FILE_INFORMATION 20 | |
888 | #define FILE_ALTERNATE_NAME_INFORMATION 21 | |
889 | #define FILE_STREAM_INFORMATION 22 | |
890 | #define FILE_PIPE_INFORMATION 23 | |
891 | #define FILE_PIPE_LOCAL_INFORMATION 24 | |
892 | #define FILE_PIPE_REMOTE_INFORMATION 25 | |
893 | #define FILE_MAILSLOT_QUERY_INFORMATION 26 | |
894 | #define FILE_MAILSLOT_SET_INFORMATION 27 | |
895 | #define FILE_COMPRESSION_INFORMATION 28 | |
896 | #define FILE_OBJECT_ID_INFORMATION 29 | |
897 | /* Number 30 not defined in documents */ | |
898 | #define FILE_MOVE_CLUSTER_INFORMATION 31 | |
899 | #define FILE_QUOTA_INFORMATION 32 | |
900 | #define FILE_REPARSE_POINT_INFORMATION 33 | |
901 | #define FILE_NETWORK_OPEN_INFORMATION 34 | |
902 | #define FILE_ATTRIBUTE_TAG_INFORMATION 35 | |
903 | #define FILE_TRACKING_INFORMATION 36 | |
904 | #define FILEID_BOTH_DIRECTORY_INFORMATION 37 | |
905 | #define FILEID_FULL_DIRECTORY_INFORMATION 38 | |
906 | #define FILE_VALID_DATA_LENGTH_INFORMATION 39 | |
907 | #define FILE_SHORT_NAME_INFORMATION 40 | |
908 | #define FILE_SFIO_RESERVE_INFORMATION 44 | |
909 | #define FILE_SFIO_VOLUME_INFORMATION 45 | |
910 | #define FILE_HARD_LINK_INFORMATION 46 | |
911 | #define FILE_NORMALIZED_NAME_INFORMATION 48 | |
912 | #define FILEID_GLOBAL_TX_DIRECTORY_INFORMATION 50 | |
913 | #define FILE_STANDARD_LINK_INFORMATION 54 | |
914 | ||
f0df737e PS |
915 | struct smb2_file_internal_info { |
916 | __le64 IndexNumber; | |
917 | } __packed; /* level 6 Query */ | |
918 | ||
35143eb5 PS |
919 | struct smb2_file_rename_info { /* encoding of request for level 10 */ |
920 | __u8 ReplaceIfExists; /* 1 = replace existing target with new */ | |
921 | /* 0 = fail if target already exists */ | |
922 | __u8 Reserved[7]; | |
923 | __u64 RootDirectory; /* MBZ for network operations (why says spec?) */ | |
924 | __le32 FileNameLength; | |
925 | char FileName[0]; /* New name to be assigned */ | |
926 | } __packed; /* level 10 Set */ | |
927 | ||
568798cc PS |
928 | struct smb2_file_link_info { /* encoding of request for level 11 */ |
929 | __u8 ReplaceIfExists; /* 1 = replace existing link with new */ | |
930 | /* 0 = fail if link already exists */ | |
931 | __u8 Reserved[7]; | |
932 | __u64 RootDirectory; /* MBZ for network operations (why says spec?) */ | |
933 | __le32 FileNameLength; | |
934 | char FileName[0]; /* Name to be assigned to new link */ | |
935 | } __packed; /* level 11 Set */ | |
936 | ||
be4cb9e3 PS |
937 | /* |
938 | * This level 18, although with struct with same name is different from cifs | |
939 | * level 0x107. Level 0x107 has an extra u64 between AccessFlags and | |
940 | * CurrentByteOffset. | |
941 | */ | |
942 | struct smb2_file_all_info { /* data block encoding of response to level 18 */ | |
943 | __le64 CreationTime; /* Beginning of FILE_BASIC_INFO equivalent */ | |
944 | __le64 LastAccessTime; | |
945 | __le64 LastWriteTime; | |
946 | __le64 ChangeTime; | |
947 | __le32 Attributes; | |
948 | __u32 Pad1; /* End of FILE_BASIC_INFO_INFO equivalent */ | |
949 | __le64 AllocationSize; /* Beginning of FILE_STANDARD_INFO equivalent */ | |
950 | __le64 EndOfFile; /* size ie offset to first free byte in file */ | |
951 | __le32 NumberOfLinks; /* hard links */ | |
952 | __u8 DeletePending; | |
953 | __u8 Directory; | |
954 | __u16 Pad2; /* End of FILE_STANDARD_INFO equivalent */ | |
955 | __le64 IndexNumber; | |
956 | __le32 EASize; | |
957 | __le32 AccessFlags; | |
958 | __le64 CurrentByteOffset; | |
959 | __le32 Mode; | |
960 | __le32 AlignmentRequirement; | |
961 | __le32 FileNameLength; | |
962 | char FileName[1]; | |
963 | } __packed; /* level 18 Query */ | |
964 | ||
c839ff24 PS |
965 | struct smb2_file_eof_info { /* encoding of request for level 10 */ |
966 | __le64 EndOfFile; /* new end of file value */ | |
967 | } __packed; /* level 20 Set */ | |
968 | ||
ddfbefbd | 969 | #endif /* _SMB2PDU_H */ |