23  *    may be used to endorse or promote products derived from this software
  24  *    without specific prior written permission.
  25  *
  26  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  27  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  28  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  29  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
  30  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  31  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  32  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  33  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  34  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  35  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  36  * SUCH DAMAGE.
  37  *
  38  * $Id: smb.h,v 1.36.90.1 2005/05/27 02:35:29 lindak Exp $
  39  */
  40 
  41 /*
  42  * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
  43  */
  44 
  45 #ifndef _NETSMB_SMB_H_
  46 #define _NETSMB_SMB_H_
  47 
  48 /*
  49  * Common definitions and structures for SMB/CIFS protocol
  50  * This file should be purely SMB protocol definition stuff.
  51  * (Please don't make it a catch-all:)
  52  */
  53 
  54 #include <smb/doserror.h>
  55 #include <smb/lmerr.h>
  56 #include <smb/nterror.h>
  57 #include <smb/ntstatus.h>
  58 
  59 /*
  60  * SMB dialects that we have to deal with.
  61  */
  62 enum smb_dialects {
  63         SMB_DIALECT_NONE,
  64         SMB_DIALECT_CORE,               /* PC NETWORK PROGRAM 1.0, PCLAN1.0 */
  65         SMB_DIALECT_COREPLUS,           /* MICROSOFT NETWORKS 1.03 */
  66         SMB_DIALECT_LANMAN1_0,          /* MICROSOFT NETWORKS 3.0, LANMAN1.0 */
  67         SMB_DIALECT_LANMAN2_0,          /* LM1.2X002, DOS LM1.2X002, Samba */
  68         SMB_DIALECT_LANMAN2_1,          /* DOS LANMAN2.1, LANMAN2.1 */
  69         SMB_DIALECT_NTLM0_12            /* NT LM 0.12, Windows for Workgroups */
  70                                         /* 3.1a, * NT LANMAN 1.0 */
  71 };
  72 
  73 /*
  74  * Formats of data/string buffers
  75  */
  76 #define SMB_DT_DATA             1
  77 #define SMB_DT_DIALECT          2
  78 #define SMB_DT_PATHNAME         3
  79 #define SMB_DT_ASCII            4
  80 #define SMB_DT_VARIABLE         5
  81 
  82 /*
  83  * SMB header
  84  */
  85 #define SMB_SIGNATURE           "\xFFSMB"
  86 #define SMB_SIGLEN              4
  87 #define SMB_HDRCMD(p)           (*((uchar_t *)(p) + SMB_SIGLEN))
  88 #define SMB_HDRMID(p)           (*(ushort_t *)((uchar_t *)(p) + 30))
  89 #define SMB_HDRLEN              32
  90 /*
  91  * bits in the smb_flags field
  92  */
  93 #define SMB_FLAGS_SUPPORT_LOCKREAD      0x01
  94 #define SMB_FLAGS_CLIENT_BUF_AVAIL      0x02
  95 #define SMB_FLAGS_CASELESS              0x08
  96 #define SMB_FLAGS_CANONICAL_PATHNAMES   0x10
  97 #define SMB_FLAGS_REQUEST_OPLOCK        0x20
  98 #define SMB_FLAGS_REQUEST_BATCH_OPLOCK  0x40
  99 #define SMB_FLAGS_SERVER_RESP           0x80
 100 
 101 /*
 102  * bits in the smb_flags2 field
 103  */
 104 #define SMB_FLAGS2_KNOWS_LONG_NAMES     0x0001
 105 #define SMB_FLAGS2_KNOWS_EAS            0x0002  /* client know about EAs */
 106 #define SMB_FLAGS2_SECURITY_SIGNATURE   0x0004  /* check SMB integrity */
 107 #define SMB_FLAGS2_IS_LONG_NAME         0x0040  /* any path name is long name */
 108 #define SMB_FLAGS2_EXT_SEC              0x0800  /* client aware of Extended */
 109                                                 /* Security negotiation */
 
 134  */
 135 #define SMB_CAP_RAW_MODE                0x0001
 136 #define SMB_CAP_MPX_MODE                0x0002
 137 #define SMB_CAP_UNICODE                 0x0004
 138 #define SMB_CAP_LARGE_FILES             0x0008  /* 64 bit offsets supported */
 139 #define SMB_CAP_NT_SMBS                 0x0010
 140 #define SMB_CAP_RPC_REMOTE_APIS         0x0020
 141 #define SMB_CAP_STATUS32                0x0040
 142 #define SMB_CAP_LEVEL_II_OPLOCKS        0x0080
 143 #define SMB_CAP_LOCK_AND_READ           0x0100
 144 #define SMB_CAP_NT_FIND                 0x0200
 145 #define SMB_CAP_DFS                     0x1000
 146 #define SMB_CAP_INFOLEVEL_PASSTHRU      0x2000
 147 #define SMB_CAP_LARGE_READX             0x4000
 148 #define SMB_CAP_LARGE_WRITEX            0x8000
 149 #define SMB_CAP_UNIX                    0x00800000
 150 #define SMB_CAP_BULK_TRANSFER           0x20000000
 151 #define SMB_CAP_COMPRESSED_DATA         0x40000000
 152 #define SMB_CAP_EXT_SECURITY            0x80000000
 153 
 154 /*
 155  * File attributes
 156  */
 157 #define SMB_FA_RDONLY           0x01
 158 #define SMB_FA_HIDDEN           0x02
 159 #define SMB_FA_SYSTEM           0x04
 160 #define SMB_FA_VOLUME           0x08
 161 #define SMB_FA_DIR              0x10
 162 #define SMB_FA_ARCHIVE          0x20
 163 
 164 /*
 165  * Extended file attributes
 166  */
 167 #define SMB_EFA_RDONLY                  0x00000001
 168 #define SMB_EFA_HIDDEN                  0x00000002
 169 #define SMB_EFA_SYSTEM                  0x00000004
 170 #define SMB_EFA_VOLUME                  0x00000008
 171 #define SMB_EFA_DIRECTORY               0x00000010
 172 #define SMB_EFA_ARCHIVE                 0x00000020
 173 #define SMB_EFA_DEVICE                  0x00000040
 174 #define SMB_EFA_NORMAL                  0x00000080
 
 
 355 #define NT_TRANSACT_CREATE              0x01
 356 #define NT_TRANSACT_IOCTL               0x02
 357 #define NT_TRANSACT_SET_SECURITY_DESC   0x03
 358 #define NT_TRANSACT_NOTIFY_CHANGE       0x04
 359 #define NT_TRANSACT_RENAME              0x05
 360 #define NT_TRANSACT_QUERY_SECURITY_DESC 0x06
 361 #define NT_TRANSACT_GET_USER_QUOTA      0x07
 362 #define NT_TRANSACT_SET_USER_QUOTA      0x08
 363 
 364 /*
 365  * SMB_TRANS2_QUERY_FS_INFORMATION levels
 366  */
 367 #define SMB_QFS_ALLOCATION                      1
 368 #define SMB_QFS_VOLUME                          2
 369 #define SMB_QFS_LABEL_INFO                      0x101
 370 #define SMB_QFS_VOLUME_INFO                     0x102
 371 #define SMB_QFS_SIZE_INFO                       0x103
 372 #define SMB_QFS_DEVICE_INFO                     0x104
 373 #define SMB_QFS_ATTRIBUTE_INFO                  0x105
 374 #define SMB_QFS_UNIX_INFO                       0x200
 375 #define SMB_QFS_MAC_FS_INFO                     0x301
 376 #define SMB_QFS_VOLUME_INFORMATION              1001
 377 #define SMB_QFS_SIZE_INFORMATION                1003
 378 #define SMB_QFS_DEVICE_INFORMATION              1004
 379 #define SMB_QFS_ATTRIBUTE_INFORMATION           1005
 380 #define SMB_QFS_QUOTA_INFORMATION               1006
 381 #define SMB_QFS_FULL_SIZE_INFORMATION           1007
 382 #define SMB_QFS_OBJECTID_INFORMATION            1008
 383 
 384 
 385 /*
 386  * SMB_QFS_ATTRIBUTE_INFO bits.
 387  * The following info found in msdn
 388  * (http://msdn.microsoft.com/library/default.asp?
 389  * url=/library/en-us/wmisdk/wmi/win32_cdromdrive.asp)
 390  * Naming is mostly as in samba, to help Those Who Google.
 391  */
 392 #define FILE_CASE_SENSITIVE_SEARCH      0x00000001
 393 #define FILE_CASE_PRESERVED_NAMES       0x00000002
 394 #define FILE_UNICODE_ON_DISK            0x00000004
 395 #define FILE_PERSISTENT_ACLS            0x00000008
 396 #define FILE_FILE_COMPRESSION           0x00000010
 397 #define FILE_VOLUME_QUOTAS              0x00000020
 398 #define FILE_SUPPORTS_SPARSE_FILES      0x00000040
 399 #define FILE_SUPPORTS_REPARSE_POINTS    0x00000080
 400 #define FILE_SUPPORTS_REMOTE_STORAGE    0x00000100
 401 #define FILE_SUPPORTS_LONG_NAMES        0x00004000
 402 #define FILE_VOLUME_IS_COMPRESSED       0x00008000
 403 #define FILE_SUPPORTS_OBJECT_IDS        0x00010000
 404 #define FILE_SUPPORTS_ENCRYPTION        0x00020000
 405 #define FILE_NAMED_STREAMS              0x00040000
 406 
 407 /*
 408  * SMB_TRANS2_QUERY_PATH levels
 409  */
 410 #define SMB_QFILEINFO_STANDARD                  1
 411 #define SMB_QFILEINFO_EA_SIZE                   2
 412 #define SMB_QFILEINFO_EAS_FROM_LIST             3
 413 #define SMB_QFILEINFO_ALL_EAS                   4
 414 #define SMB_QFILEINFO_IS_NAME_VALID             6       /* QPATHINFO only? */
 415 #define SMB_QFILEINFO_BASIC_INFO                0x101
 416 #define SMB_QFILEINFO_STANDARD_INFO             0x102
 417 #define SMB_QFILEINFO_EA_INFO                   0x103
 418 #define SMB_QFILEINFO_NAME_INFO                 0x104
 419 #define SMB_QFILEINFO_ALLOCATION_INFO           0x105
 420 #define SMB_QFILEINFO_END_OF_FILE_INFO          0x106
 421 #define SMB_QFILEINFO_ALL_INFO                  0x107
 422 #define SMB_QFILEINFO_ALT_NAME_INFO             0x108
 423 #define SMB_QFILEINFO_STREAM_INFO               0x109
 424 #define SMB_QFILEINFO_COMPRESSION_INFO          0x10b
 425 #define SMB_QFILEINFO_UNIX_BASIC                0x200
 426 #define SMB_QFILEINFO_UNIX_LINK                 0x201
 427 #define SMB_QFILEINFO_MAC_DT_GET_APPL           0x306
 428 #define SMB_QFILEINFO_MAC_DT_GET_ICON           0x307
 429 #define SMB_QFILEINFO_MAC_DT_GET_ICON_INFO      0x308
 430 #define SMB_QFILEINFO_BASIC_INFORMATION         1004
 431 #define SMB_QFILEINFO_STANDARD_INFORMATION      1005
 432 #define SMB_QFILEINFO_INTERNAL_INFORMATION      1006
 433 #define SMB_QFILEINFO_EA_INFORMATION            1007
 434 #define SMB_QFILEINFO_ACCESS_INFORMATION        1008
 435 #define SMB_QFILEINFO_NAME_INFORMATION          1009
 436 #define SMB_QFILEINFO_POSITION_INFORMATION      1014
 437 #define SMB_QFILEINFO_MODE_INFORMATION          1016
 438 #define SMB_QFILEINFO_ALIGNMENT_INFORMATION     1017
 439 #define SMB_QFILEINFO_ALL_INFORMATION           1018
 440 #define SMB_QFILEINFO_ALT_NAME_INFORMATION      1021
 441 #define SMB_QFILEINFO_STREAM_INFORMATION        1022
 442 #define SMB_QFILEINFO_COMPRESSION_INFORMATION   1028
 443 #define SMB_QFILEINFO_NETWORK_OPEN_INFORMATION  1034
 444 #define SMB_QFILEINFO_ATTRIBUTE_TAG_INFORMATION 1035
 445 
 446 /*
 447  * SMB_TRANS2_FIND_FIRST2 information levels
 448  */
 449 #define SMB_FIND_STANDARD               1
 450 #define SMB_FIND_EA_SIZE                2
 451 #define SMB_FIND_EAS_FROM_LIST          3
 452 #define SMB_FIND_DIRECTORY_INFO         0x101
 453 #define SMB_FIND_FULL_DIRECTORY_INFO    0x102
 454 #define SMB_FIND_NAME_INFO              0x103
 455 #define SMB_FIND_BOTH_DIRECTORY_INFO    0x104
 456 #define SMB_FIND_UNIX_INFO              0x200
 457 
 458 /*
 459  * Selectors for NT_TRANSACT_QUERY_SECURITY_DESC and
 460  * NT_TRANSACT_SET_SECURITY_DESC.  Details found in the MSDN
 461  * library by searching on security_information.
 462  * Note the protected/unprotected bits did not exist in NT.
 463  */
 464 
 465 #define OWNER_SECURITY_INFORMATION              0x00000001
 466 #define GROUP_SECURITY_INFORMATION              0x00000002
 467 #define DACL_SECURITY_INFORMATION               0x00000004
 468 #define SACL_SECURITY_INFORMATION               0x00000008
 469 #define UNPROTECTED_SACL_SECURITY_INFORMATION   0x10000000
 470 #define UNPROTECTED_DACL_SECURITY_INFORMATION   0x20000000
 471 #define PROTECTED_SACL_SECURITY_INFORMATION     0x40000000
 472 #define PROTECTED_DACL_SECURITY_INFORMATION     0x80000000
 473 
 474 /*
 475  * security descriptor header
 476  * it is followed by the optional SIDs and ACLs
 
 
 690 #define NO_PROPAGATE_INHERIT_ACE_FLAG           0x04
 691 #define INHERIT_ONLY_ACE_FLAG                   0x08
 692 #define INHERITED_ACE_FLAG                      0x10
 693 #define UNDEF_ACE_FLAG                          0x20 /* MS doesn't define it */
 694 #define VALID_INHERIT_ACE_FLAGS                 0x1F
 695 #define SUCCESSFUL_ACCESS_ACE_FLAG              0x40
 696 #define FAILED_ACCESS_ACE_FLAG                  0x80
 697 
 698 /*
 699  * Set PATH/FILE information levels
 700  */
 701 #define SMB_SFILEINFO_STANDARD                  1
 702 #define SMB_SFILEINFO_EA_SET                    2
 703 #define SMB_SFILEINFO_BASIC_INFO                0x101
 704 #define SMB_SFILEINFO_DISPOSITION_INFO          0x102
 705 #define SMB_SFILEINFO_ALLOCATION_INFO           0x103
 706 #define SMB_SFILEINFO_END_OF_FILE_INFO          0x104
 707 #define SMB_SFILEINFO_UNIX_BASIC                0x200
 708 #define SMB_SFILEINFO_UNIX_LINK                 0x201
 709 #define SMB_SFILEINFO_UNIX_HLINK                0x203
 710 #define SMB_SFILEINFO_DIRECTORY_INFORMATION     1001
 711 #define SMB_SFILEINFO_FULL_DIRECTORY_INFORMATION        1002
 712 #define SMB_SFILEINFO_BOTH_DIRECTORY_INFORMATION        1003
 713 #define SMB_SFILEINFO_BASIC_INFORMATION         1004
 714 #define SMB_SFILEINFO_STANDARD_INFORMATION      1005
 715 #define SMB_SFILEINFO_INTERNAL_INFORMATION      1006
 716 #define SMB_SFILEINFO_EA_INFORMATION            1007
 717 #define SMB_SFILEINFO_ACCESS_INFORMATION        1008
 718 #define SMB_SFILEINFO_NAME_INFORMATION          1009
 719 #define SMB_SFILEINFO_RENAME_INFORMATION        1010
 720 #define SMB_SFILEINFO_LINK_INFORMATION          1011
 721 #define SMB_SFILEINFO_NAMES_INFORMATION         1012
 722 #define SMB_SFILEINFO_DISPOSITION_INFORMATION   1013
 723 #define SMB_SFILEINFO_POSITION_INFORMATION      1014
 724 #define SMB_SFILEINFO_1015                      1015 /* ? */
 725 #define SMB_SFILEINFO_MODE_INFORMATION          1016
 726 #define SMB_SFILEINFO_ALIGNMENT_INFORMATION     1017
 727 #define SMB_SFILEINFO_ALL_INFORMATION           1018
 728 #define SMB_SFILEINFO_ALLOCATION_INFORMATION    1019
 729 #define SMB_SFILEINFO_END_OF_FILE_INFORMATION   1020
 
 
 799 #define TRANS_SET_NAMED_PIPE_HAND_STATE 0x01    /* set pipe handle modes */
 800 #define TRANS_Q_NAMED_PIPE_INFO         0x22    /* query pipe attributes */
 801 #define TRANS_TRANSACT_NAMED_PIPE       0x26    /* r/w operation on pipe */
 802 #define TRANS_READ_NAMED_PIPE           0x11    /* read pipe in "raw" mode */
 803                                                 /* (non message mode) */
 804 #define TRANS_WRITE_NAMED_PIPE          0x31    /* write pipe "raw" mode */
 805                                                 /* (non message mode) */
 806 
 807 /*
 808  * Share types, visible via NetShareEnum
 809  */
 810 #define STYPE_DISKTREE                  0x00000000
 811 #define STYPE_PRINTQ                    0x00000001
 812 #define STYPE_DEVICE                    0x00000002
 813 #define STYPE_IPC                       0x00000003
 814 #define STYPE_UNKNOWN                   0x00000004
 815 #define STYPE_MASK                      0x0000000F
 816 #define STYPE_TEMPORARY                 0x40000000
 817 #define STYPE_HIDDEN                    0x80000000
 818 
 819 #endif /* _NETSMB_SMB_H_ */
  | 
 
 
  23  *    may be used to endorse or promote products derived from this software
  24  *    without specific prior written permission.
  25  *
  26  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  27  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  28  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  29  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
  30  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  31  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  32  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  33  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  34  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  35  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  36  * SUCH DAMAGE.
  37  *
  38  * $Id: smb.h,v 1.36.90.1 2005/05/27 02:35:29 lindak Exp $
  39  */
  40 
  41 /*
  42  * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
  43  * Copyright 2018 Nexenta Systems, Inc.  All rights reserved.
  44  */
  45 
  46 #ifndef _NETSMB_SMB_H_
  47 #define _NETSMB_SMB_H_
  48 
  49 /*
  50  * Common definitions and structures for SMB/CIFS protocol
  51  * This file should be purely SMB protocol definition stuff.
  52  * (Please don't make it a catch-all:)
  53  */
  54 
  55 #include <smb/doserror.h>
  56 #include <smb/lmerr.h>
  57 #include <smb/nterror.h>
  58 #include <smb/ntstatus.h>
  59 
  60 /*
  61  * SMB dialects that we have to deal with.
  62  */
  63 enum smb_dialects {
  64         SMB_DIALECT_NONE,
  65         SMB_DIALECT_CORE,               /* PC NETWORK PROGRAM 1.0, PCLAN1.0 */
  66         SMB_DIALECT_COREPLUS,           /* MICROSOFT NETWORKS 1.03 */
  67         SMB_DIALECT_LANMAN1_0,          /* MICROSOFT NETWORKS 3.0, LANMAN1.0 */
  68         SMB_DIALECT_LANMAN2_0,          /* LM1.2X002, DOS LM1.2X002, Samba */
  69         SMB_DIALECT_LANMAN2_1,          /* DOS LANMAN2.1, LANMAN2.1 */
  70         SMB_DIALECT_NTLM0_12,           /* NT LM 0.12, etc. */
  71         SMB_DIALECT_SMB2_FF             /* SMB1 negotiate to SMB2 */
  72 };
  73 
  74 /*
  75  * Formats of data/string buffers
  76  */
  77 #define SMB_DT_DATA             1
  78 #define SMB_DT_DIALECT          2
  79 #define SMB_DT_PATHNAME         3
  80 #define SMB_DT_ASCII            4
  81 #define SMB_DT_VARIABLE         5
  82 
  83 /*
  84  * SMB header
  85  */
  86 
  87 #define SMB_SIGNATURE           "\xFFSMB"
  88 #define SMB_SIGLEN              4
  89 #define SMB_HDRCMD(p)           (*((uchar_t *)(p) + SMB_SIGLEN))
  90 #define SMB_HDRMID(p)           (*(ushort_t *)((uchar_t *)(p) + 30))
  91 #define SMB_HDR_OFF_MID         30
  92 #define SMB_HDRLEN              32
  93 
  94 #define SMB_HDR_V1      0xFF
  95 #define SMB_HDR_V2      0xFE
  96 #define SMB_HDR_V3E     0xFD    /* SMB3 encrypted */
  97 
  98 /*
  99  * bits in the smb_flags field
 100  */
 101 #define SMB_FLAGS_SUPPORT_LOCKREAD      0x01
 102 #define SMB_FLAGS_CLIENT_BUF_AVAIL      0x02
 103 #define SMB_FLAGS_CASELESS              0x08
 104 #define SMB_FLAGS_CANONICAL_PATHNAMES   0x10
 105 #define SMB_FLAGS_REQUEST_OPLOCK        0x20
 106 #define SMB_FLAGS_REQUEST_BATCH_OPLOCK  0x40
 107 #define SMB_FLAGS_SERVER_RESP           0x80
 108 
 109 /*
 110  * bits in the smb_flags2 field
 111  */
 112 #define SMB_FLAGS2_KNOWS_LONG_NAMES     0x0001
 113 #define SMB_FLAGS2_KNOWS_EAS            0x0002  /* client know about EAs */
 114 #define SMB_FLAGS2_SECURITY_SIGNATURE   0x0004  /* check SMB integrity */
 115 #define SMB_FLAGS2_IS_LONG_NAME         0x0040  /* any path name is long name */
 116 #define SMB_FLAGS2_EXT_SEC              0x0800  /* client aware of Extended */
 117                                                 /* Security negotiation */
 
 142  */
 143 #define SMB_CAP_RAW_MODE                0x0001
 144 #define SMB_CAP_MPX_MODE                0x0002
 145 #define SMB_CAP_UNICODE                 0x0004
 146 #define SMB_CAP_LARGE_FILES             0x0008  /* 64 bit offsets supported */
 147 #define SMB_CAP_NT_SMBS                 0x0010
 148 #define SMB_CAP_RPC_REMOTE_APIS         0x0020
 149 #define SMB_CAP_STATUS32                0x0040
 150 #define SMB_CAP_LEVEL_II_OPLOCKS        0x0080
 151 #define SMB_CAP_LOCK_AND_READ           0x0100
 152 #define SMB_CAP_NT_FIND                 0x0200
 153 #define SMB_CAP_DFS                     0x1000
 154 #define SMB_CAP_INFOLEVEL_PASSTHRU      0x2000
 155 #define SMB_CAP_LARGE_READX             0x4000
 156 #define SMB_CAP_LARGE_WRITEX            0x8000
 157 #define SMB_CAP_UNIX                    0x00800000
 158 #define SMB_CAP_BULK_TRANSFER           0x20000000
 159 #define SMB_CAP_COMPRESSED_DATA         0x40000000
 160 #define SMB_CAP_EXT_SECURITY            0x80000000
 161 
 162 /* SMB_COM_TREE_CONNECT_ANDX  flags. See [MS-SMB] for a complete description. */
 163 #define TREE_CONNECT_ANDX_DISCONNECT_TID                0x0001
 164 #define TREE_CONNECT_ANDX_EXTENDED_SIGNATURES   0x0004
 165 #define TREE_CONNECT_ANDX_EXTENDED_RESPONSE             0x0008
 166 
 167 /*
 168  * SMB_COM_TREE_CONNECT_ANDX  optional support flags. See [MS-SMB] for a
 169  * complete description.
 170  */
 171 #define SMB_SUPPORT_SEARCH_BITS         0x0001  /* supports SearchAttributes */
 172 #define SMB_SHARE_IS_IN_DFS             0x0002  /* share is managed by DFS */
 173 #define SMB_CSC_MASK                    0x000C  /* Offline-caching bits. */
 174 #define SMB_UNIQUE_FILE_NAME            0x0010  /* Long file names only */
 175 #define SMB_EXTENDED_SIGNATURES         0x0020  /* Signing key protection. */
 176 /* See [MS-SMB] for a complete description of SMB_CSC_MASK bits. */
 177 #define SMB_CSC_CACHE_MANUAL_REINT      0x0000
 178 #define SMB_CSC_CACHE_AUTO_REINT        0x0004
 179 #define SMB_CSC_CACHE_VDO               0x0008
 180 
 181 /*
 182  * File attributes
 183  */
 184 #define SMB_FA_RDONLY           0x01
 185 #define SMB_FA_HIDDEN           0x02
 186 #define SMB_FA_SYSTEM           0x04
 187 #define SMB_FA_VOLUME           0x08
 188 #define SMB_FA_DIR              0x10
 189 #define SMB_FA_ARCHIVE          0x20
 190 
 191 /*
 192  * Extended file attributes
 193  */
 194 #define SMB_EFA_RDONLY                  0x00000001
 195 #define SMB_EFA_HIDDEN                  0x00000002
 196 #define SMB_EFA_SYSTEM                  0x00000004
 197 #define SMB_EFA_VOLUME                  0x00000008
 198 #define SMB_EFA_DIRECTORY               0x00000010
 199 #define SMB_EFA_ARCHIVE                 0x00000020
 200 #define SMB_EFA_DEVICE                  0x00000040
 201 #define SMB_EFA_NORMAL                  0x00000080
 
 
 382 #define NT_TRANSACT_CREATE              0x01
 383 #define NT_TRANSACT_IOCTL               0x02
 384 #define NT_TRANSACT_SET_SECURITY_DESC   0x03
 385 #define NT_TRANSACT_NOTIFY_CHANGE       0x04
 386 #define NT_TRANSACT_RENAME              0x05
 387 #define NT_TRANSACT_QUERY_SECURITY_DESC 0x06
 388 #define NT_TRANSACT_GET_USER_QUOTA      0x07
 389 #define NT_TRANSACT_SET_USER_QUOTA      0x08
 390 
 391 /*
 392  * SMB_TRANS2_QUERY_FS_INFORMATION levels
 393  */
 394 #define SMB_QFS_ALLOCATION                      1
 395 #define SMB_QFS_VOLUME                          2
 396 #define SMB_QFS_LABEL_INFO                      0x101
 397 #define SMB_QFS_VOLUME_INFO                     0x102
 398 #define SMB_QFS_SIZE_INFO                       0x103
 399 #define SMB_QFS_DEVICE_INFO                     0x104
 400 #define SMB_QFS_ATTRIBUTE_INFO                  0x105
 401 #define SMB_QFS_UNIX_INFO                       0x200
 402 #define SMB_QFS_POSIX_WHOAMI                    0x202
 403 #define SMB_QFS_MAC_FS_INFO                     0x301
 404 #define SMB_QFS_VOLUME_INFORMATION              1001
 405 #define SMB_QFS_SIZE_INFORMATION                1003
 406 #define SMB_QFS_DEVICE_INFORMATION              1004
 407 #define SMB_QFS_ATTRIBUTE_INFORMATION           1005
 408 #define SMB_QFS_QUOTA_INFORMATION               1006
 409 #define SMB_QFS_FULL_SIZE_INFORMATION           1007
 410 #define SMB_QFS_OBJECTID_INFORMATION            1008
 411 
 412 /*
 413  * NT Notify Change Compeletion Filter
 414  * NT Notify Actions
 415  * (We don't use these.)
 416  */
 417 
 418 /*
 419  * SMB_QFS_ATTRIBUTE_INFO bits.
 420  * The following info found in msdn
 421  * (http://msdn.microsoft.com/library/default.asp?
 422  * url=/library/en-us/wmisdk/wmi/win32_cdromdrive.asp)
 423  * Naming is mostly as in samba, to help Those Who Google.
 424  */
 425 #define FILE_CASE_SENSITIVE_SEARCH      0x00000001
 426 #define FILE_CASE_PRESERVED_NAMES       0x00000002
 427 #define FILE_UNICODE_ON_DISK            0x00000004
 428 #define FILE_PERSISTENT_ACLS            0x00000008
 429 #define FILE_FILE_COMPRESSION           0x00000010
 430 #define FILE_VOLUME_QUOTAS              0x00000020
 431 #define FILE_SUPPORTS_SPARSE_FILES      0x00000040
 432 #define FILE_SUPPORTS_REPARSE_POINTS    0x00000080
 433 #define FILE_SUPPORTS_REMOTE_STORAGE    0x00000100
 434 #define FILE_SUPPORTS_LONG_NAMES        0x00004000
 435 #define FILE_VOLUME_IS_COMPRESSED       0x00008000
 436 #define FILE_SUPPORTS_OBJECT_IDS        0x00010000
 437 #define FILE_SUPPORTS_ENCRYPTION        0x00020000
 438 #define FILE_NAMED_STREAMS              0x00040000
 439 #define FILE_READ_ONLY_VOLUME           0x00080000
 440 
 441 /*
 442  * SMB_TRANS2_QUERY_PATH levels
 443  */
 444 #define SMB_QFILEINFO_STANDARD                  1
 445 #define SMB_QFILEINFO_EA_SIZE                   2
 446 #define SMB_QFILEINFO_EAS_FROM_LIST             3
 447 #define SMB_QFILEINFO_ALL_EAS                   4
 448 #define SMB_QFILEINFO_IS_NAME_VALID             6       /* QPATHINFO only? */
 449 #define SMB_QFILEINFO_BASIC_INFO                0x101
 450 #define SMB_QFILEINFO_STANDARD_INFO             0x102
 451 #define SMB_QFILEINFO_EA_INFO                   0x103
 452 #define SMB_QFILEINFO_NAME_INFO                 0x104
 453 #define SMB_QFILEINFO_ALLOCATION_INFO           0x105
 454 #define SMB_QFILEINFO_END_OF_FILE_INFO          0x106
 455 #define SMB_QFILEINFO_ALL_INFO                  0x107
 456 #define SMB_QFILEINFO_ALT_NAME_INFO             0x108
 457 #define SMB_QFILEINFO_STREAM_INFO               0x109
 458 #define SMB_QFILEINFO_COMPRESSION_INFO          0x10b
 459 #define SMB_QFILEINFO_UNIX_BASIC                0x200
 460 #define SMB_QFILEINFO_UNIX_LINK                 0x201
 461 #define SMB_QFILEINFO_POSIX_ACL                 0x204
 462 #define SMB_QFILEINFO_UNIX_INFO2                0x20B
 463 #define SMB_QFILEINFO_MAC_DT_GET_APPL           0x306
 464 #define SMB_QFILEINFO_MAC_DT_GET_ICON           0x307
 465 #define SMB_QFILEINFO_MAC_DT_GET_ICON_INFO      0x308
 466 #define SMB_QFILEINFO_MAC_SPOTLIGHT             0x310
 467 #define SMB_QFILEINFO_BASIC_INFORMATION         1004
 468 #define SMB_QFILEINFO_STANDARD_INFORMATION      1005
 469 #define SMB_QFILEINFO_INTERNAL_INFORMATION      1006
 470 #define SMB_QFILEINFO_EA_INFORMATION            1007
 471 #define SMB_QFILEINFO_ACCESS_INFORMATION        1008
 472 #define SMB_QFILEINFO_NAME_INFORMATION          1009
 473 #define SMB_QFILEINFO_POSITION_INFORMATION      1014
 474 #define SMB_QFILEINFO_MODE_INFORMATION          1016
 475 #define SMB_QFILEINFO_ALIGNMENT_INFORMATION     1017
 476 #define SMB_QFILEINFO_ALL_INFORMATION           1018
 477 #define SMB_QFILEINFO_ALT_NAME_INFORMATION      1021
 478 #define SMB_QFILEINFO_STREAM_INFORMATION        1022
 479 #define SMB_QFILEINFO_COMPRESSION_INFORMATION   1028
 480 #define SMB_QFILEINFO_NETWORK_OPEN_INFORMATION  1034
 481 #define SMB_QFILEINFO_ATTRIBUTE_TAG_INFORMATION 1035
 482 
 483 /*
 484  * SMB_TRANS2_FIND_FIRST2 information levels
 485  */
 486 #define SMB_FIND_STANDARD               1
 487 #define SMB_FIND_EA_SIZE                2
 488 #define SMB_FIND_EAS_FROM_LIST          3
 489 #define SMB_FIND_DIRECTORY_INFO         0x101
 490 #define SMB_FIND_FULL_DIRECTORY_INFO    0x102
 491 #define SMB_FIND_NAME_INFO              0x103
 492 #define SMB_FIND_BOTH_DIRECTORY_INFO    0x104
 493 #define SMB_FIND_UNIX_INFO              0x200
 494 /* Transact 2 Find First levels */
 495 #define SMB_FIND_FILE_UNIX              0x202
 496 #define SMB_FIND_FILE_UNIX_INFO2        0x20B /* UNIX File Info2 */
 497 
 498 /*
 499  * Selectors for NT_TRANSACT_QUERY_SECURITY_DESC and
 500  * NT_TRANSACT_SET_SECURITY_DESC.  Details found in the MSDN
 501  * library by searching on security_information.
 502  * Note the protected/unprotected bits did not exist in NT.
 503  */
 504 
 505 #define OWNER_SECURITY_INFORMATION              0x00000001
 506 #define GROUP_SECURITY_INFORMATION              0x00000002
 507 #define DACL_SECURITY_INFORMATION               0x00000004
 508 #define SACL_SECURITY_INFORMATION               0x00000008
 509 #define UNPROTECTED_SACL_SECURITY_INFORMATION   0x10000000
 510 #define UNPROTECTED_DACL_SECURITY_INFORMATION   0x20000000
 511 #define PROTECTED_SACL_SECURITY_INFORMATION     0x40000000
 512 #define PROTECTED_DACL_SECURITY_INFORMATION     0x80000000
 513 
 514 /*
 515  * security descriptor header
 516  * it is followed by the optional SIDs and ACLs
 
 
 730 #define NO_PROPAGATE_INHERIT_ACE_FLAG           0x04
 731 #define INHERIT_ONLY_ACE_FLAG                   0x08
 732 #define INHERITED_ACE_FLAG                      0x10
 733 #define UNDEF_ACE_FLAG                          0x20 /* MS doesn't define it */
 734 #define VALID_INHERIT_ACE_FLAGS                 0x1F
 735 #define SUCCESSFUL_ACCESS_ACE_FLAG              0x40
 736 #define FAILED_ACCESS_ACE_FLAG                  0x80
 737 
 738 /*
 739  * Set PATH/FILE information levels
 740  */
 741 #define SMB_SFILEINFO_STANDARD                  1
 742 #define SMB_SFILEINFO_EA_SET                    2
 743 #define SMB_SFILEINFO_BASIC_INFO                0x101
 744 #define SMB_SFILEINFO_DISPOSITION_INFO          0x102
 745 #define SMB_SFILEINFO_ALLOCATION_INFO           0x103
 746 #define SMB_SFILEINFO_END_OF_FILE_INFO          0x104
 747 #define SMB_SFILEINFO_UNIX_BASIC                0x200
 748 #define SMB_SFILEINFO_UNIX_LINK                 0x201
 749 #define SMB_SFILEINFO_UNIX_HLINK                0x203
 750 #define SMB_SFILEINFO_POSIX_ACL                 0x204
 751 #define SMB_SFILEINFO_POSIX_UNLINK              0x20A
 752 #define SMB_SFILEINFO_UNIX_INFO2                0x20B
 753 #define SMB_SFILEINFO_DIRECTORY_INFORMATION     1001
 754 #define SMB_SFILEINFO_FULL_DIRECTORY_INFORMATION        1002
 755 #define SMB_SFILEINFO_BOTH_DIRECTORY_INFORMATION        1003
 756 #define SMB_SFILEINFO_BASIC_INFORMATION         1004
 757 #define SMB_SFILEINFO_STANDARD_INFORMATION      1005
 758 #define SMB_SFILEINFO_INTERNAL_INFORMATION      1006
 759 #define SMB_SFILEINFO_EA_INFORMATION            1007
 760 #define SMB_SFILEINFO_ACCESS_INFORMATION        1008
 761 #define SMB_SFILEINFO_NAME_INFORMATION          1009
 762 #define SMB_SFILEINFO_RENAME_INFORMATION        1010
 763 #define SMB_SFILEINFO_LINK_INFORMATION          1011
 764 #define SMB_SFILEINFO_NAMES_INFORMATION         1012
 765 #define SMB_SFILEINFO_DISPOSITION_INFORMATION   1013
 766 #define SMB_SFILEINFO_POSITION_INFORMATION      1014
 767 #define SMB_SFILEINFO_1015                      1015 /* ? */
 768 #define SMB_SFILEINFO_MODE_INFORMATION          1016
 769 #define SMB_SFILEINFO_ALIGNMENT_INFORMATION     1017
 770 #define SMB_SFILEINFO_ALL_INFORMATION           1018
 771 #define SMB_SFILEINFO_ALLOCATION_INFORMATION    1019
 772 #define SMB_SFILEINFO_END_OF_FILE_INFORMATION   1020
 
 
 842 #define TRANS_SET_NAMED_PIPE_HAND_STATE 0x01    /* set pipe handle modes */
 843 #define TRANS_Q_NAMED_PIPE_INFO         0x22    /* query pipe attributes */
 844 #define TRANS_TRANSACT_NAMED_PIPE       0x26    /* r/w operation on pipe */
 845 #define TRANS_READ_NAMED_PIPE           0x11    /* read pipe in "raw" mode */
 846                                                 /* (non message mode) */
 847 #define TRANS_WRITE_NAMED_PIPE          0x31    /* write pipe "raw" mode */
 848                                                 /* (non message mode) */
 849 
 850 /*
 851  * Share types, visible via NetShareEnum
 852  */
 853 #define STYPE_DISKTREE                  0x00000000
 854 #define STYPE_PRINTQ                    0x00000001
 855 #define STYPE_DEVICE                    0x00000002
 856 #define STYPE_IPC                       0x00000003
 857 #define STYPE_UNKNOWN                   0x00000004
 858 #define STYPE_MASK                      0x0000000F
 859 #define STYPE_TEMPORARY                 0x40000000
 860 #define STYPE_HIDDEN                    0x80000000
 861 
 862 /*
 863  * Characters that are not allowed in an SMB file name component.
 864  * From MSDN: Naming Files, Paths, ...
 865  *      < (less than)
 866  *      > (greater than)
 867  *      : (colon)
 868  *      " (double quote)
 869  *      / (forward slash)
 870  *      \ (backslash)
 871  *      | (vertical bar or pipe)
 872  *      ? (question mark)
 873  *      * (asterisk)
 874  */
 875 #define SMB_FILENAME_INVALID_CHARS      "<>:\"/\\|?*"
 876 
 877 #endif /* _NETSMB_SMB_H_ */
  |