patch-2_6_7-vs1_9_1_12
[linux-2.6.git] / fs / cifs / cifspdu.h
1 /*
2  *   fs/cifs/cifspdu.h
3  *
4  *   Copyright (c) International Business Machines  Corp., 2002
5  *   Author(s): Steve French (sfrench@us.ibm.com)
6  *
7  *   This library is free software; you can redistribute it and/or modify
8  *   it under the terms of the GNU Lesser General Public License as published
9  *   by the Free Software Foundation; either version 2.1 of the License, or
10  *   (at your option) any later version.
11  *
12  *   This library is distributed in the hope that it will be useful,
13  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
15  *   the GNU Lesser General Public License for more details.
16  *
17  *   You should have received a copy of the GNU Lesser General Public License
18  *   along with this library; if not, write to the Free Software
19  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
20  */
21
22 #ifndef _CIFSPDU_H
23 #define _CIFSPDU_H
24
25 #include <net/sock.h>
26
27 #define CIFS_PROT   0
28 #define BAD_PROT    CIFS_PROT+1
29
30 /* SMB command codes */
31 #define SMB_COM_CREATE_DIRECTORY      0x00
32 #define SMB_COM_DELETE_DIRECTORY      0x01
33 #define SMB_COM_CLOSE                 0x04
34 #define SMB_COM_DELETE                0x06
35 #define SMB_COM_RENAME                0x07
36 #define SMB_COM_LOCKING_ANDX          0x24
37 #define SMB_COM_COPY                  0x29
38 #define SMB_COM_READ_ANDX             0x2E
39 #define SMB_COM_WRITE_ANDX            0x2F
40 #define SMB_COM_TRANSACTION2          0x32
41 #define SMB_COM_TRANSACTION2_SECONDARY 0x33
42 #define SMB_COM_FIND_CLOSE2           0x34
43 #define SMB_COM_TREE_DISCONNECT       0x71
44 #define SMB_COM_NEGOTIATE             0x72
45 #define SMB_COM_SESSION_SETUP_ANDX    0x73
46 #define SMB_COM_LOGOFF_ANDX           0x74
47 #define SMB_COM_TREE_CONNECT_ANDX     0x75
48 #define SMB_COM_NT_TRANSACT           0xA0
49 #define SMB_COM_NT_TRANSACT_SECONDARY 0xA1
50 #define SMB_COM_NT_CREATE_ANDX        0xA2
51 #define SMB_COM_NT_RENAME             0xA5
52
53 /* Transact2 subcommand codes */
54 #define TRANS2_OPEN                   0x00
55 #define TRANS2_FIND_FIRST             0x01
56 #define TRANS2_FIND_NEXT              0x02
57 #define TRANS2_QUERY_FS_INFORMATION   0x03
58 #define TRANS2_QUERY_PATH_INFORMATION 0x05
59 #define TRANS2_SET_PATH_INFORMATION   0x06
60 #define TRANS2_QUERY_FILE_INFORMATION 0x07
61 #define TRANS2_SET_FILE_INFORMATION   0x08
62 #define TRANS2_GET_DFS_REFERRAL       0x10
63 #define TRANS2_REPORT_DFS_INCOSISTENCY 0x11
64
65 /* NT Transact subcommand codes */
66 #define NT_TRANSACT_CREATE            0x01
67 #define NT_TRANSACT_IOCTL             0x02
68 #define NT_TRANSACT_SET_SECURITY_DESC 0x03
69 #define NT_TRANSACT_NOTIFY_CHANGE     0x04
70 #define NT_TRANSACT_RENAME            0x05
71 #define NT_TRANSACT_QUERY_SECURITY_DESC 0x06
72 #define NT_TRANSACT_GET_USER_QUOTA    0x07
73 #define NT_TRANSACT_SET_USER_QUOTA    0x08
74
75 #define MAX_CIFS_HDR_SIZE 256   /* chained NTCreateXReadX will probably be biggest */
76
77 /* internal cifs vfs structures */
78 /*****************************************************************
79  * All constants go here
80  *****************************************************************
81  */
82
83 /*
84  * Starting value for maximum SMB size negotiation
85  */
86 #define CIFS_MAX_MSGSIZE (4*4096)
87
88 /*
89  * Size of encrypted user password in bytes
90  */
91 #define CIFS_ENCPWD_SIZE (16)
92
93 /*
94  * Size of the crypto key returned on the negotiate SMB in bytes
95  */
96 #define CIFS_CRYPTO_KEY_SIZE (8)
97
98 /*
99  * Size of the session key (crypto key encrypted with the password
100  */
101 #define CIFS_SESSION_KEY_SIZE (24)
102
103 /*
104  * Maximum user name length
105  */
106 #define CIFS_UNLEN (20)
107
108 /*
109  * Flags on SMB open
110  */
111 #define SMBOPEN_WRITE_THROUGH 0x4000
112 #define SMBOPEN_DENY_ALL      0x0010
113 #define SMBOPEN_DENY_WRITE    0x0020
114 #define SMBOPEN_DENY_READ     0x0030
115 #define SMBOPEN_DENY_NONE     0x0040
116 #define SMBOPEN_READ          0x0000
117 #define SMBOPEN_WRITE         0x0001
118 #define SMBOPEN_READWRITE     0x0002
119 #define SMBOPEN_EXECUTE       0x0003
120
121 #define SMBOPEN_OCREATE       0x0010
122 #define SMBOPEN_OTRUNC        0x0002
123 #define SMBOPEN_OAPPEND       0x0001
124
125 /*
126  * SMB flag definitions 
127  */
128 #define SMBFLG_EXTD_LOCK 0x01   /* server supports lock-read write-unlock primitives */
129 #define SMBFLG_RCV_POSTED 0x02  /* obsolete */
130 #define SMBFLG_RSVD 0x04
131 #define SMBFLG_CASELESS 0x08    /* all pathnames treated as caseless (off implies case sensitive file handling requested) */
132 #define SMBFLG_CANONICAL_PATH_FORMAT 0x10       /* obsolete */
133 #define SMBFLG_OLD_OPLOCK 0x20  /* obsolete */
134 #define SMBFLG_OLD_OPLOCK_NOTIFY 0x40   /* obsolete */
135 #define SMBFLG_RESPONSE 0x80    /* this PDU is a response from server */
136
137 /*
138  * SMB flag2 definitions 
139  */
140 #define SMBFLG2_KNOWS_LONG_NAMES 0x0001 /* can send long (non-8.3) path names in response */
141 #define SMBFLG2_KNOWS_EAS 0x0002
142 #define SMBFLG2_SECURITY_SIGNATURE 0x0004
143 #define SMBFLG2_IS_LONG_NAME 0x0040
144 #define SMBFLG2_EXT_SEC 0x0800
145 #define SMBFLG2_DFS 0x1000
146 #define SMBFLG2_PAGING_IO 0x2000
147 #define SMBFLG2_ERR_STATUS 0x4000
148 #define SMBFLG2_UNICODE 0x8000
149
150 /*
151  * These are the file access permission bits defined in CIFS for the
152  * NTCreateAndX as well as the level 0x107
153  * TRANS2_QUERY_PATH_INFORMATION API.  The level 0x107, SMB_QUERY_FILE_ALL_INFO
154  * responds with the AccessFlags.
155  * The AccessFlags specifies the access permissions a caller has to the
156  * file and can have any suitable combination of the following values:
157  */
158
159 #define FILE_READ_DATA        0x00000001        /* Data can be read from the file   */
160 #define FILE_WRITE_DATA       0x00000002        /* Data can be written to the file  */
161 #define FILE_APPEND_DATA      0x00000004        /* Data can be appended to the file */
162 #define FILE_READ_EA          0x00000008        /* Extended attributes associated   */
163                                          /* with the file can be read        */
164 #define FILE_WRITE_EA         0x00000010        /* Extended attributes associated   */
165                                          /* with the file can be written     */
166 #define FILE_EXECUTE          0x00000020        /*Data can be read into memory from */
167                                          /* the file using system paging I/O */
168 #define FILE_DELETE_CHILD     0x00000040
169 #define FILE_READ_ATTRIBUTES  0x00000080        /* Attributes associated with the   */
170                                          /* file can be read                 */
171 #define FILE_WRITE_ATTRIBUTES 0x00000100        /* Attributes associated with the   */
172                                          /* file can be written              */
173 #define DELETE                0x00010000        /* The file can be deleted          */
174 #define READ_CONTROL          0x00020000        /* The access control list and      */
175                                          /* ownership associated with the    */
176                                          /* file can be read                 */
177 #define WRITE_DAC             0x00040000        /* The access control list and      */
178                                          /* ownership associated with the    */
179                                          /* file can be written.             */
180 #define WRITE_OWNER           0x00080000        /* Ownership information associated */
181                                          /* with the file can be written     */
182 #define SYNCHRONIZE           0x00100000        /* The file handle can waited on to */
183                                          /* synchronize with the completion  */
184                                          /* of an input/output request       */
185 #define GENERIC_ALL           0x10000000
186 #define GENERIC_EXECUTE       0x20000000
187 #define GENERIC_WRITE         0x40000000
188 #define GENERIC_READ          0x80000000
189                                          /* In summary - Relevant file       */
190                                          /* access flags from CIFS are       */
191                                          /* file_read_data, file_write_data  */
192                                          /* file_execute, file_read_attributes */
193                                          /* write_dac, and delete.           */
194
195 /*
196  * Invalid readdir handle
197  */
198 #define CIFS_NO_HANDLE        0xFFFF
199
200 /* IPC$ in ASCII */
201 #define CIFS_IPC_RESOURCE "\x49\x50\x43\x24"
202
203 /* IPC$ in Unicode */
204 #define CIFS_IPC_UNICODE_RESOURCE "\x00\x49\x00\x50\x00\x43\x00\x24\x00\x00"
205
206 /* Unicode Null terminate 2 bytes of 0 */
207 #define UNICODE_NULL "\x00\x00"
208 #define ASCII_NULL 0x00
209
210 /*
211  * Server type values (returned on EnumServer API
212  */
213 #define CIFS_SV_TYPE_DC     0x00000008
214 #define CIFS_SV_TYPE_BACKDC 0x00000010
215
216 /*
217  * Alias type flags (From EnumAlias API call
218  */
219 #define CIFS_ALIAS_TYPE_FILE 0x0001
220 #define CIFS_SHARE_TYPE_FILE 0x0000
221
222 /*
223  * File Attribute flags
224  */
225 #define ATTR_READONLY  0x0001
226 #define ATTR_HIDDEN    0x0002
227 #define ATTR_SYSTEM    0x0004
228 #define ATTR_VOLUME    0x0008
229 #define ATTR_DIRECTORY 0x0010
230 #define ATTR_ARCHIVE   0x0020
231 #define ATTR_DEVICE    0x0040
232 #define ATTR_NORMAL    0x0080
233 #define ATTR_TEMPORARY 0x0100
234 #define ATTR_SPARSE    0x0200
235 #define ATTR_REPARSE   0x0400
236 #define ATTR_COMPRESSED 0x0800
237 #define ATTR_OFFLINE    0x1000  /* ie file not immediately available - offline storage */
238 #define ATTR_NOT_CONTENT_INDEXED 0x2000
239 #define ATTR_ENCRYPTED  0x4000
240 #define ATTR_POSIX_SEMANTICS 0x01000000
241 #define ATTR_BACKUP_SEMANTICS 0x02000000
242 #define ATTR_DELETE_ON_CLOSE 0x04000000
243 #define ATTR_SEQUENTIAL_SCAN 0x08000000
244 #define ATTR_RANDOM_ACCESS   0x10000000
245 #define ATTR_NO_BUFFERING    0x20000000
246 #define ATTR_WRITE_THROUGH   0x80000000
247
248 /* ShareAccess flags */
249 #define FILE_NO_SHARE     0x00000000
250 #define FILE_SHARE_READ   0x00000001
251 #define FILE_SHARE_WRITE  0x00000002
252 #define FILE_SHARE_DELETE 0x00000004
253 #define FILE_SHARE_ALL    0x00000007
254
255 /* CreateDisposition flags */
256 #define FILE_SUPERSEDE    0x00000000
257 #define FILE_OPEN         0x00000001
258 #define FILE_CREATE       0x00000002
259 #define FILE_OPEN_IF      0x00000003
260 #define FILE_OVERWRITE    0x00000004
261 #define FILE_OVERWRITE_IF 0x00000005
262
263 /* CreateOptions */
264 #define CREATE_NOT_FILE         0x00000001      /* if set must not be file */
265 #define CREATE_WRITE_THROUGH    0x00000002
266 #define CREATE_NOT_DIR          0x00000040      /* if set must not be directory */
267 #define CREATE_RANDOM_ACCESS    0x00000800
268 #define CREATE_DELETE_ON_CLOSE  0x00001000
269 #define OPEN_REPARSE_POINT      0x00200000
270
271 /* ImpersonationLevel flags */
272 #define SECURITY_ANONYMOUS      0
273 #define SECURITY_IDENTIFICATION 1
274 #define SECURITY_IMPERSONATION  2
275 #define SECURITY_DELEGATION     3
276
277 /* SecurityFlags */
278 #define SECURITY_CONTEXT_TRACKING 0x01
279 #define SECURITY_EFFECTIVE_ONLY   0x02
280
281 /*
282  * Default PID value, used in all SMBs where the PID is not important
283  */
284 #define CIFS_DFT_PID  0x1234
285
286 /*
287  * We use the same routine for Copy and Move SMBs.  This flag is used to
288  * distinguish
289  */
290 #define CIFS_COPY_OP 1
291 #define CIFS_RENAME_OP 2
292
293 #define GETU16(var)  (*((__u16 *)var))  /* BB check for endian issues */
294 #define GETU32(var)  (*((__u32 *)var))  /* BB check for endian issues */
295
296 #pragma pack(1)
297
298 struct smb_hdr {
299         __u32 smb_buf_length;   /* big endian on wire *//* BB length is only two or three bytes - with one or two byte type preceding it but that is always zero - we could mask the type byte off just in case BB */
300         __u8 Protocol[4];
301         __u8 Command;
302         union {
303                 struct {
304                         __u8 ErrorClass;
305                         __u8 Reserved;
306                         __u16 Error;    /* note: treated as little endian (le) on wire */
307                 } DosError;
308                 __u32 CifsError;        /* note: le */
309         } Status;
310         __u8 Flags;
311         __u16 Flags2;           /* note: le */
312         __u16 PidHigh;          /* note: le */
313         union {
314                 struct {
315                         __u32 SequenceNumber;  /* le */
316                         __u32 Reserved; /* zero */
317                 } Sequence;
318                 __u8 SecuritySignature[8];      /* le */
319         } Signature;
320         __u8 pad[2];
321         __u16 Tid;
322         __u16 Pid;              /* note: le */
323         __u16 Uid;
324         __u16 Mid;
325         __u8 WordCount;
326 };
327 /* given a pointer to an smb_hdr retrieve the value of byte count */
328 #define BCC(smb_var) ( *(__u16 *)((char *)smb_var + sizeof(struct smb_hdr) + (2* smb_var->WordCount) ) )
329
330 /* given a pointer to an smb_hdr retrieve the pointer to the byte area */
331 #define pByteArea(smb_var) ((char *)smb_var + sizeof(struct smb_hdr) + (2* smb_var->WordCount) + 2 )
332
333 /*
334  * Computer Name Length
335  */
336 #define CNLEN 15
337
338 /*
339  * Share Name Length                                      @S8A
340  * Note:  This length is limited by the SMB used to get   @S8A
341  *        the Share info.   NetShareEnum only returns 13  @S8A
342  *        chars, including the null termination.          @S8A 
343  */
344 #define SNLEN 12                /*@S8A */
345
346 /*
347  * Comment Length
348  */
349 #define MAXCOMMENTLEN 40
350
351 /*
352  * The OS/2 maximum path name
353  */
354 #define MAX_PATHCONF 256
355
356 /*
357  *  SMB frame definitions  (following must be packed structs)
358  *  See the SNIA CIFS Specification for details.
359  *
360  *  The Naming convention is the lower case version of the
361  *  smb command code name for the struct and this is typedef to the
362  *  uppercase version of the same name with the prefix SMB_ removed 
363  *  for brevity.  Although typedefs are not commonly used for 
364  *  structure definitions in the Linux kernel, their use in the
365  *  CIFS standards document, which this code is based on, may
366  *  make this one of the cases where typedefs for structures make
367  *  sense to improve readability for readers of the standards doc.
368  *  Typedefs can always be removed later if they are too distracting
369  *  and they are only used for the CIFSs PDUs themselves, not
370  *  internal cifs vfs structures
371  *  
372  */
373
374 typedef struct negotiate_req {
375         struct smb_hdr hdr;     /* wct = 0 */
376         __u16 ByteCount;
377         unsigned char DialectsArray[1];
378 } NEGOTIATE_REQ;
379
380 typedef struct negotiate_rsp {
381         struct smb_hdr hdr;     /* wct = 17 */
382         __u16 DialectIndex;
383         __u8 SecurityMode;
384         __u16 MaxMpxCount;
385         __u16 MaxNumberVcs;
386         __u32 MaxBufferSize;
387         __u32 MaxRawSize;
388         __u32 SessionKey;
389         __u32 Capabilities;     /* see below */
390         __u32 SystemTimeLow;
391         __u32 SystemTimeHigh;
392         __u16 ServerTimeZone;
393         __u8 EncryptionKeyLength;
394         __u16 ByteCount;
395         union {
396                 unsigned char EncryptionKey[1]; /* if cap extended security is off */
397                 /* followed by Domain name - if extended security is off */
398                 /* followed by 16 bytes of server GUID */
399                 /* followed by security blob if cap_extended_security negotiated */
400                 struct {
401                         unsigned char GUID[16];
402                         unsigned char SecurityBlob[1];
403                 } extended_response;
404         } u;
405 } NEGOTIATE_RSP;
406
407 /* SecurityMode bits */
408 #define SECMODE_USER          0x01      /* off indicates share level security */
409 #define SECMODE_PW_ENCRYPT    0x02
410 #define SECMODE_SIGN_ENABLED  0x04      /* SMB security signatures enabled */
411 #define SECMODE_SIGN_REQUIRED 0x08      /* SMB security signatures required */
412
413 /* Negotiate response Capabilities */
414 #define CAP_RAW_MODE           0x00000001
415 #define CAP_MPX_MODE           0x00000002
416 #define CAP_UNICODE            0x00000004
417 #define CAP_LARGE_FILES        0x00000008
418 #define CAP_NT_SMBS            0x00000010       /* implies CAP_NT_FIND */
419 #define CAP_RPC_REMOTE_APIS    0x00000020
420 #define CAP_STATUS32           0x00000040
421 #define CAP_LEVEL_II_OPLOCKS   0x00000080
422 #define CAP_LOCK_AND_READ      0x00000100
423 #define CAP_NT_FIND            0x00000200
424 #define CAP_DFS                0x00001000
425 #define CAP_INFOLEVEL_PASSTHRU 0x00002000
426 #define CAP_LARGE_READ_X       0x00004000
427 #define CAP_LARGE_WRITE_X      0x00008000
428 #define CAP_UNIX               0x00800000
429 #define CAP_RESERVED           0x02000000
430 #define CAP_BULK_TRANSFER      0x20000000
431 #define CAP_COMPRESSED_DATA    0x40000000
432 #define CAP_EXTENDED_SECURITY  0x80000000
433
434 typedef union smb_com_session_setup_andx {
435         struct {                /* request format */
436                 struct smb_hdr hdr;     /* wct = 12 */
437                 __u8 AndXCommand;
438                 __u8 AndXReserved;
439                 __u16 AndXOffset;
440                 __u16 MaxBufferSize;
441                 __u16 MaxMpxCount;
442                 __u16 VcNumber;
443                 __u32 SessionKey;
444                 __u16 SecurityBlobLength;
445                 __u32 Reserved;
446                 __u32 Capabilities;     /* see below */
447                 __u16 ByteCount;
448                 unsigned char SecurityBlob[1];  /* followed by */
449                 /* STRING NativeOS */
450                 /* STRING NativeLanMan */
451         } req;                  /* NTLM request format (with extended security */
452
453         struct {                /* request format */
454                 struct smb_hdr hdr;     /* wct = 13 */
455                 __u8 AndXCommand;
456                 __u8 AndXReserved;
457                 __u16 AndXOffset;
458                 __u16 MaxBufferSize;
459                 __u16 MaxMpxCount;
460                 __u16 VcNumber;
461                 __u32 SessionKey;
462                 __u16 CaseInsensitivePasswordLength;    /* ASCII password length */
463                 __u16 CaseSensitivePasswordLength;      /* Unicode password length */
464                 __u32 Reserved; /* see below */
465                 __u32 Capabilities;
466                 __u16 ByteCount;
467                 unsigned char CaseInsensitivePassword[1];       /* followed by: */
468                 /* unsigned char * CaseSensitivePassword; */
469                 /* STRING AccountName */
470                 /* STRING PrimaryDomain */
471                 /* STRING NativeOS */
472                 /* STRING NativeLanMan */
473         } req_no_secext;        /* NTLM request format (without extended security */
474
475         struct {                /* default (NTLM) response format */
476                 struct smb_hdr hdr;     /* wct = 4 */
477                 __u8 AndXCommand;
478                 __u8 AndXReserved;
479                 __u16 AndXOffset;
480                 __u16 Action;   /* see below */
481                 __u16 SecurityBlobLength;
482                 __u16 ByteCount;
483                 unsigned char SecurityBlob[1];  /* followed by */
484 /*      unsigned char  * NativeOS;      */
485 /*      unsigned char  * NativeLanMan;  */
486 /*      unsigned char  * PrimaryDomain; */
487         } resp;                 /* NTLM response format (with or without extended security */
488
489         struct {                /* request format */
490                 struct smb_hdr hdr;     /* wct = 10 */
491                 __u8 AndXCommand;
492                 __u8 AndXReserved;
493                 __u16 AndXOffset;
494                 __u16 MaxBufferSize;
495                 __u16 MaxMpxCount;
496                 __u16 VcNumber;
497                 __u32 SessionKey;
498                 __u16 PassswordLength;
499                 __u32 Reserved;
500                 __u16 ByteCount;
501                 unsigned char AccountPassword[1];       /* followed by */
502                 /* STRING AccountName */
503                 /* STRING PrimaryDomain */
504                 /* STRING NativeOS */
505                 /* STRING NativeLanMan */
506         } old_req;              /* pre-NTLM (LANMAN2.1) request format */
507
508         struct {                /* default (NTLM) response format */
509                 struct smb_hdr hdr;     /* wct = 3 */
510                 __u8 AndXCommand;
511                 __u8 AndXReserved;
512                 __u16 AndXOffset;
513                 __u16 Action;   /* see below */
514                 __u16 ByteCount;
515                 unsigned char NativeOS[1];      /* followed by */
516 /*      unsigned char * NativeLanMan; */
517 /*      unsigned char * PrimaryDomain; */
518         } old_resp;             /* pre-NTLM (LANMAN2.1) response format */
519 } SESSION_SETUP_ANDX;
520
521 #define CIFS_NETWORK_OPSYS "CIFS VFS Client for Linux"
522
523 /* Capabilities bits (for NTLM SessSetup request) */
524 #define CAP_UNICODE            0x00000004
525 #define CAP_LARGE_FILES        0x00000008
526 #define CAP_NT_SMBS            0x00000010
527 #define CAP_STATUS32           0x00000040
528 #define CAP_LEVEL_II_OPLOCKS   0x00000080
529 #define CAP_NT_FIND            0x00000200       /* reserved should be zero (presumably because NT_SMBs implies the same thing) */
530 #define CAP_BULK_TRANSFER      0x20000000
531 #define CAP_EXTENDED_SECURITY  0x80000000
532
533 /* Action bits */
534 #define GUEST_LOGIN 1
535
536 typedef struct smb_com_tconx_req {
537         struct smb_hdr hdr;     /* wct = 4 */
538         __u8 AndXCommand;
539         __u8 AndXReserved;
540         __u16 AndXOffset;
541         __u16 Flags;            /* see below */
542         __u16 PasswordLength;
543         __u16 ByteCount;
544         unsigned char Password[1];      /* followed by */
545 /* STRING Path    *//* \\server\share name */
546         /* STRING Service */
547 } TCONX_REQ;
548
549 typedef struct smb_com_tconx_rsp {
550         struct smb_hdr hdr;     /* wct = 3 *//* note that Win2000 has sent wct=7 in some cases on responses. Four unspecified words followed OptionalSupport */
551         __u8 AndXCommand;
552         __u8 AndXReserved;
553         __u16 AndXOffset;
554         __u16 OptionalSupport;  /* see below */
555         __u16 ByteCount;
556         unsigned char Service[1];       /* always ASCII, not Unicode */
557         /* STRING NativeFileSystem */
558 } TCONX_RSP;
559
560 /* tree connect Flags */
561 #define DISCONNECT_TID          0x0001
562 #define TCON_EXTENDED_SECINFO   0x0008
563 /* OptionalSupport bits */
564 #define SMB_SUPPORT_SEARCH_BITS 0x0001  /* must have bits (exclusive searches suppt. */
565 #define SMB_SHARE_IS_IN_DFS     0x0002
566
567 typedef struct smb_com_logoff_andx_req {
568
569         struct smb_hdr hdr;     /* wct = 2 */
570         __u8 AndXCommand;
571         __u8 AndXReserved;
572         __u16 AndXOffset;
573         __u16 ByteCount;
574 } LOGOFF_ANDX_REQ;
575
576 typedef struct smb_com_logoff_andx_rsp {
577         struct smb_hdr hdr;     /* wct = 2 */
578         __u8 AndXCommand;
579         __u8 AndXReserved;
580         __u16 AndXOffset;
581         __u16 ByteCount;
582 } LOGOFF_ANDX_RSP;
583
584 typedef union smb_com_tree_disconnect { /* as an altetnative can use flag on tree_connect PDU to effect disconnect *//* probably the simplest SMB PDU */
585         struct {
586                 struct smb_hdr hdr;     /* wct = 0 */
587                 __u16 ByteCount;        /* bcc = 0 */
588         } req;
589         struct {
590                 struct smb_hdr hdr;     /* wct = 0 */
591                 __u16 ByteCount;        /* bcc = 0 */
592         } resp;
593 } TREE_DISCONNECT;
594
595 typedef struct smb_com_close_req {
596         struct smb_hdr hdr;     /* wct = 3 */
597         __u16 FileID;
598         __u32 LastWriteTime;    /* should be zero */
599         __u16 ByteCount;        /* 0 */
600 } CLOSE_REQ;
601
602 typedef struct smb_com_close_rsp {
603         struct smb_hdr hdr;     /* wct = 0 */
604         __u16 ByteCount;        /* bct = 0 */
605 } CLOSE_RSP;
606
607 typedef struct smb_com_findclose_req {
608         struct smb_hdr hdr; /* wct = 1 */
609         __u16 FileID;
610         __u16 ByteCount;    /* 0 */
611 } FINDCLOSE_REQ;
612
613 /* OpenFlags */
614 #define REQ_OPLOCK         0x00000002
615 #define REQ_BATCHOPLOCK    0x00000004
616 #define REQ_OPENDIRONLY    0x00000008
617
618 typedef struct smb_com_open_req {       /* also handles create */
619         struct smb_hdr hdr;     /* wct = 24 */
620         __u8 AndXCommand;
621         __u8 AndXReserved;
622         __u16 AndXOffset;
623         __u8 Reserved;          /* Must Be Zero */
624         __u16 NameLength;
625         __u32 OpenFlags;
626         __u32 RootDirectoryFid;
627         __u32 DesiredAccess;
628         __u64 AllocationSize;
629         __u32 FileAttributes;
630         __u32 ShareAccess;
631         __u32 CreateDisposition;
632         __u32 CreateOptions;
633         __u32 ImpersonationLevel;
634         __u8 SecurityFlags;
635         __u16 ByteCount;
636         char fileName[1];
637 } OPEN_REQ;
638
639 /* open response: oplock levels */
640 #define OPLOCK_NONE      0
641 #define OPLOCK_EXCLUSIVE 1
642 #define OPLOCK_BATCH     2
643 #define OPLOCK_READ      3  /* level 2 oplock */
644
645 /* open response for CreateAction shifted left */
646 #define CIFS_CREATE_ACTION 0x20000 /* file created */
647
648 typedef struct smb_com_open_rsp {
649         struct smb_hdr hdr;     /* wct = 34 BB */
650         __u8 AndXCommand;
651         __u8 AndXReserved;
652         __u16 AndXOffset;
653         __u8 OplockLevel;
654         __u16 Fid;
655         __u32 CreateAction;
656         __u64 CreationTime;
657         __u64 LastAccessTime;
658         __u64 LastWriteTime;
659         __u64 ChangeTime;
660         __u32 FileAttributes;
661         __u64 AllocationSize;
662         __u64 EndOfFile;
663         __u16 FileType;
664         __u16 DeviceState;
665         __u8 DirectoryFlag;
666         __u16 ByteCount;        /* bct = 0 */
667 } OPEN_RSP;
668
669 typedef struct smb_com_write_req {
670         struct smb_hdr hdr;     /* wct = 14 */
671         __u8 AndXCommand;
672         __u8 AndXReserved;
673         __u16 AndXOffset;
674         __u16 Fid;
675         __u32 OffsetLow;
676         __u32 Reserved;
677         __u16 WriteMode;
678         __u16 Remaining;
679         __u16 DataLengthHigh;
680         __u16 DataLengthLow;
681         __u16 DataOffset;
682         __u32 OffsetHigh;
683         __u16 ByteCount;
684         __u8 Pad;               /* BB check for whether padded to DWORD boundary and optimum performance here */
685         char Data[1];
686 } WRITE_REQ;
687
688 typedef struct smb_com_write_rsp {
689         struct smb_hdr hdr;     /* wct = 6 */
690         __u8 AndXCommand;
691         __u8 AndXReserved;
692         __u16 AndXOffset;
693         __u16 Count;
694         __u16 Remaining;
695         __u32 Reserved;
696         __u16 ByteCount;
697 } WRITE_RSP;
698
699 typedef struct smb_com_read_req {
700         struct smb_hdr hdr;     /* wct = 12 */
701         __u8 AndXCommand;
702         __u8 AndXReserved;
703         __u16 AndXOffset;
704         __u16 Fid;
705         __u32 OffsetLow;
706         __u16 MaxCount;
707         __u16 MinCount;         /* obsolete */
708         __u32 MaxCountHigh;
709         __u16 Remaining;
710         __u32 OffsetHigh;
711         __u16 ByteCount;
712 } READ_REQ;
713
714 typedef struct smb_com_read_rsp {
715         struct smb_hdr hdr;     /* wct = 12 */
716         __u8 AndXCommand;
717         __u8 AndXReserved;
718         __u16 AndXOffset;
719         __u16 Remaining;
720         __u16 DataCompactionMode;
721         __u16 Reserved;
722         __u16 DataLength;
723         __u16 DataOffset;
724         __u16 DataLengthHigh;
725         __u64 Reserved2;
726         __u16 ByteCount;
727         __u8 Pad;               /* BB check for whether padded to DWORD boundary and optimum performance here */
728         char Data[1];
729 } READ_RSP;
730
731 typedef struct locking_andx_range {
732         __u16 Pid;
733         __u16 Pad;
734         __u32 OffsetHigh;
735         __u32 OffsetLow;
736         __u32 LengthHigh;
737         __u32 LengthLow;
738 } LOCKING_ANDX_RANGE;
739
740 #define LOCKING_ANDX_SHARED_LOCK     0x01
741 #define LOCKING_ANDX_OPLOCK_RELEASE  0x02
742 #define LOCKING_ANDX_CHANGE_LOCKTYPE 0x04
743 #define LOCKING_ANDX_CANCEL_LOCK     0x08
744 #define LOCKING_ANDX_LARGE_FILES     0x10       /* always on for us */
745
746 typedef struct smb_com_lock_req {
747         struct smb_hdr hdr;     /* wct = 8 */
748         __u8 AndXCommand;
749         __u8 AndXReserved;
750         __u16 AndXOffset;
751         __u16 Fid;
752         __u8 LockType;
753         __u8 OplockLevel;
754         __u32 Timeout;
755         __u16 NumberOfUnlocks;
756         __u16 NumberOfLocks;
757         __u16 ByteCount;
758         LOCKING_ANDX_RANGE Locks[1];
759 } LOCK_REQ;
760
761 typedef struct smb_com_lock_rsp {
762         struct smb_hdr hdr;     /* wct = 2 */
763         __u8 AndXCommand;
764         __u8 AndXReserved;
765         __u16 AndXOffset;
766         __u16 ByteCount;
767 } LOCK_RSP;
768
769 typedef struct smb_com_rename_req {
770         struct smb_hdr hdr;     /* wct = 1 */
771         __u16 SearchAttributes; /* target file attributes */
772         __u16 ByteCount;
773         __u8 BufferFormat;      /* 4 = ASCII or Unicode */
774         unsigned char OldFileName[1];
775         /* followed by __u8 BufferFormat2 */
776         /* followed by NewFileName */
777 } RENAME_REQ;
778
779         /* copy request flags */
780 #define COPY_MUST_BE_FILE      0x0001
781 #define COPY_MUST_BE_DIR       0x0002
782 #define COPY_TARGET_MODE_ASCII 0x0004 /* if not set, binary */
783 #define COPY_SOURCE_MODE_ASCII 0x0008 /* if not set, binary */
784 #define COPY_VERIFY_WRITES     0x0010
785 #define COPY_TREE              0x0020 
786
787 typedef struct smb_com_copy_req {
788         struct smb_hdr hdr;     /* wct = 3 */
789         __u16 Tid2;
790         __u16 OpenFunction;
791         __u16 Flags;
792         __u16 ByteCount;
793         __u8 BufferFormat;      /* 4 = ASCII or Unicode */ 
794         unsigned char OldFileName[1];
795         /* followed by __u8 BufferFormat2 */
796         /* followed by NewFileName string */
797 } COPY_REQ;
798
799 typedef struct smb_com_copy_rsp {
800         struct smb_hdr hdr;     /* wct = 1 */
801         __u16 CopyCount;    /* number of files copied */
802         __u16 ByteCount;    /* may be zero */
803         __u8 BufferFormat;  /* 0x04 - only present if errored file follows */
804         unsigned char ErrorFileName[1]; /* only present if error in copy */
805 } COPY_RSP;
806
807 #define CREATE_HARD_LINK                0x103
808 #define MOVEFILE_COPY_ALLOWED           0x0002
809 #define MOVEFILE_REPLACE_EXISTING       0x0001
810
811 typedef struct smb_com_nt_rename_req {  /* A5 - also used for create hardlink */
812         struct smb_hdr hdr;     /* wct = 4 */
813         __u16 SearchAttributes; /* target file attributes */
814         __u16 Flags;            /* spec says Information Level */
815         __u32 ClusterCount;
816         __u16 ByteCount;
817         __u8 BufferFormat;      /* 4 = ASCII or Unicode */
818         unsigned char OldFileName[1];
819         /* followed by __u8 BufferFormat2 */
820         /* followed by NewFileName */
821 } NT_RENAME_REQ;
822
823 typedef struct smb_com_rename_rsp {
824         struct smb_hdr hdr;     /* wct = 0 */
825         __u16 ByteCount;        /* bct = 0 */
826 } RENAME_RSP;
827
828 typedef struct smb_com_delete_file_req {
829         struct smb_hdr hdr;     /* wct = 1 */
830         __u16 SearchAttributes;
831         __u16 ByteCount;
832         __u8 BufferFormat;      /* 4 = ASCII */
833         unsigned char fileName[1];
834 } DELETE_FILE_REQ;
835
836 typedef struct smb_com_delete_file_rsp {
837         struct smb_hdr hdr;     /* wct = 0 */
838         __u16 ByteCount;        /* bct = 0 */
839 } DELETE_FILE_RSP;
840
841 typedef struct smb_com_delete_directory_req {
842         struct smb_hdr hdr;     /* wct = 0 */
843         __u16 ByteCount;
844         __u8 BufferFormat;      /* 4 = ASCII */
845         unsigned char DirName[1];
846 } DELETE_DIRECTORY_REQ;
847
848 typedef struct smb_com_delete_directory_rsp {
849         struct smb_hdr hdr;     /* wct = 0 */
850         __u16 ByteCount;        /* bct = 0 */
851 } DELETE_DIRECTORY_RSP;
852
853 typedef struct smb_com_create_directory_req {
854         struct smb_hdr hdr;     /* wct = 0 */
855         __u16 ByteCount;
856         __u8 BufferFormat;      /* 4 = ASCII */
857         unsigned char DirName[1];
858 } CREATE_DIRECTORY_REQ;
859
860 typedef struct smb_com_create_directory_rsp {
861         struct smb_hdr hdr;     /* wct = 0 */
862         __u16 ByteCount;        /* bct = 0 */
863 } CREATE_DIRECTORY_RSP;
864
865 /***************************************************/
866 /* NT Transact structure defintions follow         */
867 /* Currently only ioctl and notify are implemented */
868 /***************************************************/
869 typedef struct smb_com_transaction_ioctl_req {
870         struct smb_hdr hdr;     /* wct = 23 */
871         __u8 MaxSetupCount;
872         __u16 Reserved;
873         __u32 TotalParameterCount;
874         __u32 TotalDataCount;
875         __u32 MaxParameterCount;
876         __u32 MaxDataCount;
877         __u32 ParameterCount;
878         __u32 ParameterOffset;
879         __u32 DataCount;
880         __u32 DataOffset;
881         __u8 SetupCount; /* four setup words follow subcommand */
882         /* SNIA spec incorrectly included spurious pad here */
883         __u16 SubCommand;/* 2 = IOCTL/FSCTL */
884         __u32 FunctionCode;
885         __u16 Fid;
886         __u8 IsFsctl;    /* 1 = File System Control, 0 = device control (IOCTL)*/
887         __u8 IsRootFlag; /* 1 = apply command to root of share (must be DFS share)*/
888         __u16 ByteCount;
889         __u8 Pad[3];
890         __u8 Data[1];
891 } TRANSACT_IOCTL_REQ;
892
893 typedef struct smb_com_transaction_ioctl_rsp {
894         struct smb_hdr hdr;     /* wct = 19 */
895         __u8 Reserved[3];
896         __u32 TotalParameterCount;
897         __u32 TotalDataCount;
898         __u32 ParameterCount;
899         __u32 ParameterOffset;
900         __u32 ParameterDisplacement;
901         __u32 DataCount;
902         __u32 DataOffset;
903         __u32 DataDisplacement;
904         __u8 SetupCount;        /* 1 */
905         __u16 ReturnedDataLen;
906         __u16 ByteCount;
907         __u8 Pad[3];
908 } TRANSACT_IOCTL_RSP;
909
910 typedef struct smb_com_transaction_change_notify_req {
911         struct smb_hdr hdr;     /* wct = 23 */
912         __u8 MaxSetupCount;
913         __u16 Reserved;
914         __u32 TotalParameterCount;
915         __u32 TotalDataCount;
916         __u32 MaxParameterCount;
917         __u32 MaxDataCount;
918         __u32 ParameterCount;
919         __u32 ParameterOffset;
920         __u32 DataCount;
921         __u32 DataOffset;
922         __u8 SetupCount; /* four setup words follow subcommand */
923         /* SNIA spec incorrectly included spurious pad here */
924         __u16 SubCommand;/* 4 = Change Notify */
925         __u32 CompletionFilter;  /* operation to monitor */
926         __u16 Fid;
927         __u8 WatchTree;  /* 1 = Monitor subdirectories */
928         __u8 Reserved2;
929         __u16 ByteCount;
930 /* __u8 Pad[3];*/
931 /*      __u8 Data[1];*/
932 } TRANSACT_CHANGE_NOTIFY_REQ;
933
934 typedef struct smb_com_transaction_change_notify_rsp {
935         struct smb_hdr hdr;     /* wct = 18 */
936         __u8 Reserved[3];
937         __u32 TotalParameterCount;
938         __u32 TotalDataCount;
939         __u32 ParameterCount;
940         __u32 ParameterOffset;
941         __u32 ParameterDisplacement;
942         __u32 DataCount;
943         __u32 DataOffset;
944         __u32 DataDisplacement;
945         __u8 SetupCount;   /* 0 */
946         __u16 ByteCount;
947         /* __u8 Pad[3]; */
948 } TRANSACT_CHANGE_NOTIFY_RSP;
949 /* Completion Filter flags for Notify */
950 #define FILE_NOTIFY_CHANGE_FILE_NAME    0x00000001
951 #define FILE_NOTIFY_CHANGE_DIR_NAME     0x00000002
952 #define FILE_NOTIFY_CHANGE_NAME         0x00000003
953 #define FILE_NOTIFY_CHANGE_ATTRIBUTES   0x00000004
954 #define FILE_NOTIFY_CHANGE_SIZE         0x00000008
955 #define FILE_NOTIFY_CHANGE_LAST_WRITE   0x00000010
956 #define FILE_NOTIFY_CHANGE_LAST_ACCESS  0x00000020
957 #define FILE_NOTIFY_CHANGE_CREATION     0x00000040
958 #define FILE_NOTIFY_CHANGE_EA           0x00000080
959 #define FILE_NOTIFY_CHANGE_SECURITY     0x00000100
960 #define FILE_NOTIFY_CHANGE_STREAM_NAME  0x00000200
961 #define FILE_NOTIFY_CHANGE_STREAM_SIZE  0x00000400
962 #define FILE_NOTIFY_CHANGE_STREAM_WRITE 0x00000800
963
964 #define FILE_ACTION_ADDED               0x00000001
965 #define FILE_ACTION_REMOVED             0x00000002
966 #define FILE_ACTION_MODIFIED            0x00000003
967 #define FILE_ACTION_RENAMED_OLD_NAME    0x00000004
968 #define FILE_ACTION_RENAMED_NEW_NAME    0x00000005
969 #define FILE_ACTION_ADDED_STREAM        0x00000006
970 #define FILE_ACTION_REMOVED_STREAM      0x00000007
971 #define FILE_ACTION_MODIFIED_STREAM     0x00000008
972
973 /* response contains array of the following structures */
974 struct file_notify_information {
975         __u32 NextEntryOffset;
976         __u32 Action;
977         __u32 FileNameLength;
978         __u8  FileName[1];
979 }; 
980
981 struct reparse_data {
982         __u32   ReparseTag;
983         __u16   ReparseDataLength;
984         __u16   Reserved;
985         __u16   AltNameOffset;
986         __u16   AltNameLen;
987         __u16   TargetNameOffset;
988         __u16   TargetNameLen;
989         char    LinkNamesBuf[1];
990 };
991
992 struct cifs_quota_data {
993         __u32   rsrvd1;  /* 0 */
994         __u32   sid_size;
995         __u64   rsrvd2;  /* 0 */
996         __u64   space_used;
997         __u64   soft_limit;
998         __u64   hard_limit;
999         char    sid[1];  /* variable size? */
1000 };
1001
1002 /* quota sub commands */
1003 #define QUOTA_LIST_CONTINUE         0
1004 #define QUOTA_LIST_START        0x100
1005 #define QUOTA_FOR_SID           0x101
1006
1007 typedef union smb_com_transaction2 {
1008         struct {
1009                 struct smb_hdr hdr;     /* wct = 14+ */
1010                 __u16 TotalParameterCount;
1011                 __u16 TotalDataCount;
1012                 __u16 MaxParameterCount;
1013                 __u16 MaxDataCount;
1014                 __u8 MaxSetupCount;
1015                 __u8 Reserved;
1016                 __u16 Flags;
1017                 __u32 Timeout;
1018                 __u16 Reserved2;
1019                 __u16 ParameterCount;
1020                 __u16 ParameterOffset;
1021                 __u16 DataCount;
1022                 __u16 DataOffset;
1023                 __u8 SetupCount;
1024                 __u8 Reserved3;
1025                 __u16 SubCommand;       /* 1st setup word - can be followed by SetupCount words */
1026                 __u16 ByteCount;        /* careful - setupcount is not always one */
1027         } req;
1028         struct {
1029                 struct smb_hdr hdr;     /* wct = 0 */
1030                 __u16 TotalParameterCount;
1031                 __u16 TotalDataCount;
1032                 __u16 Reserved;
1033                 __u16 ParameterCount;
1034                 __u16 ParamterOffset;
1035                 __u16 ParameterDisplacement;
1036                 __u16 DataCount;
1037                 __u16 DataOffset;
1038                 __u16 DataDisplacement;
1039                 __u8 SetupCount;
1040                 __u8 Reserved1; /* should be zero setup words following */
1041                 __u16 ByteCount;
1042                 __u16 Reserved2;        /* parameter word reserved - present for infolevels > 100 */
1043                 /* data area follows */
1044         } resp;
1045 } TRANSACTION2;
1046
1047 /* PathInfo/FileInfo infolevels */
1048 #define SMB_INFO_STANDARD                   1
1049 #define SMB_INFO_QUERY_EAS_FROM_LIST        3
1050 #define SMB_INFO_QUERY_ALL_EAS              4
1051 #define SMB_INFO_IS_NAME_VALID              6
1052 #define SMB_QUERY_FILE_BASIC_INFO       0x101
1053 #define SMB_QUERY_FILE_STANDARD_INFO    0x102
1054 #define SMB_QUERY_FILE_EA_INFO          0x103
1055 #define SMB_QUERY_FILE_NAME_INFO        0x104
1056 #define SMB_QUERY_FILE_ALLOCATION_INFO  0x105
1057 #define SMB_QUERY_FILE_END_OF_FILEINFO  0x106
1058 #define SMB_QUERY_FILE_ALL_INFO         0x107
1059 #define SMB_QUERY_ALT_NAME_INFO         0x108
1060 #define SMB_QUERY_FILE_STREAM_INFO      0x109
1061 #define SMB_QUERY_FILE_COMPRESSION_INFO 0x10B
1062 #define SMB_QUERY_FILE_UNIX_BASIC       0x200
1063 #define SMB_QUERY_FILE_UNIX_LINK        0x201
1064
1065 #define SMB_SET_FILE_BASIC_INFO         0x101
1066 #define SMB_SET_FILE_DISPOSITION_INFO   0x102
1067 #define SMB_SET_FILE_ALLOCATION_INFO    0x103
1068 #define SMB_SET_FILE_END_OF_FILE_INFO   0x104
1069 #define SMB_SET_FILE_UNIX_BASIC         0x200
1070 #define SMB_SET_FILE_UNIX_LINK          0x201
1071 #define SMB_SET_FILE_UNIX_HLINK         0x203
1072 #define SMB_SET_FILE_BASIC_INFO2        0x3ec
1073 #define SMB_SET_FILE_RENAME_INFORMATION 0x3f2
1074 #define SMB_FILE_ALL_INFO2              0x3fa
1075 #define SMB_SET_FILE_ALLOCATION_INFO2   0x3fb
1076 #define SMB_SET_FILE_END_OF_FILE_INFO2  0x3fc
1077 #define SMB_FILE_MOVE_CLUSTER_INFO      0x407
1078 #define SMB_FILE_QUOTA_INFO             0x408
1079 #define SMB_FILE_REPARSEPOINT_INFO      0x409
1080 #define SMB_FILE_MAXIMUM_INFO           0x40d
1081
1082 /* Find File infolevels */
1083 #define SMB_FIND_FILE_DIRECTORY_INFO      0x101
1084 #define SMB_FIND_FILE_FULL_DIRECTORY_INFO 0x102
1085 #define SMB_FIND_FILE_NAMES_INFO          0x103
1086 #define SMB_FIND_FILE_BOTH_DIRECTORY_INFO 0x104
1087 #define SMB_FIND_FILE_UNIX                0x202
1088
1089 typedef struct smb_com_transaction2_qpi_req {
1090         struct smb_hdr hdr;     /* wct = 14+ */
1091         __u16 TotalParameterCount;
1092         __u16 TotalDataCount;
1093         __u16 MaxParameterCount;
1094         __u16 MaxDataCount;
1095         __u8 MaxSetupCount;
1096         __u8 Reserved;
1097         __u16 Flags;
1098         __u32 Timeout;
1099         __u16 Reserved2;
1100         __u16 ParameterCount;
1101         __u16 ParameterOffset;
1102         __u16 DataCount;
1103         __u16 DataOffset;
1104         __u8 SetupCount;
1105         __u8 Reserved3;
1106         __u16 SubCommand;       /* one setup word */
1107         __u16 ByteCount;
1108         __u8 Pad;
1109         __u16 InformationLevel;
1110         __u32 Reserved4;
1111         char FileName[1];
1112 } TRANSACTION2_QPI_REQ;
1113
1114 typedef struct smb_com_transaction2_qpi_rsp {
1115         struct smb_hdr hdr;     /* wct = 10 + SetupCount */
1116         __u16 TotalParameterCount;
1117         __u16 TotalDataCount;
1118         __u16 Reserved;
1119         __u16 ParameterCount;
1120         __u16 ParameterOffset;
1121         __u16 ParameterDisplacement;
1122         __u16 DataCount;
1123         __u16 DataOffset;
1124         __u16 DataDisplacement;
1125         __u8 SetupCount;
1126         __u8 Reserved1;         /* should be zero setup words following */
1127         __u16 ByteCount;
1128         __u16 Reserved2;        /* parameter word reserved - present for infolevels > 100 */
1129 } TRANSACTION2_QPI_RSP;
1130
1131 typedef struct smb_com_transaction2_spi_req {
1132         struct smb_hdr hdr;     /* wct = 15 */
1133         __u16 TotalParameterCount;
1134         __u16 TotalDataCount;
1135         __u16 MaxParameterCount;
1136         __u16 MaxDataCount;
1137         __u8 MaxSetupCount;
1138         __u8 Reserved;
1139         __u16 Flags;
1140         __u32 Timeout;
1141         __u16 Reserved2;
1142         __u16 ParameterCount;
1143         __u16 ParameterOffset;
1144         __u16 DataCount;
1145         __u16 DataOffset;
1146         __u8 SetupCount;
1147         __u8 Reserved3;
1148         __u16 SubCommand;       /* one setup word */
1149         __u16 ByteCount;
1150         __u8 Pad;
1151         __u16 Pad1;
1152         __u16 InformationLevel;
1153         __u32 Reserved4;
1154         char FileName[1];
1155 } TRANSACTION2_SPI_REQ;
1156
1157 typedef struct smb_com_transaction2_spi_rsp {
1158         struct smb_hdr hdr;     /* wct = 10 + SetupCount */
1159         __u16 TotalParameterCount;
1160         __u16 TotalDataCount;
1161         __u16 Reserved;
1162         __u16 ParameterCount;
1163         __u16 ParameterOffset;
1164         __u16 ParameterDisplacement;
1165         __u16 DataCount;
1166         __u16 DataOffset;
1167         __u16 DataDisplacement;
1168         __u8 SetupCount;
1169         __u8 Reserved1;         /* should be zero setup words following */
1170         __u16 ByteCount;
1171         __u16 Reserved2;        /* parameter word reserved - present for infolevels > 100 */
1172 } TRANSACTION2_SPI_RSP;
1173
1174 struct set_file_rename {
1175         __u32 overwrite;   /* 1 = overwrite dest */
1176         __u32 root_fid;   /* zero */
1177         __u32 target_name_len;
1178         char  target_name[0];  /* Must be unicode */
1179 };
1180
1181 struct smb_com_transaction2_sfi_req {
1182         struct smb_hdr hdr;     /* wct = 15 */
1183         __u16 TotalParameterCount;
1184         __u16 TotalDataCount;
1185         __u16 MaxParameterCount;
1186         __u16 MaxDataCount;
1187         __u8 MaxSetupCount;
1188         __u8 Reserved;
1189         __u16 Flags;
1190         __u32 Timeout;
1191         __u16 Reserved2;
1192         __u16 ParameterCount;
1193         __u16 ParameterOffset;
1194         __u16 DataCount;
1195         __u16 DataOffset;
1196         __u8 SetupCount;
1197         __u8 Reserved3;
1198         __u16 SubCommand;       /* one setup word */
1199         __u16 ByteCount;
1200         __u8 Pad;
1201         __u16 Pad1;
1202         __u16 Fid;
1203         __u16 InformationLevel;
1204         __u16 Reserved4;        
1205 };
1206
1207 struct smb_com_transaction2_sfi_rsp {
1208         struct smb_hdr hdr;     /* wct = 10 + SetupCount */
1209         __u16 TotalParameterCount;
1210         __u16 TotalDataCount;
1211         __u16 Reserved;
1212         __u16 ParameterCount;
1213         __u16 ParameterOffset;
1214         __u16 ParameterDisplacement;
1215         __u16 DataCount;
1216         __u16 DataOffset;
1217         __u16 DataDisplacement;
1218         __u8 SetupCount;
1219         __u8 Reserved1;         /* should be zero setup words following */
1220         __u16 ByteCount;
1221         __u16 Reserved2;        /* parameter word reserved - present for infolevels > 100 */
1222 };
1223
1224
1225 /*
1226  * Flags on T2 FINDFIRST and FINDNEXT 
1227  */
1228 #define CIFS_SEARCH_CLOSE_ALWAYS  0x0001
1229 #define CIFS_SEARCH_CLOSE_AT_END  0x0002
1230 #define CIFS_SEARCH_RETURN_RESUME 0x0004
1231 #define CIFS_SEARCH_CONTINUE_FROM_LAST 0x0008
1232 #define CIFS_SEARCH_BACKUP_SEARCH 0x0010
1233
1234 /*
1235  * Size of the resume key on FINDFIRST and FINDNEXT calls
1236  */
1237 #define CIFS_SMB_RESUME_KEY_SIZE 4
1238
1239 typedef struct smb_com_transaction2_ffirst_req {
1240         struct smb_hdr hdr;     /* wct = 15 */
1241         __u16 TotalParameterCount;
1242         __u16 TotalDataCount;
1243         __u16 MaxParameterCount;
1244         __u16 MaxDataCount;
1245         __u8 MaxSetupCount;
1246         __u8 Reserved;
1247         __u16 Flags;
1248         __u32 Timeout;
1249         __u16 Reserved2;
1250         __u16 ParameterCount;
1251         __u16 ParameterOffset;
1252         __u16 DataCount;
1253         __u16 DataOffset;
1254         __u8 SetupCount;        /* one */
1255         __u8 Reserved3;
1256         __u16 SubCommand;       /* TRANS2_FIND_FIRST */
1257         __u16 ByteCount;
1258         __u8 Pad;
1259         __u16 SearchAttributes;
1260         __u16 SearchCount;
1261         __u16 SearchFlags;
1262         __u16 InformationLevel;
1263         __u32 SearchStorageType;
1264         char FileName[1];
1265 } TRANSACTION2_FFIRST_REQ;
1266
1267 typedef struct smb_com_transaction2_ffirst_rsp {
1268         struct smb_hdr hdr;     /* wct = 10 */
1269         __u16 TotalParameterCount;
1270         __u16 TotalDataCount;
1271         __u16 Reserved;
1272         __u16 ParameterCount;
1273         __u16 ParameterOffset;
1274         __u16 ParameterDisplacement;
1275         __u16 DataCount;
1276         __u16 DataOffset;
1277         __u16 DataDisplacement;
1278         __u8 SetupCount;
1279         __u8 Reserved1;         /* should be zero setup words following */
1280         __u16 ByteCount;
1281 } TRANSACTION2_FFIRST_RSP;
1282
1283 typedef struct smb_com_transaction2_ffirst_rsp_parms {
1284         __u16 SearchHandle;
1285         __u16 SearchCount;
1286         __u16 EndofSearch;
1287         __u16 EAErrorOffset;
1288         __u16 LastNameOffset;
1289 } T2_FFIRST_RSP_PARMS;
1290
1291 typedef struct smb_com_transaction2_fnext_req {
1292         struct smb_hdr hdr;     /* wct = 15 */
1293         __u16 TotalParameterCount;
1294         __u16 TotalDataCount;
1295         __u16 MaxParameterCount;
1296         __u16 MaxDataCount;
1297         __u8 MaxSetupCount;
1298         __u8 Reserved;
1299         __u16 Flags;
1300         __u32 Timeout;
1301         __u16 Reserved2;
1302         __u16 ParameterCount;
1303         __u16 ParameterOffset;
1304         __u16 DataCount;
1305         __u16 DataOffset;
1306         __u8 SetupCount;        /* one */
1307         __u8 Reserved3;
1308         __u16 SubCommand;       /* TRANS2_FIND_NEXT */
1309         __u16 ByteCount;
1310         __u8 Pad;
1311         __u16 SearchHandle;
1312         __u16 SearchCount;
1313         __u16 InformationLevel;
1314         __u32 ResumeKey;
1315         __u16 SearchFlags;
1316         char ResumeFileName[1];
1317 } TRANSACTION2_FNEXT_REQ;
1318
1319 typedef struct smb_com_transaction2_fnext_rsp {
1320         struct smb_hdr hdr;     /* wct = 10 */
1321         __u16 TotalParameterCount;
1322         __u16 TotalDataCount;
1323         __u16 Reserved;
1324         __u16 ParameterCount;
1325         __u16 ParameterOffset;
1326         __u16 ParameterDisplacement;
1327         __u16 DataCount;
1328         __u16 DataOffset;
1329         __u16 DataDisplacement;
1330         __u8 SetupCount;
1331         __u8 Reserved1;         /* should be zero setup words following */
1332         __u16 ByteCount;
1333 } TRANSACTION2_FNEXT_RSP;
1334
1335 typedef struct smb_com_transaction2_fnext_rsp_parms {
1336         __u16 SearchCount;
1337         __u16 EndofSearch;
1338         __u16 EAErrorOffset;
1339         __u16 LastNameOffset;
1340 } T2_FNEXT_RSP_PARMS;
1341
1342 /* QFSInfo Levels */
1343 #define SMB_INFO_ALLOCATION         1
1344 #define SMB_INFO_VOLUME             2
1345 #define SMB_QUERY_FS_VOLUME_INFO    0x102
1346 #define SMB_QUERY_FS_SIZE_INFO      0x103
1347 #define SMB_QUERY_FS_DEVICE_INFO    0x104
1348 #define SMB_QUERY_FS_ATTRIBUTE_INFO 0x105
1349 #define SMB_QUERY_CIFS_UNIX_INFO    0x200
1350 #define SMB_QUERY_LABEL_INFO        0x3ea
1351 #define SMB_QUERY_FS_QUOTA_INFO     0x3ee
1352
1353 typedef struct smb_com_transaction2_qfsi_req {
1354         struct smb_hdr hdr;     /* wct = 14+ */
1355         __u16 TotalParameterCount;
1356         __u16 TotalDataCount;
1357         __u16 MaxParameterCount;
1358         __u16 MaxDataCount;
1359         __u8 MaxSetupCount;
1360         __u8 Reserved;
1361         __u16 Flags;
1362         __u32 Timeout;
1363         __u16 Reserved2;
1364         __u16 ParameterCount;
1365         __u16 ParameterOffset;
1366         __u16 DataCount;
1367         __u16 DataOffset;
1368         __u8 SetupCount;
1369         __u8 Reserved3;
1370         __u16 SubCommand;       /* one setup word */
1371         __u16 ByteCount;
1372         __u8 Pad;
1373         __u16 InformationLevel;
1374 } TRANSACTION2_QFSI_REQ;
1375
1376 typedef struct smb_com_transaction_qfsi_rsp {
1377         struct smb_hdr hdr;     /* wct = 10 + SetupCount */
1378         __u16 TotalParameterCount;
1379         __u16 TotalDataCount;
1380         __u16 Reserved;
1381         __u16 ParameterCount;
1382         __u16 ParameterOffset;
1383         __u16 ParameterDisplacement;
1384         __u16 DataCount;
1385         __u16 DataOffset;
1386         __u16 DataDisplacement;
1387         __u8 SetupCount;
1388         __u8 Reserved1;         /* should be zero setup words following */
1389         __u16 ByteCount;
1390         __u8 Pad;               /* may be three bytes *//* followed by data area */
1391 } TRANSACTION2_QFSI_RSP;
1392
1393 typedef struct smb_com_transaction2_get_dfs_refer_req {
1394         struct smb_hdr hdr;     /* wct = 15 */
1395         __u16 TotalParameterCount;
1396         __u16 TotalDataCount;
1397         __u16 MaxParameterCount;
1398         __u16 MaxDataCount;
1399         __u8 MaxSetupCount;
1400         __u8 Reserved;
1401         __u16 Flags;
1402         __u32 Timeout;
1403         __u16 Reserved2;
1404         __u16 ParameterCount;
1405         __u16 ParameterOffset;
1406         __u16 DataCount;
1407         __u16 DataOffset;
1408         __u8 SetupCount;
1409         __u8 Reserved3;
1410         __u16 SubCommand;       /* one setup word */
1411         __u16 ByteCount;
1412         __u8 Pad[3];            /* Win2K has sent 0x0F01 (max resp length perhaps?) followed by one byte pad - doesn't seem to matter though */
1413         __u16 MaxReferralLevel;
1414         char RequestFileName[1];
1415 } TRANSACTION2_GET_DFS_REFER_REQ;
1416
1417 typedef struct dfs_referral_level_3 {
1418         __u16 VersionNumber;
1419         __u16 ReferralSize;
1420         __u16 ServerType;       /* 0x0001 = CIFS server */
1421         __u16 ReferralFlags;    /* or proximity - not clear which since always set to zero - SNIA spec says 0x01 means strip off PathConsumed chars before submitting RequestFileName to remote node */
1422         __u16 TimeToLive;
1423         __u16 Proximity;
1424         __u16 DfsPathOffset;
1425         __u16 DfsAlternatePathOffset;
1426         __u16 NetworkAddressOffset;
1427 } REFERRAL3;
1428
1429 typedef struct smb_com_transaction_get_dfs_refer_rsp {
1430         struct smb_hdr hdr;     /* wct = 10 */
1431         __u16 TotalParameterCount;
1432         __u16 TotalDataCount;
1433         __u16 Reserved;
1434         __u16 ParameterCount;
1435         __u16 ParameterOffset;
1436         __u16 ParameterDisplacement;
1437         __u16 DataCount;
1438         __u16 DataOffset;
1439         __u16 DataDisplacement;
1440         __u8 SetupCount;
1441         __u8 Reserved1;         /* zero setup words following */
1442         __u16 ByteCount;
1443         __u8 Pad;
1444         __u16 PathConsumed;
1445         __u16 NumberOfReferrals;
1446         __u16 DFSFlags;
1447         __u16 Pad2;
1448         REFERRAL3 referrals[1]; /* array of level 3 dfs_referral structures */
1449         /* followed by the strings pointed to by the referral structures */
1450 } TRANSACTION2_GET_DFS_REFER_RSP;
1451
1452 /* DFS Flags */
1453 #define DFSREF_REFERRAL_SERVER  0x0001
1454 #define DFSREF_STORAGE_SERVER   0x0002
1455
1456 /* IOCTL information */
1457 /* List of ioctl function codes that look to be of interest to remote clients like this. */
1458 /* Need to do some experimentation to make sure they all work remotely.                  */
1459 /* Some of the following such as the encryption/compression ones would be                */
1460 /* invoked from tools via a specialized hook into the VFS rather than via the            */
1461 /* standard vfs entry points */
1462 #define FSCTL_REQUEST_OPLOCK_LEVEL_1 0x00090000
1463 #define FSCTL_REQUEST_OPLOCK_LEVEL_2 0x00090004
1464 #define FSCTL_REQUEST_BATCH_OPLOCK   0x00090008
1465 #define FSCTL_LOCK_VOLUME            0x00090018
1466 #define FSCTL_UNLOCK_VOLUME          0x0009001C
1467 #define FSCTL_GET_COMPRESSION        0x0009003C
1468 #define FSCTL_SET_COMPRESSION        0x0009C040
1469 #define FSCTL_REQUEST_FILTER_OPLOCK  0x0009008C
1470 #define FSCTL_FILESYS_GET_STATISTICS 0x00090090
1471 #define FSCTL_SET_REPARSE_POINT      0x000900A4
1472 #define FSCTL_GET_REPARSE_POINT      0x000900A8
1473 #define FSCTL_DELETE_REPARSE_POINT   0x000900AC
1474 #define FSCTL_SET_SPARSE             0x000900C4
1475 #define FSCTL_SET_ZERO_DATA          0x000900C8
1476 #define FSCTL_SET_ENCRYPTION         0x000900D7
1477 #define FSCTL_ENCRYPTION_FSCTL_IO    0x000900DB
1478 #define FSCTL_WRITE_RAW_ENCRYPTED    0x000900DF
1479 #define FSCTL_READ_RAW_ENCRYPTED     0x000900E3
1480 #define FSCTL_SIS_COPYFILE           0x00090100
1481 #define FSCTL_SIS_LINK_FILES         0x0009C104
1482
1483 #define IO_REPARSE_TAG_MOUNT_POINT   0xA0000003
1484 #define IO_REPARSE_TAG_HSM           0xC0000004
1485 #define IO_REPARSE_TAG_SIS           0x80000007
1486
1487 /*
1488  ************************************************************************
1489  * All structs for everything above the SMB PDUs themselves
1490  * (such as the T2 level specific data) go here                  
1491  ************************************************************************
1492  */
1493
1494 /*
1495  * Information on a server
1496  */
1497
1498 struct serverInfo {
1499         char name[16];
1500         unsigned char versionMajor;
1501         unsigned char versionMinor;
1502         unsigned long type;
1503         unsigned int commentOffset;
1504 };
1505
1506 /*
1507  * The following structure is the format of the data returned on a NetShareEnum
1508  * with level "90" (x5A)
1509  */
1510
1511 struct shareInfo {
1512         char shareName[13];
1513         char pad;
1514         unsigned short type;
1515         unsigned int commentOffset;
1516 };
1517
1518 struct aliasInfo {
1519         char aliasName[9];
1520         char pad;
1521         unsigned int commentOffset;
1522         unsigned char type[2];
1523 };
1524
1525 struct aliasInfo92 {
1526         int aliasNameOffset;
1527         int serverNameOffset;
1528         int shareNameOffset;
1529 };
1530
1531 typedef struct {
1532         __u64 TotalAllocationUnits;
1533         __u64 FreeAllocationUnits;
1534         __u32 SectorsPerAllocationUnit;
1535         __u32 BytesPerSector;
1536 } FILE_SYSTEM_INFO;             /* size info, level 0x103 */
1537
1538 typedef struct {
1539         __u16 MajorVersionNumber;
1540         __u16 MinorVersionNumber;
1541         __u64 Capability;
1542 } FILE_SYSTEM_UNIX_INFO;        /* Unix extensions info, level 0x200 */
1543 /* Linux/Unix extensions capability flags */
1544 #define CIFS_UNIX_FCNTL_CAP             0x00000001 /* support for fcntl locks */
1545 #define CIFS_UNIX_POSIX_ACL_CAP         0x00000002
1546
1547 /* DeviceType Flags */
1548 #define FILE_DEVICE_CD_ROM              0x00000002
1549 #define FILE_DEVICE_CD_ROM_FILE_SYSTEM  0x00000003
1550 #define FILE_DEVICE_DFS                 0x00000006
1551 #define FILE_DEVICE_DISK                0x00000007
1552 #define FILE_DEVICE_DISK_FILE_SYSTEM    0x00000008
1553 #define FILE_DEVICE_FILE_SYSTEM         0x00000009
1554 #define FILE_DEVICE_NAMED_PIPE          0x00000011
1555 #define FILE_DEVICE_NETWORK             0x00000012
1556 #define FILE_DEVICE_NETWORK_FILE_SYSTEM 0x00000014
1557 #define FILE_DEVICE_NULL                0x00000015
1558 #define FILE_DEVICE_PARALLEL_PORT       0x00000016
1559 #define FILE_DEVICE_PRINTER             0x00000018
1560 #define FILE_DEVICE_SERIAL_PORT         0x0000001b
1561 #define FILE_DEVICE_STREAMS             0x0000001e
1562 #define FILE_DEVICE_TAPE                0x0000001f
1563 #define FILE_DEVICE_TAPE_FILE_SYSTEM    0x00000020
1564 #define FILE_DEVICE_VIRTUAL_DISK        0x00000024
1565 #define FILE_DEVICE_NETWORK_REDIRECTOR  0x00000028
1566
1567 typedef struct {
1568         __u32 DeviceType;
1569         __u32 DeviceCharacteristics;
1570 } FILE_SYSTEM_DEVICE_INFO;      /* device info, level 0x104 */
1571
1572 typedef struct {
1573         __u32 Attributes;
1574         __u32 MaxPathNameComponentLength;
1575         __u32 FileSystemNameLen;
1576         char FileSystemName[52];        /* do not really need to save this - so potentially get only subset of name */
1577 } FILE_SYSTEM_ATTRIBUTE_INFO;
1578
1579 typedef struct {                /* data block encoding of response to level 263 QPathInfo */
1580         __u64 CreationTime;
1581         __u64 LastAccessTime;
1582         __u64 LastWriteTime;
1583         __u64 ChangeTime;
1584         __u32 Attributes;
1585         __u32 Pad1;
1586         __u64 AllocationSize;
1587         __u64 EndOfFile;        /* size ie offset to first free byte in file */
1588         __u32 NumberOfLinks;    /* hard links */
1589         __u8 DeletePending;
1590         __u8 Directory;
1591         __u16 Pad2;
1592         __u64 IndexNumber;
1593         __u32 EASize;
1594         __u32 AccessFlags;
1595         __u64 IndexNumber1;
1596         __u64 CurrentByteOffset;
1597         __u32 Mode;
1598         __u32 AlignmentRequirement;
1599         __u32 FileNameLength;
1600         char FileName[1];
1601 } FILE_ALL_INFO;                /* level 263 QPathInfo */
1602
1603 typedef struct {
1604         __u64 EndOfFile;
1605         __u64 NumOfBytes;
1606         __u64 LastStatusChange; /*SNIA spec says DCE time for the three time fields */
1607         __u64 LastAccessTime;
1608         __u64 LastModificationTime;
1609         __u64 Uid;
1610         __u64 Gid;
1611         __u32 Type;
1612         __u64 DevMajor;
1613         __u64 DevMinor;
1614         __u64 UniqueId;
1615         __u64 Permissions;
1616         __u64 Nlinks;
1617 } FILE_UNIX_BASIC_INFO;         /* level 512 QPathInfo */
1618
1619 typedef struct {
1620         char LinkDest[1];
1621 } FILE_UNIX_LINK_INFO;          /* level 513 QPathInfo */
1622
1623 /* defines for enumerating possible values of the Unix type field below */
1624 #define UNIX_FILE      0
1625 #define UNIX_DIR       1
1626 #define UNIX_SYMLINK   2
1627 #define UNIX_CHARDEV   3
1628 #define UNIX_BLOCKDEV  4
1629 #define UNIX_FIFO      5
1630 #define UNIX_SOCKET    6
1631
1632 typedef struct {
1633         __u32 NextEntryOffset;
1634         __u32 ResumeKey;
1635         __u64 EndOfFile;
1636         __u64 NumOfBytes;
1637         __u64 LastStatusChange; /*SNIA spec says DCE time for the three time fields */
1638         __u64 LastAccessTime;
1639         __u64 LastModificationTime;
1640         __u64 Uid;
1641         __u64 Gid;
1642         __u32 Type;
1643         __u64 DevMajor;
1644         __u64 DevMinor;
1645         __u64 UniqueId;
1646         __u64 Permissions;
1647         __u64 Nlinks;
1648         char FileName[1];
1649 } FILE_UNIX_INFO;
1650
1651 typedef struct {
1652         __u64 CreationTime;
1653         __u64 LastAccessTime;
1654         __u64 LastWriteTime;
1655         __u64 ChangeTime;
1656         __u32 Attributes;
1657         __u32 Pad;
1658 } FILE_BASIC_INFO;              /* size info, level 0x101 */
1659
1660 struct file_allocation_info {
1661         __u64 AllocationSize;
1662 };              /* size info, level 0x103 */
1663
1664 struct file_end_of_file_info {
1665         __u64 FileSize;         /* offset to end of file */
1666 };      /* size info, level 0x104 */
1667
1668 typedef struct {
1669         __u32 NextEntryOffset;
1670         __u32 FileIndex;
1671         __u64 CreationTime;
1672         __u64 LastAccessTime;
1673         __u64 LastWriteTime;
1674         __u64 ChangeTime;
1675         __u64 EndOfFile;
1676         __u64 AllocationSize;
1677         __u32 ExtFileAttributes;
1678         __u32 FileNameLength;
1679         char FileName[1];
1680 } FILE_DIRECTORY_INFO;   /* level 257 FF response data area */
1681
1682 struct gea {
1683         unsigned char cbName;
1684         char szName[1];
1685 };
1686
1687 struct gealist {
1688         unsigned long cbList;
1689         struct gea list[1];
1690 };
1691
1692 struct fea {
1693         unsigned char EA_flags;
1694         __u8 name_len;
1695         __u16 value_len;
1696         char szName[1];
1697         /* optionally followed by value */
1698 };
1699 /* flags for _FEA.fEA */
1700 #define FEA_NEEDEA         0x80 /* need EA bit */
1701
1702 struct fealist {
1703         __u32 list_len;
1704         struct fea list[1];
1705 };
1706
1707 /* used to hold an arbitrary blob of data */
1708 struct data_blob {
1709         __u8 *data;
1710         size_t length;
1711         void (*free) (struct data_blob * data_blob);
1712 };
1713
1714 #ifdef CONFIG_CIFS_POSIX
1715 /* 
1716         For better POSIX semantics from Linux client, (even better
1717         than the existing CIFS Unix Extensions) we need updated PDUs for:
1718         
1719         1) PosixCreateX - to set and return the mode, inode#, device info and
1720         perhaps add a CreateDevice - to create Pipes and other special .inodes
1721         Also note POSIX open flags
1722         2) Close - to return the last write time to do cache across close more safely
1723         3) PosixQFSInfo - to return statfs info
1724         4) FindFirst return unique inode number - what about resume key, two forms short (matches readdir) and full (enough info to cache inodes)
1725         5) Mkdir - set mode
1726         
1727         And under consideration: 
1728         6) FindClose2 (return nanosecond timestamp ??)
1729         7) Use nanosecond timestamps throughout all time fields if 
1730            corresponding attribute flag is set
1731         8) sendfile - handle based copy
1732         9) Direct i/o
1733         10) "POSIX ACL" support
1734         11) Misc fcntls?
1735         
1736         what about fixing 64 bit alignment
1737         
1738         There are also various legacy SMB/CIFS requests used as is
1739         
1740         From existing Lanman and NTLM dialects:
1741         --------------------------------------
1742         NEGOTIATE
1743         SESSION_SETUP_ANDX (BB which?)
1744         TREE_CONNECT_ANDX (BB which wct?)
1745         TREE_DISCONNECT (BB add volume timestamp on response)
1746         LOGOFF_ANDX
1747         DELETE (note delete open file behavior)
1748         DELETE_DIRECTORY
1749         READ_AND_X
1750         WRITE_AND_X
1751         LOCKING_AND_X (note posix lock semantics)
1752         RENAME (note rename across dirs and open file rename posix behaviors)
1753         NT_RENAME (for hardlinks) Is this good enough for all features?
1754         FIND_CLOSE2
1755         TRANSACTION2 (18 cases)
1756                 SMB_SET_FILE_END_OF_FILE_INFO2 SMB_SET_PATH_END_OF_FILE_INFO2
1757                 (BB verify that never need to set allocation size)
1758                 SMB_SET_FILE_BASIC_INFO2 (setting times - BB can it be done via Unix ext?)
1759         
1760         COPY (note support for copy across directories) - FUTURE, OPTIONAL
1761         setting/getting OS/2 EAs - FUTURE (BB can this handle
1762                 setting Linux xattrs perfectly)         - OPTIONAL
1763     dnotify                                         - FUTURE, OPTIONAL
1764     quota                                           - FUTURE, OPTIONAL
1765                         
1766         Note that various requests implemented for NT interop such as 
1767                 NT_TRANSACT (IOCTL) QueryReparseInfo
1768         are unneeded to servers compliant with the CIFS POSIX extensions
1769         
1770         From CIFS Unix Extensions:
1771         -------------------------
1772         T2 SET_PATH_INFO (SMB_SET_FILE_UNIX_LINK) for symlinks
1773         T2 SET_PATH_INFO (SMB_SET_FILE_BASIC_INFO2)
1774         T2 QUERY_PATH_INFO (SMB_QUERY_FILE_UNIX_LINK)
1775         T2 QUERY_PATH_INFO (SMB_QUERY_FILE_UNIX_BASIC) - BB check for missing inode fields
1776                                         Actually need QUERY_FILE_UNIX_INFO since has inode num
1777                                         BB what about a) blksize/blkbits/blocks
1778                                                                   b) i_version
1779                                                                   c) i_rdev
1780                                                                   d) notify mask?
1781                                                                   e) generation
1782                                                                   f) size_seqcount
1783         T2 FIND_FIRST/FIND_NEXT FIND_FILE_UNIX
1784         TRANS2_GET_DFS_REFERRAL                           - OPTIONAL but recommended
1785         T2_QFS_INFO QueryDevice/AttributeInfo - OPTIONAL
1786         
1787         
1788  */
1789 #endif 
1790
1791 #pragma pack()                  /* resume default structure packing */
1792
1793 #endif                          /* _CIFSPDU_H */