Commit | Line | Data |
---|---|---|
ddfbefbd SF |
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 | ||
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 | ||
90 | #define SMB2_HEADER_SIZE __constant_le16_to_cpu(64) | |
91 | ||
92 | #define SMB2_ERROR_STRUCTURE_SIZE2 __constant_le16_to_cpu(9) | |
93 | ||
ddfbefbd SF |
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 | ||
093b2bda PS |
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 | ||
ec2e4523 PS |
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 | ||
171 | struct smb2_negotiate_rsp { | |
172 | struct smb2_hdr hdr; | |
173 | __le16 StructureSize; /* Must be 65 */ | |
174 | __le16 SecurityMode; | |
175 | __le16 DialectRevision; | |
176 | __le16 Reserved; /* MBZ */ | |
177 | __u8 ServerGUID[16]; | |
178 | __le32 Capabilities; | |
179 | __le32 MaxTransactSize; | |
180 | __le32 MaxReadSize; | |
181 | __le32 MaxWriteSize; | |
182 | __le64 SystemTime; /* MBZ */ | |
183 | __le64 ServerStartTime; | |
184 | __le16 SecurityBufferOffset; | |
185 | __le16 SecurityBufferLength; | |
186 | __le32 Reserved2; /* may be any value, ignore */ | |
187 | __u8 Buffer[1]; /* variable length GSS security buffer */ | |
188 | } __packed; | |
189 | ||
5478f9ba PS |
190 | struct smb2_sess_setup_req { |
191 | struct smb2_hdr hdr; | |
192 | __le16 StructureSize; /* Must be 25 */ | |
193 | __u8 VcNumber; | |
194 | __u8 SecurityMode; | |
195 | __le32 Capabilities; | |
196 | __le32 Channel; | |
197 | __le16 SecurityBufferOffset; | |
198 | __le16 SecurityBufferLength; | |
199 | __le64 PreviousSessionId; | |
200 | __u8 Buffer[1]; /* variable length GSS security buffer */ | |
201 | } __packed; | |
202 | ||
203 | /* Currently defined SessionFlags */ | |
204 | #define SMB2_SESSION_FLAG_IS_GUEST 0x0001 | |
205 | #define SMB2_SESSION_FLAG_IS_NULL 0x0002 | |
206 | struct smb2_sess_setup_rsp { | |
207 | struct smb2_hdr hdr; | |
208 | __le16 StructureSize; /* Must be 9 */ | |
209 | __le16 SessionFlags; | |
210 | __le16 SecurityBufferOffset; | |
211 | __le16 SecurityBufferLength; | |
212 | __u8 Buffer[1]; /* variable length GSS security buffer */ | |
213 | } __packed; | |
214 | ||
215 | struct smb2_logoff_req { | |
216 | struct smb2_hdr hdr; | |
217 | __le16 StructureSize; /* Must be 4 */ | |
218 | __le16 Reserved; | |
219 | } __packed; | |
220 | ||
221 | struct smb2_logoff_rsp { | |
222 | struct smb2_hdr hdr; | |
223 | __le16 StructureSize; /* Must be 4 */ | |
224 | __le16 Reserved; | |
225 | } __packed; | |
226 | ||
faaf946a PS |
227 | struct smb2_tree_connect_req { |
228 | struct smb2_hdr hdr; | |
229 | __le16 StructureSize; /* Must be 9 */ | |
230 | __le16 Reserved; | |
231 | __le16 PathOffset; | |
232 | __le16 PathLength; | |
233 | __u8 Buffer[1]; /* variable length */ | |
234 | } __packed; | |
235 | ||
236 | struct smb2_tree_connect_rsp { | |
237 | struct smb2_hdr hdr; | |
238 | __le16 StructureSize; /* Must be 16 */ | |
239 | __u8 ShareType; /* see below */ | |
240 | __u8 Reserved; | |
241 | __le32 ShareFlags; /* see below */ | |
242 | __le32 Capabilities; /* see below */ | |
243 | __le32 MaximalAccess; | |
244 | } __packed; | |
245 | ||
246 | /* Possible ShareType values */ | |
247 | #define SMB2_SHARE_TYPE_DISK 0x01 | |
248 | #define SMB2_SHARE_TYPE_PIPE 0x02 | |
249 | #define SMB2_SHARE_TYPE_PRINT 0x03 | |
250 | ||
251 | /* | |
252 | * Possible ShareFlags - exactly one and only one of the first 4 caching flags | |
253 | * must be set (any of the remaining, SHI1005, flags may be set individually | |
254 | * or in combination. | |
255 | */ | |
256 | #define SMB2_SHAREFLAG_MANUAL_CACHING 0x00000000 | |
257 | #define SMB2_SHAREFLAG_AUTO_CACHING 0x00000010 | |
258 | #define SMB2_SHAREFLAG_VDO_CACHING 0x00000020 | |
259 | #define SMB2_SHAREFLAG_NO_CACHING 0x00000030 | |
260 | #define SHI1005_FLAGS_DFS 0x00000001 | |
261 | #define SHI1005_FLAGS_DFS_ROOT 0x00000002 | |
262 | #define SHI1005_FLAGS_RESTRICT_EXCLUSIVE_OPENS 0x00000100 | |
263 | #define SHI1005_FLAGS_FORCE_SHARED_DELETE 0x00000200 | |
264 | #define SHI1005_FLAGS_ALLOW_NAMESPACE_CACHING 0x00000400 | |
265 | #define SHI1005_FLAGS_ACCESS_BASED_DIRECTORY_ENUM 0x00000800 | |
266 | #define SHI1005_FLAGS_FORCE_LEVELII_OPLOCK 0x00001000 | |
267 | #define SHI1005_FLAGS_ENABLE_HASH 0x00002000 | |
268 | ||
269 | /* Possible share capabilities */ | |
270 | #define SMB2_SHARE_CAP_DFS cpu_to_le32(0x00000008) | |
271 | ||
272 | struct smb2_tree_disconnect_req { | |
273 | struct smb2_hdr hdr; | |
274 | __le16 StructureSize; /* Must be 4 */ | |
275 | __le16 Reserved; | |
276 | } __packed; | |
277 | ||
278 | struct smb2_tree_disconnect_rsp { | |
279 | struct smb2_hdr hdr; | |
280 | __le16 StructureSize; /* Must be 4 */ | |
281 | __le16 Reserved; | |
282 | } __packed; | |
283 | ||
2503a0db PS |
284 | /* File Attrubutes */ |
285 | #define FILE_ATTRIBUTE_READONLY 0x00000001 | |
286 | #define FILE_ATTRIBUTE_HIDDEN 0x00000002 | |
287 | #define FILE_ATTRIBUTE_SYSTEM 0x00000004 | |
288 | #define FILE_ATTRIBUTE_DIRECTORY 0x00000010 | |
289 | #define FILE_ATTRIBUTE_ARCHIVE 0x00000020 | |
290 | #define FILE_ATTRIBUTE_NORMAL 0x00000080 | |
291 | #define FILE_ATTRIBUTE_TEMPORARY 0x00000100 | |
292 | #define FILE_ATTRIBUTE_SPARSE_FILE 0x00000200 | |
293 | #define FILE_ATTRIBUTE_REPARSE_POINT 0x00000400 | |
294 | #define FILE_ATTRIBUTE_COMPRESSED 0x00000800 | |
295 | #define FILE_ATTRIBUTE_OFFLINE 0x00001000 | |
296 | #define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000 | |
297 | #define FILE_ATTRIBUTE_ENCRYPTED 0x00004000 | |
298 | ||
299 | /* Oplock levels */ | |
300 | #define SMB2_OPLOCK_LEVEL_NONE 0x00 | |
301 | #define SMB2_OPLOCK_LEVEL_II 0x01 | |
302 | #define SMB2_OPLOCK_LEVEL_EXCLUSIVE 0x08 | |
303 | #define SMB2_OPLOCK_LEVEL_BATCH 0x09 | |
304 | #define SMB2_OPLOCK_LEVEL_LEASE 0xFF | |
305 | ||
306 | /* Desired Access Flags */ | |
307 | #define FILE_READ_DATA_LE cpu_to_le32(0x00000001) | |
308 | #define FILE_WRITE_DATA_LE cpu_to_le32(0x00000002) | |
309 | #define FILE_APPEND_DATA_LE cpu_to_le32(0x00000004) | |
310 | #define FILE_READ_EA_LE cpu_to_le32(0x00000008) | |
311 | #define FILE_WRITE_EA_LE cpu_to_le32(0x00000010) | |
312 | #define FILE_EXECUTE_LE cpu_to_le32(0x00000020) | |
313 | #define FILE_READ_ATTRIBUTES_LE cpu_to_le32(0x00000080) | |
314 | #define FILE_WRITE_ATTRIBUTES_LE cpu_to_le32(0x00000100) | |
315 | #define FILE_DELETE_LE cpu_to_le32(0x00010000) | |
316 | #define FILE_READ_CONTROL_LE cpu_to_le32(0x00020000) | |
317 | #define FILE_WRITE_DAC_LE cpu_to_le32(0x00040000) | |
318 | #define FILE_WRITE_OWNER_LE cpu_to_le32(0x00080000) | |
319 | #define FILE_SYNCHRONIZE_LE cpu_to_le32(0x00100000) | |
320 | #define FILE_ACCESS_SYSTEM_SECURITY_LE cpu_to_le32(0x01000000) | |
321 | #define FILE_MAXIMAL_ACCESS_LE cpu_to_le32(0x02000000) | |
322 | #define FILE_GENERIC_ALL_LE cpu_to_le32(0x10000000) | |
323 | #define FILE_GENERIC_EXECUTE_LE cpu_to_le32(0x20000000) | |
324 | #define FILE_GENERIC_WRITE_LE cpu_to_le32(0x40000000) | |
325 | #define FILE_GENERIC_READ_LE cpu_to_le32(0x80000000) | |
326 | ||
327 | /* ShareAccess Flags */ | |
328 | #define FILE_SHARE_READ_LE cpu_to_le32(0x00000001) | |
329 | #define FILE_SHARE_WRITE_LE cpu_to_le32(0x00000002) | |
330 | #define FILE_SHARE_DELETE_LE cpu_to_le32(0x00000004) | |
331 | #define FILE_SHARE_ALL_LE cpu_to_le32(0x00000007) | |
332 | ||
333 | /* CreateDisposition Flags */ | |
334 | #define FILE_SUPERSEDE_LE cpu_to_le32(0x00000000) | |
335 | #define FILE_OPEN_LE cpu_to_le32(0x00000001) | |
336 | #define FILE_CREATE_LE cpu_to_le32(0x00000002) | |
337 | #define FILE_OPEN_IF_LE cpu_to_le32(0x00000003) | |
338 | #define FILE_OVERWRITE_LE cpu_to_le32(0x00000004) | |
339 | #define FILE_OVERWRITE_IF_LE cpu_to_le32(0x00000005) | |
340 | ||
341 | /* CreateOptions Flags */ | |
342 | #define FILE_DIRECTORY_FILE_LE cpu_to_le32(0x00000001) | |
343 | /* same as #define CREATE_NOT_FILE_LE cpu_to_le32(0x00000001) */ | |
344 | #define FILE_WRITE_THROUGH_LE cpu_to_le32(0x00000002) | |
345 | #define FILE_SEQUENTIAL_ONLY_LE cpu_to_le32(0x00000004) | |
346 | #define FILE_NO_INTERMEDIATE_BUFFERRING_LE cpu_to_le32(0x00000008) | |
347 | #define FILE_SYNCHRONOUS_IO_ALERT_LE cpu_to_le32(0x00000010) | |
348 | #define FILE_SYNCHRONOUS_IO_NON_ALERT_LE cpu_to_le32(0x00000020) | |
349 | #define FILE_NON_DIRECTORY_FILE_LE cpu_to_le32(0x00000040) | |
350 | #define FILE_COMPLETE_IF_OPLOCKED_LE cpu_to_le32(0x00000100) | |
351 | #define FILE_NO_EA_KNOWLEDGE_LE cpu_to_le32(0x00000200) | |
352 | #define FILE_RANDOM_ACCESS_LE cpu_to_le32(0x00000800) | |
353 | #define FILE_DELETE_ON_CLOSE_LE cpu_to_le32(0x00001000) | |
354 | #define FILE_OPEN_BY_FILE_ID_LE cpu_to_le32(0x00002000) | |
355 | #define FILE_OPEN_FOR_BACKUP_INTENT_LE cpu_to_le32(0x00004000) | |
356 | #define FILE_NO_COMPRESSION_LE cpu_to_le32(0x00008000) | |
357 | #define FILE_RESERVE_OPFILTER_LE cpu_to_le32(0x00100000) | |
358 | #define FILE_OPEN_REPARSE_POINT_LE cpu_to_le32(0x00200000) | |
359 | #define FILE_OPEN_NO_RECALL_LE cpu_to_le32(0x00400000) | |
360 | #define FILE_OPEN_FOR_FREE_SPACE_QUERY_LE cpu_to_le32(0x00800000) | |
361 | ||
362 | #define FILE_READ_RIGHTS_LE (FILE_READ_DATA_LE | FILE_READ_EA_LE \ | |
363 | | FILE_READ_ATTRIBUTES_LE) | |
364 | #define FILE_WRITE_RIGHTS_LE (FILE_WRITE_DATA_LE | FILE_APPEND_DATA_LE \ | |
365 | | FILE_WRITE_EA_LE | FILE_WRITE_ATTRIBUTES_LE) | |
366 | #define FILE_EXEC_RIGHTS_LE (FILE_EXECUTE_LE) | |
367 | ||
368 | /* Impersonation Levels */ | |
369 | #define IL_ANONYMOUS cpu_to_le32(0x00000000) | |
370 | #define IL_IDENTIFICATION cpu_to_le32(0x00000001) | |
371 | #define IL_IMPERSONATION cpu_to_le32(0x00000002) | |
372 | #define IL_DELEGATE cpu_to_le32(0x00000003) | |
373 | ||
374 | /* Create Context Values */ | |
375 | #define SMB2_CREATE_EA_BUFFER "ExtA" /* extended attributes */ | |
376 | #define SMB2_CREATE_SD_BUFFER "SecD" /* security descriptor */ | |
377 | #define SMB2_CREATE_DURABLE_HANDLE_REQUEST "DHnQ" | |
378 | #define SMB2_CREATE_DURABLE_HANDLE_RECONNECT "DHnC" | |
379 | #define SMB2_CREATE_ALLOCATION_SIZE "AlSi" | |
380 | #define SMB2_CREATE_QUERY_MAXIMAL_ACCESS_REQUEST "MxAc" | |
381 | #define SMB2_CREATE_TIMEWARP_REQUEST "TWrp" | |
382 | #define SMB2_CREATE_QUERY_ON_DISK_ID "QFid" | |
383 | #define SMB2_CREATE_REQUEST_LEASE "RqLs" | |
384 | ||
385 | struct smb2_create_req { | |
386 | struct smb2_hdr hdr; | |
387 | __le16 StructureSize; /* Must be 57 */ | |
388 | __u8 SecurityFlags; | |
389 | __u8 RequestedOplockLevel; | |
390 | __le32 ImpersonationLevel; | |
391 | __le64 SmbCreateFlags; | |
392 | __le64 Reserved; | |
393 | __le32 DesiredAccess; | |
394 | __le32 FileAttributes; | |
395 | __le32 ShareAccess; | |
396 | __le32 CreateDisposition; | |
397 | __le32 CreateOptions; | |
398 | __le16 NameOffset; | |
399 | __le16 NameLength; | |
400 | __le32 CreateContextsOffset; | |
401 | __le32 CreateContextsLength; | |
402 | __u8 Buffer[1]; | |
403 | } __packed; | |
404 | ||
405 | struct smb2_create_rsp { | |
406 | struct smb2_hdr hdr; | |
407 | __le16 StructureSize; /* Must be 89 */ | |
408 | __u8 OplockLevel; | |
409 | __u8 Reserved; | |
410 | __le32 CreateAction; | |
411 | __le64 CreationTime; | |
412 | __le64 LastAccessTime; | |
413 | __le64 LastWriteTime; | |
414 | __le64 ChangeTime; | |
415 | __le64 AllocationSize; | |
416 | __le64 EndofFile; | |
417 | __le32 FileAttributes; | |
418 | __le32 Reserved2; | |
419 | __u64 PersistentFileId; /* opaque endianness */ | |
420 | __u64 VolatileFileId; /* opaque endianness */ | |
421 | __le32 CreateContextsOffset; | |
422 | __le32 CreateContextsLength; | |
423 | __u8 Buffer[1]; | |
424 | } __packed; | |
425 | ||
426 | /* Currently defined values for close flags */ | |
427 | #define SMB2_CLOSE_FLAG_POSTQUERY_ATTRIB cpu_to_le16(0x0001) | |
428 | struct smb2_close_req { | |
429 | struct smb2_hdr hdr; | |
430 | __le16 StructureSize; /* Must be 24 */ | |
431 | __le16 Flags; | |
432 | __le32 Reserved; | |
433 | __u64 PersistentFileId; /* opaque endianness */ | |
434 | __u64 VolatileFileId; /* opaque endianness */ | |
435 | } __packed; | |
436 | ||
437 | struct smb2_close_rsp { | |
438 | struct smb2_hdr hdr; | |
439 | __le16 StructureSize; /* 60 */ | |
440 | __le16 Flags; | |
441 | __le32 Reserved; | |
442 | __le64 CreationTime; | |
443 | __le64 LastAccessTime; | |
444 | __le64 LastWriteTime; | |
445 | __le64 ChangeTime; | |
446 | __le64 AllocationSize; /* Beginning of FILE_STANDARD_INFO equivalent */ | |
447 | __le64 EndOfFile; | |
448 | __le32 Attributes; | |
449 | } __packed; | |
450 | ||
ddfbefbd | 451 | #endif /* _SMB2PDU_H */ |