source: vendor/current/source3/include/trans2.h@ 454

Last change on this file since 454 was 414, checked in by Herwig Bauernfeind, 16 years ago

Samba 3.5.0: Initial import

File size: 27.0 KB
Line 
1/*
2 Unix SMB/CIFS implementation.
3 SMB transaction2 handling
4
5 Copyright (C) James Peach 2007
6 Copyright (C) Jeremy Allison 1994-2002.
7
8 Extensively modified by Andrew Tridgell, 1995
9
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 3 of the License, or
13 (at your option) any later version.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program. If not, see <http://www.gnu.org/licenses/>.
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
32MAXFILENAMELEN = 255;
33FDATE == uint16
34FTIME == uint16
35ULONG == uint32
36USHORT == uint16
37
38typedef struct _FILEFINDBUF {
39Byte offset Type name description
40-------------+-------+-------------------+--------------
410 FDATE fdateCreation;
422 FTIME ftimeCreation;
434 FDATE fdateLastAccess;
446 FTIME ftimeLastAccess;
458 FDATE fdateLastWrite;
4610 FTIME ftimeLastWrite;
4712 ULONG cbFile file length in bytes
4816 ULONG cbFileAlloc size of file allocation unit
4920 USHORT attrFile
5022 UCHAR cchName length of name to follow (not including zero)
5123 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/**********************************************************
65For DosFindFirst/DosFindNext - level 2
66
67typedef struct _FILEFINDBUF2 {
68Byte offset Type name description
69-------------+-------+-------------------+--------------
700 FDATE fdateCreation;
712 FTIME ftimeCreation;
724 FDATE fdateLastAccess;
736 FTIME ftimeLastAccess;
748 FDATE fdateLastWrite;
7510 FTIME ftimeLastWrite;
7612 ULONG cbFile file length in bytes
7716 ULONG cbFileAlloc size of file allocation unit
7820 USHORT attrFile
7922 ULONG cbList Extended attribute list (always 0)
8026 UCHAR cchName length of name to follow (not including zero)
8127 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/**********************************************************
97For DosFindFirst/DosFindNext - level 260
98
99typedef struct _FILEFINDBUF260 {
100Byte offset Type name description
101-------------+-------+-------------------+--------------
1020 ULONG NextEntryOffset;
1034 ULONG FileIndex;
1048 LARGE_INTEGER CreationTime;
10516 LARGE_INTEGER LastAccessTime;
10624 LARGE_INTEGER LastWriteTime;
10732 LARGE_INTEGER ChangeTime;
10840 LARGE_INTEGER EndOfFile;
10948 LARGE_INTEGER AllocationSize;
11056 ULONG FileAttributes;
11160 ULONG FileNameLength;
11264 ULONG EaSize;
11368 CHAR ShortNameLength;
11470 UNICODE ShortName[12];
11594 UNICODE FileName[];
116*************************************************************/
117
118#define l260_achName 94
119
120
121/**********************************************************
122For DosQueryPathInfo/DosQueryFileInfo/DosSetPathInfo/
123DosSetFileInfo - level 1
124
125typedef struct _FILESTATUS {
126Byte offset Type name description
127-------------+-------+-------------------+--------------
1280 FDATE fdateCreation;
1292 FTIME ftimeCreation;
1304 FDATE fdateLastAccess;
1316 FTIME ftimeLastAccess;
1328 FDATE fdateLastWrite;
13310 FTIME ftimeLastWrite;
13412 ULONG cbFile file length in bytes
13516 ULONG cbFileAlloc size of file allocation unit
13620 USHORT attrFile
137} FILESTATUS;
138*************************************************************/
139
140/* Use the l1_ defines from DosFindFirst */
141
142/**********************************************************
143For DosQueryPathInfo/DosQueryFileInfo/DosSetPathInfo/
144DosSetFileInfo - level 2
145
146typedef struct _FILESTATUS2 {
147Byte offset Type name description
148-------------+-------+-------------------+--------------
1490 FDATE fdateCreation;
1502 FTIME ftimeCreation;
1514 FDATE fdateLastAccess;
1526 FTIME ftimeLastAccess;
1538 FDATE fdateLastWrite;
15410 FTIME ftimeLastWrite;
15512 ULONG cbFile file length in bytes
15616 ULONG cbFileAlloc size of file allocation unit
15720 USHORT attrFile
15822 ULONG cbList Length of EA's (0)
159} FILESTATUS2;
160*************************************************************/
161
162/* Use the l2_ #defines from DosFindFirst */
163
164/**********************************************************
165For DosQFSInfo/DosSetFSInfo - level 1
166
167typedef struct _FSALLOCATE {
168Byte offset Type name description
169-------------+-------+-------------------+--------------
1700 ULONG idFileSystem id of file system
1714 ULONG cSectorUnit number of sectors per allocation unit
1728 ULONG cUnit number of allocation units
17312 ULONG cUnitAvail Available allocation units
17416 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/**********************************************************
185For DosQFSInfo/DosSetFSInfo - level 2
186
187typedef struct _FSINFO {
188Byte offset Type name description
189-------------+-------+-------------------+--------------
1900 FDATE vol_fdateCreation
1912 FTIME vol_ftimeCreation
1924 UCHAR vol_cch length of volume name (excluding NULL)
1935 UCHAR vol_szVolLabel[12] volume name
194} FSINFO;
195*************************************************************/
196
197#define SMB_INFO_STANDARD 1 /* FILESTATUS3 struct */
198#define SMB_INFO_SET_EA 2 /* EAOP2 struct, only valid on set not query */
199#define SMB_INFO_QUERY_EA_SIZE 2 /* FILESTATUS4 struct, only valid on query not set */
200#define SMB_INFO_QUERY_EAS_FROM_LIST 3 /* only valid on query not set */
201#define SMB_INFO_QUERY_ALL_EAS 4 /* only valid on query not set */
202#define SMB_INFO_IS_NAME_VALID 6
203#define SMB_INFO_STANDARD_LONG 11 /* similar to level 1, ie struct FileStatus3 */
204#define SMB_QUERY_EA_SIZE_LONG 12 /* similar to level 2, ie struct FileStatus4 */
205#define SMB_QUERY_FS_LABEL_INFO 0x101
206#define SMB_QUERY_FS_VOLUME_INFO 0x102
207#define SMB_QUERY_FS_SIZE_INFO 0x103
208#define SMB_QUERY_FS_DEVICE_INFO 0x104
209#define SMB_QUERY_FS_ATTRIBUTE_INFO 0x105
210#if 0
211#define SMB_QUERY_FS_QUOTA_INFO
212#endif
213
214#define l2_vol_fdateCreation 0
215#define l2_vol_cch 4
216#define l2_vol_szVolLabel 5
217
218
219#define SMB_QUERY_FILE_BASIC_INFO 0x101
220#define SMB_QUERY_FILE_STANDARD_INFO 0x102
221#define SMB_QUERY_FILE_EA_INFO 0x103
222#define SMB_QUERY_FILE_NAME_INFO 0x104
223#define SMB_QUERY_FILE_ALLOCATION_INFO 0x105
224#define SMB_QUERY_FILE_END_OF_FILEINFO 0x106
225#define SMB_QUERY_FILE_ALL_INFO 0x107
226#define SMB_QUERY_FILE_ALT_NAME_INFO 0x108
227#define SMB_QUERY_FILE_STREAM_INFO 0x109
228#define SMB_QUERY_COMPRESSION_INFO 0x10b
229
230#define SMB_FIND_INFO_STANDARD 1
231#define SMB_FIND_EA_SIZE 2
232#define SMB_FIND_EA_LIST 3
233#define SMB_FIND_FILE_DIRECTORY_INFO 0x101
234#define SMB_FIND_FILE_FULL_DIRECTORY_INFO 0x102
235#define SMB_FIND_FILE_NAMES_INFO 0x103
236#define SMB_FIND_FILE_BOTH_DIRECTORY_INFO 0x104
237#define SMB_FIND_ID_FULL_DIRECTORY_INFO 0x105
238#define SMB_FIND_ID_BOTH_DIRECTORY_INFO 0x106
239
240#define SMB_SET_FILE_BASIC_INFO 0x101
241#define SMB_SET_FILE_DISPOSITION_INFO 0x102
242#define SMB_SET_FILE_ALLOCATION_INFO 0x103
243#define SMB_SET_FILE_END_OF_FILE_INFO 0x104
244
245/* Query FS info. */
246#define SMB_INFO_ALLOCATION 1
247#define SMB_INFO_VOLUME 2
248
249/*
250 * Thursby MAC extensions....
251 */
252
253/*
254 * MAC CIFS Extensions have the range 0x300 - 0x2FF reserved.
255 * Supposedly Microsoft have agreed to this.
256 */
257
258#define MIN_MAC_INFO_LEVEL 0x300
259#define MAX_MAC_INFO_LEVEL 0x3FF
260
261#define SMB_MAC_QUERY_FS_INFO 0x301
262
263#define DIRLEN_GUESS (45+MAX(l1_achName,l2_achName))
264
265/*
266 * DeviceType and Characteristics returned in a
267 * SMB_QUERY_FS_DEVICE_INFO call.
268 */
269
270#define DEVICETYPE_CD_ROM 0x2
271#define DEVICETYPE_CD_ROM_FILE_SYSTEM 0x3
272#define DEVICETYPE_DISK 0x7
273#define DEVICETYPE_DISK_FILE_SYSTEM 0x8
274#define DEVICETYPE_FILE_SYSTEM 0x9
275
276/* Characteristics. */
277#define TYPE_REMOVABLE_MEDIA 0x1
278#define TYPE_READ_ONLY_DEVICE 0x2
279#define TYPE_FLOPPY 0x4
280#define TYPE_WORM 0x8
281#define TYPE_REMOTE 0x10
282#define TYPE_MOUNTED 0x20
283#define TYPE_VIRTUAL 0x40
284
285/* NT passthrough levels... */
286
287#define SMB_FILE_DIRECTORY_INFORMATION 1001
288#define SMB_FILE_FULL_DIRECTORY_INFORMATION 1002
289#define SMB_FILE_BOTH_DIRECTORY_INFORMATION 1003
290#define SMB_FILE_BASIC_INFORMATION 1004
291#define SMB_FILE_STANDARD_INFORMATION 1005
292#define SMB_FILE_INTERNAL_INFORMATION 1006
293#define SMB_FILE_EA_INFORMATION 1007
294#define SMB_FILE_ACCESS_INFORMATION 1008
295#define SMB_FILE_NAME_INFORMATION 1009
296#define SMB_FILE_RENAME_INFORMATION 1010
297#define SMB_FILE_LINK_INFORMATION 1011
298#define SMB_FILE_NAMES_INFORMATION 1012
299#define SMB_FILE_DISPOSITION_INFORMATION 1013
300#define SMB_FILE_POSITION_INFORMATION 1014
301#define SMB_FILE_FULL_EA_INFORMATION 1015
302#define SMB_FILE_MODE_INFORMATION 1016
303#define SMB_FILE_ALIGNMENT_INFORMATION 1017
304#define SMB_FILE_ALL_INFORMATION 1018
305#define SMB_FILE_ALLOCATION_INFORMATION 1019
306#define SMB_FILE_END_OF_FILE_INFORMATION 1020
307#define SMB_FILE_ALTERNATE_NAME_INFORMATION 1021
308#define SMB_FILE_STREAM_INFORMATION 1022
309#define SMB_FILE_PIPE_INFORMATION 1023
310#define SMB_FILE_PIPE_LOCAL_INFORMATION 1024
311#define SMB_FILE_PIPE_REMOTE_INFORMATION 1025
312#define SMB_FILE_MAILSLOT_QUERY_INFORMATION 1026
313#define SMB_FILE_MAILSLOT_SET_INFORMATION 1027
314#define SMB_FILE_COMPRESSION_INFORMATION 1028
315#define SMB_FILE_OBJECTID_INFORMATION 1029
316#define SMB_FILE_COMPLETION_INFORMATION 1030
317#define SMB_FILE_MOVE_CLUSTER_INFORMATION 1031
318#define SMB_FILE_QUOTA_INFORMATION 1032
319#define SMB_FILE_REPARSEPOINT_INFORMATION 1033
320#define SMB_FILE_NETWORK_OPEN_INFORMATION 1034
321#define SMB_FILE_ATTRIBUTE_TAG_INFORMATION 1035
322#define SMB_FILE_TRACKING_INFORMATION 1036
323#define SMB_FILE_MAXIMUM_INFORMATION 1037
324
325/* NT passthough levels for qfsinfo. */
326
327#define SMB_FS_VOLUME_INFORMATION 1001
328#define SMB_FS_LABEL_INFORMATION 1002
329#define SMB_FS_SIZE_INFORMATION 1003
330#define SMB_FS_DEVICE_INFORMATION 1004
331#define SMB_FS_ATTRIBUTE_INFORMATION 1005
332#define SMB_FS_QUOTA_INFORMATION 1006
333#define SMB_FS_FULL_SIZE_INFORMATION 1007
334#define SMB_FS_OBJECTID_INFORMATION 1008
335
336/* flags on trans2 findfirst/findnext that control search */
337#define FLAG_TRANS2_FIND_CLOSE 0x1
338#define FLAG_TRANS2_FIND_CLOSE_IF_END 0x2
339#define FLAG_TRANS2_FIND_REQUIRE_RESUME 0x4
340#define FLAG_TRANS2_FIND_CONTINUE 0x8
341#define FLAG_TRANS2_FIND_BACKUP_INTENT 0x10
342
343/* UNIX CIFS Extensions - created by HP */
344/*
345 * UNIX CIFS Extensions have the range 0x200 - 0x2FF reserved.
346 * Supposedly Microsoft have agreed to this.
347 */
348
349#define MIN_UNIX_INFO_LEVEL 0x200
350#define MAX_UNIX_INFO_LEVEL 0x2FF
351
352#define INFO_LEVEL_IS_UNIX(level) (((level) >= MIN_UNIX_INFO_LEVEL) && ((level) <= MAX_UNIX_INFO_LEVEL))
353
354#define SMB_QUERY_FILE_UNIX_BASIC 0x200 /* UNIX File Info*/
355#define SMB_SET_FILE_UNIX_BASIC 0x200
356#define SMB_SET_FILE_UNIX_INFO2 0x20B /* UNIX File Info2 */
357
358#define SMB_MODE_NO_CHANGE 0xFFFFFFFF /* file mode value which */
359 /* means "don't change it" */
360#define SMB_UID_NO_CHANGE 0xFFFFFFFF
361#define SMB_GID_NO_CHANGE 0xFFFFFFFF
362
363#define SMB_SIZE_NO_CHANGE_LO 0xFFFFFFFF
364#define SMB_SIZE_NO_CHANGE_HI 0xFFFFFFFF
365
366#define SMB_TIME_NO_CHANGE_LO 0xFFFFFFFF
367#define SMB_TIME_NO_CHANGE_HI 0xFFFFFFFF
368
369/*
370Offset Size Name
3710 LARGE_INTEGER EndOfFile File size
3728 LARGE_INTEGER Blocks Number of bytes used on disk (st_blocks).
37316 LARGE_INTEGER CreationTime Creation time
37424 LARGE_INTEGER LastAccessTime Last access time
37532 LARGE_INTEGER LastModificationTime Last modification time
37640 LARGE_INTEGER Uid Numeric user id for the owner
37748 LARGE_INTEGER Gid Numeric group id of owner
37856 ULONG Type Enumeration specifying the pathname type:
379 0 -- File
380 1 -- Directory
381 2 -- Symbolic link
382 3 -- Character device
383 4 -- Block device
384 5 -- FIFO (named pipe)
385 6 -- Unix domain socket
386