opening/creating files in SMB2 now works. Lots of unknown parameters
[samba-svnmirror.git] / source / libcli / smb2 / smb2_calls.h
1 /* 
2    Unix SMB/CIFS implementation.
3
4    SMB2 client calls 
5
6    Copyright (C) Andrew Tridgell 2005
7    
8    This program is free software; you can redistribute it and/or modify
9    it under the terms of the GNU General Public License as published by
10    the Free Software Foundation; either version 2 of the License, or
11    (at your option) any later version.
12    
13    This program is distributed in the hope that it will be useful,
14    but WITHOUT ANY WARRANTY; without even the implied warranty of
15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16    GNU General Public License for more details.
17    
18    You should have received a copy of the GNU General Public License
19    along with this program; if not, write to the Free Software
20    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 */
22
23
24 struct smb2_negprot {
25         struct {
26                 uint32_t unknown1;    /* 0x00010024 */
27                 uint16_t unknown2;    /* 0x00 */
28                 uint8_t  unknown3[32]; /* all zero */
29         } in;
30         struct {
31                 uint32_t unknown1; /* 0x41 */
32                 uint32_t unknown2; /* 0x06 */
33                 uint8_t  sessid[16];
34                 uint32_t unknown3; /* 0x0d */
35                 uint16_t unknown4; /* 0x00 */
36                 uint32_t unknown5; /* 0x01 */
37                 uint32_t unknown6; /* 0x01 */
38                 uint16_t unknown7; /* 0x01 */
39                 NTTIME   current_time;
40                 NTTIME   boot_time;
41                 uint16_t unknown8; /* 0x80 */
42                 /* uint16_t secblob size here */
43                 uint32_t unknown9; /* 0x204d4c20 */
44                 DATA_BLOB secblob;
45         } out;
46 };
47
48 struct smb2_session_setup {
49         struct {
50                 uint32_t unknown1; /* 0x11 */
51                 uint32_t unknown2; /* 0xF */
52                 uint32_t unknown3; /* 0x00 */
53                 /* uint16_t secblob ofs/size here */
54                 DATA_BLOB secblob;
55         } in;
56         struct {
57                 uint32_t unknown1; /* 0x09 */
58                 /* uint16_t secblob ofs/size here */
59                 DATA_BLOB secblob;
60                 uint64_t uid; /* returned in header */
61         } out;
62 };
63
64 struct smb2_tree_connect {
65         struct {
66                 uint32_t unknown1; /* 0x09 */
67                 const char *path;
68         } in;
69         struct {
70                 uint32_t unknown1; /* 0x00020010 */
71                 uint32_t unknown2; /* 0x00 */
72                 uint32_t unknown3; /* 0x00 */
73                 uint32_t unknown4; /* 0x1f01ff */ /* capabilities?? */
74                 uint32_t tid;
75         } out;
76 };
77
78 /*
79   file handles in SMB2 are 20 bytes, like RPC handles
80 */
81 struct smb2_handle {
82         uint8_t data[20];
83 };
84
85 struct smb2_create {
86         struct {
87                 uint32_t unknown1; /* 0x09000039 */
88                 uint32_t unknown2; /* 2 */
89                 uint32_t unknown3[4];
90                 uint32_t access_mask;
91                 uint32_t file_attr;
92                 uint32_t unknown4;
93                 uint32_t open_disposition;
94                 uint32_t unknown5;
95                 /* ofs/len of name here, 16 bits */
96                 uint32_t unknown6;
97                 const char *fname;
98                 uint32_t unknown7;
99                 uint32_t unknown8;
100                 uint32_t unknown9;
101                 uint32_t unknown10;
102                 uint64_t unknown11;
103         } in;
104
105         struct {
106                 uint32_t unknown1;
107                 uint32_t unknown2;
108                 NTTIME   create_time;
109                 NTTIME   access_time;
110                 NTTIME   write_time;
111                 NTTIME   change_time;
112                 uint32_t unknown3;
113                 uint32_t unknown4;
114                 uint32_t unknown5;
115                 uint32_t unknown6;
116                 uint32_t unknown7;
117                 struct smb2_handle handle;
118                 uint32_t unknown8[2];
119         } out;
120 };
121