001    /*
002     * CDDL HEADER START
003     *
004     * The contents of this file are subject to the terms of the
005     * Common Development and Distribution License, Version 1.0 only
006     * (the "License").  You may not use this file except in compliance
007     * with the License.
008     *
009     * You can obtain a copy of the license at
010     * trunk/opends/resource/legal-notices/OpenDS.LICENSE
011     * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
012     * See the License for the specific language governing permissions
013     * and limitations under the License.
014     *
015     * When distributing Covered Code, include this CDDL HEADER in each
016     * file and include the License file at
017     * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
018     * add the following below this CDDL HEADER, with the fields enclosed
019     * by brackets "[]" replaced with your own identifying information:
020     *      Portions Copyright [yyyy] [name of copyright owner]
021     *
022     * CDDL HEADER END
023     *
024     *
025     *      Copyright 2006-2008 Sun Microsystems, Inc.
026     */
027    package org.opends.server.protocols.ldap;
028    
029    
030    
031    /**
032     * This class defines a number of constants used in the LDAP protocol.
033     */
034    public class LDAPConstants
035    {
036      /**
037       * The protocol op type for bind requests.
038       */
039      public static final byte OP_TYPE_BIND_REQUEST = 0x60;
040    
041    
042    
043      /**
044       * The protocol op type for bind responses.
045       */
046      public static final byte OP_TYPE_BIND_RESPONSE = 0x61;
047    
048    
049    
050      /**
051       * The protocol op type for unbind requests.
052       */
053      public static final byte OP_TYPE_UNBIND_REQUEST = 0x42;
054    
055    
056    
057      /**
058       * The protocol op type for search requests.
059       */
060      public static final byte OP_TYPE_SEARCH_REQUEST = 0x63;
061    
062    
063    
064      /**
065       * The protocol op type for search result entries.
066       */
067      public static final byte OP_TYPE_SEARCH_RESULT_ENTRY = 0x64;
068    
069    
070    
071      /**
072       * The protocol op type for search result references.
073       */
074      public static final byte OP_TYPE_SEARCH_RESULT_REFERENCE = 0x73;
075    
076    
077    
078      /**
079       * The protocol op type for search result done elements.
080       */
081      public static final byte OP_TYPE_SEARCH_RESULT_DONE = 0x65;
082    
083    
084    
085      /**
086       * The protocol op type for modify requests.
087       */
088      public static final byte OP_TYPE_MODIFY_REQUEST = 0x66;
089    
090    
091    
092      /**
093       * The protocol op type for modify responses.
094       */
095      public static final byte OP_TYPE_MODIFY_RESPONSE = 0x67;
096    
097    
098    
099      /**
100       * The protocol op type for add requests.
101       */
102      public static final byte OP_TYPE_ADD_REQUEST = 0x68;
103    
104    
105    
106      /**
107       * The protocol op type for add responses.
108       */
109      public static final byte OP_TYPE_ADD_RESPONSE = 0x69;
110    
111    
112    
113      /**
114       * The protocol op type for delete requests.
115       */
116      public static final byte OP_TYPE_DELETE_REQUEST = 0x4A;
117    
118    
119    
120      /**
121       * The protocol op type for delete responses.
122       */
123      public static final byte OP_TYPE_DELETE_RESPONSE = 0x6B;
124    
125    
126    
127      /**
128       * The protocol op type for modify DN requests.
129       */
130      public static final byte OP_TYPE_MODIFY_DN_REQUEST = 0x6C;
131    
132    
133    
134      /**
135       * The protocol op type for modify DN responses.
136       */
137      public static final byte OP_TYPE_MODIFY_DN_RESPONSE = 0x6D;
138    
139    
140    
141      /**
142       * The protocol op type for compare requests.
143       */
144      public static final byte OP_TYPE_COMPARE_REQUEST = 0x6E;
145    
146    
147    
148      /**
149       * The protocol op type for compare responses.
150       */
151      public static final byte OP_TYPE_COMPARE_RESPONSE = 0x6F;
152    
153    
154    
155      /**
156       * The protocol op type for abandon requests.
157       */
158      public static final byte OP_TYPE_ABANDON_REQUEST = 0x50;
159    
160    
161    
162      /**
163       * The protocol op type for extended requests.
164       */
165      public static final byte OP_TYPE_EXTENDED_REQUEST = 0x77;
166    
167    
168    
169      /**
170       * The protocol op type for extended responses.
171       */
172      public static final byte OP_TYPE_EXTENDED_RESPONSE = 0x78;
173    
174    
175    
176      /**
177       * The protocol op type for intermediate responses.
178       */
179      public static final byte OP_TYPE_INTERMEDIATE_RESPONSE = 0x79;
180    
181    
182    
183      /**
184       * The BER type to use for encoding the sequence of controls in an LDAP
185       * message.
186       */
187      public static final byte TYPE_CONTROL_SEQUENCE = (byte) 0xA0;
188    
189    
190    
191      /**
192       * The BER type to use for encoding the sequence of referral URLs in an
193       * LDAPResult element.
194       */
195      public static final byte TYPE_REFERRAL_SEQUENCE = (byte) 0xA3;
196    
197    
198    
199      /**
200       * The BER type to use for the AuthenticationChoice element in a bind request
201       * when simple authentication is to be used.
202       */
203      public static final byte TYPE_AUTHENTICATION_SIMPLE = (byte) 0x80;
204    
205    
206    
207      /**
208       * The BER type to use for the AuthenticationChoice element in a bind request
209       * when SASL authentication is to be used.
210       */
211      public static final byte TYPE_AUTHENTICATION_SASL = (byte) 0xA3;
212    
213    
214    
215      /**
216       * The BER type to use for the server SASL credentials in a bind response.
217       */
218      public static final byte TYPE_SERVER_SASL_CREDENTIALS = (byte) 0x87;
219    
220    
221    
222      /**
223       * The BER type to use for AND filter components.
224       */
225      public static final byte TYPE_FILTER_AND = (byte) 0xA0;
226    
227    
228    
229      /**
230       * The BER type to use for OR filter components.
231       */
232      public static final byte TYPE_FILTER_OR = (byte) 0xA1;
233    
234    
235    
236      /**
237       * The BER type to use for NOT filter components.
238       */
239      public static final byte TYPE_FILTER_NOT = (byte) 0xA2;
240    
241    
242    
243      /**
244       * The BER type to use for equality filter components.
245       */
246      public static final byte TYPE_FILTER_EQUALITY = (byte) 0xA3;
247    
248    
249    
250      /**
251       * The BER type to use for substring filter components.
252       */
253      public static final byte TYPE_FILTER_SUBSTRING = (byte) 0xA4;
254    
255    
256    
257      /**
258       * The BER type to use for greater than or equal to filter components.
259       */
260      public static final byte TYPE_FILTER_GREATER_OR_EQUAL = (byte) 0xA5;
261    
262    
263    
264      /**
265       * The BER type to use for less than or equal to filter components.
266       */
267      public static final byte TYPE_FILTER_LESS_OR_EQUAL = (byte) 0xA6;
268    
269    
270    
271      /**
272       * The BER type to use for presence filter components.
273       */
274      public static final byte TYPE_FILTER_PRESENCE = (byte) 0x87;
275    
276    
277    
278      /**
279       * The BER type to use for approximate filter components.
280       */
281      public static final byte TYPE_FILTER_APPROXIMATE = (byte) 0xA8;
282    
283    
284    
285      /**
286       * The BER type to use for extensible matching filter components.
287       */
288      public static final byte TYPE_FILTER_EXTENSIBLE_MATCH = (byte) 0xA9;
289    
290    
291    
292      /**
293       * The BER type to use for the subInitial component of a substring filter.
294       */
295      public static final byte TYPE_SUBINITIAL = (byte) 0x80;
296    
297    
298    
299      /**
300       * The BER type to use for the subAny component(s) of a substring filter.
301       */
302      public static final byte TYPE_SUBANY = (byte) 0x81;
303    
304    
305    
306      /**
307       * The BER type to use for the subFinal components of a substring filter.
308       */
309      public static final byte TYPE_SUBFINAL = (byte) 0x82;
310    
311    
312    
313      /**
314       * The BER type to use for the matching rule OID in a matching rule assertion.
315       */
316      public static final byte TYPE_MATCHING_RULE_ID = (byte) 0x81;
317    
318    
319    
320      /**
321       * The BER type to use for the attribute type in a matching rule assertion.
322       */
323      public static final byte TYPE_MATCHING_RULE_TYPE = (byte) 0x82;
324    
325    
326    
327      /**
328       * The BER type to use for the assertion value in a matching rule assertion.
329       */
330      public static final byte TYPE_MATCHING_RULE_VALUE = (byte) 0x83;
331    
332    
333    
334      /**
335       * The BER type to use for the DN attributes flag in a matching rule
336       * assertion.
337       */
338      public static final byte TYPE_MATCHING_RULE_DN_ATTRIBUTES = (byte) 0x84;
339    
340    
341    
342      /**
343       * The BER type to use for the newSuperior component of a modify DN request.
344       */
345      public static final byte TYPE_MODIFY_DN_NEW_SUPERIOR = (byte) 0x80;
346    
347    
348    
349      /**
350       * The BER type to use for the OID of an extended request.
351       */
352      public static final byte TYPE_EXTENDED_REQUEST_OID = (byte) 0x80;
353    
354    
355    
356      /**
357       * The BER type to use for the value of an extended request.
358       */
359      public static final byte TYPE_EXTENDED_REQUEST_VALUE = (byte) 0x81;
360    
361    
362    
363      /**
364       * The BER type to use for the OID of an extended response.
365       */
366      public static final byte TYPE_EXTENDED_RESPONSE_OID = (byte) 0x8A;
367    
368    
369    
370      /**
371       * The BER type to use for the value of an extended response.
372       */
373      public static final byte TYPE_EXTENDED_RESPONSE_VALUE = (byte) 0x8B;
374    
375    
376    
377      /**
378       * The BER type to use for the OID of an intermediate response message.
379       */
380      public static final byte TYPE_INTERMEDIATE_RESPONSE_OID = (byte) 0x80;
381    
382    
383    
384      /**
385       * The BER type to use for the value of an intermediate response message.
386       */
387      public static final byte TYPE_INTERMEDIATE_RESPONSE_VALUE = (byte) 0x81;
388    
389    
390    
391      /**
392       * The enumerated type for modify operations that add one or more values for
393       * an attribute.
394       */
395      public static final int MOD_TYPE_ADD = 0;
396    
397    
398    
399      /**
400       * The enumerated type for modify operations that remove one or more values
401       * from an attribute.
402       */
403      public static final int MOD_TYPE_DELETE = 1;
404    
405    
406    
407      /**
408       * The enumerated type for modify operations that replace the set of values
409       * for an attribute.
410       */
411      public static final int MOD_TYPE_REPLACE = 2;
412    
413    
414    
415      /**
416       * The enumerated type for modify operations that increment the value for an
417       * attribute.
418       */
419      public static final int MOD_TYPE_INCREMENT = 3;
420    
421    
422    
423      /**
424       * The search scope value that will be used for base-level searches.
425       */
426      public static final int SCOPE_BASE_OBJECT = 0;
427    
428    
429    
430      /**
431       * The search scope value that will be used for single-level searches.
432       */
433      public static final int SCOPE_SINGLE_LEVEL = 1;
434    
435    
436    
437      /**
438       * The search scope value that will be used for whole subtree searches.
439       */
440      public static final int SCOPE_WHOLE_SUBTREE = 2;
441    
442    
443    
444      /**
445       * The search scope value that will be used for subordinate subtree searches.
446       */
447      public static final int SCOPE_SUBORDINATE_SUBTREE = 3;
448    
449    
450    
451      /**
452       * The alias dereferencing policy value that will be used for cases in which
453       * aliases are never to be dereferenced.
454       */
455      public static final int DEREF_NEVER = 0;
456    
457    
458    
459      /**
460       * The alias dereferencing policy value that will be used for cases in which
461       * any aliases encountered while finding matching entries should be
462       * dereferenced.
463       */
464      public static final int DEREF_IN_SEARCHING = 1;
465    
466    
467    
468      /**
469       * The alias dereferencing policy value that will be used for cases in which
470       * the search base should be dereferenced if it is an alias.
471       */
472      public static final int DEREF_FINDING_BASE = 2;
473    
474    
475    
476      /**
477       * The alias dereferencing policy value that will be used for cases in which
478       * all aliases encountered should be dereferenced.
479       */
480      public static final int DEREF_ALWAYS = 3;
481    
482    
483    
484      /**
485       * The OID for the Kerberos V GSSAPI mechanism.
486       */
487      public static final String OID_GSSAPI_KERBEROS_V = "1.2.840.113554.1.2.2";
488    
489    
490    
491      /**
492       * The OID for the LDAP notice of disconnection extended operation.
493       */
494      public static final String OID_NOTICE_OF_DISCONNECTION =
495           "1.3.6.1.4.1.1466.20036";
496    
497    
498    
499      /**
500       * The ASN.1 element decoding state that indicates that the next byte read
501       * should be the BER type for a new element.
502       */
503      public static final int ELEMENT_READ_STATE_NEED_TYPE = 0;
504    
505    
506    
507      /**
508       * The ASN.1 element decoding state that indicates that the next byte read
509       * should be the first byte for the element length.
510       */
511      public static final int ELEMENT_READ_STATE_NEED_FIRST_LENGTH_BYTE = 1;
512    
513    
514    
515      /**
516       * The ASN.1 element decoding state that indicates that the next byte read
517       * should be additional bytes of a multi-byte length.
518       */
519      public static final int ELEMENT_READ_STATE_NEED_ADDITIONAL_LENGTH_BYTES = 2;
520    
521    
522    
523      /**
524       * The ASN.1 element decoding state that indicates that the next byte read
525       * should be applied to the value of the element.
526       */
527      public static final int ELEMENT_READ_STATE_NEED_VALUE_BYTES = 3;
528    }
529