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>
6 Copyright (C) James Peach 2007
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
22 #ifndef __LIBCLI_RAW_INTERFACES_H__
23 #define __LIBCLI_RAW_INTERFACES_H__
26 #include "librpc/gen_ndr/misc.h" /* for struct GUID */
28 /* this structure is just a wrapper for a string, the only reason we
29 bother with this is that it allows us to check the length provided
30 on the wire in testsuite test code to ensure that we are
31 terminating names in the same way that win2003 is. The *ONLY* time
32 you should ever look at the 'private_length' field in this
33 structure is inside compliance test code, in all other cases just
34 use the null terminated char* as the definitive definition of the
37 also note that this structure is only used in packets where there
38 is an explicit length provided on the wire (hence the name). That
39 length is placed in 'private_length'. For packets where the length
40 is always determined by NULL or packet termination a normal char*
41 is used in the structure definition.
43 struct smb_wire_string {
44 uint32_t private_length;
49 * SMB2 uses a 16Byte handle,
50 * (we can maybe use struct GUID later)
59 * a generic container for file handles or file pathes
60 * for qfileinfo/setfileinfo and qpathinfo/setpathinfo
62 union smb_handle_or_path {
65 * the qpathinfo and setpathinfo
70 * this is used as file handle in SMB
75 * this is used as file handle in SMB2
77 struct smb2_handle handle;
80 * this is used as generic file handle for the NTVFS layer
82 struct ntvfs_handle *ntvfs;
86 a generic container for file handles
90 * this is used as file handle in SMB
95 * this is used as file handle in SMB2
97 struct smb2_handle handle;
100 * this is used as generic file handle for the NTVFS layer
102 struct ntvfs_handle *ntvfs;
106 this header defines the structures and unions used between the SMB
107 parser and the backends.
110 /* struct used for SMBlseek call */
114 union smb_handle file;
116 int32_t offset; /* signed */
124 /* struct used in unlink() call */
135 /* struct used in chkpath() call */
144 enum smb_mkdir_level {RAW_MKDIR_GENERIC, RAW_MKDIR_MKDIR, RAW_MKDIR_T2MKDIR};
146 /* union used in mkdir() call */
150 enum smb_mkdir_level level;
154 enum smb_mkdir_level level;
161 enum smb_mkdir_level level;
165 struct ea_struct *eas;
170 /* struct used in rmdir() call */
177 /* struct used in rename() call */
178 enum smb_rename_level {RAW_RENAME_RENAME, RAW_RENAME_NTRENAME, RAW_RENAME_NTTRANS};
182 enum smb_rename_level level;
185 /* SMBrename interface */
187 enum smb_rename_level level;
190 const char *pattern1;
191 const char *pattern2;
197 /* SMBntrename interface */
199 enum smb_rename_level level;
203 uint16_t flags; /* see RENAME_FLAG_* */
204 uint32_t cluster_size;
205 const char *old_name;
206 const char *new_name;
210 /* NT TRANS rename interface */
212 enum smb_rename_level level;
215 union smb_handle file;
216 uint16_t flags;/* see RENAME_REPLACE_IF_EXISTS */
217 const char *new_name;
222 enum smb_tcon_level {
228 /* union used in tree connect call */
230 /* generic interface */
232 enum smb_tcon_level level;
235 /* SMBtcon interface */
237 enum smb_tcon_level level;
241 const char *password;
250 /* SMBtconX interface */
252 enum smb_tcon_level level;
268 /* SMB2 TreeConnect */
269 struct smb2_tree_connect {
270 enum smb_tcon_level level;
273 /* static body buffer 8 (0x08) bytes */
275 /* uint16_t path_ofs */
276 /* uint16_t path_size */
278 const char *path; /* as non-terminated UTF-16 on the wire */
281 /* static body buffer 16 (0x10) bytes */
282 /* uint16_t buffer_code; 0x10 */
286 uint32_t capabilities;
287 uint32_t access_mask;
289 /* extracted from the SMB2 header */
296 enum smb_sesssetup_level {
299 RAW_SESSSETUP_SPNEGO,
303 /* union used in session_setup call */
304 union smb_sesssetup {
305 /* the pre-NT1 interface */
307 enum smb_sesssetup_level level;
329 /* the NT1 interface */
331 enum smb_sesssetup_level level;
338 uint32_t capabilities;
356 /* the SPNEGO interface */
358 enum smb_sesssetup_level level;
365 uint32_t capabilities;
369 const char *workgroup;
381 /* SMB2 SessionSetup */
382 struct smb2_session_setup {
383 enum smb_sesssetup_level level;
386 /* static body 24 (0x18) bytes */
388 uint8_t security_mode;
389 uint32_t capabilities;
391 /* uint16_t secblob_ofs */
392 /* uint16_t secblob_size */
393 uint64_t previous_sessionid;
398 /* body buffer 8 (0x08) bytes */
399 uint16_t session_flags;
400 /* uint16_t secblob_ofs */
401 /* uint16_t secblob_size */
405 /* extracted from the SMB2 header */
411 /* Note that the specified enum values are identical to the actual info-levels used
414 enum smb_fileinfo_level {
415 RAW_FILEINFO_GENERIC = 0xF000,
416 RAW_FILEINFO_GETATTR, /* SMBgetatr */
417 RAW_FILEINFO_GETATTRE, /* SMBgetattrE */
418 RAW_FILEINFO_SEC_DESC, /* NT_TRANSACT_QUERY_SECURITY_DESC */
419 RAW_FILEINFO_STANDARD = SMB_QFILEINFO_STANDARD,
420 RAW_FILEINFO_EA_SIZE = SMB_QFILEINFO_EA_SIZE,
421 RAW_FILEINFO_EA_LIST = SMB_QFILEINFO_EA_LIST,
422 RAW_FILEINFO_ALL_EAS = SMB_QFILEINFO_ALL_EAS,
423 RAW_FILEINFO_IS_NAME_VALID = SMB_QFILEINFO_IS_NAME_VALID,
424 RAW_FILEINFO_BASIC_INFO = SMB_QFILEINFO_BASIC_INFO,
425 RAW_FILEINFO_STANDARD_INFO = SMB_QFILEINFO_STANDARD_INFO,
426 RAW_FILEINFO_EA_INFO = SMB_QFILEINFO_EA_INFO,
427 RAW_FILEINFO_NAME_INFO = SMB_QFILEINFO_NAME_INFO,
428 RAW_FILEINFO_ALL_INFO = SMB_QFILEINFO_ALL_INFO,
429 RAW_FILEINFO_ALT_NAME_INFO = SMB_QFILEINFO_ALT_NAME_INFO,
430 RAW_FILEINFO_STREAM_INFO = SMB_QFILEINFO_STREAM_INFO,
431 RAW_FILEINFO_COMPRESSION_INFO = SMB_QFILEINFO_COMPRESSION_INFO,
432 RAW_FILEINFO_UNIX_BASIC = SMB_QFILEINFO_UNIX_BASIC,
433 RAW_FILEINFO_UNIX_INFO2 = SMB_QFILEINFO_UNIX_INFO2,
434 RAW_FILEINFO_UNIX_LINK = SMB_QFILEINFO_UNIX_LINK,
435 RAW_FILEINFO_BASIC_INFORMATION = SMB_QFILEINFO_BASIC_INFORMATION,
436 RAW_FILEINFO_STANDARD_INFORMATION = SMB_QFILEINFO_STANDARD_INFORMATION,
437 RAW_FILEINFO_INTERNAL_INFORMATION = SMB_QFILEINFO_INTERNAL_INFORMATION,
438 RAW_FILEINFO_EA_INFORMATION = SMB_QFILEINFO_EA_INFORMATION,
439 RAW_FILEINFO_ACCESS_INFORMATION = SMB_QFILEINFO_ACCESS_INFORMATION,
440 RAW_FILEINFO_NAME_INFORMATION = SMB_QFILEINFO_NAME_INFORMATION,
441 RAW_FILEINFO_POSITION_INFORMATION = SMB_QFILEINFO_POSITION_INFORMATION,
442 RAW_FILEINFO_MODE_INFORMATION = SMB_QFILEINFO_MODE_INFORMATION,
443 RAW_FILEINFO_ALIGNMENT_INFORMATION = SMB_QFILEINFO_ALIGNMENT_INFORMATION,
444 RAW_FILEINFO_ALL_INFORMATION = SMB_QFILEINFO_ALL_INFORMATION,
445 RAW_FILEINFO_ALT_NAME_INFORMATION = SMB_QFILEINFO_ALT_NAME_INFORMATION,
446 RAW_FILEINFO_STREAM_INFORMATION = SMB_QFILEINFO_STREAM_INFORMATION,
447 RAW_FILEINFO_COMPRESSION_INFORMATION = SMB_QFILEINFO_COMPRESSION_INFORMATION,
448 RAW_FILEINFO_NETWORK_OPEN_INFORMATION = SMB_QFILEINFO_NETWORK_OPEN_INFORMATION,
449 RAW_FILEINFO_ATTRIBUTE_TAG_INFORMATION = SMB_QFILEINFO_ATTRIBUTE_TAG_INFORMATION,
450 /* SMB2 specific levels */
451 RAW_FILEINFO_SMB2_ALL_EAS = 0x0f01,
452 RAW_FILEINFO_SMB2_ALL_INFORMATION = 0x1201
455 /* union used in qfileinfo() and qpathinfo() backend calls */
457 /* generic interface:
458 * matches RAW_FILEINFO_GENERIC */
460 enum smb_fileinfo_level level;
462 union smb_handle_or_path file;
470 struct smb_wire_string name;
480 struct smb_wire_string fname;
481 struct smb_wire_string alt_fname;
482 uint8_t delete_pending;
484 uint64_t compressed_size;
488 uint8_t cluster_shift;
490 uint32_t access_flags; /* seen 0x001f01ff from w2k3 */
493 uint32_t alignment_requirement;
494 uint32_t reparse_tag;
496 struct stream_struct {
499 struct smb_wire_string stream_name;
505 /* SMBgetatr interface:
506 * matches RAW_FILEINFO_GETATTR */
508 enum smb_fileinfo_level level;
510 union smb_handle_or_path file;
519 /* SMBgetattrE and RAW_FILEINFO_STANDARD interface */
521 enum smb_fileinfo_level level;
523 union smb_handle_or_path file;
533 } getattre, standard;
535 /* trans2 RAW_FILEINFO_EA_SIZE interface */
537 enum smb_fileinfo_level level;
539 union smb_handle_or_path file;
552 /* trans2 RAW_FILEINFO_EA_LIST interface */
554 enum smb_fileinfo_level level;
556 union smb_handle_or_path file;
559 struct smb_wire_string name;
565 struct ea_struct *eas;
569 /* trans2 RAW_FILEINFO_ALL_EAS and RAW_FILEINFO_FULL_EA_INFORMATION interfaces */
571 enum smb_fileinfo_level level;
573 union smb_handle_or_path file;
574 /* SMB2 only - SMB2_CONTINUE_FLAG_* */
575 uint8_t continue_flags;
577 struct smb_ea_list out;
580 /* trans2 qpathinfo RAW_FILEINFO_IS_NAME_VALID interface
581 only valid for a QPATHNAME call - no returned data */
583 enum smb_fileinfo_level level;
585 union smb_handle_or_path file;
589 /* RAW_FILEINFO_BASIC_INFO and RAW_FILEINFO_BASIC_INFORMATION interfaces */
591 enum smb_fileinfo_level level;
593 union smb_handle_or_path file;
605 /* RAW_FILEINFO_STANDARD_INFO and RAW_FILEINFO_STANDARD_INFORMATION interfaces */
607 enum smb_fileinfo_level level;
609 union smb_handle_or_path file;
620 /* RAW_FILEINFO_EA_INFO and RAW_FILEINFO_EA_INFORMATION interfaces */
622 enum smb_fileinfo_level level;
624 union smb_handle_or_path file;
631 /* RAW_FILEINFO_NAME_INFO and RAW_FILEINFO_NAME_INFORMATION interfaces */
633 enum smb_fileinfo_level level;
635 union smb_handle_or_path file;
638 struct smb_wire_string fname;
642 /* RAW_FILEINFO_ALL_INFO and RAW_FILEINFO_ALL_INFORMATION interfaces */
644 enum smb_fileinfo_level level;
646 union smb_handle_or_path file;
657 uint8_t delete_pending;
660 struct smb_wire_string fname;
664 /* RAW_FILEINFO_SMB2_ALL_INFORMATION interface */
666 enum smb_fileinfo_level level;
668 union smb_handle_or_path file;
680 uint8_t delete_pending;
685 uint32_t access_mask;
688 uint32_t alignment_requirement;
689 struct smb_wire_string fname;
693 /* RAW_FILEINFO_ALT_NAME_INFO and RAW_FILEINFO_ALT_NAME_INFORMATION interfaces */
695 enum smb_fileinfo_level level;
697 union smb_handle_or_path file;
700 struct smb_wire_string fname;
704 /* RAW_FILEINFO_STREAM_INFO and RAW_FILEINFO_STREAM_INFORMATION interfaces */
706 enum smb_fileinfo_level level;
708 union smb_handle_or_path file;
710 struct stream_information {
712 struct stream_struct *streams;
716 /* RAW_FILEINFO_COMPRESSION_INFO and RAW_FILEINFO_COMPRESSION_INFORMATION interfaces */
718 enum smb_fileinfo_level level;
720 union smb_handle_or_path file;
723 uint64_t compressed_size;
727 uint8_t cluster_shift;
731 /* RAW_FILEINFO_UNIX_BASIC interface */
733 enum smb_fileinfo_level level;
735 union smb_handle_or_path file;
738 uint64_t end_of_file;
740 NTTIME status_change_time;
749 uint64_t permissions;
754 /* RAW_FILEINFO_UNIX_INFO2 interface */
756 enum smb_fileinfo_level level;
758 union smb_handle_or_path file;
761 uint64_t end_of_file;
763 NTTIME status_change_time;
772 uint64_t permissions;
780 /* RAW_FILEINFO_UNIX_LINK interface */
782 enum smb_fileinfo_level level;
784 union smb_handle_or_path file;
787 struct smb_wire_string link_dest;
791 /* RAW_FILEINFO_INTERNAL_INFORMATION interface */
793 enum smb_fileinfo_level level;
795 union smb_handle_or_path file;
800 } internal_information;
802 /* RAW_FILEINFO_ACCESS_INFORMATION interface */
804 enum smb_fileinfo_level level;
806 union smb_handle_or_path file;
809 uint32_t access_flags;
811 } access_information;
813 /* RAW_FILEINFO_POSITION_INFORMATION interface */
815 enum smb_fileinfo_level level;
817 union smb_handle_or_path file;
822 } position_information;
824 /* RAW_FILEINFO_MODE_INFORMATION interface */
826 enum smb_fileinfo_level level;
828 union smb_handle_or_path file;
835 /* RAW_FILEINFO_ALIGNMENT_INFORMATION interface */
837 enum smb_fileinfo_level level;
839 union smb_handle_or_path file;
842 uint32_t alignment_requirement;
844 } alignment_information;
846 /* RAW_FILEINFO_NETWORK_OPEN_INFORMATION interface */
848 enum smb_fileinfo_level level;
850 union smb_handle_or_path file;
861 } network_open_information;
864 /* RAW_FILEINFO_ATTRIBUTE_TAG_INFORMATION interface */
866 enum smb_fileinfo_level level;
868 union smb_handle_or_path file;
872 uint32_t reparse_tag;
874 } attribute_tag_information;
876 /* RAW_FILEINFO_SEC_DESC */
878 enum smb_fileinfo_level level;
880 union smb_handle_or_path file;
881 uint32_t secinfo_flags;
884 struct security_descriptor *sd;
890 enum smb_setfileinfo_level {
891 RAW_SFILEINFO_GENERIC = 0xF000,
892 RAW_SFILEINFO_SETATTR, /* SMBsetatr */
893 RAW_SFILEINFO_SETATTRE, /* SMBsetattrE */
894 RAW_SFILEINFO_SEC_DESC, /* NT_TRANSACT_SET_SECURITY_DESC */
895 RAW_SFILEINFO_STANDARD = SMB_SFILEINFO_STANDARD,
896 RAW_SFILEINFO_EA_SET = SMB_SFILEINFO_EA_SET,
897 RAW_SFILEINFO_BASIC_INFO = SMB_SFILEINFO_BASIC_INFO,
898 RAW_SFILEINFO_DISPOSITION_INFO = SMB_SFILEINFO_DISPOSITION_INFO,
899 RAW_SFILEINFO_ALLOCATION_INFO = SMB_SFILEINFO_ALLOCATION_INFO,
900 RAW_SFILEINFO_END_OF_FILE_INFO = SMB_SFILEINFO_END_OF_FILE_INFO,
901 RAW_SFILEINFO_UNIX_BASIC = SMB_SFILEINFO_UNIX_BASIC,
902 RAW_SFILEINFO_UNIX_INFO2 = SMB_SFILEINFO_UNIX_INFO2,
903 RAW_SFILEINFO_UNIX_LINK = SMB_SFILEINFO_UNIX_LINK,
904 RAW_SFILEINFO_UNIX_HLINK = SMB_SFILEINFO_UNIX_HLINK,
905 RAW_SFILEINFO_BASIC_INFORMATION = SMB_SFILEINFO_BASIC_INFORMATION,
906 RAW_SFILEINFO_RENAME_INFORMATION = SMB_SFILEINFO_RENAME_INFORMATION,
907 RAW_SFILEINFO_DISPOSITION_INFORMATION = SMB_SFILEINFO_DISPOSITION_INFORMATION,
908 RAW_SFILEINFO_POSITION_INFORMATION = SMB_SFILEINFO_POSITION_INFORMATION,
909 RAW_SFILEINFO_MODE_INFORMATION = SMB_SFILEINFO_MODE_INFORMATION,
910 RAW_SFILEINFO_ALLOCATION_INFORMATION = SMB_SFILEINFO_ALLOCATION_INFORMATION,
911 RAW_SFILEINFO_END_OF_FILE_INFORMATION = SMB_SFILEINFO_END_OF_FILE_INFORMATION,
912 RAW_SFILEINFO_1023 = SMB_SFILEINFO_1023,
913 RAW_SFILEINFO_1025 = SMB_SFILEINFO_1025,
914 RAW_SFILEINFO_1029 = SMB_SFILEINFO_1029,
915 RAW_SFILEINFO_1032 = SMB_SFILEINFO_1032,
916 RAW_SFILEINFO_1039 = SMB_SFILEINFO_1039,
917 RAW_SFILEINFO_1040 = SMB_SFILEINFO_1040,
919 /* cope with breakage in SMB2 */
920 RAW_SFILEINFO_RENAME_INFORMATION_SMB2 = SMB_SFILEINFO_RENAME_INFORMATION|0x80000000,
923 /* union used in setfileinfo() and setpathinfo() calls */
924 union smb_setfileinfo {
925 /* generic interface */
927 enum smb_setfileinfo_level level;
929 union smb_handle_or_path file;
933 /* RAW_SFILEINFO_SETATTR (SMBsetatr) interface - only via setpathinfo() */
935 enum smb_setfileinfo_level level;
937 union smb_handle_or_path file;
943 /* RAW_SFILEINFO_SETATTRE (SMBsetattrE) interface - only via setfileinfo()
944 also RAW_SFILEINFO_STANDARD */
946 enum smb_setfileinfo_level level;
948 union smb_handle_or_path file;
952 /* notice that size, alloc_size and attrib are not settable,
953 unlike the corresponding qfileinfo level */
955 } setattre, standard;
957 /* RAW_SFILEINFO_EA_SET interface */
959 enum smb_setfileinfo_level level;
961 union smb_handle_or_path file;
963 struct ea_struct *eas;
967 /* RAW_SFILEINFO_BASIC_INFO and
968 RAW_SFILEINFO_BASIC_INFORMATION interfaces */
970 enum smb_setfileinfo_level level;
972 union smb_handle_or_path file;
981 /* RAW_SFILEINFO_DISPOSITION_INFO and
982 RAW_SFILEINFO_DISPOSITION_INFORMATION interfaces */
984 enum smb_setfileinfo_level level;
986 union smb_handle_or_path file;
987 bool delete_on_close;
991 /* RAW_SFILEINFO_ALLOCATION_INFO and
992 RAW_SFILEINFO_ALLOCATION_INFORMATION interfaces */
994 enum smb_setfileinfo_level level;
996 union smb_handle_or_path file;
997 /* w2k3 rounds this up to nearest 4096 */
1002 /* RAW_SFILEINFO_END_OF_FILE_INFO and
1003 RAW_SFILEINFO_END_OF_FILE_INFORMATION interfaces */
1005 enum smb_setfileinfo_level level;
1007 union smb_handle_or_path file;
1012 /* RAW_SFILEINFO_RENAME_INFORMATION interface */
1014 enum smb_setfileinfo_level level;
1016 union smb_handle_or_path file;
1019 const char *new_name;
1021 } rename_information;
1023 /* RAW_SFILEINFO_POSITION_INFORMATION interface */
1025 enum smb_setfileinfo_level level;
1027 union smb_handle_or_path file;
1030 } position_information;
1032 /* RAW_SFILEINFO_MODE_INFORMATION interface */
1034 enum smb_setfileinfo_level level;
1036 union smb_handle_or_path file;
1037 /* valid values seem to be 0, 2, 4 and 6 */
1042 /* RAW_SFILEINFO_UNIX_BASIC interface */
1044 enum smb_setfileinfo_level level;
1046 union smb_handle_or_path file;
1047 uint32_t mode; /* yuck - this field remains to fix compile of libcli/clifile.c */
1048 uint64_t end_of_file;
1050 NTTIME status_change_time;
1059 uint64_t permissions;
1064 /* RAW_SFILEINFO_UNIX_INFO2 interface */
1066 enum smb_setfileinfo_level level;
1068 union smb_handle_or_path file;
1069 uint64_t end_of_file;
1071 NTTIME status_change_time;
1080 uint64_t permissions;
1083 uint32_t file_flags;
1084 uint32_t flags_mask;
1088 /* RAW_SFILEINFO_UNIX_LINK, RAW_SFILEINFO_UNIX_HLINK interface */
1090 enum smb_setfileinfo_level level;
1092 union smb_handle_or_path file;
1093 const char *link_dest;
1095 } unix_link, unix_hlink;
1097 /* RAW_FILEINFO_SET_SEC_DESC */
1099 enum smb_setfileinfo_level level;
1101 union smb_handle_or_path file;
1102 uint32_t secinfo_flags;
1103 struct security_descriptor *sd;
1109 enum smb_fsinfo_level {
1110 RAW_QFS_GENERIC = 0xF000,
1111 RAW_QFS_DSKATTR, /* SMBdskattr */
1112 RAW_QFS_ALLOCATION = SMB_QFS_ALLOCATION,
1113 RAW_QFS_VOLUME = SMB_QFS_VOLUME,
1114 RAW_QFS_VOLUME_INFO = SMB_QFS_VOLUME_INFO,
1115 RAW_QFS_SIZE_INFO = SMB_QFS_SIZE_INFO,
1116 RAW_QFS_DEVICE_INFO = SMB_QFS_DEVICE_INFO,
1117 RAW_QFS_ATTRIBUTE_INFO = SMB_QFS_ATTRIBUTE_INFO,
1118 RAW_QFS_UNIX_INFO = SMB_QFS_UNIX_INFO,
1119 RAW_QFS_VOLUME_INFORMATION = SMB_QFS_VOLUME_INFORMATION,
1120 RAW_QFS_SIZE_INFORMATION = SMB_QFS_SIZE_INFORMATION,
1121 RAW_QFS_DEVICE_INFORMATION = SMB_QFS_DEVICE_INFORMATION,
1122 RAW_QFS_ATTRIBUTE_INFORMATION = SMB_QFS_ATTRIBUTE_INFORMATION,
1123 RAW_QFS_QUOTA_INFORMATION = SMB_QFS_QUOTA_INFORMATION,
1124 RAW_QFS_FULL_SIZE_INFORMATION = SMB_QFS_FULL_SIZE_INFORMATION,
1125 RAW_QFS_OBJECTID_INFORMATION = SMB_QFS_OBJECTID_INFORMATION};
1128 /* union for fsinfo() backend call. Note that there are no in
1129 structures, as this call only contains out parameters */
1131 /* generic interface */
1133 enum smb_fsinfo_level level;
1134 struct smb2_handle handle; /* only for smb2 */
1137 uint32_t block_size;
1138 uint64_t blocks_total;
1139 uint64_t blocks_free;
1142 uint32_t serial_number;
1144 uint32_t max_file_component_length;
1145 uint32_t device_type;
1146 uint32_t device_characteristics;
1147 uint64_t quota_soft;
1148 uint64_t quota_hard;
1149 uint64_t quota_flags;
1156 /* SMBdskattr interface */
1158 enum smb_fsinfo_level level;
1161 uint16_t units_total;
1162 uint16_t blocks_per_unit;
1163 uint16_t block_size;
1164 uint16_t units_free;
1168 /* trans2 RAW_QFS_ALLOCATION interface */
1170 enum smb_fsinfo_level level;
1174 uint32_t sectors_per_unit;
1175 uint32_t total_alloc_units;
1176 uint32_t avail_alloc_units;
1177 uint16_t bytes_per_sector;
1181 /* TRANS2 RAW_QFS_VOLUME interface */
1183 enum smb_fsinfo_level level;
1186 uint32_t serial_number;
1187 struct smb_wire_string volume_name;
1191 /* TRANS2 RAW_QFS_VOLUME_INFO and RAW_QFS_VOLUME_INFORMATION interfaces */
1193 enum smb_fsinfo_level level;
1194 struct smb2_handle handle; /* only for smb2 */
1198 uint32_t serial_number;
1199 struct smb_wire_string volume_name;
1203 /* trans2 RAW_QFS_SIZE_INFO and RAW_QFS_SIZE_INFORMATION interfaces */
1205 enum smb_fsinfo_level level;
1206 struct smb2_handle handle; /* only for smb2 */
1209 uint64_t total_alloc_units;
1210 uint64_t avail_alloc_units; /* maps to call_avail_alloc_units */
1211 uint32_t sectors_per_unit;
1212 uint32_t bytes_per_sector;
1216 /* TRANS2 RAW_QFS_DEVICE_INFO and RAW_QFS_DEVICE_INFORMATION interfaces */
1218 enum smb_fsinfo_level level;
1219 struct smb2_handle handle; /* only for smb2 */
1222 uint32_t device_type;
1223 uint32_t characteristics;
1228 /* TRANS2 RAW_QFS_ATTRIBUTE_INFO and RAW_QFS_ATTRIBUTE_INFORMATION interfaces */
1230 enum smb_fsinfo_level level;
1231 struct smb2_handle handle; /* only for smb2 */
1235 uint32_t max_file_component_length;
1236 struct smb_wire_string fs_type;
1241 /* TRANS2 RAW_QFS_UNIX_INFO interface */
1243 enum smb_fsinfo_level level;
1246 uint16_t major_version;
1247 uint16_t minor_version;
1248 uint64_t capability;
1252 /* trans2 RAW_QFS_QUOTA_INFORMATION interface */
1254 enum smb_fsinfo_level level;
1255 struct smb2_handle handle; /* only for smb2 */
1258 uint64_t unknown[3];
1259 uint64_t quota_soft;
1260 uint64_t quota_hard;
1261 uint64_t quota_flags;
1263 } quota_information;
1265 /* trans2 RAW_QFS_FULL_SIZE_INFORMATION interface */
1267 enum smb_fsinfo_level level;
1268 struct smb2_handle handle; /* only for smb2 */
1271 uint64_t total_alloc_units;
1272 uint64_t call_avail_alloc_units;
1273 uint64_t actual_avail_alloc_units;
1274 uint32_t sectors_per_unit;
1275 uint32_t bytes_per_sector;
1277 } full_size_information;
1279 /* trans2 RAW_QFS_OBJECTID_INFORMATION interface */
1281 enum smb_fsinfo_level level;
1282 struct smb2_handle handle; /* only for smb2 */
1286 uint64_t unknown[6];
1288 } objectid_information;
1293 enum smb_open_level {
1302 RAW_OPEN_NTTRANS_CREATE,
1303 RAW_OPEN_OPENX_READX,
1307 /* the generic interface is defined to be equal to the NTCREATEX interface */
1308 #define RAW_OPEN_GENERIC RAW_OPEN_NTCREATEX
1310 /* union for open() backend call */
1313 * because the *.out.file structs are not aligned to the same offset for each level
1314 * we provide a hepler macro that should be used to find the current smb_handle structure
1316 #define SMB_OPEN_OUT_FILE(op, file) do { \
1317 switch (op->generic.level) { \
1318 case RAW_OPEN_OPEN: \
1319 file = &op->openold.out.file; \
1321 case RAW_OPEN_OPENX: \
1322 file = &op->openx.out.file; \
1324 case RAW_OPEN_MKNEW: \
1325 file = &op->mknew.out.file; \
1327 case RAW_OPEN_CREATE: \
1328 file = &op->create.out.file; \
1330 case RAW_OPEN_CTEMP: \
1331 file = &op->ctemp.out.file; \
1333 case RAW_OPEN_SPLOPEN: \
1334 file = &op->splopen.out.file; \
1336 case RAW_OPEN_NTCREATEX: \
1337 file = &op->ntcreatex.out.file; \
1339 case RAW_OPEN_T2OPEN: \
1340 file = &op->t2open.out.file; \
1342 case RAW_OPEN_NTTRANS_CREATE: \
1343 file = &op->nttrans.out.file; \
1345 case RAW_OPEN_OPENX_READX: \
1346 file = &op->openxreadx.out.file; \
1348 case RAW_OPEN_SMB2: \
1349 file = &op->smb2.out.file; \
1352 /* this must be a programmer error */ \
1357 /* SMBNTCreateX, nttrans and generic interface */
1359 enum smb_open_level level;
1363 uint32_t access_mask;
1364 uint64_t alloc_size;
1366 uint32_t share_access;
1367 uint32_t open_disposition;
1368 uint32_t create_options;
1369 uint32_t impersonation;
1370 uint8_t security_flags;
1371 /* NOTE: fname can also be a pointer to a
1372 uint64_t file_id if create_options has the
1373 NTCREATEX_OPTIONS_OPEN_BY_FILE_ID flag set */
1376 /* these last 2 elements are only used in the
1377 NTTRANS varient of the call */
1378 struct security_descriptor *sec_desc;
1379 struct smb_ea_list *ea_list;
1381 /* some optional parameters from the SMB2 varient */
1382 bool query_maximal_access;
1385 union smb_handle file;
1386 uint8_t oplock_level;
1387 uint32_t create_action;
1393 uint64_t alloc_size;
1397 uint8_t is_directory;
1399 /* optional return values matching SMB2 tagged
1400 values in the call */
1401 uint32_t maximal_access;
1403 } ntcreatex, nttrans, generic;
1405 /* TRANS2_OPEN interface */
1407 enum smb_open_level level;
1411 uint16_t search_attrs;
1412 uint16_t file_attrs;
1419 struct ea_struct *eas;
1422 union smb_handle file;
1434 /* SMBopen interface */
1436 enum smb_open_level level;
1439 uint16_t search_attrs;
1443 union smb_handle file;
1451 /* SMBopenX interface */
1453 enum smb_open_level level;
1457 uint16_t search_attrs; /* not honoured by win2003 */
1458 uint16_t file_attrs;
1459 time_t write_time; /* not honoured by win2003 */
1461 uint32_t size; /* note that this sets the
1462 initial file size, not
1463 just allocation size */
1464 uint32_t timeout; /* not honoured by win2003 */
1468 union smb_handle file;
1476 uint32_t unique_fid;
1477 uint32_t access_mask;
1482 /* SMBmknew interface */
1484 enum smb_open_level level;
1491 union smb_handle file;
1495 /* SMBctemp interface */
1497 enum smb_open_level level;
1501 const char *directory;
1504 union smb_handle file;
1505 /* temp name, relative to directory */
1510 /* SMBsplopen interface */
1512 enum smb_open_level level;
1514 uint16_t setup_length;
1519 union smb_handle file;
1524 /* chained OpenX/ReadX interface */
1526 enum smb_open_level level;
1530 uint16_t search_attrs; /* not honoured by win2003 */
1531 uint16_t file_attrs;
1532 time_t write_time; /* not honoured by win2003 */
1534 uint32_t size; /* note that this sets the
1535 initial file size, not
1536 just allocation size */
1537 uint32_t timeout; /* not honoured by win2003 */
1547 union smb_handle file;
1555 uint32_t unique_fid;
1556 uint32_t access_mask;
1562 uint16_t compaction_mode;
1567 #define SMB2_CREATE_FLAG_REQUEST_OPLOCK 0x0100
1568 #define SMB2_CREATE_FLAG_REQUEST_EXCLUSIVE_OPLOCK 0x0800
1569 #define SMB2_CREATE_FLAG_GRANT_OPLOCK 0x0001
1570 #define SMB2_CREATE_FLAG_GRANT_EXCLUSIVE_OPLOCK 0x0080
1573 struct smb2_create {
1574 enum smb_open_level level;
1576 /* static body buffer 56 (0x38) bytes */
1577 uint8_t security_flags; /* SMB2_SECURITY_* */
1578 uint8_t oplock_level; /* SMB2_OPLOCK_LEVEL_* */
1579 uint32_t impersonation_level; /* SMB2_IMPERSONATION_* */
1580 uint64_t create_flags;
1582 uint32_t desired_access;
1583 uint32_t file_attributes;
1584 uint32_t share_access; /* NTCREATEX_SHARE_ACCESS_* */
1585 uint32_t create_disposition; /* NTCREATEX_DISP_* */
1586 uint32_t create_options; /* NTCREATEX_OPTIONS_* */
1588 /* uint16_t fname_ofs */
1589 /* uint16_t fname_size */
1590 /* uint32_t blob_ofs; */
1591 /* uint32_t blob_size; */
1596 /* now some optional parameters - encoded as tagged blobs */
1597 struct smb_ea_list eas;
1598 uint64_t alloc_size;
1599 struct security_descriptor *sec_desc;
1601 struct smb2_handle *durable_handle;
1602 bool query_maximal_access;
1604 bool query_on_disk_id;
1606 /* and any additional blobs the caller wants */
1607 struct smb2_create_blobs {
1609 struct smb2_create_blob {
1616 union smb_handle file;
1618 /* static body buffer 88 (0x58) bytes */
1619 /* uint16_t buffer_code; 0x59 = 0x58 + 1 */
1620 uint8_t oplock_level;
1622 uint32_t create_action;
1627 uint64_t alloc_size;
1631 /* struct smb2_handle handle;*/
1632 /* uint32_t blob_ofs; */
1633 /* uint32_t blob_size; */
1635 /* optional return values matching tagged values in the call */
1636 uint32_t maximal_access;
1637 uint8_t on_disk_id[32];
1639 /* tagged blobs in the reply */
1640 struct smb2_create_blobs blobs;
1647 enum smb_read_level {
1655 #define RAW_READ_GENERIC RAW_READ_READX
1657 /* union for read() backend call
1659 note that .infoX.out.data will be allocated before the backend is
1660 called. It will be big enough to hold the maximum size asked for
1663 /* SMBreadX (and generic) interface */
1665 enum smb_read_level level;
1667 union smb_handle file;
1669 uint32_t mincnt; /* enforced on SMB2, 16 bit on SMB */
1672 bool read_for_execute;
1677 uint16_t compaction_mode;
1682 /* SMBreadbraw interface */
1684 enum smb_read_level level;
1686 union smb_handle file;
1699 /* SMBlockandread interface */
1701 enum smb_read_level level;
1703 union smb_handle file;
1714 /* SMBread interface */
1716 enum smb_read_level level;
1718 union smb_handle file;
1731 enum smb_read_level level;
1733 union smb_handle file;
1735 /* static body buffer 48 (0x30) bytes */
1736 /* uint16_t buffer_code; 0x31 = 0x30 + 1 */
1741 /* struct smb2_handle handle; */
1745 /* the docs give no indication of what
1746 these channel variables are for */
1747 uint16_t channel_offset;
1748 uint16_t channel_length;
1751 /* static body buffer 16 (0x10) bytes */
1752 /* uint16_t buffer_code; 0x11 = 0x10 + 1 */
1753 /* uint8_t data_ofs; */
1754 /* uint8_t reserved; */
1755 /* uint32_t data_size; */
1766 enum smb_write_level {
1767 RAW_WRITE_WRITEUNLOCK,
1770 RAW_WRITE_WRITECLOSE,
1775 #define RAW_WRITE_GENERIC RAW_WRITE_WRITEX
1777 /* union for write() backend call
1780 /* SMBwriteX interface */
1782 enum smb_write_level level;
1784 union smb_handle file;
1789 const uint8_t *data;
1797 /* SMBwriteunlock interface */
1799 enum smb_write_level level;
1801 union smb_handle file;
1805 const uint8_t *data;
1812 /* SMBwrite interface */
1814 enum smb_write_level level;
1816 union smb_handle file;
1820 const uint8_t *data;
1827 /* SMBwriteclose interface */
1829 enum smb_write_level level;
1831 union smb_handle file;
1835 const uint8_t *data;
1842 /* SMBsplwrite interface */
1844 enum smb_write_level level;
1846 union smb_handle file;
1848 const uint8_t *data;
1854 enum smb_write_level level;
1856 union smb_handle file;
1858 /* static body buffer 48 (0x30) bytes */
1859 /* uint16_t buffer_code; 0x31 = 0x30 + 1 */
1860 /* uint16_t data_ofs; */
1861 /* uint32_t data_size; */
1863 /* struct smb2_handle handle; */
1864 uint64_t unknown1; /* 0xFFFFFFFFFFFFFFFF */
1865 uint64_t unknown2; /* 0xFFFFFFFFFFFFFFFF */
1871 /* static body buffer 17 (0x11) bytes */
1872 /* uint16_t buffer_code; 0x11 = 0x10 + 1*/
1875 uint64_t unknown1; /* 0x0000000000000000 */
1881 enum smb_lock_level {
1889 #define RAW_LOCK_GENERIC RAW_LOCK_LOCKX
1891 /* union for lock() backend call
1894 /* SMBlockingX and generic interface */
1896 enum smb_lock_level level;
1898 union smb_handle file;
1903 struct smb_lock_entry {
1907 } *locks; /* unlocks are first in the arrray */
1911 /* SMBlock and SMBunlock interface */
1913 enum smb_lock_level level;
1915 union smb_handle file;
1923 enum smb_lock_level level;
1925 union smb_handle file;
1927 /* static body buffer 48 (0x30) bytes */
1928 /* uint16_t buffer_code; 0x30 */
1929 uint16_t lock_count;
1931 /* struct smb2_handle handle; */
1932 struct smb2_lock_element {
1935 /* these flags are the same as the SMB2 lock flags */
1936 #define SMB2_LOCK_FLAG_NONE 0x00000000
1937 #define SMB2_LOCK_FLAG_SHARED 0x00000001
1938 #define SMB2_LOCK_FLAG_EXCLUSIVE 0x00000002
1939 #define SMB2_LOCK_FLAG_UNLOCK 0x00000004
1940 #define SMB2_LOCK_FLAG_FAIL_IMMEDIATELY 0x00000010
1941 #define SMB2_LOCK_FLAG_ALL_MASK 0x00000017
1947 /* static body buffer 4 (0x04) bytes */
1948 /* uint16_t buffer_code; 0x04 */
1955 enum smb_lock_level level;
1957 union smb_handle file;
1959 /* static body buffer 24 (0x18) bytes */
1960 uint8_t oplock_level;
1963 /* struct smb2_handle handle; */
1969 enum smb_close_level {
1977 union for close() backend call
1980 /* generic interface */
1982 enum smb_close_level level;
1984 union smb_handle file;
1986 #define SMB2_CLOSE_FLAGS_FULL_INFORMATION (1<<0)
1987 uint16_t flags; /* SMB2_CLOSE_FLAGS_* */
1995 uint64_t alloc_size;
2001 /* SMBclose interface */
2003 enum smb_close_level level;
2005 union smb_handle file;
2010 /* SMBsplclose interface - empty! */
2012 enum smb_close_level level;
2014 union smb_handle file;
2020 enum smb_close_level level;
2022 union smb_handle file;
2024 /* static body buffer 24 (0x18) bytes */
2025 /* uint16_t buffer_code; 0x18 */
2026 uint16_t flags; /* SMB2_CLOSE_FLAGS_* */
2030 /* static body buffer 60 (0x3C) bytes */
2031 /* uint16_t buffer_code; 0x3C */
2038 uint64_t alloc_size;
2046 enum smb_lpq_level {RAW_LPQ_GENERIC, RAW_LPQ_RETQ};
2049 union for lpq() backend
2052 /* generic interface */
2054 enum smb_lpq_level level;
2059 /* SMBsplretq interface */
2061 enum smb_lpq_level level;
2069 uint16_t restart_idx;
2081 enum smb_ioctl_level {
2085 RAW_IOCTL_SMB2_NO_HANDLE
2089 union for ioctl() backend
2092 /* generic interface */
2094 enum smb_ioctl_level level;
2096 union smb_handle file;
2100 /* struct for SMBioctl */
2102 enum smb_ioctl_level level;
2104 union smb_handle file;
2113 /* struct for NT ioctl call */
2115 enum smb_ioctl_level level;
2117 union smb_handle file;
2131 enum smb_ioctl_level level;
2133 union smb_handle file;
2135 /* static body buffer 56 (0x38) bytes */
2136 /* uint16_t buffer_code; 0x39 = 0x38 + 1 */
2139 /*struct smb2_handle handle;*/
2140 /* uint32_t out_ofs; */
2141 /* uint32_t out_size; */
2143 /* uint32_t in_ofs; */
2144 /* uint32_t in_size; */
2145 uint32_t max_response_size;
2153 union smb_handle file;
2155 /* static body buffer 48 (0x30) bytes */
2156 /* uint16_t buffer_code; 0x31 = 0x30 + 1 */
2159 /* struct smb2_handle handle; */
2160 /* uint32_t in_ofs; */
2161 /* uint32_t in_size; */
2162 /* uint32_t out_ofs; */
2163 /* uint32_t out_size; */
2174 enum smb_flush_level {
2181 /* struct for SMBflush */
2183 enum smb_flush_level level;
2185 union smb_handle file;
2189 /* SMBflush with 0xFFFF wildcard fnum */
2191 enum smb_flush_level level;
2196 enum smb_flush_level level;
2198 union smb_handle file;
2208 /* struct for SMBcopy */
2223 /* struct for transact/transact2 call */
2231 uint8_t setup_count;
2233 const char *trans_name; /* SMBtrans only */
2239 uint8_t setup_count;
2246 /* struct for nttransact2 call */
2247 struct smb_nttrans {
2252 uint32_t setup_count;
2260 uint8_t setup_count; /* in units of 16 bit words */
2267 enum smb_notify_level {
2273 /* struct for nttrans change notify call */
2275 enum smb_notify_level level;
2278 union smb_handle file;
2279 uint32_t buffer_size;
2280 uint32_t completion_filter;
2285 uint32_t num_changes;
2286 struct notify_changes {
2288 struct smb_wire_string name;
2293 struct smb2_notify {
2294 enum smb_notify_level level;
2297 union smb_handle file;
2298 /* static body buffer 32 (0x20) bytes */
2299 /* uint16_t buffer_code; 0x32 */
2301 uint32_t buffer_size;
2302 /*struct smb2_handle file;*/
2303 uint32_t completion_filter;
2308 /* static body buffer 8 (0x08) bytes */
2309 /* uint16_t buffer_code; 0x09 = 0x08 + 1 */
2310 /* uint16_t blob_ofs; */
2311 /* uint16_t blob_size; */
2316 /* DATA_BLOB content */
2317 uint32_t num_changes;
2318 struct notify_changes *changes;
2323 enum smb_search_level {
2324 RAW_SEARCH_SEARCH, /* SMBsearch */
2325 RAW_SEARCH_FFIRST, /* SMBffirst */
2326 RAW_SEARCH_FUNIQUE, /* SMBfunique */
2327 RAW_SEARCH_TRANS2, /* SMBtrans2 */
2328 RAW_SEARCH_SMB2 /* SMB2 Find */
2331 enum smb_search_data_level {
2332 RAW_SEARCH_DATA_GENERIC = 0x10000, /* only used in the smbcli_ code */
2333 RAW_SEARCH_DATA_SEARCH,
2334 RAW_SEARCH_DATA_STANDARD = SMB_FIND_STANDARD,
2335 RAW_SEARCH_DATA_EA_SIZE = SMB_FIND_EA_SIZE,
2336 RAW_SEARCH_DATA_EA_LIST = SMB_FIND_EA_LIST,
2337 RAW_SEARCH_DATA_DIRECTORY_INFO = SMB_FIND_DIRECTORY_INFO,
2338 RAW_SEARCH_DATA_FULL_DIRECTORY_INFO = SMB_FIND_FULL_DIRECTORY_INFO,
2339 RAW_SEARCH_DATA_NAME_INFO = SMB_FIND_NAME_INFO,
2340 RAW_SEARCH_DATA_BOTH_DIRECTORY_INFO = SMB_FIND_BOTH_DIRECTORY_INFO,
2341 RAW_SEARCH_DATA_ID_FULL_DIRECTORY_INFO = SMB_FIND_ID_FULL_DIRECTORY_INFO,
2342 RAW_SEARCH_DATA_ID_BOTH_DIRECTORY_INFO = SMB_FIND_ID_BOTH_DIRECTORY_INFO,
2343 RAW_SEARCH_DATA_UNIX_INFO = SMB_FIND_UNIX_INFO,
2344 RAW_SEARCH_DATA_UNIX_INFO2 = SMB_FIND_UNIX_INFO2
2347 /* union for file search */
2348 union smb_search_first {
2350 enum smb_search_level level;
2351 enum smb_search_data_level data_level;
2354 /* search (old) findfirst interface.
2355 Also used for ffirst and funique. */
2357 enum smb_search_level level;
2358 enum smb_search_data_level data_level;
2362 uint16_t search_attrib;
2363 const char *pattern;
2370 /* trans2 findfirst interface */
2372 enum smb_search_level level;
2373 enum smb_search_data_level data_level;
2376 uint16_t search_attrib;
2379 uint32_t storage_type;
2380 const char *pattern;
2382 /* the ea names are only used for RAW_SEARCH_EA_LIST */
2384 struct ea_name *ea_names;
2389 uint16_t end_of_search;
2394 SMB2 uses different level numbers for the same old SMB trans2 search levels
2396 #define SMB2_FIND_DIRECTORY_INFO 0x01
2397 #define SMB2_FIND_FULL_DIRECTORY_INFO 0x02
2398 #define SMB2_FIND_BOTH_DIRECTORY_INFO 0x03
2399 #define SMB2_FIND_NAME_INFO 0x0C
2400 #define SMB2_FIND_ID_BOTH_DIRECTORY_INFO 0x25
2401 #define SMB2_FIND_ID_FULL_DIRECTORY_INFO 0x26
2403 /* flags for SMB2 find */
2404 #define SMB2_CONTINUE_FLAG_RESTART 0x01
2405 #define SMB2_CONTINUE_FLAG_SINGLE 0x02
2406 #define SMB2_CONTINUE_FLAG_INDEX 0x04
2407 #define SMB2_CONTINUE_FLAG_REOPEN 0x10
2411 enum smb_search_level level;
2412 enum smb_search_data_level data_level;
2414 union smb_handle file;
2416 /* static body buffer 32 (0x20) bytes */
2417 /* uint16_t buffer_code; 0x21 = 0x20 + 1 */
2419 uint8_t continue_flags; /* SMB2_CONTINUE_FLAG_* */
2420 uint32_t file_index;
2421 /* struct smb2_handle handle; */
2422 /* uint16_t pattern_ofs; */
2423 /* uint16_t pattern_size; */
2424 uint32_t max_response_size;
2427 const char *pattern;
2430 /* static body buffer 8 (0x08) bytes */
2431 /* uint16_t buffer_code; 0x08 */
2432 /* uint16_t blob_ofs; */
2433 /* uint32_t blob_size; */
2441 /* union for file search continue */
2442 union smb_search_next {
2444 enum smb_search_level level;
2445 enum smb_search_data_level data_level;
2448 /* search (old) findnext interface. Also used
2449 for ffirst when continuing */
2451 enum smb_search_level level;
2452 enum smb_search_data_level data_level;
2456 uint16_t search_attrib;
2457 struct smb_search_id {
2461 uint32_t server_cookie;
2462 uint32_t client_cookie;
2470 /* trans2 findnext interface */
2472 enum smb_search_level level;
2473 enum smb_search_data_level data_level;
2478 uint32_t resume_key;
2480 const char *last_name;
2482 /* the ea names are only used for RAW_SEARCH_EA_LIST */
2484 struct ea_name *ea_names;
2488 uint16_t end_of_search;
2493 struct smb2_find smb2;
2496 /* union for search reply file data */
2497 union smb_search_data {
2499 * search (old) findfirst
2500 * RAW_SEARCH_DATA_SEARCH
2506 struct smb_search_id id;
2510 /* trans2 findfirst RAW_SEARCH_DATA_STANDARD level */
2512 uint32_t resume_key;
2517 uint32_t alloc_size;
2519 struct smb_wire_string name;
2522 /* trans2 findfirst RAW_SEARCH_DATA_EA_SIZE level */
2524 uint32_t resume_key;
2529 uint32_t alloc_size;
2532 struct smb_wire_string name;
2535 /* trans2 findfirst RAW_SEARCH_DATA_EA_LIST level */
2537 uint32_t resume_key;
2542 uint32_t alloc_size;
2544 struct smb_ea_list eas;
2545 struct smb_wire_string name;
2548 /* RAW_SEARCH_DATA_DIRECTORY_INFO interface */
2550 uint32_t file_index;
2556 uint64_t alloc_size;
2558 struct smb_wire_string name;
2561 /* RAW_SEARCH_DATA_FULL_DIRECTORY_INFO interface */
2563 uint32_t file_index;
2569 uint64_t alloc_size;
2572 struct smb_wire_string name;
2573 } full_directory_info;
2575 /* RAW_SEARCH_DATA_NAME_INFO interface */
2577 uint32_t file_index;
2578 struct smb_wire_string name;
2581 /* RAW_SEARCH_DATA_BOTH_DIRECTORY_INFO interface */
2583 uint32_t file_index;
2589 uint64_t alloc_size;
2592 struct smb_wire_string short_name;
2593 struct smb_wire_string name;
2594 } both_directory_info;
2596 /* RAW_SEARCH_DATA_ID_FULL_DIRECTORY_INFO interface */
2598 uint32_t file_index;
2604 uint64_t alloc_size;
2608 struct smb_wire_string name;
2609 } id_full_directory_info;
2611 /* RAW_SEARCH_DATA_ID_BOTH_DIRECTORY_INFO interface */
2613 uint32_t file_index;
2619 uint64_t alloc_size;
2623 struct smb_wire_string short_name;
2624 struct smb_wire_string name;
2625 } id_both_directory_info;
2627 /* RAW_SEARCH_DATA_UNIX_INFO interface */
2629 uint32_t file_index;
2631 uint64_t alloc_size;
2632 NTTIME status_change_time;
2641 uint64_t permissions;
2646 /* RAW_SEARCH_DATA_UNIX_INFO2 interface */
2648 uint32_t file_index;
2649 uint64_t end_of_file;
2651 NTTIME status_change_time;
2660 uint64_t permissions;
2663 uint32_t file_flags;
2664 uint32_t flags_mask;
2665 struct smb_wire_string name;
2669 /* Callback function passed to the raw search interface. */
2670 typedef bool (*smbcli_search_callback)(void *private, const union smb_search_data *file);
2672 enum smb_search_close_level {RAW_FINDCLOSE_GENERIC, RAW_FINDCLOSE_FCLOSE, RAW_FINDCLOSE_FINDCLOSE};
2674 /* union for file search close */
2675 union smb_search_close {
2677 enum smb_search_close_level level;
2680 /* SMBfclose (old search) interface */
2682 enum smb_search_close_level level;
2685 /* max_count and search_attrib are not used, but are present */
2687 uint16_t search_attrib;
2688 struct smb_search_id id;
2692 /* SMBfindclose interface */
2694 enum smb_search_close_level level;
2704 struct for SMBecho call
2708 uint16_t repeat_count;
2714 uint16_t sequence_number;
2721 struct for shadow copy volumes
2723 struct smb_shadow_copy {
2725 union smb_handle file;
2729 uint32_t num_volumes;
2735 #endif /* __LIBCLI_RAW_INTERFACES_H__ */