sync 3.0 into HEAD for the last time
[samba.git] / source / include / trans2.h
index 53f351d5cf170ba6cb4715f4bdc3356f26e787c1..168e6477210db65c64c005469488e81aaf745d1e 100644 (file)
@@ -1,8 +1,7 @@
 /* 
-   Unix SMB/Netbios implementation.
-   Version 1.9.
+   Unix SMB/CIFS implementation.
    SMB transaction2 handling
-   Copyright (C) Jeremy Allison 1994-1998
+   Copyright (C) Jeremy Allison 1994-2002.
 
    Extensively modified by Andrew Tridgell, 1995
 
@@ -194,17 +193,22 @@ Byte offset   Type     name                description
 } FSINFO;
 *************************************************************/
 
-#define SMB_INFO_STANDARD               1
-#define SMB_INFO_QUERY_EA_SIZE          2
-#define SMB_INFO_QUERY_EAS_FROM_LIST    3
-#define SMB_INFO_QUERY_ALL_EAS          4
+#define SMB_INFO_STANDARD               1  /* FILESTATUS3 struct */
+#define SMB_INFO_SET_EA                 2  /* EAOP2 struct, only valid on set not query */
+#define SMB_INFO_QUERY_EA_SIZE          2  /* FILESTATUS4 struct, only valid on query not set */
+#define SMB_INFO_QUERY_EAS_FROM_LIST    3  /* only valid on query not set */
+#define SMB_INFO_QUERY_ALL_EAS          4  /* only valid on query not set */
 #define SMB_INFO_IS_NAME_VALID          6
-#define SMB_QUERY_FS_LABEL_INFO                        0x101
-#define SMB_QUERY_FS_VOLUME_INFO               0x102
-#define SMB_QUERY_FS_SIZE_INFO                 0x103
-#define SMB_QUERY_FS_DEVICE_INFO               0x104
-#define SMB_QUERY_FS_ATTRIBUTE_INFO            0x105
-
+#define SMB_INFO_STANDARD_LONG          11  /* similar to level 1, ie struct FileStatus3 */
+#define SMB_QUERY_EA_SIZE_LONG          12  /* similar to level 2, ie struct FileStatus4 */
+#define SMB_QUERY_FS_LABEL_INFO         0x101
+#define SMB_QUERY_FS_VOLUME_INFO        0x102
+#define SMB_QUERY_FS_SIZE_INFO          0x103
+#define SMB_QUERY_FS_DEVICE_INFO        0x104
+#define SMB_QUERY_FS_ATTRIBUTE_INFO     0x105
+#if 0
+#define SMB_QUERY_FS_QUOTA_INFO                
+#endif
 
 #define l2_vol_fdateCreation 0
 #define l2_vol_cch 4
@@ -220,17 +224,24 @@ Byte offset   Type     name                description
 #define SMB_QUERY_FILE_ALL_INFO                0x107
 #define SMB_QUERY_FILE_ALT_NAME_INFO   0x108
 #define SMB_QUERY_FILE_STREAM_INFO     0x109
+#define SMB_QUERY_COMPRESSION_INFO     0x10b
 
 #define SMB_FIND_FILE_DIRECTORY_INFO           0x101
 #define SMB_FIND_FILE_FULL_DIRECTORY_INFO      0x102
 #define SMB_FIND_FILE_NAMES_INFO               0x103
 #define SMB_FIND_FILE_BOTH_DIRECTORY_INFO      0x104
+#define SMB_FIND_FILE_LEVEL_261                        0x105
+#define SMB_FIND_FILE_LEVEL_262                        0x106
 
 #define SMB_SET_FILE_BASIC_INFO                0x101
 #define SMB_SET_FILE_DISPOSITION_INFO  0x102
 #define SMB_SET_FILE_ALLOCATION_INFO   0x103
 #define SMB_SET_FILE_END_OF_FILE_INFO  0x104
 
+/* Query FS info. */
+#define SMB_INFO_ALLOCATION            1
+#define SMB_INFO_VOLUME                        2
+
 /*
  * Thursby MAC extensions....
  */
@@ -307,6 +318,17 @@ Byte offset   Type     name                description
 #define SMB_FILE_TRACKING_INFORMATION                  1036
 #define SMB_FILE_MAXIMUM_INFORMATION                   1037
 
+/* NT passthough levels for qfsinfo. */
+
+#define SMB_FS_VOLUME_INFORMATION                      1001
+#define SMB_FS_LABEL_INFORMATION                       1002
+#define SMB_FS_SIZE_INFORMATION                                1003
+#define SMB_FS_DEVICE_INFORMATION                      1004
+#define SMB_FS_ATTRIBUTE_INFORMATION                   1005
+#define SMB_FS_QUOTA_INFORMATION                       1006
+#define SMB_FS_FULL_SIZE_INFORMATION                   1007
+#define SMB_FS_OBJECTID_INFORMATION                    1008
+
 /* UNIX CIFS Extensions - created by HP */
 /*
  * UNIX CIFS Extensions have the range 0x200 - 0x2FF reserved.
@@ -321,8 +343,49 @@ Byte offset   Type     name                description
 #define SMB_QUERY_FILE_UNIX_BASIC      0x200   /* UNIX File Info*/
 #define SMB_SET_FILE_UNIX_BASIC        0x200
 
-#define MODE_NO_CHANGE                 -1     /* file mode value which */
+#define SMB_MODE_NO_CHANGE                 0xFFFFFFFF     /* file mode value which */
                                               /* means "don't change it" */
