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.
22 #ifndef __LIBCLI_RAW_INTERFACES_H__
23 #define __LIBCLI_RAW_INTERFACES_H__
27 /* this structure is just a wrapper for a string, the only reason we
28 bother with this is that it allows us to check the length provided
29 on the wire in testsuite test code to ensure that we are
30 terminating names in the same way that win2003 is. The *ONLY* time
31 you should ever look at the 'private_length' field in this
32 structure is inside compliance test code, in all other cases just
33 use the null terminated char* as the definitive definition of the
36 also note that this structure is only used in packets where there
37 is an explicit length provided on the wire (hence the name). That
38 length is placed in 'private_length'. For packets where the length
39 is always determined by NULL or packet termination a normal char*
40 is used in the structure definition.
42 struct smb_wire_string {
43 uint32_t private_length;
48 * SMB2 uses a 16Byte handle,
49 * (we can maybe use struct GUID later)
56 * a generic container for file handles or file pathes
57 * for qfileinfo/setfileinfo and qpathinfo/setpathinfo
59 union smb_handle_or_path {
62 * the qpathinfo and setpathinfo
67 * this is used as file handle in SMB
72 * this is used as file handle in SMB2
74 struct smb2_handle handle;
78 a generic container for file handles
83 * the qpathinfo and setpathinfo
88 * this is used as file handle in SMB
93 * this is used as file handle in SMB2
95 struct smb2_handle handle;
99 this header defines the structures and unions used between the SMB
100 parser and the backends.
103 /* struct used for SMBlseek call */
107 union smb_handle file;
109 int32_t offset; /* signed */
117 /* struct used in unlink() call */
128 /* struct used in chkpath() call */
137 enum smb_mkdir_level {RAW_MKDIR_GENERIC, RAW_MKDIR_MKDIR, RAW_MKDIR_T2MKDIR};
139 /* union used in mkdir() call */
143 enum smb_mkdir_level level;
147 enum smb_mkdir_level level;
154 enum smb_mkdir_level level;
158 struct ea_struct *eas;
163 /* struct used in rmdir() call */
170 /* struct used in rename() call */
171 enum smb_rename_level {RAW_RENAME_RENAME, RAW_RENAME_NTRENAME};
175 enum smb_rename_level level;
178 /* SMBrename interface */
180 enum smb_rename_level level;
183 const char *pattern1;
184 const char *pattern2;
190 /* SMBntrename interface */
192 enum smb_rename_level level;
196 uint16_t flags; /* see RENAME_FLAG_* */
197 uint32_t cluster_size;
198 const char *old_name;
199 const char *new_name;
204 enum smb_tcon_level {RAW_TCON_TCON, RAW_TCON_TCONX};
206 /* union used in tree connect call */
208 /* generic interface */
210 enum smb_tcon_level level;
213 /* SMBtcon interface */
215 enum smb_tcon_level level;
219 const char *password;
228 /* SMBtconX interface */
230 enum smb_tcon_level level;
248 enum smb_sesssetup_level {RAW_SESSSETUP_OLD, RAW_SESSSETUP_NT1, RAW_SESSSETUP_SPNEGO};
250 /* union used in session_setup call */
251 union smb_sesssetup {
252 /* the pre-NT1 interface */
254 enum smb_sesssetup_level level;
276 /* the NT1 interface */
278 enum smb_sesssetup_level level;
285 uint32_t capabilities;
303 /* the SPNEGO interface */
305 enum smb_sesssetup_level level;
312 uint32_t capabilities;
316 const char *workgroup;
329 /* Note that the specified enum values are identical to the actual info-levels used
332 enum smb_fileinfo_level {
333 RAW_FILEINFO_GENERIC = 0xF000,
334 RAW_FILEINFO_GETATTR, /* SMBgetatr */
335 RAW_FILEINFO_GETATTRE, /* SMBgetattrE */
336 RAW_FILEINFO_SEC_DESC, /* NT_TRANSACT_QUERY_SECURITY_DESC */
337 RAW_FILEINFO_STANDARD = SMB_QFILEINFO_STANDARD,
338 RAW_FILEINFO_EA_SIZE = SMB_QFILEINFO_EA_SIZE,
339 RAW_FILEINFO_EA_LIST = SMB_QFILEINFO_EA_LIST,
340 RAW_FILEINFO_ALL_EAS = SMB_QFILEINFO_ALL_EAS,
341 RAW_FILEINFO_IS_NAME_VALID = SMB_QFILEINFO_IS_NAME_VALID,
342 RAW_FILEINFO_BASIC_INFO = SMB_QFILEINFO_BASIC_INFO,
343 RAW_FILEINFO_STANDARD_INFO = SMB_QFILEINFO_STANDARD_INFO,
344 RAW_FILEINFO_EA_INFO = SMB_QFILEINFO_EA_INFO,
345 RAW_FILEINFO_NAME_INFO = SMB_QFILEINFO_NAME_INFO,
346 RAW_FILEINFO_ALL_INFO = SMB_QFILEINFO_ALL_INFO,
347 RAW_FILEINFO_ALT_NAME_INFO = SMB_QFILEINFO_ALT_NAME_INFO,
348 RAW_FILEINFO_STREAM_INFO = SMB_QFILEINFO_STREAM_INFO,
349 RAW_FILEINFO_COMPRESSION_INFO = SMB_QFILEINFO_COMPRESSION_INFO,
350 RAW_FILEINFO_UNIX_BASIC = SMB_QFILEINFO_UNIX_BASIC,
351 RAW_FILEINFO_UNIX_LINK = SMB_QFILEINFO_UNIX_LINK,
352 RAW_FILEINFO_BASIC_INFORMATION = SMB_QFILEINFO_BASIC_INFORMATION,
353 RAW_FILEINFO_STANDARD_INFORMATION = SMB_QFILEINFO_STANDARD_INFORMATION,
354 RAW_FILEINFO_INTERNAL_INFORMATION = SMB_QFILEINFO_INTERNAL_INFORMATION,
355 RAW_FILEINFO_EA_INFORMATION = SMB_QFILEINFO_EA_INFORMATION,
356 RAW_FILEINFO_ACCESS_INFORMATION = SMB_QFILEINFO_ACCESS_INFORMATION,
357 RAW_FILEINFO_NAME_INFORMATION = SMB_QFILEINFO_NAME_INFORMATION,
358 RAW_FILEINFO_POSITION_INFORMATION = SMB_QFILEINFO_POSITION_INFORMATION,
359 RAW_FILEINFO_MODE_INFORMATION = SMB_QFILEINFO_MODE_INFORMATION,
360 RAW_FILEINFO_ALIGNMENT_INFORMATION = SMB_QFILEINFO_ALIGNMENT_INFORMATION,
361 RAW_FILEINFO_ALL_INFORMATION = SMB_QFILEINFO_ALL_INFORMATION,
362 RAW_FILEINFO_ALT_NAME_INFORMATION = SMB_QFILEINFO_ALT_NAME_INFORMATION,
363 RAW_FILEINFO_STREAM_INFORMATION = SMB_QFILEINFO_STREAM_INFORMATION,
364 RAW_FILEINFO_COMPRESSION_INFORMATION = SMB_QFILEINFO_COMPRESSION_INFORMATION,
365 RAW_FILEINFO_NETWORK_OPEN_INFORMATION = SMB_QFILEINFO_NETWORK_OPEN_INFORMATION,
366 RAW_FILEINFO_ATTRIBUTE_TAG_INFORMATION = SMB_QFILEINFO_ATTRIBUTE_TAG_INFORMATION,
367 /* SMB2 specific levels */
368 RAW_FILEINFO_SMB2_ALL_EAS = 0x0f01,
369 RAW_FILEINFO_SMB2_ALL_INFORMATION = 0x1201
372 /* union used in qfileinfo() and qpathinfo() backend calls */
374 /* generic interface:
375 * matches RAW_FILEINFO_GENERIC */
377 enum smb_fileinfo_level level;
379 union smb_handle_or_path file;
387 struct smb_wire_string name;
397 struct smb_wire_string fname;
398 struct smb_wire_string alt_fname;
399 uint8_t delete_pending;
401 uint64_t compressed_size;
405 uint8_t cluster_shift;
407 uint32_t access_flags; /* seen 0x001f01ff from w2k3 */
410 uint32_t alignment_requirement;
411 uint32_t reparse_tag;
413 struct stream_struct {
416 struct smb_wire_string stream_name;
422 /* SMBgetatr interface:
423 * matches RAW_FILEINFO_GETATTR */
425 enum smb_fileinfo_level level;
427 union smb_handle_or_path file;
436 /* SMBgetattrE and RAW_FILEINFO_STANDARD interface */
438 enum smb_fileinfo_level level;
440 union smb_handle_or_path file;
450 } getattre, standard;
452 /* trans2 RAW_FILEINFO_EA_SIZE interface */
454 enum smb_fileinfo_level level;
456 union smb_handle_or_path file;
469 /* trans2 RAW_FILEINFO_EA_LIST interface */
471 enum smb_fileinfo_level level;
473 union smb_handle_or_path file;
476 struct smb_wire_string name;
482 struct ea_struct *eas;
486 /* trans2 RAW_FILEINFO_ALL_EAS and RAW_FILEINFO_FULL_EA_INFORMATION interfaces */
488 enum smb_fileinfo_level level;
490 union smb_handle_or_path file;
491 /* SMB2 only - SMB2_CONTINUE_FLAG_* */
492 uint8_t continue_flags;
494 struct smb_ea_list out;
497 /* trans2 qpathinfo RAW_FILEINFO_IS_NAME_VALID interface
498 only valid for a QPATHNAME call - no returned data */
500 enum smb_fileinfo_level level;
502 union smb_handle_or_path file;
506 /* RAW_FILEINFO_BASIC_INFO and RAW_FILEINFO_BASIC_INFORMATION interfaces */
508 enum smb_fileinfo_level level;
510 union smb_handle_or_path file;
522 /* RAW_FILEINFO_STANDARD_INFO and RAW_FILEINFO_STANDARD_INFORMATION interfaces */
524 enum smb_fileinfo_level level;
526 union smb_handle_or_path file;
537 /* RAW_FILEINFO_EA_INFO and RAW_FILEINFO_EA_INFORMATION interfaces */
539 enum smb_fileinfo_level level;
541 union smb_handle_or_path file;
548 /* RAW_FILEINFO_NAME_INFO and RAW_FILEINFO_NAME_INFORMATION interfaces */
550 enum smb_fileinfo_level level;
552 union smb_handle_or_path file;
555 struct smb_wire_string fname;
559 /* RAW_FILEINFO_ALL_INFO and RAW_FILEINFO_ALL_INFORMATION interfaces */
561 enum smb_fileinfo_level level;
563 union smb_handle_or_path file;
574 uint8_t delete_pending;
577 struct smb_wire_string fname;
581 /* RAW_FILEINFO_SMB2_ALL_INFORMATION interface */
583 enum smb_fileinfo_level level;
585 union smb_handle_or_path file;
597 uint8_t delete_pending;
602 uint32_t access_mask;
605 struct smb_wire_string fname;
609 /* RAW_FILEINFO_ALT_NAME_INFO and RAW_FILEINFO_ALT_NAME_INFORMATION interfaces */
611 enum smb_fileinfo_level level;
613 union smb_handle_or_path file;
616 struct smb_wire_string fname;
620 /* RAW_FILEINFO_STREAM_INFO and RAW_FILEINFO_STREAM_INFORMATION interfaces */
622 enum smb_fileinfo_level level;
624 union smb_handle_or_path file;
626 struct stream_information {
628 struct stream_struct *streams;
632 /* RAW_FILEINFO_COMPRESSION_INFO and RAW_FILEINFO_COMPRESSION_INFORMATION interfaces */
634 enum smb_fileinfo_level level;
636 union smb_handle_or_path file;
639 uint64_t compressed_size;
643 uint8_t cluster_shift;
647 /* RAW_FILEINFO_UNIX_BASIC interface */
649 enum smb_fileinfo_level level;
651 union smb_handle_or_path file;
654 uint64_t end_of_file;
656 NTTIME status_change_time;
665 uint64_t permissions;
670 /* RAW_FILEINFO_UNIX_LINK interface */
672 enum smb_fileinfo_level level;
674 union smb_handle_or_path file;
677 struct smb_wire_string link_dest;
681 /* RAW_FILEINFO_INTERNAL_INFORMATION interface */
683 enum smb_fileinfo_level level;
685 union smb_handle_or_path file;
690 } internal_information;
692 /* RAW_FILEINFO_ACCESS_INFORMATION interface */
694 enum smb_fileinfo_level level;
696 union smb_handle_or_path file;
699 uint32_t access_flags;
701 } access_information;
703 /* RAW_FILEINFO_POSITION_INFORMATION interface */
705 enum smb_fileinfo_level level;
707 union smb_handle_or_path file;
712 } position_information;
714 /* RAW_FILEINFO_MODE_INFORMATION interface */
716 enum smb_fileinfo_level level;
718 union smb_handle_or_path file;
725 /* RAW_FILEINFO_ALIGNMENT_INFORMATION interface */
727 enum smb_fileinfo_level level;
729 union smb_handle_or_path file;
732 uint32_t alignment_requirement;
734 } alignment_information;
736 /* RAW_FILEINFO_NETWORK_OPEN_INFORMATION interface */
738 enum smb_fileinfo_level level;
740 union smb_handle_or_path file;
751 } network_open_information;
754 /* RAW_FILEINFO_ATTRIBUTE_TAG_INFORMATION interface */
756 enum smb_fileinfo_level level;
758 union smb_handle_or_path file;
762 uint32_t reparse_tag;
764 } attribute_tag_information;
766 /* RAW_FILEINFO_SEC_DESC */
768 enum smb_fileinfo_level level;
770 union smb_handle_or_path file;
771 uint32_t secinfo_flags;
774 struct security_descriptor *sd;
780 enum smb_setfileinfo_level {
781 RAW_SFILEINFO_GENERIC = 0xF000,
782 RAW_SFILEINFO_SETATTR, /* SMBsetatr */
783 RAW_SFILEINFO_SETATTRE, /* SMBsetattrE */
784 RAW_SFILEINFO_SEC_DESC, /* NT_TRANSACT_SET_SECURITY_DESC */
785 RAW_SFILEINFO_STANDARD = SMB_SFILEINFO_STANDARD,
786 RAW_SFILEINFO_EA_SET = SMB_SFILEINFO_EA_SET,
787 RAW_SFILEINFO_BASIC_INFO = SMB_SFILEINFO_BASIC_INFO,
788 RAW_SFILEINFO_DISPOSITION_INFO = SMB_SFILEINFO_DISPOSITION_INFO,
789 RAW_SFILEINFO_ALLOCATION_INFO = SMB_SFILEINFO_ALLOCATION_INFO,
790 RAW_SFILEINFO_END_OF_FILE_INFO = SMB_SFILEINFO_END_OF_FILE_INFO,
791 RAW_SFILEINFO_UNIX_BASIC = SMB_SFILEINFO_UNIX_BASIC,
792 RAW_SFILEINFO_UNIX_LINK = SMB_SFILEINFO_UNIX_LINK,
793 RAW_SFILEINFO_UNIX_HLINK = SMB_SFILEINFO_UNIX_HLINK,
794 RAW_SFILEINFO_BASIC_INFORMATION = SMB_SFILEINFO_BASIC_INFORMATION,
795 RAW_SFILEINFO_RENAME_INFORMATION = SMB_SFILEINFO_RENAME_INFORMATION,
796 RAW_SFILEINFO_DISPOSITION_INFORMATION = SMB_SFILEINFO_DISPOSITION_INFORMATION,
797 RAW_SFILEINFO_POSITION_INFORMATION = SMB_SFILEINFO_POSITION_INFORMATION,
798 RAW_SFILEINFO_MODE_INFORMATION = SMB_SFILEINFO_MODE_INFORMATION,
799 RAW_SFILEINFO_ALLOCATION_INFORMATION = SMB_SFILEINFO_ALLOCATION_INFORMATION,
800 RAW_SFILEINFO_END_OF_FILE_INFORMATION = SMB_SFILEINFO_END_OF_FILE_INFORMATION,
801 RAW_SFILEINFO_1023 = SMB_SFILEINFO_1023,
802 RAW_SFILEINFO_1025 = SMB_SFILEINFO_1025,
803 RAW_SFILEINFO_1029 = SMB_SFILEINFO_1029,
804 RAW_SFILEINFO_1032 = SMB_SFILEINFO_1032,
805 RAW_SFILEINFO_1039 = SMB_SFILEINFO_1039,
806 RAW_SFILEINFO_1040 = SMB_SFILEINFO_1040
809 /* union used in setfileinfo() and setpathinfo() calls */
810 union smb_setfileinfo {
811 /* generic interface */
813 enum smb_setfileinfo_level level;
815 union smb_handle_or_path file;
819 /* RAW_SFILEINFO_SETATTR (SMBsetatr) interface - only via setpathinfo() */
821 enum smb_setfileinfo_level level;
823 union smb_handle_or_path file;
829 /* RAW_SFILEINFO_SETATTRE (SMBsetattrE) interface - only via setfileinfo()
830 also RAW_SFILEINFO_STANDARD */
832 enum smb_setfileinfo_level level;
834 union smb_handle_or_path file;
838 /* notice that size, alloc_size and attrib are not settable,
839 unlike the corresponding qfileinfo level */
841 } setattre, standard;
843 /* RAW_SFILEINFO_EA_SET interface */
845 enum smb_setfileinfo_level level;
847 union smb_handle_or_path file;
849 struct ea_struct *eas;
853 /* RAW_SFILEINFO_BASIC_INFO and
854 RAW_SFILEINFO_BASIC_INFORMATION interfaces */
856 enum smb_setfileinfo_level level;
858 union smb_handle_or_path file;
867 /* RAW_SFILEINFO_DISPOSITION_INFO and
868 RAW_SFILEINFO_DISPOSITION_INFORMATION interfaces */
870 enum smb_setfileinfo_level level;
872 union smb_handle_or_path file;
873 BOOL delete_on_close;
877 /* RAW_SFILEINFO_ALLOCATION_INFO and
878 RAW_SFILEINFO_ALLOCATION_INFORMATION interfaces */
880 enum smb_setfileinfo_level level;
882 union smb_handle_or_path file;
883 /* w2k3 rounds this up to nearest 4096 */
888 /* RAW_SFILEINFO_END_OF_FILE_INFO and
889 RAW_SFILEINFO_END_OF_FILE_INFORMATION interfaces */
891 enum smb_setfileinfo_level level;
893 union smb_handle_or_path file;
898 /* RAW_SFILEINFO_RENAME_INFORMATION interface */
900 enum smb_setfileinfo_level level;
902 union smb_handle_or_path file;
905 const char *new_name;
907 } rename_information;
909 /* RAW_SFILEINFO_POSITION_INFORMATION interface */
911 enum smb_setfileinfo_level level;
913 union smb_handle_or_path file;
916 } position_information;
918 /* RAW_SFILEINFO_MODE_INFORMATION interface */
920 enum smb_setfileinfo_level level;
922 union smb_handle_or_path file;
923 /* valid values seem to be 0, 2, 4 and 6 */
930 /* RAW_SFILEINFO_UNIX_BASIC interface */
932 enum smb_setfileinfo_level level;
934 union smb_handle_or_path file;
935 uint32_t mode; /* yuck - this field remains to fix compile of libcli/clifile.c */
936 uint64_t end_of_file;
938 NTTIME status_change_time;
947 uint64_t permissions;
952 /* RAW_SFILEINFO_UNIX_LINK, RAW_SFILEINFO_UNIX_HLINK interface */
954 enum smb_setfileinfo_level level;
956 union smb_handle_or_path file;
957 const char *link_dest;
959 } unix_link, unix_hlink;
961 /* RAW_FILEINFO_SET_SEC_DESC */
963 enum smb_setfileinfo_level level;
965 union smb_handle_or_path file;
966 uint32_t secinfo_flags;
967 struct security_descriptor *sd;
973 enum smb_fsinfo_level {
974 RAW_QFS_GENERIC = 0xF000,
975 RAW_QFS_DSKATTR, /* SMBdskattr */
976 RAW_QFS_ALLOCATION = SMB_QFS_ALLOCATION,
977 RAW_QFS_VOLUME = SMB_QFS_VOLUME,
978 RAW_QFS_VOLUME_INFO = SMB_QFS_VOLUME_INFO,
979 RAW_QFS_SIZE_INFO = SMB_QFS_SIZE_INFO,
980 RAW_QFS_DEVICE_INFO = SMB_QFS_DEVICE_INFO,
981 RAW_QFS_ATTRIBUTE_INFO = SMB_QFS_ATTRIBUTE_INFO,
982 RAW_QFS_UNIX_INFO = SMB_QFS_UNIX_INFO,
983 RAW_QFS_VOLUME_INFORMATION = SMB_QFS_VOLUME_INFORMATION,
984 RAW_QFS_SIZE_INFORMATION = SMB_QFS_SIZE_INFORMATION,
985 RAW_QFS_DEVICE_INFORMATION = SMB_QFS_DEVICE_INFORMATION,
986 RAW_QFS_ATTRIBUTE_INFORMATION = SMB_QFS_ATTRIBUTE_INFORMATION,
987 RAW_QFS_QUOTA_INFORMATION = SMB_QFS_QUOTA_INFORMATION,
988 RAW_QFS_FULL_SIZE_INFORMATION = SMB_QFS_FULL_SIZE_INFORMATION,
989 RAW_QFS_OBJECTID_INFORMATION = SMB_QFS_OBJECTID_INFORMATION};
992 /* union for fsinfo() backend call. Note that there are no in
993 structures, as this call only contains out parameters */
995 /* generic interface */
997 enum smb_fsinfo_level level;
998 struct smb2_handle handle; /* only for smb2 */
1001 uint32_t block_size;
1002 uint64_t blocks_total;
1003 uint64_t blocks_free;
1006 uint32_t serial_number;
1008 uint32_t max_file_component_length;
1009 uint32_t device_type;
1010 uint32_t device_characteristics;
1011 uint64_t quota_soft;
1012 uint64_t quota_hard;
1013 uint64_t quota_flags;
1020 /* SMBdskattr interface */
1022 enum smb_fsinfo_level level;
1025 uint16_t units_total;
1026 uint16_t blocks_per_unit;
1027 uint16_t block_size;
1028 uint16_t units_free;
1032 /* trans2 RAW_QFS_ALLOCATION interface */
1034 enum smb_fsinfo_level level;
1038 uint32_t sectors_per_unit;
1039 uint32_t total_alloc_units;
1040 uint32_t avail_alloc_units;
1041 uint16_t bytes_per_sector;
1045 /* TRANS2 RAW_QFS_VOLUME interface */
1047 enum smb_fsinfo_level level;
1050 uint32_t serial_number;
1051 struct smb_wire_string volume_name;
1055 /* TRANS2 RAW_QFS_VOLUME_INFO and RAW_QFS_VOLUME_INFORMATION interfaces */
1057 enum smb_fsinfo_level level;
1058 struct smb2_handle handle; /* only for smb2 */
1062 uint32_t serial_number;
1063 struct smb_wire_string volume_name;
1067 /* trans2 RAW_QFS_SIZE_INFO and RAW_QFS_SIZE_INFORMATION interfaces */
1069 enum smb_fsinfo_level level;
1070 struct smb2_handle handle; /* only for smb2 */
1073 uint64_t total_alloc_units;
1074 uint64_t avail_alloc_units; /* maps to call_avail_alloc_units */
1075 uint32_t sectors_per_unit;
1076 uint32_t bytes_per_sector;
1080 /* TRANS2 RAW_QFS_DEVICE_INFO and RAW_QFS_DEVICE_INFORMATION interfaces */
1082 enum smb_fsinfo_level level;
1083 struct smb2_handle handle; /* only for smb2 */
1086 uint32_t device_type;
1087 uint32_t characteristics;
1092 /* TRANS2 RAW_QFS_ATTRIBUTE_INFO and RAW_QFS_ATTRIBUTE_INFORMATION interfaces */
1094 enum smb_fsinfo_level level;
1095 struct smb2_handle handle; /* only for smb2 */
1099 uint32_t max_file_component_length;
1100 struct smb_wire_string fs_type;
1105 /* TRANS2 RAW_QFS_UNIX_INFO interface */
1107 enum smb_fsinfo_level level;
1110 uint16_t major_version;
1111 uint16_t minor_version;
1112 uint64_t capability;
1116 /* trans2 RAW_QFS_QUOTA_INFORMATION interface */
1118 enum smb_fsinfo_level level;
1119 struct smb2_handle handle; /* only for smb2 */
1122 uint64_t unknown[3];
1123 uint64_t quota_soft;
1124 uint64_t quota_hard;
1125 uint64_t quota_flags;
1127 } quota_information;
1129 /* trans2 RAW_QFS_FULL_SIZE_INFORMATION interface */
1131 enum smb_fsinfo_level level;
1132 struct smb2_handle handle; /* only for smb2 */
1135 uint64_t total_alloc_units;
1136 uint64_t call_avail_alloc_units;
1137 uint64_t actual_avail_alloc_units;
1138 uint32_t sectors_per_unit;
1139 uint32_t bytes_per_sector;
1141 } full_size_information;
1143 /* trans2 RAW_QFS_OBJECTID_INFORMATION interface */
1145 enum smb_fsinfo_level level;
1146 struct smb2_handle handle; /* only for smb2 */
1150 uint64_t unknown[6];
1152 } objectid_information;
1157 enum smb_open_level {
1158 RAW_OPEN_OPEN, RAW_OPEN_OPENX,
1159 RAW_OPEN_MKNEW, RAW_OPEN_CREATE,
1160 RAW_OPEN_CTEMP, RAW_OPEN_SPLOPEN,
1161 RAW_OPEN_NTCREATEX, RAW_OPEN_T2OPEN,
1162 RAW_OPEN_NTTRANS_CREATE,
1163 RAW_OPEN_OPENX_READX};
1165 /* the generic interface is defined to be equal to the NTCREATEX interface */
1166 #define RAW_OPEN_GENERIC RAW_OPEN_NTCREATEX
1168 /* union for open() backend call */
1170 /* SMBNTCreateX interface */
1172 enum smb_open_level level;
1176 uint32_t access_mask;
1177 uint64_t alloc_size;
1179 uint32_t share_access;
1180 uint32_t open_disposition;
1181 uint32_t create_options;
1182 uint32_t impersonation;
1183 uint8_t security_flags;
1184 /* NOTE: fname can also be a pointer to a
1185 uint64_t file_id if create_options has the
1186 NTCREATEX_OPTIONS_OPEN_BY_FILE_ID flag set */
1189 /* these last 2 elements are only used in the
1190 NTTRANS varient of the call */
1191 struct security_descriptor *sec_desc;
1192 struct smb_ea_list *ea_list;
1195 union smb_handle file;
1196 uint8_t oplock_level;
1197 uint32_t create_action;
1203 uint64_t alloc_size;
1207 uint8_t is_directory;
1209 } ntcreatex, generic;
1211 /* TRANS2_OPEN interface */
1213 enum smb_open_level level;
1217 uint16_t search_attrs;
1218 uint16_t file_attrs;
1225 struct ea_struct *eas;
1228 union smb_handle file;
1240 /* SMBopen interface */
1242 enum smb_open_level level;
1245 uint16_t search_attrs;
1249 union smb_handle file;
1257 /* SMBopenX interface */
1259 enum smb_open_level level;
1263 uint16_t search_attrs; /* not honoured by win2003 */
1264 uint16_t file_attrs;
1265 time_t write_time; /* not honoured by win2003 */
1267 uint32_t size; /* note that this sets the
1268 initial file size, not
1269 just allocation size */
1270 uint32_t timeout; /* not honoured by win2003 */
1274 union smb_handle file;
1282 uint32_t unique_fid;
1283 uint32_t access_mask;
1288 /* SMBmknew interface */
1290 enum smb_open_level level;
1297 union smb_handle file;
1301 /* SMBctemp interface */
1303 enum smb_open_level level;
1307 const char *directory;
1310 union smb_handle file;
1311 /* temp name, relative to directory */
1316 /* SMBsplopen interface */
1318 enum smb_open_level level;
1320 uint16_t setup_length;
1325 union smb_handle file;
1330 /* chained OpenX/ReadX interface */
1332 enum smb_open_level level;
1336 uint16_t search_attrs; /* not honoured by win2003 */
1337 uint16_t file_attrs;
1338 time_t write_time; /* not honoured by win2003 */
1340 uint32_t size; /* note that this sets the
1341 initial file size, not
1342 just allocation size */
1343 uint32_t timeout; /* not honoured by win2003 */
1353 union smb_handle file;
1361 uint32_t unique_fid;
1362 uint32_t access_mask;
1368 uint16_t compaction_mode;
1376 enum smb_read_level {RAW_READ_READBRAW, RAW_READ_LOCKREAD, RAW_READ_READ, RAW_READ_READX};
1378 #define RAW_READ_GENERIC RAW_READ_READX
1380 /* union for read() backend call
1382 note that .infoX.out.data will be allocated before the backend is
1383 called. It will be big enough to hold the maximum size asked for
1386 /* SMBreadX (and generic) interface */
1388 enum smb_read_level level;
1390 union smb_handle file;
1395 BOOL read_for_execute;
1400 uint16_t compaction_mode;
1405 /* SMBreadbraw interface */
1407 enum smb_read_level level;
1409 union smb_handle file;
1422 /* SMBlockandread interface */
1424 enum smb_read_level level;
1426 union smb_handle file;
1437 /* SMBread interface */
1439 enum smb_read_level level;
1441 union smb_handle file;
1454 enum smb_write_level {RAW_WRITE_WRITEUNLOCK, RAW_WRITE_WRITE,
1455 RAW_WRITE_WRITEX, RAW_WRITE_WRITECLOSE,
1456 RAW_WRITE_SPLWRITE};
1458 #define RAW_WRITE_GENERIC RAW_WRITE_WRITEX
1460 /* union for write() backend call
1463 /* SMBwriteX interface */
1465 enum smb_write_level level;
1467 union smb_handle file;
1472 const uint8_t *data;
1480 /* SMBwriteunlock interface */
1482 enum smb_write_level level;
1484 union smb_handle file;
1488 const uint8_t *data;
1495 /* SMBwrite interface */
1497 enum smb_write_level level;
1499 union smb_handle file;
1503 const uint8_t *data;
1510 /* SMBwriteclose interface */
1512 enum smb_write_level level;
1514 union smb_handle file;
1518 const uint8_t *data;
1525 /* SMBsplwrite interface */
1527 enum smb_write_level level;
1529 union smb_handle file;
1531 const uint8_t *data;
1537 enum smb_lock_level {RAW_LOCK_LOCK, RAW_LOCK_UNLOCK, RAW_LOCK_LOCKX};
1539 /* the generic interface is defined to be equal to the lockingX interface */
1540 #define RAW_LOCK_GENERIC RAW_LOCK_LOCKX
1542 /* union for lock() backend call
1545 /* SMBlockingX (and generic) interface */
1547 enum smb_lock_level level;
1549 union smb_handle file;
1554 struct smb_lock_entry {
1558 } *locks; /* unlocks are first in the arrray */
1562 /* SMBlock and SMBunlock interface */
1564 enum smb_lock_level level;
1566 union smb_handle file;
1574 enum smb_close_level {RAW_CLOSE_CLOSE, RAW_CLOSE_SPLCLOSE};
1576 #define RAW_CLOSE_GENERIC RAW_CLOSE_CLOSE
1579 union for close() backend call
1582 /* SMBclose (and generic) interface */
1584 enum smb_close_level level;
1586 union smb_handle file;
1591 /* SMBsplclose interface - empty! */
1593 enum smb_close_level level;
1595 union smb_handle file;
1601 enum smb_lpq_level {RAW_LPQ_GENERIC, RAW_LPQ_RETQ};
1604 union for lpq() backend
1607 /* generic interface */
1609 enum smb_lpq_level level;
1614 /* SMBsplretq interface */
1616 enum smb_lpq_level level;
1624 uint16_t restart_idx;
1636 enum smb_ioctl_level {RAW_IOCTL_IOCTL, RAW_IOCTL_NTIOCTL};
1639 union for ioctl() backend
1642 /* generic interface */
1644 enum smb_ioctl_level level;
1646 union smb_handle file;
1650 /* struct for SMBioctl */
1652 enum smb_ioctl_level level;
1654 union smb_handle file;
1663 /* struct for NT ioctl call */
1665 enum smb_ioctl_level level;
1667 union smb_handle file;
1678 /* struct for SMBflush */
1682 union smb_handle file;
1688 /* struct for SMBcopy */
1703 /* struct for transact/transact2 call */
1711 uint8_t setup_count;
1713 const char *trans_name; /* SMBtrans only */
1719 uint8_t setup_count;
1726 /* struct for nttransact2 call */
1727 struct smb_nttrans {
1732 uint32_t setup_count;
1740 uint8_t setup_count;
1748 /* struct for nttrans change notify call */
1751 union smb_handle file;
1752 uint32_t buffer_size;
1753 uint32_t completion_filter;
1758 uint32_t num_changes;
1759 struct notify_changes {
1761 struct smb_wire_string name;
1766 enum smb_search_level {RAW_SEARCH_GENERIC = 0xF000,
1767 RAW_SEARCH_SEARCH, /* SMBsearch */
1768 RAW_SEARCH_FFIRST, /* SMBffirst */
1769 RAW_SEARCH_FUNIQUE, /* SMBfunique */
1770 RAW_SEARCH_STANDARD = SMB_FIND_STANDARD,
1771 RAW_SEARCH_EA_SIZE = SMB_FIND_EA_SIZE,
1772 RAW_SEARCH_EA_LIST = SMB_FIND_EA_LIST,
1773 RAW_SEARCH_DIRECTORY_INFO = SMB_FIND_DIRECTORY_INFO,
1774 RAW_SEARCH_FULL_DIRECTORY_INFO = SMB_FIND_FULL_DIRECTORY_INFO,
1775 RAW_SEARCH_NAME_INFO = SMB_FIND_NAME_INFO,
1776 RAW_SEARCH_BOTH_DIRECTORY_INFO = SMB_FIND_BOTH_DIRECTORY_INFO,
1777 RAW_SEARCH_ID_FULL_DIRECTORY_INFO = SMB_FIND_ID_FULL_DIRECTORY_INFO,
1778 RAW_SEARCH_ID_BOTH_DIRECTORY_INFO = SMB_FIND_ID_BOTH_DIRECTORY_INFO,
1779 RAW_SEARCH_UNIX_INFO = SMB_FIND_UNIX_INFO};
1782 /* union for file search */
1783 union smb_search_first {
1785 enum smb_search_level level;
1788 /* search (old) findfirst interface.
1789 Also used for ffirst and funique. */
1791 enum smb_search_level level;
1795 uint16_t search_attrib;
1796 const char *pattern;
1803 /* trans2 findfirst interface */
1805 enum smb_search_level level;
1808 uint16_t search_attrib;
1811 uint32_t storage_type;
1812 const char *pattern;
1814 /* the ea names are only used for RAW_SEARCH_EA_LIST */
1816 struct ea_name *ea_names;
1821 uint16_t end_of_search;
1826 /* union for file search continue */
1827 union smb_search_next {
1829 enum smb_search_level level;
1832 /* search (old) findnext interface. Also used
1833 for ffirst when continuing */
1835 enum smb_search_level level;
1839 uint16_t search_attrib;
1840 struct smb_search_id {
1844 uint32_t server_cookie;
1845 uint32_t client_cookie;
1853 /* trans2 findnext interface */
1855 enum smb_search_level level;
1860 uint32_t resume_key;
1862 const char *last_name;
1864 /* the ea names are only used for RAW_SEARCH_EA_LIST */
1866 struct ea_name *ea_names;
1870 uint16_t end_of_search;
1875 /* union for search reply file data */
1876 union smb_search_data {
1877 /* search (old) findfirst */
1882 struct smb_search_id id;
1886 /* trans2 findfirst RAW_SEARCH_STANDARD level */
1888 uint32_t resume_key;
1893 uint32_t alloc_size;
1895 struct smb_wire_string name;
1898 /* trans2 findfirst RAW_SEARCH_EA_SIZE level */
1900 uint32_t resume_key;
1905 uint32_t alloc_size;
1908 struct smb_wire_string name;
1911 /* trans2 findfirst RAW_SEARCH_EA_LIST level */
1913 uint32_t resume_key;
1918 uint32_t alloc_size;
1920 struct smb_ea_list eas;
1921 struct smb_wire_string name;
1924 /* RAW_SEARCH_DIRECTORY_INFO interface */
1926 uint32_t file_index;
1932 uint64_t alloc_size;
1934 struct smb_wire_string name;
1937 /* RAW_SEARCH_FULL_DIRECTORY_INFO interface */
1939 uint32_t file_index;
1945 uint64_t alloc_size;
1948 struct smb_wire_string name;
1949 } full_directory_info;
1951 /* RAW_SEARCH_NAME_INFO interface */
1953 uint32_t file_index;
1954 struct smb_wire_string name;
1957 /* RAW_SEARCH_BOTH_DIRECTORY_INFO interface */
1959 uint32_t file_index;
1965 uint64_t alloc_size;
1968 struct smb_wire_string short_name;
1969 struct smb_wire_string name;
1970 } both_directory_info;
1972 /* RAW_SEARCH_ID_FULL_DIRECTORY_INFO interface */
1974 uint32_t file_index;
1980 uint64_t alloc_size;
1984 struct smb_wire_string name;
1985 } id_full_directory_info;
1987 /* RAW_SEARCH_ID_BOTH_DIRECTORY_INFO interface */
1989 uint32_t file_index;
1995 uint64_t alloc_size;
1999 struct smb_wire_string short_name;
2000 struct smb_wire_string name;
2001 } id_both_directory_info;
2003 /* RAW_SEARCH_UNIX_INFO interface */
2005 uint32_t file_index;
2007 uint64_t alloc_size;
2008 NTTIME status_change_time;
2017 uint64_t permissions;
2024 enum smb_search_close_level {RAW_FINDCLOSE_GENERIC, RAW_FINDCLOSE_FCLOSE, RAW_FINDCLOSE_FINDCLOSE};
2026 /* union for file search close */
2027 union smb_search_close {
2029 enum smb_search_close_level level;
2032 /* SMBfclose (old search) interface */
2034 enum smb_search_close_level level;
2037 /* max_count and search_attrib are not used, but are present */
2039 uint16_t search_attrib;
2040 struct smb_search_id id;
2044 /* SMBfindclose interface */
2046 enum smb_search_close_level level;
2054 #endif /* __LIBCLI_RAW_INTERFACES_H__ */