Raise the debug level from 1 to 5 in get_share_mode_lock_internal()
[Samba.git] / libcli / smb / smb2_constants.h
blobf4e8b0286d8f239d37224906453e89910781dfe6
1 /*
2 Unix SMB/CIFS implementation.
4 SMB2 client library header
6 Copyright (C) Andrew Tridgell 2005
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
22 #ifndef __LIBCLI_SMB2_SMB2_CONSTANTS_H__
23 #define __LIBCLI_SMB2_SMB2_CONSTANTS_H__
25 /* offsets into header elements for a sync SMB2 request */
26 #define SMB2_HDR_PROTOCOL_ID 0x00
27 #define SMB2_HDR_LENGTH 0x04
28 #define SMB2_HDR_CREDIT_CHARGE 0x06
29 #define SMB2_HDR_EPOCH SMB2_HDR_CREDIT_CHARGE /* TODO: remove this */
30 #define SMB2_HDR_STATUS 0x08
31 #define SMB2_HDR_OPCODE 0x0c
32 #define SMB2_HDR_CREDIT 0x0e
33 #define SMB2_HDR_FLAGS 0x10
34 #define SMB2_HDR_NEXT_COMMAND 0x14
35 #define SMB2_HDR_MESSAGE_ID 0x18
36 #define SMB2_HDR_PID 0x20
37 #define SMB2_HDR_TID 0x24
38 #define SMB2_HDR_SESSION_ID 0x28
39 #define SMB2_HDR_SIGNATURE 0x30 /* 16 bytes */
40 #define SMB2_HDR_BODY 0x40
42 /* offsets into header elements for an async SMB2 request */
43 #define SMB2_HDR_ASYNC_ID 0x20
45 /* header flags */
46 #define SMB2_HDR_FLAG_REDIRECT 0x01
47 #define SMB2_HDR_FLAG_ASYNC 0x02
48 #define SMB2_HDR_FLAG_CHAINED 0x04
49 #define SMB2_HDR_FLAG_SIGNED 0x08
50 #define SMB2_HDR_FLAG_DFS 0x10000000
51 #define SMB2_HDR_FLAG_REPLAY_OPERATION 0x20000000
53 /* SMB2 opcodes */
54 #define SMB2_OP_NEGPROT 0x00
55 #define SMB2_OP_SESSSETUP 0x01
56 #define SMB2_OP_LOGOFF 0x02
57 #define SMB2_OP_TCON 0x03
58 #define SMB2_OP_TDIS 0x04
59 #define SMB2_OP_CREATE 0x05
60 #define SMB2_OP_CLOSE 0x06
61 #define SMB2_OP_FLUSH 0x07
62 #define SMB2_OP_READ 0x08
63 #define SMB2_OP_WRITE 0x09
64 #define SMB2_OP_LOCK 0x0a
65 #define SMB2_OP_IOCTL 0x0b
66 #define SMB2_OP_CANCEL 0x0c
67 #define SMB2_OP_KEEPALIVE 0x0d
68 #define SMB2_OP_FIND 0x0e
69 #define SMB2_OP_NOTIFY 0x0f
70 #define SMB2_OP_GETINFO 0x10
71 #define SMB2_OP_SETINFO 0x11
72 #define SMB2_OP_BREAK 0x12
74 #define SMB2_MAGIC 0x424D53FE /* 0xFE 'S' 'M' 'B' */
76 /* SMB2 negotiate dialects */
77 #define SMB2_DIALECT_REVISION_000 0x0000 /* early beta dialect */
78 #define SMB2_DIALECT_REVISION_202 0x0202
79 #define SMB2_DIALECT_REVISION_210 0x0210
80 #define SMB2_DIALECT_REVISION_222 0x0222
81 #define SMB2_DIALECT_REVISION_224 0x0224
82 #define SMB3_DIALECT_REVISION_300 0x0300
83 #define SMB2_DIALECT_REVISION_2FF 0x02FF
85 /* SMB2 negotiate security_mode */
86 #define SMB2_NEGOTIATE_SIGNING_ENABLED 0x01
87 #define SMB2_NEGOTIATE_SIGNING_REQUIRED 0x02
89 /* SMB2 global capabilities */
90 #define SMB2_CAP_DFS 0x00000001
91 #define SMB2_CAP_LEASING 0x00000002 /* only in dialect >= 0x210 */
92 #define SMB2_CAP_LARGE_MTU 0x00000004 /* only in dialect >= 0x210 */
93 #define SMB2_CAP_MULTI_CHANNEL 0x00000008 /* only in dialect >= 0x222 */
94 #define SMB2_CAP_PERSISTENT_HANDLES 0x00000010 /* only in dialect >= 0x222 */
95 #define SMB2_CAP_DIRECTORY_LEASING 0x00000020 /* only in dialect >= 0x222 */
96 #define SMB2_CAP_ENCRYPTION 0x00000040 /* only in dialect >= 0x222 */
98 /* so we can spot new caps as added */
99 #define SMB2_CAP_ALL (\
100 SMB2_CAP_DFS | \
101 SMB2_CAP_LEASING | \
102 SMB2_CAP_LARGE_MTU | \
103 SMB2_CAP_MULTI_CHANNEL | \
104 SMB2_CAP_PERSISTENT_HANDLES | \
105 SMB2_CAP_ENCRYPTION)
108 /* SMB2 session flags */
109 #define SMB2_SESSION_FLAG_IS_GUEST 0x0001
110 #define SMB2_SESSION_FLAG_IS_NULL 0x0002
112 /* SMB2 sharetype flags */
113 #define SMB2_SHARE_TYPE_DISK 0x1
114 #define SMB2_SHARE_TYPE_PIPE 0x2
115 #define SMB2_SHARE_TYPE_PRINT 0x3
117 /* SMB2 share flags */
118 #define SMB2_SHAREFLAG_MANUAL_CACHING 0x0000
119 #define SMB2_SHAREFLAG_AUTO_CACHING 0x0010
120 #define SMB2_SHAREFLAG_VDO_CACHING 0x0020
121 #define SMB2_SHAREFLAG_NO_CACHING 0x0030
122 #define SMB2_SHAREFLAG_DFS 0x0001
123 #define SMB2_SHAREFLAG_DFS_ROOT 0x0002
124 #define SMB2_SHAREFLAG_RESTRICT_EXCLUSIVE_OPENS 0x0100
125 #define SMB2_SHAREFLAG_FORCE_SHARED_DELETE 0x0200
126 #define SMB2_SHAREFLAG_ALLOW_NAMESPACE_CACHING 0x0400
127 #define SMB2_SHAREFLAG_ACCESS_BASED_DIRECTORY_ENUM 0x0800
128 #define SMB2_SHAREFLAG_FORCE_LEVELII_OPLOCKS 0x1000
129 #define SMB2_SHAREFLAG_ENABLE_HASH_V1 0x2000
130 #define SMB2_SHAREFLAG_ENABLE_HASH_V2 0x4000
131 #define SMB2_SHAREFLAG_ENCRYPT_DATA 0x8000
132 #define SMB2_SHAREFLAG_ALL 0xFF33
134 /* SMB2 share capabilities */
135 #define SMB2_SHARE_CAP_DFS 0x8
136 #define SMB2_SHARE_CAP_CONTINUOUS_AVAILABILITY 0x10 /* in dialect >= 0x222 */
137 #define SMB2_SHARE_CAP_SCALEOUT 0x20 /* in dialect >= 0x222 */
138 #define SMB2_SHARE_CAP_CLUSTER 0x40 /* in dialect >= 0x222 */
140 /* SMB2 create security flags */
141 #define SMB2_SECURITY_DYNAMIC_TRACKING 0x01
142 #define SMB2_SECURITY_EFFECTIVE_ONLY 0x02
144 /* SMB2 lock flags */
145 #define SMB2_LOCK_FLAG_NONE 0x00000000
146 #define SMB2_LOCK_FLAG_SHARED 0x00000001
147 #define SMB2_LOCK_FLAG_EXCLUSIVE 0x00000002
148 #define SMB2_LOCK_FLAG_UNLOCK 0x00000004
149 #define SMB2_LOCK_FLAG_FAIL_IMMEDIATELY 0x00000010
150 #define SMB2_LOCK_FLAG_ALL_MASK 0x00000017
152 /* SMB2 requested oplock levels */
153 #define SMB2_OPLOCK_LEVEL_NONE 0x00
154 #define SMB2_OPLOCK_LEVEL_II 0x01
155 #define SMB2_OPLOCK_LEVEL_EXCLUSIVE 0x08
156 #define SMB2_OPLOCK_LEVEL_BATCH 0x09
157 #define SMB2_OPLOCK_LEVEL_LEASE 0xFF
159 /* SMB2 lease bits */
160 #define SMB2_LEASE_NONE 0x00
161 #define SMB2_LEASE_READ 0x01
162 #define SMB2_LEASE_HANDLE 0x02
163 #define SMB2_LEASE_WRITE 0x04
165 /* SMB2 lease break flags */
166 #define SMB2_NOTIFY_BREAK_LEASE_FLAG_ACK_REQUIRED 0x01
168 /* SMB2 impersonation levels */
169 #define SMB2_IMPERSONATION_ANONYMOUS 0x00
170 #define SMB2_IMPERSONATION_IDENTIFICATION 0x01
171 #define SMB2_IMPERSONATION_IMPERSONATION 0x02
172 #define SMB2_IMPERSONATION_DELEGATE 0x03
174 /* SMB2 create tags */
175 #define SMB2_CREATE_TAG_EXTA "ExtA"
176 #define SMB2_CREATE_TAG_MXAC "MxAc"
177 #define SMB2_CREATE_TAG_SECD "SecD"
178 #define SMB2_CREATE_TAG_DHNQ "DHnQ"
179 #define SMB2_CREATE_TAG_DHNC "DHnC"
180 #define SMB2_CREATE_TAG_ALSI "AlSi"
181 #define SMB2_CREATE_TAG_TWRP "TWrp"
182 #define SMB2_CREATE_TAG_QFID "QFid"
183 #define SMB2_CREATE_TAG_RQLS "RqLs"
184 #define SMB2_CREATE_TAG_DH2Q "DH2Q"
185 #define SMB2_CREATE_TAG_DH2C "DH2C"
187 /* SMB2 notify flags */
188 #define SMB2_WATCH_TREE 0x0001
190 /* SMB2 Create ignore some more create_options */
191 #define SMB2_CREATE_OPTIONS_NOT_SUPPORTED_MASK (NTCREATEX_OPTIONS_TREE_CONNECTION | \
192 NTCREATEX_OPTIONS_OPFILTER)
195 SMB2 uses different level numbers for the same old SMB trans2 search levels
197 #define SMB2_FIND_DIRECTORY_INFO 0x01
198 #define SMB2_FIND_FULL_DIRECTORY_INFO 0x02
199 #define SMB2_FIND_BOTH_DIRECTORY_INFO 0x03
200 #define SMB2_FIND_NAME_INFO 0x0C
201 #define SMB2_FIND_ID_BOTH_DIRECTORY_INFO 0x25
202 #define SMB2_FIND_ID_FULL_DIRECTORY_INFO 0x26
204 /* flags for SMB2 find */
205 #define SMB2_CONTINUE_FLAG_RESTART 0x01
206 #define SMB2_CONTINUE_FLAG_SINGLE 0x02
207 #define SMB2_CONTINUE_FLAG_INDEX 0x04
208 #define SMB2_CONTINUE_FLAG_REOPEN 0x10
210 /* getinfo classes */
211 #define SMB2_GETINFO_FILE 0x01
212 #define SMB2_GETINFO_FS 0x02
213 #define SMB2_GETINFO_SECURITY 0x03
214 #define SMB2_GETINFO_QUOTA 0x04
216 #define SMB2_CLOSE_FLAGS_FULL_INFORMATION (0x01)
218 #define SMB2_WRITEFLAG_WRITE_THROUGH 0x00000001
220 /* 2.2.31 SMB2 IOCTL Request */
221 #define SMB2_IOCTL_FLAG_IS_FSCTL 0x00000001
224 * Flags for durable handle v2 requests
226 #define SMB2_DHANDLE_FLAG_PERSISTENT 0x00000002
228 #endif