smb.h revision 108533
175374Sbp/*
275374Sbp * Copyright (c) 2000-2001 Boris Popov
375374Sbp * All rights reserved.
475374Sbp *
575374Sbp * Redistribution and use in source and binary forms, with or without
675374Sbp * modification, are permitted provided that the following conditions
775374Sbp * are met:
875374Sbp * 1. Redistributions of source code must retain the above copyright
975374Sbp *    notice, this list of conditions and the following disclaimer.
1075374Sbp * 2. Redistributions in binary form must reproduce the above copyright
1175374Sbp *    notice, this list of conditions and the following disclaimer in the
1275374Sbp *    documentation and/or other materials provided with the distribution.
1375374Sbp * 3. All advertising materials mentioning features or use of this software
1475374Sbp *    must display the following acknowledgement:
1575374Sbp *    This product includes software developed by Boris Popov.
1675374Sbp * 4. Neither the name of the author nor the names of any co-contributors
1775374Sbp *    may be used to endorse or promote products derived from this software
1875374Sbp *    without specific prior written permission.
1975374Sbp *
2075374Sbp * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
2175374Sbp * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2275374Sbp * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2375374Sbp * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
2475374Sbp * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2575374Sbp * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2675374Sbp * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2775374Sbp * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2875374Sbp * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2975374Sbp * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3075374Sbp * SUCH DAMAGE.
3175374Sbp *
3275374Sbp * $FreeBSD: head/sys/netsmb/smb.h 108533 2003-01-01 18:49:04Z schweikh $
3375374Sbp */
3475374Sbp
3575374Sbp/*
3688741Sbp * Common definitions and structures for SMB/CIFS protocol
3775374Sbp */
3875374Sbp
3975374Sbp#ifndef _NETSMB_SMB_H_
4075374Sbp#define _NETSMB_SMB_H_
4175374Sbp
4275374Sbp#define	SMB_TCP_PORT	139
4375374Sbp/*
4475374Sbp * SMB dialects that we have to deal with.
4575374Sbp */
4675374Sbpenum smb_dialects {
4775374Sbp	SMB_DIALECT_NONE,
4875374Sbp	SMB_DIALECT_CORE,		/* PC NETWORK PROGRAM 1.0, PCLAN1.0 */
4975374Sbp	SMB_DIALECT_COREPLUS,		/* MICROSOFT NETWORKS 1.03 */
5075374Sbp	SMB_DIALECT_LANMAN1_0,		/* MICROSOFT NETWORKS 3.0, LANMAN1.0 */
5175374Sbp	SMB_DIALECT_LANMAN2_0,		/* LM1.2X002, DOS LM1.2X002, Samba */
5275374Sbp	SMB_DIALECT_LANMAN2_1,		/* DOS LANMAN2.1, LANMAN2.1 */
5375374Sbp	SMB_DIALECT_NTLM0_12		/* NT LM 0.12, Windows for Workgroups 3.1a,
5475374Sbp					 * NT LANMAN 1.0 */
5575374Sbp};
5675374Sbp
5775374Sbp/*
5875374Sbp * Formats of data/string buffers
5975374Sbp */
6075374Sbp#define	SMB_DT_DATA		1
6175374Sbp#define	SMB_DT_DIALECT		2
6275374Sbp#define	SMB_DT_PATHNAME		3
6375374Sbp#define	SMB_DT_ASCII		4
6475374Sbp#define	SMB_DT_VARIABLE		5
6575374Sbp
6675374Sbp/*
6775374Sbp * SMB header
6875374Sbp */
6975374Sbp#define	SMB_SIGNATURE		"\xFFSMB"
7075374Sbp#define	SMB_SIGLEN		4
71107940Srobert#define	SMB_HDRMID(p)		(le16toh(*(u_short*)((u_char*)(p) + 30)))
7275374Sbp#define	SMB_HDRLEN		32
7375374Sbp/*
7475374Sbp * bits in the smb_flags field
7575374Sbp */
7675374Sbp#define	SMB_FLAGS_CASELESS	0x08
7775374Sbp#define SMB_FLAGS_SERVER_RESP	0x80	/* indicates a response */
7875374Sbp
7975374Sbp/*
8075374Sbp * bits in the smb_flags2 field
8175374Sbp */
8275374Sbp#define	SMB_FLAGS2_KNOWS_LONG_NAMES	0x0001
8375374Sbp#define	SMB_FLAGS2_KNOWS_EAS		0x0002	/* client know about EAs */
8475374Sbp#define	SMB_FLAGS2_SECURITY_SIGNATURE	0x0004	/* check SMB integrity */
8575374Sbp#define	SMB_FLAGS2_IS_LONG_NAME		0x0040	/* any path name is a long name */
8675374Sbp#define	SMB_FLAGS2_EXT_SEC		0x0800	/* client aware of Extended
8775374Sbp						 * Security negotiation */
8875374Sbp#define	SMB_FLAGS2_DFS			0x1000	/* resolve paths in DFS */
8975374Sbp#define	SMB_FLAGS2_PAGING_IO		0x2000	/* for exec */
9075374Sbp#define	SMB_FLAGS2_ERR_STATUS		0x4000	/* 1 - status.status */
9175374Sbp#define	SMB_FLAGS2_UNICODE		0x8000	/* use Unicode for all strings */
9275374Sbp
9375374Sbp#define	SMB_UID_UNKNOWN		0xffff
9475374Sbp#define	SMB_TID_UNKNOWN		0xffff
9575374Sbp
9675374Sbp/*
9775374Sbp * Security mode bits
9875374Sbp */
9975374Sbp#define SMB_SM_USER		0x01		/* server in the user security mode */
10088741Sbp#define	SMB_SM_ENCRYPT		0x02		/* use challenge/response */
101103389Sbp#define	SMB_SM_SIGS		0x04
102103389Sbp#define	SMB_SM_SIGS_REQUIRE	0x08
10375374Sbp
10475374Sbp/*
10575374Sbp * NTLM capabilities
10675374Sbp */
107103389Sbp#define	SMB_CAP_RAW_MODE		0x0001
108103389Sbp#define	SMB_CAP_MPX_MODE		0x0002
109103389Sbp#define	SMB_CAP_UNICODE			0x0004
110103389Sbp#define	SMB_CAP_LARGE_FILES		0x0008		/* 64 bit offsets supported */
111103389Sbp#define	SMB_CAP_NT_SMBS			0x0010
112103389Sbp#define	SMB_CAP_RPC_REMOTE_APIS		0x0020
113103389Sbp#define	SMB_CAP_STATUS32		0x0040
114103389Sbp#define	SMB_CAP_LEVEL_II_OPLOCKS	0x0080
115103389Sbp#define	SMB_CAP_LOCK_AND_READ		0x0100
116103389Sbp#define	SMB_CAP_NT_FIND			0x0200
117103389Sbp#define	SMB_CAP_DFS			0x1000
118103389Sbp#define	SMB_CAP_INFOLEVEL_PASSTHRU	0x2000
119103389Sbp#define	SMB_CAP_LARGE_READX		0x4000
120103389Sbp#define	SMB_CAP_LARGE_WRITEX		0x8000
121103389Sbp#define	SMB_CAP_UNIX			0x00800000
122103389Sbp#define	SMB_CAP_BULK_TRANSFER		0x20000000
123103389Sbp#define	SMB_CAP_COMPRESSED_DATA		0x40000000
124103389Sbp#define	SMB_CAP_EXT_SECURITY		0x80000000
12575374Sbp
12675374Sbp/*
12775374Sbp * File attributes
12875374Sbp */
12975374Sbp#define	SMB_FA_RDONLY		0x01
13075374Sbp#define	SMB_FA_HIDDEN		0x02
13175374Sbp#define	SMB_FA_SYSTEM		0x04
13275374Sbp#define	SMB_FA_VOLUME		0x08
13375374Sbp#define	SMB_FA_DIR		0x10
13475374Sbp#define	SMB_FA_ARCHIVE		0x20
13575374Sbp
13675374Sbp/*
13775374Sbp * Extended file attributes
13875374Sbp */
13975374Sbp#define	SMB_EFA_RDONLY		0x0001
14075374Sbp#define	SMB_EFA_HIDDEN		0x0002
14175374Sbp#define	SMB_EFA_SYSTEM		0x0004
142103389Sbp#define	SMB_EFA_DIRECTORY	0x0010
14375374Sbp#define	SMB_EFA_ARCHIVE		0x0020
14475374Sbp#define	SMB_EFA_NORMAL		0x0080
14575374Sbp#define	SMB_EFA_TEMPORARY	0x0100
14675374Sbp#define	SMB_EFA_COMPRESSED	0x0800
147103389Sbp#define	SMB_EFA_POSIX_SEMANTICS	0x01000000
14875374Sbp#define	SMB_EFA_BACKUP_SEMANTICS 0x02000000
14975374Sbp#define	SMB_EFA_DELETE_ON_CLOSE	0x04000000
15075374Sbp#define	SMB_EFA_SEQUENTIAL_SCAN	0x08000000
15175374Sbp#define	SMB_EFA_RANDOM_ACCESS	0x10000000
15275374Sbp#define	SMB_EFA_NO_BUFFERING	0x20000000
15375374Sbp#define	SMB_EFA_WRITE_THROUGH	0x80000000
15475374Sbp
15575374Sbp/*
15675374Sbp * Access Mode Encoding
15775374Sbp */
15875374Sbp#define	SMB_AM_OPENREAD		0x0000
15975374Sbp#define	SMB_AM_OPENWRITE	0x0001
16075374Sbp#define	SMB_AM_OPENRW		0x0002
16175374Sbp#define	SMB_AM_OPENEXEC		0x0003
16275374Sbp#define	SMB_SM_COMPAT		0x0000
16375374Sbp#define	SMB_SM_EXCLUSIVE	0x0010
16475374Sbp#define	SMB_SM_DENYWRITE	0x0020
16575374Sbp#define	SMB_SM_DENYREADEXEC	0x0030
16675374Sbp#define	SMB_SM_DENYNONE		0x0040
16775374Sbp
16875374Sbp/*
16975374Sbp * SMB commands
17075374Sbp */
17175374Sbp#define	SMB_COM_CREATE_DIRECTORY        0x00
17275374Sbp#define	SMB_COM_DELETE_DIRECTORY        0x01
17375374Sbp#define	SMB_COM_OPEN                    0x02
17475374Sbp#define	SMB_COM_CREATE                  0x03
17575374Sbp#define	SMB_COM_CLOSE                   0x04
17675374Sbp#define	SMB_COM_FLUSH                   0x05
17775374Sbp#define	SMB_COM_DELETE                  0x06
17875374Sbp#define	SMB_COM_RENAME                  0x07
17975374Sbp#define	SMB_COM_QUERY_INFORMATION       0x08
18075374Sbp#define	SMB_COM_SET_INFORMATION         0x09
18175374Sbp#define	SMB_COM_READ                    0x0A
18275374Sbp#define	SMB_COM_WRITE                   0x0B
18375374Sbp#define	SMB_COM_LOCK_BYTE_RANGE         0x0C
18475374Sbp#define	SMB_COM_UNLOCK_BYTE_RANGE       0x0D
18575374Sbp#define	SMB_COM_CREATE_TEMPORARY        0x0E
18675374Sbp#define	SMB_COM_CREATE_NEW              0x0F
18775374Sbp#define	SMB_COM_CHECK_DIRECTORY         0x10
18875374Sbp#define	SMB_COM_PROCESS_EXIT            0x11
18975374Sbp#define	SMB_COM_SEEK                    0x12
19075374Sbp#define	SMB_COM_LOCK_AND_READ           0x13
19175374Sbp#define	SMB_COM_WRITE_AND_UNLOCK        0x14
19275374Sbp#define	SMB_COM_READ_RAW                0x1A
19375374Sbp#define	SMB_COM_READ_MPX                0x1B
19475374Sbp#define	SMB_COM_READ_MPX_SECONDARY      0x1C
19575374Sbp#define	SMB_COM_WRITE_RAW               0x1D
19675374Sbp#define	SMB_COM_WRITE_MPX               0x1E
19775374Sbp#define	SMB_COM_WRITE_COMPLETE          0x20
19875374Sbp#define	SMB_COM_SET_INFORMATION2        0x22
19975374Sbp#define	SMB_COM_QUERY_INFORMATION2      0x23
20075374Sbp#define	SMB_COM_LOCKING_ANDX            0x24
20175374Sbp#define	SMB_COM_TRANSACTION             0x25
20275374Sbp#define	SMB_COM_TRANSACTION_SECONDARY   0x26
20375374Sbp#define	SMB_COM_IOCTL                   0x27
20475374Sbp#define	SMB_COM_IOCTL_SECONDARY         0x28
20575374Sbp#define	SMB_COM_COPY                    0x29
20675374Sbp#define	SMB_COM_MOVE                    0x2A
20775374Sbp#define	SMB_COM_ECHO                    0x2B
20875374Sbp#define	SMB_COM_WRITE_AND_CLOSE         0x2C
20975374Sbp#define	SMB_COM_OPEN_ANDX               0x2D
21075374Sbp#define	SMB_COM_READ_ANDX               0x2E
21175374Sbp#define	SMB_COM_WRITE_ANDX              0x2F
21275374Sbp#define	SMB_COM_CLOSE_AND_TREE_DISC     0x31
21375374Sbp#define	SMB_COM_TRANSACTION2            0x32
21475374Sbp#define	SMB_COM_TRANSACTION2_SECONDARY  0x33
21575374Sbp#define	SMB_COM_FIND_CLOSE2             0x34
21675374Sbp#define	SMB_COM_FIND_NOTIFY_CLOSE       0x35
21775374Sbp#define	SMB_COM_TREE_CONNECT		0x70
21875374Sbp#define	SMB_COM_TREE_DISCONNECT         0x71
21975374Sbp#define	SMB_COM_NEGOTIATE               0x72
22075374Sbp#define	SMB_COM_SESSION_SETUP_ANDX      0x73
22175374Sbp#define	SMB_COM_LOGOFF_ANDX             0x74
22275374Sbp#define	SMB_COM_TREE_CONNECT_ANDX       0x75
22375374Sbp#define	SMB_COM_QUERY_INFORMATION_DISK  0x80
22475374Sbp#define	SMB_COM_SEARCH                  0x81
22575374Sbp#define	SMB_COM_FIND                    0x82
22675374Sbp#define	SMB_COM_FIND_UNIQUE             0x83
22775374Sbp#define	SMB_COM_NT_TRANSACT             0xA0
22875374Sbp#define	SMB_COM_NT_TRANSACT_SECONDARY   0xA1
22975374Sbp#define	SMB_COM_NT_CREATE_ANDX          0xA2
23075374Sbp#define	SMB_COM_NT_CANCEL               0xA4
23175374Sbp#define	SMB_COM_OPEN_PRINT_FILE         0xC0
23275374Sbp#define	SMB_COM_WRITE_PRINT_FILE        0xC1
23375374Sbp#define	SMB_COM_CLOSE_PRINT_FILE        0xC2
23475374Sbp#define	SMB_COM_GET_PRINT_QUEUE         0xC3
23575374Sbp#define	SMB_COM_READ_BULK               0xD8
23675374Sbp#define	SMB_COM_WRITE_BULK              0xD9
23775374Sbp#define	SMB_COM_WRITE_BULK_DATA         0xDA
23875374Sbp
23975374Sbp/*
24075374Sbp * TRANS2 commands
24175374Sbp */
24275374Sbp#define	SMB_TRANS2_OPEN2			0x00
24375374Sbp#define	SMB_TRANS2_FIND_FIRST2			0x01
24475374Sbp#define	SMB_TRANS2_FIND_NEXT2			0x02
24575374Sbp#define	SMB_TRANS2_QUERY_FS_INFORMATION		0x03
24675374Sbp#define	SMB_TRANS2_QUERY_PATH_INFORMATION	0x05
24775374Sbp#define	SMB_TRANS2_SET_PATH_INFORMATION		0x06
24875374Sbp#define	SMB_TRANS2_QUERY_FILE_INFORMATION	0x07
24975374Sbp#define	SMB_TRANS2_SET_FILE_INFORMATION		0x08
25075374Sbp#define	SMB_TRANS2_FSCTL			0x09
25175374Sbp#define	SMB_TRANS2_IOCTL2			0x0A
25275374Sbp#define	SMB_TRANS2_FIND_NOTIFY_FIRST		0x0B
25375374Sbp#define	SMB_TRANS2_FIND_NOTIFY_NEXT		0x0C
25475374Sbp#define	SMB_TRANS2_CREATE_DIRECTORY		0x0D
25575374Sbp#define	SMB_TRANS2_SESSION_SETUP		0x0E
25675374Sbp#define	SMB_TRANS2_GET_DFS_REFERRAL		0x10
25775374Sbp#define	SMB_TRANS2_REPORT_DFS_INCONSISTENCY	0x11
25875374Sbp
25975374Sbp/*
26075374Sbp * SMB_TRANS2_QUERY_FS_INFORMATION levels
26175374Sbp */
26275374Sbp#define SMB_INFO_ALLOCATION		1
26375374Sbp#define SMB_INFO_VOLUME			2
26475374Sbp#define SMB_QUERY_FS_VOLUME_INFO	0x102
26575374Sbp#define SMB_QUERY_FS_SIZE_INFO		0x103
26675374Sbp#define SMB_QUERY_FS_DEVICE_INFO	0x104
26775374Sbp#define SMB_QUERY_FS_ATTRIBUTE_INFO	0x105
26875374Sbp
26975374Sbp/*
270103389Sbp * SMB_TRANS2_QUERY_PATH levels
271103389Sbp */
272103389Sbp#define	SMB_QUERY_FILE_STANDARD			1
273103389Sbp#define	SMB_QUERY_FILE_EA_SIZE			2
274103389Sbp#define	SMB_QUERY_FILE_EAS_FROM_LIST		3
275103389Sbp#define	SMB_QUERY_FILE_ALL_EAS			4
276103389Sbp#define	SMB_QUERY_FILE_IS_NAME_VALID		6
277103389Sbp#define	SMB_QUERY_FILE_BASIC_INFO		0x101
278103389Sbp#define	SMB_QUERY_FILE_STANDARD_INFO		0x102
279103389Sbp#define	SMB_QUERY_FILE_EA_INFO			0x103
280103389Sbp#define	SMB_QUERY_FILE_NAME_INFO		0x104
281103389Sbp#define	SMB_QUERY_FILE_ALL_INFO			0x107
282103389Sbp#define	SMB_QUERY_FILE_ALT_NAME_INFO		0x108
283103389Sbp#define	SMB_QUERY_FILE_STREAM_INFO		0x109
284103389Sbp#define	SMB_QUERY_FILE_COMPRESSION_INFO		0x10b
285103389Sbp#define	SMB_QUERY_FILE_UNIX_BASIC		0x200
286103389Sbp#define	SMB_QUERY_FILE_UNIX_LINK		0x201
287103389Sbp#define	SMB_QUERY_FILE_MAC_DT_GET_APPL		0x306
288103389Sbp#define	SMB_QUERY_FILE_MAC_DT_GET_ICON		0x307
289103389Sbp#define	SMB_QUERY_FILE_MAC_DT_GET_ICON_INFO	0x308
290103389Sbp
291103389Sbp/*
29275374Sbp * SMB_TRANS2_FIND_FIRST2 information levels
29375374Sbp */
29475374Sbp#define SMB_INFO_STANDARD		1
29575374Sbp#define SMB_INFO_QUERY_EA_SIZE		2
29675374Sbp#define SMB_INFO_QUERY_EAS_FROM_LIST	3
29775374Sbp#define SMB_FIND_FILE_DIRECTORY_INFO	0x101
29875374Sbp#define SMB_FIND_FULL_DIRECTORY_INFO	0x102
29975374Sbp#define SMB_FIND_FILE_NAMES_INFO	0x103
30075374Sbp#define SMB_FIND_BOTH_DIRECTORY_INFO	0x104
30175374Sbp
30275374Sbp/*
30375374Sbp * Set PATH/FILE information levels
30475374Sbp */
30575374Sbp#define	SMB_SET_FILE_BASIC_INFO		0x101
30691021Sbp#define	SMB_SET_FILE_END_OF_FILE_INFO	0x104
30775374Sbp
30875374Sbp/*
30975374Sbp * LOCKING_ANDX LockType flags
31075374Sbp */
31175374Sbp#define SMB_LOCKING_ANDX_SHARED_LOCK	0x01
31275374Sbp#define SMB_LOCKING_ANDX_OPLOCK_RELEASE	0x02
31375374Sbp#define SMB_LOCKING_ANDX_CHANGE_LOCKTYPE 0x04
31475374Sbp#define SMB_LOCKING_ANDX_CANCEL_LOCK	0x08
31575374Sbp#define SMB_LOCKING_ANDX_LARGE_FILES	0x10
31675374Sbp
31775374Sbp/*
31875374Sbp * Some names length limitations. Some of them aren't declared by specs,
31975374Sbp * but we need reasonable limits.
32075374Sbp */
32175374Sbp#define SMB_MAXSRVNAMELEN	15	/* NetBIOS limit */
32275374Sbp#define SMB_MAXUSERNAMELEN	128
32375374Sbp#define SMB_MAXPASSWORDLEN	128
32475374Sbp#define	SMB_MAXSHARENAMELEN	128
32575374Sbp#define	SMB_MAXPKTLEN		0x1FFFF
32675374Sbp#define	SMB_MAXCHALLENGELEN	8
32775374Sbp#define	SMB_MAXFNAMELEN		255	/* Keep in sync with MAXNAMLEN */
32875374Sbp
32975374Sbp#define	SMB_MAXRCN		3	/* number of reconnect attempts */
33075374Sbp
33175374Sbp/*
33275374Sbp * Error classes
33375374Sbp */
33475374Sbp#define SMBSUCCESS	0x00
33575374Sbp#define ERRDOS		0x01
33675374Sbp#define ERRSRV		0x02
337108470Sschweikh#define ERRHRD		0x03	/* Error is a hardware error. */
33875374Sbp#define ERRCMD		0xFF	/* Command was not in the "SMB" format. */
33975374Sbp
34075374Sbp/*
34175374Sbp * Error codes for the ERRDOS class
34275374Sbp */
34375374Sbp#define ERRbadfunc	1	/* Invalid function */
34475374Sbp#define ERRbadfile	2	/* File not found (last component) */
34575374Sbp#define ERRbadpath	3	/* Directory invalid */
34675374Sbp#define ERRnofids	4	/* Too many open files */
34775374Sbp#define ERRnoaccess	5	/* Access denied */
34875374Sbp#define ERRbadfid	6	/* Invalid file handle */
34975374Sbp#define ERRbadmcb	7	/* Memory control blocks destroyed (huh ?) */
35075374Sbp#define ERRnomem	8	/* Insufficient memory */
35175374Sbp#define ERRbadmem	9	/* Invalid memory block address */
35275374Sbp#define ERRbadenv	10	/* Invalid environment */
35375374Sbp#define ERRbadformat	11	/* Invalid format */
35475374Sbp#define ERRbadaccess	12	/* Invalid open mode */
35575374Sbp#define ERRbaddata	13	/* Invalid data */
35675374Sbp#define ERRbaddrive	15	/* Invalid drive specified */
35775374Sbp#define ERRremcd	16	/* An attempt to delete current directory */
35875374Sbp#define ERRdiffdevice	17	/* cross fs rename/move */
35975374Sbp#define ERRnofiles	18	/* no more files found in file search */
36075374Sbp#define ERRbadshare	32	/* Share mode can't be granted */
36175374Sbp#define ERRlock		33	/* A lock request conflicts with existing lock */
362103389Sbp#define ERRunsup	50	/* unsupported - Win 95 */
363103389Sbp#define ERRnoipc	66	/* ipc unsupported */
364103389Sbp#define ERRnosuchshare	67	/* invalid share name */
36575374Sbp#define ERRfilexists	80	/* The file named in the request already exists */
36694914Sbp#define	ERRquota	112	/* W2K returns this if quota space exceeds */
367103389Sbp#define ERRcannotopen	110	/* cannot open the file */
368103389Sbp#define ERRinvalidname	123
369103389Sbp#define ERRunknownlevel 124
370103389Sbp#define ERRnotlocked	158	/* region was not locked by this context */
371103389Sbp#define ERRrename	183
372103389Sbp#define ERRbadpipe	230	/* named pipe invalid */
373103389Sbp#define ERRpipebusy	231	/* all pipe instances are busy */
374103389Sbp#define ERRpipeclosing	232	/* close in progress */
375103389Sbp#define ERRnotconnected	233	/* nobody on other end of pipe */
376103389Sbp#define ERRmoredata	234	/* more data to be returned */
377103389Sbp#define ERRbaddirectory	267	/* invalid directory name */
378103389Sbp#define ERReasunsupported	282	/* extended attributes not supported */
379103389Sbp#define ERRunknownipc	2142
380103389Sbp#define ERRbuftoosmall	2123
381103389Sbp#define ERRnosuchprintjob	2151
38275374Sbp
38375374Sbp/*
38475374Sbp * Error codes for the ERRSRV class
38575374Sbp */
38675374Sbp#define ERRerror	1	/* Non-specific error code */
38775374Sbp#define ERRbadpw	2	/* Bad password */
388103389Sbp#define ERRbadtype	3	/* reserved */
38975374Sbp#define ERRaccess	4	/* The client doesn't have enough access rights */
39075374Sbp#define ERRinvnid	5	/* The Tid specified in a command is invalid */
39175374Sbp#define ERRinvnetname	6	/* Invalid server name in the tree connect */
39275374Sbp#define ERRinvdevice	7	/* Printer and not printer devices are mixed */
39375374Sbp#define ERRqfull	49	/* Print queue full */
39475374Sbp#define ERRqtoobig	50	/* Print queue full - no space */
39575374Sbp#define ERRinvpfid	52	/* Invalid print file FID */
39688741Sbp#define ERRsmbcmd	64	/* The server did not recognize the command */
39775374Sbp#define ERRsrverror	65	/* The server encountered and internal error */
39875374Sbp#define ERRfilespecs	67	/* The Fid and path name contains an invalid combination */
39975374Sbp#define ERRbadpermits	69	/* Access mode invalid */
40075374Sbp#define ERRsetattrmode	71	/* Attribute mode invalid */
40175374Sbp#define ERRpaused	81	/* Server is paused */
40275374Sbp#define ERRmsgoff	82	/* Not receiving messages */
40375374Sbp#define ERRnoroom	83	/* No room to buffer message */
40475374Sbp#define ERRrmuns	87	/* Too many remote user names */
40575374Sbp#define ERRtimeout	88	/* Operation timed out */
40675374Sbp#define ERRnoresource	89	/* No resources currently available for request */
40775374Sbp#define ERRtoomanyuids	90      /* Too many UIDs active on this session */
40875374Sbp#define ERRbaduid	91	/* The UID is not known in this session */
40975374Sbp#define ERRusempx	250	/* Temporarily unable to support Raw, use MPX mode */
41088741Sbp#define ERRusestd	251	/* Temporarily unable to support Raw, use standard r/w */
41175374Sbp#define ERRcontmpx	252	/* Continue in MPX mode */
41294914Sbp#define ERRbadPassword	254
41394914Sbp#define	ERRaccountExpired 2239
41494914Sbp#define	ERRbadClient	2240	/* Cannot access the server from this workstation */
41594914Sbp#define	ERRbadLogonTime	2241	/* Cannot access the server at this time **/
41694914Sbp#define	ERRpasswordExpired 2242
41775374Sbp#define ERRnosupport	65535	/* Invalid function */
41875374Sbp
41975374Sbp/*
42075374Sbp * Error codes for the ERRHRD class
42175374Sbp */
42275374Sbp#define ERRnowrite	19	/* write protected media */
42375374Sbp#define ERRbadunit	20	/* Unknown unit */
42475374Sbp#define ERRnotready	21	/* Drive not ready */
42575374Sbp#define ERRbadcmd	22	/* Unknown command */
42675374Sbp#define ERRdata		23	/* Data error (CRC) */
42775374Sbp#define ERRbadreq	24	/* Bad request structure length */
42875374Sbp#define ERRseek		25	/* Seek error */
42975374Sbp#define ERRbadmedia	26	/* Unknown media type */
43075374Sbp#define ERRbadsector	27	/* Sector not found */
43175374Sbp#define ERRnopaper	28	/* Printer out of paper */
43275374Sbp#define ERRwrite	29	/* Write fault */
43375374Sbp#define ERRread		30	/* Read fault */
43475374Sbp#define ERRgeneral	31	/* General failure */
435108533Sschweikh#define	ERRbadshare	32	/* An open conflicts with an existing open */
43675374Sbp#define	ERRlock		33	/* lock/unlock conflict */
43775374Sbp#define ERRwrongdisk	34	/* The wrong disk was found in a drive */
43875374Sbp#define ERRFCBunavail	35	/* No FCBs available */
43975374Sbp#define ERRsharebufexc	36	/* A sharing buffer has been exceeded */
440103389Sbp#define ERRdiskfull	39
44175374Sbp
44275374Sbp/*
44375374Sbp * RAP error codes (it seems that they returned not only by RAP)
44475374Sbp */
44575374Sbp#define	SMB_ERROR_ACCESS_DENIED		5
44675374Sbp#define	SMB_ERROR_NETWORK_ACCESS_DENIED	65
44775374Sbp#define	SMB_ERROR_MORE_DATA		234
44875374Sbp
44975374Sbptypedef u_int16_t	smbfh;
45075374Sbp
45175374Sbp#endif /* _NETSMB_SMB_H_ */
452