smb.h revision 103389
1213365Smarcel/*
2214006Smarcel * Copyright (c) 2000-2001 Boris Popov
3213365Smarcel * All rights reserved.
4213365Smarcel *
5213365Smarcel * Redistribution and use in source and binary forms, with or without
6213365Smarcel * modification, are permitted provided that the following conditions
7213365Smarcel * are met:
8213365Smarcel * 1. Redistributions of source code must retain the above copyright
9213365Smarcel *    notice, this list of conditions and the following disclaimer.
10213365Smarcel * 2. Redistributions in binary form must reproduce the above copyright
11213365Smarcel *    notice, this list of conditions and the following disclaimer in the
12213365Smarcel *    documentation and/or other materials provided with the distribution.
13213365Smarcel * 3. All advertising materials mentioning features or use of this software
14213365Smarcel *    must display the following acknowledgement:
15213365Smarcel *    This product includes software developed by Boris Popov.
16213365Smarcel * 4. Neither the name of the author nor the names of any co-contributors
17213365Smarcel *    may be used to endorse or promote products derived from this software
18213365Smarcel *    without specific prior written permission.
19213365Smarcel *
20213365Smarcel * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
21213365Smarcel * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22213365Smarcel * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23213365Smarcel * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
24213365Smarcel * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25213365Smarcel * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26213365Smarcel * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27213365Smarcel * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28213365Smarcel * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29213365Smarcel * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30213365Smarcel * SUCH DAMAGE.
31213365Smarcel *
32213365Smarcel * $FreeBSD: head/sys/netsmb/smb.h 103389 2002-09-16 09:26:07Z bp $
33213365Smarcel */
34213365Smarcel
35213365Smarcel/*
36213365Smarcel * Common definitions and structures for SMB/CIFS protocol
37213365Smarcel */
38214006Smarcel
39214006Smarcel#ifndef _NETSMB_SMB_H_
40213365Smarcel#define _NETSMB_SMB_H_
41213365Smarcel
42213365Smarcel#define	SMB_TCP_PORT	139
43213365Smarcel/*
44213365Smarcel * SMB dialects that we have to deal with.
45228634Savg */
46213365Smarcelenum smb_dialects {
47213365Smarcel	SMB_DIALECT_NONE,
48213365Smarcel	SMB_DIALECT_CORE,		/* PC NETWORK PROGRAM 1.0, PCLAN1.0 */
49213365Smarcel	SMB_DIALECT_COREPLUS,		/* MICROSOFT NETWORKS 1.03 */
50214006Smarcel	SMB_DIALECT_LANMAN1_0,		/* MICROSOFT NETWORKS 3.0, LANMAN1.0 */
51213365Smarcel	SMB_DIALECT_LANMAN2_0,		/* LM1.2X002, DOS LM1.2X002, Samba */
52213365Smarcel	SMB_DIALECT_LANMAN2_1,		/* DOS LANMAN2.1, LANMAN2.1 */
53213365Smarcel	SMB_DIALECT_NTLM0_12		/* NT LM 0.12, Windows for Workgroups 3.1a,
54213365Smarcel					 * NT LANMAN 1.0 */
55213365Smarcel};
56213365Smarcel
57213365Smarcel/*
58223919Sae * Formats of data/string buffers
59214006Smarcel */
60213365Smarcel#define	SMB_DT_DATA		1
61213365Smarcel#define	SMB_DT_DIALECT		2
62213365Smarcel#define	SMB_DT_PATHNAME		3
63213365Smarcel#define	SMB_DT_ASCII		4
64213365Smarcel#define	SMB_DT_VARIABLE		5
65213365Smarcel
66213365Smarcel/*
67213365Smarcel * SMB header
68213365Smarcel */
69213365Smarcel#define	SMB_SIGNATURE		"\xFFSMB"
70213365Smarcel#define	SMB_SIGLEN		4
71213365Smarcel#define	SMB_HDRMID(p)		(letohs(*(u_short*)((u_char*)(p) + 30)))
72213365Smarcel#define	SMB_HDRLEN		32
73213365Smarcel/*
74213365Smarcel * bits in the smb_flags field
75213365Smarcel */
76213365Smarcel#define	SMB_FLAGS_CASELESS	0x08
77213365Smarcel#define SMB_FLAGS_SERVER_RESP	0x80	/* indicates a response */
78213365Smarcel
79213365Smarcel/*
80213365Smarcel * bits in the smb_flags2 field
81213365Smarcel */
82213365Smarcel#define	SMB_FLAGS2_KNOWS_LONG_NAMES	0x0001
83213365Smarcel#define	SMB_FLAGS2_KNOWS_EAS		0x0002	/* client know about EAs */
84213365Smarcel#define	SMB_FLAGS2_SECURITY_SIGNATURE	0x0004	/* check SMB integrity */
85213365Smarcel#define	SMB_FLAGS2_IS_LONG_NAME		0x0040	/* any path name is a long name */
86213365Smarcel#define	SMB_FLAGS2_EXT_SEC		0x0800	/* client aware of Extended
87213365Smarcel						 * Security negotiation */
88213365Smarcel#define	SMB_FLAGS2_DFS			0x1000	/* resolve paths in DFS */
89214006Smarcel#define	SMB_FLAGS2_PAGING_IO		0x2000	/* for exec */
90214006Smarcel#define	SMB_FLAGS2_ERR_STATUS		0x4000	/* 1 - status.status */
91214006Smarcel#define	SMB_FLAGS2_UNICODE		0x8000	/* use Unicode for all strings */
92213365Smarcel
93214006Smarcel#define	SMB_UID_UNKNOWN		0xffff
94214006Smarcel#define	SMB_TID_UNKNOWN		0xffff
95213365Smarcel
96214006Smarcel/*
97213365Smarcel * Security mode bits
98287107Strasz */
99287107Strasz#define SMB_SM_USER		0x01		/* server in the user security mode */
100287107Strasz#define	SMB_SM_ENCRYPT		0x02		/* use challenge/response */
101287107Strasz#define	SMB_SM_SIGS		0x04
102287107Strasz#define	SMB_SM_SIGS_REQUIRE	0x08
103214006Smarcel
104213365Smarcel/*
105267351Smav * NTLM capabilities
106267351Smav */
107267351Smav#define	SMB_CAP_RAW_MODE		0x0001
108213365Smarcel#define	SMB_CAP_MPX_MODE		0x0002
109213365Smarcel#define	SMB_CAP_UNICODE			0x0004
110213365Smarcel#define	SMB_CAP_LARGE_FILES		0x0008		/* 64 bit offsets supported */
111213365Smarcel#define	SMB_CAP_NT_SMBS			0x0010
112213365Smarcel#define	SMB_CAP_RPC_REMOTE_APIS		0x0020
113213365Smarcel#define	SMB_CAP_STATUS32		0x0040
114213365Smarcel#define	SMB_CAP_LEVEL_II_OPLOCKS	0x0080
115213365Smarcel#define	SMB_CAP_LOCK_AND_READ		0x0100
116214006Smarcel#define	SMB_CAP_NT_FIND			0x0200
117214006Smarcel#define	SMB_CAP_DFS			0x1000
118214006Smarcel#define	SMB_CAP_INFOLEVEL_PASSTHRU	0x2000
119214006Smarcel#define	SMB_CAP_LARGE_READX		0x4000
120214006Smarcel#define	SMB_CAP_LARGE_WRITEX		0x8000
121214006Smarcel#define	SMB_CAP_UNIX			0x00800000
122214006Smarcel#define	SMB_CAP_BULK_TRANSFER		0x20000000
123214006Smarcel#define	SMB_CAP_COMPRESSED_DATA		0x40000000
124214006Smarcel#define	SMB_CAP_EXT_SECURITY		0x80000000
125214006Smarcel
126213365Smarcel/*
127213365Smarcel * File attributes
128214006Smarcel */
129214006Smarcel#define	SMB_FA_RDONLY		0x01
130253910Smarcel#define	SMB_FA_HIDDEN		0x02
131214006Smarcel#define	SMB_FA_SYSTEM		0x04
132213365Smarcel#define	SMB_FA_VOLUME		0x08
133213365Smarcel#define	SMB_FA_DIR		0x10
134213365Smarcel#define	SMB_FA_ARCHIVE		0x20
135213365Smarcel
136213365Smarcel/*
137213365Smarcel * Extended file attributes
138213365Smarcel */
139213365Smarcel#define	SMB_EFA_RDONLY		0x0001
140213365Smarcel#define	SMB_EFA_HIDDEN		0x0002
141213365Smarcel#define	SMB_EFA_SYSTEM		0x0004
142267351Smav#define	SMB_EFA_DIRECTORY	0x0010
143213365Smarcel#define	SMB_EFA_ARCHIVE		0x0020
144267351Smav#define	SMB_EFA_NORMAL		0x0080
145213365Smarcel#define	SMB_EFA_TEMPORARY	0x0100
146213365Smarcel#define	SMB_EFA_COMPRESSED	0x0800
147213365Smarcel#define	SMB_EFA_POSIX_SEMANTICS	0x01000000
148213365Smarcel#define	SMB_EFA_BACKUP_SEMANTICS 0x02000000
149213365Smarcel#define	SMB_EFA_DELETE_ON_CLOSE	0x04000000
150213365Smarcel#define	SMB_EFA_SEQUENTIAL_SCAN	0x08000000
151213365Smarcel#define	SMB_EFA_RANDOM_ACCESS	0x10000000
152213365Smarcel#define	SMB_EFA_NO_BUFFERING	0x20000000
153213365Smarcel#define	SMB_EFA_WRITE_THROUGH	0x80000000
154267351Smav
155213365Smarcel/*
156213365Smarcel * Access Mode Encoding
157267351Smav */
158213365Smarcel#define	SMB_AM_OPENREAD		0x0000
159213365Smarcel#define	SMB_AM_OPENWRITE	0x0001
160213365Smarcel#define	SMB_AM_OPENRW		0x0002
161213365Smarcel#define	SMB_AM_OPENEXEC		0x0003
162213365Smarcel#define	SMB_SM_COMPAT		0x0000
163213365Smarcel#define	SMB_SM_EXCLUSIVE	0x0010
164213365Smarcel#define	SMB_SM_DENYWRITE	0x0020
165213365Smarcel#define	SMB_SM_DENYREADEXEC	0x0030
166213365Smarcel#define	SMB_SM_DENYNONE		0x0040
167213365Smarcel
168213365Smarcel/*
169213365Smarcel * SMB commands
170213365Smarcel */
171213365Smarcel#define	SMB_COM_CREATE_DIRECTORY        0x00
172213365Smarcel#define	SMB_COM_DELETE_DIRECTORY        0x01
173213365Smarcel#define	SMB_COM_OPEN                    0x02
174213365Smarcel#define	SMB_COM_CREATE                  0x03
175213365Smarcel#define	SMB_COM_CLOSE                   0x04
176213365Smarcel#define	SMB_COM_FLUSH                   0x05
177213365Smarcel#define	SMB_COM_DELETE                  0x06
178213365Smarcel#define	SMB_COM_RENAME                  0x07
179267351Smav#define	SMB_COM_QUERY_INFORMATION       0x08
180213365Smarcel#define	SMB_COM_SET_INFORMATION         0x09
181267351Smav#define	SMB_COM_READ                    0x0A
182213365Smarcel#define	SMB_COM_WRITE                   0x0B
183213365Smarcel#define	SMB_COM_LOCK_BYTE_RANGE         0x0C
184267351Smav#define	SMB_COM_UNLOCK_BYTE_RANGE       0x0D
185213365Smarcel#define	SMB_COM_CREATE_TEMPORARY        0x0E
186213365Smarcel#define	SMB_COM_CREATE_NEW              0x0F
187213365Smarcel#define	SMB_COM_CHECK_DIRECTORY         0x10
188213365Smarcel#define	SMB_COM_PROCESS_EXIT            0x11
189213365Smarcel#define	SMB_COM_SEEK                    0x12
190213365Smarcel#define	SMB_COM_LOCK_AND_READ           0x13
191213365Smarcel#define	SMB_COM_WRITE_AND_UNLOCK        0x14
192213365Smarcel#define	SMB_COM_READ_RAW                0x1A
193213365Smarcel#define	SMB_COM_READ_MPX                0x1B
194213365Smarcel#define	SMB_COM_READ_MPX_SECONDARY      0x1C
195213365Smarcel#define	SMB_COM_WRITE_RAW               0x1D
196213365Smarcel#define	SMB_COM_WRITE_MPX               0x1E
197213365Smarcel#define	SMB_COM_WRITE_COMPLETE          0x20
198213365Smarcel#define	SMB_COM_SET_INFORMATION2        0x22
199213365Smarcel#define	SMB_COM_QUERY_INFORMATION2      0x23
200213365Smarcel#define	SMB_COM_LOCKING_ANDX            0x24
201213365Smarcel#define	SMB_COM_TRANSACTION             0x25
202213365Smarcel#define	SMB_COM_TRANSACTION_SECONDARY   0x26
203213365Smarcel#define	SMB_COM_IOCTL                   0x27
204213365Smarcel#define	SMB_COM_IOCTL_SECONDARY         0x28
205213365Smarcel#define	SMB_COM_COPY                    0x29
206213365Smarcel#define	SMB_COM_MOVE                    0x2A
207213365Smarcel#define	SMB_COM_ECHO                    0x2B
208213365Smarcel#define	SMB_COM_WRITE_AND_CLOSE         0x2C
209213365Smarcel#define	SMB_COM_OPEN_ANDX               0x2D
210213365Smarcel#define	SMB_COM_READ_ANDX               0x2E
211213365Smarcel#define	SMB_COM_WRITE_ANDX              0x2F
212213365Smarcel#define	SMB_COM_CLOSE_AND_TREE_DISC     0x31
213214006Smarcel#define	SMB_COM_TRANSACTION2            0x32
214214006Smarcel#define	SMB_COM_TRANSACTION2_SECONDARY  0x33
215213365Smarcel#define	SMB_COM_FIND_CLOSE2             0x34
216213365Smarcel#define	SMB_COM_FIND_NOTIFY_CLOSE       0x35
217213365Smarcel#define	SMB_COM_TREE_CONNECT		0x70
218214006Smarcel#define	SMB_COM_TREE_DISCONNECT         0x71
219213365Smarcel#define	SMB_COM_NEGOTIATE               0x72
220213365Smarcel#define	SMB_COM_SESSION_SETUP_ANDX      0x73
221214006Smarcel#define	SMB_COM_LOGOFF_ANDX             0x74
222214006Smarcel#define	SMB_COM_TREE_CONNECT_ANDX       0x75
223213365Smarcel#define	SMB_COM_QUERY_INFORMATION_DISK  0x80
224213365Smarcel#define	SMB_COM_SEARCH                  0x81
225213365Smarcel#define	SMB_COM_FIND                    0x82
226214006Smarcel#define	SMB_COM_FIND_UNIQUE             0x83
227213365Smarcel#define	SMB_COM_NT_TRANSACT             0xA0
228213365Smarcel#define	SMB_COM_NT_TRANSACT_SECONDARY   0xA1
229213365Smarcel#define	SMB_COM_NT_CREATE_ANDX          0xA2
230213365Smarcel#define	SMB_COM_NT_CANCEL               0xA4
231213365Smarcel#define	SMB_COM_OPEN_PRINT_FILE         0xC0
232213365Smarcel#define	SMB_COM_WRITE_PRINT_FILE        0xC1
233214006Smarcel#define	SMB_COM_CLOSE_PRINT_FILE        0xC2
234213365Smarcel#define	SMB_COM_GET_PRINT_QUEUE         0xC3
235213365Smarcel#define	SMB_COM_READ_BULK               0xD8
236213365Smarcel#define	SMB_COM_WRITE_BULK              0xD9
237213365Smarcel#define	SMB_COM_WRITE_BULK_DATA         0xDA
238213365Smarcel
239213365Smarcel/*
240213365Smarcel * TRANS2 commands
241213365Smarcel */
242213365Smarcel#define	SMB_TRANS2_OPEN2			0x00
243214006Smarcel#define	SMB_TRANS2_FIND_FIRST2			0x01
244287107Strasz#define	SMB_TRANS2_FIND_NEXT2			0x02
245213365Smarcel#define	SMB_TRANS2_QUERY_FS_INFORMATION		0x03
246213365Smarcel#define	SMB_TRANS2_QUERY_PATH_INFORMATION	0x05
247274476Skib#define	SMB_TRANS2_SET_PATH_INFORMATION		0x06
248213365Smarcel#define	SMB_TRANS2_QUERY_FILE_INFORMATION	0x07
249213365Smarcel#define	SMB_TRANS2_SET_FILE_INFORMATION		0x08
250214006Smarcel#define	SMB_TRANS2_FSCTL			0x09
251214006Smarcel#define	SMB_TRANS2_IOCTL2			0x0A
252213365Smarcel#define	SMB_TRANS2_FIND_NOTIFY_FIRST		0x0B
253213365Smarcel#define	SMB_TRANS2_FIND_NOTIFY_NEXT		0x0C
254214006Smarcel#define	SMB_TRANS2_CREATE_DIRECTORY		0x0D
255214006Smarcel#define	SMB_TRANS2_SESSION_SETUP		0x0E
256213365Smarcel#define	SMB_TRANS2_GET_DFS_REFERRAL		0x10
257213365Smarcel#define	SMB_TRANS2_REPORT_DFS_INCONSISTENCY	0x11
258214006Smarcel
259214006Smarcel/*
260214006Smarcel * SMB_TRANS2_QUERY_FS_INFORMATION levels
261213365Smarcel */
262213365Smarcel#define SMB_INFO_ALLOCATION		1
263214006Smarcel#define SMB_INFO_VOLUME			2
264214006Smarcel#define SMB_QUERY_FS_VOLUME_INFO	0x102
265214006Smarcel#define SMB_QUERY_FS_SIZE_INFO		0x103
266213365Smarcel#define SMB_QUERY_FS_DEVICE_INFO	0x104
267214006Smarcel#define SMB_QUERY_FS_ATTRIBUTE_INFO	0x105
268214006Smarcel
269214006Smarcel/*
270214006Smarcel * SMB_TRANS2_QUERY_PATH levels
271214006Smarcel */
272214006Smarcel#define	SMB_QUERY_FILE_STANDARD			1
273214006Smarcel#define	SMB_QUERY_FILE_EA_SIZE			2
274213365Smarcel#define	SMB_QUERY_FILE_EAS_FROM_LIST		3
275213365Smarcel#define	SMB_QUERY_FILE_ALL_EAS			4
276214006Smarcel#define	SMB_QUERY_FILE_IS_NAME_VALID		6
277214006Smarcel#define	SMB_QUERY_FILE_BASIC_INFO		0x101
278214006Smarcel#define	SMB_QUERY_FILE_STANDARD_INFO		0x102
279213365Smarcel#define	SMB_QUERY_FILE_EA_INFO			0x103
280214006Smarcel#define	SMB_QUERY_FILE_NAME_INFO		0x104
281214006Smarcel#define	SMB_QUERY_FILE_ALL_INFO			0x107
282214006Smarcel#define	SMB_QUERY_FILE_ALT_NAME_INFO		0x108
283214006Smarcel#define	SMB_QUERY_FILE_STREAM_INFO		0x109
284214006Smarcel#define	SMB_QUERY_FILE_COMPRESSION_INFO		0x10b
285214006Smarcel#define	SMB_QUERY_FILE_UNIX_BASIC		0x200
286214006Smarcel#define	SMB_QUERY_FILE_UNIX_LINK		0x201
287214006Smarcel#define	SMB_QUERY_FILE_MAC_DT_GET_APPL		0x306
288214006Smarcel#define	SMB_QUERY_FILE_MAC_DT_GET_ICON		0x307
289214006Smarcel#define	SMB_QUERY_FILE_MAC_DT_GET_ICON_INFO	0x308
290214006Smarcel
291214006Smarcel/*
292213365Smarcel * SMB_TRANS2_FIND_FIRST2 information levels
293213365Smarcel */
294213365Smarcel#define SMB_INFO_STANDARD		1
295214006Smarcel#define SMB_INFO_QUERY_EA_SIZE		2
296214006Smarcel#define SMB_INFO_QUERY_EAS_FROM_LIST	3
297214006Smarcel#define SMB_FIND_FILE_DIRECTORY_INFO	0x101
298214006Smarcel#define SMB_FIND_FULL_DIRECTORY_INFO	0x102
299214006Smarcel#define SMB_FIND_FILE_NAMES_INFO	0x103
300214006Smarcel#define SMB_FIND_BOTH_DIRECTORY_INFO	0x104
301214006Smarcel
302214006Smarcel/*
303214006Smarcel * Set PATH/FILE information levels
304214006Smarcel */
305214006Smarcel#define	SMB_SET_FILE_BASIC_INFO		0x101
306214006Smarcel#define	SMB_SET_FILE_END_OF_FILE_INFO	0x104
307214006Smarcel
308214006Smarcel/*
309214006Smarcel * LOCKING_ANDX LockType flags
310214006Smarcel */
311214006Smarcel#define SMB_LOCKING_ANDX_SHARED_LOCK	0x01
312214006Smarcel#define SMB_LOCKING_ANDX_OPLOCK_RELEASE	0x02
313214006Smarcel#define SMB_LOCKING_ANDX_CHANGE_LOCKTYPE 0x04
314214006Smarcel#define SMB_LOCKING_ANDX_CANCEL_LOCK	0x08
315214006Smarcel#define SMB_LOCKING_ANDX_LARGE_FILES	0x10
316214006Smarcel
317214006Smarcel/*
318214006Smarcel * Some names length limitations. Some of them aren't declared by specs,
319214006Smarcel * but we need reasonable limits.
320214006Smarcel */
321214006Smarcel#define SMB_MAXSRVNAMELEN	15	/* NetBIOS limit */
322214006Smarcel#define SMB_MAXUSERNAMELEN	128
323214006Smarcel#define SMB_MAXPASSWORDLEN	128
324214006Smarcel#define	SMB_MAXSHARENAMELEN	128
325214006Smarcel#define	SMB_MAXPKTLEN		0x1FFFF
326214006Smarcel#define	SMB_MAXCHALLENGELEN	8
327214006Smarcel#define	SMB_MAXFNAMELEN		255	/* Keep in sync with MAXNAMLEN */
328214006Smarcel
329214006Smarcel#define	SMB_MAXRCN		3	/* number of reconnect attempts */
330214006Smarcel
331213365Smarcel/*
332213365Smarcel * Error classes
333214006Smarcel */
334214006Smarcel#define SMBSUCCESS	0x00
335214006Smarcel#define ERRDOS		0x01
336214006Smarcel#define ERRSRV		0x02
337214006Smarcel#define ERRHRD		0x03	/* Error is an hardware error. */
338214006Smarcel#define ERRCMD		0xFF	/* Command was not in the "SMB" format. */
339214006Smarcel
340214006Smarcel/*
341214006Smarcel * Error codes for the ERRDOS class
342214006Smarcel */
343214006Smarcel#define ERRbadfunc	1	/* Invalid function */
344214006Smarcel#define ERRbadfile	2	/* File not found (last component) */
345214006Smarcel#define ERRbadpath	3	/* Directory invalid */
346214006Smarcel#define ERRnofids	4	/* Too many open files */
347214006Smarcel#define ERRnoaccess	5	/* Access denied */
348214006Smarcel#define ERRbadfid	6	/* Invalid file handle */
349214006Smarcel#define ERRbadmcb	7	/* Memory control blocks destroyed (huh ?) */
350213365Smarcel#define ERRnomem	8	/* Insufficient memory */
351214006Smarcel#define ERRbadmem	9	/* Invalid memory block address */
352214006Smarcel#define ERRbadenv	10	/* Invalid environment */
353214006Smarcel#define ERRbadformat	11	/* Invalid format */
354213365Smarcel#define ERRbadaccess	12	/* Invalid open mode */
355214006Smarcel#define ERRbaddata	13	/* Invalid data */
356214006Smarcel#define ERRbaddrive	15	/* Invalid drive specified */
357214006Smarcel#define ERRremcd	16	/* An attempt to delete current directory */
358214006Smarcel#define ERRdiffdevice	17	/* cross fs rename/move */
359274476Skib#define ERRnofiles	18	/* no more files found in file search */
360274476Skib#define ERRbadshare	32	/* Share mode can't be granted */
361214006Smarcel#define ERRlock		33	/* A lock request conflicts with existing lock */
362214006Smarcel#define ERRunsup	50	/* unsupported - Win 95 */
363214006Smarcel#define ERRnoipc	66	/* ipc unsupported */
364213365Smarcel#define ERRnosuchshare	67	/* invalid share name */
365214006Smarcel#define ERRfilexists	80	/* The file named in the request already exists */
366214006Smarcel#define	ERRquota	112	/* W2K returns this if quota space exceeds */
367214006Smarcel#define ERRcannotopen	110	/* cannot open the file */
368214006Smarcel#define ERRinvalidname	123
369214006Smarcel#define ERRunknownlevel 124
370214006Smarcel#define ERRnotlocked	158	/* region was not locked by this context */
371214006Smarcel#define ERRrename	183
372214006Smarcel#define ERRbadpipe	230	/* named pipe invalid */
373214006Smarcel#define ERRpipebusy	231	/* all pipe instances are busy */
374214006Smarcel#define ERRpipeclosing	232	/* close in progress */
375214006Smarcel#define ERRnotconnected	233	/* nobody on other end of pipe */
376214006Smarcel#define ERRmoredata	234	/* more data to be returned */
377214006Smarcel#define ERRbaddirectory	267	/* invalid directory name */
378214006Smarcel#define ERReasunsupported	282	/* extended attributes not supported */
379214006Smarcel#define ERRunknownipc	2142
380214006Smarcel#define ERRbuftoosmall	2123
381214006Smarcel#define ERRnosuchprintjob	2151
382214006Smarcel
383214006Smarcel/*
384214006Smarcel * Error codes for the ERRSRV class
385214006Smarcel */
386214006Smarcel#define ERRerror	1	/* Non-specific error code */
387214006Smarcel#define ERRbadpw	2	/* Bad password */
388214006Smarcel#define ERRbadtype	3	/* reserved */
389214006Smarcel#define ERRaccess	4	/* The client doesn't have enough access rights */
390214006Smarcel#define ERRinvnid	5	/* The Tid specified in a command is invalid */
391214006Smarcel#define ERRinvnetname	6	/* Invalid server name in the tree connect */
392214006Smarcel#define ERRinvdevice	7	/* Printer and not printer devices are mixed */
393214006Smarcel#define ERRqfull	49	/* Print queue full */
394214006Smarcel#define ERRqtoobig	50	/* Print queue full - no space */
395214006Smarcel#define ERRinvpfid	52	/* Invalid print file FID */
396214006Smarcel#define ERRsmbcmd	64	/* The server did not recognize the command */
397214006Smarcel#define ERRsrverror	65	/* The server encountered and internal error */
398214006Smarcel#define ERRfilespecs	67	/* The Fid and path name contains an invalid combination */
399214006Smarcel#define ERRbadpermits	69	/* Access mode invalid */
400214006Smarcel#define ERRsetattrmode	71	/* Attribute mode invalid */
401214006Smarcel#define ERRpaused	81	/* Server is paused */
402214006Smarcel#define ERRmsgoff	82	/* Not receiving messages */
403214006Smarcel#define ERRnoroom	83	/* No room to buffer message */
404214006Smarcel#define ERRrmuns	87	/* Too many remote user names */
405214006Smarcel#define ERRtimeout	88	/* Operation timed out */
406214006Smarcel#define ERRnoresource	89	/* No resources currently available for request */
407214006Smarcel#define ERRtoomanyuids	90      /* Too many UIDs active on this session */
408214006Smarcel#define ERRbaduid	91	/* The UID is not known in this session */
409214006Smarcel#define ERRusempx	250	/* Temporarily unable to support Raw, use MPX mode */
410214006Smarcel#define ERRusestd	251	/* Temporarily unable to support Raw, use standard r/w */
411214006Smarcel#define ERRcontmpx	252	/* Continue in MPX mode */
412214006Smarcel#define ERRbadPassword	254
413214006Smarcel#define	ERRaccountExpired 2239
414214006Smarcel#define	ERRbadClient	2240	/* Cannot access the server from this workstation */
415214006Smarcel#define	ERRbadLogonTime	2241	/* Cannot access the server at this time **/
416214006Smarcel#define	ERRpasswordExpired 2242
417214006Smarcel#define ERRnosupport	65535	/* Invalid function */
418214006Smarcel
419214006Smarcel/*
420214006Smarcel * Error codes for the ERRHRD class
421214006Smarcel */
422214006Smarcel#define ERRnowrite	19	/* write protected media */
423214006Smarcel#define ERRbadunit	20	/* Unknown unit */
424214006Smarcel#define ERRnotready	21	/* Drive not ready */
425214006Smarcel#define ERRbadcmd	22	/* Unknown command */
426214006Smarcel#define ERRdata		23	/* Data error (CRC) */
427213365Smarcel#define ERRbadreq	24	/* Bad request structure length */
428214006Smarcel#define ERRseek		25	/* Seek error */
429214006Smarcel#define ERRbadmedia	26	/* Unknown media type */
430213365Smarcel#define ERRbadsector	27	/* Sector not found */
431214006Smarcel#define ERRnopaper	28	/* Printer out of paper */
432214006Smarcel#define ERRwrite	29	/* Write fault */
433214006Smarcel#define ERRread		30	/* Read fault */
434214006Smarcel#define ERRgeneral	31	/* General failure */
435214006Smarcel#define	ERRbadshare	32	/* A open conflicts with an existing open */
436214006Smarcel#define	ERRlock		33	/* lock/unlock conflict */
437214006Smarcel#define ERRwrongdisk	34	/* The wrong disk was found in a drive */
438214006Smarcel#define ERRFCBunavail	35	/* No FCBs available */
439214006Smarcel#define ERRsharebufexc	36	/* A sharing buffer has been exceeded */
440213365Smarcel#define ERRdiskfull	39
441214006Smarcel
442214006Smarcel/*
443214006Smarcel * RAP error codes (it seems that they returned not only by RAP)
444214006Smarcel */
445214006Smarcel#define	SMB_ERROR_ACCESS_DENIED		5
446214006Smarcel#define	SMB_ERROR_NETWORK_ACCESS_DENIED	65
447214006Smarcel#define	SMB_ERROR_MORE_DATA		234
448213365Smarcel
449213365Smarceltypedef u_int16_t	smbfh;
450214006Smarcel
451214006Smarcel#endif /* _NETSMB_SMB_H_ */
452213365Smarcel