1/*
2 * Copyright (c) 2009 Apple Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23#ifndef NTSTATUS_H_83E0C5F3_6873_4CAA_ADEF_C95FBDD3625E
24#define NTSTATUS_H_83E0C5F3_6873_4CAA_ADEF_C95FBDD3625E
25
26#ifdef __cplusplus
27extern "C" {
28#endif
29
30/*
31 *  NTSTATUS encoding are 32 bit values layed out as follows:
32 *
33 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
34 * | | | | | | | | | | |1| | | | | | | | | |2| | | | | | | | | |3| |
35 * |0|1|2|3|4|5|6|7|8|9|0|1|2|3|4|5|6|7|8|9|0|1|2|3|4|5|6|7|8|9|0|1|
36 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
37 * |Sev|C|R| Facility              | Code                          |
38 * +-------+-----------------------+-------------------------------+
39 *
40 *  where
41 *
42 *      Sev - is the severity code
43 *
44 *          00 - Success
45 *          01 - Informational
46 *          10 - Warning
47 *          11 - Error
48 *
49 *      C - is the Customer code flag
50 *
51 *      R - is a reserved bit
52 *
53 *      Facility - is the facility code
54 *			FACILITY_WINDOWS_CE              24
55 *			FACILITY_WINDOWS                 8
56 *			FACILITY_URT                     19
57 *			FACILITY_UMI                     22
58 *			FACILITY_SXS                     23
59 *			FACILITY_STORAGE                 3
60 *			FACILITY_SSPI                    9
61 *			FACILITY_SCARD                   16
62 *			FACILITY_SETUPAPI                15
63 *			FACILITY_SECURITY                9
64 *			FACILITY_RPC                     1
65 *			FACILITY_WIN32                   7
66 *			FACILITY_CONTROL                 10
67 *			FACILITY_NULL                    0
68 *			FACILITY_MSMQ                    14
69 *			FACILITY_MEDIASERVER             13
70 *			FACILITY_INTERNET                12
71 *			FACILITY_ITF                     4
72 *			FACILITY_HTTP                    25
73 *			FACILITY_DPLAY                   21
74 *			FACILITY_DISPATCH                2
75 *			FACILITY_CONFIGURATION           33
76 *			FACILITY_COMPLUS                 17
77 *			FACILITY_CERT                    11
78 *			FACILITY_BACKGROUNDCOPY          32
79 *			FACILITY_ACS                     20
80 *			FACILITY_AAF                     18
81 *
82 *
83 *      Code - is the facility's status code
84 *				See ntstatus.inc
85 */
86
87#define STATUS_SEVERITY_SUCCESS			0x00000000
88#define STATUS_SEVERITY_INFORMATIONAL	0x40000000
89#define STATUS_SEVERITY_WARNING			0x80000000
90#define STATUS_SEVERITY_ERROR			0xC0000000
91#define STATUS_SEVERITY_MASK			0xC0000000
92
93typedef enum nt_status
94{
95#undef declare_ntstatus
96#define declare_ntstatus(name, value) name = value,
97#include "ntstatus.inc"
98#undef declare_ntstatus
99}nt_status;
100
101
102/*
103 * [MS-CIFS] - 2.2.2.4 SMB Error Classes and Codes
104 * This section provides an overview of status codes that can be returned by the
105 * SMB commands listed in this document, including mappings between the NTSTATUS
106 * codes used in the NT LAN Manager dialect, the SMBSTATUS class/code pairs used
107 * in earlier SMB dialects, and common POSIX equivalents. The POSIX error code
108 * mappings are based upon those used in the Xenix server implementation. This
109 * is not an exhaustive listing and MUST NOT be considered normative.
110 * Each command and subcommand description also includes a list of status codes
111 * that are returned by CIFS-compliant servers. Individual implementations can
112 * return status codes from their underlying operating systems; it is up to the
113 * implementer to decide how to interpret those status codes.
114 * The listing below is organized by SMBSTATUS Error Class. It shows SMBSTATUS
115 * Error Code values and a general description, as well as mappings from
116 * NTSTATUS values ([MS-ERREF] section 2.3.1) and POSIX-style error codes where
117 * possible. Note that multiple NTSTATUS values can map to a single SMBSTATUS
118 * value.
119 *
120 * NOTE: Skipping all OS2 errors, then will all default to STATUS_UNSUCCESSFUL
121 */
122#define SUCCESS_Class	0x00
123
124#define ERRDOS_Class	0x01
125#define ERRbadfunc		0x0001	/* STATUS_NOT_IMPLEMENTED */
126#define ERRbadfile		0x0002	/* STATUS_NO_SUCH_FILE */
127#define ERRbadpath		0x0003	/* STATUS_OBJECT_PATH_NOT_FOUND */
128#define ERRnofids		0x0004	/* STATUS_TOO_MANY_OPENED_FILES */
129#define ERRnoaccess		0x0005	/* STATUS_ACCESS_DENIED */
130#define ERRbadfid		0x0006	/* STATUS_INVALID_HANDLE */
131#define ERRbadmcb		0x0007	/* STATUS_INSUFF_SERVER_RESOURCES */
132#define ERRnomem		0x0008	/* STATUS_NO_MEMORY */
133#define ERRbadmem		0x0009	/* STATUS_NO_MEMORY */
134#define ERRbadenv		0x000A	/* STATUS_INVALID_PARAMETER */
135#define ERRbadformat	0x000B	/* STATUS_INVALID_PARAMETER */
136#define ERRbadaccess	0x000C	/* STATUS_ACCESS_DENIED */
137#define ERRbaddata		0x000D	/* STATUS_DATA_ERROR */
138#define ERRoutofmem		0x000E	/* STATUS_NO_MEMORY */
139#define ERRbaddrive		0x000F	/* STATUS_INSUFF_SERVER_RESOURCES */
140#define ERRremcd		0x0010	/* STATUS_DIRECTORY_NOT_EMPTY */
141#define ERRdiffdevice	0x0011	/* STATUS_NOT_SAME_DEVICE */
142#define ERRnofiles		0x0012	/* STATUS_NO_MORE_FILES */
143#define ERRwriteprotect	0x0013	/* STATUS_MEDIA_WRITE_PROTECTED */
144#define ERRnotready		0x0015	/* STATUS_DEVICE_NOT_READY */
145#define ERRbadcmd		0x0016	/* STATUS_SMB_BAD_COMMAND */
146#define ERRcrc			0x0017	/* STATUS_DATA_ERROR */
147#define ERRbadlength	0x0018	/* STATUS_INFO_LENGTH_MISMATCH */
148#define ERRsectornotfound 0x001b /* STATUS_NONEXISTENT_SECTOR */
149#define ERRgeneral		0x001F	/* STATUS_UNSUCCESSFUL */
150#define ERRbadshare		0x0020	/* STATUS_SHARING_VIOLATION */
151#define ERRlock			0x0021	/* STATUS_FILE_LOCK_CONFLICT or STATUS_LOCK_NOT_GRANTED */
152#define ERRwrongdisk	0x0022	/* STATUS_WRONG_VOLUME */
153#define ERReof			0x0026	/* STATUS_END_OF_FILE */
154#define ERRunsup		0x0032	/* STATUS_NOT_SUPPORTED */
155#define ERRnoipc		0x0042	/* STATUS_BAD_NETWORK_NAME */
156#define ERRnosuchshare	0x0043	/* STATUS_BAD_NETWORK_NAME */
157#define ERRtoomanynames	0x0044	/* STATUS_TOO_MANY_NAMES */
158#define ERRfilexists	0x0050	/* STATUS_OBJECT_NAME_COLLISION */
159#define ERRinvalidparam	0x0057	/* STATUS_INVALID_PARAMETER */
160#define ERRinvalidname	0x007b	/* STATUS_OBJECT_NAME_INVALID */
161#define ERRunknownlevel	0x007c	/* STATUS_INVALID_LEVEL*/
162#define ERRdirnotempty	0x0091	/* STATUS_DIRECTORY_NOT_EMPTY */
163#define ERRnotlocked	0x009E	/* STATUS_RANGE_NOT_LOCKED */
164#define ERRrename		0x00b7	/* STATUS_OBJECT_NAME_COLLISION */
165#define ERRbadpipe		0x00E6	/* STATUS_INVALID_PIPE_STATE */
166#define ERRpipebusy		0x00E7	/* STATUS_PIPE_BUSY */
167#define ERRpipeclosing	0x00E8	/* STATUS_PIPE_CLOSING */
168#define ERRnotconnected 0x00E9	/* STATUS_PIPE_DISCONNECTED */
169#define ERRmoredata		0x00EA	/* STATUS_MORE_PROCESSING_REQUIRED */
170#define ERRbadealist	0x00FF	/* STATUS_EA_TOO_LARGE */
171#define ERReasunsupported 0x011A /* STATUS_EAS_NOT_SUPPORTED */
172#define ERRnotifyenumdir 0x03FE	/* STATUS_NOTIFY_ENUM_DIR */
173#define ERRinvgroup		0x0997	/* STATUS_NETLOGON_NOT_STARTED */
174
175#define ERRSRV_Class	0x02
176#define	ERRerror		0x0001	/* STATUS_INSUFFICIENT_RESOURCES */
177#define	ERRbadpw		0x0002	/* STATUS_WRONG_PASSWORD */
178#define	ERRbadpath		0x0003	/* STATUS_PATH_NOT_COVERED */
179#define	ERRaccess		0x0004	/* STATUS_NETWORK_ACCESS_DENIED */
180#define	ERRinvtid		0x0005	/* STATUS_SMB_BAD_TID */
181#define	ERRinvnetname	0x0006	/* STATUS_BAD_NETWORK_NAME */
182#define	ERRinvdevice	0x0007	/* STATUS_BAD_DEVICE_TYPE */
183#define	ERRinvsess		0x0010	/* STATUS_UNSUCCESSFUL */
184#define	ERRworking		0x0011	/* STATUS_UNSUCCESSFUL */
185#define	ERRnotme		0x0012	/* STATUS_UNSUCCESSFUL */
186#define	ERRbadcmd		0x0016	/* STATUS_SMB_BAD_COMMAND */
187#define	ERRqfull		0x0031	/* STATUS_PRINT_QUEUE_FULL */
188#define	ERRqtoobig		0x0032	/* STATUS_NO_SPOOL_SPACE */
189#define	ERRqeof			0x0033	/* STATUS_UNSUCCESSFUL */
190#define	ERRinvpfid		0x0034	/* STATUS_PRINT_CANCELLED */
191#define	ERRsmbcmd		0x0040	/* STATUS_NOT_IMPLEMENTED */
192#define	ERRsrverror		0x0041	/* STATUS_UNEXPECTED_NETWORK_ERROR */
193#define	ERRfilespecs	0x0043	/* STATUS_INVALID_HANDLE */
194#define	ERRbadpermits	0x0045	/* STATUS_NETWORK_ACCESS_DENIED */
195#define	ERRsetattrmode	0x0047	/* STATUS_INVALID_PARAMETER */
196#define	ERRtimeout		0x0058	/* STATUS_IO_TIMEOUT */
197#define	ERRnoresource	0x0059	/* STATUS_REQUEST_NOT_ACCEPTED */
198#define	ERRtoomanyuids	0x005A	/* STATUS_TOO_MANY_SESSIONS */
199#define	ERRbaduid		0x005B	/* STATUS_SMB_BAD_UID */
200#define	ERRnotconnected 0x00E9	/* STATUS_PIPE_DISCONNECTED */
201#define	ERRusempx		0x00FA	/* STATUS_SMB_USE_MPX */
202#define	ERRusestd		0x00FB	/* STATUS_SMB_USE_STANDARD */
203#define	ERRcontmpx		0x00FC	/* STATUS_SMB_CONTINUE_MPX */
204#define	ERRaccountExpired	0x08BF	/* STATUS_ACCOUNT_EXPIRED */
205#define	ERRbadClient	0x08C0	/* STATUS_INVALID_WORKSTATION */
206#define	ERRbadLogonTime	0x08C1	/* STATUS_INVALID_LOGON_HOURS */
207#define	ERRpasswordExpired 0x08C2	/* STATUS_PASSWORD_EXPIRED */
208#define	ERRnosupport	0xFFFF	/* STATUS_SMB_NO_SUPPORT */
209
210#define ERRHRD_Class	0x03
211#define	ERRnowrite		0x0013	/* STATUS_MEDIA_WRITE_PROTECTED */
212#define	ERRbadunit		0x0014	/* STATUS_UNSUCCESSFUL */
213#define	ERRnotready		0x0015	/* STATUS_NO_MEDIA_IN_DEVICE */
214#define	ERRbadcmd		0x0016	/* STATUS_INVALID_DEVICE_STATE */
215#define	ERRdata			0x0017	/* STATUS_DATA_ERROR */
216#define	ERRbadreq		0x0018	/* STATUS_DATA_ERROR */
217#define	ERRseek			0x0019	/* STATUS_UNSUCCESSFUL */
218#define	ERRbadmedia		0x001A	/* STATUS_DISK_CORRUPT_ERROR */
219#define	ERRbadsector	0x001B	/* STATUS_NONEXISTENT_SECTOR */
220#define	ERRnopaper		0x001C	/* STATUS_DEVICE_PAPER_EMPTY */
221#define	ERRwrite		0x001D	/* STATUS_IO_DEVICE_ERROR */
222#define	ERRread			0x001E	/* STATUS_IO_DEVICE_ERROR */
223#define	ERRgeneral		0x001F	/* STATUS_UNSUCCESSFUL */
224#define	ERRbadshare		0x0020	/* STATUS_SHARING_VIOLATION */
225#define	ERRlock			0x0021	/* STATUS_FILE_LOCK_CONFLICT */
226#define	ERRwrongdisk	0x0022	/* STATUS_WRONG_VOLUME */
227#define	ERRFCBunavail	0x0023	/* STATUS_UNSUCCESSFUL */
228#define ERRsharebufexc	0x0024	/* STATUS_UNSUCCESSFUL */
229#define ERRdiskfull		0x0027	/* STATUS_DISK_FULL */
230
231#ifdef __cplusplus
232} // extern "C"
233#endif
234
235#endif /* NTSTATUS_H_83E0C5F3_6873_4CAA_ADEF_C95FBDD3625E */
236/* vim: set sw=4 ts=4 tw=79 et: */
237