r23792: convert Samba4 to GPLv3
[ira/wip.git] / source4 / libcli / smb2 / smb2.h
index 14e6e8d835601ba467fc277825858ae372ac59a9..cad9ebd38e978fa8ec57e583c3a580cf210f7f5b 100644 (file)
@@ -7,7 +7,7 @@
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
+   the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
    
    This program is distributed in the hope that it will be useful,
@@ -16,8 +16,7 @@
    GNU General Public License for more details.
    
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
 struct smb2_options {
@@ -48,6 +47,15 @@ struct smb2_transport {
 
        /* context of the stream -> packet parser */
        struct packet_context *packet;
+
+       /* an idle function - if this is defined then it will be
+          called once every period microseconds while we are waiting
+          for a packet */
+       struct {
+               void (*func)(struct smb2_transport *, void *);
+               void *private;
+               uint_t period;
+       } idle;
 };
 
 
@@ -119,6 +127,12 @@ struct smb2_request {
 
        uint64_t seqnum;
 
+       struct {
+               BOOL do_cancel;
+               BOOL can_cancel;
+               uint32_t pending_id;
+       } cancel;
+
        /* the NT status for this request. Set by packet receive code
           or code detecting error. */
        NTSTATUS status;
@@ -143,19 +157,19 @@ struct smb2_request {
 #define SMB2_MIN_SIZE 0x42
 
 /* offsets into header elements */
-#define SMB2_HDR_LENGTH  0x04
-#define SMB2_HDR_PAD1    0x06
-#define SMB2_HDR_STATUS  0x08
-#define SMB2_HDR_OPCODE  0x0c
-#define SMB2_HDR_PAD2    0x0e
-#define SMB2_HDR_FLAGS   0x10
-#define SMB2_HDR_UNKNOWN 0x14
-#define SMB2_HDR_SEQNUM  0x18
-#define SMB2_HDR_PID     0x20
-#define SMB2_HDR_TID     0x24
-#define SMB2_HDR_UID     0x28 /* 64 bit */
-#define SMB2_HDR_SIG     0x30 /* guess ... */
-#define SMB2_HDR_BODY    0x40
+#define SMB2_HDR_LENGTH                0x04
+#define SMB2_HDR_PAD1          0x06
+#define SMB2_HDR_STATUS                0x08
+#define SMB2_HDR_OPCODE                0x0c
+#define SMB2_HDR_UNKNOWN1      0x0e
+#define SMB2_HDR_FLAGS         0x10
+#define SMB2_HDR_CHAIN_OFFSET  0x14
+#define SMB2_HDR_SEQNUM                0x18
+#define SMB2_HDR_PID           0x20
+#define SMB2_HDR_TID           0x24
+#define SMB2_HDR_UID           0x28 /* 64 bit */
+#define SMB2_HDR_SIG           0x30 /* guess ... */
+#define SMB2_HDR_BODY          0x40
 
 /* SMB2 opcodes */
 #define SMB2_OP_NEGPROT   0x00
@@ -189,12 +203,12 @@ struct smb2_request {
        uint16_t want_size = ((dynamic)?(size)+1:(size)); \
        if (is_size < (size)) { \
                DEBUG(0,("%s: buffer too small 0x%x. Expected 0x%x\n", \
-                        __location__, is_size, want_size)); \
+                        __location__, (unsigned)is_size, (unsigned)want_size)); \
                return NT_STATUS_BUFFER_TOO_SMALL; \
        }\
        if (field_size != want_size) { \
                DEBUG(0,("%s: unexpected fixed body size 0x%x. Expected 0x%x\n", \
-                        __location__, field_size, want_size)); \
+                        __location__, (unsigned)field_size, (unsigned)want_size)); \
                return NT_STATUS_INVALID_PARAMETER; \
        } \
 } while (0)