| 1 | /* $NetBSD: smb.h,v 1.20 2012/11/30 23:24:22 nakayama Exp $ */ |
| 2 | |
| 3 | /* |
| 4 | * Copyright (c) 2000-2001 Boris Popov |
| 5 | * All rights reserved. |
| 6 | * |
| 7 | * Redistribution and use in source and binary forms, with or without |
| 8 | * modification, are permitted provided that the following conditions |
| 9 | * are met: |
| 10 | * 1. Redistributions of source code must retain the above copyright |
| 11 | * notice, this list of conditions and the following disclaimer. |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright |
| 13 | * notice, this list of conditions and the following disclaimer in the |
| 14 | * documentation and/or other materials provided with the distribution. |
| 15 | * 3. All advertising materials mentioning features or use of this software |
| 16 | * must display the following acknowledgement: |
| 17 | * This product includes software developed by Boris Popov. |
| 18 | * 4. Neither the name of the author nor the names of any co-contributors |
| 19 | * may be used to endorse or promote products derived from this software |
| 20 | * without specific prior written permission. |
| 21 | * |
| 22 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND |
| 23 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 24 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 25 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |
| 26 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 27 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
| 28 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 29 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
| 30 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 32 | * SUCH DAMAGE. |
| 33 | * |
| 34 | * FreeBSD: src/sys/netsmb/smb.h,v 1.9 2003/01/01 18:48:56 schweikh Exp |
| 35 | */ |
| 36 | |
| 37 | /* |
| 38 | * Common definintions and structures for SMB/CIFS protocol |
| 39 | */ |
| 40 | |
| 41 | #ifndef _NETSMB_SMB_H_ |
| 42 | #define _NETSMB_SMB_H_ |
| 43 | |
| 44 | #define SMB_TCP_PORT 139 |
| 45 | /* |
| 46 | * SMB dialects that we have to deal with. |
| 47 | */ |
| 48 | enum smb_dialects { |
| 49 | SMB_DIALECT_NONE, |
| 50 | SMB_DIALECT_CORE, /* PC NETWORK PROGRAM 1.0, PCLAN1.0 */ |
| 51 | SMB_DIALECT_COREPLUS, /* MICROSOFT NETWORKS 1.03 */ |
| 52 | SMB_DIALECT_LANMAN1_0, /* MICROSOFT NETWORKS 3.0, LANMAN1.0 */ |
| 53 | SMB_DIALECT_LANMAN2_0, /* LM1.2X002, DOS LM1.2X002, Samba */ |
| 54 | SMB_DIALECT_LANMAN2_1, /* DOS LANMAN2.1, LANMAN2.1 */ |
| 55 | SMB_DIALECT_NTLM0_12 /* NT LM 0.12, Windows for Workgroups 3.1a, |
| 56 | * NT LANMAN 1.0 */ |
| 57 | }; |
| 58 | |
| 59 | /* |
| 60 | * Formats of data/string buffers |
| 61 | */ |
| 62 | #define SMB_DT_DATA 1 |
| 63 | #define SMB_DT_DIALECT 2 |
| 64 | #define SMB_DT_PATHNAME 3 |
| 65 | #define SMB_DT_ASCII 4 |
| 66 | #define SMB_DT_VARIABLE 5 |
| 67 | |
| 68 | /* |
| 69 | * SMB header |
| 70 | */ |
| 71 | #define SMB_SIGNATURE "\xFFSMB" |
| 72 | #define SMB_SIGLEN 4 |
| 73 | #define SMB_HDRMID(p) (le16toh(*(u_short*)((u_char*)(p) + 30))) |
| 74 | #define SMB_HDRLEN 32 |
| 75 | /* |
| 76 | * bits in the smb_flags field |
| 77 | */ |
| 78 | #define SMB_FLAGS_CASELESS 0x08 |
| 79 | #define SMB_FLAGS_SERVER_RESP 0x80 /* indicates a response */ |
| 80 | |
| 81 | /* |
| 82 | * bits in the smb_flags2 field |
| 83 | */ |
| 84 | #define SMB_FLAGS2_KNOWS_LONG_NAMES 0x0001 |
| 85 | #define SMB_FLAGS2_KNOWS_EAS 0x0002 /* client know about EAs */ |
| 86 | #define SMB_FLAGS2_SECURITY_SIGNATURE 0x0004 /* check SMB integrity */ |
| 87 | #define SMB_FLAGS2_IS_LONG_NAME 0x0040 /* any path name is a long name */ |
| 88 | #define SMB_FLAGS2_EXT_SEC 0x0800 /* client aware of Extended |
| 89 | * Security negotiation */ |
| 90 | #define SMB_FLAGS2_DFS 0x1000 /* resolve paths in DFS */ |
| 91 | #define SMB_FLAGS2_PAGING_IO 0x2000 /* for exec */ |
| 92 | #define SMB_FLAGS2_ERR_STATUS 0x4000 /* 1 - status.status */ |
| 93 | #define SMB_FLAGS2_UNICODE 0x8000 /* use Unicode for all strings */ |
| 94 | |
| 95 | #define SMB_UID_UNKNOWN 0xffff |
| 96 | #define SMB_TID_UNKNOWN 0xffff |
| 97 | |
| 98 | /* |
| 99 | * Security mode bits |
| 100 | */ |
| 101 | #define SMB_SM_USER 0x01 /* server in the user security mode */ |
| 102 | #define SMB_SM_ENCRYPT 0x02 /* use challenge/response */ |
| 103 | |
| 104 | /* |
| 105 | * NTLM capabilities |
| 106 | */ |
| 107 | #define SMB_CAP_RAW_MODE 0x0001 |
| 108 | #define SMB_CAP_MPX_MODE 0x0002 |
| 109 | #define SMB_CAP_UNICODE 0x0004 |
| 110 | #define SMB_CAP_LARGE_FILES 0x0008 /* 64 bit offsets supported */ |
| 111 | #define SMB_CAP_NT_SMBS 0x0010 |
| 112 | #define SMB_CAP_RPC_REMOTE_APIS 0x0020 |
| 113 | #define SMB_CAP_STATUS32 0x0040 |
| 114 | #define SMB_CAP_LEVEL_II_OPLOCKS 0x0080 |
| 115 | #define SMB_CAP_LOCK_AND_READ 0x0100 |
| 116 | #define SMB_CAP_NT_FIND 0x0200 |
| 117 | #define SMB_CAP_DFS 0x1000 |
| 118 | #define SMB_CAP_INFOLEVEL_PASSTHRU 0x2000 |
| 119 | #define SMB_CAP_LARGE_READX 0x4000 |
| 120 | #define SMB_CAP_LARGE_WRITEX 0x8000 |
| 121 | #define SMB_CAP_UNIX 0x00800000 |
| 122 | #define SMB_CAP_BULK_TRANSFER 0x20000000 |
| 123 | #define SMB_CAP_COMPRESSED_DATA 0x40000000 |
| 124 | #define SMB_CAP_EXT_SECURITY 0x80000000 |
| 125 | |
| 126 | /* |
| 127 | * File attributes |
| 128 | */ |
| 129 | #define SMB_FA_RDONLY 0x01 |
| 130 | #define SMB_FA_HIDDEN 0x02 |
| 131 | #define SMB_FA_SYSTEM 0x04 |
| 132 | #define SMB_FA_VOLUME 0x08 |
| 133 | #define SMB_FA_DIR 0x10 |
| 134 | #define SMB_FA_ARCHIVE 0x20 |
| 135 | |
| 136 | /* |
| 137 | * Extended file attributes |
| 138 | */ |
| 139 | #define SMB_EFA_RDONLY 0x00000001 |
| 140 | #define SMB_EFA_HIDDEN 0x00000002 |
| 141 | #define SMB_EFA_SYSTEM 0x00000004 |
| 142 | #define SMB_EFA_DIRECTORY 0x00000010 |
| 143 | #define SMB_EFA_ARCHIVE 0x00000020 |
| 144 | #define SMB_EFA_NORMAL 0x00000080 |
| 145 | #define SMB_EFA_TEMPORARY 0x00000100 |
| 146 | #define SMB_EFA_COMPRESSED 0x00000800 |
| 147 | #define SMB_EFA_POSIX_SEMANTICS 0x01000000 |
| 148 | #define SMB_EFA_BACKUP_SEMANTICS 0x02000000 |
| 149 | #define SMB_EFA_DELETE_ON_CLOSE 0x04000000 |
| 150 | #define SMB_EFA_SEQUENTIAL_SCAN 0x08000000 |
| 151 | #define SMB_EFA_RANDOM_ACCESS 0x10000000 |
| 152 | #define SMB_EFA_NO_BUFFERING 0x20000000 |
| 153 | #define SMB_EFA_WRITE_THROUGH 0x80000000 |
| 154 | |
| 155 | /* |
| 156 | * Access Mode Encoding |
| 157 | */ |
| 158 | #define SMB_AM_OPENREAD 0x0000 |
| 159 | #define SMB_AM_OPENWRITE 0x0001 |
| 160 | #define SMB_AM_OPENRW 0x0002 |
| 161 | #define SMB_AM_OPENEXEC 0x0003 |
| 162 | #define SMB_SM_COMPAT 0x0000 |
| 163 | #define SMB_SM_EXCLUSIVE 0x0010 |
| 164 | #define SMB_SM_DENYWRITE 0x0020 |
| 165 | #define SMB_SM_DENYREADEXEC 0x0030 |
| 166 | #define SMB_SM_DENYNONE 0x0040 |
| 167 | |
| 168 | /* |
| 169 | * Request flag defines - CIFS spec 3.1.1 via Samba |
| 170 | */ |
| 171 | #define SMB_FL_SUPPORT_LOCKREAD 0x01 |
| 172 | #define SMB_FL_CLIENT_BUF_AVAIL 0x02 |
| 173 | #define SMB_FL_RESERVED 0x04 |
| 174 | #define SMB_FL_CASELESS_PATHNAMES 0x08 |
| 175 | #define SMB_FL_CANONICAL_PATHNAMES 0x10 |
| 176 | #define SMB_FL_REQUEST_OPLOCK 0x20 |
| 177 | #define SMB_FL_REQUEST_BATCH_OPLOCK 0x40 |
| 178 | #define SMB_FL_REPLY 0x80 |
| 179 | |
| 180 | /* |
| 181 | * SMB commands |
| 182 | */ |
| 183 | #define SMB_COM_CREATE_DIRECTORY 0x00 |
| 184 | #define SMB_COM_DELETE_DIRECTORY 0x01 |
| 185 | #define SMB_COM_OPEN 0x02 |
| 186 | #define SMB_COM_CREATE 0x03 |
| 187 | #define SMB_COM_CLOSE 0x04 |
| 188 | #define SMB_COM_FLUSH 0x05 |
| 189 | #define SMB_COM_DELETE 0x06 |
| 190 | #define SMB_COM_RENAME 0x07 |
| 191 | #define SMB_COM_QUERY_INFORMATION 0x08 |
| 192 | #define SMB_COM_SET_INFORMATION 0x09 |
| 193 | #define SMB_COM_READ 0x0A |
| 194 | #define SMB_COM_WRITE 0x0B |
| 195 | #define SMB_COM_LOCK_BYTE_RANGE 0x0C |
| 196 | #define SMB_COM_UNLOCK_BYTE_RANGE 0x0D |
| 197 | #define SMB_COM_CREATE_TEMPORARY 0x0E |
| 198 | #define SMB_COM_CREATE_NEW 0x0F |
| 199 | #define SMB_COM_CHECK_DIRECTORY 0x10 |
| 200 | #define SMB_COM_PROCESS_EXIT 0x11 |
| 201 | #define SMB_COM_SEEK 0x12 |
| 202 | #define SMB_COM_LOCK_AND_READ 0x13 |
| 203 | #define SMB_COM_WRITE_AND_UNLOCK 0x14 |
| 204 | #define SMB_COM_READ_RAW 0x1A |
| 205 | #define SMB_COM_READ_MPX 0x1B |
| 206 | #define SMB_COM_READ_MPX_SECONDARY 0x1C |
| 207 | #define SMB_COM_WRITE_RAW 0x1D |
| 208 | #define SMB_COM_WRITE_MPX 0x1E |
| 209 | #define SMB_COM_WRITE_COMPLETE 0x20 |
| 210 | #define SMB_COM_SET_INFORMATION2 0x22 |
| 211 | #define SMB_COM_QUERY_INFORMATION2 0x23 |
| 212 | #define SMB_COM_LOCKING_ANDX 0x24 |
| 213 | #define SMB_COM_TRANSACTION 0x25 |
| 214 | #define SMB_COM_TRANSACTION_SECONDARY 0x26 |
| 215 | #define SMB_COM_IOCTL 0x27 |
| 216 | #define SMB_COM_IOCTL_SECONDARY 0x28 |
| 217 | #define SMB_COM_COPY 0x29 |
| 218 | #define SMB_COM_MOVE 0x2A |
| 219 | #define SMB_COM_ECHO 0x2B |
| 220 | #define SMB_COM_WRITE_AND_CLOSE 0x2C |
| 221 | #define SMB_COM_OPEN_ANDX 0x2D |
| 222 | #define SMB_COM_READ_ANDX 0x2E |
| 223 | #define SMB_COM_WRITE_ANDX 0x2F |
| 224 | #define SMB_COM_CLOSE_AND_TREE_DISC 0x31 |
| 225 | #define SMB_COM_TRANSACTION2 0x32 |
| 226 | #define SMB_COM_TRANSACTION2_SECONDARY 0x33 |
| 227 | #define SMB_COM_FIND_CLOSE2 0x34 |
| 228 | #define SMB_COM_FIND_NOTIFY_CLOSE 0x35 |
| 229 | #define SMB_COM_TREE_CONNECT 0x70 |
| 230 | #define SMB_COM_TREE_DISCONNECT 0x71 |
| 231 | #define SMB_COM_NEGOTIATE 0x72 |
| 232 | #define SMB_COM_SESSION_SETUP_ANDX 0x73 |
| 233 | #define SMB_COM_LOGOFF_ANDX 0x74 |
| 234 | #define SMB_COM_TREE_CONNECT_ANDX 0x75 |
| 235 | #define SMB_COM_QUERY_INFORMATION_DISK 0x80 |
| 236 | #define SMB_COM_SEARCH 0x81 |
| 237 | #define SMB_COM_FIND 0x82 |
| 238 | #define SMB_COM_FIND_UNIQUE 0x83 |
| 239 | #define SMB_COM_NT_TRANSACT 0xA0 |
| 240 | #define SMB_COM_NT_TRANSACT_SECONDARY 0xA1 |
| 241 | #define SMB_COM_NT_CREATE_ANDX 0xA2 |
| 242 | #define SMB_COM_NT_CANCEL 0xA4 |
| 243 | #define SMB_COM_OPEN_PRINT_FILE 0xC0 |
| 244 | #define SMB_COM_WRITE_PRINT_FILE 0xC1 |
| 245 | #define SMB_COM_CLOSE_PRINT_FILE 0xC2 |
| 246 | #define SMB_COM_GET_PRINT_QUEUE 0xC3 |
| 247 | #define SMB_COM_READ_BULK 0xD8 |
| 248 | #define SMB_COM_WRITE_BULK 0xD9 |
| 249 | #define SMB_COM_WRITE_BULK_DATA 0xDA |
| 250 | |
| 251 | /* |
| 252 | * SMB_COM_NT_TRANSACT subcommands |
| 253 | */ |
| 254 | #define SMB_NTTRANS_CREATE 0x01 |
| 255 | #define SMB_NTTRANS_IOCTL 0x02 |
| 256 | #define SMB_NTTRANS_SET_SEC_DESC 0x03 /* Set Security Descriptor */ |
| 257 | #define SMB_NTTRANS_NOTIFY_CHANGE 0x04 /* Directory Change Notify */ |
| 258 | #define SMB_NTTRANS_RENAME 0x05 |
| 259 | #define SMB_NTTRANS_QUERY_SEC_DESC 0x06 /* Query Security Descriptor */ |
| 260 | |
| 261 | /* |
| 262 | * NT TRANSACT NOTIFY CHANGE CompletionFilter flags |
| 263 | */ |
| 264 | #define FILE_NOTIFY_CHANGE_FILE_NAME 0x00000001 |
| 265 | #define FILE_NOTIFY_CHANGE_DIR_NAME 0x00000002 |
| 266 | #define FILE_NOTIFY_CHANGE_NAME 0x00000003 |
| 267 | #define FILE_NOTIFY_CHANGE_ATTRIBUTES 0x00000004 |
| 268 | #define FILE_NOTIFY_CHANGE_SIZE 0x00000008 |
| 269 | #define FILE_NOTIFY_CHANGE_LAST_WRITE 0x00000010 |
| 270 | #define FILE_NOTIFY_CHANGE_LAST_ACCESS 0x00000020 |
| 271 | #define FILE_NOTIFY_CHANGE_CREATION 0x00000040 |
| 272 | #define FILE_NOTIFY_CHANGE_EA 0x00000080 |
| 273 | #define FILE_NOTIFY_CHANGE_SECURITY 0x00000100 |
| 274 | #define FILE_NOTIFY_CHANGE_STREAM_NAME 0x00000200 |
| 275 | #define FILE_NOTIFY_CHANGE_STREAM_SIZE 0x00000400 |
| 276 | #define FILE_NOTIFY_CHANGE_STREAM_WRITE 0x00000800 |
| 277 | |
| 278 | /* |
| 279 | * NT TRANSACT NOTIFY CHANGE Action |
| 280 | */ |
| 281 | #define FILE_ACTION_ADDED 0x00000001 |
| 282 | #define FILE_ACTION_REMOVED 0x00000002 |
| 283 | #define FILE_ACTION_MODIFIED 0x00000003 |
| 284 | #define FILE_ACTION_RENAMED_OLD_NAME 0x00000004 |
| 285 | #define FILE_ACTION_RENAMED_NEW_NAME 0x00000005 |
| 286 | #define FILE_ACTION_ADDED_STREAM 0x00000006 |
| 287 | #define FILE_ACTION_REMOVED_STREAM 0x00000007 |
| 288 | #define FILE_ACTION_MODIFIED_STREAM 0x00000008 |
| 289 | |
| 290 | /* |
| 291 | * Some contansts for NT CREATE AND X |
| 292 | */ |
| 293 | #define NT_FILE_DIRECTORY_FILE 0x0001 |
| 294 | |
| 295 | /* perms */ |
| 296 | #define NT_FILE_LIST_DIRECTORY 0x0001 |
| 297 | |
| 298 | /* share types */ |
| 299 | #define NT_FILE_SHARE_READ 0x0001 |
| 300 | #define NT_FILE_SHARE_WRITE 0x0002 |
| 301 | #define NT_FILE_SHARE_DELETE 0x0004 |
| 302 | |
| 303 | /* open types - create disposition */ |
| 304 | #define NT_OPEN_EXISTING 0x0001 |
| 305 | #define NT_OPEN_CREATE 0x0002 |
| 306 | |
| 307 | /* |
| 308 | * TRANS2 commands |
| 309 | */ |
| 310 | #define SMB_TRANS2_OPEN2 0x00 |
| 311 | #define SMB_TRANS2_FIND_FIRST2 0x01 |
| 312 | #define SMB_TRANS2_FIND_NEXT2 0x02 |
| 313 | #define SMB_TRANS2_QUERY_FS_INFORMATION 0x03 |
| 314 | #define SMB_TRANS2_QUERY_PATH_INFORMATION 0x05 |
| 315 | #define SMB_TRANS2_SET_PATH_INFORMATION 0x06 |
| 316 | #define SMB_TRANS2_QUERY_FILE_INFORMATION 0x07 |
| 317 | #define SMB_TRANS2_SET_FILE_INFORMATION 0x08 |
| 318 | #define SMB_TRANS2_FSCTL 0x09 |
| 319 | #define SMB_TRANS2_IOCTL2 0x0A |
| 320 | /* Start monitoring a directory for changes */ |
| 321 | #define SMB_TRANS2_FIND_NOTIFY_FIRST 0x0B |
| 322 | /* Continue monitoring a directory for changes */ |
| 323 | #define SMB_TRANS2_FIND_NOTIFY_NEXT 0x0C |
| 324 | #define SMB_TRANS2_CREATE_DIRECTORY 0x0D |
| 325 | #define SMB_TRANS2_SESSION_SETUP 0x0E |
| 326 | #define SMB_TRANS2_GET_DFS_REFERRAL 0x10 |
| 327 | #define SMB_TRANS2_REPORT_DFS_INCONSISTENCY 0x11 |
| 328 | |
| 329 | /* |
| 330 | * SMB_TRANS2_QUERY_FS_INFORMATION levels |
| 331 | */ |
| 332 | #define SMB_INFO_ALLOCATION 1 |
| 333 | #define SMB_INFO_VOLUME 2 |
| 334 | #define SMB_QUERY_FS_VOLUME_INFO 0x102 |
| 335 | #define SMB_QUERY_FS_SIZE_INFO 0x103 |
| 336 | #define SMB_QUERY_FS_DEVICE_INFO 0x104 |
| 337 | #define SMB_QUERY_FS_ATTRIBUTE_INFO 0x105 |
| 338 | |
| 339 | /* |
| 340 | * SMB_TRANS2_QUERY_PATH levels |
| 341 | */ |
| 342 | #define SMB_QUERY_FILE_STANDARD 1 |
| 343 | #define SMB_QUERY_FILE_EA_SIZE 2 |
| 344 | #define SMB_QUERY_FILE_EAS_FROM_LIST 3 |
| 345 | #define SMB_QUERY_FILE_ALL_EAS 4 |
| 346 | #define SMB_QUERY_FILE_IS_NAME_VALID 6 |
| 347 | #define SMB_QUERY_FILE_BASIC_INFO 0x101 |
| 348 | #define SMB_QUERY_FILE_STANDARD_INFO 0x102 |
| 349 | #define SMB_QUERY_FILE_EA_INFO 0x103 |
| 350 | #define SMB_QUERY_FILE_NAME_INFO 0x104 |
| 351 | #define SMB_QUERY_FILE_ALL_INFO 0x107 |
| 352 | #define SMB_QUERY_FILE_ALT_NAME_INFO 0x108 |
| 353 | #define SMB_QUERY_FILE_STREAM_INFO 0x109 |
| 354 | #define SMB_QUERY_FILE_COMPRESSION_INFO 0x10b |
| 355 | #define SMB_QUERY_FILE_UNIX_BASIC 0x200 |
| 356 | #define SMB_QUERY_FILE_UNIX_LINK 0x201 |
| 357 | #define SMB_QUERY_FILE_MAC_DT_GET_APPL 0x306 |
| 358 | #define SMB_QUERY_FILE_MAC_DT_GET_ICON 0x307 |
| 359 | #define SMB_QUERY_FILE_MAC_DT_GET_ICON_INFO 0x308 |
| 360 | |
| 361 | /* |
| 362 | * SMB_TRANS2_FIND_FIRST2 information levels |
| 363 | */ |
| 364 | #define SMB_INFO_STANDARD 1 |
| 365 | #define SMB_INFO_QUERY_EA_SIZE 2 |
| 366 | #define SMB_INFO_QUERY_EAS_FROM_LIST 3 |
| 367 | #define SMB_FIND_FILE_DIRECTORY_INFO 0x101 |
| 368 | #define SMB_FIND_FULL_DIRECTORY_INFO 0x102 |
| 369 | #define SMB_FIND_FILE_NAMES_INFO 0x103 |
| 370 | #define SMB_FIND_BOTH_DIRECTORY_INFO 0x104 |
| 371 | |
| 372 | /* |
| 373 | * Set PATH/FILE information levels |
| 374 | */ |
| 375 | #define SMB_SET_FILE_BASIC_INFO 0x101 |
| 376 | #define SMB_SET_FILE_END_OF_FILE_INFO 0x104 |
| 377 | #define SMB_SET_FILE_BASIC_INFORMATION 1004 |
| 378 | |
| 379 | /* |
| 380 | * LOCKING_ANDX LockType flags |
| 381 | */ |
| 382 | #define SMB_LOCKING_ANDX_SHARED_LOCK 0x01 |
| 383 | #define SMB_LOCKING_ANDX_OPLOCK_RELEASE 0x02 |
| 384 | #define SMB_LOCKING_ANDX_CHANGE_LOCKTYPE 0x04 |
| 385 | #define SMB_LOCKING_ANDX_CANCEL_LOCK 0x08 |
| 386 | #define SMB_LOCKING_ANDX_LARGE_FILES 0x10 |
| 387 | |
| 388 | /* |
| 389 | * Some names length limitations. Some of them aren't declared by specs, |
| 390 | * but we need reasonable limits. |
| 391 | */ |
| 392 | #define SMB_MAXSRVNAMELEN 15 /* NetBIOS limit */ |
| 393 | #define SMB_MAXUSERNAMELEN 128 |
| 394 | #define SMB_MAXPASSWORDLEN 128 |
| 395 | #define SMB_MAXSHARENAMELEN 128 |
| 396 | #define SMB_MAXPKTLEN 0x1FFFF |
| 397 | #define SMB_MAXCHALLENGELEN 8 |
| 398 | #define SMB_MAXNAMLEN 255 |
| 399 | |
| 400 | #define SMB_MAXRCN 3 /* number of reconnect attempts */ |
| 401 | |
| 402 | /* |
| 403 | * Error classes |
| 404 | */ |
| 405 | #define SMBSUCCESS 0x00 |
| 406 | #define ERRDOS 0x01 |
| 407 | #define ERRSRV 0x02 |
| 408 | #define ERRHRD 0x03 /* Error is a hardware error. */ |
| 409 | #define ERRCMD 0xFF /* Command was not in the "SMB" format. */ |
| 410 | |
| 411 | /* |
| 412 | * Error codes for the ERRDOS class |
| 413 | */ |
| 414 | #define ERRbadfunc 1 /* Invalid function */ |
| 415 | #define ERRbadfile 2 /* File not found (last component) */ |
| 416 | #define ERRbadpath 3 /* Directory invalid */ |
| 417 | #define ERRnofids 4 /* Too many open files */ |
| 418 | #define ERRnoaccess 5 /* Access denied */ |
| 419 | #define ERRbadfid 6 /* Invalid file handle */ |
| 420 | #define ERRbadmcb 7 /* Memory control blocks destroyed (huh ?) */ |
| 421 | #define ERRnomem 8 /* Insufficient memory */ |
| 422 | #define ERRbadmem 9 /* Invalid memory block address */ |
| 423 | #define ERRbadenv 10 /* Invalid environment */ |
| 424 | #define ERRbadformat 11 /* Invalid format */ |
| 425 | #define ERRbadaccess 12 /* Invalid open mode */ |
| 426 | #define ERRbaddata 13 /* Invalid data */ |
| 427 | #define ERRbaddrive 15 /* Invalid drive specified */ |
| 428 | #define ERRremcd 16 /* An attempt to delete current directory */ |
| 429 | #define ERRdiffdevice 17 /* cross fs rename/move */ |
| 430 | #define ERRnofiles 18 /* no more files found in file search */ |
| 431 | #define ERRbadshare 32 /* Share mode can't be granted */ |
| 432 | #define ERRlock 33 /* A lock request conflicts with existing lock */ |
| 433 | #define ERRunsup 50 /* unsupported - Win 95 */ |
| 434 | #define ERRnoipc 66 /* Bad Device Type */ |
| 435 | #define ERRnosuchshare 67 /* Bad Network Name */ |
| 436 | #define ERRfilexists 80 /* The file named in the request already exists */ |
| 437 | #define ERRcannotopen 110 /* cannot open the file */ |
| 438 | #define ERRquota 112 /* W2K returns this if quota space exceeds */ |
| 439 | #define ERRinvalidname 123 /* Invalid Name */ |
| 440 | #define ERRunknownlevel 124 |
| 441 | #define ERRdirnempty 145 /* Directory Not Empty */ |
| 442 | #define ERRnotlocked 158 /* region was not locked by this context */ |
| 443 | #define ERRrename 183 /* Already Exists */ |
| 444 | #define ERRbadpipe 230 /* named pipe invalid */ |
| 445 | #define ERRpipebusy 231 /* all pipe instances are busy */ |
| 446 | #define ERRpipeclosing 232 /* close in progress */ |
| 447 | #define ERRnotconnected 233 /* nobody on other end of pipe */ |
| 448 | #define ERRmoredata 234 /* more data to be returned */ |
| 449 | #define ERRbaddirectory 267 /* invalid directory name */ |
| 450 | #define ERReasunsupported 282 /* extended attributes not supported */ |
| 451 | #define ERRunknownipc 2142 |
| 452 | #define ERRbuftoosmall 2123 |
| 453 | #define ERRnosuchprintjob 2151 |
| 454 | |
| 455 | /* |
| 456 | * Error codes for the ERRSRV class |
| 457 | */ |
| 458 | #define ERRerror 1 /* Non-specific error code */ |
| 459 | #define ERRbadpw 2 /* Bad password */ |
| 460 | #define ERRbadtype 3 /* Reserved - Bad Device Type */ |
| 461 | #define ERRaccess 4 /* The client doesn't have enough access rights */ |
| 462 | #define ERRinvnid 5 /* The Tid specified in a command is invalid */ |
| 463 | #define ERRinvnetname 6 /* Invalid server name in the tree connect */ |
| 464 | #define ERRinvdevice 7 /* Printer and not printer devices are mixed */ |
| 465 | #define ERRqfull 49 /* Print queue full */ |
| 466 | #define ERRqtoobig 50 /* Print queue full - no space */ |
| 467 | #define ERRinvpfid 52 /* Invalid print file FID */ |
| 468 | #define ERRsmbcmd 64 /* The server did not recognize the command */ |
| 469 | #define ERRsrverror 65 /* The server encountered and internal error */ |
| 470 | #define ERRfilespecs 67 /* The Fid and path name contains an invalid combination */ |
| 471 | #define ERRbadpermits 69 /* Access mode invalid */ |
| 472 | #define ERRsetattrmode 71 /* Attribute mode invalid */ |
| 473 | #define ERRpaused 81 /* Server is paused */ |
| 474 | #define ERRmsgoff 82 /* Not receiving messages */ |
| 475 | #define ERRnoroom 83 /* No room to buffer message */ |
| 476 | #define ERRrmuns 87 /* Too many remote user names */ |
| 477 | #define ERRtimeout 88 /* Operation timed out */ |
| 478 | #define ERRnoresource 89 /* No resources currently available for request */ |
| 479 | #define ERRtoomanyuids 90 /* Too many UIDs active on this session */ |
| 480 | #define ERRbaduid 91 /* The UID is not known in this session */ |
| 481 | #define ERRusempx 250 /* Temporarily unable to support Raw, use MPX mode */ |
| 482 | #define ERRusestd 251 /* Temporarily unable to support Raw, use standard r/w */ |
| 483 | #define ERRcontmpx 252 /* Continue in MPX mode */ |
| 484 | #define ERRbadPassword 254 |
| 485 | #define ERRaccountExpired 2239 |
| 486 | #define ERRbadClient 2240 /* Cannot access the server from this workstation */ |
| 487 | #define ERRbadLogonTime 2241 /* Cannot access the server at this time */ |
| 488 | #define ERRpasswordExpired 2242 |
| 489 | #define ERRnosupport 65535 /* Invalid function */ |
| 490 | |
| 491 | /* |
| 492 | * Error codes for the ERRHRD class |
| 493 | */ |
| 494 | #define ERRnowrite 19 /* write protected media */ |
| 495 | #define ERRbadunit 20 /* Unknown unit */ |
| 496 | #define ERRnotready 21 /* Drive not ready */ |
| 497 | #define ERRbadcmd 22 /* Unknown command */ |
| 498 | #define ERRdata 23 /* Data error (CRC) */ |
| 499 | #define ERRbadreq 24 /* Bad request structure length */ |
| 500 | #define ERRseek 25 /* Seek error */ |
| 501 | #define ERRbadmedia 26 /* Unknown media type */ |
| 502 | #define ERRbadsector 27 /* Sector not found */ |
| 503 | #define ERRnopaper 28 /* Printer out of paper */ |
| 504 | #define ERRwrite 29 /* Write fault */ |
| 505 | #define ERRread 30 /* Read fault */ |
| 506 | #define ERRgeneral 31 /* General failure */ |
| 507 | #define ERRbadshare 32 /* An open conflicts with an existing open */ |
| 508 | #define ERRlock 33 /* lock/unlock conflict */ |
| 509 | #define ERRwrongdisk 34 /* The wrong disk was found in a drive */ |
| 510 | #define ERRFCBunavail 35 /* No FCBs available */ |
| 511 | #define ERRsharebufexc 36 /* A sharing buffer has been exceeded */ |
| 512 | #define ERRdiskfull 39 |
| 513 | |
| 514 | /* |
| 515 | * RAP error codes (it seems that they returned not only by RAP) |
| 516 | */ |
| 517 | #define SMB_ERROR_ACCESS_DENIED 5 |
| 518 | #define SMB_ERROR_NETWORK_ACCESS_DENIED 65 |
| 519 | #define SMB_ERROR_MORE_DATA 234 |
| 520 | |
| 521 | /* |
| 522 | * Error message returned from NT Directory Change Notify if |
| 523 | * where are too many directory notifications and directory should |
| 524 | * be just enumerated. |
| 525 | */ |
| 526 | #define NT_STATUS_NOTIFY_ENUM_DIR 1022 |
| 527 | |
| 528 | typedef u_int16_t smbfh; |
| 529 | |
| 530 | #endif /* !_NETSMB_SMB_H_ */ |
| 531 | |