r15814: add SMB2 Lock interface structure
[Samba/aatanasov.git] / source4 / libcli / raw / interfaces.h
blob8b144779f41b9a33e1f7a346c4dcd1eb03a85efe
1 /*
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__
25 #include "smb.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
34 string
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;
44 const char *s;
48 * SMB2 uses a 16Byte handle,
49 * (we can maybe use struct GUID later)
51 struct smb2_handle {
52 uint64_t data[2];
55 struct ntvfs_handle;
58 * a generic container for file handles or file pathes
59 * for qfileinfo/setfileinfo and qpathinfo/setpathinfo
61 union smb_handle_or_path {
63 * this is used for
64 * the qpathinfo and setpathinfo
65 * calls
67 const char *path;
69 * this is used as file handle in SMB
71 uint16_t fnum;
74 * this is used as file handle in SMB2
76 struct smb2_handle handle;
79 * this is used as generic file handle for the NTVFS layer
81 struct ntvfs_handle *ntvfs;
85 a generic container for file handles
87 union smb_handle {
89 * this is used as file handle in SMB
91 uint16_t fnum;
94 * this is used as file handle in SMB2
96 struct smb2_handle handle;
99 * this is used as generic file handle for the NTVFS layer
101 struct ntvfs_handle *ntvfs;
105 this header defines the structures and unions used between the SMB
106 parser and the backends.
109 /* struct used for SMBlseek call */
110 union smb_seek {
111 struct {
112 struct {
113 union smb_handle file;
114 uint16_t mode;
115 int32_t offset; /* signed */
116 } in;
117 struct {
118 int32_t offset;
119 } out;
120 } lseek, generic;
123 /* struct used in unlink() call */
124 union smb_unlink {
125 struct {
126 struct {
127 const char *pattern;
128 uint16_t attrib;
129 } in;
130 } unlink;
134 /* struct used in chkpath() call */
135 union smb_chkpath {
136 struct {
137 struct {
138 const char *path;
139 } in;
140 } chkpath;
143 enum smb_mkdir_level {RAW_MKDIR_GENERIC, RAW_MKDIR_MKDIR, RAW_MKDIR_T2MKDIR};
145 /* union used in mkdir() call */
146 union smb_mkdir {
147 /* generic level */
148 struct {
149 enum smb_mkdir_level level;
150 } generic;
152 struct {
153 enum smb_mkdir_level level;
154 struct {
155 const char *path;
156 } in;
157 } mkdir;
159 struct {
160 enum smb_mkdir_level level;
161 struct {
162 const char *path;
163 uint_t num_eas;
164 struct ea_struct *eas;
165 } in;
166 } t2mkdir;
169 /* struct used in rmdir() call */
170 struct smb_rmdir {
171 struct {
172 const char *path;
173 } in;
176 /* struct used in rename() call */
177 enum smb_rename_level {RAW_RENAME_RENAME, RAW_RENAME_NTRENAME};
179 union smb_rename {
180 struct {
181 enum smb_rename_level level;
182 } generic;
184 /* SMBrename interface */
185 struct {
186 enum smb_rename_level level;
188 struct {
189 const char *pattern1;
190 const char *pattern2;
191 uint16_t attrib;
192 } in;
193 } rename;
196 /* SMBntrename interface */
197 struct {
198 enum smb_rename_level level;
200 struct {
201 uint16_t attrib;
202 uint16_t flags; /* see RENAME_FLAG_* */
203 uint32_t cluster_size;
204 const char *old_name;
205 const char *new_name;
206 } in;
207 } ntrename;
210 enum smb_tcon_level {
211 RAW_TCON_TCON,
212 RAW_TCON_TCONX,
213 RAW_TCON_SMB2
216 /* union used in tree connect call */
217 union smb_tcon {
218 /* generic interface */
219 struct {
220 enum smb_tcon_level level;
221 } generic;
223 /* SMBtcon interface */
224 struct {
225 enum smb_tcon_level level;
227 struct {
228 const char *service;
229 const char *password;
230 const char *dev;
231 } in;
232 struct {
233 uint16_t max_xmit;
234 uint16_t tid;
235 } out;
236 } tcon;
238 /* SMBtconX interface */
239 struct {
240 enum smb_tcon_level level;
242 struct {
243 uint16_t flags;
244 DATA_BLOB password;
245 const char *path;
246 const char *device;
247 } in;
248 struct {
249 uint16_t options;
250 char *dev_type;
251 char *fs_type;
252 uint16_t tid;
253 } out;
254 } tconx;
256 /* SMB2 TreeConnect */
257 struct smb2_tree_connect {
258 enum smb_tcon_level level;
260 struct {
261 /* static body buffer 8 (0x08) bytes */
262 /* uint16_t buffer_code; 0x09 = 0x08 + 1 */
263 uint16_t unknown1; /* 0x0000 */
264 /* uint16_t path_ofs */
265 /* uint16_t path_size */
267 /* dynamic body */
268 const char *path; /* as non-terminated UTF-16 on the wire */
269 } in;
270 struct {
271 /* static body buffer 16 (0x10) bytes */
272 /* uint16_t buffer_code; 0x10 */
273 uint16_t unknown1; /* 0x02 */
274 uint32_t unknown2; /* 0x00 */
275 uint32_t unknown3; /* 0x00 */
276 uint32_t access_mask;
278 /* extracted from the SMB2 header */
279 uint32_t tid;
280 } out;
281 } smb2;
285 enum smb_sesssetup_level {
286 RAW_SESSSETUP_OLD,
287 RAW_SESSSETUP_NT1,
288 RAW_SESSSETUP_SPNEGO,
289 RAW_SESSSETUP_SMB2
292 /* union used in session_setup call */
293 union smb_sesssetup {
294 /* the pre-NT1 interface */
295 struct {
296 enum smb_sesssetup_level level;
298 struct {
299 uint16_t bufsize;
300 uint16_t mpx_max;
301 uint16_t vc_num;
302 uint32_t sesskey;
303 DATA_BLOB password;
304 const char *user;
305 const char *domain;
306 const char *os;
307 const char *lanman;
308 } in;
309 struct {
310 uint16_t action;
311 uint16_t vuid;
312 char *os;
313 char *lanman;
314 char *domain;
315 } out;
316 } old;
318 /* the NT1 interface */
319 struct {
320 enum smb_sesssetup_level level;
322 struct {
323 uint16_t bufsize;
324 uint16_t mpx_max;
325 uint16_t vc_num;
326 uint32_t sesskey;
327 uint32_t capabilities;
328 DATA_BLOB password1;
329 DATA_BLOB password2;
330 const char *user;
331 const char *domain;
332 const char *os;
333 const char *lanman;
334 } in;
335 struct {
336 uint16_t action;
337 uint16_t vuid;
338 char *os;
339 char *lanman;
340 char *domain;
341 } out;
342 } nt1;
345 /* the SPNEGO interface */
346 struct {
347 enum smb_sesssetup_level level;
349 struct {
350 uint16_t bufsize;
351 uint16_t mpx_max;
352 uint16_t vc_num;
353 uint32_t sesskey;
354 uint32_t capabilities;
355 DATA_BLOB secblob;
356 const char *os;
357 const char *lanman;
358 const char *workgroup;
359 } in;
360 struct {
361 uint16_t action;
362 DATA_BLOB secblob;
363 char *os;
364 char *lanman;
365 char *workgroup;
366 uint16_t vuid;
367 } out;
368 } spnego;
370 /* SMB2 SessionSetup */
371 struct smb2_session_setup {
372 enum smb_sesssetup_level level;
374 struct {
375 /* static body buffer 16 (0x10) bytes */
376 /* uint16_t buffer_code; 0x11 = 0x10 + 1 */
377 uint16_t _pad;
378 uint32_t unknown2; /* 0xF */
379 uint32_t unknown3; /* 0x00 */
380 /* uint16_t secblob_ofs */
381 /* uint16_t secblob_size */
383 /* dynamic body */
384 DATA_BLOB secblob;
385 } in;
386 struct {
387 /* static body buffer 8 (0x08) bytes */
388 /* uint16_t buffer_code; 0x09 = 0x08 +1 */
389 uint16_t _pad;
390 /* uint16_t secblob_ofs */
391 /* uint16_t secblob_size */
393 /* dynamic body */
394 DATA_BLOB secblob;
396 /* extracted from the SMB2 header */
397 uint64_t uid;
398 } out;
399 } smb2;
402 /* Note that the specified enum values are identical to the actual info-levels used
403 * on the wire.
405 enum smb_fileinfo_level {
406 RAW_FILEINFO_GENERIC = 0xF000,
407 RAW_FILEINFO_GETATTR, /* SMBgetatr */
408 RAW_FILEINFO_GETATTRE, /* SMBgetattrE */
409 RAW_FILEINFO_SEC_DESC, /* NT_TRANSACT_QUERY_SECURITY_DESC */
410 RAW_FILEINFO_STANDARD = SMB_QFILEINFO_STANDARD,
411 RAW_FILEINFO_EA_SIZE = SMB_QFILEINFO_EA_SIZE,
412 RAW_FILEINFO_EA_LIST = SMB_QFILEINFO_EA_LIST,
413 RAW_FILEINFO_ALL_EAS = SMB_QFILEINFO_ALL_EAS,
414 RAW_FILEINFO_IS_NAME_VALID = SMB_QFILEINFO_IS_NAME_VALID,
415 RAW_FILEINFO_BASIC_INFO = SMB_QFILEINFO_BASIC_INFO,
416 RAW_FILEINFO_STANDARD_INFO = SMB_QFILEINFO_STANDARD_INFO,
417 RAW_FILEINFO_EA_INFO = SMB_QFILEINFO_EA_INFO,
418 RAW_FILEINFO_NAME_INFO = SMB_QFILEINFO_NAME_INFO,
419 RAW_FILEINFO_ALL_INFO = SMB_QFILEINFO_ALL_INFO,
420 RAW_FILEINFO_ALT_NAME_INFO = SMB_QFILEINFO_ALT_NAME_INFO,
421 RAW_FILEINFO_STREAM_INFO = SMB_QFILEINFO_STREAM_INFO,
422 RAW_FILEINFO_COMPRESSION_INFO = SMB_QFILEINFO_COMPRESSION_INFO,
423 RAW_FILEINFO_UNIX_BASIC = SMB_QFILEINFO_UNIX_BASIC,
424 RAW_FILEINFO_UNIX_LINK = SMB_QFILEINFO_UNIX_LINK,
425 RAW_FILEINFO_BASIC_INFORMATION = SMB_QFILEINFO_BASIC_INFORMATION,
426 RAW_FILEINFO_STANDARD_INFORMATION = SMB_QFILEINFO_STANDARD_INFORMATION,
427 RAW_FILEINFO_INTERNAL_INFORMATION = SMB_QFILEINFO_INTERNAL_INFORMATION,
428 RAW_FILEINFO_EA_INFORMATION = SMB_QFILEINFO_EA_INFORMATION,
429 RAW_FILEINFO_ACCESS_INFORMATION = SMB_QFILEINFO_ACCESS_INFORMATION,
430 RAW_FILEINFO_NAME_INFORMATION = SMB_QFILEINFO_NAME_INFORMATION,
431 RAW_FILEINFO_POSITION_INFORMATION = SMB_QFILEINFO_POSITION_INFORMATION,
432 RAW_FILEINFO_MODE_INFORMATION = SMB_QFILEINFO_MODE_INFORMATION,
433 RAW_FILEINFO_ALIGNMENT_INFORMATION = SMB_QFILEINFO_ALIGNMENT_INFORMATION,
434 RAW_FILEINFO_ALL_INFORMATION = SMB_QFILEINFO_ALL_INFORMATION,
435 RAW_FILEINFO_ALT_NAME_INFORMATION = SMB_QFILEINFO_ALT_NAME_INFORMATION,
436 RAW_FILEINFO_STREAM_INFORMATION = SMB_QFILEINFO_STREAM_INFORMATION,
437 RAW_FILEINFO_COMPRESSION_INFORMATION = SMB_QFILEINFO_COMPRESSION_INFORMATION,
438 RAW_FILEINFO_NETWORK_OPEN_INFORMATION = SMB_QFILEINFO_NETWORK_OPEN_INFORMATION,
439 RAW_FILEINFO_ATTRIBUTE_TAG_INFORMATION = SMB_QFILEINFO_ATTRIBUTE_TAG_INFORMATION,
440 /* SMB2 specific levels */
441 RAW_FILEINFO_SMB2_ALL_EAS = 0x0f01,
442 RAW_FILEINFO_SMB2_ALL_INFORMATION = 0x1201
445 /* union used in qfileinfo() and qpathinfo() backend calls */
446 union smb_fileinfo {
447 /* generic interface:
448 * matches RAW_FILEINFO_GENERIC */
449 struct {
450 enum smb_fileinfo_level level;
451 struct {
452 union smb_handle_or_path file;
453 } in;
454 struct {
455 uint32_t attrib;
456 uint32_t ea_size;
457 uint_t num_eas;
458 struct ea_struct {
459 uint8_t flags;
460 struct smb_wire_string name;
461 DATA_BLOB value;
462 } *eas;
463 NTTIME create_time;
464 NTTIME access_time;
465 NTTIME write_time;
466 NTTIME change_time;
467 uint64_t alloc_size;
468 uint64_t size;
469 uint32_t nlink;
470 struct smb_wire_string fname;
471 struct smb_wire_string alt_fname;
472 uint8_t delete_pending;
473 uint8_t directory;
474 uint64_t compressed_size;
475 uint16_t format;
476 uint8_t unit_shift;
477 uint8_t chunk_shift;
478 uint8_t cluster_shift;
479 uint64_t file_id;
480 uint32_t access_flags; /* seen 0x001f01ff from w2k3 */
481 uint64_t position;
482 uint32_t mode;
483 uint32_t alignment_requirement;
484 uint32_t reparse_tag;
485 uint_t num_streams;
486 struct stream_struct {
487 uint64_t size;
488 uint64_t alloc_size;
489 struct smb_wire_string stream_name;
490 } *streams;
491 } out;
492 } generic;
495 /* SMBgetatr interface:
496 * matches RAW_FILEINFO_GETATTR */
497 struct {
498 enum smb_fileinfo_level level;
499 struct {
500 union smb_handle_or_path file;
501 } in;
502 struct {
503 uint16_t attrib;
504 uint32_t size;
505 time_t write_time;
506 } out;
507 } getattr;
509 /* SMBgetattrE and RAW_FILEINFO_STANDARD interface */
510 struct {
511 enum smb_fileinfo_level level;
512 struct {
513 union smb_handle_or_path file;
514 } in;
515 struct {
516 time_t create_time;
517 time_t access_time;
518 time_t write_time;
519 uint32_t size;
520 uint32_t alloc_size;
521 uint16_t attrib;
522 } out;
523 } getattre, standard;
525 /* trans2 RAW_FILEINFO_EA_SIZE interface */
526 struct {
527 enum smb_fileinfo_level level;
528 struct {
529 union smb_handle_or_path file;
530 } in;
531 struct {
532 time_t create_time;
533 time_t access_time;
534 time_t write_time;
535 uint32_t size;
536 uint32_t alloc_size;
537 uint16_t attrib;
538 uint32_t ea_size;
539 } out;
540 } ea_size;
542 /* trans2 RAW_FILEINFO_EA_LIST interface */
543 struct {
544 enum smb_fileinfo_level level;
545 struct {
546 union smb_handle_or_path file;
547 uint_t num_names;
548 struct ea_name {
549 struct smb_wire_string name;
550 } *ea_names;
551 } in;
553 struct smb_ea_list {
554 uint_t num_eas;
555 struct ea_struct *eas;
556 } out;
557 } ea_list;
559 /* trans2 RAW_FILEINFO_ALL_EAS and RAW_FILEINFO_FULL_EA_INFORMATION interfaces */
560 struct {
561 enum smb_fileinfo_level level;
562 struct {
563 union smb_handle_or_path file;
564 /* SMB2 only - SMB2_CONTINUE_FLAG_* */
565 uint8_t continue_flags;
566 } in;
567 struct smb_ea_list out;
568 } all_eas;
570 /* trans2 qpathinfo RAW_FILEINFO_IS_NAME_VALID interface
571 only valid for a QPATHNAME call - no returned data */
572 struct {
573 enum smb_fileinfo_level level;
574 struct {
575 union smb_handle_or_path file;
576 } in;
577 } is_name_valid;
579 /* RAW_FILEINFO_BASIC_INFO and RAW_FILEINFO_BASIC_INFORMATION interfaces */
580 struct {
581 enum smb_fileinfo_level level;
582 struct {
583 union smb_handle_or_path file;
584 } in;
585 struct {
586 NTTIME create_time;
587 NTTIME access_time;
588 NTTIME write_time;
589 NTTIME change_time;
590 uint32_t attrib;
591 } out;
592 } basic_info;
595 /* RAW_FILEINFO_STANDARD_INFO and RAW_FILEINFO_STANDARD_INFORMATION interfaces */
596 struct {
597 enum smb_fileinfo_level level;
598 struct {
599 union smb_handle_or_path file;
600 } in;
601 struct {
602 uint64_t alloc_size;
603 uint64_t size;
604 uint32_t nlink;
605 BOOL delete_pending;
606 BOOL directory;
607 } out;
608 } standard_info;
610 /* RAW_FILEINFO_EA_INFO and RAW_FILEINFO_EA_INFORMATION interfaces */
611 struct {
612 enum smb_fileinfo_level level;
613 struct {
614 union smb_handle_or_path file;
615 } in;
616 struct {
617 uint32_t ea_size;
618 } out;
619 } ea_info;
621 /* RAW_FILEINFO_NAME_INFO and RAW_FILEINFO_NAME_INFORMATION interfaces */
622 struct {
623 enum smb_fileinfo_level level;
624 struct {
625 union smb_handle_or_path file;
626 } in;
627 struct {
628 struct smb_wire_string fname;
629 } out;
630 } name_info;
632 /* RAW_FILEINFO_ALL_INFO and RAW_FILEINFO_ALL_INFORMATION interfaces */
633 struct {
634 enum smb_fileinfo_level level;
635 struct {
636 union smb_handle_or_path file;
637 } in;
638 struct {
639 NTTIME create_time;
640 NTTIME access_time;
641 NTTIME write_time;
642 NTTIME change_time;
643 uint32_t attrib;
644 uint64_t alloc_size;
645 uint64_t size;
646 uint32_t nlink;
647 uint8_t delete_pending;
648 uint8_t directory;
649 uint32_t ea_size;
650 struct smb_wire_string fname;
651 } out;
652 } all_info;
654 /* RAW_FILEINFO_SMB2_ALL_INFORMATION interface */
655 struct {
656 enum smb_fileinfo_level level;
657 struct {
658 union smb_handle_or_path file;
659 } in;
660 struct {
661 NTTIME create_time;
662 NTTIME access_time;
663 NTTIME write_time;
664 NTTIME change_time;
665 uint32_t attrib;
666 uint32_t unknown1;
667 uint64_t alloc_size;
668 uint64_t size;
669 uint32_t nlink;
670 uint8_t delete_pending;
671 uint8_t directory;
672 /* uint16_t _pad; */
673 uint64_t file_id;
674 uint32_t ea_size;
675 uint32_t access_mask;
676 uint64_t position;
677 uint64_t mode;
678 struct smb_wire_string fname;
679 } out;
680 } all_info2;
682 /* RAW_FILEINFO_ALT_NAME_INFO and RAW_FILEINFO_ALT_NAME_INFORMATION interfaces */
683 struct {
684 enum smb_fileinfo_level level;
685 struct {
686 union smb_handle_or_path file;
687 } in;
688 struct {
689 struct smb_wire_string fname;
690 } out;
691 } alt_name_info;
693 /* RAW_FILEINFO_STREAM_INFO and RAW_FILEINFO_STREAM_INFORMATION interfaces */
694 struct {
695 enum smb_fileinfo_level level;
696 struct {
697 union smb_handle_or_path file;
698 } in;
699 struct stream_information {
700 uint_t num_streams;
701 struct stream_struct *streams;
702 } out;
703 } stream_info;
705 /* RAW_FILEINFO_COMPRESSION_INFO and RAW_FILEINFO_COMPRESSION_INFORMATION interfaces */
706 struct {
707 enum smb_fileinfo_level level;
708 struct {
709 union smb_handle_or_path file;
710 } in;
711 struct {
712 uint64_t compressed_size;
713 uint16_t format;
714 uint8_t unit_shift;
715 uint8_t chunk_shift;
716 uint8_t cluster_shift;
717 } out;
718 } compression_info;
720 /* RAW_FILEINFO_UNIX_BASIC interface */
721 struct {
722 enum smb_fileinfo_level level;
723 struct {
724 union smb_handle_or_path file;
725 } in;
726 struct {
727 uint64_t end_of_file;
728 uint64_t num_bytes;
729 NTTIME status_change_time;
730 NTTIME access_time;
731 NTTIME change_time;
732 uint64_t uid;
733 uint64_t gid;
734 uint32_t file_type;
735 uint64_t dev_major;
736 uint64_t dev_minor;
737 uint64_t unique_id;
738 uint64_t permissions;
739 uint64_t nlink;
740 } out;
741 } unix_basic_info;
743 /* RAW_FILEINFO_UNIX_LINK interface */
744 struct {
745 enum smb_fileinfo_level level;
746 struct {
747 union smb_handle_or_path file;
748 } in;
749 struct {
750 struct smb_wire_string link_dest;
751 } out;
752 } unix_link_info;
754 /* RAW_FILEINFO_INTERNAL_INFORMATION interface */
755 struct {
756 enum smb_fileinfo_level level;
757 struct {
758 union smb_handle_or_path file;
759 } in;
760 struct {
761 uint64_t file_id;
762 } out;
763 } internal_information;
765 /* RAW_FILEINFO_ACCESS_INFORMATION interface */
766 struct {
767 enum smb_fileinfo_level level;
768 struct {
769 union smb_handle_or_path file;
770 } in;
771 struct {
772 uint32_t access_flags;
773 } out;
774 } access_information;
776 /* RAW_FILEINFO_POSITION_INFORMATION interface */
777 struct {
778 enum smb_fileinfo_level level;
779 struct {
780 union smb_handle_or_path file;
781 } in;
782 struct {
783 uint64_t position;
784 } out;
785 } position_information;
787 /* RAW_FILEINFO_MODE_INFORMATION interface */
788 struct {
789 enum smb_fileinfo_level level;
790 struct {
791 union smb_handle_or_path file;
792 } in;
793 struct {
794 uint32_t mode;
795 } out;
796 } mode_information;
798 /* RAW_FILEINFO_ALIGNMENT_INFORMATION interface */
799 struct {
800 enum smb_fileinfo_level level;
801 struct {
802 union smb_handle_or_path file;
803 } in;
804 struct {
805 uint32_t alignment_requirement;
806 } out;
807 } alignment_information;
809 /* RAW_FILEINFO_NETWORK_OPEN_INFORMATION interface */
810 struct {
811 enum smb_fileinfo_level level;
812 struct {
813 union smb_handle_or_path file;
814 } in;
815 struct {
816 NTTIME create_time;
817 NTTIME access_time;
818 NTTIME write_time;
819 NTTIME change_time;
820 uint64_t alloc_size;
821 uint64_t size;
822 uint32_t attrib;
823 } out;
824 } network_open_information;
827 /* RAW_FILEINFO_ATTRIBUTE_TAG_INFORMATION interface */
828 struct {
829 enum smb_fileinfo_level level;
830 struct {
831 union smb_handle_or_path file;
832 } in;
833 struct {
834 uint32_t attrib;
835 uint32_t reparse_tag;
836 } out;
837 } attribute_tag_information;
839 /* RAW_FILEINFO_SEC_DESC */
840 struct {
841 enum smb_fileinfo_level level;
842 struct {
843 union smb_handle_or_path file;
844 uint32_t secinfo_flags;
845 } in;
846 struct {
847 struct security_descriptor *sd;
848 } out;
849 } query_secdesc;
853 enum smb_setfileinfo_level {
854 RAW_SFILEINFO_GENERIC = 0xF000,
855 RAW_SFILEINFO_SETATTR, /* SMBsetatr */
856 RAW_SFILEINFO_SETATTRE, /* SMBsetattrE */
857 RAW_SFILEINFO_SEC_DESC, /* NT_TRANSACT_SET_SECURITY_DESC */
858 RAW_SFILEINFO_STANDARD = SMB_SFILEINFO_STANDARD,
859 RAW_SFILEINFO_EA_SET = SMB_SFILEINFO_EA_SET,
860 RAW_SFILEINFO_BASIC_INFO = SMB_SFILEINFO_BASIC_INFO,
861 RAW_SFILEINFO_DISPOSITION_INFO = SMB_SFILEINFO_DISPOSITION_INFO,
862 RAW_SFILEINFO_ALLOCATION_INFO = SMB_SFILEINFO_ALLOCATION_INFO,
863 RAW_SFILEINFO_END_OF_FILE_INFO = SMB_SFILEINFO_END_OF_FILE_INFO,
864 RAW_SFILEINFO_UNIX_BASIC = SMB_SFILEINFO_UNIX_BASIC,
865 RAW_SFILEINFO_UNIX_LINK = SMB_SFILEINFO_UNIX_LINK,
866 RAW_SFILEINFO_UNIX_HLINK = SMB_SFILEINFO_UNIX_HLINK,
867 RAW_SFILEINFO_BASIC_INFORMATION = SMB_SFILEINFO_BASIC_INFORMATION,
868 RAW_SFILEINFO_RENAME_INFORMATION = SMB_SFILEINFO_RENAME_INFORMATION,
869 RAW_SFILEINFO_DISPOSITION_INFORMATION = SMB_SFILEINFO_DISPOSITION_INFORMATION,
870 RAW_SFILEINFO_POSITION_INFORMATION = SMB_SFILEINFO_POSITION_INFORMATION,
871 RAW_SFILEINFO_MODE_INFORMATION = SMB_SFILEINFO_MODE_INFORMATION,
872 RAW_SFILEINFO_ALLOCATION_INFORMATION = SMB_SFILEINFO_ALLOCATION_INFORMATION,
873 RAW_SFILEINFO_END_OF_FILE_INFORMATION = SMB_SFILEINFO_END_OF_FILE_INFORMATION,
874 RAW_SFILEINFO_1023 = SMB_SFILEINFO_1023,
875 RAW_SFILEINFO_1025 = SMB_SFILEINFO_1025,
876 RAW_SFILEINFO_1029 = SMB_SFILEINFO_1029,
877 RAW_SFILEINFO_1032 = SMB_SFILEINFO_1032,
878 RAW_SFILEINFO_1039 = SMB_SFILEINFO_1039,
879 RAW_SFILEINFO_1040 = SMB_SFILEINFO_1040
882 /* union used in setfileinfo() and setpathinfo() calls */
883 union smb_setfileinfo {
884 /* generic interface */
885 struct {
886 enum smb_setfileinfo_level level;
887 struct {
888 union smb_handle_or_path file;
889 } in;
890 } generic;
892 /* RAW_SFILEINFO_SETATTR (SMBsetatr) interface - only via setpathinfo() */
893 struct {
894 enum smb_setfileinfo_level level;
895 struct {
896 union smb_handle_or_path file;
897 uint16_t attrib;
898 time_t write_time;
899 } in;
900 } setattr;
902 /* RAW_SFILEINFO_SETATTRE (SMBsetattrE) interface - only via setfileinfo()
903 also RAW_SFILEINFO_STANDARD */
904 struct {
905 enum smb_setfileinfo_level level;
906 struct {
907 union smb_handle_or_path file;
908 time_t create_time;
909 time_t access_time;
910 time_t write_time;
911 /* notice that size, alloc_size and attrib are not settable,
912 unlike the corresponding qfileinfo level */
913 } in;
914 } setattre, standard;
916 /* RAW_SFILEINFO_EA_SET interface */
917 struct {
918 enum smb_setfileinfo_level level;
919 struct {
920 union smb_handle_or_path file;
921 uint_t num_eas;
922 struct ea_struct *eas;
923 } in;
924 } ea_set;
926 /* RAW_SFILEINFO_BASIC_INFO and
927 RAW_SFILEINFO_BASIC_INFORMATION interfaces */
928 struct {
929 enum smb_setfileinfo_level level;
930 struct {
931 union smb_handle_or_path file;
932 NTTIME create_time;
933 NTTIME access_time;
934 NTTIME write_time;
935 NTTIME change_time;
936 uint32_t attrib;
937 } in;
938 } basic_info;
940 /* RAW_SFILEINFO_DISPOSITION_INFO and
941 RAW_SFILEINFO_DISPOSITION_INFORMATION interfaces */
942 struct {
943 enum smb_setfileinfo_level level;
944 struct {
945 union smb_handle_or_path file;
946 BOOL delete_on_close;
947 } in;
948 } disposition_info;
950 /* RAW_SFILEINFO_ALLOCATION_INFO and
951 RAW_SFILEINFO_ALLOCATION_INFORMATION interfaces */
952 struct {
953 enum smb_setfileinfo_level level;
954 struct {
955 union smb_handle_or_path file;
956 /* w2k3 rounds this up to nearest 4096 */
957 uint64_t alloc_size;
958 } in;
959 } allocation_info;
961 /* RAW_SFILEINFO_END_OF_FILE_INFO and
962 RAW_SFILEINFO_END_OF_FILE_INFORMATION interfaces */
963 struct {
964 enum smb_setfileinfo_level level;
965 struct {
966 union smb_handle_or_path file;
967 uint64_t size;
968 } in;
969 } end_of_file_info;
971 /* RAW_SFILEINFO_RENAME_INFORMATION interface */
972 struct {
973 enum smb_setfileinfo_level level;
974 struct {
975 union smb_handle_or_path file;
976 uint8_t overwrite;
977 uint32_t root_fid;
978 const char *new_name;
979 } in;
980 } rename_information;
982 /* RAW_SFILEINFO_POSITION_INFORMATION interface */
983 struct {
984 enum smb_setfileinfo_level level;
985 struct {
986 union smb_handle_or_path file;
987 uint64_t position;
988 } in;
989 } position_information;
991 /* RAW_SFILEINFO_MODE_INFORMATION interface */
992 struct {
993 enum smb_setfileinfo_level level;
994 struct {
995 union smb_handle_or_path file;
996 /* valid values seem to be 0, 2, 4 and 6 */
997 uint32_t mode;
998 } in;
999 } mode_information;
1003 /* RAW_SFILEINFO_UNIX_BASIC interface */
1004 struct {
1005 enum smb_setfileinfo_level level;
1006 struct {
1007 union smb_handle_or_path file;
1008 uint32_t mode; /* yuck - this field remains to fix compile of libcli/clifile.c */
1009 uint64_t end_of_file;
1010 uint64_t num_bytes;
1011 NTTIME status_change_time;
1012 NTTIME access_time;
1013 NTTIME change_time;
1014 uint64_t uid;
1015 uint64_t gid;
1016 uint32_t file_type;
1017 uint64_t dev_major;
1018 uint64_t dev_minor;
1019 uint64_t unique_id;
1020 uint64_t permissions;
1021 uint64_t nlink;
1022 } in;
1023 } unix_basic;
1025 /* RAW_SFILEINFO_UNIX_LINK, RAW_SFILEINFO_UNIX_HLINK interface */
1026 struct {
1027 enum smb_setfileinfo_level level;
1028 struct {
1029 union smb_handle_or_path file;
1030 const char *link_dest;
1031 } in;
1032 } unix_link, unix_hlink;
1034 /* RAW_FILEINFO_SET_SEC_DESC */
1035 struct {
1036 enum smb_setfileinfo_level level;
1037 struct {
1038 union smb_handle_or_path file;
1039 uint32_t secinfo_flags;
1040 struct security_descriptor *sd;
1041 } in;
1042 } set_secdesc;
1046 enum smb_fsinfo_level {
1047 RAW_QFS_GENERIC = 0xF000,
1048 RAW_QFS_DSKATTR, /* SMBdskattr */
1049 RAW_QFS_ALLOCATION = SMB_QFS_ALLOCATION,
1050 RAW_QFS_VOLUME = SMB_QFS_VOLUME,
1051 RAW_QFS_VOLUME_INFO = SMB_QFS_VOLUME_INFO,
1052 RAW_QFS_SIZE_INFO = SMB_QFS_SIZE_INFO,
1053 RAW_QFS_DEVICE_INFO = SMB_QFS_DEVICE_INFO,
1054 RAW_QFS_ATTRIBUTE_INFO = SMB_QFS_ATTRIBUTE_INFO,
1055 RAW_QFS_UNIX_INFO = SMB_QFS_UNIX_INFO,
1056 RAW_QFS_VOLUME_INFORMATION = SMB_QFS_VOLUME_INFORMATION,
1057 RAW_QFS_SIZE_INFORMATION = SMB_QFS_SIZE_INFORMATION,
1058 RAW_QFS_DEVICE_INFORMATION = SMB_QFS_DEVICE_INFORMATION,
1059 RAW_QFS_ATTRIBUTE_INFORMATION = SMB_QFS_ATTRIBUTE_INFORMATION,
1060 RAW_QFS_QUOTA_INFORMATION = SMB_QFS_QUOTA_INFORMATION,
1061 RAW_QFS_FULL_SIZE_INFORMATION = SMB_QFS_FULL_SIZE_INFORMATION,
1062 RAW_QFS_OBJECTID_INFORMATION = SMB_QFS_OBJECTID_INFORMATION};
1065 /* union for fsinfo() backend call. Note that there are no in
1066 structures, as this call only contains out parameters */
1067 union smb_fsinfo {
1068 /* generic interface */
1069 struct {
1070 enum smb_fsinfo_level level;
1071 struct smb2_handle handle; /* only for smb2 */
1073 struct {
1074 uint32_t block_size;
1075 uint64_t blocks_total;
1076 uint64_t blocks_free;
1077 uint32_t fs_id;
1078 NTTIME create_time;
1079 uint32_t serial_number;
1080 uint32_t fs_attr;
1081 uint32_t max_file_component_length;
1082 uint32_t device_type;
1083 uint32_t device_characteristics;
1084 uint64_t quota_soft;
1085 uint64_t quota_hard;
1086 uint64_t quota_flags;
1087 struct GUID guid;
1088 char *volume_name;
1089 char *fs_type;
1090 } out;
1091 } generic;
1093 /* SMBdskattr interface */
1094 struct {
1095 enum smb_fsinfo_level level;
1097 struct {
1098 uint16_t units_total;
1099 uint16_t blocks_per_unit;
1100 uint16_t block_size;
1101 uint16_t units_free;
1102 } out;
1103 } dskattr;
1105 /* trans2 RAW_QFS_ALLOCATION interface */
1106 struct {
1107 enum smb_fsinfo_level level;
1109 struct {
1110 uint32_t fs_id;
1111 uint32_t sectors_per_unit;
1112 uint32_t total_alloc_units;
1113 uint32_t avail_alloc_units;
1114 uint16_t bytes_per_sector;
1115 } out;
1116 } allocation;
1118 /* TRANS2 RAW_QFS_VOLUME interface */
1119 struct {
1120 enum smb_fsinfo_level level;
1122 struct {
1123 uint32_t serial_number;
1124 struct smb_wire_string volume_name;
1125 } out;
1126 } volume;
1128 /* TRANS2 RAW_QFS_VOLUME_INFO and RAW_QFS_VOLUME_INFORMATION interfaces */
1129 struct {
1130 enum smb_fsinfo_level level;
1131 struct smb2_handle handle; /* only for smb2 */
1133 struct {
1134 NTTIME create_time;
1135 uint32_t serial_number;
1136 struct smb_wire_string volume_name;
1137 } out;
1138 } volume_info;
1140 /* trans2 RAW_QFS_SIZE_INFO and RAW_QFS_SIZE_INFORMATION interfaces */
1141 struct {
1142 enum smb_fsinfo_level level;
1143 struct smb2_handle handle; /* only for smb2 */
1145 struct {
1146 uint64_t total_alloc_units;
1147 uint64_t avail_alloc_units; /* maps to call_avail_alloc_units */
1148 uint32_t sectors_per_unit;
1149 uint32_t bytes_per_sector;
1150 } out;
1151 } size_info;
1153 /* TRANS2 RAW_QFS_DEVICE_INFO and RAW_QFS_DEVICE_INFORMATION interfaces */
1154 struct {
1155 enum smb_fsinfo_level level;
1156 struct smb2_handle handle; /* only for smb2 */
1158 struct {
1159 uint32_t device_type;
1160 uint32_t characteristics;
1161 } out;
1162 } device_info;
1165 /* TRANS2 RAW_QFS_ATTRIBUTE_INFO and RAW_QFS_ATTRIBUTE_INFORMATION interfaces */
1166 struct {
1167 enum smb_fsinfo_level level;
1168 struct smb2_handle handle; /* only for smb2 */
1170 struct {
1171 uint32_t fs_attr;
1172 uint32_t max_file_component_length;
1173 struct smb_wire_string fs_type;
1174 } out;
1175 } attribute_info;
1178 /* TRANS2 RAW_QFS_UNIX_INFO interface */
1179 struct {
1180 enum smb_fsinfo_level level;
1182 struct {
1183 uint16_t major_version;
1184 uint16_t minor_version;
1185 uint64_t capability;
1186 } out;
1187 } unix_info;
1189 /* trans2 RAW_QFS_QUOTA_INFORMATION interface */
1190 struct {
1191 enum smb_fsinfo_level level;
1192 struct smb2_handle handle; /* only for smb2 */
1194 struct {
1195 uint64_t unknown[3];
1196 uint64_t quota_soft;
1197 uint64_t quota_hard;
1198 uint64_t quota_flags;
1199 } out;
1200 } quota_information;
1202 /* trans2 RAW_QFS_FULL_SIZE_INFORMATION interface */
1203 struct {
1204 enum smb_fsinfo_level level;
1205 struct smb2_handle handle; /* only for smb2 */
1207 struct {
1208 uint64_t total_alloc_units;
1209 uint64_t call_avail_alloc_units;
1210 uint64_t actual_avail_alloc_units;
1211 uint32_t sectors_per_unit;
1212 uint32_t bytes_per_sector;
1213 } out;
1214 } full_size_information;
1216 /* trans2 RAW_QFS_OBJECTID_INFORMATION interface */
1217 struct {
1218 enum smb_fsinfo_level level;
1219 struct smb2_handle handle; /* only for smb2 */
1221 struct {
1222 struct GUID guid;
1223 uint64_t unknown[6];
1224 } out;
1225 } objectid_information;
1230 enum smb_open_level {
1231 RAW_OPEN_OPEN,
1232 RAW_OPEN_OPENX,
1233 RAW_OPEN_MKNEW,
1234 RAW_OPEN_CREATE,
1235 RAW_OPEN_CTEMP,
1236 RAW_OPEN_SPLOPEN,
1237 RAW_OPEN_NTCREATEX,
1238 RAW_OPEN_T2OPEN,
1239 RAW_OPEN_NTTRANS_CREATE,
1240 RAW_OPEN_OPENX_READX,
1241 RAW_OPEN_SMB2
1244 /* the generic interface is defined to be equal to the NTCREATEX interface */
1245 #define RAW_OPEN_GENERIC RAW_OPEN_NTCREATEX
1247 /* union for open() backend call */
1248 union smb_open {
1250 * because the *.out.file structs are not aligned to the same offset for each level
1251 * we provide a hepler macro that should be used to find the current smb_handle structure
1253 #define SMB_OPEN_OUT_FILE(op, file) do { \
1254 switch (op->generic.level) { \
1255 case RAW_OPEN_OPEN: \
1256 file = &op->openold.out.file; \
1257 break; \
1258 case RAW_OPEN_OPENX: \
1259 file = &op->openx.out.file; \
1260 break; \
1261 case RAW_OPEN_MKNEW: \
1262 file = &op->mknew.out.file; \
1263 break; \
1264 case RAW_OPEN_CREATE: \
1265 file = &op->create.out.file; \
1266 break; \
1267 case RAW_OPEN_CTEMP: \
1268 file = &op->ctemp.out.file; \
1269 break; \
1270 case RAW_OPEN_SPLOPEN: \
1271 file = &op->splopen.out.file; \
1272 break; \
1273 case RAW_OPEN_NTCREATEX: \
1274 file = &op->ntcreatex.out.file; \
1275 break; \
1276 case RAW_OPEN_T2OPEN: \
1277 file = &op->t2open.out.file; \
1278 break; \
1279 case RAW_OPEN_NTTRANS_CREATE: \
1280 file = &op->nttrans.out.file; \
1281 break; \
1282 case RAW_OPEN_OPENX_READX: \
1283 file = &op->openxreadx.out.file; \
1284 break; \
1285 case RAW_OPEN_SMB2: \
1286 file = &op->smb2.out.file; \
1287 break; \
1288 default: \
1289 /* this must be a programmer error */ \
1290 file = NULL; \
1291 break; \
1293 } while (0)
1294 /* SMBNTCreateX interface */
1295 struct {
1296 enum smb_open_level level;
1297 struct {
1298 uint32_t flags;
1299 uint32_t root_fid;
1300 uint32_t access_mask;
1301 uint64_t alloc_size;
1302 uint32_t file_attr;
1303 uint32_t share_access;
1304 uint32_t open_disposition;
1305 uint32_t create_options;
1306 uint32_t impersonation;
1307 uint8_t security_flags;
1308 /* NOTE: fname can also be a pointer to a
1309 uint64_t file_id if create_options has the
1310 NTCREATEX_OPTIONS_OPEN_BY_FILE_ID flag set */
1311 const char *fname;
1313 /* these last 2 elements are only used in the
1314 NTTRANS varient of the call */
1315 struct security_descriptor *sec_desc;
1316 struct smb_ea_list *ea_list;
1317 } in;
1318 struct {
1319 union smb_handle file;
1320 uint8_t oplock_level;
1321 uint32_t create_action;
1322 NTTIME create_time;
1323 NTTIME access_time;
1324 NTTIME write_time;
1325 NTTIME change_time;
1326 uint32_t attrib;
1327 uint64_t alloc_size;
1328 uint64_t size;
1329 uint16_t file_type;
1330 uint16_t ipc_state;
1331 uint8_t is_directory;
1332 } out;
1333 } ntcreatex, nttrans, generic;
1335 /* TRANS2_OPEN interface */
1336 struct {
1337 enum smb_open_level level;
1338 struct {
1339 uint16_t flags;
1340 uint16_t open_mode;
1341 uint16_t search_attrs;
1342 uint16_t file_attrs;
1343 time_t write_time;
1344 uint16_t open_func;
1345 uint32_t size;
1346 uint32_t timeout;
1347 const char *fname;
1348 uint_t num_eas;
1349 struct ea_struct *eas;
1350 } in;
1351 struct {
1352 union smb_handle file;
1353 uint16_t attrib;
1354 time_t write_time;
1355 uint32_t size;
1356 uint16_t access;
1357 uint16_t ftype;
1358 uint16_t devstate;
1359 uint16_t action;
1360 uint32_t file_id;
1361 } out;
1362 } t2open;
1364 /* SMBopen interface */
1365 struct {
1366 enum smb_open_level level;
1367 struct {
1368 uint16_t open_mode;
1369 uint16_t search_attrs;
1370 const char *fname;
1371 } in;
1372 struct {
1373 union smb_handle file;
1374 uint16_t attrib;
1375 time_t write_time;
1376 uint32_t size;
1377 uint16_t rmode;
1378 } out;
1379 } openold;
1381 /* SMBopenX interface */
1382 struct {
1383 enum smb_open_level level;
1384 struct {
1385 uint16_t flags;
1386 uint16_t open_mode;
1387 uint16_t search_attrs; /* not honoured by win2003 */
1388 uint16_t file_attrs;
1389 time_t write_time; /* not honoured by win2003 */
1390 uint16_t open_func;
1391 uint32_t size; /* note that this sets the
1392 initial file size, not
1393 just allocation size */
1394 uint32_t timeout; /* not honoured by win2003 */
1395 const char *fname;
1396 } in;
1397 struct {
1398 union smb_handle file;
1399 uint16_t attrib;
1400 time_t write_time;
1401 uint32_t size;
1402 uint16_t access;
1403 uint16_t ftype;
1404 uint16_t devstate;
1405 uint16_t action;
1406 uint32_t unique_fid;
1407 uint32_t access_mask;
1408 uint32_t unknown;
1409 } out;
1410 } openx;
1412 /* SMBmknew interface */
1413 struct {
1414 enum smb_open_level level;
1415 struct {
1416 uint16_t attrib;
1417 time_t write_time;
1418 const char *fname;
1419 } in;
1420 struct {
1421 union smb_handle file;
1422 } out;
1423 } mknew, create;
1425 /* SMBctemp interface */
1426 struct {
1427 enum smb_open_level level;
1428 struct {
1429 uint16_t attrib;
1430 time_t write_time;
1431 const char *directory;
1432 } in;
1433 struct {
1434 union smb_handle file;
1435 /* temp name, relative to directory */
1436 char *name;
1437 } out;
1438 } ctemp;
1440 /* SMBsplopen interface */
1441 struct {
1442 enum smb_open_level level;
1443 struct {
1444 uint16_t setup_length;
1445 uint16_t mode;
1446 const char *ident;
1447 } in;
1448 struct {
1449 union smb_handle file;
1450 } out;
1451 } splopen;
1454 /* chained OpenX/ReadX interface */
1455 struct {
1456 enum smb_open_level level;
1457 struct {
1458 uint16_t flags;
1459 uint16_t open_mode;
1460 uint16_t search_attrs; /* not honoured by win2003 */
1461 uint16_t file_attrs;
1462 time_t write_time; /* not honoured by win2003 */
1463 uint16_t open_func;
1464 uint32_t size; /* note that this sets the
1465 initial file size, not
1466 just allocation size */
1467 uint32_t timeout; /* not honoured by win2003 */
1468 const char *fname;
1470 /* readx part */
1471 uint64_t offset;
1472 uint16_t mincnt;
1473 uint32_t maxcnt;
1474 uint16_t remaining;
1475 } in;
1476 struct {
1477 union smb_handle file;
1478 uint16_t attrib;
1479 time_t write_time;
1480 uint32_t size;
1481 uint16_t access;
1482 uint16_t ftype;
1483 uint16_t devstate;
1484 uint16_t action;
1485 uint32_t unique_fid;
1486 uint32_t access_mask;
1487 uint32_t unknown;
1489 /* readx part */
1490 uint8_t *data;
1491 uint16_t remaining;
1492 uint16_t compaction_mode;
1493 uint16_t nread;
1494 } out;
1495 } openxreadx;
1497 #define SMB2_CREATE_FLAG_REQUEST_OPLOCK 0x0100
1498 #define SMB2_CREATE_FLAG_REQUEST_EXCLUSIVE_OPLOCK 0x0800
1499 #define SMB2_CREATE_FLAG_GRANT_OPLOCK 0x0001
1500 #define SMB2_CREATE_FLAG_GRANT_EXCLUSIVE_OPLOCK 0x0080
1502 /* SMB2 Create */
1503 struct smb2_create {
1504 enum smb_open_level level;
1505 struct {
1506 /* static body buffer 56 (0x38) bytes */
1507 /* uint16_t buffer_code; 0x39 = 0x38 + 1 */
1508 uint16_t oplock_flags; /* SMB2_CREATE_FLAG_* */
1509 uint32_t impersonation;
1510 uint32_t unknown3[4];
1511 uint32_t access_mask;
1513 uint32_t file_attr;
1514 uint32_t share_access;
1515 uint32_t open_disposition;
1516 uint32_t create_options;
1518 /* uint16_t fname_ofs */
1519 /* uint16_t fname_size */
1520 /* uint32_t blob_ofs; */
1521 /* uint32_t blob_size; */
1523 /* dynamic body */
1524 const char *fname;
1526 /* optional list of extended attributes */
1527 struct smb_ea_list eas;
1528 } in;
1529 struct {
1530 union smb_handle file;
1532 /* static body buffer 88 (0x58) bytes */
1533 /* uint16_t buffer_code; 0x59 = 0x58 + 1 */
1534 uint16_t oplock_flags; /* SMB2_CREATE_FLAG_* */
1535 uint32_t create_action;
1536 NTTIME create_time;
1537 NTTIME access_time;
1538 NTTIME write_time;
1539 NTTIME change_time;
1540 uint64_t alloc_size;
1541 uint64_t size;
1542 uint32_t file_attr;
1543 uint32_t _pad;
1544 /* struct smb2_handle handle;*/
1545 /* uint32_t blob_ofs; */
1546 /* uint32_t blob_size; */
1548 /* dynamic body */
1549 DATA_BLOB blob;
1550 } out;
1551 } smb2;
1556 enum smb_read_level {
1557 RAW_READ_READBRAW,
1558 RAW_READ_LOCKREAD,
1559 RAW_READ_READ,
1560 RAW_READ_READX,
1561 RAW_READ_SMB2
1564 #define RAW_READ_GENERIC RAW_READ_READX
1566 /* union for read() backend call
1568 note that .infoX.out.data will be allocated before the backend is
1569 called. It will be big enough to hold the maximum size asked for
1571 union smb_read {
1572 /* SMBreadX (and generic) interface */
1573 struct {
1574 enum smb_read_level level;
1575 struct {
1576 union smb_handle file;
1577 uint64_t offset;
1578 uint16_t mincnt;
1579 uint32_t maxcnt;
1580 uint16_t remaining;
1581 BOOL read_for_execute;
1582 } in;
1583 struct {
1584 uint8_t *data;
1585 uint16_t remaining;
1586 uint16_t compaction_mode;
1587 uint16_t nread;
1588 } out;
1589 } readx, generic;
1591 /* SMBreadbraw interface */
1592 struct {
1593 enum smb_read_level level;
1594 struct {
1595 union smb_handle file;
1596 uint64_t offset;
1597 uint16_t maxcnt;
1598 uint16_t mincnt;
1599 uint32_t timeout;
1600 } in;
1601 struct {
1602 uint8_t *data;
1603 uint32_t nread;
1604 } out;
1605 } readbraw;
1608 /* SMBlockandread interface */
1609 struct {
1610 enum smb_read_level level;
1611 struct {
1612 union smb_handle file;
1613 uint16_t count;
1614 uint32_t offset;
1615 uint16_t remaining;
1616 } in;
1617 struct {
1618 uint8_t *data;
1619 uint16_t nread;
1620 } out;
1621 } lockread;
1623 /* SMBread interface */
1624 struct {
1625 enum smb_read_level level;
1626 struct {
1627 union smb_handle file;
1628 uint16_t count;
1629 uint32_t offset;
1630 uint16_t remaining;
1631 } in;
1632 struct {
1633 uint8_t *data;
1634 uint16_t nread;
1635 } out;
1636 } read;
1638 /* SMB2 Read */
1639 struct smb2_read {
1640 enum smb_read_level level;
1641 struct {
1642 union smb_handle file;
1644 /* static body buffer 48 (0x30) bytes */
1645 /* uint16_t buffer_code; 0x31 = 0x30 + 1 */
1646 uint16_t _pad;
1647 uint32_t length;
1648 uint64_t offset;
1649 /* struct smb2_handle handle; */
1650 uint64_t unknown1; /* 0x0000000000000000 */
1651 uint64_t unknown2; /* 0x0000000000000000 */
1652 uint8_t _bug;
1653 } in;
1654 struct {
1655 /* static body buffer 16 (0x10) bytes */
1656 /* uint16_t buffer_code; 0x11 = 0x10 + 1 */
1657 /* uint16_t data_ofs; */
1658 /* uint32_t data_size; */
1659 uint64_t unknown1; /* 0x0000000000000000 */
1661 /* dynamic body */
1662 DATA_BLOB data;
1663 } out;
1664 } smb2;
1668 enum smb_write_level {
1669 RAW_WRITE_WRITEUNLOCK,
1670 RAW_WRITE_WRITE,
1671 RAW_WRITE_WRITEX,
1672 RAW_WRITE_WRITECLOSE,
1673 RAW_WRITE_SPLWRITE,
1674 RAW_WRITE_SMB2
1677 #define RAW_WRITE_GENERIC RAW_WRITE_WRITEX
1679 /* union for write() backend call
1681 union smb_write {
1682 /* SMBwriteX interface */
1683 struct {
1684 enum smb_write_level level;
1685 struct {
1686 union smb_handle file;
1687 uint64_t offset;
1688 uint16_t wmode;
1689 uint16_t remaining;
1690 uint32_t count;
1691 const uint8_t *data;
1692 } in;
1693 struct {
1694 uint32_t nwritten;
1695 uint16_t remaining;
1696 } out;
1697 } writex, generic;
1699 /* SMBwriteunlock interface */
1700 struct {
1701 enum smb_write_level level;
1702 struct {
1703 union smb_handle file;
1704 uint16_t count;
1705 uint32_t offset;
1706 uint16_t remaining;
1707 const uint8_t *data;
1708 } in;
1709 struct {
1710 uint32_t nwritten;
1711 } out;
1712 } writeunlock;
1714 /* SMBwrite interface */
1715 struct {
1716 enum smb_write_level level;
1717 struct {
1718 union smb_handle file;
1719 uint16_t count;
1720 uint32_t offset;
1721 uint16_t remaining;
1722 const uint8_t *data;
1723 } in;
1724 struct {
1725 uint16_t nwritten;
1726 } out;
1727 } write;
1729 /* SMBwriteclose interface */
1730 struct {
1731 enum smb_write_level level;
1732 struct {
1733 union smb_handle file;
1734 uint16_t count;
1735 uint32_t offset;
1736 time_t mtime;
1737 const uint8_t *data;
1738 } in;
1739 struct {
1740 uint16_t nwritten;
1741 } out;
1742 } writeclose;
1744 /* SMBsplwrite interface */
1745 struct {
1746 enum smb_write_level level;
1747 struct {
1748 union smb_handle file;
1749 uint16_t count;
1750 const uint8_t *data;
1751 } in;
1752 } splwrite;
1754 /* SMB2 Write */
1755 struct smb2_write {
1756 enum smb_write_level level;
1757 struct {
1758 union smb_handle file;
1760 /* static body buffer 48 (0x30) bytes */
1761 /* uint16_t buffer_code; 0x31 = 0x30 + 1 */
1762 /* uint16_t data_ofs; */
1763 /* uint32_t data_size; */
1764 uint64_t offset;
1765 /* struct smb2_handle handle; */
1766 uint64_t unknown1; /* 0xFFFFFFFFFFFFFFFF */
1767 uint64_t unknown2; /* 0xFFFFFFFFFFFFFFFF */
1769 /* dynamic body */
1770 DATA_BLOB data;
1771 } in;
1772 struct {
1773 /* static body buffer 17 (0x11) bytes */
1774 /* uint16_t buffer_code; 0x11 */
1775 uint16_t _pad;
1776 uint32_t nwritten;
1777 uint64_t unknown1; /* 0x0000000000000000 */
1778 uint8_t _bug;
1779 } out;
1780 } smb2;
1784 enum smb_lock_level {
1785 RAW_LOCK_LOCK,
1786 RAW_LOCK_UNLOCK,
1787 RAW_LOCK_LOCKX,
1788 RAW_LOCK_SMB2
1791 /* the generic interface is defined to be equal to the lockingX interface */
1792 #define RAW_LOCK_GENERIC RAW_LOCK_LOCKX
1794 /* union for lock() backend call
1796 union smb_lock {
1797 /* SMBlockingX (and generic) interface */
1798 struct {
1799 enum smb_lock_level level;
1800 struct {
1801 union smb_handle file;
1802 uint16_t mode;
1803 uint32_t timeout;
1804 uint16_t ulock_cnt;
1805 uint16_t lock_cnt;
1806 struct smb_lock_entry {
1807 uint16_t pid;
1808 uint64_t offset;
1809 uint64_t count;
1810 } *locks; /* unlocks are first in the arrray */
1811 } in;
1812 } lockx, generic;
1814 /* SMBlock and SMBunlock interface */
1815 struct {
1816 enum smb_lock_level level;
1817 struct {
1818 union smb_handle file;
1819 uint32_t count;
1820 uint32_t offset;
1821 } in;
1822 } lock, unlock;
1824 /* SMB2 Lock */
1825 struct smb2_lock {
1826 enum smb_lock_level level;
1827 struct {
1828 union smb_handle file;
1830 /* static body buffer 48 (0x30) bytes */
1831 /* uint16_t buffer_code; 0x30 */
1832 uint16_t unknown1; /* must be 0x0001 */
1833 uint32_t unknown2;
1834 /* struct smb2_handle handle; */
1835 uint64_t offset;
1836 uint64_t count;
1837 uint32_t unknown5;
1838 #define SMB2_LOCK_FLAG_NONE 0x00000000
1839 #define SMB2_LOCK_FLAG_EXCLUSIV 0x00000002
1840 #define SMB2_LOCK_FLAG_UNLOCK 0x00000004
1841 #define SMB2_LOCK_FLAGS_MASK 0x00000006
1842 uint32_t flags;
1843 } in;
1844 struct {
1845 /* static body buffer 4 (0x04) bytes */
1846 /* uint16_t buffer_code; 0x04 */
1847 uint16_t unknown1;
1848 } out;
1849 } smb2;
1853 enum smb_close_level {
1854 RAW_CLOSE_CLOSE,
1855 RAW_CLOSE_SPLCLOSE,
1856 RAW_CLOSE_SMB2
1859 #define RAW_CLOSE_GENERIC RAW_CLOSE_CLOSE
1862 union for close() backend call
1864 union smb_close {
1865 /* SMBclose (and generic) interface */
1866 struct {
1867 enum smb_close_level level;
1868 struct {
1869 union smb_handle file;
1870 time_t write_time;
1871 } in;
1872 } close, generic;
1874 /* SMBsplclose interface - empty! */
1875 struct {
1876 enum smb_close_level level;
1877 struct {
1878 union smb_handle file;
1879 } in;
1880 } splclose;
1882 /* SMB2 Close */
1883 struct smb2_close {
1884 enum smb_close_level level;
1885 struct {
1886 union smb_handle file;
1888 /* static body buffer 24 (0x18) bytes */
1889 /* uint16_t buffer_code; 0x18 */
1890 #define SMB2_CLOSE_FLAGS_FULL_INFORMATION (1<<0)
1891 uint16_t flags; /* SMB2_CLOSE_FLAGS_* */
1892 uint32_t _pad;
1893 } in;
1894 struct {
1895 /* static body buffer 60 (0x3C) bytes */
1896 /* uint16_t buffer_code; 0x3C */
1897 uint16_t flags;
1898 uint32_t _pad;
1899 NTTIME create_time;
1900 NTTIME access_time;
1901 NTTIME write_time;
1902 NTTIME change_time;
1903 uint64_t alloc_size;
1904 uint64_t size;
1905 uint32_t file_attr;
1906 } out;
1907 } smb2;
1911 enum smb_lpq_level {RAW_LPQ_GENERIC, RAW_LPQ_RETQ};
1914 union for lpq() backend
1916 union smb_lpq {
1917 /* generic interface */
1918 struct {
1919 enum smb_lpq_level level;
1921 } generic;
1924 /* SMBsplretq interface */
1925 struct {
1926 enum smb_lpq_level level;
1928 struct {
1929 uint16_t maxcount;
1930 uint16_t startidx;
1931 } in;
1932 struct {
1933 uint16_t count;
1934 uint16_t restart_idx;
1935 struct {
1936 time_t time;
1937 uint8_t status;
1938 uint16_t job;
1939 uint32_t size;
1940 char *user;
1941 } *queue;
1942 } out;
1943 } retq;
1946 enum smb_ioctl_level {
1947 RAW_IOCTL_IOCTL,
1948 RAW_IOCTL_NTIOCTL,
1949 RAW_IOCTL_SMB2
1953 union for ioctl() backend
1955 union smb_ioctl {
1956 /* generic interface */
1957 struct {
1958 enum smb_ioctl_level level;
1959 struct {
1960 union smb_handle file;
1961 } in;
1962 } generic;
1964 /* struct for SMBioctl */
1965 struct {
1966 enum smb_ioctl_level level;
1967 struct {
1968 union smb_handle file;
1969 uint32_t request;
1970 } in;
1971 struct {
1972 DATA_BLOB blob;
1973 } out;
1974 } ioctl;
1977 /* struct for NT ioctl call */
1978 struct {
1979 enum smb_ioctl_level level;
1980 struct {
1981 union smb_handle file;
1982 uint32_t function;
1983 BOOL fsctl;
1984 uint8_t filter;
1985 uint32_t max_data;
1986 DATA_BLOB blob;
1987 } in;
1988 struct {
1989 DATA_BLOB blob;
1990 } out;
1991 } ntioctl;
1993 /* SMB2 Ioctl */
1994 struct smb2_ioctl {
1995 enum smb_ioctl_level level;
1996 struct {
1997 union smb_handle file;
1999 /* static body buffer 56 (0x38) bytes */
2000 /* uint16_t buffer_code; 0x39 = 0x38 + 1 */
2001 uint16_t _pad;
2002 uint32_t function;
2003 /*struct smb2_handle handle;*/
2004 /* uint32_t out_ofs; */
2005 /* uint32_t out_size; */
2006 uint32_t unknown2;
2007 /* uint32_t in_ofs; */
2008 /* uint32_t in_size; */
2009 uint32_t max_response_size;
2010 uint64_t flags;
2012 /* dynamic body */
2013 DATA_BLOB out;
2014 DATA_BLOB in;
2015 } in;
2016 struct {
2017 union smb_handle file;
2019 /* static body buffer 48 (0x30) bytes */
2020 /* uint16_t buffer_code; 0x31 = 0x30 + 1 */
2021 uint16_t _pad;
2022 uint32_t function;
2023 /* struct smb2_handle handle; */
2024 /* uint32_t in_ofs; */
2025 /* uint32_t in_size; */
2026 /* uint32_t out_ofs; */
2027 /* uint32_t out_size; */
2028 uint32_t unknown2;
2029 uint32_t unknown3;
2031 /* dynamic body */
2032 DATA_BLOB in;
2033 DATA_BLOB out;
2034 } out;
2035 } smb2;
2038 enum smb_flush_level {
2039 RAW_FLUSH_FLUSH,
2040 RAW_FLUSH_ALL,
2041 RAW_FLUSH_SMB2
2044 union smb_flush {
2045 /* struct for SMBflush */
2046 struct {
2047 enum smb_flush_level level;
2048 struct {
2049 union smb_handle file;
2050 } in;
2051 } flush, generic;
2053 /* SMBflush with 0xFFFF wildcard fnum */
2054 struct {
2055 enum smb_flush_level level;
2056 } flush_all;
2058 /* SMB2 Flush */
2059 struct smb2_flush {
2060 enum smb_flush_level level;
2061 struct {
2062 union smb_handle file;
2063 uint32_t unknown;
2064 } in;
2065 } smb2;
2068 /* struct for SMBcopy */
2069 struct smb_copy {
2070 struct {
2071 uint16_t tid2;
2072 uint16_t ofun;
2073 uint16_t flags;
2074 const char *path1;
2075 const char *path2;
2076 } in;
2077 struct {
2078 uint16_t count;
2079 } out;
2083 /* struct for transact/transact2 call */
2084 struct smb_trans2 {
2085 struct {
2086 uint16_t max_param;
2087 uint16_t max_data;
2088 uint8_t max_setup;
2089 uint16_t flags;
2090 uint32_t timeout;
2091 uint8_t setup_count;
2092 uint16_t *setup;
2093 const char *trans_name; /* SMBtrans only */
2094 DATA_BLOB params;
2095 DATA_BLOB data;
2096 } in;
2098 struct {
2099 uint8_t setup_count;
2100 uint16_t *setup;
2101 DATA_BLOB params;
2102 DATA_BLOB data;
2103 } out;
2106 /* struct for nttransact2 call */
2107 struct smb_nttrans {
2108 struct {
2109 uint8_t max_setup;
2110 uint32_t max_param;
2111 uint32_t max_data;
2112 uint32_t setup_count;
2113 uint16_t function;
2114 uint16_t *setup;
2115 DATA_BLOB params;
2116 DATA_BLOB data;
2117 } in;
2119 struct {
2120 uint8_t setup_count;
2121 uint16_t *setup;
2122 DATA_BLOB params;
2123 DATA_BLOB data;
2124 } out;
2128 /* struct for nttrans change notify call */
2129 struct smb_notify {
2130 struct {
2131 union smb_handle file;
2132 uint32_t buffer_size;
2133 uint32_t completion_filter;
2134 BOOL recursive;
2135 } in;
2137 struct {
2138 uint32_t num_changes;
2139 struct notify_changes {
2140 uint32_t action;
2141 struct smb_wire_string name;
2142 } *changes;
2143 } out;
2146 enum smb_search_level {RAW_SEARCH_GENERIC = 0xF000,
2147 RAW_SEARCH_SEARCH, /* SMBsearch */
2148 RAW_SEARCH_FFIRST, /* SMBffirst */
2149 RAW_SEARCH_FUNIQUE, /* SMBfunique */
2150 RAW_SEARCH_SMB2, /* SMB2 Find */
2151 RAW_SEARCH_STANDARD = SMB_FIND_STANDARD,
2152 RAW_SEARCH_EA_SIZE = SMB_FIND_EA_SIZE,
2153 RAW_SEARCH_EA_LIST = SMB_FIND_EA_LIST,
2154 RAW_SEARCH_DIRECTORY_INFO = SMB_FIND_DIRECTORY_INFO,
2155 RAW_SEARCH_FULL_DIRECTORY_INFO = SMB_FIND_FULL_DIRECTORY_INFO,
2156 RAW_SEARCH_NAME_INFO = SMB_FIND_NAME_INFO,
2157 RAW_SEARCH_BOTH_DIRECTORY_INFO = SMB_FIND_BOTH_DIRECTORY_INFO,
2158 RAW_SEARCH_ID_FULL_DIRECTORY_INFO = SMB_FIND_ID_FULL_DIRECTORY_INFO,
2159 RAW_SEARCH_ID_BOTH_DIRECTORY_INFO = SMB_FIND_ID_BOTH_DIRECTORY_INFO,
2160 RAW_SEARCH_UNIX_INFO = SMB_FIND_UNIX_INFO};
2163 /* union for file search */
2164 union smb_search_first {
2165 struct {
2166 enum smb_search_level level;
2167 } generic;
2169 /* search (old) findfirst interface.
2170 Also used for ffirst and funique. */
2171 struct {
2172 enum smb_search_level level;
2174 struct {
2175 uint16_t max_count;
2176 uint16_t search_attrib;
2177 const char *pattern;
2178 } in;
2179 struct {
2180 int16_t count;
2181 } out;
2182 } search_first;
2184 /* trans2 findfirst interface */
2185 struct {
2186 enum smb_search_level level;
2188 struct {
2189 uint16_t search_attrib;
2190 uint16_t max_count;
2191 uint16_t flags;
2192 uint32_t storage_type;
2193 const char *pattern;
2195 /* the ea names are only used for RAW_SEARCH_EA_LIST */
2196 uint_t num_names;
2197 struct ea_name *ea_names;
2198 } in;
2199 struct {
2200 uint16_t handle;
2201 uint16_t count;
2202 uint16_t end_of_search;
2203 } out;
2204 } t2ffirst;
2207 SMB2 uses different level numbers for the same old SMB search levels
2209 #define SMB2_FIND_DIRECTORY_INFO 0x01
2210 #define SMB2_FIND_FULL_DIRECTORY_INFO 0x02
2211 #define SMB2_FIND_BOTH_DIRECTORY_INFO 0x03
2212 #define SMB2_FIND_NAME_INFO 0x0C
2213 #define SMB2_FIND_ID_BOTH_DIRECTORY_INFO 0x25
2214 #define SMB2_FIND_ID_FULL_DIRECTORY_INFO 0x26
2215 /* SMB2 Find */
2216 struct smb2_find {
2217 enum smb_search_level level;
2218 struct {
2219 union smb_handle file;
2221 /* static body buffer 32 (0x20) bytes */
2222 /* uint16_t buffer_code; 0x21 = 0x20 + 1 */
2223 uint8_t level;
2224 uint8_t continue_flags; /* SMB2_CONTINUE_FLAG_* */
2225 uint32_t unknown; /* perhaps a continue token? */
2226 /* struct smb2_handle handle; */
2227 /* uint16_t pattern_ofs; */
2228 /* uint32_t pattern_size; */
2229 uint32_t max_response_size;
2231 /* dynamic body */
2232 const char *pattern;
2233 } in;
2234 struct {
2235 /* static body buffer 8 (0x08) bytes */
2236 /* uint16_t buffer_code; 0x08 */
2237 /* uint16_t blob_ofs; */
2238 /* uint32_t blob_size; */
2240 /* dynamic body */
2241 DATA_BLOB blob;
2242 } out;
2243 } smb2;
2246 /* union for file search continue */
2247 union smb_search_next {
2248 struct {
2249 enum smb_search_level level;
2250 } generic;
2252 /* search (old) findnext interface. Also used
2253 for ffirst when continuing */
2254 struct {
2255 enum smb_search_level level;
2257 struct {
2258 uint16_t max_count;
2259 uint16_t search_attrib;
2260 struct smb_search_id {
2261 uint8_t reserved;
2262 char name[11];
2263 uint8_t handle;
2264 uint32_t server_cookie;
2265 uint32_t client_cookie;
2266 } id;
2267 } in;
2268 struct {
2269 uint16_t count;
2270 } out;
2271 } search_next;
2273 /* trans2 findnext interface */
2274 struct {
2275 enum smb_search_level level;
2277 struct {
2278 uint16_t handle;
2279 uint16_t max_count;
2280 uint32_t resume_key;
2281 uint16_t flags;
2282 const char *last_name;
2284 /* the ea names are only used for RAW_SEARCH_EA_LIST */
2285 uint_t num_names;
2286 struct ea_name *ea_names;
2287 } in;
2288 struct {
2289 uint16_t count;
2290 uint16_t end_of_search;
2291 } out;
2292 } t2fnext;
2295 /* union for search reply file data */
2296 union smb_search_data {
2297 /* search (old) findfirst */
2298 struct {
2299 uint16_t attrib;
2300 time_t write_time;
2301 uint32_t size;
2302 struct smb_search_id id;
2303 const char *name;
2304 } search;
2306 /* trans2 findfirst RAW_SEARCH_STANDARD level */
2307 struct {
2308 uint32_t resume_key;
2309 time_t create_time;
2310 time_t access_time;
2311 time_t write_time;
2312 uint32_t size;
2313 uint32_t alloc_size;
2314 uint16_t attrib;
2315 struct smb_wire_string name;
2316 } standard;
2318 /* trans2 findfirst RAW_SEARCH_EA_SIZE level */
2319 struct {
2320 uint32_t resume_key;
2321 time_t create_time;
2322 time_t access_time;
2323 time_t write_time;
2324 uint32_t size;
2325 uint32_t alloc_size;
2326 uint16_t attrib;
2327 uint32_t ea_size;
2328 struct smb_wire_string name;
2329 } ea_size;
2331 /* trans2 findfirst RAW_SEARCH_EA_LIST level */
2332 struct {
2333 uint32_t resume_key;
2334 time_t create_time;
2335 time_t access_time;
2336 time_t write_time;
2337 uint32_t size;
2338 uint32_t alloc_size;
2339 uint16_t attrib;
2340 struct smb_ea_list eas;
2341 struct smb_wire_string name;
2342 } ea_list;
2344 /* RAW_SEARCH_DIRECTORY_INFO interface */
2345 struct {
2346 uint32_t file_index;
2347 NTTIME create_time;
2348 NTTIME access_time;
2349 NTTIME write_time;
2350 NTTIME change_time;
2351 uint64_t size;
2352 uint64_t alloc_size;
2353 uint32_t attrib;
2354 struct smb_wire_string name;
2355 } directory_info;
2357 /* RAW_SEARCH_FULL_DIRECTORY_INFO interface */
2358 struct {
2359 uint32_t file_index;
2360 NTTIME create_time;
2361 NTTIME access_time;
2362 NTTIME write_time;
2363 NTTIME change_time;
2364 uint64_t size;
2365 uint64_t alloc_size;
2366 uint32_t attrib;
2367 uint32_t ea_size;
2368 struct smb_wire_string name;
2369 } full_directory_info;
2371 /* RAW_SEARCH_NAME_INFO interface */
2372 struct {
2373 uint32_t file_index;
2374 struct smb_wire_string name;
2375 } name_info;
2377 /* RAW_SEARCH_BOTH_DIRECTORY_INFO interface */
2378 struct {
2379 uint32_t file_index;
2380 NTTIME create_time;
2381 NTTIME access_time;
2382 NTTIME write_time;
2383 NTTIME change_time;
2384 uint64_t size;
2385 uint64_t alloc_size;
2386 uint32_t attrib;
2387 uint32_t ea_size;
2388 struct smb_wire_string short_name;
2389 struct smb_wire_string name;
2390 } both_directory_info;
2392 /* RAW_SEARCH_ID_FULL_DIRECTORY_INFO interface */
2393 struct {
2394 uint32_t file_index;
2395 NTTIME create_time;
2396 NTTIME access_time;
2397 NTTIME write_time;
2398 NTTIME change_time;
2399 uint64_t size;
2400 uint64_t alloc_size;
2401 uint32_t attrib;
2402 uint32_t ea_size;
2403 uint64_t file_id;
2404 struct smb_wire_string name;
2405 } id_full_directory_info;
2407 /* RAW_SEARCH_ID_BOTH_DIRECTORY_INFO interface */
2408 struct {
2409 uint32_t file_index;
2410 NTTIME create_time;
2411 NTTIME access_time;
2412 NTTIME write_time;
2413 NTTIME change_time;
2414 uint64_t size;
2415 uint64_t alloc_size;
2416 uint32_t attrib;
2417 uint32_t ea_size;
2418 uint64_t file_id;
2419 struct smb_wire_string short_name;
2420 struct smb_wire_string name;
2421 } id_both_directory_info;
2423 /* RAW_SEARCH_UNIX_INFO interface */
2424 struct {
2425 uint32_t file_index;
2426 uint64_t size;
2427 uint64_t alloc_size;
2428 NTTIME status_change_time;
2429 NTTIME access_time;
2430 NTTIME change_time;
2431 uint64_t uid;
2432 uint64_t gid;
2433 uint32_t file_type;
2434 uint64_t dev_major;
2435 uint64_t dev_minor;
2436 uint64_t unique_id;
2437 uint64_t permissions;
2438 uint64_t nlink;
2439 const char *name;
2440 } unix_info;
2444 enum smb_search_close_level {RAW_FINDCLOSE_GENERIC, RAW_FINDCLOSE_FCLOSE, RAW_FINDCLOSE_FINDCLOSE};
2446 /* union for file search close */
2447 union smb_search_close {
2448 struct {
2449 enum smb_search_close_level level;
2450 } generic;
2452 /* SMBfclose (old search) interface */
2453 struct {
2454 enum smb_search_close_level level;
2456 struct {
2457 /* max_count and search_attrib are not used, but are present */
2458 uint16_t max_count;
2459 uint16_t search_attrib;
2460 struct smb_search_id id;
2461 } in;
2462 } fclose;
2464 /* SMBfindclose interface */
2465 struct {
2466 enum smb_search_close_level level;
2468 struct {
2469 uint16_t handle;
2470 } in;
2471 } findclose;
2474 #endif /* __LIBCLI_RAW_INTERFACES_H__ */