ensure that we honor SMB2 read min_count properly
[kai/samba.git] / source4 / libcli / raw / interfaces.h
index 8ebdd38beebd632d9079dae4f7ae5169e4605a6f..17c85138ac1377610936bedcce5ea7b6634d41d2 100644 (file)
@@ -3,10 +3,11 @@
    SMB request interface structures
    Copyright (C) Andrew Tridgell                       2003
    Copyright (C) James J Myers 2003 <myersjj@samba.org>
+   Copyright (C) James Peach 2007
    
    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,
    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/>.
 */
 
 #ifndef __LIBCLI_RAW_INTERFACES_H__
 #define __LIBCLI_RAW_INTERFACES_H__
 
 #include "smb.h" 
+#include "librpc/gen_ndr/misc.h" /* for struct GUID */
 
 /* this structure is just a wrapper for a string, the only reason we
    bother with this is that it allows us to check the length provided
@@ -174,7 +175,7 @@ struct smb_rmdir {
 };
 
 /* struct used in rename() call */
-enum smb_rename_level {RAW_RENAME_RENAME, RAW_RENAME_NTRENAME};
+enum smb_rename_level {RAW_RENAME_RENAME, RAW_RENAME_NTRENAME, RAW_RENAME_NTTRANS};
 
 union smb_rename {
        struct {
@@ -205,6 +206,17 @@ union smb_rename {
                        const char *new_name;
                } in;
        } ntrename;
+
+       /* NT TRANS rename interface */
+       struct {
+               enum smb_rename_level level;
+
+               struct {
+                       union smb_handle file;
+                       uint16_t flags;/* see RENAME_REPLACE_IF_EXISTS */
+                       const char *new_name;
+               } in;
+       } nttrans;
 };
 
 enum smb_tcon_level {
@@ -259,20 +271,19 @@ union smb_tcon {
 
                struct {
                        /* static body buffer 8 (0x08) bytes */
-                       /* uint16_t buffer_code; 0x09 = 0x08 + 1 */
-                       uint16_t unknown1; /* 0x0000 */
+                       uint16_t reserved;
                        /* uint16_t path_ofs */
                        /* uint16_t path_size */
-       
-                       /* dynamic body */
+                               /* dynamic body */
                        const char *path; /* as non-terminated UTF-16 on the wire */
                } in;
                struct {
                        /* static body buffer 16 (0x10) bytes */
                        /* uint16_t buffer_code;  0x10 */
-                       uint16_t unknown1; /* 0x02 */
-                       uint32_t unknown2; /* 0x00 */
-                       uint32_t unknown3; /* 0x00 */
+                       uint8_t share_type;
+                       uint8_t reserved;
+                       uint32_t flags;
+                       uint32_t capabilities;
                        uint32_t access_mask;
        
                        /* extracted from the SMB2 header */
@@ -372,29 +383,22 @@ union smb_sesssetup {
                enum smb_sesssetup_level level;
 
                struct {
-                       /* NOTE: this was 0x11 = 0x10 + 1 in vista-CTP
-                        * and changed in vista-beta2, but both server's
-                        * can handle the 0x18 clients
-                        */
-                       /* static body buffer 24 (0x18) bytes */
-                       /* uint16_t buffer_code;  0x19 = 0x18 + 1 */
-                       uint16_t _pad;
-                       uint32_t unknown2; /* 0x0000000F(vista-CTP) 0x00000007(vista-beta2) */
-                       uint32_t unknown3; /* 0x0000000 */
+                       /* static body 24 (0x18) bytes */
+                       uint8_t vc_number;
+                       uint8_t security_mode;
+                       uint32_t capabilities;
+                       uint32_t channel;
                        /* uint16_t secblob_ofs */
                        /* uint16_t secblob_size */
-                       uint64_t unknown4; /* 0x0000000000000000 only present in vista-beta2 */
-
+                       uint64_t previous_sessionid;
                        /* dynamic body */
                        DATA_BLOB secblob;
                } in;
                struct {
-                       /* static body buffer 8 (0x08) bytes */
-                       /* uint16_t buffer_code; 0x09 = 0x08 +1 */
-                       uint16_t _pad;
+                       /* body buffer 8 (0x08) bytes */
+                       uint16_t session_flags;
                        /* uint16_t secblob_ofs */
                        /* uint16_t secblob_size */
-
                        /* dynamic body */
                        DATA_BLOB secblob;
 
@@ -426,6 +430,7 @@ enum smb_fileinfo_level {
                     RAW_FILEINFO_STREAM_INFO                = SMB_QFILEINFO_STREAM_INFO,
                     RAW_FILEINFO_COMPRESSION_INFO           = SMB_QFILEINFO_COMPRESSION_INFO,
                     RAW_FILEINFO_UNIX_BASIC                 = SMB_QFILEINFO_UNIX_BASIC,
+                    RAW_FILEINFO_UNIX_INFO2                 = SMB_QFILEINFO_UNIX_INFO2,
                     RAW_FILEINFO_UNIX_LINK                  = SMB_QFILEINFO_UNIX_LINK,
                     RAW_FILEINFO_BASIC_INFORMATION          = SMB_QFILEINFO_BASIC_INFORMATION,
                     RAW_FILEINFO_STANDARD_INFORMATION       = SMB_QFILEINFO_STANDARD_INFORMATION,
@@ -607,8 +612,8 @@ union smb_fileinfo {
                        uint64_t alloc_size;
                        uint64_t size;
                        uint32_t nlink;
-                       BOOL delete_pending;
-                       BOOL directory;
+                       bool delete_pending;
+                       bool directory;
                } out;
        } standard_info;
        
@@ -679,7 +684,8 @@ union smb_fileinfo {
                        uint32_t ea_size;
                        uint32_t access_mask;
                        uint64_t position;
-                       uint64_t mode;
+                       uint32_t mode;
+                       uint32_t alignment_requirement;
                        struct smb_wire_string fname;
                } out;
        } all_info2;
@@ -745,6 +751,32 @@ union smb_fileinfo {
                } out;
        } unix_basic_info;
 
+       /* RAW_FILEINFO_UNIX_INFO2 interface */
+       struct {
+               enum smb_fileinfo_level level;
+               struct {
+                       union smb_handle_or_path file;
+               } in;
+               struct {
+                       uint64_t end_of_file;
+                       uint64_t num_bytes;
+                       NTTIME status_change_time;
+                       NTTIME access_time;
+                       NTTIME change_time;
+                       uint64_t uid;
+                       uint64_t gid;
+                       uint32_t file_type;
+                       uint64_t dev_major;
+                       uint64_t dev_minor;
+                       uint64_t unique_id;
+                       uint64_t permissions;
+                       uint64_t nlink;
+                       NTTIME create_time;
+                       uint32_t file_flags;
+                       uint32_t flags_mask;
+               } out;
+       } unix_info2;
+
        /* RAW_FILEINFO_UNIX_LINK interface */
        struct {
                enum smb_fileinfo_level level;
@@ -867,6 +899,7 @@ enum smb_setfileinfo_level {
        RAW_SFILEINFO_ALLOCATION_INFO         = SMB_SFILEINFO_ALLOCATION_INFO,
        RAW_SFILEINFO_END_OF_FILE_INFO        = SMB_SFILEINFO_END_OF_FILE_INFO,
        RAW_SFILEINFO_UNIX_BASIC              = SMB_SFILEINFO_UNIX_BASIC,
+       RAW_SFILEINFO_UNIX_INFO2              = SMB_SFILEINFO_UNIX_INFO2,
        RAW_SFILEINFO_UNIX_LINK               = SMB_SFILEINFO_UNIX_LINK,
        RAW_SFILEINFO_UNIX_HLINK              = SMB_SFILEINFO_UNIX_HLINK,
        RAW_SFILEINFO_BASIC_INFORMATION       = SMB_SFILEINFO_BASIC_INFORMATION,
@@ -881,7 +914,10 @@ enum smb_setfileinfo_level {
        RAW_SFILEINFO_1029                    = SMB_SFILEINFO_1029,
        RAW_SFILEINFO_1032                    = SMB_SFILEINFO_1032,
        RAW_SFILEINFO_1039                    = SMB_SFILEINFO_1039,
-       RAW_SFILEINFO_1040                    = SMB_SFILEINFO_1040
+       RAW_SFILEINFO_1040                    = SMB_SFILEINFO_1040,
+       
+       /* cope with breakage in SMB2 */
+       RAW_SFILEINFO_RENAME_INFORMATION_SMB2 = SMB_SFILEINFO_RENAME_INFORMATION|0x80000000,
 };
 
 /* union used in setfileinfo() and setpathinfo() calls */
@@ -948,7 +984,7 @@ union smb_setfileinfo {
                enum smb_setfileinfo_level level;
                struct {
                        union smb_handle_or_path file;
-                       BOOL delete_on_close;
+                       bool delete_on_close;
                } in;
        } disposition_info;
 
@@ -979,7 +1015,7 @@ union smb_setfileinfo {
                struct {
                        union smb_handle_or_path file;
                        uint8_t overwrite;
-                       uint32_t root_fid;
+                       uint64_t root_fid;
                        const char *new_name;
                } in;
        } rename_information;
@@ -1003,8 +1039,6 @@ union smb_setfileinfo {
                } in;
        } mode_information;
 
-
-
        /* RAW_SFILEINFO_UNIX_BASIC interface */
        struct {
                enum smb_setfileinfo_level level;
@@ -1026,7 +1060,31 @@ union smb_setfileinfo {
                        uint64_t nlink;
                } in;
        } unix_basic;
-       
+
+       /* RAW_SFILEINFO_UNIX_INFO2 interface */
+       struct {
+               enum smb_setfileinfo_level level;
+               struct {
+                       union smb_handle_or_path file;
+                       uint64_t end_of_file;
+                       uint64_t num_bytes;
+                       NTTIME status_change_time;
+                       NTTIME access_time;
+                       NTTIME change_time;
+                       uint64_t uid;
+                       uint64_t gid;
+                       uint32_t file_type;
+                       uint64_t dev_major;
+                       uint64_t dev_minor;
+                       uint64_t unique_id;
+                       uint64_t permissions;
+                       uint64_t nlink;
+                       NTTIME create_time;
+                       uint32_t file_flags;
+                       uint32_t flags_mask;
+               } in;
+       } unix_info2;
+
        /* RAW_SFILEINFO_UNIX_LINK, RAW_SFILEINFO_UNIX_HLINK interface */
        struct {
                enum smb_setfileinfo_level level;
@@ -1509,16 +1567,16 @@ union smb_open {
                enum smb_open_level level;
                struct {
                        /* static body buffer 56 (0x38) bytes */
-                       /* uint16_t buffer_code;  0x39 = 0x38 + 1 */
-                       uint16_t oplock_flags; /* SMB2_CREATE_FLAG_* */
-                       uint32_t impersonation;
-                       uint32_t unknown3[4];
-                       uint32_t access_mask;
-
-                       uint32_t file_attr;
-                       uint32_t share_access;
-                       uint32_t open_disposition;
-                       uint32_t create_options;
+                       uint8_t  security_flags;      /* SMB2_SECURITY_* */
+                       uint8_t  oplock_level;        /* SMB2_OPLOCK_LEVEL_* */
+                       uint32_t impersonation_level; /* SMB2_IMPERSONATION_* */
+                       uint64_t create_flags;
+                       uint64_t reserved;
+                       uint32_t desired_access;
+                       uint32_t file_attributes;
+                       uint32_t share_access; /* NTCREATEX_SHARE_ACCESS_* */
+                       uint32_t create_disposition; /* NTCREATEX_DISP_* */
+                       uint32_t create_options; /* NTCREATEX_OPTIONS_* */
 
                        /* uint16_t fname_ofs */
                        /* uint16_t fname_size */
@@ -1530,13 +1588,22 @@ union smb_open {
 
                        /* optional list of extended attributes */
                        struct smb_ea_list eas;
+
+                       struct smb2_create_blobs {
+                               uint32_t num_blobs;
+                               struct smb2_create_blob {
+                                       const char *tag;
+                                       DATA_BLOB data;
+                               } *blobs;
+                       } blobs;
                } in;
                struct {
                        union smb_handle file;
 
                        /* static body buffer 88 (0x58) bytes */
                        /* uint16_t buffer_code;  0x59 = 0x58 + 1 */
-                       uint16_t oplock_flags; /* SMB2_CREATE_FLAG_* */
+                       uint8_t oplock_level;
+                       uint8_t reserved;
                        uint32_t create_action;
                        NTTIME   create_time;
                        NTTIME   access_time;
@@ -1545,7 +1612,7 @@ union smb_open {
                        uint64_t alloc_size;
                        uint64_t size;
                        uint32_t file_attr;
-                       uint32_t _pad;
+                       uint32_t reserved2;
                        /* struct smb2_handle handle;*/
                        /* uint32_t blob_ofs; */
                        /* uint32_t blob_size; */
@@ -1580,16 +1647,16 @@ union smb_read {
                struct {
                        union smb_handle file;
                        uint64_t offset;
-                       uint16_t mincnt;
+                       uint32_t mincnt; /* enforced on SMB2, 16 bit on SMB */
                        uint32_t maxcnt;
                        uint16_t remaining;
-                       BOOL read_for_execute;
+                       bool read_for_execute;
                } in;
                struct {
                        uint8_t *data;
                        uint16_t remaining;
                        uint16_t compaction_mode;
-                       uint16_t nread;
+                       uint32_t nread;
                } out;
        } readx, generic;
 
@@ -1648,19 +1715,27 @@ union smb_read {
 
                        /* static body buffer 48 (0x30) bytes */
                        /* uint16_t buffer_code;  0x31 = 0x30 + 1 */
-                       uint16_t _pad;
+                       uint8_t _pad;
+                       uint8_t reserved;
                        uint32_t length;
                        uint64_t offset;
                        /* struct smb2_handle handle; */
-                       uint64_t unknown1; /* 0x0000000000000000 */
-                       uint64_t unknown2; /* 0x0000000000000000 */
+                       uint32_t min_count;
+                       uint32_t channel;
+                       uint32_t remaining;
+                       /* the docs give no indication of what
+                          these channel variables are for */
+                       uint16_t channel_offset;
+                       uint16_t channel_length;
                } in;
                struct {
                        /* static body buffer 16 (0x10) bytes */
                        /* uint16_t buffer_code;  0x11 = 0x10 + 1 */
-                       /* uint16_t data_ofs; */
+                       /* uint8_t data_ofs; */
+                       /* uint8_t reserved; */
                        /* uint32_t data_size; */
-                       uint64_t unknown1; /* 0x0000000000000000 */
+                       uint32_t remaining;
+                       uint32_t reserved;
 
                        /* dynamic body */
                        DATA_BLOB data;
@@ -1788,16 +1863,16 @@ enum smb_lock_level {
        RAW_LOCK_LOCK,
        RAW_LOCK_UNLOCK,
        RAW_LOCK_LOCKX,
-       RAW_LOCK_SMB2
+       RAW_LOCK_SMB2,
+       RAW_LOCK_SMB2_BREAK
 };
 
-/* the generic interface is defined to be equal to the lockingX interface */
-#define RAW_LOCK_GENERIC RAW_LOCK_LOCKX
+#define        RAW_LOCK_GENERIC RAW_LOCK_LOCKX
 
 /* union for lock() backend call 
 */
 union smb_lock {
-       /* SMBlockingX (and generic) interface */
+       /* SMBlockingX and generic interface */
        struct {
                enum smb_lock_level level;
                struct {
@@ -1812,7 +1887,7 @@ union smb_lock {
                                uint64_t count;
                        } *locks; /* unlocks are first in the arrray */
                } in;
-       } lockx, generic;
+       } generic, lockx;
 
        /* SMBlock and SMBunlock interface */
        struct {
@@ -1832,47 +1907,86 @@ union smb_lock {
 
                        /* static body buffer 48 (0x30) bytes */
                        /* uint16_t buffer_code;  0x30 */
-                       uint16_t unknown1; /* must be 0x0001 */
-                       uint32_t unknown2;
+                       uint16_t lock_count;
+                       uint32_t reserved;
                        /* struct smb2_handle handle; */
-                       uint64_t offset;
-                       uint64_t count;
-                       uint32_t unknown5;
-#define SMB2_LOCK_FLAG_NONE    0x00000000
-#define SMB2_LOCK_FLAG_EXCLUSIV        0x00000002
-#define SMB2_LOCK_FLAG_UNLOCK  0x00000004
-#define SMB2_LOCK_FLAGS_MASK   0x00000006
-                       uint32_t flags; 
+                       struct smb2_lock_element {
+                               uint64_t offset;
+                               uint64_t length;
+/* these flags are the same as the SMB2 lock flags */
+#define SMB2_LOCK_FLAG_NONE            0x00000000
+#define SMB2_LOCK_FLAG_SHARED          0x00000001
+#define SMB2_LOCK_FLAG_EXCLUSIVE       0x00000002
+#define SMB2_LOCK_FLAG_UNLOCK          0x00000004
+#define SMB2_LOCK_FLAG_FAIL_IMMEDIATELY        0x00000010
+#define SMB2_LOCK_FLAG_ALL_MASK                0x00000017
+                               uint32_t flags;
+                               uint32_t reserved;
+                       } *locks;
                } in;
                struct {
                        /* static body buffer 4 (0x04) bytes */
                        /* uint16_t buffer_code;  0x04 */
-                       uint16_t unknown1;
+                       uint16_t reserved;
                } out;
        } smb2;
+
+       /* SMB2 Break */
+       struct smb2_break {
+               enum smb_lock_level level;
+               struct {
+                       union smb_handle file;
+
+                       /* static body buffer 24 (0x18) bytes */
+                       uint8_t oplock_level;
+                       uint8_t reserved;
+                       uint32_t reserved2;
+                       /* struct smb2_handle handle; */
+               } in, out;
+       } smb2_break;
 };
 
 
 enum smb_close_level {
        RAW_CLOSE_CLOSE,
        RAW_CLOSE_SPLCLOSE,
-       RAW_CLOSE_SMB2
+       RAW_CLOSE_SMB2,
+       RAW_CLOSE_GENERIC,
 };
 
-#define RAW_CLOSE_GENERIC RAW_CLOSE_CLOSE
-
 /*
   union for close() backend call
 */
 union smb_close {
-       /* SMBclose (and generic) interface */
+       /* generic interface */
+       struct {
+               enum smb_close_level level;
+               struct {
+                       union smb_handle file;
+                       time_t write_time;
+#define SMB2_CLOSE_FLAGS_FULL_INFORMATION (1<<0)
+                       uint16_t flags; /* SMB2_CLOSE_FLAGS_* */
+               } in;
+               struct {
+                       uint16_t flags;
+                       NTTIME   create_time;
+                       NTTIME   access_time;
+                       NTTIME   write_time;
+                       NTTIME   change_time;
+                       uint64_t alloc_size;
+                       uint64_t size;
+                       uint32_t file_attr;
+               } out;
+       } generic;
+
+       /* SMBclose interface */
        struct {
                enum smb_close_level level;
                struct {
                        union smb_handle file;
                        time_t write_time;
                } in;
-       } close, generic;
+       } close;
 
        /* SMBsplclose interface - empty! */
        struct {
@@ -1890,7 +2004,6 @@ union smb_close {
 
                        /* static body buffer 24 (0x18) bytes */
                        /* uint16_t buffer_code;  0x18 */
-#define SMB2_CLOSE_FLAGS_FULL_INFORMATION (1<<0)
                        uint16_t flags; /* SMB2_CLOSE_FLAGS_* */
                        uint32_t _pad;
                } in;
@@ -1984,7 +2097,7 @@ union smb_ioctl {
                struct {
                        union smb_handle file;
                        uint32_t function;
-                       BOOL fsctl;
+                       bool fsctl;
                        uint8_t filter;
                        uint32_t max_data;
                        DATA_BLOB blob;
@@ -2064,8 +2177,12 @@ union smb_flush {
                enum smb_flush_level level;
                struct {
                        union smb_handle file;
-                       uint32_t unknown;
+                       uint16_t reserved1;
+                       uint32_t reserved2;
                } in;
+               struct {
+                       uint16_t reserved;
+               } out;
        } smb2;
 };
 
@@ -2115,36 +2232,73 @@ struct smb_nttrans {
                uint32_t max_data;
                uint32_t setup_count;
                uint16_t function;
-               uint16_t *setup;
+               uint8_t  *setup;
                DATA_BLOB params;
                DATA_BLOB data;
        } in;
 
        struct {
-               uint8_t  setup_count;
-               uint16_t *setup;
+               uint8_t  setup_count; /* in units of 16 bit words */
+               uint8_t  *setup;
                DATA_BLOB params;
                DATA_BLOB data;
        } out;
 };
 
+enum smb_notify_level {
+       RAW_NOTIFY_NTTRANS,
+       RAW_NOTIFY_SMB2
+};
 
-/* struct for nttrans change notify call */
-struct smb_notify {
+union smb_notify {
+       /* struct for nttrans change notify call */
        struct {
-               union smb_handle file;
-               uint32_t buffer_size;
-               uint32_t completion_filter;
-               BOOL recursive;
-       } in;
+               enum smb_notify_level level;
 
-       struct {
-               uint32_t num_changes;
-               struct notify_changes {
-                       uint32_t action;
-                       struct smb_wire_string name;
-               } *changes;
-       } out;
+               struct {
+                       union smb_handle file;
+                       uint32_t buffer_size;
+                       uint32_t completion_filter;
+                       bool recursive;
+               } in;
+
+               struct {
+                       uint32_t num_changes;
+                       struct notify_changes {
+                               uint32_t action;
+                               struct smb_wire_string name;
+                       } *changes;
+               } out;
+       } nttrans;
+
+       struct smb2_notify {
+               enum smb_notify_level level;
+               
+               struct {
+                       union smb_handle file;
+                       /* static body buffer 32 (0x20) bytes */
+                       /* uint16_t buffer_code;  0x32 */
+                       uint16_t recursive;
+                       uint32_t buffer_size;
+                       /*struct  smb2_handle file;*/
+                       uint32_t completion_filter;
+                       uint32_t unknown;
+               } in;
+
+               struct {
+                       /* static body buffer 8 (0x08) bytes */
+                       /* uint16_t buffer_code; 0x09 = 0x08 + 1 */
+                       /* uint16_t blob_ofs; */
+                       /* uint16_t blob_size; */
+
+                       /* dynamic body */
+                       /*DATA_BLOB blob;*/
+
+                       /* DATA_BLOB content */
+                       uint32_t num_changes;
+                       struct notify_changes *changes;
+               } out;
+       } smb2;
 };
 
 enum smb_search_level {
@@ -2167,7 +2321,8 @@ enum smb_search_data_level {
        RAW_SEARCH_DATA_BOTH_DIRECTORY_INFO     = SMB_FIND_BOTH_DIRECTORY_INFO,
        RAW_SEARCH_DATA_ID_FULL_DIRECTORY_INFO  = SMB_FIND_ID_FULL_DIRECTORY_INFO,
        RAW_SEARCH_DATA_ID_BOTH_DIRECTORY_INFO  = SMB_FIND_ID_BOTH_DIRECTORY_INFO,
-       RAW_SEARCH_DATA_UNIX_INFO               = SMB_FIND_UNIX_INFO
+       RAW_SEARCH_DATA_UNIX_INFO               = SMB_FIND_UNIX_INFO,
+       RAW_SEARCH_DATA_UNIX_INFO2              = SMB_FIND_UNIX_INFO2
 };
        
 /* union for file search */
@@ -2226,10 +2381,11 @@ union smb_search_first {
 #define SMB2_FIND_ID_BOTH_DIRECTORY_INFO 0x25
 #define SMB2_FIND_ID_FULL_DIRECTORY_INFO 0x26
 
-/* flags for RAW_FILEINFO_SMB2_ALL_EAS */
+/* flags for SMB2 find */
 #define SMB2_CONTINUE_FLAG_RESTART    0x01
 #define SMB2_CONTINUE_FLAG_SINGLE     0x02
-#define SMB2_CONTINUE_FLAG_NEW        0x10
+#define SMB2_CONTINUE_FLAG_INDEX      0x04
+#define SMB2_CONTINUE_FLAG_REOPEN     0x10
 
        /* SMB2 Find */
        struct smb2_find {
@@ -2242,7 +2398,7 @@ union smb_search_first {
                        /* uint16_t buffer_code;  0x21 = 0x20 + 1 */
                        uint8_t level;
                        uint8_t continue_flags; /* SMB2_CONTINUE_FLAG_* */
-                       uint32_t unknown; /* perhaps a continue token? */
+                       uint32_t file_index; 
                        /* struct smb2_handle handle; */
                        /* uint16_t pattern_ofs; */
                        /* uint16_t pattern_size; */
@@ -2467,8 +2623,32 @@ union smb_search_data {
                uint64_t nlink;         
                const char *name;
        } unix_info;
+
+       /* RAW_SEARCH_DATA_UNIX_INFO2 interface */
+       struct {
+               uint32_t file_index;
+               uint64_t end_of_file;
+               uint64_t num_bytes;
+               NTTIME status_change_time;
+               NTTIME access_time;
+               NTTIME change_time;
+               uint64_t uid;
+               uint64_t gid;
+               uint32_t file_type;
+               uint64_t dev_major;
+               uint64_t dev_minor;
+               uint64_t unique_id;
+               uint64_t permissions;
+               uint64_t nlink;
+               NTTIME create_time;
+               uint32_t file_flags;
+               uint32_t flags_mask;
+               struct smb_wire_string name;
+       } unix_info2;
 };
 
+/* Callback function passed to the raw search interface. */
+typedef bool (*smbcli_search_callback)(void *private, const union smb_search_data *file);
 
 enum smb_search_close_level {RAW_FINDCLOSE_GENERIC, RAW_FINDCLOSE_FCLOSE, RAW_FINDCLOSE_FINDCLOSE};
 
@@ -2500,4 +2680,37 @@ union smb_search_close {
        } findclose;
 };
 
+
+/*
+  struct for SMBecho call
+*/
+struct smb_echo {
+       struct {
+               uint16_t repeat_count;
+               uint16_t size;
+               uint8_t *data;
+       } in;
+       struct {
+               uint16_t count;
+               uint16_t sequence_number;
+               uint16_t size;
+               uint8_t *data;
+       } out;
+};
+
+/*
+  struct for shadow copy volumes
+ */
+struct smb_shadow_copy {
+       struct {
+               union smb_handle file;
+               uint32_t max_data;
+       } in;
+       struct {
+               uint32_t num_volumes;
+               uint32_t num_names;
+               const char **names;
+       } out;
+};
+
 #endif /* __LIBCLI_RAW_INTERFACES_H__ */