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 | ||
b8c32dbb PS |
153 | #define SMB2_CLIENT_GUID_SIZE 16 |
154 | ||
155 | extern __u8 cifs_client_guid[SMB2_CLIENT_GUID_SIZE]; | |
156 | ||
ec2e4523 PS |
157 | struct smb2_negotiate_req { |
158 | struct smb2_hdr hdr; | |
159 | __le16 StructureSize; /* Must be 36 */ | |
160 | __le16 DialectCount; | |
161 | __le16 SecurityMode; | |
162 | __le16 Reserved; /* MBZ */ | |
163 | __le32 Capabilities; | |
b8c32dbb | 164 | __u8 ClientGUID[SMB2_CLIENT_GUID_SIZE]; |
ec2e4523 | 165 | __le64 ClientStartTime; /* MBZ */ |
e4aa25e7 | 166 | __le16 Dialects[1]; /* One dialect (vers=) at a time for now */ |
ec2e4523 PS |
167 | } __packed; |
168 | ||
e4aa25e7 SF |
169 | /* Dialects */ |
170 | #define SMB20_PROT_ID 0x0202 | |
171 | #define SMB21_PROT_ID 0x0210 | |
172 | #define SMB30_PROT_ID 0x0300 | |
20b6d8b4 | 173 | #define SMB302_PROT_ID 0x0302 |
e4aa25e7 SF |
174 | #define BAD_PROT_ID 0xFFFF |
175 | ||
ec2e4523 PS |
176 | /* SecurityMode flags */ |
177 | #define SMB2_NEGOTIATE_SIGNING_ENABLED 0x0001 | |
178 | #define SMB2_NEGOTIATE_SIGNING_REQUIRED 0x0002 | |
179 | /* Capabilities flags */ | |
180 | #define SMB2_GLOBAL_CAP_DFS 0x00000001 | |
181 | #define SMB2_GLOBAL_CAP_LEASING 0x00000002 /* Resp only New to SMB2.1 */ | |
182 | #define SMB2_GLOBAL_CAP_LARGE_MTU 0X00000004 /* Resp only New to SMB2.1 */ | |
e4aa25e7 SF |
183 | #define SMB2_GLOBAL_CAP_MULTI_CHANNEL 0x00000008 /* New to SMB3 */ |
184 | #define SMB2_GLOBAL_CAP_PERSISTENT_HANDLES 0x00000010 /* New to SMB3 */ | |
185 | #define SMB2_GLOBAL_CAP_DIRECTORY_LEASING 0x00000020 /* New to SMB3 */ | |
186 | #define SMB2_GLOBAL_CAP_ENCRYPTION 0x00000040 /* New to SMB3 */ | |
29e20f9c PS |
187 | /* Internal types */ |
188 | #define SMB2_NT_FIND 0x00100000 | |
189 | #define SMB2_LARGE_FILES 0x00200000 | |
ec2e4523 PS |
190 | |
191 | struct smb2_negotiate_rsp { | |
192 | struct smb2_hdr hdr; | |
193 | __le16 StructureSize; /* Must be 65 */ | |
194 | __le16 SecurityMode; | |
195 | __le16 DialectRevision; | |
196 | __le16 Reserved; /* MBZ */ | |
197 | __u8 ServerGUID[16]; | |
198 | __le32 Capabilities; | |
199 | __le32 MaxTransactSize; | |
200 | __le32 MaxReadSize; | |
201 | __le32 MaxWriteSize; | |
202 | __le64 SystemTime; /* MBZ */ | |
203 | __le64 ServerStartTime; | |
204 | __le16 SecurityBufferOffset; | |
205 | __le16 SecurityBufferLength; | |
206 | __le32 Reserved2; /* may be any value, ignore */ | |
207 | __u8 Buffer[1]; /* variable length GSS security buffer */ | |
208 | } __packed; | |
209 | ||
5478f9ba PS |
210 | struct smb2_sess_setup_req { |
211 | struct smb2_hdr hdr; | |
212 | __le16 StructureSize; /* Must be 25 */ | |
213 | __u8 VcNumber; | |
214 | __u8 SecurityMode; | |
215 | __le32 Capabilities; | |
216 | __le32 Channel; | |
217 | __le16 SecurityBufferOffset; | |
218 | __le16 SecurityBufferLength; | |
219 | __le64 PreviousSessionId; | |
220 | __u8 Buffer[1]; /* variable length GSS security buffer */ | |
221 | } __packed; | |
222 | ||
223 | /* Currently defined SessionFlags */ | |
224 | #define SMB2_SESSION_FLAG_IS_GUEST 0x0001 | |
225 | #define SMB2_SESSION_FLAG_IS_NULL 0x0002 | |
226 | struct smb2_sess_setup_rsp { | |
227 | struct smb2_hdr hdr; | |
228 | __le16 StructureSize; /* Must be 9 */ | |
229 | __le16 SessionFlags; | |
230 | __le16 SecurityBufferOffset; | |
231 | __le16 SecurityBufferLength; | |
232 | __u8 Buffer[1]; /* variable length GSS security buffer */ | |
233 | } __packed; | |
234 | ||
235 | struct smb2_logoff_req { | |
236 | struct smb2_hdr hdr; | |
237 | __le16 StructureSize; /* Must be 4 */ | |
238 | __le16 Reserved; | |
239 | } __packed; | |
240 | ||
241 | struct smb2_logoff_rsp { | |
242 | struct smb2_hdr hdr; | |
243 | __le16 StructureSize; /* Must be 4 */ | |
244 | __le16 Reserved; | |
245 | } __packed; | |
246 | ||
faaf946a PS |
247 | struct smb2_tree_connect_req { |
248 | struct smb2_hdr hdr; | |
249 | __le16 StructureSize; /* Must be 9 */ | |
250 | __le16 Reserved; | |
251 | __le16 PathOffset; | |
252 | __le16 PathLength; | |
253 | __u8 Buffer[1]; /* variable length */ | |
254 | } __packed; | |
255 | ||
256 | struct smb2_tree_connect_rsp { | |
257 | struct smb2_hdr hdr; | |
258 | __le16 StructureSize; /* Must be 16 */ | |
259 | __u8 ShareType; /* see below */ | |
260 | __u8 Reserved; | |
261 | __le32 ShareFlags; /* see below */ | |
262 | __le32 Capabilities; /* see below */ | |
263 | __le32 MaximalAccess; | |
264 | } __packed; | |
265 | ||
266 | /* Possible ShareType values */ | |
267 | #define SMB2_SHARE_TYPE_DISK 0x01 | |
268 | #define SMB2_SHARE_TYPE_PIPE 0x02 | |
269 | #define SMB2_SHARE_TYPE_PRINT 0x03 | |
270 | ||
271 | /* | |
272 | * Possible ShareFlags - exactly one and only one of the first 4 caching flags | |
273 | * must be set (any of the remaining, SHI1005, flags may be set individually | |
274 | * or in combination. | |
275 | */ | |
276 | #define SMB2_SHAREFLAG_MANUAL_CACHING 0x00000000 | |
277 | #define SMB2_SHAREFLAG_AUTO_CACHING 0x00000010 | |
278 | #define SMB2_SHAREFLAG_VDO_CACHING 0x00000020 | |
279 | #define SMB2_SHAREFLAG_NO_CACHING 0x00000030 | |
280 | #define SHI1005_FLAGS_DFS 0x00000001 | |
281 | #define SHI1005_FLAGS_DFS_ROOT 0x00000002 | |
282 | #define SHI1005_FLAGS_RESTRICT_EXCLUSIVE_OPENS 0x00000100 | |
283 | #define SHI1005_FLAGS_FORCE_SHARED_DELETE 0x00000200 | |
284 | #define SHI1005_FLAGS_ALLOW_NAMESPACE_CACHING 0x00000400 | |
285 | #define SHI1005_FLAGS_ACCESS_BASED_DIRECTORY_ENUM 0x00000800 | |
286 | #define SHI1005_FLAGS_FORCE_LEVELII_OPLOCK 0x00001000 | |
c8664730 SF |
287 | #define SHI1005_FLAGS_ENABLE_HASH_V1 0x00002000 |
288 | #define SHI1005_FLAGS_ENABLE_HASH_V2 0x00004000 | |
289 | #define SHI1005_FLAGS_ENCRYPT_DATA 0x00008000 | |
290 | #define SHI1005_FLAGS_ALL 0x0000FF33 | |
faaf946a PS |
291 | |
292 | /* Possible share capabilities */ | |
2b5dc286 SF |
293 | #define SMB2_SHARE_CAP_DFS cpu_to_le32(0x00000008) /* all dialects */ |
294 | #define SMB2_SHARE_CAP_CONTINUOUS_AVAILABILITY cpu_to_le32(0x00000010) /* 3.0 */ | |
295 | #define SMB2_SHARE_CAP_SCALEOUT cpu_to_le32(0x00000020) /* 3.0 */ | |
296 | #define SMB2_SHARE_CAP_CLUSTER cpu_to_le32(0x00000040) /* 3.0 */ | |
297 | #define SMB2_SHARE_CAP_ASYMMETRIC cpu_to_le32(0x00000080) /* 3.02 */ | |
faaf946a PS |
298 | |
299 | struct smb2_tree_disconnect_req { | |
300 | struct smb2_hdr hdr; | |
301 | __le16 StructureSize; /* Must be 4 */ | |
302 | __le16 Reserved; | |
303 | } __packed; | |
304 | ||
305 | struct smb2_tree_disconnect_rsp { | |
306 | struct smb2_hdr hdr; | |
307 | __le16 StructureSize; /* Must be 4 */ | |
308 | __le16 Reserved; | |
309 | } __packed; | |
310 | ||
2503a0db PS |
311 | /* File Attrubutes */ |
312 | #define FILE_ATTRIBUTE_READONLY 0x00000001 | |
313 | #define FILE_ATTRIBUTE_HIDDEN 0x00000002 | |
314 | #define FILE_ATTRIBUTE_SYSTEM 0x00000004 | |
315 | #define FILE_ATTRIBUTE_DIRECTORY 0x00000010 | |
316 | #define FILE_ATTRIBUTE_ARCHIVE 0x00000020 | |
317 | #define FILE_ATTRIBUTE_NORMAL 0x00000080 | |
318 | #define FILE_ATTRIBUTE_TEMPORARY 0x00000100 | |
319 | #define FILE_ATTRIBUTE_SPARSE_FILE 0x00000200 | |
320 | #define FILE_ATTRIBUTE_REPARSE_POINT 0x00000400 | |
321 | #define FILE_ATTRIBUTE_COMPRESSED 0x00000800 | |
322 | #define FILE_ATTRIBUTE_OFFLINE 0x00001000 | |
323 | #define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000 | |
324 | #define FILE_ATTRIBUTE_ENCRYPTED 0x00004000 | |
325 | ||
326 | /* Oplock levels */ | |
327 | #define SMB2_OPLOCK_LEVEL_NONE 0x00 | |
328 | #define SMB2_OPLOCK_LEVEL_II 0x01 | |
329 | #define SMB2_OPLOCK_LEVEL_EXCLUSIVE 0x08 | |
330 | #define SMB2_OPLOCK_LEVEL_BATCH 0x09 | |
331 | #define SMB2_OPLOCK_LEVEL_LEASE 0xFF | |
b8c32dbb PS |
332 | /* Non-spec internal type */ |
333 | #define SMB2_OPLOCK_LEVEL_NOCHANGE 0x99 | |
2503a0db PS |
334 | |
335 | /* Desired Access Flags */ | |
336 | #define FILE_READ_DATA_LE cpu_to_le32(0x00000001) | |
337 | #define FILE_WRITE_DATA_LE cpu_to_le32(0x00000002) | |
338 | #define FILE_APPEND_DATA_LE cpu_to_le32(0x00000004) | |
339 | #define FILE_READ_EA_LE cpu_to_le32(0x00000008) | |
340 | #define FILE_WRITE_EA_LE cpu_to_le32(0x00000010) | |
341 | #define FILE_EXECUTE_LE cpu_to_le32(0x00000020) | |
342 | #define FILE_READ_ATTRIBUTES_LE cpu_to_le32(0x00000080) | |
343 | #define FILE_WRITE_ATTRIBUTES_LE cpu_to_le32(0x00000100) | |
344 | #define FILE_DELETE_LE cpu_to_le32(0x00010000) | |
345 | #define FILE_READ_CONTROL_LE cpu_to_le32(0x00020000) | |
346 | #define FILE_WRITE_DAC_LE cpu_to_le32(0x00040000) | |
347 | #define FILE_WRITE_OWNER_LE cpu_to_le32(0x00080000) | |
348 | #define FILE_SYNCHRONIZE_LE cpu_to_le32(0x00100000) | |
349 | #define FILE_ACCESS_SYSTEM_SECURITY_LE cpu_to_le32(0x01000000) | |
350 | #define FILE_MAXIMAL_ACCESS_LE cpu_to_le32(0x02000000) | |
351 | #define FILE_GENERIC_ALL_LE cpu_to_le32(0x10000000) | |
352 | #define FILE_GENERIC_EXECUTE_LE cpu_to_le32(0x20000000) | |
353 | #define FILE_GENERIC_WRITE_LE cpu_to_le32(0x40000000) | |
354 | #define FILE_GENERIC_READ_LE cpu_to_le32(0x80000000) | |
355 | ||
356 | /* ShareAccess Flags */ | |
357 | #define FILE_SHARE_READ_LE cpu_to_le32(0x00000001) | |
358 | #define FILE_SHARE_WRITE_LE cpu_to_le32(0x00000002) | |
359 | #define FILE_SHARE_DELETE_LE cpu_to_le32(0x00000004) | |
360 | #define FILE_SHARE_ALL_LE cpu_to_le32(0x00000007) | |
361 | ||
362 | /* CreateDisposition Flags */ | |
363 | #define FILE_SUPERSEDE_LE cpu_to_le32(0x00000000) | |
364 | #define FILE_OPEN_LE cpu_to_le32(0x00000001) | |
365 | #define FILE_CREATE_LE cpu_to_le32(0x00000002) | |
366 | #define FILE_OPEN_IF_LE cpu_to_le32(0x00000003) | |
367 | #define FILE_OVERWRITE_LE cpu_to_le32(0x00000004) | |
368 | #define FILE_OVERWRITE_IF_LE cpu_to_le32(0x00000005) | |
369 | ||
370 | /* CreateOptions Flags */ | |
371 | #define FILE_DIRECTORY_FILE_LE cpu_to_le32(0x00000001) | |
372 | /* same as #define CREATE_NOT_FILE_LE cpu_to_le32(0x00000001) */ | |
373 | #define FILE_WRITE_THROUGH_LE cpu_to_le32(0x00000002) | |
374 | #define FILE_SEQUENTIAL_ONLY_LE cpu_to_le32(0x00000004) | |
375 | #define FILE_NO_INTERMEDIATE_BUFFERRING_LE cpu_to_le32(0x00000008) | |
376 | #define FILE_SYNCHRONOUS_IO_ALERT_LE cpu_to_le32(0x00000010) | |
377 | #define FILE_SYNCHRONOUS_IO_NON_ALERT_LE cpu_to_le32(0x00000020) | |
378 | #define FILE_NON_DIRECTORY_FILE_LE cpu_to_le32(0x00000040) | |
379 | #define FILE_COMPLETE_IF_OPLOCKED_LE cpu_to_le32(0x00000100) | |
380 | #define FILE_NO_EA_KNOWLEDGE_LE cpu_to_le32(0x00000200) | |
381 | #define FILE_RANDOM_ACCESS_LE cpu_to_le32(0x00000800) | |
382 | #define FILE_DELETE_ON_CLOSE_LE cpu_to_le32(0x00001000) | |
383 | #define FILE_OPEN_BY_FILE_ID_LE cpu_to_le32(0x00002000) | |
384 | #define FILE_OPEN_FOR_BACKUP_INTENT_LE cpu_to_le32(0x00004000) | |
385 | #define FILE_NO_COMPRESSION_LE cpu_to_le32(0x00008000) | |
386 | #define FILE_RESERVE_OPFILTER_LE cpu_to_le32(0x00100000) | |
387 | #define FILE_OPEN_REPARSE_POINT_LE cpu_to_le32(0x00200000) | |
388 | #define FILE_OPEN_NO_RECALL_LE cpu_to_le32(0x00400000) | |
389 | #define FILE_OPEN_FOR_FREE_SPACE_QUERY_LE cpu_to_le32(0x00800000) | |
390 | ||
391 | #define FILE_READ_RIGHTS_LE (FILE_READ_DATA_LE | FILE_READ_EA_LE \ | |
392 | | FILE_READ_ATTRIBUTES_LE) | |
393 | #define FILE_WRITE_RIGHTS_LE (FILE_WRITE_DATA_LE | FILE_APPEND_DATA_LE \ | |
394 | | FILE_WRITE_EA_LE | FILE_WRITE_ATTRIBUTES_LE) | |
395 | #define FILE_EXEC_RIGHTS_LE (FILE_EXECUTE_LE) | |
396 | ||
397 | /* Impersonation Levels */ | |
398 | #define IL_ANONYMOUS cpu_to_le32(0x00000000) | |
399 | #define IL_IDENTIFICATION cpu_to_le32(0x00000001) | |
400 | #define IL_IMPERSONATION cpu_to_le32(0x00000002) | |
401 | #define IL_DELEGATE cpu_to_le32(0x00000003) | |
402 | ||
403 | /* Create Context Values */ | |
404 | #define SMB2_CREATE_EA_BUFFER "ExtA" /* extended attributes */ | |
405 | #define SMB2_CREATE_SD_BUFFER "SecD" /* security descriptor */ | |
406 | #define SMB2_CREATE_DURABLE_HANDLE_REQUEST "DHnQ" | |
407 | #define SMB2_CREATE_DURABLE_HANDLE_RECONNECT "DHnC" | |
408 | #define SMB2_CREATE_ALLOCATION_SIZE "AlSi" | |
409 | #define SMB2_CREATE_QUERY_MAXIMAL_ACCESS_REQUEST "MxAc" | |
410 | #define SMB2_CREATE_TIMEWARP_REQUEST "TWrp" | |
411 | #define SMB2_CREATE_QUERY_ON_DISK_ID "QFid" | |
412 | #define SMB2_CREATE_REQUEST_LEASE "RqLs" | |
413 | ||
414 | struct smb2_create_req { | |
415 | struct smb2_hdr hdr; | |
416 | __le16 StructureSize; /* Must be 57 */ | |
417 | __u8 SecurityFlags; | |
418 | __u8 RequestedOplockLevel; | |
419 | __le32 ImpersonationLevel; | |
420 | __le64 SmbCreateFlags; | |
421 | __le64 Reserved; | |
422 | __le32 DesiredAccess; | |
423 | __le32 FileAttributes; | |
424 | __le32 ShareAccess; | |
425 | __le32 CreateDisposition; | |
426 | __le32 CreateOptions; | |
427 | __le16 NameOffset; | |
428 | __le16 NameLength; | |
429 | __le32 CreateContextsOffset; | |
430 | __le32 CreateContextsLength; | |
b8c32dbb | 431 | __u8 Buffer[8]; |
2503a0db PS |
432 | } __packed; |
433 | ||
434 | struct smb2_create_rsp { | |
435 | struct smb2_hdr hdr; | |
436 | __le16 StructureSize; /* Must be 89 */ | |
437 | __u8 OplockLevel; | |
438 | __u8 Reserved; | |
439 | __le32 CreateAction; | |
440 | __le64 CreationTime; | |
441 | __le64 LastAccessTime; | |
442 | __le64 LastWriteTime; | |
443 | __le64 ChangeTime; | |
444 | __le64 AllocationSize; | |
445 | __le64 EndofFile; | |
446 | __le32 FileAttributes; | |
447 | __le32 Reserved2; | |
448 | __u64 PersistentFileId; /* opaque endianness */ | |
449 | __u64 VolatileFileId; /* opaque endianness */ | |
450 | __le32 CreateContextsOffset; | |
451 | __le32 CreateContextsLength; | |
452 | __u8 Buffer[1]; | |
453 | } __packed; | |
454 | ||
b8c32dbb PS |
455 | struct create_context { |
456 | __le32 Next; | |
457 | __le16 NameOffset; | |
458 | __le16 NameLength; | |
459 | __le16 Reserved; | |
460 | __le16 DataOffset; | |
461 | __le32 DataLength; | |
462 | __u8 Buffer[0]; | |
463 | } __packed; | |
464 | ||
465 | #define SMB2_LEASE_NONE __constant_cpu_to_le32(0x00) | |
466 | #define SMB2_LEASE_READ_CACHING __constant_cpu_to_le32(0x01) | |
467 | #define SMB2_LEASE_HANDLE_CACHING __constant_cpu_to_le32(0x02) | |
468 | #define SMB2_LEASE_WRITE_CACHING __constant_cpu_to_le32(0x04) | |
469 | ||
470 | #define SMB2_LEASE_FLAG_BREAK_IN_PROGRESS __constant_cpu_to_le32(0x02) | |
471 | ||
472 | #define SMB2_LEASE_KEY_SIZE 16 | |
473 | ||
474 | struct lease_context { | |
475 | __le64 LeaseKeyLow; | |
476 | __le64 LeaseKeyHigh; | |
477 | __le32 LeaseState; | |
478 | __le32 LeaseFlags; | |
479 | __le64 LeaseDuration; | |
480 | } __packed; | |
481 | ||
482 | struct create_lease { | |
483 | struct create_context ccontext; | |
484 | __u8 Name[8]; | |
485 | struct lease_context lcontext; | |
486 | } __packed; | |
487 | ||
be7457d3 SF |
488 | /* this goes in the ioctl buffer when doing a copychunk request */ |
489 | struct copychunk_ioctl { | |
490 | char SourceKey[24]; | |
491 | __le32 ChunkCount; /* we are only sending 1 */ | |
492 | __le32 Reserved; | |
493 | /* array will only be one chunk long for us */ | |
494 | __le64 SourceOffset; | |
495 | __le64 TargetOffset; | |
c8664730 | 496 | __le32 Length; /* how many bytes to copy */ |
be7457d3 SF |
497 | __u32 Reserved2; |
498 | } __packed; | |
499 | ||
500 | struct smb2_ioctl_req { | |
501 | struct smb2_hdr hdr; | |
502 | __le16 StructureSize; /* Must be 57 */ | |
503 | __u16 Reserved; | |
504 | __le32 CtlCode; | |
505 | __u64 PersistentFileId; /* opaque endianness */ | |
506 | __u64 VolatileFileId; /* opaque endianness */ | |
507 | __le32 InputOffset; | |
508 | __le32 InputCount; | |
509 | __le32 MaxInputResponse; | |
510 | __le32 OutputOffset; | |
511 | __le32 OutputCount; | |
512 | __le32 MaxOutputResponse; | |
513 | __le32 Flags; | |
514 | __u32 Reserved2; | |
515 | char Buffer[0]; | |
516 | } __packed; | |
517 | ||
518 | struct smb2_ioctl_rsp { | |
519 | struct smb2_hdr hdr; | |
520 | __le16 StructureSize; /* Must be 57 */ | |
521 | __u16 Reserved; | |
522 | __le32 CtlCode; | |
523 | __u64 PersistentFileId; /* opaque endianness */ | |
524 | __u64 VolatileFileId; /* opaque endianness */ | |
525 | __le32 InputOffset; | |
526 | __le32 InputCount; | |
527 | __le32 OutputOffset; | |
528 | __le32 OutputCount; | |
529 | __le32 Flags; | |
530 | __u32 Reserved2; | |
531 | /* char * buffer[] */ | |
532 | } __packed; | |
533 | ||
2503a0db PS |
534 | /* Currently defined values for close flags */ |
535 | #define SMB2_CLOSE_FLAG_POSTQUERY_ATTRIB cpu_to_le16(0x0001) | |
536 | struct smb2_close_req { | |
537 | struct smb2_hdr hdr; | |
538 | __le16 StructureSize; /* Must be 24 */ | |
539 | __le16 Flags; | |
540 | __le32 Reserved; | |
541 | __u64 PersistentFileId; /* opaque endianness */ | |
542 | __u64 VolatileFileId; /* opaque endianness */ | |
543 | } __packed; | |
544 | ||
545 | struct smb2_close_rsp { | |
546 | struct smb2_hdr hdr; | |
547 | __le16 StructureSize; /* 60 */ | |
548 | __le16 Flags; | |
549 | __le32 Reserved; | |
550 | __le64 CreationTime; | |
551 | __le64 LastAccessTime; | |
552 | __le64 LastWriteTime; | |
553 | __le64 ChangeTime; | |
554 | __le64 AllocationSize; /* Beginning of FILE_STANDARD_INFO equivalent */ | |
555 | __le64 EndOfFile; | |
556 | __le32 Attributes; | |
557 | } __packed; | |
558 | ||
7a5cfb19 PS |
559 | struct smb2_flush_req { |
560 | struct smb2_hdr hdr; | |
561 | __le16 StructureSize; /* Must be 24 */ | |
562 | __le16 Reserved1; | |
563 | __le32 Reserved2; | |
564 | __u64 PersistentFileId; /* opaque endianness */ | |
565 | __u64 VolatileFileId; /* opaque endianness */ | |
566 | } __packed; | |
567 | ||
568 | struct smb2_flush_rsp { | |
569 | struct smb2_hdr hdr; | |
570 | __le16 StructureSize; | |
571 | __le16 Reserved; | |
572 | } __packed; | |
573 | ||
2b5dc286 SF |
574 | /* For read request Flags field below, following flag is defined for SMB3.02 */ |
575 | #define SMB2_READFLAG_READ_UNBUFFERED 0x01 | |
576 | ||
577 | /* Channel field for read and write: exactly one of following flags can be set*/ | |
578 | #define SMB2_CHANNEL_NONE 0x00000000 | |
579 | #define SMB2_CHANNEL_RDMA_V1 0x00000001 /* SMB3 or later */ | |
580 | #define SMB2_CHANNEL_RDMA_V1_INVALIDATE 0x00000001 /* SMB3.02 or later */ | |
581 | ||
09a4707e PS |
582 | struct smb2_read_req { |
583 | struct smb2_hdr hdr; | |
584 | __le16 StructureSize; /* Must be 49 */ | |
585 | __u8 Padding; /* offset from start of SMB2 header to place read */ | |
2b5dc286 | 586 | __u8 Flags; /* MBZ unless SMB3.02 or later */ |
09a4707e PS |
587 | __le32 Length; |
588 | __le64 Offset; | |
589 | __u64 PersistentFileId; /* opaque endianness */ | |
590 | __u64 VolatileFileId; /* opaque endianness */ | |
591 | __le32 MinimumCount; | |
2b5dc286 | 592 | __le32 Channel; /* MBZ except for SMB3 or later */ |
09a4707e PS |
593 | __le32 RemainingBytes; |
594 | __le16 ReadChannelInfoOffset; /* Reserved MBZ */ | |
595 | __le16 ReadChannelInfoLength; /* Reserved MBZ */ | |
596 | __u8 Buffer[1]; | |
597 | } __packed; | |
598 | ||
599 | struct smb2_read_rsp { | |
600 | struct smb2_hdr hdr; | |
601 | __le16 StructureSize; /* Must be 17 */ | |
602 | __u8 DataOffset; | |
33319141 PS |
603 | __u8 Reserved; |
604 | __le32 DataLength; | |
605 | __le32 DataRemaining; | |
606 | __u32 Reserved2; | |
607 | __u8 Buffer[1]; | |
608 | } __packed; | |
609 | ||
2b5dc286 SF |
610 | /* For write request Flags field below the following flags are defined: */ |
611 | #define SMB2_WRITEFLAG_WRITE_THROUGH 0x00000001 /* SMB2.1 or later */ | |
612 | #define SMB2_WRITEFLAG_WRITE_UNBUFFERED 0x00000002 /* SMB3.02 or later */ | |
33319141 PS |
613 | |
614 | struct smb2_write_req { | |
615 | struct smb2_hdr hdr; | |
616 | __le16 StructureSize; /* Must be 49 */ | |
617 | __le16 DataOffset; /* offset from start of SMB2 header to write data */ | |
618 | __le32 Length; | |
619 | __le64 Offset; | |
620 | __u64 PersistentFileId; /* opaque endianness */ | |
621 | __u64 VolatileFileId; /* opaque endianness */ | |
622 | __le32 Channel; /* Reserved MBZ */ | |
623 | __le32 RemainingBytes; | |
624 | __le16 WriteChannelInfoOffset; /* Reserved MBZ */ | |
625 | __le16 WriteChannelInfoLength; /* Reserved MBZ */ | |
626 | __le32 Flags; | |
627 | __u8 Buffer[1]; | |
628 | } __packed; | |
629 | ||
630 | struct smb2_write_rsp { | |
631 | struct smb2_hdr hdr; | |
632 | __le16 StructureSize; /* Must be 17 */ | |
633 | __u8 DataOffset; | |
09a4707e PS |
634 | __u8 Reserved; |
635 | __le32 DataLength; | |
636 | __le32 DataRemaining; | |
637 | __u32 Reserved2; | |
638 | __u8 Buffer[1]; | |
639 | } __packed; | |
640 | ||
027e8eec PS |
641 | #define SMB2_LOCKFLAG_SHARED_LOCK 0x0001 |
642 | #define SMB2_LOCKFLAG_EXCLUSIVE_LOCK 0x0002 | |
643 | #define SMB2_LOCKFLAG_UNLOCK 0x0004 | |
644 | #define SMB2_LOCKFLAG_FAIL_IMMEDIATELY 0x0010 | |
645 | ||
f7ba7fe6 PS |
646 | struct smb2_lock_element { |
647 | __le64 Offset; | |
648 | __le64 Length; | |
649 | __le32 Flags; | |
650 | __le32 Reserved; | |
651 | } __packed; | |
652 | ||
653 | struct smb2_lock_req { | |
654 | struct smb2_hdr hdr; | |
655 | __le16 StructureSize; /* Must be 48 */ | |
656 | __le16 LockCount; | |
657 | __le32 Reserved; | |
658 | __u64 PersistentFileId; /* opaque endianness */ | |
659 | __u64 VolatileFileId; /* opaque endianness */ | |
660 | /* Followed by at least one */ | |
661 | struct smb2_lock_element locks[1]; | |
662 | } __packed; | |
663 | ||
664 | struct smb2_lock_rsp { | |
665 | struct smb2_hdr hdr; | |
666 | __le16 StructureSize; /* Must be 4 */ | |
667 | __le16 Reserved; | |
668 | } __packed; | |
669 | ||
9094fad1 PS |
670 | struct smb2_echo_req { |
671 | struct smb2_hdr hdr; | |
672 | __le16 StructureSize; /* Must be 4 */ | |
673 | __u16 Reserved; | |
674 | } __packed; | |
675 | ||
676 | struct smb2_echo_rsp { | |
677 | struct smb2_hdr hdr; | |
678 | __le16 StructureSize; /* Must be 4 */ | |
679 | __u16 Reserved; | |
680 | } __packed; | |
681 | ||
d324f08d PS |
682 | /* search (query_directory) Flags field */ |
683 | #define SMB2_RESTART_SCANS 0x01 | |
684 | #define SMB2_RETURN_SINGLE_ENTRY 0x02 | |
685 | #define SMB2_INDEX_SPECIFIED 0x04 | |
686 | #define SMB2_REOPEN 0x10 | |
687 | ||
688 | struct smb2_query_directory_req { | |
689 | struct smb2_hdr hdr; | |
690 | __le16 StructureSize; /* Must be 33 */ | |
691 | __u8 FileInformationClass; | |
692 | __u8 Flags; | |
693 | __le32 FileIndex; | |
694 | __u64 PersistentFileId; /* opaque endianness */ | |
695 | __u64 VolatileFileId; /* opaque endianness */ | |
696 | __le16 FileNameOffset; | |
697 | __le16 FileNameLength; | |
698 | __le32 OutputBufferLength; | |
699 | __u8 Buffer[1]; | |
700 | } __packed; | |
701 | ||
702 | struct smb2_query_directory_rsp { | |
703 | struct smb2_hdr hdr; | |
704 | __le16 StructureSize; /* Must be 9 */ | |
705 | __le16 OutputBufferOffset; | |
706 | __le32 OutputBufferLength; | |
707 | __u8 Buffer[1]; | |
708 | } __packed; | |
709 | ||
be4cb9e3 PS |
710 | /* Possible InfoType values */ |
711 | #define SMB2_O_INFO_FILE 0x01 | |
712 | #define SMB2_O_INFO_FILESYSTEM 0x02 | |
713 | #define SMB2_O_INFO_SECURITY 0x03 | |
714 | #define SMB2_O_INFO_QUOTA 0x04 | |
715 | ||
716 | struct smb2_query_info_req { | |
717 | struct smb2_hdr hdr; | |
718 | __le16 StructureSize; /* Must be 41 */ | |
719 | __u8 InfoType; | |
720 | __u8 FileInfoClass; | |
721 | __le32 OutputBufferLength; | |
722 | __le16 InputBufferOffset; | |
723 | __u16 Reserved; | |
724 | __le32 InputBufferLength; | |
725 | __le32 AdditionalInformation; | |
726 | __le32 Flags; | |
727 | __u64 PersistentFileId; /* opaque endianness */ | |
728 | __u64 VolatileFileId; /* opaque endianness */ | |
729 | __u8 Buffer[1]; | |
730 | } __packed; | |
731 | ||
732 | struct smb2_query_info_rsp { | |
733 | struct smb2_hdr hdr; | |
734 | __le16 StructureSize; /* Must be 9 */ | |
735 | __le16 OutputBufferOffset; | |
736 | __le32 OutputBufferLength; | |
737 | __u8 Buffer[1]; | |
738 | } __packed; | |
739 | ||
35143eb5 PS |
740 | struct smb2_set_info_req { |
741 | struct smb2_hdr hdr; | |
742 | __le16 StructureSize; /* Must be 33 */ | |
743 | __u8 InfoType; | |
744 | __u8 FileInfoClass; | |
745 | __le32 BufferLength; | |
746 | __le16 BufferOffset; | |
747 | __u16 Reserved; | |
748 | __le32 AdditionalInformation; | |
749 | __u64 PersistentFileId; /* opaque endianness */ | |
750 | __u64 VolatileFileId; /* opaque endianness */ | |
751 | __u8 Buffer[1]; | |
752 | } __packed; | |
753 | ||
754 | struct smb2_set_info_rsp { | |
755 | struct smb2_hdr hdr; | |
756 | __le16 StructureSize; /* Must be 2 */ | |
757 | } __packed; | |
758 | ||
983c88a4 PS |
759 | struct smb2_oplock_break { |
760 | struct smb2_hdr hdr; | |
761 | __le16 StructureSize; /* Must be 24 */ | |
762 | __u8 OplockLevel; | |
763 | __u8 Reserved; | |
764 | __le32 Reserved2; | |
765 | __u64 PersistentFid; | |
766 | __u64 VolatileFid; | |
767 | } __packed; | |
768 | ||
0822f514 PS |
769 | #define SMB2_NOTIFY_BREAK_LEASE_FLAG_ACK_REQUIRED cpu_to_le32(0x01) |
770 | ||
771 | struct smb2_lease_break { | |
772 | struct smb2_hdr hdr; | |
773 | __le16 StructureSize; /* Must be 44 */ | |
774 | __le16 Reserved; | |
775 | __le32 Flags; | |
776 | __u8 LeaseKey[16]; | |
777 | __le32 CurrentLeaseState; | |
778 | __le32 NewLeaseState; | |
779 | __le32 BreakReason; | |
780 | __le32 AccessMaskHint; | |
781 | __le32 ShareMaskHint; | |
782 | } __packed; | |
783 | ||
784 | struct smb2_lease_ack { | |
785 | struct smb2_hdr hdr; | |
786 | __le16 StructureSize; /* Must be 36 */ | |
787 | __le16 Reserved; | |
788 | __le32 Flags; | |
789 | __u8 LeaseKey[16]; | |
790 | __le32 LeaseState; | |
791 | __le64 LeaseDuration; | |
792 | } __packed; | |
793 | ||
be4cb9e3 PS |
794 | /* |
795 | * PDU infolevel structure definitions | |
796 | * BB consider moving to a different header | |
797 | */ | |
798 | ||
6fc05c25 PS |
799 | /* File System Information Classes */ |
800 | #define FS_VOLUME_INFORMATION 1 /* Query */ | |
801 | #define FS_LABEL_INFORMATION 2 /* Set */ | |
802 | #define FS_SIZE_INFORMATION 3 /* Query */ | |
803 | #define FS_DEVICE_INFORMATION 4 /* Query */ | |
804 | #define FS_ATTRIBUTE_INFORMATION 5 /* Query */ | |
805 | #define FS_CONTROL_INFORMATION 6 /* Query, Set */ | |
806 | #define FS_FULL_SIZE_INFORMATION 7 /* Query */ | |
807 | #define FS_OBJECT_ID_INFORMATION 8 /* Query, Set */ | |
808 | #define FS_DRIVER_PATH_INFORMATION 9 /* Query */ | |
809 | ||
810 | struct smb2_fs_full_size_info { | |
811 | __le64 TotalAllocationUnits; | |
812 | __le64 CallerAvailableAllocationUnits; | |
813 | __le64 ActualAvailableAllocationUnits; | |
814 | __le32 SectorsPerAllocationUnit; | |
815 | __le32 BytesPerSector; | |
816 | } __packed; | |
817 | ||
be4cb9e3 PS |
818 | /* partial list of QUERY INFO levels */ |
819 | #define FILE_DIRECTORY_INFORMATION 1 | |
820 | #define FILE_FULL_DIRECTORY_INFORMATION 2 | |
821 | #define FILE_BOTH_DIRECTORY_INFORMATION 3 | |
822 | #define FILE_BASIC_INFORMATION 4 | |
823 | #define FILE_STANDARD_INFORMATION 5 | |
824 | #define FILE_INTERNAL_INFORMATION 6 | |
825 | #define FILE_EA_INFORMATION 7 | |
826 | #define FILE_ACCESS_INFORMATION 8 | |
827 | #define FILE_NAME_INFORMATION 9 | |
828 | #define FILE_RENAME_INFORMATION 10 | |
829 | #define FILE_LINK_INFORMATION 11 | |
830 | #define FILE_NAMES_INFORMATION 12 | |
831 | #define FILE_DISPOSITION_INFORMATION 13 | |
832 | #define FILE_POSITION_INFORMATION 14 | |
833 | #define FILE_FULL_EA_INFORMATION 15 | |
834 | #define FILE_MODE_INFORMATION 16 | |
835 | #define FILE_ALIGNMENT_INFORMATION 17 | |
836 | #define FILE_ALL_INFORMATION 18 | |
837 | #define FILE_ALLOCATION_INFORMATION 19 | |
838 | #define FILE_END_OF_FILE_INFORMATION 20 | |
839 | #define FILE_ALTERNATE_NAME_INFORMATION 21 | |
840 | #define FILE_STREAM_INFORMATION 22 | |
841 | #define FILE_PIPE_INFORMATION 23 | |
842 | #define FILE_PIPE_LOCAL_INFORMATION 24 | |
843 | #define FILE_PIPE_REMOTE_INFORMATION 25 | |
844 | #define FILE_MAILSLOT_QUERY_INFORMATION 26 | |
845 | #define FILE_MAILSLOT_SET_INFORMATION 27 | |
846 | #define FILE_COMPRESSION_INFORMATION 28 | |
847 | #define FILE_OBJECT_ID_INFORMATION 29 | |
848 | /* Number 30 not defined in documents */ | |
849 | #define FILE_MOVE_CLUSTER_INFORMATION 31 | |
850 | #define FILE_QUOTA_INFORMATION 32 | |
851 | #define FILE_REPARSE_POINT_INFORMATION 33 | |
852 | #define FILE_NETWORK_OPEN_INFORMATION 34 | |
853 | #define FILE_ATTRIBUTE_TAG_INFORMATION 35 | |
854 | #define FILE_TRACKING_INFORMATION 36 | |
855 | #define FILEID_BOTH_DIRECTORY_INFORMATION 37 | |
856 | #define FILEID_FULL_DIRECTORY_INFORMATION 38 | |
857 | #define FILE_VALID_DATA_LENGTH_INFORMATION 39 | |
858 | #define FILE_SHORT_NAME_INFORMATION 40 | |
859 | #define FILE_SFIO_RESERVE_INFORMATION 44 | |
860 | #define FILE_SFIO_VOLUME_INFORMATION 45 | |
861 | #define FILE_HARD_LINK_INFORMATION 46 | |
862 | #define FILE_NORMALIZED_NAME_INFORMATION 48 | |
863 | #define FILEID_GLOBAL_TX_DIRECTORY_INFORMATION 50 | |
864 | #define FILE_STANDARD_LINK_INFORMATION 54 | |
865 | ||
f0df737e PS |
866 | struct smb2_file_internal_info { |
867 | __le64 IndexNumber; | |
868 | } __packed; /* level 6 Query */ | |
869 | ||
35143eb5 PS |
870 | struct smb2_file_rename_info { /* encoding of request for level 10 */ |
871 | __u8 ReplaceIfExists; /* 1 = replace existing target with new */ | |
872 | /* 0 = fail if target already exists */ | |
873 | __u8 Reserved[7]; | |
874 | __u64 RootDirectory; /* MBZ for network operations (why says spec?) */ | |
875 | __le32 FileNameLength; | |
876 | char FileName[0]; /* New name to be assigned */ | |
877 | } __packed; /* level 10 Set */ | |
878 | ||
568798cc PS |
879 | struct smb2_file_link_info { /* encoding of request for level 11 */ |
880 | __u8 ReplaceIfExists; /* 1 = replace existing link with new */ | |
881 | /* 0 = fail if link already exists */ | |
882 | __u8 Reserved[7]; | |
883 | __u64 RootDirectory; /* MBZ for network operations (why says spec?) */ | |
884 | __le32 FileNameLength; | |
885 | char FileName[0]; /* Name to be assigned to new link */ | |
886 | } __packed; /* level 11 Set */ | |
887 | ||
be4cb9e3 PS |
888 | /* |
889 | * This level 18, although with struct with same name is different from cifs | |
890 | * level 0x107. Level 0x107 has an extra u64 between AccessFlags and | |
891 | * CurrentByteOffset. | |
892 | */ | |
893 | struct smb2_file_all_info { /* data block encoding of response to level 18 */ | |
894 | __le64 CreationTime; /* Beginning of FILE_BASIC_INFO equivalent */ | |
895 | __le64 LastAccessTime; | |
896 | __le64 LastWriteTime; | |
897 | __le64 ChangeTime; | |
898 | __le32 Attributes; | |
899 | __u32 Pad1; /* End of FILE_BASIC_INFO_INFO equivalent */ | |
900 | __le64 AllocationSize; /* Beginning of FILE_STANDARD_INFO equivalent */ | |
901 | __le64 EndOfFile; /* size ie offset to first free byte in file */ | |
902 | __le32 NumberOfLinks; /* hard links */ | |
903 | __u8 DeletePending; | |
904 | __u8 Directory; | |
905 | __u16 Pad2; /* End of FILE_STANDARD_INFO equivalent */ | |
906 | __le64 IndexNumber; | |
907 | __le32 EASize; | |
908 | __le32 AccessFlags; | |
909 | __le64 CurrentByteOffset; | |
910 | __le32 Mode; | |
911 | __le32 AlignmentRequirement; | |
912 | __le32 FileNameLength; | |
913 | char FileName[1]; | |
914 | } __packed; /* level 18 Query */ | |
915 | ||
c839ff24 PS |
916 | struct smb2_file_eof_info { /* encoding of request for level 10 */ |
917 | __le64 EndOfFile; /* new end of file value */ | |
918 | } __packed; /* level 20 Set */ | |
919 | ||
ddfbefbd | 920 | #endif /* _SMB2PDU_H */ |