]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blob - fs/cifs/smb2pdu.h
Merge tag 'msm-cleanup-for-3.7' of git://git.kernel.org/pub/scm/linux/kernel/git...
[mirror_ubuntu-artful-kernel.git] / fs / cifs / smb2pdu.h
1 /*
2 * fs/cifs/smb2pdu.h
3 *
4 * Copyright (c) International Business Machines Corp., 2009, 2010
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
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
88 #define SMB2_PROTO_NUMBER __constant_cpu_to_le32(0x424d53fe)
89
90 #define SMB2_HEADER_SIZE __constant_le16_to_cpu(64)
91
92 #define SMB2_ERROR_STRUCTURE_SIZE2 __constant_le16_to_cpu(9)
93
94 /*
95 * SMB2 Header Definition
96 *
97 * "MBZ" : Must be Zero
98 * "BB" : BugBug, Something to check/review/analyze later
99 * "PDU" : "Protocol Data Unit" (ie a network "frame")
100 *
101 */
102 struct smb2_hdr {
103 __be32 smb2_buf_length; /* big endian on wire */
104 /* length is only two or three bytes - with
105 one or two byte type preceding it that MBZ */
106 __u8 ProtocolId[4]; /* 0xFE 'S' 'M' 'B' */
107 __le16 StructureSize; /* 64 */
108 __le16 CreditCharge; /* MBZ */
109 __le32 Status; /* Error from server */
110 __le16 Command;
111 __le16 CreditRequest; /* CreditResponse */
112 __le32 Flags;
113 __le32 NextCommand;
114 __u64 MessageId; /* opaque - so can stay little endian */
115 __le32 ProcessId;
116 __u32 TreeId; /* opaque - so do not make little endian */
117 __u64 SessionId; /* opaque - so do not make little endian */
118 __u8 Signature[16];
119 } __packed;
120
121 struct smb2_pdu {
122 struct smb2_hdr hdr;
123 __le16 StructureSize2; /* size of wct area (varies, request specific) */
124 } __packed;
125
126 /*
127 * SMB2 flag definitions
128 */
129 #define SMB2_FLAGS_SERVER_TO_REDIR __constant_cpu_to_le32(0x00000001)
130 #define SMB2_FLAGS_ASYNC_COMMAND __constant_cpu_to_le32(0x00000002)
131 #define SMB2_FLAGS_RELATED_OPERATIONS __constant_cpu_to_le32(0x00000004)
132 #define SMB2_FLAGS_SIGNED __constant_cpu_to_le32(0x00000008)
133 #define SMB2_FLAGS_DFS_OPERATIONS __constant_cpu_to_le32(0x10000000)
134
135 /*
136 * Definitions for SMB2 Protocol Data Units (network frames)
137 *
138 * See MS-SMB2.PDF specification for protocol details.
139 * The Naming convention is the lower case version of the SMB2
140 * command code name for the struct. Note that structures must be packed.
141 *
142 */
143 struct smb2_err_rsp {
144 struct smb2_hdr hdr;
145 __le16 StructureSize;
146 __le16 Reserved; /* MBZ */
147 __le32 ByteCount; /* even if zero, at least one byte follows */
148 __u8 ErrorData[1]; /* variable length */
149 } __packed;
150
151 struct smb2_negotiate_req {
152 struct smb2_hdr hdr;
153 __le16 StructureSize; /* Must be 36 */
154 __le16 DialectCount;
155 __le16 SecurityMode;
156 __le16 Reserved; /* MBZ */
157 __le32 Capabilities;
158 __u8 ClientGUID[16]; /* MBZ */
159 __le64 ClientStartTime; /* MBZ */
160 __le16 Dialects[2]; /* variable length */
161 } __packed;
162
163 /* SecurityMode flags */
164 #define SMB2_NEGOTIATE_SIGNING_ENABLED 0x0001
165 #define SMB2_NEGOTIATE_SIGNING_REQUIRED 0x0002
166 /* Capabilities flags */
167 #define SMB2_GLOBAL_CAP_DFS 0x00000001
168 #define SMB2_GLOBAL_CAP_LEASING 0x00000002 /* Resp only New to SMB2.1 */
169 #define SMB2_GLOBAL_CAP_LARGE_MTU 0X00000004 /* Resp only New to SMB2.1 */
170 /* Internal types */
171 #define SMB2_NT_FIND 0x00100000
172 #define SMB2_LARGE_FILES 0x00200000
173
174 struct smb2_negotiate_rsp {
175 struct smb2_hdr hdr;
176 __le16 StructureSize; /* Must be 65 */
177 __le16 SecurityMode;
178 __le16 DialectRevision;
179 __le16 Reserved; /* MBZ */
180 __u8 ServerGUID[16];
181 __le32 Capabilities;
182 __le32 MaxTransactSize;
183 __le32 MaxReadSize;
184 __le32 MaxWriteSize;
185 __le64 SystemTime; /* MBZ */
186 __le64 ServerStartTime;
187 __le16 SecurityBufferOffset;
188 __le16 SecurityBufferLength;
189 __le32 Reserved2; /* may be any value, ignore */
190 __u8 Buffer[1]; /* variable length GSS security buffer */
191 } __packed;
192
193 struct smb2_sess_setup_req {
194 struct smb2_hdr hdr;
195 __le16 StructureSize; /* Must be 25 */
196 __u8 VcNumber;
197 __u8 SecurityMode;
198 __le32 Capabilities;
199 __le32 Channel;
200 __le16 SecurityBufferOffset;
201 __le16 SecurityBufferLength;
202 __le64 PreviousSessionId;
203 __u8 Buffer[1]; /* variable length GSS security buffer */
204 } __packed;
205
206 /* Currently defined SessionFlags */
207 #define SMB2_SESSION_FLAG_IS_GUEST 0x0001
208 #define SMB2_SESSION_FLAG_IS_NULL 0x0002
209 struct smb2_sess_setup_rsp {
210 struct smb2_hdr hdr;
211 __le16 StructureSize; /* Must be 9 */
212 __le16 SessionFlags;
213 __le16 SecurityBufferOffset;
214 __le16 SecurityBufferLength;
215 __u8 Buffer[1]; /* variable length GSS security buffer */
216 } __packed;
217
218 struct smb2_logoff_req {
219 struct smb2_hdr hdr;
220 __le16 StructureSize; /* Must be 4 */
221 __le16 Reserved;
222 } __packed;
223
224 struct smb2_logoff_rsp {
225 struct smb2_hdr hdr;
226 __le16 StructureSize; /* Must be 4 */
227 __le16 Reserved;
228 } __packed;
229
230 struct smb2_tree_connect_req {
231 struct smb2_hdr hdr;
232 __le16 StructureSize; /* Must be 9 */
233 __le16 Reserved;
234 __le16 PathOffset;
235 __le16 PathLength;
236 __u8 Buffer[1]; /* variable length */
237 } __packed;
238
239 struct smb2_tree_connect_rsp {
240 struct smb2_hdr hdr;
241 __le16 StructureSize; /* Must be 16 */
242 __u8 ShareType; /* see below */
243 __u8 Reserved;
244 __le32 ShareFlags; /* see below */
245 __le32 Capabilities; /* see below */
246 __le32 MaximalAccess;
247 } __packed;
248
249 /* Possible ShareType values */
250 #define SMB2_SHARE_TYPE_DISK 0x01
251 #define SMB2_SHARE_TYPE_PIPE 0x02
252 #define SMB2_SHARE_TYPE_PRINT 0x03
253
254 /*
255 * Possible ShareFlags - exactly one and only one of the first 4 caching flags
256 * must be set (any of the remaining, SHI1005, flags may be set individually
257 * or in combination.
258 */
259 #define SMB2_SHAREFLAG_MANUAL_CACHING 0x00000000
260 #define SMB2_SHAREFLAG_AUTO_CACHING 0x00000010
261 #define SMB2_SHAREFLAG_VDO_CACHING 0x00000020
262 #define SMB2_SHAREFLAG_NO_CACHING 0x00000030
263 #define SHI1005_FLAGS_DFS 0x00000001
264 #define SHI1005_FLAGS_DFS_ROOT 0x00000002
265 #define SHI1005_FLAGS_RESTRICT_EXCLUSIVE_OPENS 0x00000100
266 #define SHI1005_FLAGS_FORCE_SHARED_DELETE 0x00000200
267 #define SHI1005_FLAGS_ALLOW_NAMESPACE_CACHING 0x00000400
268 #define SHI1005_FLAGS_ACCESS_BASED_DIRECTORY_ENUM 0x00000800
269 #define SHI1005_FLAGS_FORCE_LEVELII_OPLOCK 0x00001000
270 #define SHI1005_FLAGS_ENABLE_HASH 0x00002000
271
272 /* Possible share capabilities */
273 #define SMB2_SHARE_CAP_DFS cpu_to_le32(0x00000008)
274
275 struct smb2_tree_disconnect_req {
276 struct smb2_hdr hdr;
277 __le16 StructureSize; /* Must be 4 */
278 __le16 Reserved;
279 } __packed;
280
281 struct smb2_tree_disconnect_rsp {
282 struct smb2_hdr hdr;
283 __le16 StructureSize; /* Must be 4 */
284 __le16 Reserved;
285 } __packed;
286
287 /* File Attrubutes */
288 #define FILE_ATTRIBUTE_READONLY 0x00000001
289 #define FILE_ATTRIBUTE_HIDDEN 0x00000002
290 #define FILE_ATTRIBUTE_SYSTEM 0x00000004
291 #define FILE_ATTRIBUTE_DIRECTORY 0x00000010
292 #define FILE_ATTRIBUTE_ARCHIVE 0x00000020
293 #define FILE_ATTRIBUTE_NORMAL 0x00000080
294 #define FILE_ATTRIBUTE_TEMPORARY 0x00000100
295 #define FILE_ATTRIBUTE_SPARSE_FILE 0x00000200
296 #define FILE_ATTRIBUTE_REPARSE_POINT 0x00000400
297 #define FILE_ATTRIBUTE_COMPRESSED 0x00000800
298 #define FILE_ATTRIBUTE_OFFLINE 0x00001000
299 #define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000
300 #define FILE_ATTRIBUTE_ENCRYPTED 0x00004000
301
302 /* Oplock levels */
303 #define SMB2_OPLOCK_LEVEL_NONE 0x00
304 #define SMB2_OPLOCK_LEVEL_II 0x01
305 #define SMB2_OPLOCK_LEVEL_EXCLUSIVE 0x08
306 #define SMB2_OPLOCK_LEVEL_BATCH 0x09
307 #define SMB2_OPLOCK_LEVEL_LEASE 0xFF
308
309 /* Desired Access Flags */
310 #define FILE_READ_DATA_LE cpu_to_le32(0x00000001)
311 #define FILE_WRITE_DATA_LE cpu_to_le32(0x00000002)
312 #define FILE_APPEND_DATA_LE cpu_to_le32(0x00000004)
313 #define FILE_READ_EA_LE cpu_to_le32(0x00000008)
314 #define FILE_WRITE_EA_LE cpu_to_le32(0x00000010)
315 #define FILE_EXECUTE_LE cpu_to_le32(0x00000020)
316 #define FILE_READ_ATTRIBUTES_LE cpu_to_le32(0x00000080)
317 #define FILE_WRITE_ATTRIBUTES_LE cpu_to_le32(0x00000100)
318 #define FILE_DELETE_LE cpu_to_le32(0x00010000)
319 #define FILE_READ_CONTROL_LE cpu_to_le32(0x00020000)
320 #define FILE_WRITE_DAC_LE cpu_to_le32(0x00040000)
321 #define FILE_WRITE_OWNER_LE cpu_to_le32(0x00080000)
322 #define FILE_SYNCHRONIZE_LE cpu_to_le32(0x00100000)
323 #define FILE_ACCESS_SYSTEM_SECURITY_LE cpu_to_le32(0x01000000)
324 #define FILE_MAXIMAL_ACCESS_LE cpu_to_le32(0x02000000)
325 #define FILE_GENERIC_ALL_LE cpu_to_le32(0x10000000)
326 #define FILE_GENERIC_EXECUTE_LE cpu_to_le32(0x20000000)
327 #define FILE_GENERIC_WRITE_LE cpu_to_le32(0x40000000)
328 #define FILE_GENERIC_READ_LE cpu_to_le32(0x80000000)
329
330 /* ShareAccess Flags */
331 #define FILE_SHARE_READ_LE cpu_to_le32(0x00000001)
332 #define FILE_SHARE_WRITE_LE cpu_to_le32(0x00000002)
333 #define FILE_SHARE_DELETE_LE cpu_to_le32(0x00000004)
334 #define FILE_SHARE_ALL_LE cpu_to_le32(0x00000007)
335
336 /* CreateDisposition Flags */
337 #define FILE_SUPERSEDE_LE cpu_to_le32(0x00000000)
338 #define FILE_OPEN_LE cpu_to_le32(0x00000001)
339 #define FILE_CREATE_LE cpu_to_le32(0x00000002)
340 #define FILE_OPEN_IF_LE cpu_to_le32(0x00000003)
341 #define FILE_OVERWRITE_LE cpu_to_le32(0x00000004)
342 #define FILE_OVERWRITE_IF_LE cpu_to_le32(0x00000005)
343
344 /* CreateOptions Flags */
345 #define FILE_DIRECTORY_FILE_LE cpu_to_le32(0x00000001)
346 /* same as #define CREATE_NOT_FILE_LE cpu_to_le32(0x00000001) */
347 #define FILE_WRITE_THROUGH_LE cpu_to_le32(0x00000002)
348 #define FILE_SEQUENTIAL_ONLY_LE cpu_to_le32(0x00000004)
349 #define FILE_NO_INTERMEDIATE_BUFFERRING_LE cpu_to_le32(0x00000008)
350 #define FILE_SYNCHRONOUS_IO_ALERT_LE cpu_to_le32(0x00000010)
351 #define FILE_SYNCHRONOUS_IO_NON_ALERT_LE cpu_to_le32(0x00000020)
352 #define FILE_NON_DIRECTORY_FILE_LE cpu_to_le32(0x00000040)
353 #define FILE_COMPLETE_IF_OPLOCKED_LE cpu_to_le32(0x00000100)
354 #define FILE_NO_EA_KNOWLEDGE_LE cpu_to_le32(0x00000200)
355 #define FILE_RANDOM_ACCESS_LE cpu_to_le32(0x00000800)
356 #define FILE_DELETE_ON_CLOSE_LE cpu_to_le32(0x00001000)
357 #define FILE_OPEN_BY_FILE_ID_LE cpu_to_le32(0x00002000)
358 #define FILE_OPEN_FOR_BACKUP_INTENT_LE cpu_to_le32(0x00004000)
359 #define FILE_NO_COMPRESSION_LE cpu_to_le32(0x00008000)
360 #define FILE_RESERVE_OPFILTER_LE cpu_to_le32(0x00100000)
361 #define FILE_OPEN_REPARSE_POINT_LE cpu_to_le32(0x00200000)
362 #define FILE_OPEN_NO_RECALL_LE cpu_to_le32(0x00400000)
363 #define FILE_OPEN_FOR_FREE_SPACE_QUERY_LE cpu_to_le32(0x00800000)
364
365 #define FILE_READ_RIGHTS_LE (FILE_READ_DATA_LE | FILE_READ_EA_LE \
366 | FILE_READ_ATTRIBUTES_LE)
367 #define FILE_WRITE_RIGHTS_LE (FILE_WRITE_DATA_LE | FILE_APPEND_DATA_LE \
368 | FILE_WRITE_EA_LE | FILE_WRITE_ATTRIBUTES_LE)
369 #define FILE_EXEC_RIGHTS_LE (FILE_EXECUTE_LE)
370
371 /* Impersonation Levels */
372 #define IL_ANONYMOUS cpu_to_le32(0x00000000)
373 #define IL_IDENTIFICATION cpu_to_le32(0x00000001)
374 #define IL_IMPERSONATION cpu_to_le32(0x00000002)
375 #define IL_DELEGATE cpu_to_le32(0x00000003)
376
377 /* Create Context Values */
378 #define SMB2_CREATE_EA_BUFFER "ExtA" /* extended attributes */
379 #define SMB2_CREATE_SD_BUFFER "SecD" /* security descriptor */
380 #define SMB2_CREATE_DURABLE_HANDLE_REQUEST "DHnQ"
381 #define SMB2_CREATE_DURABLE_HANDLE_RECONNECT "DHnC"
382 #define SMB2_CREATE_ALLOCATION_SIZE "AlSi"
383 #define SMB2_CREATE_QUERY_MAXIMAL_ACCESS_REQUEST "MxAc"
384 #define SMB2_CREATE_TIMEWARP_REQUEST "TWrp"
385 #define SMB2_CREATE_QUERY_ON_DISK_ID "QFid"
386 #define SMB2_CREATE_REQUEST_LEASE "RqLs"
387
388 struct smb2_create_req {
389 struct smb2_hdr hdr;
390 __le16 StructureSize; /* Must be 57 */
391 __u8 SecurityFlags;
392 __u8 RequestedOplockLevel;
393 __le32 ImpersonationLevel;
394 __le64 SmbCreateFlags;
395 __le64 Reserved;
396 __le32 DesiredAccess;
397 __le32 FileAttributes;
398 __le32 ShareAccess;
399 __le32 CreateDisposition;
400 __le32 CreateOptions;
401 __le16 NameOffset;
402 __le16 NameLength;
403 __le32 CreateContextsOffset;
404 __le32 CreateContextsLength;
405 __u8 Buffer[1];
406 } __packed;
407
408 struct smb2_create_rsp {
409 struct smb2_hdr hdr;
410 __le16 StructureSize; /* Must be 89 */
411 __u8 OplockLevel;
412 __u8 Reserved;
413 __le32 CreateAction;
414 __le64 CreationTime;
415 __le64 LastAccessTime;
416 __le64 LastWriteTime;
417 __le64 ChangeTime;
418 __le64 AllocationSize;
419 __le64 EndofFile;
420 __le32 FileAttributes;
421 __le32 Reserved2;
422 __u64 PersistentFileId; /* opaque endianness */
423 __u64 VolatileFileId; /* opaque endianness */
424 __le32 CreateContextsOffset;
425 __le32 CreateContextsLength;
426 __u8 Buffer[1];
427 } __packed;
428
429 /* Currently defined values for close flags */
430 #define SMB2_CLOSE_FLAG_POSTQUERY_ATTRIB cpu_to_le16(0x0001)
431 struct smb2_close_req {
432 struct smb2_hdr hdr;
433 __le16 StructureSize; /* Must be 24 */
434 __le16 Flags;
435 __le32 Reserved;
436 __u64 PersistentFileId; /* opaque endianness */
437 __u64 VolatileFileId; /* opaque endianness */
438 } __packed;
439
440 struct smb2_close_rsp {
441 struct smb2_hdr hdr;
442 __le16 StructureSize; /* 60 */
443 __le16 Flags;
444 __le32 Reserved;
445 __le64 CreationTime;
446 __le64 LastAccessTime;
447 __le64 LastWriteTime;
448 __le64 ChangeTime;
449 __le64 AllocationSize; /* Beginning of FILE_STANDARD_INFO equivalent */
450 __le64 EndOfFile;
451 __le32 Attributes;
452 } __packed;
453
454 struct smb2_echo_req {
455 struct smb2_hdr hdr;
456 __le16 StructureSize; /* Must be 4 */
457 __u16 Reserved;
458 } __packed;
459
460 struct smb2_echo_rsp {
461 struct smb2_hdr hdr;
462 __le16 StructureSize; /* Must be 4 */
463 __u16 Reserved;
464 } __packed;
465
466 /* Possible InfoType values */
467 #define SMB2_O_INFO_FILE 0x01
468 #define SMB2_O_INFO_FILESYSTEM 0x02
469 #define SMB2_O_INFO_SECURITY 0x03
470 #define SMB2_O_INFO_QUOTA 0x04
471
472 struct smb2_query_info_req {
473 struct smb2_hdr hdr;
474 __le16 StructureSize; /* Must be 41 */
475 __u8 InfoType;
476 __u8 FileInfoClass;
477 __le32 OutputBufferLength;
478 __le16 InputBufferOffset;
479 __u16 Reserved;
480 __le32 InputBufferLength;
481 __le32 AdditionalInformation;
482 __le32 Flags;
483 __u64 PersistentFileId; /* opaque endianness */
484 __u64 VolatileFileId; /* opaque endianness */
485 __u8 Buffer[1];
486 } __packed;
487
488 struct smb2_query_info_rsp {
489 struct smb2_hdr hdr;
490 __le16 StructureSize; /* Must be 9 */
491 __le16 OutputBufferOffset;
492 __le32 OutputBufferLength;
493 __u8 Buffer[1];
494 } __packed;
495
496 /*
497 * PDU infolevel structure definitions
498 * BB consider moving to a different header
499 */
500
501 /* partial list of QUERY INFO levels */
502 #define FILE_DIRECTORY_INFORMATION 1
503 #define FILE_FULL_DIRECTORY_INFORMATION 2
504 #define FILE_BOTH_DIRECTORY_INFORMATION 3
505 #define FILE_BASIC_INFORMATION 4
506 #define FILE_STANDARD_INFORMATION 5
507 #define FILE_INTERNAL_INFORMATION 6
508 #define FILE_EA_INFORMATION 7
509 #define FILE_ACCESS_INFORMATION 8
510 #define FILE_NAME_INFORMATION 9
511 #define FILE_RENAME_INFORMATION 10
512 #define FILE_LINK_INFORMATION 11
513 #define FILE_NAMES_INFORMATION 12
514 #define FILE_DISPOSITION_INFORMATION 13
515 #define FILE_POSITION_INFORMATION 14
516 #define FILE_FULL_EA_INFORMATION 15
517 #define FILE_MODE_INFORMATION 16
518 #define FILE_ALIGNMENT_INFORMATION 17
519 #define FILE_ALL_INFORMATION 18
520 #define FILE_ALLOCATION_INFORMATION 19
521 #define FILE_END_OF_FILE_INFORMATION 20
522 #define FILE_ALTERNATE_NAME_INFORMATION 21
523 #define FILE_STREAM_INFORMATION 22
524 #define FILE_PIPE_INFORMATION 23
525 #define FILE_PIPE_LOCAL_INFORMATION 24
526 #define FILE_PIPE_REMOTE_INFORMATION 25
527 #define FILE_MAILSLOT_QUERY_INFORMATION 26
528 #define FILE_MAILSLOT_SET_INFORMATION 27
529 #define FILE_COMPRESSION_INFORMATION 28
530 #define FILE_OBJECT_ID_INFORMATION 29
531 /* Number 30 not defined in documents */
532 #define FILE_MOVE_CLUSTER_INFORMATION 31
533 #define FILE_QUOTA_INFORMATION 32
534 #define FILE_REPARSE_POINT_INFORMATION 33
535 #define FILE_NETWORK_OPEN_INFORMATION 34
536 #define FILE_ATTRIBUTE_TAG_INFORMATION 35
537 #define FILE_TRACKING_INFORMATION 36
538 #define FILEID_BOTH_DIRECTORY_INFORMATION 37
539 #define FILEID_FULL_DIRECTORY_INFORMATION 38
540 #define FILE_VALID_DATA_LENGTH_INFORMATION 39
541 #define FILE_SHORT_NAME_INFORMATION 40
542 #define FILE_SFIO_RESERVE_INFORMATION 44
543 #define FILE_SFIO_VOLUME_INFORMATION 45
544 #define FILE_HARD_LINK_INFORMATION 46
545 #define FILE_NORMALIZED_NAME_INFORMATION 48
546 #define FILEID_GLOBAL_TX_DIRECTORY_INFORMATION 50
547 #define FILE_STANDARD_LINK_INFORMATION 54
548
549 /*
550 * This level 18, although with struct with same name is different from cifs
551 * level 0x107. Level 0x107 has an extra u64 between AccessFlags and
552 * CurrentByteOffset.
553 */
554 struct smb2_file_all_info { /* data block encoding of response to level 18 */
555 __le64 CreationTime; /* Beginning of FILE_BASIC_INFO equivalent */
556 __le64 LastAccessTime;
557 __le64 LastWriteTime;
558 __le64 ChangeTime;
559 __le32 Attributes;
560 __u32 Pad1; /* End of FILE_BASIC_INFO_INFO equivalent */
561 __le64 AllocationSize; /* Beginning of FILE_STANDARD_INFO equivalent */
562 __le64 EndOfFile; /* size ie offset to first free byte in file */
563 __le32 NumberOfLinks; /* hard links */
564 __u8 DeletePending;
565 __u8 Directory;
566 __u16 Pad2; /* End of FILE_STANDARD_INFO equivalent */
567 __le64 IndexNumber;
568 __le32 EASize;
569 __le32 AccessFlags;
570 __le64 CurrentByteOffset;
571 __le32 Mode;
572 __le32 AlignmentRequirement;
573 __le32 FileNameLength;
574 char FileName[1];
575 } __packed; /* level 18 Query */
576
577 #endif /* _SMB2PDU_H */