1204591Sluigi/*-
2204591Sluigi * Copyright (c) 2000-2001 Boris Popov
3204591Sluigi * All rights reserved.
4204591Sluigi *
5204591Sluigi * Redistribution and use in source and binary forms, with or without
6204591Sluigi * modification, are permitted provided that the following conditions
7204591Sluigi * are met:
8204591Sluigi * 1. Redistributions of source code must retain the above copyright
9204591Sluigi *    notice, this list of conditions and the following disclaimer.
10204591Sluigi * 2. Redistributions in binary form must reproduce the above copyright
11204591Sluigi *    notice, this list of conditions and the following disclaimer in the
12204591Sluigi *    documentation and/or other materials provided with the distribution.
13204591Sluigi *
14204591Sluigi * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15204591Sluigi * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16204591Sluigi * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17204591Sluigi * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18204591Sluigi * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19204591Sluigi * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20204591Sluigi * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21204591Sluigi * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22204591Sluigi * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23204591Sluigi * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24204591Sluigi * SUCH DAMAGE.
25204591Sluigi *
26204591Sluigi * $FreeBSD$
27204591Sluigi */
28204591Sluigi
29204591Sluigi/*
30204591Sluigi * Common definitions and structures for SMB/CIFS protocol
31204591Sluigi */
32204591Sluigi
33204591Sluigi#ifndef _NETSMB_SMB_H_
34204591Sluigi#define _NETSMB_SMB_H_
35204591Sluigi
36204591Sluigi#define	SMB_TCP_PORT	139
37204591Sluigi/*
38204591Sluigi * SMB dialects that we have to deal with.
39204591Sluigi */
40204591Sluigienum smb_dialects {
41204591Sluigi	SMB_DIALECT_NONE,
42204591Sluigi	SMB_DIALECT_CORE,		/* PC NETWORK PROGRAM 1.0, PCLAN1.0 */
43204591Sluigi	SMB_DIALECT_COREPLUS,		/* MICROSOFT NETWORKS 1.03 */
44204591Sluigi	SMB_DIALECT_LANMAN1_0,		/* MICROSOFT NETWORKS 3.0, LANMAN1.0 */
45204591Sluigi	SMB_DIALECT_LANMAN2_0,		/* LM1.2X002, DOS LM1.2X002, Samba */
46204591Sluigi	SMB_DIALECT_LANMAN2_1,		/* DOS LANMAN2.1, LANMAN2.1 */
47204591Sluigi	SMB_DIALECT_NTLM0_12		/* NT LM 0.12, Windows for Workgroups 3.1a,
48204591Sluigi					 * NT LANMAN 1.0 */
49204591Sluigi};
50204591Sluigi
51204591Sluigi/*
52204591Sluigi * Formats of data/string buffers
53204591Sluigi */
54204591Sluigi#define	SMB_DT_DATA		1
55204591Sluigi#define	SMB_DT_DIALECT		2
56204591Sluigi#define	SMB_DT_PATHNAME		3
57204591Sluigi#define	SMB_DT_ASCII		4
58204591Sluigi#define	SMB_DT_VARIABLE		5
59204591Sluigi
60204591Sluigi/*
61204591Sluigi * SMB header
62204591Sluigi */
63204591Sluigi#define	SMB_SIGNATURE		"\xFFSMB"
64204591Sluigi#define	SMB_SIGLEN		4
65204591Sluigi#define	SMB_HDRMID(p)		(le16toh(*(u_short*)((u_char*)(p) + 30)))
66204591Sluigi#define	SMB_HDRLEN		32
67204591Sluigi/*
68204591Sluigi * bits in the smb_flags field
69204591Sluigi */
70204591Sluigi#define	SMB_FLAGS_CASELESS	0x08
71204591Sluigi#define SMB_FLAGS_SERVER_RESP	0x80	/* indicates a response */
72204591Sluigi
73204591Sluigi/*
74204591Sluigi * bits in the smb_flags2 field
75204591Sluigi */
76204591Sluigi#define	SMB_FLAGS2_KNOWS_LONG_NAMES	0x0001
77204591Sluigi#define	SMB_FLAGS2_KNOWS_EAS		0x0002	/* client know about EAs */
78204591Sluigi#define	SMB_FLAGS2_SECURITY_SIGNATURE	0x0004	/* check SMB integrity */
79204591Sluigi#define	SMB_FLAGS2_IS_LONG_NAME		0x0040	/* any path name is a long name */
80204591Sluigi#define	SMB_FLAGS2_EXT_SEC		0x0800	/* client aware of Extended
81204591Sluigi						 * Security negotiation */
82204591Sluigi#define	SMB_FLAGS2_DFS			0x1000	/* resolve paths in DFS */
83204591Sluigi#define	SMB_FLAGS2_PAGING_IO		0x2000	/* for exec */
84301772Struckman#define	SMB_FLAGS2_ERR_STATUS		0x4000	/* 1 - status.status */
85301772Struckman#define	SMB_FLAGS2_UNICODE		0x8000	/* use Unicode for all strings */
86301772Struckman
87301772Struckman#define	SMB_UID_UNKNOWN		0xffff
88204591Sluigi#define	SMB_TID_UNKNOWN		0xffff
89204591Sluigi
90204591Sluigi/*
91204591Sluigi * Security mode bits
92204591Sluigi */
93204591Sluigi#define SMB_SM_USER		0x01		/* server in the user security mode */
94204591Sluigi#define	SMB_SM_ENCRYPT		0x02		/* use challenge/response */
95204591Sluigi#define	SMB_SM_SIGS		0x04
96204591Sluigi#define	SMB_SM_SIGS_REQUIRE	0x08
97204591Sluigi
98204591Sluigi/*
99204591Sluigi * NTLM capabilities
100204591Sluigi */
101204591Sluigi#define	SMB_CAP_RAW_MODE		0x0001
102204591Sluigi#define	SMB_CAP_MPX_MODE		0x0002
103204591Sluigi#define	SMB_CAP_UNICODE			0x0004
104204591Sluigi#define	SMB_CAP_LARGE_FILES		0x0008		/* 64 bit offsets supported */
105204591Sluigi#define	SMB_CAP_NT_SMBS			0x0010
106204591Sluigi#define	SMB_CAP_RPC_REMOTE_APIS		0x0020
107204591Sluigi#define	SMB_CAP_STATUS32		0x0040
108204591Sluigi#define	SMB_CAP_LEVEL_II_OPLOCKS	0x0080
109204591Sluigi#define	SMB_CAP_LOCK_AND_READ		0x0100
110204591Sluigi#define	SMB_CAP_NT_FIND			0x0200
111204591Sluigi#define	SMB_CAP_DFS			0x1000
112204591Sluigi#define	SMB_CAP_INFOLEVEL_PASSTHRU	0x2000
113204591Sluigi#define	SMB_CAP_LARGE_READX		0x4000
114204591Sluigi#define	SMB_CAP_LARGE_WRITEX		0x8000
115204591Sluigi#define	SMB_CAP_UNIX			0x00800000
116204591Sluigi#define	SMB_CAP_BULK_TRANSFER		0x20000000
117204591Sluigi#define	SMB_CAP_COMPRESSED_DATA		0x40000000
118204591Sluigi#define	SMB_CAP_EXT_SECURITY		0x80000000
119204591Sluigi
120204591Sluigi/*
121204591Sluigi * File attributes
122204591Sluigi */
123204591Sluigi#define	SMB_FA_RDONLY		0x01
124204591Sluigi#define	SMB_FA_HIDDEN		0x02
125204591Sluigi#define	SMB_FA_SYSTEM		0x04
126204591Sluigi#define	SMB_FA_VOLUME		0x08
127204591Sluigi#define	SMB_FA_DIR		0x10
128204591Sluigi#define	SMB_FA_ARCHIVE		0x20
129204591Sluigi
130204591Sluigi/*
131204591Sluigi * Extended file attributes
132204591Sluigi */
133204591Sluigi#define	SMB_EFA_RDONLY		0x0001
134204591Sluigi#define	SMB_EFA_HIDDEN		0x0002
135204591Sluigi#define	SMB_EFA_SYSTEM		0x0004
136204591Sluigi#define	SMB_EFA_DIRECTORY	0x0010
137204591Sluigi#define	SMB_EFA_ARCHIVE		0x0020
138204591Sluigi#define	SMB_EFA_NORMAL		0x0080
139204591Sluigi#define	SMB_EFA_TEMPORARY	0x0100
140204591Sluigi#define	SMB_EFA_COMPRESSED	0x0800
141204591Sluigi#define	SMB_EFA_POSIX_SEMANTICS	0x01000000
142301772Struckman#define	SMB_EFA_BACKUP_SEMANTICS 0x02000000
143301772Struckman#define	SMB_EFA_DELETE_ON_CLOSE	0x04000000
144301772Struckman#define	SMB_EFA_SEQUENTIAL_SCAN	0x08000000
145204591Sluigi#define	SMB_EFA_RANDOM_ACCESS	0x10000000
146204591Sluigi#define	SMB_EFA_NO_BUFFERING	0x20000000
147205173Sluigi#define	SMB_EFA_WRITE_THROUGH	0x80000000
148205173Sluigi
149205173Sluigi/*
150204591Sluigi * Access Mode Encoding
151204591Sluigi */
152204591Sluigi#define	SMB_AM_OPENREAD		0x0000
153205173Sluigi#define	SMB_AM_OPENWRITE	0x0001
154205173Sluigi#define	SMB_AM_OPENRW		0x0002
155206845Sluigi#define	SMB_AM_OPENEXEC		0x0003
156206428Sluigi#define	SMB_SM_COMPAT		0x0000
157206428Sluigi#define	SMB_SM_EXCLUSIVE	0x0010
158204591Sluigi#define	SMB_SM_DENYWRITE	0x0020
159204591Sluigi#define	SMB_SM_DENYREADEXEC	0x0030
160204591Sluigi#define	SMB_SM_DENYNONE		0x0040
161204591Sluigi
162204591Sluigi/*
163204591Sluigi * SMB commands
164204591Sluigi */
165204591Sluigi#define	SMB_COM_CREATE_DIRECTORY        0x00
166204591Sluigi#define	SMB_COM_DELETE_DIRECTORY        0x01
167204591Sluigi#define	SMB_COM_OPEN                    0x02
168204591Sluigi#define	SMB_COM_CREATE                  0x03
169204591Sluigi#define	SMB_COM_CLOSE                   0x04
170204591Sluigi#define	SMB_COM_FLUSH                   0x05
171204591Sluigi#define	SMB_COM_DELETE                  0x06
172204591Sluigi#define	SMB_COM_RENAME                  0x07
173204591Sluigi#define	SMB_COM_QUERY_INFORMATION       0x08
174204591Sluigi#define	SMB_COM_SET_INFORMATION         0x09
175204591Sluigi#define	SMB_COM_READ                    0x0A
176204591Sluigi#define	SMB_COM_WRITE                   0x0B
177204591Sluigi#define	SMB_COM_LOCK_BYTE_RANGE         0x0C
178204591Sluigi#define	SMB_COM_UNLOCK_BYTE_RANGE       0x0D
179204591Sluigi#define	SMB_COM_CREATE_TEMPORARY        0x0E
180204591Sluigi#define	SMB_COM_CREATE_NEW              0x0F
181204591Sluigi#define	SMB_COM_CHECK_DIRECTORY         0x10
182204591Sluigi#define	SMB_COM_PROCESS_EXIT            0x11
183204591Sluigi#define	SMB_COM_SEEK                    0x12
184204591Sluigi#define	SMB_COM_LOCK_AND_READ           0x13
185204591Sluigi#define	SMB_COM_WRITE_AND_UNLOCK        0x14
186204591Sluigi#define	SMB_COM_READ_RAW                0x1A
187204591Sluigi#define	SMB_COM_READ_MPX                0x1B
188204591Sluigi#define	SMB_COM_READ_MPX_SECONDARY      0x1C
189204591Sluigi#define	SMB_COM_WRITE_RAW               0x1D
190204591Sluigi#define	SMB_COM_WRITE_MPX               0x1E
191204591Sluigi#define	SMB_COM_WRITE_COMPLETE          0x20
192204591Sluigi#define	SMB_COM_SET_INFORMATION2        0x22
193204591Sluigi#define	SMB_COM_QUERY_INFORMATION2      0x23
194204591Sluigi#define	SMB_COM_LOCKING_ANDX            0x24
195204591Sluigi#define	SMB_COM_TRANSACTION             0x25
196204591Sluigi#define	SMB_COM_TRANSACTION_SECONDARY   0x26
197204591Sluigi#define	SMB_COM_IOCTL                   0x27
198204591Sluigi#define	SMB_COM_IOCTL_SECONDARY         0x28
199204591Sluigi#define	SMB_COM_COPY                    0x29
200204591Sluigi#define	SMB_COM_MOVE                    0x2A
201204591Sluigi#define	SMB_COM_ECHO                    0x2B
202204591Sluigi#define	SMB_COM_WRITE_AND_CLOSE         0x2C
203204591Sluigi#define	SMB_COM_OPEN_ANDX               0x2D
204204591Sluigi#define	SMB_COM_READ_ANDX               0x2E
205204591Sluigi#define	SMB_COM_WRITE_ANDX              0x2F
206204591Sluigi#define	SMB_COM_CLOSE_AND_TREE_DISC     0x31
207204591Sluigi#define	SMB_COM_TRANSACTION2            0x32
208204591Sluigi#define	SMB_COM_TRANSACTION2_SECONDARY  0x33
209204591Sluigi#define	SMB_COM_FIND_CLOSE2             0x34
210204591Sluigi#define	SMB_COM_FIND_NOTIFY_CLOSE       0x35
211204591Sluigi#define	SMB_COM_TREE_CONNECT		0x70
212204591Sluigi#define	SMB_COM_TREE_DISCONNECT         0x71
213204591Sluigi#define	SMB_COM_NEGOTIATE               0x72
214204591Sluigi#define	SMB_COM_SESSION_SETUP_ANDX      0x73
215204591Sluigi#define	SMB_COM_LOGOFF_ANDX             0x74
216204591Sluigi#define	SMB_COM_TREE_CONNECT_ANDX       0x75
217204591Sluigi#define	SMB_COM_QUERY_INFORMATION_DISK  0x80
218204591Sluigi#define	SMB_COM_SEARCH                  0x81
219204591Sluigi#define	SMB_COM_FIND                    0x82
220204591Sluigi#define	SMB_COM_FIND_UNIQUE             0x83
221204591Sluigi#define	SMB_COM_NT_TRANSACT             0xA0
222204591Sluigi#define	SMB_COM_NT_TRANSACT_SECONDARY   0xA1
223204591Sluigi#define	SMB_COM_NT_CREATE_ANDX          0xA2
224204591Sluigi#define	SMB_COM_NT_CANCEL               0xA4
225204591Sluigi#define	SMB_COM_OPEN_PRINT_FILE         0xC0
226204591Sluigi#define	SMB_COM_WRITE_PRINT_FILE        0xC1
227204591Sluigi#define	SMB_COM_CLOSE_PRINT_FILE        0xC2
228204591Sluigi#define	SMB_COM_GET_PRINT_QUEUE         0xC3
229204591Sluigi#define	SMB_COM_READ_BULK               0xD8
230204591Sluigi#define	SMB_COM_WRITE_BULK              0xD9
231204591Sluigi#define	SMB_COM_WRITE_BULK_DATA         0xDA
232204591Sluigi
233204591Sluigi/*
234204591Sluigi * TRANS2 commands
235204591Sluigi */
236204591Sluigi#define	SMB_TRANS2_OPEN2			0x00
237204591Sluigi#define	SMB_TRANS2_FIND_FIRST2			0x01
238204591Sluigi#define	SMB_TRANS2_FIND_NEXT2			0x02
239204591Sluigi#define	SMB_TRANS2_QUERY_FS_INFORMATION		0x03
240204591Sluigi#define	SMB_TRANS2_QUERY_PATH_INFORMATION	0x05
241301772Struckman#define	SMB_TRANS2_SET_PATH_INFORMATION		0x06
242301772Struckman#define	SMB_TRANS2_QUERY_FILE_INFORMATION	0x07
243301772Struckman#define	SMB_TRANS2_SET_FILE_INFORMATION		0x08
244301772Struckman#define	SMB_TRANS2_FSCTL			0x09
245204591Sluigi#define	SMB_TRANS2_IOCTL2			0x0A
246204591Sluigi#define	SMB_TRANS2_FIND_NOTIFY_FIRST		0x0B
247204591Sluigi#define	SMB_TRANS2_FIND_NOTIFY_NEXT		0x0C
248204591Sluigi#define	SMB_TRANS2_CREATE_DIRECTORY		0x0D
249204591Sluigi#define	SMB_TRANS2_SESSION_SETUP		0x0E
250204591Sluigi#define	SMB_TRANS2_GET_DFS_REFERRAL		0x10
251204591Sluigi#define	SMB_TRANS2_REPORT_DFS_INCONSISTENCY	0x11
252204591Sluigi
253204591Sluigi/*
254204591Sluigi * SMB_TRANS2_QUERY_FS_INFORMATION levels
255204591Sluigi */
256204591Sluigi#define SMB_INFO_ALLOCATION		1
257204591Sluigi#define SMB_INFO_VOLUME			2
258204591Sluigi#define SMB_QUERY_FS_VOLUME_INFO	0x102
259204591Sluigi#define SMB_QUERY_FS_SIZE_INFO		0x103
260204591Sluigi#define SMB_QUERY_FS_DEVICE_INFO	0x104
261204591Sluigi#define SMB_QUERY_FS_ATTRIBUTE_INFO	0x105
262204591Sluigi
263204591Sluigi/*
264204591Sluigi * SMB_TRANS2_QUERY_PATH levels
265204591Sluigi */
266204591Sluigi#define	SMB_QUERY_FILE_STANDARD			1
267301772Struckman#define	SMB_QUERY_FILE_EA_SIZE			2
268301772Struckman#define	SMB_QUERY_FILE_EAS_FROM_LIST		3
269301772Struckman#define	SMB_QUERY_FILE_ALL_EAS			4
270204591Sluigi#define	SMB_QUERY_FILE_IS_NAME_VALID		6
271204591Sluigi#define	SMB_QUERY_FILE_BASIC_INFO		0x101
272204591Sluigi#define	SMB_QUERY_FILE_STANDARD_INFO		0x102
273204591Sluigi#define	SMB_QUERY_FILE_EA_INFO			0x103
274204591Sluigi#define	SMB_QUERY_FILE_NAME_INFO		0x104
275204591Sluigi#define	SMB_QUERY_FILE_ALL_INFO			0x107
276204591Sluigi#define	SMB_QUERY_FILE_ALT_NAME_INFO		0x108
277204591Sluigi#define	SMB_QUERY_FILE_STREAM_INFO		0x109
278204591Sluigi#define	SMB_QUERY_FILE_COMPRESSION_INFO		0x10b
279204591Sluigi#define	SMB_QUERY_FILE_UNIX_BASIC		0x200
280204591Sluigi#define	SMB_QUERY_FILE_UNIX_LINK		0x201
281204591Sluigi#define	SMB_QUERY_FILE_MAC_DT_GET_APPL		0x306
282204591Sluigi#define	SMB_QUERY_FILE_MAC_DT_GET_ICON		0x307
283204591Sluigi#define	SMB_QUERY_FILE_MAC_DT_GET_ICON_INFO	0x308
284204591Sluigi
285204591Sluigi/*
286204591Sluigi * SMB_TRANS2_FIND_FIRST2 information levels
287204591Sluigi */
288204591Sluigi#define SMB_INFO_STANDARD		1
289204591Sluigi#define SMB_INFO_QUERY_EA_SIZE		2
290204591Sluigi#define SMB_INFO_QUERY_EAS_FROM_LIST	3
291204591Sluigi#define SMB_FIND_FILE_DIRECTORY_INFO	0x101
292204591Sluigi#define SMB_FIND_FULL_DIRECTORY_INFO	0x102
293204591Sluigi#define SMB_FIND_FILE_NAMES_INFO	0x103
294204591Sluigi#define SMB_FIND_BOTH_DIRECTORY_INFO	0x104
295204591Sluigi
296204591Sluigi/*
297204591Sluigi * Set PATH/FILE information levels
298204591Sluigi */
299204591Sluigi#define	SMB_SET_FILE_BASIC_INFO		0x101
300204591Sluigi#define	SMB_SET_FILE_END_OF_FILE_INFO	0x104
301204591Sluigi
302204591Sluigi/*
303204591Sluigi * LOCKING_ANDX LockType flags
304204591Sluigi */
305204591Sluigi#define SMB_LOCKING_ANDX_SHARED_LOCK	0x01
306204591Sluigi#define SMB_LOCKING_ANDX_OPLOCK_RELEASE	0x02
307204591Sluigi#define SMB_LOCKING_ANDX_CHANGE_LOCKTYPE 0x04
308204591Sluigi#define SMB_LOCKING_ANDX_CANCEL_LOCK	0x08
309204591Sluigi#define SMB_LOCKING_ANDX_LARGE_FILES	0x10
310204591Sluigi
311204591Sluigi/*
312204591Sluigi * Some names length limitations. Some of them aren't declared by specs,
313204591Sluigi * but we need reasonable limits.
314204591Sluigi */
315204591Sluigi#define SMB_MAXSRVNAMELEN	15	/* NetBIOS limit */
316204591Sluigi#define SMB_MAXUSERNAMELEN	128
317204591Sluigi#define SMB_MAXPASSWORDLEN	128
318204591Sluigi#define	SMB_MAXSHARENAMELEN	128
319204591Sluigi#define	SMB_MAXPKTLEN		0x1FFFF
320204591Sluigi#define	SMB_MAXCHALLENGELEN	8
321204591Sluigi#define	SMB_MAXFNAMELEN		255	/* Keep in sync with MAXNAMLEN */
322204591Sluigi
323204591Sluigi#define	SMB_MAXRCN		3	/* number of reconnect attempts */
324204591Sluigi
325204591Sluigi/*
326204591Sluigi * Error classes
327204591Sluigi */
328204591Sluigi#define SMBSUCCESS	0x00
329204591Sluigi#define ERRDOS		0x01
330204591Sluigi#define ERRSRV		0x02
331204591Sluigi#define ERRHRD		0x03	/* Error is a hardware error. */
332204591Sluigi#define ERRCMD		0xFF	/* Command was not in the "SMB" format. */
333204591Sluigi
334204591Sluigi/*
335204591Sluigi * Error codes for the ERRDOS class
336204591Sluigi */
337204591Sluigi#define ERRbadfunc	1	/* Invalid function */
338204591Sluigi#define ERRbadfile	2	/* File not found (last component) */
339204591Sluigi#define ERRbadpath	3	/* Directory invalid */
340204591Sluigi#define ERRnofids	4	/* Too many open files */
341204591Sluigi#define ERRnoaccess	5	/* Access denied */
342204591Sluigi#define ERRbadfid	6	/* Invalid file handle */
343204591Sluigi#define ERRbadmcb	7	/* Memory control blocks destroyed (huh ?) */
344204591Sluigi#define ERRnomem	8	/* Insufficient memory */
345204591Sluigi#define ERRbadmem	9	/* Invalid memory block address */
346204591Sluigi#define ERRbadenv	10	/* Invalid environment */
347204591Sluigi#define ERRbadformat	11	/* Invalid format */
348204591Sluigi#define ERRbadaccess	12	/* Invalid open mode */
349204591Sluigi#define ERRbaddata	13	/* Invalid data */
350204591Sluigi#define ERRbaddrive	15	/* Invalid drive specified */
351204591Sluigi#define ERRremcd	16	/* An attempt to delete current directory */
352204591Sluigi#define ERRdiffdevice	17	/* cross fs rename/move */
353204591Sluigi#define ERRnofiles	18	/* no more files found in file search */
354204591Sluigi#define ERRbadshare	32	/* Share mode can't be granted */
355204591Sluigi#define ERRlock		33	/* A lock request conflicts with existing lock */
356204591Sluigi#define ERRunsup	50	/* unsupported - Win 95 */
357204591Sluigi#define ERRnoipc	66	/* ipc unsupported */
358204591Sluigi#define ERRnosuchshare	67	/* invalid share name */
359204591Sluigi#define ERRfilexists	80	/* The file named in the request already exists */
360204591Sluigi#define	ERRquota	112	/* W2K returns this if quota space exceeds */
361204591Sluigi#define ERRcannotopen	110	/* cannot open the file */
362204591Sluigi#define ERRinvalidname	123
363204591Sluigi#define ERRunknownlevel 124
364213253Sluigi#define ERRnotlocked	158	/* region was not locked by this context */
365213253Sluigi#define ERRrename	183
366204591Sluigi#define ERRbadpipe	230	/* named pipe invalid */
367204591Sluigi#define ERRpipebusy	231	/* all pipe instances are busy */
368204591Sluigi#define ERRpipeclosing	232	/* close in progress */
369325731Struckman#define ERRnotconnected	233	/* nobody on other end of pipe */
370325731Struckman#define ERRmoredata	234	/* more data to be returned */
371325731Struckman#define ERRbaddirectory	267	/* invalid directory name */
372325731Struckman#define ERReasunsupported	282	/* extended attributes not supported */
373325731Struckman#define ERRunknownipc	2142
374325731Struckman#define ERRbuftoosmall	2123
375325731Struckman#define ERRnosuchprintjob	2151
376325731Struckman
377325731Struckman/*
378325731Struckman * Error codes for the ERRSRV class
379325731Struckman */
380325731Struckman#define ERRerror	1	/* Non-specific error code */
381325731Struckman#define ERRbadpw	2	/* Bad password */
382325731Struckman#define ERRbadtype	3	/* reserved */
383325731Struckman#define ERRaccess	4	/* The client doesn't have enough access rights */
384325731Struckman#define ERRinvnid	5	/* The Tid specified in a command is invalid */
385325731Struckman#define ERRinvnetname	6	/* Invalid server name in the tree connect */
386325731Struckman#define ERRinvdevice	7	/* Printer and not printer devices are mixed */
387204591Sluigi#define ERRqfull	49	/* Print queue full */
388206428Sluigi#define ERRqtoobig	50	/* Print queue full - no space */
389213253Sluigi#define ERRinvpfid	52	/* Invalid print file FID */
390204591Sluigi#define ERRsmbcmd	64	/* The server did not recognize the command */
391204591Sluigi#define ERRsrverror	65	/* The server encountered and internal error */
392204591Sluigi#define ERRfilespecs	67	/* The Fid and path name contains an invalid combination */
393204591Sluigi#define ERRbadpermits	69	/* Access mode invalid */
394325731Struckman#define ERRsetattrmode	71	/* Attribute mode invalid */
395204591Sluigi#define ERRpaused	81	/* Server is paused */
396204591Sluigi#define ERRmsgoff	82	/* Not receiving messages */
397204591Sluigi#define ERRnoroom	83	/* No room to buffer message */
398204591Sluigi#define ERRrmuns	87	/* Too many remote user names */
399204591Sluigi#define ERRtimeout	88	/* Operation timed out */
400205050Sluigi#define ERRnoresource	89	/* No resources currently available for request */
401205050Sluigi#define ERRtoomanyuids	90      /* Too many UIDs active on this session */
402205050Sluigi#define ERRbaduid	91	/* The UID is not known in this session */
403205050Sluigi#define ERRusempx	250	/* Temporarily unable to support Raw, use MPX mode */
404205050Sluigi#define ERRusestd	251	/* Temporarily unable to support Raw, use standard r/w */
405205050Sluigi#define ERRcontmpx	252	/* Continue in MPX mode */
406205050Sluigi#define ERRbadPassword	254
407205050Sluigi#define	ERRaccountExpired 2239
408205050Sluigi#define	ERRbadClient	2240	/* Cannot access the server from this workstation */
409205050Sluigi#define	ERRbadLogonTime	2241	/* Cannot access the server at this time **/
410205050Sluigi#define	ERRpasswordExpired 2242
411205050Sluigi#define ERRnosupport	65535	/* Invalid function */
412204591Sluigi
413204591Sluigi/*
414204591Sluigi * Error codes for the ERRHRD class
415204591Sluigi */
416204591Sluigi#define ERRnowrite	19	/* write protected media */
417205050Sluigi#define ERRbadunit	20	/* Unknown unit */
418204591Sluigi#define ERRnotready	21	/* Drive not ready */
419204591Sluigi#define ERRbadcmd	22	/* Unknown command */
420204591Sluigi#define ERRdata		23	/* Data error (CRC) */
421204591Sluigi#define ERRbadreq	24	/* Bad request structure length */
422204591Sluigi#define ERRseek		25	/* Seek error */
423204591Sluigi#define ERRbadmedia	26	/* Unknown media type */
424204591Sluigi#define ERRbadsector	27	/* Sector not found */
425204591Sluigi#define ERRnopaper	28	/* Printer out of paper */
426204591Sluigi#define ERRwrite	29	/* Write fault */
427204591Sluigi#define ERRread		30	/* Read fault */
428204591Sluigi#define ERRgeneral	31	/* General failure */
429206425Sluigi#define	ERRbadshare	32	/* An open conflicts with an existing open */
430204591Sluigi#define	ERRlock		33	/* lock/unlock conflict */
431204591Sluigi#define ERRwrongdisk	34	/* The wrong disk was found in a drive */
432204591Sluigi#define ERRFCBunavail	35	/* No FCBs available */
433204591Sluigi#define ERRsharebufexc	36	/* A sharing buffer has been exceeded */
434204591Sluigi#define ERRdiskfull	39
435204591Sluigi
436301772Struckman/*
437301772Struckman * RAP error codes (it seems that they returned not only by RAP)
438301772Struckman */
439301772Struckman#define	SMB_ERROR_ACCESS_DENIED		5
440301772Struckman#define	SMB_ERROR_NETWORK_ACCESS_DENIED	65
441301772Struckman#define	SMB_ERROR_MORE_DATA		234
442301772Struckman
443301772Struckmantypedef u_int16_t	smbfh;
444301772Struckman
445301772Struckman#endif /* _NETSMB_SMB_H_ */
446301772Struckman