Getting ready to add UNIX extensions in HEAD also.
[sfrench/samba-autobuild/.git] / source / include / trans2.h
1 /* 
2    Unix SMB/Netbios implementation.
3    Version 1.9.
4    SMB transaction2 handling
5    Copyright (C) Jeremy Allison 1994-1998
6
7    Extensively modified by Andrew Tridgell, 1995
8
9    This program is free software; you can redistribute it and/or modify
10    it under the terms of the GNU General Public License as published by
11    the Free Software Foundation; either version 2 of the License, or
12    (at your option) any later version.
13    
14    This program is distributed in the hope that it will be useful,
15    but WITHOUT ANY WARRANTY; without even the implied warranty of
16    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17    GNU General Public License for more details.
18    
19    You should have received a copy of the GNU General Public License
20    along with this program; if not, write to the Free Software
21    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 */
23
24 #ifndef _TRANS2_H_
25 #define _TRANS2_H_
26
27 /* Define the structures needed for the trans2 calls. */
28
29 /*******************************************************
30  For DosFindFirst/DosFindNext - level 1
31
32 MAXFILENAMELEN = 255;
33 FDATE == uint16
34 FTIME == uint16
35 ULONG == uint32
36 USHORT == uint16
37
38 typedef struct _FILEFINDBUF {
39 Byte offset   Type     name                description
40 -------------+-------+-------------------+--------------
41 0             FDATE    fdateCreation;
42 2             FTIME    ftimeCreation;
43 4             FDATE    fdateLastAccess;
44 6             FTIME    ftimeLastAccess;
45 8             FDATE    fdateLastWrite;
46 10            FTIME    ftimeLastWrite;
47 12            ULONG    cbFile               file length in bytes
48 16            ULONG    cbFileAlloc          size of file allocation unit
49 20            USHORT   attrFile
50 22            UCHAR    cchName              length of name to follow (not including zero)
51 23            UCHAR    achName[MAXFILENAMELEN]; Null terminated name
52 } FILEFINDBUF;
53 *********************************************************/
54
55 #define l1_fdateCreation 0
56 #define l1_fdateLastAccess 4
57 #define l1_fdateLastWrite 8
58 #define l1_cbFile 12
59 #define l1_cbFileAlloc 16
60 #define l1_attrFile 20
61 #define l1_cchName 22
62 #define l1_achName 23
63
64 /**********************************************************
65 For DosFindFirst/DosFindNext - level 2
66
67 typedef struct _FILEFINDBUF2 {
68 Byte offset   Type     name                description
69 -------------+-------+-------------------+--------------
70 0             FDATE    fdateCreation;
71 2             FTIME    ftimeCreation;
72 4             FDATE    fdateLastAccess;
73 6             FTIME    ftimeLastAccess;
74 8             FDATE    fdateLastWrite;
75 10            FTIME    ftimeLastWrite;
76 12            ULONG    cbFile               file length in bytes
77 16            ULONG    cbFileAlloc          size of file allocation unit
78 20            USHORT   attrFile
79 22            ULONG    cbList               Extended attribute list (always 0)
80 26            UCHAR    cchName              length of name to follow (not including zero)
81 27            UCHAR    achName[MAXFILENAMELEN]; Null terminated name
82 } FILEFINDBUF2;
83 *************************************************************/
84
85 #define l2_fdateCreation 0
86 #define l2_fdateLastAccess 4
87 #define l2_fdateLastWrite 8
88 #define l2_cbFile 12
89 #define l2_cbFileAlloc 16
90 #define l2_attrFile 20
91 #define l2_cbList 22
92 #define l2_cchName 26
93 #define l2_achName 27
94
95
96 /**********************************************************
97 For DosFindFirst/DosFindNext - level 260
98
99 typedef struct _FILEFINDBUF260 {
100 Byte offset   Type     name                description
101 -------------+-------+-------------------+--------------
102 0              ULONG  NextEntryOffset;
103 4              ULONG  FileIndex;
104 8              LARGE_INTEGER CreationTime;
105 16             LARGE_INTEGER LastAccessTime;
106 24             LARGE_INTEGER LastWriteTime;
107 32             LARGE_INTEGER ChangeTime;
108 40             LARGE_INTEGER EndOfFile;
109 48             LARGE_INTEGER AllocationSize;
110 56             ULONG FileAttributes;
111 60             ULONG FileNameLength;
112 64             ULONG EaSize;
113 68             CHAR ShortNameLength;
114 70             UNICODE ShortName[12];
115 94             UNICODE FileName[];
116 *************************************************************/
117
118 #define l260_achName 94
119
120
121 /**********************************************************
122 For DosQueryPathInfo/DosQueryFileInfo/DosSetPathInfo/
123 DosSetFileInfo - level 1
124
125 typedef struct _FILESTATUS {
126 Byte offset   Type     name                description
127 -------------+-------+-------------------+--------------
128 0             FDATE    fdateCreation;
129 2             FTIME    ftimeCreation;
130 4             FDATE    fdateLastAccess;
131 6             FTIME    ftimeLastAccess;
132 8             FDATE    fdateLastWrite;
133 10            FTIME    ftimeLastWrite;
134 12            ULONG    cbFile               file length in bytes
135 16            ULONG    cbFileAlloc          size of file allocation unit
136 20            USHORT   attrFile
137 } FILESTATUS;
138 *************************************************************/
139
140 /* Use the l1_ defines from DosFindFirst */
141
142 /**********************************************************
143 For DosQueryPathInfo/DosQueryFileInfo/DosSetPathInfo/
144 DosSetFileInfo - level 2
145
146 typedef struct _FILESTATUS2 {
147 Byte offset   Type     name                description
148 -------------+-------+-------------------+--------------
149 0             FDATE    fdateCreation;
150 2             FTIME    ftimeCreation;
151 4             FDATE    fdateLastAccess;
152 6             FTIME    ftimeLastAccess;
153 8             FDATE    fdateLastWrite;
154 10            FTIME    ftimeLastWrite;
155 12            ULONG    cbFile               file length in bytes
156 16            ULONG    cbFileAlloc          size of file allocation unit
157 20            USHORT   attrFile
158 22            ULONG    cbList               Length of EA's (0)
159 } FILESTATUS2;
160 *************************************************************/
161
162 /* Use the l2_ #defines from DosFindFirst */
163
164 /**********************************************************
165 For DosQFSInfo/DosSetFSInfo - level 1
166
167 typedef struct _FSALLOCATE {
168 Byte offset   Type     name                description
169 -------------+-------+-------------------+--------------
170 0             ULONG    idFileSystem       id of file system
171 4             ULONG    cSectorUnit        number of sectors per allocation unit
172 8             ULONG    cUnit              number of allocation units
173 12            ULONG    cUnitAvail         Available allocation units
174 16            USHORT   cbSector           bytes per sector
175 } FSALLOCATE;
176 *************************************************************/
177
178 #define l1_idFileSystem 0
179 #define l1_cSectorUnit 4
180 #define l1_cUnit 8
181 #define l1_cUnitAvail 12
182 #define l1_cbSector 16
183
184 /**********************************************************
185 For DosQFSInfo/DosSetFSInfo - level 2
186
187 typedef struct _FSINFO {
188 Byte offset   Type     name                description
189 -------------+-------+-------------------+--------------
190 0             FDATE   vol_fdateCreation
191 2             FTIME   vol_ftimeCreation
192 4             UCHAR   vol_cch             length of volume name (excluding NULL)
193 5             UCHAR   vol_szVolLabel[12]  volume name
194 } FSINFO;
195 *************************************************************/
196
197 #define SMB_INFO_STANDARD               1
198 #define SMB_INFO_QUERY_EA_SIZE          2
199 #define SMB_INFO_QUERY_EAS_FROM_LIST    3
200 #define SMB_INFO_QUERY_ALL_EAS          4
201 #define SMB_INFO_IS_NAME_VALID          6
202 #define SMB_QUERY_FS_LABEL_INFO                 0x101
203 #define SMB_QUERY_FS_VOLUME_INFO                0x102
204 #define SMB_QUERY_FS_SIZE_INFO                  0x103
205 #define SMB_QUERY_FS_DEVICE_INFO                0x104
206 #define SMB_QUERY_FS_ATTRIBUTE_INFO             0x105
207
208
209 #define l2_vol_fdateCreation 0
210 #define l2_vol_cch 4
211 #define l2_vol_szVolLabel 5
212
213
214 #define SMB_QUERY_FILE_BASIC_INFO       0x101
215 #define SMB_QUERY_FILE_STANDARD_INFO    0x102
216 #define SMB_QUERY_FILE_EA_INFO          0x103
217 #define SMB_QUERY_FILE_NAME_INFO        0x104
218 #define SMB_QUERY_FILE_ALLOCATION_INFO  0x105
219 #define SMB_QUERY_FILE_END_OF_FILEINFO  0x106
220 #define SMB_QUERY_FILE_ALL_INFO         0x107
221 #define SMB_QUERY_FILE_ALT_NAME_INFO    0x108
222 #define SMB_QUERY_FILE_STREAM_INFO      0x109
223
224 #define SMB_FIND_FILE_DIRECTORY_INFO            0x101
225 #define SMB_FIND_FILE_FULL_DIRECTORY_INFO       0x102
226 #define SMB_FIND_FILE_NAMES_INFO                0x103
227 #define SMB_FIND_FILE_BOTH_DIRECTORY_INFO       0x104
228
229 #define SMB_SET_FILE_BASIC_INFO         0x101
230 #define SMB_SET_FILE_DISPOSITION_INFO   0x102
231 #define SMB_SET_FILE_ALLOCATION_INFO    0x103
232 #define SMB_SET_FILE_END_OF_FILE_INFO   0x104
233
234 /*
235  * Thursby MAC extensions....
236  */
237
238 /*
239  * MAC CIFS Extensions have the range 0x300 - 0x2FF reserved.
240  * Supposedly Microsoft have agreed to this.
241  */
242
243 #define MIN_MAC_INFO_LEVEL 0x300
244 #define MAX_MAC_INFO_LEVEL 0x3FF
245
246 #define SMB_MAC_QUERY_FS_INFO           0x301
247
248 #define DIRLEN_GUESS (45+MAX(l1_achName,l2_achName))
249
250 /*
251  * DeviceType and Characteristics returned in a
252  * SMB_QUERY_FS_DEVICE_INFO call.
253  */
254
255 #define DEVICETYPE_CD_ROM               0x2
256 #define DEVICETYPE_CD_ROM_FILE_SYSTEM   0x3
257 #define DEVICETYPE_DISK                 0x7
258 #define DEVICETYPE_DISK_FILE_SYSTEM     0x8
259 #define DEVICETYPE_FILE_SYSTEM          0x9
260
261 /* Characteristics. */
262 #define TYPE_REMOVABLE_MEDIA            0x1
263 #define TYPE_READ_ONLY_DEVICE           0x2
264 #define TYPE_FLOPPY                     0x4
265 #define TYPE_WORM                       0x8
266 #define TYPE_REMOTE                     0x10
267 #define TYPE_MOUNTED                    0x20
268 #define TYPE_VIRTUAL                    0x40
269
270 /* NT passthrough levels... */
271
272 #define SMB_FILE_DIRECTORY_INFORMATION                  1001
273 #define SMB_FILE_FULL_DIRECTORY_INFORMATION             1002
274 #define SMB_FILE_BOTH_DIRECTORY_INFORMATION             1003
275 #define SMB_FILE_BASIC_INFORMATION                      1004
276 #define SMB_FILE_STANDARD_INFORMATION                   1005
277 #define SMB_FILE_INTERNAL_INFORMATION                   1006
278 #define SMB_FILE_EA_INFORMATION                         1007
279 #define SMB_FILE_ACCESS_INFORMATION                     1008
280 #define SMB_FILE_NAME_INFORMATION                       1009
281 #define SMB_FILE_RENAME_INFORMATION                     1010
282 #define SMB_FILE_LINK_INFORMATION                       1011
283 #define SMB_FILE_NAMES_INFORMATION                      1012
284 #define SMB_FILE_DISPOSITION_INFORMATION                1013
285 #define SMB_FILE_POSITION_INFORMATION                   1014
286 #define SMB_FILE_FULL_EA_INFORMATION                    1015
287 #define SMB_FILE_MODE_INFORMATION                       1016
288 #define SMB_FILE_ALIGNMENT_INFORMATION                  1017
289 #define SMB_FILE_ALL_INFORMATION                        1018
290 #define SMB_FILE_ALLOCATION_INFORMATION                 1019
291 #define SMB_FILE_END_OF_FILE_INFORMATION                1020
292 #define SMB_FILE_ALTERNATE_NAME_INFORMATION             1021
293 #define SMB_FILE_STREAM_INFORMATION                     1022
294 #define SMB_FILE_PIPE_INFORMATION                       1023
295 #define SMB_FILE_PIPE_LOCAL_INFORMATION                 1024
296 #define SMB_FILE_PIPE_REMOTE_INFORMATION                1025
297 #define SMB_FILE_MAILSLOT_QUERY_INFORMATION             1026
298 #define SMB_FILE_MAILSLOT_SET_INFORMATION               1027
299 #define SMB_FILE_COMPRESSION_INFORMATION                1028
300 #define SMB_FILE_OBJECTID_INFORMATION                   1029
301 #define SMB_FILE_COMPLETION_INFORMATION                 1030
302 #define SMB_FILE_MOVE_CLUSTER_INFORMATION               1031
303 #define SMB_FILE_QUOTA_INFORMATION                      1032
304 #define SMB_FILE_REPARSEPOINT_INFORMATION               1033
305 #define SMB_FILE_NETWORK_OPEN_INFORMATION               1034
306 #define SMB_FILE_ATTRIBUTE_TAG_INFORMATION              1035
307 #define SMB_FILE_TRACKING_INFORMATION                   1036
308 #define SMB_FILE_MAXIMUM_INFORMATION                    1037
309
310 /* UNIX CIFS Extensions - created by HP */
311 /*
312  * UNIX CIFS Extensions have the range 0x200 - 0x2FF reserved.
313  * Supposedly Microsoft have agreed to this.
314  */
315
316 #define MIN_UNIX_INFO_LEVEL 0x200
317 #define MAX_UNIX_INFO_LEVEL 0x2FF
318
319 #define SMB_QUERY_FILE_UNIX_BASIC      0x200   /* UNIX File Info*/
320 #define SMB_SET_FILE_UNIX_BASIC        0x200
321
322 #define MODE_NO_CHANGE                 -1     /* file mode value which */
323                                               /* means "don't change it" */
324
325 /*
326  LARGE_INTEGER EndOfFile                File size
327  LARGE_INTEGER Blocks                   Number of bytes used on disk (st_blocks).
328  LARGE_INTEGER CreationTime             Creation time
329  LARGE_INTEGER LastAccessTime           Last access time
330  LARGE_INTEGER LastModificationTime     Last modification time
331  LARGE_INTEGER Uid                      Numeric user id for the owner
332  LARGE_INTEGER Gid                      Numeric group id of owner
333  ULONG Type                             Enumeration specifying the pathname type:
334                                          0 -- File
335                                          1 -- Directory
336                                          2 -- Symbolic link
337                                          3 -- Character device
338                                          4 -- Block device
339                                          5 -- FIFO (named pipe)
340
341  LARGE_INTEGER devmajor                 Major device number if type is device
342  LARGE_INTEGER devminor                 Minor device number if type is device
343  LARGE_INTEGER uniqueid                 This is a server-assigned unique id for the file. The client
344                                         will typically map this onto an inode number. The scope of
345                                         uniqueness is the share.
346  LARGE_INTEGER permissions              Standard UNIX file permissions
347  LARGE_INTEGER nlinks                   The number of directory entries that map to this entry
348                                           (number of hard links)
349
350 */
351
352 #define SMB_QUERY_FILE_UNIX_LINK       0x201
353 #define SMB_SET_FILE_UNIX_LINK         0x201
354 #define SMB_SET_FILE_UNIX_HLINK        0x203
355
356 #define SMB_FIND_FILE_UNIX             0x202
357
358 #endif