2 Unix SMB/CIFS implementation.
3 SMB request interface structures
4 Copyright (C) Andrew Tridgell 2003
5 Copyright (C) James J Myers 2003 <myersjj@samba.org>
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program 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 the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 /* Globally Unique ID */
26 /* 64 bit time (100 nanosec) 1601 - cifs6.txt, section 3.5, page 30 */
27 typedef uint64_t NTTIME;
29 /* 8 byte aligned 'hyper' type from MS IDL */
30 typedef uint64_t HYPER_T;
34 /* this structure is just a wrapper for a string, the only reason we
35 bother with this is that it allows us to check the length provided
36 on the wire in testsuite test code to ensure that we are
37 terminating names in the same way that win2003 is. The *ONLY* time
38 you should ever look at the 'private_length' field in this
39 structure is inside compliance test code, in all other cases just
40 use the null terminated char* as the definitive definition of the
43 also note that this structure is only used in packets where there
44 is an explicit length provided on the wire (hence the name). That
45 length is placed in 'private_length'. For packets where the length
46 is always determined by NULL or packet termination a normal char*
47 is used in the structure definition.
50 uint32_t private_length;
56 this header defines the structures and unions used between the SMB
57 parser and the backends.
60 /* struct used for SMBlseek call */
65 int32_t offset; /* signed */
73 /* struct used in unlink() call */
82 /* struct used in chkpath() call */
89 enum smb_mkdir_level {RAW_MKDIR_GENERIC, RAW_MKDIR_MKDIR, RAW_MKDIR_T2MKDIR};
91 /* union used in mkdir() call */
95 enum smb_mkdir_level level;
99 enum smb_mkdir_level level;
106 enum smb_mkdir_level level;
110 struct ea_struct *eas;
115 /* struct used in rmdir() call */
122 /* struct used in rename() call */
123 enum smb_rename_level {RAW_RENAME_RENAME, RAW_RENAME_NTRENAME};
127 enum smb_rename_level level;
130 /* SMBrename interface */
132 enum smb_rename_level level;
135 const char *pattern1;
136 const char *pattern2;
142 /* SMBntrename interface */
144 enum smb_rename_level level;
148 uint16_t flags; /* see RENAME_FLAG_* */
149 uint32_t cluster_size;
150 const char *old_name;
151 const char *new_name;
156 enum smb_tcon_level {RAW_TCON_TCON, RAW_TCON_TCONX};
158 /* union used in tree connect call */
160 /* generic interface */
162 enum smb_tcon_level level;
165 /* SMBtcon interface */
167 enum smb_tcon_level level;
171 const char *password;
180 /* SMBtconX interface */
182 enum smb_tcon_level level;
200 enum smb_sesssetup_level {RAW_SESSSETUP_GENERIC, RAW_SESSSETUP_OLD, RAW_SESSSETUP_NT1, RAW_SESSSETUP_SPNEGO};
202 /* union used in session_setup call */
203 union smb_sesssetup {
205 /* generic interface - used for auto selecting based on negotiated
208 enum smb_sesssetup_level level;
212 uint32_t capabilities;
213 const char *password;
225 /* the pre-NT1 interface */
227 enum smb_sesssetup_level level;
249 /* the NT1 interface */
251 enum smb_sesssetup_level level;
258 uint32_t capabilities;
276 /* the SPNEGO interface */
278 enum smb_sesssetup_level level;
285 uint32_t capabilities;
302 /* Note that the specified enum values are identical to the actual info-levels used
305 enum smb_fileinfo_level {
306 RAW_FILEINFO_GENERIC = 0xF000,
307 RAW_FILEINFO_GETATTR, /* SMBgetatr */
308 RAW_FILEINFO_GETATTRE, /* SMBgetattrE */
309 RAW_FILEINFO_STANDARD = SMB_QFILEINFO_STANDARD,
310 RAW_FILEINFO_EA_SIZE = SMB_QFILEINFO_EA_SIZE,
311 RAW_FILEINFO_ALL_EAS = SMB_QFILEINFO_ALL_EAS,
312 RAW_FILEINFO_IS_NAME_VALID = SMB_QFILEINFO_IS_NAME_VALID,
313 RAW_FILEINFO_BASIC_INFO = SMB_QFILEINFO_BASIC_INFO,
314 RAW_FILEINFO_STANDARD_INFO = SMB_QFILEINFO_STANDARD_INFO,
315 RAW_FILEINFO_EA_INFO = SMB_QFILEINFO_EA_INFO,
316 RAW_FILEINFO_NAME_INFO = SMB_QFILEINFO_NAME_INFO,
317 RAW_FILEINFO_ALL_INFO = SMB_QFILEINFO_ALL_INFO,
318 RAW_FILEINFO_ALT_NAME_INFO = SMB_QFILEINFO_ALT_NAME_INFO,
319 RAW_FILEINFO_STREAM_INFO = SMB_QFILEINFO_STREAM_INFO,
320 RAW_FILEINFO_COMPRESSION_INFO = SMB_QFILEINFO_COMPRESSION_INFO,
321 RAW_FILEINFO_UNIX_BASIC = SMB_QFILEINFO_UNIX_BASIC,
322 RAW_FILEINFO_UNIX_LINK = SMB_QFILEINFO_UNIX_LINK,
323 RAW_FILEINFO_BASIC_INFORMATION = SMB_QFILEINFO_BASIC_INFORMATION,
324 RAW_FILEINFO_STANDARD_INFORMATION = SMB_QFILEINFO_STANDARD_INFORMATION,
325 RAW_FILEINFO_INTERNAL_INFORMATION = SMB_QFILEINFO_INTERNAL_INFORMATION,
326 RAW_FILEINFO_EA_INFORMATION = SMB_QFILEINFO_EA_INFORMATION,
327 RAW_FILEINFO_ACCESS_INFORMATION = SMB_QFILEINFO_ACCESS_INFORMATION,
328 RAW_FILEINFO_NAME_INFORMATION = SMB_QFILEINFO_NAME_INFORMATION,
329 RAW_FILEINFO_POSITION_INFORMATION = SMB_QFILEINFO_POSITION_INFORMATION,
330 RAW_FILEINFO_MODE_INFORMATION = SMB_QFILEINFO_MODE_INFORMATION,
331 RAW_FILEINFO_ALIGNMENT_INFORMATION = SMB_QFILEINFO_ALIGNMENT_INFORMATION,
332 RAW_FILEINFO_ALL_INFORMATION = SMB_QFILEINFO_ALL_INFORMATION,
333 RAW_FILEINFO_ALT_NAME_INFORMATION = SMB_QFILEINFO_ALT_NAME_INFORMATION,
334 RAW_FILEINFO_STREAM_INFORMATION = SMB_QFILEINFO_STREAM_INFORMATION,
335 RAW_FILEINFO_COMPRESSION_INFORMATION = SMB_QFILEINFO_COMPRESSION_INFORMATION,
336 RAW_FILEINFO_NETWORK_OPEN_INFORMATION = SMB_QFILEINFO_NETWORK_OPEN_INFORMATION,
337 RAW_FILEINFO_ATTRIBUTE_TAG_INFORMATION = SMB_QFILEINFO_ATTRIBUTE_TAG_INFORMATION
341 /* union used in qfileinfo() and qpathinfo() backend calls */
343 /* generic interface:
344 * matches RAW_FILEINFO_GENERIC */
346 enum smb_fileinfo_level level;
348 /* each level can be called on either a pathname or a
349 * filename, in either case the return format is
351 union smb_fileinfo_in {
373 WIRE_STRING alt_fname;
374 uint8_t delete_pending;
376 uint64_t compressed_size;
380 uint8_t cluster_shift;
382 uint32_t access_flags; /* seen 0x001f01ff from w2k3 */
385 uint32_t alignment_requirement;
386 uint32_t reparse_tag;
388 struct stream_struct {
391 WIRE_STRING stream_name;
397 /* SMBgetatr interface:
398 * matches RAW_FILEINFO_GETATTR */
400 enum smb_fileinfo_level level;
401 union smb_fileinfo_in in;
410 /* SMBgetattrE interface */
412 enum smb_fileinfo_level level;
413 union smb_fileinfo_in in;
425 /* trans2 RAW_FILEINFO_STANDARD interface */
427 enum smb_fileinfo_level level;
428 union smb_fileinfo_in in;
440 /* trans2 RAW_FILEINFO_EA_SIZE interface */
442 enum smb_fileinfo_level level;
443 union smb_fileinfo_in in;
456 /* trans2 RAW_FILEINFO_ALL_EAS interface */
458 enum smb_fileinfo_level level;
459 union smb_fileinfo_in in;
462 /* the ea_size is implied by the list */
464 struct ea_struct *eas;
468 /* trans2 qpathinfo RAW_FILEINFO_IS_NAME_VALID interface
469 only valid for a QPATHNAME call - no returned data */
471 enum smb_fileinfo_level level;
472 union smb_fileinfo_in in;
475 /* RAW_FILEINFO_BASIC_INFO and RAW_FILEINFO_BASIC_INFORMATION interfaces */
477 enum smb_fileinfo_level level;
478 union smb_fileinfo_in in;
490 /* RAW_FILEINFO_STANDARD_INFO and RAW_FILEINFO_STANDARD_INFORMATION interfaces */
492 enum smb_fileinfo_level level;
493 union smb_fileinfo_in in;
504 /* RAW_FILEINFO_EA_INFO and RAW_FILEINFO_EA_INFORMATION interfaces */
506 enum smb_fileinfo_level level;
507 union smb_fileinfo_in in;
514 /* RAW_FILEINFO_NAME_INFO and RAW_FILEINFO_NAME_INFORMATION interfaces */
516 enum smb_fileinfo_level level;
517 union smb_fileinfo_in in;
524 /* RAW_FILEINFO_ALL_INFO and RAW_FILEINFO_ALL_INFORMATION interfaces */
526 enum smb_fileinfo_level level;
527 union smb_fileinfo_in in;
538 uint8_t delete_pending;
545 /* RAW_FILEINFO_ALT_NAME_INFO and RAW_FILEINFO_ALT_NAME_INFORMATION interfaces */
547 enum smb_fileinfo_level level;
548 union smb_fileinfo_in in;
555 /* RAW_FILEINFO_STREAM_INFO and RAW_FILEINFO_STREAM_INFORMATION interfaces */
557 enum smb_fileinfo_level level;
558 union smb_fileinfo_in in;
562 struct stream_struct *streams;
566 /* RAW_FILEINFO_COMPRESSION_INFO and RAW_FILEINFO_COMPRESSION_INFORMATION interfaces */
568 enum smb_fileinfo_level level;
569 union smb_fileinfo_in in;
572 uint64_t compressed_size;
576 uint8_t cluster_shift;
580 /* RAW_FILEINFO_UNIX_BASIC interface */
582 enum smb_fileinfo_level level;
583 union smb_fileinfo_in in;
586 uint64_t end_of_file;
588 NTTIME status_change_time;
597 uint64_t permissions;
602 /* RAW_FILEINFO_UNIX_LINK interface */
604 enum smb_fileinfo_level level;
605 union smb_fileinfo_in in;
608 WIRE_STRING link_dest;
612 /* RAW_FILEINFO_INTERNAL_INFORMATION interface */
614 enum smb_fileinfo_level level;
615 union smb_fileinfo_in in;
620 } internal_information;
622 /* RAW_FILEINFO_ACCESS_INFORMATION interface */
624 enum smb_fileinfo_level level;
625 union smb_fileinfo_in in;
628 uint32_t access_flags; /* seen 0x001f01ff from w2k3 */
630 } access_information;
632 /* RAW_FILEINFO_POSITION_INFORMATION interface */
634 enum smb_fileinfo_level level;
635 union smb_fileinfo_in in;
640 } position_information;
642 /* RAW_FILEINFO_MODE_INFORMATION interface */
644 enum smb_fileinfo_level level;
645 union smb_fileinfo_in in;
652 /* RAW_FILEINFO_ALIGNMENT_INFORMATION interface */
654 enum smb_fileinfo_level level;
655 union smb_fileinfo_in in;
658 uint32_t alignment_requirement;
660 } alignment_information;
662 /* RAW_FILEINFO_NETWORK_OPEN_INFORMATION interface */
664 enum smb_fileinfo_level level;
665 union smb_fileinfo_in in;
676 } network_open_information;
679 /* RAW_FILEINFO_ATTRIBUTE_TAG_INFORMATION interface */
681 enum smb_fileinfo_level level;
682 union smb_fileinfo_in in;
686 uint32_t reparse_tag;
688 } attribute_tag_information;
692 enum smb_setfileinfo_level {
693 RAW_SFILEINFO_GENERIC = 0xF000,
694 RAW_SFILEINFO_SETATTR, /* SMBsetatr */
695 RAW_SFILEINFO_SETATTRE, /* SMBsetattrE */
696 RAW_SFILEINFO_STANDARD = SMB_SFILEINFO_STANDARD,
697 RAW_SFILEINFO_EA_SET = SMB_SFILEINFO_EA_SET,
698 RAW_SFILEINFO_BASIC_INFO = SMB_SFILEINFO_BASIC_INFO,
699 RAW_SFILEINFO_DISPOSITION_INFO = SMB_SFILEINFO_DISPOSITION_INFO,
700 RAW_SFILEINFO_ALLOCATION_INFO = SMB_SFILEINFO_ALLOCATION_INFO,
701 RAW_SFILEINFO_END_OF_FILE_INFO = SMB_SFILEINFO_END_OF_FILE_INFO,
702 RAW_SFILEINFO_UNIX_BASIC = SMB_SFILEINFO_UNIX_BASIC,
703 RAW_SFILEINFO_UNIX_LINK = SMB_SFILEINFO_UNIX_LINK,
704 RAW_SFILEINFO_UNIX_HLINK = SMB_SFILEINFO_UNIX_HLINK,
705 RAW_SFILEINFO_BASIC_INFORMATION = SMB_SFILEINFO_BASIC_INFORMATION,
706 RAW_SFILEINFO_RENAME_INFORMATION = SMB_SFILEINFO_RENAME_INFORMATION,
707 RAW_SFILEINFO_DISPOSITION_INFORMATION = SMB_SFILEINFO_DISPOSITION_INFORMATION,
708 RAW_SFILEINFO_POSITION_INFORMATION = SMB_SFILEINFO_POSITION_INFORMATION,
709 RAW_SFILEINFO_MODE_INFORMATION = SMB_SFILEINFO_MODE_INFORMATION,
710 RAW_SFILEINFO_ALLOCATION_INFORMATION = SMB_SFILEINFO_ALLOCATION_INFORMATION,
711 RAW_SFILEINFO_END_OF_FILE_INFORMATION = SMB_SFILEINFO_END_OF_FILE_INFORMATION,
712 RAW_SFILEINFO_1023 = SMB_SFILEINFO_1023,
713 RAW_SFILEINFO_1025 = SMB_SFILEINFO_1025,
714 RAW_SFILEINFO_1029 = SMB_SFILEINFO_1029,
715 RAW_SFILEINFO_1032 = SMB_SFILEINFO_1032,
716 RAW_SFILEINFO_1039 = SMB_SFILEINFO_1039,
717 RAW_SFILEINFO_1040 = SMB_SFILEINFO_1040
720 /* union used in setfileinfo() and setpathinfo() calls */
721 union smb_setfileinfo {
722 /* generic interface */
724 enum smb_setfileinfo_level level;
726 /* we are combining setfileinfo and setpathinfo into one
728 union setfileinfo_file {
734 /* RAW_SFILEINFO_SETATTR (SMBsetatr) interface - only via setpathinfo() */
736 enum smb_setfileinfo_level level;
737 union setfileinfo_file file;
744 /* RAW_SFILEINFO_SETATTRE (SMBsetattrE) interface - only via setfileinfo() */
746 enum smb_setfileinfo_level level;
747 union setfileinfo_file file;
757 /* RAW_SFILEINFO_STANDARD interface */
759 enum smb_setfileinfo_level level;
760 union setfileinfo_file file;
765 /* notice that size, alloc_size and attrib are not settable,
766 unlike the corresponding qfileinfo level */
770 /* RAW_SFILEINFO_EA_SET interface */
772 enum smb_setfileinfo_level level;
773 union setfileinfo_file file;
779 /* RAW_SFILEINFO_BASIC_INFO and
780 RAW_SFILEINFO_BASIC_INFORMATION interfaces */
782 enum smb_setfileinfo_level level;
783 union setfileinfo_file file;
794 /* RAW_SFILEINFO_DISPOSITION_INFO and
795 RAW_SFILEINFO_DISPOSITION_INFORMATION interfaces */
797 enum smb_setfileinfo_level level;
798 union setfileinfo_file file;
801 BOOL delete_on_close;
805 /* RAW_SFILEINFO_ALLOCATION_INFO and
806 RAW_SFILEINFO_ALLOCATION_INFORMATION interfaces */
808 enum smb_setfileinfo_level level;
809 union setfileinfo_file file;
812 /* w2k3 rounds this up to nearest 4096 */
817 /* RAW_SFILEINFO_END_OF_FILE_INFO and
818 RAW_SFILEINFO_END_OF_FILE_INFORMATION interfaces */
820 enum smb_setfileinfo_level level;
821 union setfileinfo_file file;
828 /* RAW_SFILEINFO_RENAME_INFORMATION interface */
830 enum smb_setfileinfo_level level;
831 union setfileinfo_file file;
836 const char *new_name;
838 } rename_information;
840 /* RAW_SFILEINFO_POSITION_INFORMATION interface */
842 enum smb_setfileinfo_level level;
843 union setfileinfo_file file;
848 } position_information;
850 /* RAW_SFILEINFO_MODE_INFORMATION interface */
852 enum smb_setfileinfo_level level;
853 union setfileinfo_file file;
856 /* valid values seem to be 0, 2, 4 and 6 */
863 /* RAW_SFILEINFO_UNIX_BASIC interface */
865 enum smb_setfileinfo_level level;
866 union setfileinfo_file file;
868 uint32_t mode; /* yuck - this field remains to fix compile of libcli/clifile.c */
869 uint64_t end_of_file;
871 NTTIME status_change_time;
880 uint64_t permissions;
885 /* RAW_SFILEINFO_UNIX_LINK, RAW_SFILEINFO_UNIX_HLINK interface */
887 enum smb_setfileinfo_level level;
888 union setfileinfo_file file;
890 const char *link_dest;
892 } unix_link, unix_hlink;
896 enum smb_fsinfo_level {
897 RAW_QFS_GENERIC = 0xF000,
898 RAW_QFS_DSKATTR, /* SMBdskattr */
899 RAW_QFS_ALLOCATION = SMB_QFS_ALLOCATION,
900 RAW_QFS_VOLUME = SMB_QFS_VOLUME,
901 RAW_QFS_VOLUME_INFO = SMB_QFS_VOLUME_INFO,
902 RAW_QFS_SIZE_INFO = SMB_QFS_SIZE_INFO,
903 RAW_QFS_DEVICE_INFO = SMB_QFS_DEVICE_INFO,
904 RAW_QFS_ATTRIBUTE_INFO = SMB_QFS_ATTRIBUTE_INFO,
905 RAW_QFS_UNIX_INFO = SMB_QFS_UNIX_INFO,
906 RAW_QFS_VOLUME_INFORMATION = SMB_QFS_VOLUME_INFORMATION,
907 RAW_QFS_SIZE_INFORMATION = SMB_QFS_SIZE_INFORMATION,
908 RAW_QFS_DEVICE_INFORMATION = SMB_QFS_DEVICE_INFORMATION,
909 RAW_QFS_ATTRIBUTE_INFORMATION = SMB_QFS_ATTRIBUTE_INFORMATION,
910 RAW_QFS_QUOTA_INFORMATION = SMB_QFS_QUOTA_INFORMATION,
911 RAW_QFS_FULL_SIZE_INFORMATION = SMB_QFS_FULL_SIZE_INFORMATION,
912 RAW_QFS_OBJECTID_INFORMATION = SMB_QFS_OBJECTID_INFORMATION};
915 /* union for fsinfo() backend call. Note that there are no in
916 structures, as this call only contains out parameters */
918 /* generic interface */
920 enum smb_fsinfo_level level;
924 uint64_t blocks_total;
925 uint64_t blocks_free;
928 uint32_t serial_number;
930 uint32_t max_file_component_length;
931 uint32_t device_type;
932 uint32_t device_characteristics;
935 uint64_t quota_flags;
942 /* SMBdskattr interface */
944 enum smb_fsinfo_level level;
947 uint16_t units_total;
948 uint16_t blocks_per_unit;
954 /* trans2 RAW_QFS_ALLOCATION interface */
956 enum smb_fsinfo_level level;
960 uint32_t sectors_per_unit;
961 uint32_t total_alloc_units;
962 uint32_t avail_alloc_units;
963 uint16_t bytes_per_sector;
967 /* TRANS2 RAW_QFS_VOLUME interface */
969 enum smb_fsinfo_level level;
972 uint32_t serial_number;
973 WIRE_STRING volume_name;
977 /* TRANS2 RAW_QFS_VOLUME_INFO and RAW_QFS_VOLUME_INFORMATION interfaces */
979 enum smb_fsinfo_level level;
983 uint32_t serial_number;
984 WIRE_STRING volume_name;
988 /* trans2 RAW_QFS_SIZE_INFO and RAW_QFS_SIZE_INFORMATION interfaces */
990 enum smb_fsinfo_level level;
993 uint64_t total_alloc_units;
994 uint64_t avail_alloc_units; /* maps to call_avail_alloc_units */
995 uint32_t sectors_per_unit;
996 uint32_t bytes_per_sector;
1000 /* TRANS2 RAW_QFS_DEVICE_INFO and RAW_QFS_DEVICE_INFORMATION interfaces */
1002 enum smb_fsinfo_level level;
1005 uint32_t device_type;
1006 uint32_t characteristics;
1011 /* TRANS2 RAW_QFS_ATTRIBUTE_INFO and RAW_QFS_ATTRIBUTE_INFORMATION interfaces */
1013 enum smb_fsinfo_level level;
1017 uint32_t max_file_component_length;
1018 WIRE_STRING fs_type;
1023 /* TRANS2 RAW_QFS_UNIX_INFO interface */
1025 enum smb_fsinfo_level level;
1028 uint16_t major_version;
1029 uint16_t minor_version;
1030 uint64_t capability;
1034 /* trans2 RAW_QFS_QUOTA_INFORMATION interface */
1036 enum smb_fsinfo_level level;
1039 uint64_t unknown[3];
1040 uint64_t quota_soft;
1041 uint64_t quota_hard;
1042 uint64_t quota_flags;
1044 } quota_information;
1046 /* trans2 RAW_QFS_FULL_SIZE_INFORMATION interface */
1048 enum smb_fsinfo_level level;
1051 uint64_t total_alloc_units;
1052 uint64_t call_avail_alloc_units;
1053 uint64_t actual_avail_alloc_units;
1054 uint32_t sectors_per_unit;
1055 uint32_t bytes_per_sector;
1057 } full_size_information;
1059 /* trans2 RAW_QFS_OBJECTID_INFORMATION interface */
1061 enum smb_fsinfo_level level;
1065 uint64_t unknown[6];
1067 } objectid_information;
1072 enum smb_open_level {
1073 RAW_OPEN_OPEN, RAW_OPEN_OPENX,
1074 RAW_OPEN_MKNEW, RAW_OPEN_CREATE,
1075 RAW_OPEN_CTEMP, RAW_OPEN_SPLOPEN,
1076 RAW_OPEN_NTCREATEX, RAW_OPEN_T2OPEN};
1078 /* the generic interface is defined to be equal to the NTCREATEX interface */
1079 #define RAW_OPEN_GENERIC RAW_OPEN_NTCREATEX
1081 /* union for open() backend call */
1083 /* SMBNTCreateX interface */
1085 enum smb_open_level level;
1090 uint32_t access_mask;
1091 uint64_t alloc_size;
1093 uint32_t share_access;
1094 uint32_t open_disposition;
1095 uint32_t create_options;
1096 uint32_t impersonation;
1097 uint8_t security_flags;
1098 /* NOTE: fname can also be a pointer to a
1099 uint64_t file_id if create_options has the
1100 NTCREATEX_OPTIONS_OPEN_BY_FILE_ID flag set */
1105 uint8_t oplock_level;
1107 uint32_t create_action;
1113 uint64_t alloc_size;
1117 uint8_t is_directory;
1119 } ntcreatex, generic;
1121 /* TRANS2_OPEN interface */
1123 enum smb_open_level level;
1128 uint16_t file_attrs;
1135 struct ea_struct *eas;
1151 /* SMBopen interface */
1153 enum smb_open_level level;
1157 uint16_t search_attrs;
1169 /* SMBopenX interface */
1171 enum smb_open_level level;
1176 uint16_t search_attrs; /* not honoured by win2003 */
1177 uint16_t file_attrs;
1178 time_t write_time; /* not honoured by win2003 */
1180 uint32_t size; /* note that this sets the
1181 initial file size, not
1182 just allocation size */
1183 uint32_t timeout; /* not honoured by win2003 */
1195 uint32_t unique_fid;
1196 uint32_t access_mask;
1201 /* SMBmknew interface */
1203 enum smb_open_level level;
1215 /* SMBctemp interface */
1217 enum smb_open_level level;
1222 const char *directory;
1226 /* temp name, relative to directory */
1231 /* SMBsplopen interface */
1233 enum smb_open_level level;
1236 uint16_t setup_length;
1248 enum smb_read_level {RAW_READ_GENERIC, RAW_READ_READBRAW, RAW_READ_LOCKREAD, RAW_READ_READ, RAW_READ_READX};
1250 /* union for read() backend call
1252 note that .infoX.out.data will be allocated before the backend is
1253 called. It will be big enough to hold the maximum size asked for
1256 /* generic interface */
1258 enum smb_read_level level;
1272 /* SMBreadbraw interface */
1274 enum smb_read_level level;
1290 /* SMBlockandread interface */
1292 enum smb_read_level level;
1306 /* SMBread interface */
1308 enum smb_read_level level;
1322 /* SMBreadX interface */
1324 enum smb_read_level level;
1336 uint16_t compaction_mode;
1343 enum smb_write_level {
1344 RAW_WRITE_GENERIC, RAW_WRITE_WRITEUNLOCK, RAW_WRITE_WRITE,
1345 RAW_WRITE_WRITEX, RAW_WRITE_WRITECLOSE, RAW_WRITE_SPLWRITE};
1347 /* union for write() backend call
1350 /* generic interface */
1352 enum smb_write_level level;
1366 /* SMBwriteunlock interface */
1368 enum smb_write_level level;
1382 /* SMBwrite interface */
1384 enum smb_write_level level;
1398 /* SMBwriteX interface */
1400 enum smb_write_level level;
1416 /* SMBwriteclose interface */
1418 enum smb_write_level level;
1432 /* SMBsplwrite interface */
1434 enum smb_write_level level;
1445 enum smb_lock_level {RAW_LOCK_GENERIC, RAW_LOCK_LOCK, RAW_LOCK_UNLOCK, RAW_LOCK_LOCKX};
1447 /* union for lock() backend call
1450 /* generic interface */
1452 enum smb_lock_level level;
1456 /* SMBlock interface */
1458 enum smb_lock_level level;
1467 /* SMBunlock interface */
1469 enum smb_lock_level level;
1478 /* SMBlockingX interface */
1480 enum smb_lock_level level;
1488 struct smb_lock_entry {
1492 } *locks; /* unlocks are first in the arrray */
1498 enum smb_close_level {RAW_CLOSE_GENERIC, RAW_CLOSE_CLOSE, RAW_CLOSE_SPLCLOSE};
1501 union for close() backend call
1504 /* generic interface */
1506 enum smb_close_level level;
1513 /* SMBclose interface */
1515 enum smb_close_level level;
1523 /* SMBsplclose interface - empty! */
1525 enum smb_close_level level;
1534 enum smb_lpq_level {RAW_LPQ_GENERIC, RAW_LPQ_RETQ};
1537 union for lpq() backend
1540 /* generic interface */
1542 enum smb_lpq_level level;
1547 /* SMBsplretq interface */
1549 enum smb_lpq_level level;
1557 uint16_t restart_idx;
1569 enum smb_ioctl_level {RAW_IOCTL_IOCTL, RAW_IOCTL_NTIOCTL};
1572 union for ioctl() backend
1575 /* generic interface */
1577 enum smb_ioctl_level level;
1581 /* struct for SMBioctl */
1583 enum smb_ioctl_level level;
1594 /* struct for NT ioctl call */
1596 enum smb_ioctl_level level;
1609 /* struct for SMBflush */
1617 /* struct for SMBcopy */
1632 /* struct for transact/transact2 call */
1640 uint8_t setup_count;
1642 const char *trans_name; /* SMBtrans only */
1648 uint8_t setup_count;
1655 /* struct for nttransact2 call */
1656 struct smb_nttrans {
1661 uint32_t setup_count;
1669 uint8_t setup_count;
1677 /* struct for nttrans change notify call */
1680 uint32_t buffer_size;
1681 uint32_t completion_filter;
1687 uint32_t num_changes;
1696 enum smb_search_level {RAW_SEARCH_GENERIC = 0xF000,
1697 RAW_SEARCH_SEARCH, /* SMBsearch */
1698 RAW_SEARCH_FFIRST, /* SMBffirst */
1699 RAW_SEARCH_FUNIQUE, /* SMBfunique */
1700 RAW_SEARCH_STANDARD = SMB_FIND_STANDARD,
1701 RAW_SEARCH_EA_SIZE = SMB_FIND_EA_SIZE,
1702 RAW_SEARCH_DIRECTORY_INFO = SMB_FIND_DIRECTORY_INFO,
1703 RAW_SEARCH_FULL_DIRECTORY_INFO = SMB_FIND_FULL_DIRECTORY_INFO,
1704 RAW_SEARCH_NAME_INFO = SMB_FIND_NAME_INFO,
1705 RAW_SEARCH_BOTH_DIRECTORY_INFO = SMB_FIND_BOTH_DIRECTORY_INFO,
1706 RAW_SEARCH_ID_FULL_DIRECTORY_INFO = SMB_FIND_ID_FULL_DIRECTORY_INFO,
1707 RAW_SEARCH_ID_BOTH_DIRECTORY_INFO = SMB_FIND_ID_BOTH_DIRECTORY_INFO,
1708 RAW_SEARCH_UNIX_INFO = SMB_FIND_UNIX_INFO};
1711 /* union for file search */
1712 union smb_search_first {
1714 enum smb_search_level level;
1717 /* search (old) findfirst interface.
1718 Also used for ffirst and funique. */
1720 enum smb_search_level level;
1724 uint16_t search_attrib;
1725 const char *pattern;
1732 /* trans2 findfirst interface */
1734 enum smb_search_level level;
1737 uint16_t search_attrib;
1740 uint32_t storage_type;
1741 const char *pattern;
1746 uint16_t end_of_search;
1751 /* union for file search continue */
1752 union smb_search_next {
1754 enum smb_search_level level;
1757 /* search (old) findnext interface. Also used
1758 for ffirst when continuing */
1760 enum smb_search_level level;
1764 uint16_t search_attrib;
1765 struct smb_search_id {
1769 uint32_t server_cookie;
1770 uint32_t client_cookie;
1778 /* trans2 findnext interface */
1780 enum smb_search_level level;
1785 uint32_t resume_key;
1787 const char *last_name;
1791 uint16_t end_of_search;
1796 /* union for search reply file data */
1797 union smb_search_data {
1798 /* search (old) findfirst */
1803 struct smb_search_id id;
1807 /* trans2 findfirst RAW_SEARCH_STANDARD level */
1809 uint32_t resume_key;
1814 uint32_t alloc_size;
1819 /* trans2 findfirst RAW_SEARCH_EA_SIZE level */
1821 uint32_t resume_key;
1826 uint32_t alloc_size;
1832 /* RAW_SEARCH_DIRECTORY_INFO interface */
1834 uint32_t file_index;
1840 uint64_t alloc_size;
1845 /* RAW_SEARCH_FULL_DIRECTORY_INFO interface */
1847 uint32_t file_index;
1853 uint64_t alloc_size;
1857 } full_directory_info;
1859 /* RAW_SEARCH_NAME_INFO interface */
1861 uint32_t file_index;
1865 /* RAW_SEARCH_BOTH_DIRECTORY_INFO interface */
1867 uint32_t file_index;
1873 uint64_t alloc_size;
1876 WIRE_STRING short_name;
1878 } both_directory_info;
1880 /* RAW_SEARCH_ID_FULL_DIRECTORY_INFO interface */
1882 uint32_t file_index;
1888 uint64_t alloc_size;
1893 } id_full_directory_info;
1895 /* RAW_SEARCH_ID_BOTH_DIRECTORY_INFO interface */
1897 uint32_t file_index;
1903 uint64_t alloc_size;
1907 WIRE_STRING short_name;
1909 } id_both_directory_info;
1911 /* RAW_SEARCH_UNIX_INFO interface */
1913 uint32_t file_index;
1915 uint64_t alloc_size;
1916 NTTIME status_change_time;
1925 uint64_t permissions;
1932 enum smb_search_close_level {RAW_FINDCLOSE_GENERIC, RAW_FINDCLOSE_FCLOSE, RAW_FINDCLOSE_FINDCLOSE};
1934 /* union for file search close */
1935 union smb_search_close {
1937 enum smb_search_close_level level;
1940 /* SMBfclose (old search) interface */
1942 enum smb_search_close_level level;
1945 /* max_count and search_attrib are not used, but are present */
1947 uint16_t search_attrib;
1948 struct smb_search_id id;
1952 /* SMBfindclose interface */
1954 enum smb_search_close_level level;