xref: /freebsd/sys/netsmb/smb.h (revision c398230b64aea809cb7c5cea8db580af7097920c)
1c398230bSWarner Losh /*-
2681a5bbeSBoris Popov  * Copyright (c) 2000-2001 Boris Popov
3681a5bbeSBoris Popov  * All rights reserved.
4681a5bbeSBoris Popov  *
5681a5bbeSBoris Popov  * Redistribution and use in source and binary forms, with or without
6681a5bbeSBoris Popov  * modification, are permitted provided that the following conditions
7681a5bbeSBoris Popov  * are met:
8681a5bbeSBoris Popov  * 1. Redistributions of source code must retain the above copyright
9681a5bbeSBoris Popov  *    notice, this list of conditions and the following disclaimer.
10681a5bbeSBoris Popov  * 2. Redistributions in binary form must reproduce the above copyright
11681a5bbeSBoris Popov  *    notice, this list of conditions and the following disclaimer in the
12681a5bbeSBoris Popov  *    documentation and/or other materials provided with the distribution.
13681a5bbeSBoris Popov  * 3. All advertising materials mentioning features or use of this software
14681a5bbeSBoris Popov  *    must display the following acknowledgement:
15681a5bbeSBoris Popov  *    This product includes software developed by Boris Popov.
16681a5bbeSBoris Popov  * 4. Neither the name of the author nor the names of any co-contributors
17681a5bbeSBoris Popov  *    may be used to endorse or promote products derived from this software
18681a5bbeSBoris Popov  *    without specific prior written permission.
19681a5bbeSBoris Popov  *
20681a5bbeSBoris Popov  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
21681a5bbeSBoris Popov  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22681a5bbeSBoris Popov  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23681a5bbeSBoris Popov  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
24681a5bbeSBoris Popov  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25681a5bbeSBoris Popov  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26681a5bbeSBoris Popov  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27681a5bbeSBoris Popov  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28681a5bbeSBoris Popov  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29681a5bbeSBoris Popov  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30681a5bbeSBoris Popov  * SUCH DAMAGE.
31681a5bbeSBoris Popov  *
32681a5bbeSBoris Popov  * $FreeBSD$
33681a5bbeSBoris Popov  */
34681a5bbeSBoris Popov 
35681a5bbeSBoris Popov /*
36fc75194cSBoris Popov  * Common definitions and structures for SMB/CIFS protocol
37681a5bbeSBoris Popov  */
38681a5bbeSBoris Popov 
39681a5bbeSBoris Popov #ifndef _NETSMB_SMB_H_
40681a5bbeSBoris Popov #define _NETSMB_SMB_H_
41681a5bbeSBoris Popov 
42681a5bbeSBoris Popov #define	SMB_TCP_PORT	139
43681a5bbeSBoris Popov /*
44681a5bbeSBoris Popov  * SMB dialects that we have to deal with.
45681a5bbeSBoris Popov  */
46681a5bbeSBoris Popov enum smb_dialects {
47681a5bbeSBoris Popov 	SMB_DIALECT_NONE,
48681a5bbeSBoris Popov 	SMB_DIALECT_CORE,		/* PC NETWORK PROGRAM 1.0, PCLAN1.0 */
49681a5bbeSBoris Popov 	SMB_DIALECT_COREPLUS,		/* MICROSOFT NETWORKS 1.03 */
50681a5bbeSBoris Popov 	SMB_DIALECT_LANMAN1_0,		/* MICROSOFT NETWORKS 3.0, LANMAN1.0 */
51681a5bbeSBoris Popov 	SMB_DIALECT_LANMAN2_0,		/* LM1.2X002, DOS LM1.2X002, Samba */
52681a5bbeSBoris Popov 	SMB_DIALECT_LANMAN2_1,		/* DOS LANMAN2.1, LANMAN2.1 */
53681a5bbeSBoris Popov 	SMB_DIALECT_NTLM0_12		/* NT LM 0.12, Windows for Workgroups 3.1a,
54681a5bbeSBoris Popov 					 * NT LANMAN 1.0 */
55681a5bbeSBoris Popov };
56681a5bbeSBoris Popov 
57681a5bbeSBoris Popov /*
58681a5bbeSBoris Popov  * Formats of data/string buffers
59681a5bbeSBoris Popov  */
60681a5bbeSBoris Popov #define	SMB_DT_DATA		1
61681a5bbeSBoris Popov #define	SMB_DT_DIALECT		2
62681a5bbeSBoris Popov #define	SMB_DT_PATHNAME		3
63681a5bbeSBoris Popov #define	SMB_DT_ASCII		4
64681a5bbeSBoris Popov #define	SMB_DT_VARIABLE		5
65681a5bbeSBoris Popov 
66681a5bbeSBoris Popov /*
67681a5bbeSBoris Popov  * SMB header
68681a5bbeSBoris Popov  */
69681a5bbeSBoris Popov #define	SMB_SIGNATURE		"\xFFSMB"
70681a5bbeSBoris Popov #define	SMB_SIGLEN		4
710adb6d7aSRobert Drehmel #define	SMB_HDRMID(p)		(le16toh(*(u_short*)((u_char*)(p) + 30)))
72681a5bbeSBoris Popov #define	SMB_HDRLEN		32
73681a5bbeSBoris Popov /*
74681a5bbeSBoris Popov  * bits in the smb_flags field
75681a5bbeSBoris Popov  */
76681a5bbeSBoris Popov #define	SMB_FLAGS_CASELESS	0x08
77681a5bbeSBoris Popov #define SMB_FLAGS_SERVER_RESP	0x80	/* indicates a response */
78681a5bbeSBoris Popov 
79681a5bbeSBoris Popov /*
80681a5bbeSBoris Popov  * bits in the smb_flags2 field
81681a5bbeSBoris Popov  */
82681a5bbeSBoris Popov #define	SMB_FLAGS2_KNOWS_LONG_NAMES	0x0001
83681a5bbeSBoris Popov #define	SMB_FLAGS2_KNOWS_EAS		0x0002	/* client know about EAs */
84681a5bbeSBoris Popov #define	SMB_FLAGS2_SECURITY_SIGNATURE	0x0004	/* check SMB integrity */
85681a5bbeSBoris Popov #define	SMB_FLAGS2_IS_LONG_NAME		0x0040	/* any path name is a long name */
86681a5bbeSBoris Popov #define	SMB_FLAGS2_EXT_SEC		0x0800	/* client aware of Extended
87681a5bbeSBoris Popov 						 * Security negotiation */
88681a5bbeSBoris Popov #define	SMB_FLAGS2_DFS			0x1000	/* resolve paths in DFS */
89681a5bbeSBoris Popov #define	SMB_FLAGS2_PAGING_IO		0x2000	/* for exec */
90681a5bbeSBoris Popov #define	SMB_FLAGS2_ERR_STATUS		0x4000	/* 1 - status.status */
91681a5bbeSBoris Popov #define	SMB_FLAGS2_UNICODE		0x8000	/* use Unicode for all strings */
92681a5bbeSBoris Popov 
93681a5bbeSBoris Popov #define	SMB_UID_UNKNOWN		0xffff
94681a5bbeSBoris Popov #define	SMB_TID_UNKNOWN		0xffff
95681a5bbeSBoris Popov 
96681a5bbeSBoris Popov /*
97681a5bbeSBoris Popov  * Security mode bits
98681a5bbeSBoris Popov  */
99681a5bbeSBoris Popov #define SMB_SM_USER		0x01		/* server in the user security mode */
100fc75194cSBoris Popov #define	SMB_SM_ENCRYPT		0x02		/* use challenge/response */
1018341a67dSBoris Popov #define	SMB_SM_SIGS		0x04
1028341a67dSBoris Popov #define	SMB_SM_SIGS_REQUIRE	0x08
103681a5bbeSBoris Popov 
104681a5bbeSBoris Popov /*
105681a5bbeSBoris Popov  * NTLM capabilities
106681a5bbeSBoris Popov  */
107681a5bbeSBoris Popov #define	SMB_CAP_RAW_MODE		0x0001
108681a5bbeSBoris Popov #define	SMB_CAP_MPX_MODE		0x0002
109681a5bbeSBoris Popov #define	SMB_CAP_UNICODE			0x0004
110681a5bbeSBoris Popov #define	SMB_CAP_LARGE_FILES		0x0008		/* 64 bit offsets supported */
111681a5bbeSBoris Popov #define	SMB_CAP_NT_SMBS			0x0010
1128341a67dSBoris Popov #define	SMB_CAP_RPC_REMOTE_APIS		0x0020
1138341a67dSBoris Popov #define	SMB_CAP_STATUS32		0x0040
1148341a67dSBoris Popov #define	SMB_CAP_LEVEL_II_OPLOCKS	0x0080
1158341a67dSBoris Popov #define	SMB_CAP_LOCK_AND_READ		0x0100
116681a5bbeSBoris Popov #define	SMB_CAP_NT_FIND			0x0200
1178341a67dSBoris Popov #define	SMB_CAP_DFS			0x1000
1188341a67dSBoris Popov #define	SMB_CAP_INFOLEVEL_PASSTHRU	0x2000
1198341a67dSBoris Popov #define	SMB_CAP_LARGE_READX		0x4000
1208341a67dSBoris Popov #define	SMB_CAP_LARGE_WRITEX		0x8000
1218341a67dSBoris Popov #define	SMB_CAP_UNIX			0x00800000
1228341a67dSBoris Popov #define	SMB_CAP_BULK_TRANSFER		0x20000000
1238341a67dSBoris Popov #define	SMB_CAP_COMPRESSED_DATA		0x40000000
124681a5bbeSBoris Popov #define	SMB_CAP_EXT_SECURITY		0x80000000
125681a5bbeSBoris Popov 
126681a5bbeSBoris Popov /*
127681a5bbeSBoris Popov  * File attributes
128681a5bbeSBoris Popov  */
129681a5bbeSBoris Popov #define	SMB_FA_RDONLY		0x01
130681a5bbeSBoris Popov #define	SMB_FA_HIDDEN		0x02
131681a5bbeSBoris Popov #define	SMB_FA_SYSTEM		0x04
132681a5bbeSBoris Popov #define	SMB_FA_VOLUME		0x08
133681a5bbeSBoris Popov #define	SMB_FA_DIR		0x10
134681a5bbeSBoris Popov #define	SMB_FA_ARCHIVE		0x20
135681a5bbeSBoris Popov 
136681a5bbeSBoris Popov /*
137681a5bbeSBoris Popov  * Extended file attributes
138681a5bbeSBoris Popov  */
139681a5bbeSBoris Popov #define	SMB_EFA_RDONLY		0x0001
140681a5bbeSBoris Popov #define	SMB_EFA_HIDDEN		0x0002
141681a5bbeSBoris Popov #define	SMB_EFA_SYSTEM		0x0004
1428341a67dSBoris Popov #define	SMB_EFA_DIRECTORY	0x0010
143681a5bbeSBoris Popov #define	SMB_EFA_ARCHIVE		0x0020
144681a5bbeSBoris Popov #define	SMB_EFA_NORMAL		0x0080
145681a5bbeSBoris Popov #define	SMB_EFA_TEMPORARY	0x0100
146681a5bbeSBoris Popov #define	SMB_EFA_COMPRESSED	0x0800
1478341a67dSBoris Popov #define	SMB_EFA_POSIX_SEMANTICS	0x01000000
148681a5bbeSBoris Popov #define	SMB_EFA_BACKUP_SEMANTICS 0x02000000
149681a5bbeSBoris Popov #define	SMB_EFA_DELETE_ON_CLOSE	0x04000000
150681a5bbeSBoris Popov #define	SMB_EFA_SEQUENTIAL_SCAN	0x08000000
151681a5bbeSBoris Popov #define	SMB_EFA_RANDOM_ACCESS	0x10000000
152681a5bbeSBoris Popov #define	SMB_EFA_NO_BUFFERING	0x20000000
153681a5bbeSBoris Popov #define	SMB_EFA_WRITE_THROUGH	0x80000000
154681a5bbeSBoris Popov 
155681a5bbeSBoris Popov /*
156681a5bbeSBoris Popov  * Access Mode Encoding
157681a5bbeSBoris Popov  */
158681a5bbeSBoris Popov #define	SMB_AM_OPENREAD		0x0000
159681a5bbeSBoris Popov #define	SMB_AM_OPENWRITE	0x0001
160681a5bbeSBoris Popov #define	SMB_AM_OPENRW		0x0002
161681a5bbeSBoris Popov #define	SMB_AM_OPENEXEC		0x0003
162681a5bbeSBoris Popov #define	SMB_SM_COMPAT		0x0000
163681a5bbeSBoris Popov #define	SMB_SM_EXCLUSIVE	0x0010
164681a5bbeSBoris Popov #define	SMB_SM_DENYWRITE	0x0020
165681a5bbeSBoris Popov #define	SMB_SM_DENYREADEXEC	0x0030
166681a5bbeSBoris Popov #define	SMB_SM_DENYNONE		0x0040
167681a5bbeSBoris Popov 
168681a5bbeSBoris Popov /*
169681a5bbeSBoris Popov  * SMB commands
170681a5bbeSBoris Popov  */
171681a5bbeSBoris Popov #define	SMB_COM_CREATE_DIRECTORY        0x00
172681a5bbeSBoris Popov #define	SMB_COM_DELETE_DIRECTORY        0x01
173681a5bbeSBoris Popov #define	SMB_COM_OPEN                    0x02
174681a5bbeSBoris Popov #define	SMB_COM_CREATE                  0x03
175681a5bbeSBoris Popov #define	SMB_COM_CLOSE                   0x04
176681a5bbeSBoris Popov #define	SMB_COM_FLUSH                   0x05
177681a5bbeSBoris Popov #define	SMB_COM_DELETE                  0x06
178681a5bbeSBoris Popov #define	SMB_COM_RENAME                  0x07
179681a5bbeSBoris Popov #define	SMB_COM_QUERY_INFORMATION       0x08
180681a5bbeSBoris Popov #define	SMB_COM_SET_INFORMATION         0x09
181681a5bbeSBoris Popov #define	SMB_COM_READ                    0x0A
182681a5bbeSBoris Popov #define	SMB_COM_WRITE                   0x0B
183681a5bbeSBoris Popov #define	SMB_COM_LOCK_BYTE_RANGE         0x0C
184681a5bbeSBoris Popov #define	SMB_COM_UNLOCK_BYTE_RANGE       0x0D
185681a5bbeSBoris Popov #define	SMB_COM_CREATE_TEMPORARY        0x0E
186681a5bbeSBoris Popov #define	SMB_COM_CREATE_NEW              0x0F
187681a5bbeSBoris Popov #define	SMB_COM_CHECK_DIRECTORY         0x10
188681a5bbeSBoris Popov #define	SMB_COM_PROCESS_EXIT            0x11
189681a5bbeSBoris Popov #define	SMB_COM_SEEK                    0x12
190681a5bbeSBoris Popov #define	SMB_COM_LOCK_AND_READ           0x13
191681a5bbeSBoris Popov #define	SMB_COM_WRITE_AND_UNLOCK        0x14
192681a5bbeSBoris Popov #define	SMB_COM_READ_RAW                0x1A
193681a5bbeSBoris Popov #define	SMB_COM_READ_MPX                0x1B
194681a5bbeSBoris Popov #define	SMB_COM_READ_MPX_SECONDARY      0x1C
195681a5bbeSBoris Popov #define	SMB_COM_WRITE_RAW               0x1D
196681a5bbeSBoris Popov #define	SMB_COM_WRITE_MPX               0x1E
197681a5bbeSBoris Popov #define	SMB_COM_WRITE_COMPLETE          0x20
198681a5bbeSBoris Popov #define	SMB_COM_SET_INFORMATION2        0x22
199681a5bbeSBoris Popov #define	SMB_COM_QUERY_INFORMATION2      0x23
200681a5bbeSBoris Popov #define	SMB_COM_LOCKING_ANDX            0x24
201681a5bbeSBoris Popov #define	SMB_COM_TRANSACTION             0x25
202681a5bbeSBoris Popov #define	SMB_COM_TRANSACTION_SECONDARY   0x26
203681a5bbeSBoris Popov #define	SMB_COM_IOCTL                   0x27
204681a5bbeSBoris Popov #define	SMB_COM_IOCTL_SECONDARY         0x28
205681a5bbeSBoris Popov #define	SMB_COM_COPY                    0x29
206681a5bbeSBoris Popov #define	SMB_COM_MOVE                    0x2A
207681a5bbeSBoris Popov #define	SMB_COM_ECHO                    0x2B
208681a5bbeSBoris Popov #define	SMB_COM_WRITE_AND_CLOSE         0x2C
209681a5bbeSBoris Popov #define	SMB_COM_OPEN_ANDX               0x2D
210681a5bbeSBoris Popov #define	SMB_COM_READ_ANDX               0x2E
211681a5bbeSBoris Popov #define	SMB_COM_WRITE_ANDX              0x2F
212681a5bbeSBoris Popov #define	SMB_COM_CLOSE_AND_TREE_DISC     0x31
213681a5bbeSBoris Popov #define	SMB_COM_TRANSACTION2            0x32
214681a5bbeSBoris Popov #define	SMB_COM_TRANSACTION2_SECONDARY  0x33
215681a5bbeSBoris Popov #define	SMB_COM_FIND_CLOSE2             0x34
216681a5bbeSBoris Popov #define	SMB_COM_FIND_NOTIFY_CLOSE       0x35
217681a5bbeSBoris Popov #define	SMB_COM_TREE_CONNECT		0x70
218681a5bbeSBoris Popov #define	SMB_COM_TREE_DISCONNECT         0x71
219681a5bbeSBoris Popov #define	SMB_COM_NEGOTIATE               0x72
220681a5bbeSBoris Popov #define	SMB_COM_SESSION_SETUP_ANDX      0x73
221681a5bbeSBoris Popov #define	SMB_COM_LOGOFF_ANDX             0x74
222681a5bbeSBoris Popov #define	SMB_COM_TREE_CONNECT_ANDX       0x75
223681a5bbeSBoris Popov #define	SMB_COM_QUERY_INFORMATION_DISK  0x80
224681a5bbeSBoris Popov #define	SMB_COM_SEARCH                  0x81
225681a5bbeSBoris Popov #define	SMB_COM_FIND                    0x82
226681a5bbeSBoris Popov #define	SMB_COM_FIND_UNIQUE             0x83
227681a5bbeSBoris Popov #define	SMB_COM_NT_TRANSACT             0xA0
228681a5bbeSBoris Popov #define	SMB_COM_NT_TRANSACT_SECONDARY   0xA1
229681a5bbeSBoris Popov #define	SMB_COM_NT_CREATE_ANDX          0xA2
230681a5bbeSBoris Popov #define	SMB_COM_NT_CANCEL               0xA4
231681a5bbeSBoris Popov #define	SMB_COM_OPEN_PRINT_FILE         0xC0
232681a5bbeSBoris Popov #define	SMB_COM_WRITE_PRINT_FILE        0xC1
233681a5bbeSBoris Popov #define	SMB_COM_CLOSE_PRINT_FILE        0xC2
234681a5bbeSBoris Popov #define	SMB_COM_GET_PRINT_QUEUE         0xC3
235681a5bbeSBoris Popov #define	SMB_COM_READ_BULK               0xD8
236681a5bbeSBoris Popov #define	SMB_COM_WRITE_BULK              0xD9
237681a5bbeSBoris Popov #define	SMB_COM_WRITE_BULK_DATA         0xDA
238681a5bbeSBoris Popov 
239681a5bbeSBoris Popov /*
240681a5bbeSBoris Popov  * TRANS2 commands
241681a5bbeSBoris Popov  */
242681a5bbeSBoris Popov #define	SMB_TRANS2_OPEN2			0x00
243681a5bbeSBoris Popov #define	SMB_TRANS2_FIND_FIRST2			0x01
244681a5bbeSBoris Popov #define	SMB_TRANS2_FIND_NEXT2			0x02
245681a5bbeSBoris Popov #define	SMB_TRANS2_QUERY_FS_INFORMATION		0x03
246681a5bbeSBoris Popov #define	SMB_TRANS2_QUERY_PATH_INFORMATION	0x05
247681a5bbeSBoris Popov #define	SMB_TRANS2_SET_PATH_INFORMATION		0x06
248681a5bbeSBoris Popov #define	SMB_TRANS2_QUERY_FILE_INFORMATION	0x07
249681a5bbeSBoris Popov #define	SMB_TRANS2_SET_FILE_INFORMATION		0x08
250681a5bbeSBoris Popov #define	SMB_TRANS2_FSCTL			0x09
251681a5bbeSBoris Popov #define	SMB_TRANS2_IOCTL2			0x0A
252681a5bbeSBoris Popov #define	SMB_TRANS2_FIND_NOTIFY_FIRST		0x0B
253681a5bbeSBoris Popov #define	SMB_TRANS2_FIND_NOTIFY_NEXT		0x0C
254681a5bbeSBoris Popov #define	SMB_TRANS2_CREATE_DIRECTORY		0x0D
255681a5bbeSBoris Popov #define	SMB_TRANS2_SESSION_SETUP		0x0E
256681a5bbeSBoris Popov #define	SMB_TRANS2_GET_DFS_REFERRAL		0x10
257681a5bbeSBoris Popov #define	SMB_TRANS2_REPORT_DFS_INCONSISTENCY	0x11
258681a5bbeSBoris Popov 
259681a5bbeSBoris Popov /*
260681a5bbeSBoris Popov  * SMB_TRANS2_QUERY_FS_INFORMATION levels
261681a5bbeSBoris Popov  */
262681a5bbeSBoris Popov #define SMB_INFO_ALLOCATION		1
263681a5bbeSBoris Popov #define SMB_INFO_VOLUME			2
264681a5bbeSBoris Popov #define SMB_QUERY_FS_VOLUME_INFO	0x102
265681a5bbeSBoris Popov #define SMB_QUERY_FS_SIZE_INFO		0x103
266681a5bbeSBoris Popov #define SMB_QUERY_FS_DEVICE_INFO	0x104
267681a5bbeSBoris Popov #define SMB_QUERY_FS_ATTRIBUTE_INFO	0x105
268681a5bbeSBoris Popov 
269681a5bbeSBoris Popov /*
2708341a67dSBoris Popov  * SMB_TRANS2_QUERY_PATH levels
2718341a67dSBoris Popov  */
2728341a67dSBoris Popov #define	SMB_QUERY_FILE_STANDARD			1
2738341a67dSBoris Popov #define	SMB_QUERY_FILE_EA_SIZE			2
2748341a67dSBoris Popov #define	SMB_QUERY_FILE_EAS_FROM_LIST		3
2758341a67dSBoris Popov #define	SMB_QUERY_FILE_ALL_EAS			4
2768341a67dSBoris Popov #define	SMB_QUERY_FILE_IS_NAME_VALID		6
2778341a67dSBoris Popov #define	SMB_QUERY_FILE_BASIC_INFO		0x101
2788341a67dSBoris Popov #define	SMB_QUERY_FILE_STANDARD_INFO		0x102
2798341a67dSBoris Popov #define	SMB_QUERY_FILE_EA_INFO			0x103
2808341a67dSBoris Popov #define	SMB_QUERY_FILE_NAME_INFO		0x104
2818341a67dSBoris Popov #define	SMB_QUERY_FILE_ALL_INFO			0x107
2828341a67dSBoris Popov #define	SMB_QUERY_FILE_ALT_NAME_INFO		0x108
2838341a67dSBoris Popov #define	SMB_QUERY_FILE_STREAM_INFO		0x109
2848341a67dSBoris Popov #define	SMB_QUERY_FILE_COMPRESSION_INFO		0x10b
2858341a67dSBoris Popov #define	SMB_QUERY_FILE_UNIX_BASIC		0x200
2868341a67dSBoris Popov #define	SMB_QUERY_FILE_UNIX_LINK		0x201
2878341a67dSBoris Popov #define	SMB_QUERY_FILE_MAC_DT_GET_APPL		0x306
2888341a67dSBoris Popov #define	SMB_QUERY_FILE_MAC_DT_GET_ICON		0x307
2898341a67dSBoris Popov #define	SMB_QUERY_FILE_MAC_DT_GET_ICON_INFO	0x308
2908341a67dSBoris Popov 
2918341a67dSBoris Popov /*
292681a5bbeSBoris Popov  * SMB_TRANS2_FIND_FIRST2 information levels
293681a5bbeSBoris Popov  */
294681a5bbeSBoris Popov #define SMB_INFO_STANDARD		1
295681a5bbeSBoris Popov #define SMB_INFO_QUERY_EA_SIZE		2
296681a5bbeSBoris Popov #define SMB_INFO_QUERY_EAS_FROM_LIST	3
297681a5bbeSBoris Popov #define SMB_FIND_FILE_DIRECTORY_INFO	0x101
298681a5bbeSBoris Popov #define SMB_FIND_FULL_DIRECTORY_INFO	0x102
299681a5bbeSBoris Popov #define SMB_FIND_FILE_NAMES_INFO	0x103
300681a5bbeSBoris Popov #define SMB_FIND_BOTH_DIRECTORY_INFO	0x104
301681a5bbeSBoris Popov 
302681a5bbeSBoris Popov /*
303681a5bbeSBoris Popov  * Set PATH/FILE information levels
304681a5bbeSBoris Popov  */
305681a5bbeSBoris Popov #define	SMB_SET_FILE_BASIC_INFO		0x101
306be32ca52SBoris Popov #define	SMB_SET_FILE_END_OF_FILE_INFO	0x104
307681a5bbeSBoris Popov 
308681a5bbeSBoris Popov /*
309681a5bbeSBoris Popov  * LOCKING_ANDX LockType flags
310681a5bbeSBoris Popov  */
311681a5bbeSBoris Popov #define SMB_LOCKING_ANDX_SHARED_LOCK	0x01
312681a5bbeSBoris Popov #define SMB_LOCKING_ANDX_OPLOCK_RELEASE	0x02
313681a5bbeSBoris Popov #define SMB_LOCKING_ANDX_CHANGE_LOCKTYPE 0x04
314681a5bbeSBoris Popov #define SMB_LOCKING_ANDX_CANCEL_LOCK	0x08
315681a5bbeSBoris Popov #define SMB_LOCKING_ANDX_LARGE_FILES	0x10
316681a5bbeSBoris Popov 
317681a5bbeSBoris Popov /*
318681a5bbeSBoris Popov  * Some names length limitations. Some of them aren't declared by specs,
319681a5bbeSBoris Popov  * but we need reasonable limits.
320681a5bbeSBoris Popov  */
321681a5bbeSBoris Popov #define SMB_MAXSRVNAMELEN	15	/* NetBIOS limit */
322681a5bbeSBoris Popov #define SMB_MAXUSERNAMELEN	128
323681a5bbeSBoris Popov #define SMB_MAXPASSWORDLEN	128
324681a5bbeSBoris Popov #define	SMB_MAXSHARENAMELEN	128
325681a5bbeSBoris Popov #define	SMB_MAXPKTLEN		0x1FFFF
326681a5bbeSBoris Popov #define	SMB_MAXCHALLENGELEN	8
327681a5bbeSBoris Popov #define	SMB_MAXFNAMELEN		255	/* Keep in sync with MAXNAMLEN */
328681a5bbeSBoris Popov 
329681a5bbeSBoris Popov #define	SMB_MAXRCN		3	/* number of reconnect attempts */
330681a5bbeSBoris Popov 
331681a5bbeSBoris Popov /*
332681a5bbeSBoris Popov  * Error classes
333681a5bbeSBoris Popov  */
334681a5bbeSBoris Popov #define SMBSUCCESS	0x00
335681a5bbeSBoris Popov #define ERRDOS		0x01
336681a5bbeSBoris Popov #define ERRSRV		0x02
337d64ada50SJens Schweikhardt #define ERRHRD		0x03	/* Error is a hardware error. */
338681a5bbeSBoris Popov #define ERRCMD		0xFF	/* Command was not in the "SMB" format. */
339681a5bbeSBoris Popov 
340681a5bbeSBoris Popov /*
341681a5bbeSBoris Popov  * Error codes for the ERRDOS class
342681a5bbeSBoris Popov  */
343681a5bbeSBoris Popov #define ERRbadfunc	1	/* Invalid function */
344681a5bbeSBoris Popov #define ERRbadfile	2	/* File not found (last component) */
345681a5bbeSBoris Popov #define ERRbadpath	3	/* Directory invalid */
346681a5bbeSBoris Popov #define ERRnofids	4	/* Too many open files */
347681a5bbeSBoris Popov #define ERRnoaccess	5	/* Access denied */
348681a5bbeSBoris Popov #define ERRbadfid	6	/* Invalid file handle */
349681a5bbeSBoris Popov #define ERRbadmcb	7	/* Memory control blocks destroyed (huh ?) */
350681a5bbeSBoris Popov #define ERRnomem	8	/* Insufficient memory */
351681a5bbeSBoris Popov #define ERRbadmem	9	/* Invalid memory block address */
352681a5bbeSBoris Popov #define ERRbadenv	10	/* Invalid environment */
353681a5bbeSBoris Popov #define ERRbadformat	11	/* Invalid format */
354681a5bbeSBoris Popov #define ERRbadaccess	12	/* Invalid open mode */
355681a5bbeSBoris Popov #define ERRbaddata	13	/* Invalid data */
356681a5bbeSBoris Popov #define ERRbaddrive	15	/* Invalid drive specified */
357681a5bbeSBoris Popov #define ERRremcd	16	/* An attempt to delete current directory */
358681a5bbeSBoris Popov #define ERRdiffdevice	17	/* cross fs rename/move */
359681a5bbeSBoris Popov #define ERRnofiles	18	/* no more files found in file search */
360681a5bbeSBoris Popov #define ERRbadshare	32	/* Share mode can't be granted */
361681a5bbeSBoris Popov #define ERRlock		33	/* A lock request conflicts with existing lock */
3628341a67dSBoris Popov #define ERRunsup	50	/* unsupported - Win 95 */
3638341a67dSBoris Popov #define ERRnoipc	66	/* ipc unsupported */
3648341a67dSBoris Popov #define ERRnosuchshare	67	/* invalid share name */
365681a5bbeSBoris Popov #define ERRfilexists	80	/* The file named in the request already exists */
366af9b5e8fSBoris Popov #define	ERRquota	112	/* W2K returns this if quota space exceeds */
3678341a67dSBoris Popov #define ERRcannotopen	110	/* cannot open the file */
3688341a67dSBoris Popov #define ERRinvalidname	123
3698341a67dSBoris Popov #define ERRunknownlevel 124
3708341a67dSBoris Popov #define ERRnotlocked	158	/* region was not locked by this context */
3718341a67dSBoris Popov #define ERRrename	183
3728341a67dSBoris Popov #define ERRbadpipe	230	/* named pipe invalid */
3738341a67dSBoris Popov #define ERRpipebusy	231	/* all pipe instances are busy */
3748341a67dSBoris Popov #define ERRpipeclosing	232	/* close in progress */
3758341a67dSBoris Popov #define ERRnotconnected	233	/* nobody on other end of pipe */
3768341a67dSBoris Popov #define ERRmoredata	234	/* more data to be returned */
3778341a67dSBoris Popov #define ERRbaddirectory	267	/* invalid directory name */
3788341a67dSBoris Popov #define ERReasunsupported	282	/* extended attributes not supported */
3798341a67dSBoris Popov #define ERRunknownipc	2142
3808341a67dSBoris Popov #define ERRbuftoosmall	2123
3818341a67dSBoris Popov #define ERRnosuchprintjob	2151
382681a5bbeSBoris Popov 
383681a5bbeSBoris Popov /*
384681a5bbeSBoris Popov  * Error codes for the ERRSRV class
385681a5bbeSBoris Popov  */
386681a5bbeSBoris Popov #define ERRerror	1	/* Non-specific error code */
387681a5bbeSBoris Popov #define ERRbadpw	2	/* Bad password */
3888341a67dSBoris Popov #define ERRbadtype	3	/* reserved */
389681a5bbeSBoris Popov #define ERRaccess	4	/* The client doesn't have enough access rights */
390681a5bbeSBoris Popov #define ERRinvnid	5	/* The Tid specified in a command is invalid */
391681a5bbeSBoris Popov #define ERRinvnetname	6	/* Invalid server name in the tree connect */
392681a5bbeSBoris Popov #define ERRinvdevice	7	/* Printer and not printer devices are mixed */
393681a5bbeSBoris Popov #define ERRqfull	49	/* Print queue full */
394681a5bbeSBoris Popov #define ERRqtoobig	50	/* Print queue full - no space */
395681a5bbeSBoris Popov #define ERRinvpfid	52	/* Invalid print file FID */
396fc75194cSBoris Popov #define ERRsmbcmd	64	/* The server did not recognize the command */
397681a5bbeSBoris Popov #define ERRsrverror	65	/* The server encountered and internal error */
398681a5bbeSBoris Popov #define ERRfilespecs	67	/* The Fid and path name contains an invalid combination */
399681a5bbeSBoris Popov #define ERRbadpermits	69	/* Access mode invalid */
400681a5bbeSBoris Popov #define ERRsetattrmode	71	/* Attribute mode invalid */
401681a5bbeSBoris Popov #define ERRpaused	81	/* Server is paused */
402681a5bbeSBoris Popov #define ERRmsgoff	82	/* Not receiving messages */
403681a5bbeSBoris Popov #define ERRnoroom	83	/* No room to buffer message */
404681a5bbeSBoris Popov #define ERRrmuns	87	/* Too many remote user names */
405681a5bbeSBoris Popov #define ERRtimeout	88	/* Operation timed out */
406681a5bbeSBoris Popov #define ERRnoresource	89	/* No resources currently available for request */
407681a5bbeSBoris Popov #define ERRtoomanyuids	90      /* Too many UIDs active on this session */
408681a5bbeSBoris Popov #define ERRbaduid	91	/* The UID is not known in this session */
409681a5bbeSBoris Popov #define ERRusempx	250	/* Temporarily unable to support Raw, use MPX mode */
410fc75194cSBoris Popov #define ERRusestd	251	/* Temporarily unable to support Raw, use standard r/w */
411681a5bbeSBoris Popov #define ERRcontmpx	252	/* Continue in MPX mode */
412af9b5e8fSBoris Popov #define ERRbadPassword	254
413af9b5e8fSBoris Popov #define	ERRaccountExpired 2239
414af9b5e8fSBoris Popov #define	ERRbadClient	2240	/* Cannot access the server from this workstation */
415af9b5e8fSBoris Popov #define	ERRbadLogonTime	2241	/* Cannot access the server at this time **/
416af9b5e8fSBoris Popov #define	ERRpasswordExpired 2242
417681a5bbeSBoris Popov #define ERRnosupport	65535	/* Invalid function */
418681a5bbeSBoris Popov 
419681a5bbeSBoris Popov /*
420681a5bbeSBoris Popov  * Error codes for the ERRHRD class
421681a5bbeSBoris Popov  */
422681a5bbeSBoris Popov #define ERRnowrite	19	/* write protected media */
423681a5bbeSBoris Popov #define ERRbadunit	20	/* Unknown unit */
424681a5bbeSBoris Popov #define ERRnotready	21	/* Drive not ready */
425681a5bbeSBoris Popov #define ERRbadcmd	22	/* Unknown command */
426681a5bbeSBoris Popov #define ERRdata		23	/* Data error (CRC) */
427681a5bbeSBoris Popov #define ERRbadreq	24	/* Bad request structure length */
428681a5bbeSBoris Popov #define ERRseek		25	/* Seek error */
429681a5bbeSBoris Popov #define ERRbadmedia	26	/* Unknown media type */
430681a5bbeSBoris Popov #define ERRbadsector	27	/* Sector not found */
431681a5bbeSBoris Popov #define ERRnopaper	28	/* Printer out of paper */
432681a5bbeSBoris Popov #define ERRwrite	29	/* Write fault */
433681a5bbeSBoris Popov #define ERRread		30	/* Read fault */
434681a5bbeSBoris Popov #define ERRgeneral	31	/* General failure */
4359d5abbddSJens Schweikhardt #define	ERRbadshare	32	/* An open conflicts with an existing open */
436681a5bbeSBoris Popov #define	ERRlock		33	/* lock/unlock conflict */
437681a5bbeSBoris Popov #define ERRwrongdisk	34	/* The wrong disk was found in a drive */
438681a5bbeSBoris Popov #define ERRFCBunavail	35	/* No FCBs available */
439681a5bbeSBoris Popov #define ERRsharebufexc	36	/* A sharing buffer has been exceeded */
4408341a67dSBoris Popov #define ERRdiskfull	39
441681a5bbeSBoris Popov 
442681a5bbeSBoris Popov /*
443681a5bbeSBoris Popov  * RAP error codes (it seems that they returned not only by RAP)
444681a5bbeSBoris Popov  */
445681a5bbeSBoris Popov #define	SMB_ERROR_ACCESS_DENIED		5
446681a5bbeSBoris Popov #define	SMB_ERROR_NETWORK_ACCESS_DENIED	65
447681a5bbeSBoris Popov #define	SMB_ERROR_MORE_DATA		234
448681a5bbeSBoris Popov 
449681a5bbeSBoris Popov typedef u_int16_t	smbfh;
450681a5bbeSBoris Popov 
451681a5bbeSBoris Popov #endif /* _NETSMB_SMB_H_ */
452