r3780: final release notes
[Samba.git] / source / aparser / cifs.struct
blob202f0d7e619a612e95aa0719eee59ed17f5068cd
1 module cifs
3 option autoalign False
6 #define BOOL uint32
7 #define UCHAR uint8
8 #define WCHAR uint16
9 #define USHORT uint16
10 #define LONG uint32
11 #define ULONG uint32
12 #define DWORD uint32
13 #define SMB_TIME uint16
14 #define SMB_DATE uint16
16 typedef struct {
17         ULONG low;
18         LONG high;
19 } TIME;
21 typedef struct {
22         ULONG low;
23         ULONG high;
24 } hyper;
26 typedef struct {
27         uint8 cmd;
28         uint8 reserved;
29         uint16 offset;
30 } ANDX_INFO;
33 typedef struct {
34         uint8 tag2;
35         STRING protocol;
36 } BUF2;
38 typedef struct {
39         uint16 bcount;
40         BUF2 protocol[*];
41 } Q_NEGPROT_0;
43 typedef struct {
44         uint8 wcount;
45         union ctr[wcount] {
46                 case 0 Q_NEGPROT_0 q0;
47         }
48 } Q_NEGPROT;
50 typedef struct {
51         USHORT  DialectIndex;         /* Index of selected dialect */
52         USHORT  SecurityMode;         /* Security mode: */
53                                       /* bit 0: 0 = share, 1 = user */
54                                       /* bit 1: 1 = use challenge/response */
55                                       /* authentication */
56         USHORT  MaxBufferSize;        /* Max transmit buffer size (>= 1024) */
57         USHORT  MaxMpxCount;          /* Max pending multiplexed requests */
58         USHORT  MaxNumberVcs;         /* Max VCs between client and server */
59         USHORT  RawMode;              /* Raw modes supported: */
60                                       /*  bit 0: 1 = Read Raw supported */
61                                       /*  bit 1: 1 = Write Raw supported */
62         ULONG SessionKey;             /* Unique token identifying this session */
63         SMB_TIME ServerTime;          /* Current time at server */
64         SMB_DATE ServerDate;          /* Current date at server */
65         USHORT ServerTimeZone;        /* Current time zone at server */
66         USHORT  ChallengeLength;      /* Length of Challenge; MBZ if not LM2.1
67                                       /* dialect or later */
68         USHORT  Reserved;             /* MBZ */
69         USHORT  ByteCount;             /* Count of data bytes */
70         UCHAR Challenge[ChallengeLength];            /* The challenge */
71         STRING PrimaryDomain;       /* The server's primary domain */
73 } R_NEGPROT_12;
75 typedef struct {
76         USHORT DialectIndex;  /*Index of selected dialect */
77         UCHAR SecurityMode;   /*Security mode: */
78                               /*  bit 0: 0 = share, 1 = user */
79                               /*  bit 1: 1 = use challenge/response */
80                               /*  authentication */
81                               /*  bit 2: 1 = Security Signatures (SMB integrity */
82                               /*  check) enabled */
83                               /*  bit 3: 1 = Security Signatures (SMB integrity */
84                               /*  check) required */
85         USHORT MaxMpxCount;   /*Max pending outstanding requests */
86         USHORT MaxNumberVcs;  /*Max VCs between client and server */
87         ULONG MaxBufferSize;  /*Max transmit buffer size */
88         ULONG MaxRawSize;     /*Maximum raw buffer size */
89         ULONG SessionKey;     /*Unique token identifying this session */
90         ULONG Capabilities;   /*Server capabilities */
91         ULONG SystemTimeLow;  /*System (UTC) time of the server (low). */
92         ULONG SystemTimeHigh; /*System (UTC) time of the server (high). */
93         USHORT ServerTimeZone;/*Time zone of server (minutes from UTC) */
94         UCHAR SecurityBlobLength;/*Length of SecurityBlob */
96         USHORT bcount;     /*Count of data bytes */
97         /*UCHAR GUID[16];       A globally unique identifier assigned to the */
98                               /*  server; present only when */
99                               /*  CAP_EXTENDED_SECURITY is on in the */
100                               /*  Capabilities field. */
101         UCHAR SecurityBlob[SecurityBlobLength];  /*Opaque Security Blob associated with the */
102                               /*  security package if CAP_EXTENDED_SECURITY is */
103                               /*  on in the Capabilities field; else challenge */
104                               /*  for CIFS challenge/response authentication. */
105         STRING OemDomainName[+]; /*The name of the domain (in OEM chars); not */
106                               /*  present  if CAP_EXTENDED_SECURITY is on in the */
107                               /*  Capabilities field */
108 } R_NEGPROT_17;
111 typedef struct {
112         uint8 wcount;
113         union ctr[wcount] {
114                 case 17 R_NEGPROT_17 r17;
115         }
116 } R_NEGPROT;
118 typedef struct {
119         uint8 wcount;
120         uint16 vwv[wcount];
121         uint16 bcount;
122         uint8 none[bcount];
123 } Q_TDIS;
125 typedef struct {
126         uint8 wcount;
127         uint16 vwv[wcount];
128         uint16 bcount;
129         uint8 none[bcount];
130 } R_TDIS;
132 typedef struct {
133         ANDX_INFO andx;
134         uint16 bcount;
135         uint8 none[bcount];
136 } R_ULOGOFF_ANDX_2;
138 typedef struct {
139         uint8 wcount;
140         union ctr[wcount] {
141                 case 2 R_ULOGOFF_ANDX_2 q2;
142         }
143 } R_ULOGOFF_ANDX;
145 typedef struct {
146         ANDX_INFO andx;
147         uint16 bcount;
148         uint8 none[bcount];
149 } Q_ULOGOFF_ANDX_2;
151 typedef struct {
152         uint8 wcount;
153         union ctr[wcount] {
154                 case 2 Q_ULOGOFF_ANDX_2 q2;
155         }
156 } Q_ULOGOFF_ANDX;
158 typedef struct {
159         ANDX_INFO andx;
160         uint16 bufsize;
161         uint16 max_mpx;
162         uint16 vc;
163         ULONG sess_key;
164         uint16 pwlen;
165         ULONG reserved;
167         uint16 bcount;
168         uint8 password[pwlen];
169         STRING domain;
170         STRING os;
171         STRING server;
173 } Q_SESSION_SETUP_ANDX_10;
175 typedef struct {
176         ANDX_INFO andx;
177         uint16 bufsize;
178         uint16 max_mpx;
179         uint16 vc;
180         ULONG sess_key;
181         uint16 pwlen;
182         uint16 upwlen;
183         ULONG capabilities;
184         ULONG reserved;
186         uint16 bcount;
187         uint8 password[pwlen];
188         uint8 upassword[upwlen];
189         STRING user;
190         STRING domain;
191         STRING os;
192         STRING server;
194 } Q_SESSION_SETUP_ANDX_13;
196 typedef struct _Q_SESSION_SETUP_ANDX {
197         uint8 wcount;
198         union ctr[wcount] {
199                 case 10 Q_SESSION_SETUP_ANDX_10 q10;
200                 case 13 Q_SESSION_SETUP_ANDX_13 q13;
201         }
202 } Q_SESSION_SETUP_ANDX;
204 typedef struct {
205         ANDX_INFO andx;
206         uint16 vwv2;
207         uint16 passlen;
208         uint16 bcount;
209         uint8 password[passlen];
210         STRING path;
211         STRING device;
212 } Q_TCON_ANDX_4;
214 typedef struct _Q_TCON_ANDX {
215         uint8 wcount;
216         union ctr[wcount] {
217                 case 4 Q_TCON_ANDX_4 q4;
218         }
219 } Q_TCON_ANDX;
221 typedef struct {
222         ANDX_INFO andx;
223         uint16 vwv2;
224         uint16 bcount;
225         STRING share;
226 } R_TCON_ANDX_3;
228 typedef struct _R_TCON_ANDX {
229         uint8 wcount;
230         union ctr[wcount] {
231                 case 3 R_TCON_ANDX_3 q3;
232         }
233 } R_TCON_ANDX;
235 typedef struct {
236         ANDX_INFO andx;
237         uint16 action;
239         uint16 count;
240         STRING os;
241         STRING server;
242         STRING domain;
243 } R_SESSION_SETUP_ANDX_10;
245 typedef struct _R_SESSION_SETUP_ANDX {
246         uint8 wcount;
247         union ctr[wcount] {
248                 case 3 R_SESSION_SETUP_ANDX_10 r3;
249         }
250 } R_SESSION_SETUP_ANDX;
253 typedef struct _R_CLOSE {
254         uint8 wcount;
255         uint16 count;
256         uint8 none[count];
258 } R_CLOSE;
260 typedef struct _Q_CLOSE {
261         uint8 wcount;
262         uint16 fnum;
263         uint32 vwv1;
265         uint16 count;
266         uint8 none[count];
268 } Q_CLOSE;
270 typedef struct {
271         uint16 dsize;
272         uint16 bsizehi;
273         uint16 bsizelo;
274         uint16 avail;
275         uint16 vwv4;
277         uint16 bcount;
278         uint8 none[bcount];
280 } R_DSKATTR_5;
282 typedef struct {
283         uint8 wcount;
284         union ctr[wcount] {
285                 case 5 R_DSKATTR_5 r5;
286         }
287 } R_DSKATTR;
289 typedef struct {
290         uint16 count;
291         uint8 none[count];
293 } Q_DSKATTR_0;
295 typedef struct _Q_DSKATTR {
296         uint8 wcount;
297         union ctr[wcount] {
298                 case 0 Q_DSKATTR_0 q1;
299         }
301 } Q_DSKATTR;
303 typedef struct {
304         ANDX_INFO andx;
306         uint16 bcount;
307         uint8 none[bcount];
309 } R_LOCKING_2;
311 typedef struct {
312         uint8 wcount;
313         union ctr[wcount] {
314                 case 2 R_LOCKING_2 r2;
315         }
316 } R_LOCKING_ANDX;
318 /* XXXX must do a switch on bit 0x10 to do large locks XXXX */
319 /*      LockType Flag Name            Value Description */
321 #define LOCKING_ANDX_SHARED_LOCK      0x01  /* Read-only lock */
322 #define LOCKING_ANDX_OPLOCK_RELEASE   0x02  /* Oplock break notification */
323 #define LOCKING_ANDX_CHANGE_LOCKTYPE  0x04  /* Change lock type */
324 #define LOCKING_ANDX_CANCEL_LOCK      0x08  /* Cancel outstanding request */
325 #define LOCKING_ANDX_LARGE_FILES      0x10  /* Large file locking format */
327 typedef struct {
328         USHORT Pid;      /* PID of process "owning" lock */
329         ULONG Offset;    /* Offset to bytes to [un]lock */
330         ULONG Length;    /* Number of bytes to [un]lock */
331 } LOCKING_ANDX_RANGE_SHORT;
333 typedef struct {
334         USHORT Pid;       /* PID of process "owning" lock */
335         .align4 0;
336         ULONG OffsetHigh; /* Offset to bytes to [un]lock (high) */
337         ULONG OffsetLow;  /* Offset to bytes to [un]lock (low) */
338         ULONG LengthHigh; /* Number of bytes to [un]lock (high) */
339         ULONG LengthLow;  /* Number of bytes to [un]lock (low) */
341 } LOCKING_ANDX_RANGE_LARGE;
343 /* typedef struct { */
344         /* union ctr[LockType&0x10] { */
345                 /* case 0    LOCKING_ANDX_RANGE_SHORT ls; */
346                 /* case 0x10 LOCKING_ANDX_RANGE_LARGE ll; */
347         /* } */
348 /* } LOCKING_ANDX_RANGE; */
350 typedef struct {
351         ANDX_INFO andx;
353         USHORT Fid;             /* File handle */
354         UCHAR LockType;         /* See LockType table below */
355         UCHAR OplockLevel;      /* The new oplock level */
356         ULONG Timeout;          /* Milliseconds to wait for unlock */
357         USHORT NumberOfUnlocks; /* Num. unlock range structs following */
358         USHORT NumberOfLocks;   /* Num. lock range structs following */
360         USHORT ByteCount;       /* Count of data bytes */
361         LOCKING_ANDX_RANGE_SHORT Unlocks[NumberOfUnlocks]; /* Unlock ranges */
362         LOCKING_ANDX_RANGE_SHORT Locks[NumberOfLocks];     /* Lock ranges */
364 } Q_LOCKING_8;
366 typedef struct _Q_LOCKING {
367         uint8 wcount;
368         union ctr[wcount] {
369                 case 8 Q_LOCKING_8 q8;
370         }
372 } Q_LOCKING_ANDX;
375 typedef struct {
376         uint16 bcount;
377         uint8 protocols[bcount];
379 } R_UNLINK_0;
381 typedef struct {
382         uint8 wcount;
383         union ctr[wcount] {
384                 case 0 R_UNLINK_0 r0;
385         }
386 } R_UNLINK;
388 typedef struct {
389         uint16 dirtype;
391         uint16 count;
392         uint8 fname[count];
394 } Q_UNLINK_1;
396 typedef struct _Q_UNLINK {
397         uint8 wcount;
398         union ctr[wcount] {
399                 case 1 Q_UNLINK_1 q1;
400         }
402 } Q_UNLINK;
404 typedef struct _R_OPEN_ANDX{
405         uint8 wcount;
406         ANDX_INFO andx;
407         uint16 fnum;
408         uint16 fmode;
409         uint32 mtime;
410         uint32 size;
411         uint16 rmode;
412         uint16 vwv9;
413         uint16 vwv10;
414         uint16 smb_action;
415         uint16 vwv12;
416         uint16 vwv13;
417         uint16 vwv14;
419         uint16 count;
420         uint8 none[count];
422 } R_OPEN_ANDX;
424 typedef struct _Q_OPEN_ANDX{
425         uint8 wcount;
426         ANDX_INFO andx;
427         uint16 fnum;
428         uint16 fmode;
429         uint32 mtime;
430         uint32 size;
431         uint16 rmode;
432         uint16 vwv9;
433         uint16 vwv10;
434         uint16 smb_action;
435         uint16 vwv12;
436         uint16 vwv13;
437         uint16 vwv14;
439         uint16 count;
440         uint8 fname[count];
442 } Q_OPEN_ANDX;
444 typedef struct _R_READ_ANDX {
445         uint8 wcount;
446         ANDX_INFO andx;
447         uint16 vwv2;
448         uint16 vwv3;
449         uint16 vwv4;
450         uint16 nread;
451         uint16 offset;
452         uint16 vwv7;
453         uint16 vwv8;
454         uint16 vwv9;
455         uint16 vwv10;
456         uint16 vwv11;
458         uint16 count;
459         uint8 data[count];
461 } R_READ_ANDX;
463 typedef struct _Q_READ_ANDX_10 {
464         ANDX_INFO andx;
465         uint16 fnum;
466         uint32 startpos;
467         uint16 smb_maxcnt;
468         uint16 smb_mincnt;
469         uint16 vwv7;
470         uint16 vwv8;
471         uint16 vwv9;
473         uint16 count;
474         uint8 none[count];
476 } Q_READ_ANDX_10;
478 typedef struct _Q_READ_ANDX_12 {
479         ANDX_INFO andx;
480         uint16 fnum;
481         uint32 startpos;
482         uint16 smb_maxcnt;
483         uint16 smb_mincnt;
484         uint16 vwv7;
485         uint16 vwv8;
486         uint16 vwv9;
487         uint32 startposhi;
489         uint16 count;
490         uint8 none[count];
492 } Q_READ_ANDX_12;
494 typedef struct _Q_READ_ANDX {
495         uint8 wcount;
496         union ctr[wcount] {
497                 case 10 Q_READ_ANDX_10 q10;
498                 case 12 Q_READ_ANDX_12 q12;
499         }
500 } Q_READ_ANDX;
502 typedef struct _R_WRITE_ANDX {
503         uint8 wcount;
504         ANDX_INFO andx;
505         uint16 nwritten;
506         uint16 vwv3;
507         uint16 vwv4;
508         uint16 vwv5;
510         uint16 count;
511         uint8 none[count];
513 } R_WRITE_ANDX;
515 typedef struct _Q_WRITE_ANDX_12 {
516         ANDX_INFO andx;
517         uint16 fnum;
518         uint32 startpos;
519         uint16 vwv5;
520         uint16 vwv6;
521         uint16 write_through;
522         uint16 vwv8;
523         uint16 vwv9;
524         uint16 numtowrite;
525         uint16 smb_doff;
527         uint16 count;
528         uint8 data[count];
530 } Q_WRITE_ANDX_12;
532 typedef struct _Q_WRITE_ANDX_14 {
533         ANDX_INFO andx;
534         uint16 fnum;
535         uint32 startpos;
536         uint16 vwv5;
537         uint16 vwv6;
538         uint16 write_through;
539         uint16 vwv8;
540         uint16 vwv9;
541         uint16 numtowrite;
542         uint16 smb_doff;
543         uint32 startposhi;
545         uint16 count;
546         uint8 data[count];
548 } Q_WRITE_ANDX_14;
550 typedef struct _Q_WRITE_ANDX {
551         uint8 wcount;
552         union ctr[wcount] {
553                 case 12 Q_WRITE_ANDX_12 q12;
554                 case 14 Q_WRITE_ANDX_14 q14;
555         }
556 } Q_WRITE_ANDX;
560 typedef struct _Q_NTTRANS_19 {
561         UCHAR MaxSetupCount;          /* Max setup words to return */
562         USHORT Reserved;
563         ULONG TotalParameterCount;    /* Total parameter bytes being sent */
564         ULONG TotalDataCount;         /* Total data bytes being sent */
565         ULONG MaxParameterCount;      /* Max parameter bytes to return */
566         ULONG MaxDataCount;           /* Max data bytes to return */
567         ULONG ParameterCount;         /* Parameter bytes sent this buffer */
568         ULONG ParameterOffset;        /* Offset (from header start) to */
569                                          /* Parameters */
570         ULONG DataCount;              /* Data bytes sent this buffer */
571         ULONG DataOffset;             /* Offset (from header start) to data */
572         UCHAR SetupCount;             /* Count of setup words */
573         USHORT Function;              /* The transaction function code */
574         UCHAR Buffer[1];
575         USHORT Setup[SetupCount];     /* Setup words */
576         USHORT ByteCount;             /* Count of data bytes */
577         .align4 0;
578         UCHAR Parameters[ParameterCount];/* Parameter bytes */
579         .align4 0;
580         UCHAR Data[DataCount];        /* Data bytes */
582 } Q_NTTRANS_19;
584 typedef struct _Q_NTTRANS {
585         uint8 wcount;
586         union ctr[wcount] {
587                 case 19 Q_NTTRANS_19 q19;
588         }
589 } Q_NTTRANS;
591 typedef struct _R_NTTRANS_18 {
592         UCHAR Reserved[3];
593         ULONG TotalParameterCount;   /* Total parameter bytes being sent */
594         ULONG TotalDataCount;        /* Total data bytes being sent */
595         ULONG ParameterCount;        /* Parameter bytes sent this buffer */
596         ULONG ParameterOffset;       /* Offset (from header start) to */
597                                           /* Parameters */
598         ULONG ParameterDisplacement; /* Specifies the offset from the start */
599                                 /* of the overall parameter block to */
600                                 /* the parameter bytes that are */
601                                 /* contained in this message */
602         ULONG DataCount;        /* Data bytes sent this buffer */
603         ULONG DataOffset;       /* Offset (from header start) to data */
604         ULONG DataDisplacement; /* Specifies the offset from the start */
605                                 /* of the overall data block to the */
606                                 /* data bytes that are contained in */
607                                 /* this message. */
608         UCHAR SetupCount;       /* Count of setup words */
609         USHORT Setup[SetupCount]; /* Setup words */
610         USHORT ByteCount;       /* Count of data bytes */
611         .align4 0;
612         UCHAR Parameters[ParameterCount]; /* Parameter bytes */
613         .align4 0;
614         UCHAR Data[DataCount];  /* Data bytes */
615 } R_NTTRANS_18;
617 typedef struct _R_NTTRANS {
618         uint8 wcount;
619         union ctr[wcount] {
620                 case 18 R_NTTRANS_18 q18;
621         }
622         .align4 2;
623 } R_NTTRANS;
625 /*Setup[0] Transaction2           Value Description */
626 /*Subcommand Code */
627 /*=============================== ===== ============================= */
629 #define TRANS2_OPEN2                    0x00  /* Create file with extended attributes */
630 #define TRANS2_FIND_FIRST2              0x01  /* Begin search for files */
631 #define TRANS2_FIND_NEXT2               0x02  /* Resume search for files */
632 #define TRANS2_QUERY_FS_INFO     0x03  /* Get file system information
633 #define TRANS2_RESERVED4                0x04  /* Reserved */
634 #define TRANS2_QUERY_PATH_INFO   0x05  /* Get information about a named file or directory */
635 #define TRANS2_SET_PATH_INFO     0x06  /* Set information about a named file or directory */
636 #define TRANS2_QUERY_FILE_INFO   0x07  /* Get information about a handle */
637 #define TRANS2_SET_FILE_INFO     0x08  /* Set information by handle */
638 #define TRANS2_FSCTL                    0x09  /* Not implemented by NT server */
639 #define TRANS2_IOCTL2                   0x0A  /* Not implemented by NT server */
640 #define TRANS2_FIND_NOTIFY_FIRST        0x0B  /* Not implemented by NT server */
641 #define TRANS2_FIND_NOTIFY_NEXT         0x0C  /* Not implemented by NT server */
642 #define TRANS2_CREATE_DIRECTORY         0x0D  /* Create directory with extended attributes */
643 #define TRANS2_SESSION_SETUP            0x0E  /* Session setup with extended security information */
644 #define TRANS2_GET_DFS_REFERRAL         0x10  /* Get a DFS referral */
645 #define TRANS2_REPORT_DFS_INCONSISTENCY 0x11  /* Report a DFS knowledge inconsistency */
647 typedef struct {
648         USHORT InformationLevel;   /* Level of information requested */
649 } TRANS2_QUERY_FS_INFO_STRUCT;
651 #define SMB_INFO_STANDARD                1
652 #define SMB_INFO_QUERY_EA_SIZE           2
653 #define SMB_SET_FILE_BASIC_INFO          0x101
654 #define SMB_SET_FILE_DISPOSITION_INFO    0x102
655 #define SMB_SET_FILE_ALLOCATION_INFO     0x103
656 #define SMB_SET_FILE_END_OF_FILE_INFO    0x104
659 typedef struct {
660         hyper CreationTime;
661         hyper LastAccessTime;
662         hyper LastWriteTime;
663         hyper ChangeTime;
664         USHORT Attributes;
665         .align4 0;
666 } SMB_QUERY_FILE_BASIC_INFO_STRUCT;
669 typedef struct {
670         ULONG fs_atr;
671         LONG max_len_filename;
672         ULONG length;
673         uint8 fs[length];
674         .align4 2;
675 } SMB_QUERY_FS_ATTRIBUTE_INFO_STRUCT;
677 #define FILE_CASE_SENSITIVE_SEARCH   0x00000001
678 #define FILE_CASE_PRESERVED_NAMES    0x00000002
679 #define FILE_PRSISTENT_ACLS          0x00000004
680 #define FILE_FILE_COMPRESSION        0x00000008
681 #define FILE_VOLUME_QUOTAS           0x00000010
682 #define FILE_DEVICE_IS_MOUNTED       0x00000020
683 #define FILE_VOLUME_IS_COMPRESSED    0x00008000
685 typedef struct {
686         USHORT Fid;
687         USHORT InformationLevel;
688         USHORT Reserved;
689         .align4 0;
691         union ctr[InformationLevel] {
692                 case 0x101 SMB_QUERY_FILE_BASIC_INFO_STRUCT t101;
693         }
695 } TRANS2_SET_FILE_INFO_STRUCT;
697 typedef struct {
698         USHORT InformationLevel;   /* Level of information requested */
699         ULONG Reserved;            /* Must be zero */
700         STRING FileName;           /* File or directory name */
701 } TRANS2_QUERY_PATH_INFO_STRUCT;
703 typedef struct {
704         USHORT SearchAttributes;
705         USHORT SearchCount;          
706         USHORT Flags;                
707         USHORT InformationLevel;      
708         ULONG SearchStorageType;
709         STRING FileName;              
710 } TRANS2_FIND_FIRST2_STRUCT;
712 typedef struct _Q_TRANS2_15 {
713         USHORT TotalParameterCount;      /* Total parameter bytes being sent */
714         USHORT TotalDataCount;           /* Total data bytes being sent */
715         USHORT MaxParameterCount;        /* Max parameter bytes to return */
716         USHORT MaxDataCount;             /* Max data bytes to return */
717         UCHAR MaxSetupCount;             /* Max setup words to return */
718         UCHAR Reserved;
719         USHORT Flags;                    /* Additional information: */
720                                   /* bit 0 - also disconnect TID in TID */
721         ULONG Timeout;
722         USHORT Reserved2;
723         USHORT ParameterCount;           /* Parameter bytes sent this buffer */
724         USHORT ParameterOffset;          /* Offset (from header start) to */
725                                   /* Parameters */
726         USHORT DataCount;                /* Data bytes sent this buffer */
727         USHORT DataOffset;               /* Offset (from header start) to data */
728         UCHAR SetupCount;                /* Count of setup words */
729         UCHAR Reserved3;                 /* Reserved (pad above to word) */
730         USHORT Setup[SetupCount];        /* Setup words (# = SetupWordCount) */
731         USHORT ByteCount;                /* Count of data bytes */
732         .align4 0;
733         union ctr[Setup[0]] {
734                 case 1 TRANS2_FIND_FIRST2_STRUCT t1;
735                 case 3 TRANS2_QUERY_FS_INFO_STRUCT t3;
736                 case 5 TRANS2_QUERY_PATH_INFO_STRUCT t5;
737                 case 8 TRANS2_SET_FILE_INFO_STRUCT t8;
738         }
740 } Q_TRANS2_15;
742 typedef struct _Q_TRANS2 {
743         uint8 wcount;
744         union ctr[wcount] {
745                 case 15 Q_TRANS2_15 q15;
746         }
747 } Q_TRANS2;
749 typedef struct {
750         ULONG NextEntryOffset;
751         ULONG FileIndex;
752         hyper CreationTime;
753         hyper LastAccessTime;
754         hyper LastWriteTime;
755         hyper ChangeTime;
756         hyper EndOfFile;
757         hyper AllocationSize;
758         ULONG ExtFileAttributes;
759         ULONG FileNameLength;
760         ULONG EaSize;
761         UCHAR ShortNameLength;
762         UCHAR Reserved;
763         uint8 ShortName[24];
764         UCHAR FileName[FileNameLength];
765         .align4 2;
766 } SMB_FIND_FILE_BOTH_DIRECTORY_INFO;
768 typedef struct {
769         .align2 0;
770 } R_TRANS2_D0;
772 typedef struct {
773         .align4 2;
774 } R_TRANS2_P0;
776 typedef struct {
777         USHORT Reserved;
778 } R_TRANS2_P2;
780 typedef struct {
781         USHORT Sid;            /* Search handle */
782         USHORT SearchCount;    /* Number of entries returned */
783         USHORT EndOfSearch;    /* Was last entry returned? */
784         USHORT EaErrorOffset;  /* Offset into EA list if EA error */
785         USHORT LastNameOffset; /* Offset into data to file name of last */
786                         /*  entry, if server needs it to resume */
787                         /*  search; else 0 */
788         .align4 2;
789         SMB_FIND_FILE_BOTH_DIRECTORY_INFO i104[SearchCount];
790 } R_TRANS2_FIND_FIRST2_STRUCT;
792 typedef struct {
793         SMB_QUERY_FILE_BASIC_INFO_STRUCT i101;
794         .align4 2;
795 } R_TRANS2_FILE_BASIC_STRUCT;
797 typedef struct _R_TRANS2_10 {
798         USHORT TotalParameterCount;/* Total parameter bytes being sent */
799         USHORT TotalDataCount;     /* Total data bytes being sent */
800         USHORT Reserved2;
801         USHORT ParameterCount;     /* Parameter bytes sent this buffer */
802         USHORT ParameterOffset;    /* Offset (from header start) to */
803                                   /* Parameters */
804         USHORT ParameterDisplacement; /* Specifies the offset from the start */
805                                   /* of the overall parameter block to */
806                                   /* the parameter bytes that are */
807                                   /* contained in this message */
808         USHORT DataCount;          /* Data bytes sent this buffer */
809         USHORT DataOffset;         /* Offset (from header start) to data */
810         USHORT DataDisplacement;   /* Specifies the offset from the start */
811                                   /* of the overall data block to the */
812                                   /* data bytes that are contained in */
813                                   /* this message. */
814         UCHAR SetupCount;         /* Count of setup words */
815         UCHAR Reserved3;                 /* Reserved (pad above to word) */
816         USHORT Setup[SetupCount]; /* Setup words */
817         USHORT ByteCount;         /* Count of data bytes */
818         .align4 2;
819         union pctr[ParameterCount] {
820                 case 0 R_TRANS2_P0 p0;
821                 case 2 R_TRANS2_P2 p2;
822                 case 10 R_TRANS2_FIND_FIRST2_STRUCT r10;
823         }
824         union dctr[DataCount] {
825                 case 0 R_TRANS2_D0 d0;
826                 case 0x24 R_TRANS2_FILE_BASIC_STRUCT r24;
827                 case 0x14 SMB_QUERY_FS_ATTRIBUTE_INFO_STRUCT r14;
828         }
829 } R_TRANS2_10;
831 typedef struct {
832         USHORT ByteCount;         /* Count of data bytes */
833 } R_TRANS2_0;
835 typedef struct _R_TRANS2 {
836         uint8 wcount;
837         union ctr[wcount] {
838                 case 0 R_TRANS2_0 q0;
839                 case 10 R_TRANS2_10 q10;
840         }
841 } R_TRANS2;
843 typedef struct _Q_TRANS_16 {
844         USHORT TotalParameterCount;      /* Total parameter bytes being sent */
845         USHORT TotalDataCount;           /* Total data bytes being sent */
846         USHORT MaxParameterCount;        /* Max parameter bytes to return */
847         USHORT MaxDataCount;             /* Max data bytes to return */
848         UCHAR MaxSetupCount;             /* Max setup words to return */
849         UCHAR Reserved;
850         USHORT Flags;                    /* Additional information: */
851                                   /* bit 0 - also disconnect TID in TID */
852         ULONG Timeout;
853         USHORT Reserved2;
854         USHORT ParameterCount;           /* Parameter bytes sent this buffer */
855         USHORT ParameterOffset;          /* Offset (from header start) to */
856                                   /* Parameters */
857         USHORT DataCount;                /* Data bytes sent this buffer */
858         USHORT DataOffset;               /* Offset (from header start) to data */
859         UCHAR SetupCount;                /* Count of setup words */
860         UCHAR Reserved3;                 /* Reserved (pad above to word) */
861         USHORT Setup[SetupCount];        /* Setup words (# = SetupWordCount) */
862         USHORT ByteCount;                /* Count of data bytes */
863         STRING Name;                    /* Must be NULL */
864         .align4 0;
865         UCHAR Parameters[ParameterCount];/* Parameter bytes (# = ParameterCount) */ 
866         .align4 0;
867         UCHAR Data[DataCount];           /* Data bytes (# = DataCount) */
869 } Q_TRANS_16;
871 typedef struct _Q_TRANS {
872         uint8 wcount;
873         union ctr[wcount] {
874                 case 16 Q_TRANS_16 q16;
875         }
876 } Q_TRANS;
878 typedef struct _R_TRANS_10 {
879         USHORT TotalParameterCount;/* Total parameter bytes being sent */
880         USHORT TotalDataCount;     /* Total data bytes being sent */
881         USHORT Reserved2;
882         USHORT ParameterCount;     /* Parameter bytes sent this buffer */
883         USHORT ParameterOffset;    /* Offset (from header start) to */
884                                   /* Parameters */
885         USHORT ParameterDisplacement; /* Specifies the offset from the start */
886                                   /* of the overall parameter block to */
887                                   /* the parameter bytes that are */
888                                   /* contained in this message */
889         USHORT DataCount;          /* Data bytes sent this buffer */
890         USHORT DataOffset;         /* Offset (from header start) to data */
891         USHORT DataDisplacement;   /* Specifies the offset from the start */
892                                   /* of the overall data block to the */
893                                   /* data bytes that are contained in */
894                                   /* this message. */
895         UCHAR SetupCount;         /* Count of setup words */
896         UCHAR Reserved3;                 /* Reserved (pad above to word) */
897         USHORT Setup[SetupCount]; /* Setup words */
898         USHORT ByteCount;         /* Count of data bytes */
899         .align4 0;
900         UCHAR Parameters[ParameterCount];/* Parameter bytes */
901         .align4 0;
902         UCHAR Data[DataCount];    /* Data bytes */
903 } R_TRANS_10;
905 typedef struct _R_TRANS {
906         uint8 wcount;
907         union ctr[wcount] {
908                 case 10 R_TRANS_10 q10;
909         }
910 } R_TRANS;
912 typedef struct _Q_NT_CREATE_ANDX_24 {
913         ANDX_INFO andx;
914         uint8 reserved;
915         uint16 name_len;
916         ULONG flags;
917         ULONG rootfid;
918         ULONG access;
919         hyper allocsize;
920         ULONG attribs;
921         ULONG sharing;
922         ULONG creat_disp;
923         ULONG creat_options;
924         ULONG impersonation;
925         uint8 sec_flags;
927         uint16 count;
928         uint8 name[name_len];
930 } Q_NTCREATE_ANDX_24;
932 typedef struct _Q_NTCREATE_ANDX{
933         uint8 wcount;
934         union ctr[wcount] {
935                 case 24 Q_NTCREATE_ANDX_24 q24;
936         }
937 } Q_NTCREATE_ANDX;
939 typedef struct {
940         ANDX_INFO andx;
941         uint8 oplock_level;
942         uint16 fid;
943         ULONG action;
944         TIME create_time;
945         TIME access_time;
946         TIME write_time;
947         TIME change_time;
948         ULONG ext_attribs;
949         hyper allocsize;
950         hyper size;
951         uint16 type;
952         uint16 state;
953         uint8 directory;
955         uint16 count;
956         uint8 none[count];
958 } R_NTCREATE_ANDX_34;
960 typedef struct _R_NTCREATE_ANDX{
961         uint8 wcount;
962         union ctr[wcount] {
963                 case 34 R_NTCREATE_ANDX_34 q34;
964         }
965 } R_NTCREATE_ANDX;
967 typedef struct {
968         ULONG smbhdr;
969         uint8 com;
970         uint8 rcls;
971         uint8 reh;
972         uint16 err;
973         uint8 flg;
974         uint16 flg2;
975         uint16 reserved;
976         uint8 SecuritySignature[8]; 
977         uint16 pad;
978         uint16 tid;
979         uint16 pid;
980         uint16 uid;
981         uint16 mid;
982 } SMB_HDR;
984 typedef struct _R_SMB {
985         ULONG nbhdr;
986         SMB_HDR hdr;
987         union ctr[hdr.com] {
988                 case 4   R_CLOSE      r4;
989                 case 6   R_UNLINK     r6;
990                 case 36  R_LOCKING_ANDX r36;
991                 case 37  R_TRANS r37;
992                 case 45  R_OPEN_ANDX r45;
993                 case 46  R_READ_ANDX r46;
994                 case 47  R_WRITE_ANDX r47;
995                 case 50  R_TRANS2 q50;
996                 case 113 R_TDIS    r113;
997                 case 114 R_NEGPROT r114;
998                 case 115 R_SESSION_SETUP_ANDX r115;
999                 case 116 R_ULOGOFF_ANDX r116;
1000                 case 117 R_TCON_ANDX r117;
1001                 case 128 R_DSKATTR    r128;
1002                 case 160 R_NTTRANS r160;
1003                 case 162 R_NTCREATE_ANDX r162;
1004         }
1005 } R_SMB;
1007 typedef struct _Q_SMB {
1008         ULONG nbhdr;
1009         SMB_HDR hdr;
1010         union ctr[hdr.com] {
1011                 case 4   Q_CLOSE      q4;
1012                 case 6   Q_UNLINK     q6;
1013                 case 36  Q_LOCKING_ANDX q36;
1014                 case 37  Q_TRANS q37;
1015                 case 45  Q_OPEN_ANDX q45;
1016                 case 46  Q_READ_ANDX q46;
1017                 case 47  Q_WRITE_ANDX q47;
1018                 case 50  Q_TRANS2 q50;
1019                 case 113 Q_TDIS    q113;
1020                 case 114 Q_NEGPROT q114;
1021                 case 115 Q_SESSION_SETUP_ANDX q115;
1022                 case 116 Q_ULOGOFF_ANDX q116;
1023                 case 117 Q_TCON_ANDX q117;
1024                 case 128 Q_DSKATTR    q128;
1025                 case 160 Q_NTTRANS q160;
1026                 case 162 Q_NTCREATE_ANDX q162;
1027         }
1028 } Q_SMB;