Merge branch 'v4-0-test' of git://git.samba.org/samba into 4-0-local
[kai/samba-autobuild/.git] / source4 / libcli / smb2 / smb2_calls.h
index 7d41a0615314a94e76da778a62d719adc698e156..f66236af30c90e9e780ffcfe7569051442e7fb7f 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,
    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/>.
 */
 
+#include "libcli/raw/interfaces.h"
 
 struct smb2_negprot {
        struct {
-               uint32_t unknown1;    /* 0x00010024 */
-               uint16_t unknown2;    /* 0x00 */
-               uint8_t  unknown3[32]; /* all zero */
+               uint16_t dialect_count;    /* size of dialects array */
+               uint16_t security_mode;    /* 0==signing disabled   
+                                             1==signing enabled */
+               uint16_t reserved;
+               uint32_t capabilities;
+               struct GUID client_guid;
+               NTTIME   start_time;
+               uint16_t *dialects;
        } in;
        struct {
-               uint32_t unknown1; /* 0x41 */
-               uint32_t unknown2; /* 0x06 */
-               uint8_t  sessid[16];
-               uint32_t unknown3; /* 0x0d */
-               uint16_t unknown4; /* 0x00 */
-               uint32_t unknown5; /* 0x01 */
-               uint32_t unknown6; /* 0x01 */
-               uint16_t unknown7; /* 0x01 */
-               NTTIME   current_time;
-               NTTIME   boot_time;
-               uint16_t unknown8; /* 0x80 */
-               /* uint16_t secblob size here */
-               uint32_t unknown9; /* 0x204d4c20 */
+               /* static body buffer 64 (0x40) bytes */
+               /* uint16_t buffer_code;  0x41 = 0x40 + 1 */
+               uint16_t security_mode; /* SMB2_NEGOTIATE_SIGNING_* */
+               uint16_t dialect_revision;
+               uint16_t reserved;
+               struct GUID server_guid;
+               uint32_t capabilities;
+               uint32_t max_transact_size;
+               uint32_t max_read_size;
+               uint32_t max_write_size;
+               NTTIME   system_time;
+               NTTIME   server_start_time;
+               /* uint16_t secblob_ofs */
+               /* uint16_t secblob_size */
+               uint32_t reserved2;
                DATA_BLOB secblob;
        } out;
 };
 
-struct smb2_session_setup {
-       struct {
-               uint32_t unknown1; /* 0x11 */
-               uint32_t unknown2; /* 0xF */
-               uint32_t unknown3; /* 0x00 */
-               /* uint16_t secblob ofs/size here */
-               DATA_BLOB secblob;
-       } in;
-       struct {
-               uint32_t unknown1; /* 0x09 */
-               /* uint16_t secblob ofs/size here */
-               DATA_BLOB secblob;
-               uint64_t uid; /* returned in header */
-       } out;
-};
+/* getinfo classes */
+#define SMB2_GETINFO_FILE               0x01
+#define SMB2_GETINFO_FS                 0x02
+#define SMB2_GETINFO_SECURITY           0x03
+#define SMB2_GETINFO_QUOTA              0x04
 
-struct smb2_tree_connect {
-       struct {
-               uint32_t unknown1; /* 0x09 */
-               const char *path;
-       } in;
-       struct {
-               uint32_t unknown1; /* 0x00020010 */
-               uint32_t unknown2; /* 0x00 */
-               uint32_t unknown3; /* 0x00 */
-               uint32_t unknown4; /* 0x1f01ff */ /* capabilities?? */
-               uint32_t tid;
-       } out;
-};
+#define SMB2_GETINFO_ADD_OWNER_SECURITY 0x01
+#define SMB2_GETINFO_ADD_GROUP_SECURITY 0x02
+#define SMB2_GETINFO_ADD_DACL_SECURITY  0x04
+#define SMB2_GETINFO_ADD_SACL_SECURITY  0x08
+#define SMB2_GETINFO_ADD_LABEL_SECURITY 0x10
 
-/*
-  file handles in SMB2 are 16 bytes
-*/
-struct smb2_handle {
-       uint64_t data[2];
-};
+/* NOTE! the getinfo fs and file levels exactly match up with the
+   'passthru' SMB levels, which are levels >= 1000. The SMB2 client
+   lib uses the names from the libcli/raw/ library */
 
-struct smb2_create {
+struct smb2_getinfo {
        struct {
-               uint32_t unknown1; /* 0x09000039 */
-               uint32_t unknown2; /* 2 */
-               uint32_t unknown3[4];
-               uint32_t access_mask;
-               uint32_t file_attr;
-               uint32_t unknown4;
-               uint32_t open_disposition;
-               uint32_t unknown5;
-               /* ofs/len of name here, 16 bits */
-               uint32_t unknown6;
-               const char *fname;
-               uint32_t unknown7;
-               uint32_t unknown8;
-               uint32_t unknown9;
-               uint32_t unknown10;
-               uint64_t unknown11;
+               /* static body buffer 40 (0x28) bytes */
+               /* uint16_t buffer_code;  0x29 = 0x28 + 1 */
+               uint8_t info_type;
+               uint8_t info_class;
+               uint32_t output_buffer_length;
+               /* uint32_t input_buffer_offset; */
+               uint32_t reserved;
+               uint32_t input_buffer_length;
+               uint32_t additional_information; /* SMB2_GETINFO_ADD_* */
+               uint32_t getinfo_flags; /* level specific */
+               union smb_handle file;
+               DATA_BLOB blob;
        } in;
 
        struct {
-               uint32_t unknown1;
-               uint32_t unknown2;
-               NTTIME   create_time;
-               NTTIME   access_time;
-               NTTIME   write_time;
-               NTTIME   change_time;
-               uint32_t unknown3;
-               uint32_t unknown4;
-               uint32_t unknown5;
-               uint32_t unknown6;
-               uint32_t unknown7;
-               uint32_t unknown8;
-               uint32_t unknown9;
-               struct smb2_handle handle;
-               uint32_t unknown10;
+               /* 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;
        } out;
 };
 
-
-struct smb2_close {
+struct smb2_setinfo {
        struct {
-               uint32_t unknown1;
-               uint32_t unknown2;
-               struct smb2_handle handle;
+               uint16_t level;
+               uint32_t flags;
+               union smb_handle file;
+               DATA_BLOB blob;
        } in;
-
-       struct {
-               uint32_t unknown1;
-               uint32_t unknown2;
-               NTTIME   create_time;
-               NTTIME   access_time;
-               NTTIME   write_time;
-               NTTIME   change_time;
-               uint32_t unknown3;
-               uint32_t unknown4;
-               uint32_t unknown5;
-               uint32_t unknown6;
-               uint32_t unknown7;
-       } out;
 };
 
+struct cli_credentials;
+struct event_context;
+struct resolve_context;
+#include "libcli/smb2/smb2_proto.h"