1<?php
2
3/**
4 * This file is part of the FreeDSx LDAP package.
5 *
6 * (c) Chad Sikorra <Chad.Sikorra@gmail.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace FreeDSx\Ldap\Operation;
13
14/**
15 * Message response result codes. Defined in RFC 4511, 4.1.9
16 *
17 * @author Chad Sikorra <Chad.Sikorra@gmail.com>
18 */
19class ResultCode
20{
21    public const SUCCESS = 0;
22
23    public const OPERATIONS_ERROR = 1;
24
25    public const PROTOCOL_ERROR = 2;
26
27    public const TIME_LIMIT_EXCEEDED = 3;
28
29    public const SIZE_LIMIT_EXCEEDED = 4;
30
31    public const COMPARE_FALSE = 5;
32
33    public const COMPARE_TRUE = 6;
34
35    public const AUTH_METHOD_UNSUPPORTED = 7;
36
37    public const STRONGER_AUTH_REQUIRED = 8;
38
39    public const REFERRAL = 10;
40
41    public const ADMIN_LIMIT_EXCEEDED = 11;
42
43    public const UNAVAILABLE_CRITICAL_EXTENSION = 12;
44
45    public const CONFIDENTIALITY_REQUIRED = 13;
46
47    public const SASL_BIND_IN_PROGRESS = 14;
48
49    public const NO_SUCH_ATTRIBUTE = 16;
50
51    public const UNDEFINED_ATTRIBUTE_TYPE = 17;
52
53    public const INAPPROPRIATE_MATCHING = 18;
54
55    public const CONSTRAINT_VIOLATION = 19;
56
57    public const ATTRIBUTE_OR_VALUE_EXISTS = 20;
58
59    public const INVALID_ATTRIBUTE_SYNTAX = 21;
60
61    public const NO_SUCH_OBJECT = 32;
62
63    public const ALIAS_PROBLEM = 33;
64
65    public const INVALID_DN_SYNTAX = 34;
66
67    public const ALIAS_DEREFERENCING_PROBLEM = 36;
68
69    public const INAPPROPRIATE_AUTHENTICATION = 48;
70
71    public const INVALID_CREDENTIALS = 49;
72
73    public const INSUFFICIENT_ACCESS_RIGHTS = 50;
74
75    public const BUSY = 51;
76
77    public const UNAVAILABLE = 52;
78
79    public const UNWILLING_TO_PERFORM = 53;
80
81    public const LOOP_DETECT = 54;
82
83    public const NAMING_VIOLATION = 64;
84
85    public const OBJECT_CLASS_VIOLATION = 65;
86
87    public const NOT_ALLOWED_ON_NON_LEAF = 66;
88
89    public const NOT_ALLOWED_ON_RDN = 67;
90
91    public const ENTRY_ALREADY_EXISTS = 68;
92
93    public const OBJECT_CLASS_MODS_PROHIBITED = 69;
94
95    public const AFFECTS_MULTIPLE_DSAS = 71;
96
97    public const VIRTUAL_LIST_VIEW_ERROR = 76;
98
99    public const OTHER = 80;
100
101    public const CANCELED = 118;
102
103    public const NO_SUCH_OPERATION = 119;
104
105    public const TOO_LATE = 120;
106
107    public const CANNOT_CANCEL = 121;
108
109    public const ASSERTION_FAILED = 122;
110
111    public const AUTHORIZATION_DENIED = 123;
112
113    public const SYNCHRONIZATION_REFRESH_REQUIRED = 4096;
114
115    public const MEANING_SHORT = [
116        self::SUCCESS => 'success',
117        self::OPERATIONS_ERROR => 'operationsError',
118        self::PROTOCOL_ERROR => 'protocolError',
119        self::TIME_LIMIT_EXCEEDED => 'timeLimitExceeded',
120        self::SIZE_LIMIT_EXCEEDED => 'sizeLimitExceeded',
121        self::COMPARE_FALSE => 'compareFalse',
122        self::COMPARE_TRUE => 'compareTrue',
123        self::AUTH_METHOD_UNSUPPORTED => 'authMethodNotSupported',
124        self::STRONGER_AUTH_REQUIRED => 'strongerAuthRequired',
125        self::REFERRAL => 'referral',
126        self::ADMIN_LIMIT_EXCEEDED => 'adminLimitExceeded',
127        self::UNAVAILABLE_CRITICAL_EXTENSION => 'unavailableCriticalExtension',
128        self::CONFIDENTIALITY_REQUIRED => 'confidentialityRequired',
129        self::SASL_BIND_IN_PROGRESS => 'saslBindInProgress',
130        self::NO_SUCH_ATTRIBUTE => 'noSuchAttribute',
131        self::UNDEFINED_ATTRIBUTE_TYPE => 'undefinedAttributeType',
132        self::INAPPROPRIATE_MATCHING => 'inappropriateMatching',
133        self::CONSTRAINT_VIOLATION => 'constraintViolation',
134        self::ATTRIBUTE_OR_VALUE_EXISTS => 'attributeOrValueExists',
135        self::INVALID_ATTRIBUTE_SYNTAX => 'invalidAttributeSyntax',
136        self::NO_SUCH_OBJECT => 'noSuchObject',
137        self::ALIAS_PROBLEM => 'aliasProblem',
138        self::INVALID_DN_SYNTAX => 'invalidDNSyntax',
139        self::ALIAS_DEREFERENCING_PROBLEM => 'aliasDereferencingProblem',
140        self::INAPPROPRIATE_AUTHENTICATION => 'inappropriateAuthentication',
141        self::INVALID_CREDENTIALS => 'invalidCredentials',
142        self::INSUFFICIENT_ACCESS_RIGHTS => 'insufficientAccessRights',
143        self::BUSY => 'busy',
144        self::UNAVAILABLE => 'unavailable',
145        self::UNWILLING_TO_PERFORM => 'unwillingToPerform',
146        self::LOOP_DETECT => 'loopDetect',
147        self::NAMING_VIOLATION => 'namingViolation',
148        self::OBJECT_CLASS_VIOLATION => 'objectClassViolation',
149        self::NOT_ALLOWED_ON_NON_LEAF => 'notAllowedOnNonLeaf',
150        self::NOT_ALLOWED_ON_RDN => 'notAllowedOnRDN',
151        self::ENTRY_ALREADY_EXISTS => 'entryAlreadyExists',
152        self::OBJECT_CLASS_MODS_PROHIBITED => 'objectClassModsProhibited',
153        self::AFFECTS_MULTIPLE_DSAS => 'affectsMultipleDSAs',
154        self::OTHER => 'other',
155        self::VIRTUAL_LIST_VIEW_ERROR => 'virtualListViewError',
156        self::CANNOT_CANCEL => 'cannotCancel',
157        self::TOO_LATE => 'tooLate',
158        self::NO_SUCH_OPERATION => 'noSuchOperation',
159        self::AUTHORIZATION_DENIED => 'authorizationDenied',
160    ];
161
162    public const MEANING_DESCRIPTION = [
163        self::SUCCESS => 'Indicates the successful completion of an operation.',
164        self::OPERATIONS_ERROR => 'Indicates that the operation is not properly sequenced with relation to other operations (of same or different type).',
165        self::PROTOCOL_ERROR => 'Indicates the server received data that is not well-formed.',
166        self::TIME_LIMIT_EXCEEDED => 'Indicates that the time limit specified by the client was exceeded before the operation could be completed.',
167        self::SIZE_LIMIT_EXCEEDED => 'Indicates that the size limit specified by the client was exceeded before the operation could be completed.',
168        self::COMPARE_FALSE => 'Indicates that the Compare operation has successfully completed and the assertion has evaluated to FALSE or Undefined.',
169        self::COMPARE_TRUE => 'Indicates that the Compare operation has successfully completed and the assertion has evaluated to TRUE.',
170        self::AUTH_METHOD_UNSUPPORTED => 'Indicates that the authentication method or mechanism is not supported.',
171        self::STRONGER_AUTH_REQUIRED => 'Indicates the server requires strong(er) authentication in order to complete the operation.',
172        self::REFERRAL => 'Indicates that a referral needs to be chased to complete the operation.',
173        self::ADMIN_LIMIT_EXCEEDED => 'Indicates that an administrative limit has been exceeded.',
174        self::UNAVAILABLE_CRITICAL_EXTENSION => 'Indicates a critical control is unrecognized.',
175        self::CONFIDENTIALITY_REQUIRED => 'Indicates that data confidentiality protections are required.',
176        self::SASL_BIND_IN_PROGRESS => 'Indicates the server requires the client to send a new bind request, with the same SASL mechanism, to continue the authentication process.',
177        self::NO_SUCH_ATTRIBUTE => 'Indicates that the named entry does not contain the specified attribute or attribute value.',
178        self::UNDEFINED_ATTRIBUTE_TYPE => 'Indicates that a request field contains an unrecognized attribute description.',
179        self::INAPPROPRIATE_MATCHING => 'Indicates that an attempt was made (e.g., in an assertion) to use a matching rule not defined for the attribute type concerned.',
180        self::CONSTRAINT_VIOLATION => 'Indicates that the client supplied an attribute value that does not conform to the constraints placed upon it by the data model.',
181        self::ATTRIBUTE_OR_VALUE_EXISTS => 'Indicates that the client supplied an attribute or value to be added to an entry, but the attribute or value already exists.',
182        self::INVALID_ATTRIBUTE_SYNTAX => 'Indicates that a purported attribute value does not conform to the syntax of the attribute.',
183        self::NO_SUCH_OBJECT => 'Indicates that the object does not exist in the DIT.',
184        self::ALIAS_PROBLEM => 'Indicates that an alias problem has occurred.  For example, the code may used to indicate an alias has been dereferenced that names no object.',
185        self::INVALID_DN_SYNTAX => 'Indicates that an LDAPDN or RelativeLDAPDN field (e.g., search base, target entry, ModifyDN newrdn, etc.) of a request does not conform to the required syntax or contains attribute values that do not conform to the syntax of the attribute\'s type.',
186        self::ALIAS_DEREFERENCING_PROBLEM => 'Indicates that a problem occurred while dereferencing an alias.  Typically, an alias was encountered in a situation where it was not allowed or where access was denied.',
187        self::INAPPROPRIATE_AUTHENTICATION => 'Indicates the server requires the client that had attempted to bind anonymously or without supplying credentials to provide some form of credentials.',
188        self::INVALID_CREDENTIALS => 'Indicates that the provided credentials (e.g., the user\'s name and password) are invalid.',
189        self::INSUFFICIENT_ACCESS_RIGHTS => 'Indicates that the client does not have sufficient access rights to perform the operation.',
190        self::BUSY => 'Indicates that the server is too busy to service the operation.',
191        self::UNAVAILABLE => 'Indicates that the server is shutting down or a subsystem necessary to complete the operation is offline.',
192        self::UNWILLING_TO_PERFORM => 'Indicates that the server is unwilling to perform the operation.',
193        self::LOOP_DETECT => 'Indicates that the server has detected an internal loop (e.g., while dereferencing aliases or chaining an operation).',
194        self::NAMING_VIOLATION => 'Indicates that the entry\'s name violates naming restrictions.',
195        self::OBJECT_CLASS_VIOLATION => ' Indicates that the entry violates object class restrictions.',
196        self::NOT_ALLOWED_ON_NON_LEAF => 'Indicates that the operation is inappropriately acting upon a non-leaf entry.',
197        self::NOT_ALLOWED_ON_RDN => 'Indicates that the operation is inappropriately attempting to remove a value that forms the entry\'s relative distinguished name.',
198        self::ENTRY_ALREADY_EXISTS => 'Indicates that the request cannot be fulfilled (added, moved, or renamed) as the target entry already exists.',
199        self::OBJECT_CLASS_MODS_PROHIBITED => 'Indicates that an attempt to modify the object class(es) of an entry\'s \'objectClass\' attribute is prohibited.',
200        self::AFFECTS_MULTIPLE_DSAS => 'Indicates that the operation cannot be performed as it would affect multiple servers (DSAs).',
201        self::OTHER => 'Indicates the server has encountered an internal error.',
202        self::VIRTUAL_LIST_VIEW_ERROR => 'This error indicates that the search operation failed due to the inclusion of the VirtualListViewRequest control.',
203        self::CANNOT_CANCEL => 'The cannotCancel resultCode is returned if the identified operation does not support cancelation or the cancel operation could not be performed.',
204        self::TOO_LATE => 'Indicates that it is too late to cancel the outstanding operation.',
205        self::NO_SUCH_OPERATION => 'The server has no knowledge of the operation requested for cancelation.',
206    ];
207}
208