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