+#define SMB_UID_NO_CHANGE                  0xFFFFFFFF
+#define SMB_GID_NO_CHANGE                  0xFFFFFFFF
+
+#define SMB_SIZE_NO_CHANGE_LO              0xFFFFFFFF
+#define SMB_SIZE_NO_CHANGE_HI              0xFFFFFFFF
+#define SMB_TIME_NO_CHANGE_LO              0xFFFFFFFF
+#define SMB_TIME_NO_CHANGE_HI              0xFFFFFFFF
+
+/*
+Offset Size         Name
+0      LARGE_INTEGER EndOfFile                File size
+8      LARGE_INTEGER Blocks                   Number of bytes used on disk (st_blocks).
+16     LARGE_INTEGER CreationTime             Creation time
+24     LARGE_INTEGER LastAccessTime           Last access time
+32     LARGE_INTEGER LastModificationTime     Last modification time
+40     LARGE_INTEGER Uid                      Numeric user id for the owner
+48     LARGE_INTEGER Gid                      Numeric group id of owner
+56     ULONG Type                             Enumeration specifying the pathname type:
+                                              0 -- File
+                                              1 -- Directory
+                                              2 -- Symbolic link
+                                              3 -- Character device
+                                              4 -- Block device
+                                              5 -- FIFO (named pipe)
+                                              6 -- Unix domain socket
+
+60     LARGE_INTEGER devmajor                 Major device number if type is device
+68     LARGE_INTEGER devminor                 Minor device number if type is device
+76     LARGE_INTEGER uniqueid                 This is a server-assigned unique id for the file. The client
+                                              will typically map this onto an inode number. The scope of
+                                              uniqueness is the share.
+84     LARGE_INTEGER permissions              Standard UNIX file permissions  - see below.
+92     LARGE_INTEGER nlinks                   The number of directory entries that map to this entry
+                                              (number of hard links)
+
+100 - end.
+*/
+
+/* UNIX filetype mappings. */
+
 #define UNIX_TYPE_FILE 0
 #define UNIX_TYPE_DIR 1
 #define UNIX_TYPE_SYMLINK 2
@@ -330,35 +393,35 @@ Byte offset   Type     name                description
 #define UNIX_TYPE_BLKDEV 4
 #define UNIX_TYPE_FIFO 5
 #define UNIX_TYPE_SOCKET 6
-#define UNIx_TYPE_UNKNOWN 0xFFFFFFFF
+#define UNIX_TYPE_UNKNOWN 0xFFFFFFFF
 
 /*
- LARGE_INTEGER EndOfFile                File size
- LARGE_INTEGER Blocks                   Number of bytes used on disk (st_blocks).
- LARGE_INTEGER CreationTime             Creation time
- LARGE_INTEGER LastAccessTime           Last access time
- LARGE_INTEGER LastModificationTime     Last modification time
- LARGE_INTEGER Uid                      Numeric user id for the owner
- LARGE_INTEGER Gid                      Numeric group id of owner
- ULONG Type                             Enumeration specifying the pathname type:
-                                         0 -- File
-                                         1 -- Directory
-                                         2 -- Symbolic link
-                                         3 -- Character device
-                                         4 -- Block device
-                                         5 -- FIFO (named pipe)
-                                         6 -- Unix domain socket
-
- LARGE_INTEGER devmajor                 Major device number if type is device
- LARGE_INTEGER devminor                 Minor device number if type is device
- LARGE_INTEGER uniqueid                 This is a server-assigned unique id for the file. The client
-                                        will typically map this onto an inode number. The scope of
-                                        uniqueness is the share.
- LARGE_INTEGER permissions              Standard UNIX file permissions
- LARGE_INTEGER nlinks                   The number of directory entries that map to this entry
-                                          (number of hard links)
+ * Oh this is fun. "Standard UNIX permissions" has no
+ * meaning in POSIX. We need to define the mapping onto
+ * and off the wire as this was not done in the original HP
+ * spec. JRA.
+ */
 
-*/
+#define UNIX_X_OTH                     0000001
+#define UNIX_W_OTH                     0000002
+#define UNIX_R_OTH                     0000004
+#define UNIX_X_GRP                     0000010
+#define UNIX_W_GRP                      0000020
+#define UNIX_R_GRP                      0000040
+#define UNIX_X_USR                      0000100
+#define UNIX_W_USR                      0000200
+#define UNIX_R_USR                      0000400
+#define UNIX_STICKY                     0001000
+#define UNIX_SET_GID                    0002000
+#define UNIX_SET_UID                    0004000
+
+/* Masks for the above */
+#define UNIX_OTH_MASK                   0000007
+#define UNIX_GRP_MASK                   0000070
+#define UNIX_USR_MASK                   0000700
+#define UNIX_PERM_MASK                  0000777
+#define UNIX_EXTRA_MASK                 0007000
+#define UNIX_ALL_MASK                   0007777
 
 #define SMB_QUERY_FILE_UNIX_LINK       0x201
 #define SMB_SET_FILE_UNIX_LINK         0x201
@@ -366,4 +429,27 @@ Byte offset   Type     name                description
 
 #define SMB_FIND_FILE_UNIX             0x202
 
+/*
+ Info level for QVOLINFO - returns version of CIFS UNIX extensions, plus
+ 64-bits worth of capability fun :-).
+*/
+
+#define SMB_QUERY_CIFS_UNIX_INFO      0x200
+
+/* Returns the following.
+
+  UINT16             major version number
+  UINT16             minor version number
+  LARGE_INTEGER      capability bitfield
+
+*/
+
+#define CIFS_UNIX_MAJOR_VERSION 1
+#define CIFS_UNIX_MINOR_VERSION 0
+
+#define CIFS_UNIX_FCNTL_LOCKS_CAP           0x1
+#define CIFS_UNIX_POSIX_ACLS_CAP            0x2
+
+/* ... more as we think of them :-). */
+
 #endif