s4:smb2: Add rudimentary SMB2.1 lease support to libcli
[ira/wip.git] / source4 / libcli / smb2 / smb2.h
index f00107de603b1f803ddd3967727725a22a70d31a..fd961ce5f3988241d82749be9edfb70967e76feb 100644 (file)
@@ -35,6 +35,7 @@ struct smb2_negotiate {
        NTTIME system_time;
        NTTIME server_start_time;
        uint16_t security_mode;
+       uint16_t dialect_revision;
 };
 
 /* this is the context for the smb2 transport layer */
@@ -59,7 +60,7 @@ struct smb2_transport {
           for a packet */
        struct {
                void (*func)(struct smb2_transport *, void *);
-               void *private;
+               void *private_data;
                uint_t period;
        } idle;
 
@@ -178,6 +179,7 @@ struct smb2_request {
 
 
 #define SMB2_MIN_SIZE 0x42
+#define SMB2_MIN_SIZE_NO_BODY 0x40
 
 /* offsets into header elements for a sync SMB2 request */
 #define SMB2_HDR_PROTOCOL_ID    0x00
@@ -225,8 +227,10 @@ struct smb2_request {
 
 #define SMB2_MAGIC 0x424D53FE /* 0xFE 'S' 'M' 'B' */
 
-/* the dialect we support */
+/* the dialects we support */
 #define SMB2_DIALECT_REVISION           0x202
+#define SMB21_DIALECT_REVISION          0x210
+#define SMB2_LONGHORN_BETA_DIALECT_REVISION    0x0 /* early beta dialect */
 
 /* SMB2 negotiate security_mode */
 #define SMB2_NEGOTIATE_SIGNING_ENABLED   0x01
@@ -259,6 +263,13 @@ struct smb2_request {
 #define SMB2_OPLOCK_LEVEL_II                             0x01
 #define SMB2_OPLOCK_LEVEL_EXCLUSIVE                      0x08
 #define SMB2_OPLOCK_LEVEL_BATCH                          0x09
+#define SMB2_OPLOCK_LEVEL_LEASE                          0xFF
+
+/* SMB2 lease bits */
+#define SMB2_LEASE_NONE                                  0x00
+#define SMB2_LEASE_READ                                  0x01
+#define SMB2_LEASE_HANDLE                                0x02
+#define SMB2_LEASE_WRITE                                 0x04
 
 /* SMB2 impersonation levels */
 #define SMB2_IMPERSONATION_ANONYMOUS                     0x00
@@ -275,6 +286,7 @@ struct smb2_request {
 #define SMB2_CREATE_TAG_ALSI "AlSi"
 #define SMB2_CREATE_TAG_TWRP "TWrp"
 #define SMB2_CREATE_TAG_QFID "QFid"
+#define SMB2_CREATE_TAG_RQLS "RqLs"
 
 /* SMB2 Create ignore some more create_options */
 #define SMB2_CREATE_OPTIONS_NOT_SUPPORTED_MASK (NTCREATEX_OPTIONS_TREE_CONNECTION | \