001/*
002 * The contents of this file are subject to the terms of the Common Development and
003 * Distribution License (the License). You may not use this file except in compliance with the
004 * License.
005 *
006 * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
007 * specific language governing permission and limitations under the License.
008 *
009 * When distributing Covered Software, include this CDDL Header Notice in each file and include
010 * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
011 * Header, with the fields enclosed by brackets [] replaced by your own identifying
012 * information: "Portions Copyright [year] [name of copyright owner]".
013 *
014 * Copyright 2006-2008 Sun Microsystems, Inc.
015 * Portions Copyright 2016 ForgeRock AS.
016 */
017package org.opends.server.protocols.ldap;
018
019/** This class defines a number of constants used in the LDAP protocol. */
020public class LDAPConstants
021{
022  /** The protocol op type for bind requests. */
023  public static final byte OP_TYPE_BIND_REQUEST = 0x60;
024  /** The protocol op type for bind responses. */
025  public static final byte OP_TYPE_BIND_RESPONSE = 0x61;
026  /** The protocol op type for unbind requests. */
027  public static final byte OP_TYPE_UNBIND_REQUEST = 0x42;
028  /** The protocol op type for search requests. */
029  public static final byte OP_TYPE_SEARCH_REQUEST = 0x63;
030  /** The protocol op type for search result entries. */
031  public static final byte OP_TYPE_SEARCH_RESULT_ENTRY = 0x64;
032  /** The protocol op type for search result references. */
033  public static final byte OP_TYPE_SEARCH_RESULT_REFERENCE = 0x73;
034  /** The protocol op type for search result done elements. */
035  public static final byte OP_TYPE_SEARCH_RESULT_DONE = 0x65;
036  /** The protocol op type for modify requests. */
037  public static final byte OP_TYPE_MODIFY_REQUEST = 0x66;
038  /** The protocol op type for modify responses. */
039  public static final byte OP_TYPE_MODIFY_RESPONSE = 0x67;
040  /** The protocol op type for add requests. */
041  public static final byte OP_TYPE_ADD_REQUEST = 0x68;
042  /** The protocol op type for add responses. */
043  public static final byte OP_TYPE_ADD_RESPONSE = 0x69;
044  /** The protocol op type for delete requests. */
045  public static final byte OP_TYPE_DELETE_REQUEST = 0x4A;
046  /** The protocol op type for delete responses. */
047  public static final byte OP_TYPE_DELETE_RESPONSE = 0x6B;
048  /** The protocol op type for modify DN requests. */
049  public static final byte OP_TYPE_MODIFY_DN_REQUEST = 0x6C;
050  /** The protocol op type for modify DN responses. */
051  public static final byte OP_TYPE_MODIFY_DN_RESPONSE = 0x6D;
052  /** The protocol op type for compare requests. */
053  public static final byte OP_TYPE_COMPARE_REQUEST = 0x6E;
054  /** The protocol op type for compare responses. */
055  public static final byte OP_TYPE_COMPARE_RESPONSE = 0x6F;
056  /** The protocol op type for abandon requests. */
057  public static final byte OP_TYPE_ABANDON_REQUEST = 0x50;
058  /** The protocol op type for extended requests. */
059  public static final byte OP_TYPE_EXTENDED_REQUEST = 0x77;
060  /** The protocol op type for extended responses. */
061  public static final byte OP_TYPE_EXTENDED_RESPONSE = 0x78;
062  /** The protocol op type for intermediate responses. */
063  public static final byte OP_TYPE_INTERMEDIATE_RESPONSE = 0x79;
064
065  /** The BER type to use for encoding the sequence of controls in an LDAP message. */
066  public static final byte TYPE_CONTROL_SEQUENCE = (byte) 0xA0;
067  /** The BER type to use for encoding the sequence of referral URLs in an LDAPResult element. */
068  public static final byte TYPE_REFERRAL_SEQUENCE = (byte) 0xA3;
069  /**
070   * The BER type to use for the AuthenticationChoice element in a bind request
071   * when simple authentication is to be used.
072   */
073  public static final byte TYPE_AUTHENTICATION_SIMPLE = (byte) 0x80;
074  /**
075   * The BER type to use for the AuthenticationChoice element in a bind request
076   * when SASL authentication is to be used.
077   */
078  public static final byte TYPE_AUTHENTICATION_SASL = (byte) 0xA3;
079  /** The BER type to use for the server SASL credentials in a bind response. */
080  public static final byte TYPE_SERVER_SASL_CREDENTIALS = (byte) 0x87;
081  /** The BER type to use for AND filter components. */
082  public static final byte TYPE_FILTER_AND = (byte) 0xA0;
083  /** The BER type to use for OR filter components. */
084  public static final byte TYPE_FILTER_OR = (byte) 0xA1;
085  /** The BER type to use for NOT filter components. */
086  public static final byte TYPE_FILTER_NOT = (byte) 0xA2;
087  /** The BER type to use for equality filter components. */
088  public static final byte TYPE_FILTER_EQUALITY = (byte) 0xA3;
089  /** The BER type to use for substring filter components. */
090  public static final byte TYPE_FILTER_SUBSTRING = (byte) 0xA4;
091  /** The BER type to use for greater than or equal to filter components. */
092  public static final byte TYPE_FILTER_GREATER_OR_EQUAL = (byte) 0xA5;
093  /** The BER type to use for less than or equal to filter components. */
094  public static final byte TYPE_FILTER_LESS_OR_EQUAL = (byte) 0xA6;
095  /** The BER type to use for presence filter components. */
096  public static final byte TYPE_FILTER_PRESENCE = (byte) 0x87;
097  /** The BER type to use for approximate filter components. */
098  public static final byte TYPE_FILTER_APPROXIMATE = (byte) 0xA8;
099  /** The BER type to use for extensible matching filter components. */
100  public static final byte TYPE_FILTER_EXTENSIBLE_MATCH = (byte) 0xA9;
101  /** The BER type to use for the subInitial component of a substring filter. */
102  public static final byte TYPE_SUBINITIAL = (byte) 0x80;
103  /** The BER type to use for the subAny component(s) of a substring filter. */
104  public static final byte TYPE_SUBANY = (byte) 0x81;
105  /** The BER type to use for the subFinal components of a substring filter. */
106  public static final byte TYPE_SUBFINAL = (byte) 0x82;
107  /** The BER type to use for the matching rule OID in a matching rule assertion. */
108  public static final byte TYPE_MATCHING_RULE_ID = (byte) 0x81;
109  /** The BER type to use for the attribute type in a matching rule assertion. */
110  public static final byte TYPE_MATCHING_RULE_TYPE = (byte) 0x82;
111  /** The BER type to use for the assertion value in a matching rule assertion. */
112  public static final byte TYPE_MATCHING_RULE_VALUE = (byte) 0x83;
113  /** The BER type to use for the DN attributes flag in a matching rule assertion. */
114  public static final byte TYPE_MATCHING_RULE_DN_ATTRIBUTES = (byte) 0x84;
115  /** The BER type to use for the newSuperior component of a modify DN request. */
116  public static final byte TYPE_MODIFY_DN_NEW_SUPERIOR = (byte) 0x80;
117  /** The BER type to use for the OID of an extended request. */
118  public static final byte TYPE_EXTENDED_REQUEST_OID = (byte) 0x80;
119  /** The BER type to use for the value of an extended request. */
120  public static final byte TYPE_EXTENDED_REQUEST_VALUE = (byte) 0x81;
121  /** The BER type to use for the OID of an extended response. */
122  public static final byte TYPE_EXTENDED_RESPONSE_OID = (byte) 0x8A;
123  /** The BER type to use for the value of an extended response. */
124  public static final byte TYPE_EXTENDED_RESPONSE_VALUE = (byte) 0x8B;
125  /** The BER type to use for the OID of an intermediate response message. */
126  public static final byte TYPE_INTERMEDIATE_RESPONSE_OID = (byte) 0x80;
127  /** The BER type to use for the value of an intermediate response message. */
128  public static final byte TYPE_INTERMEDIATE_RESPONSE_VALUE = (byte) 0x81;
129
130  /** The enumerated type for modify operations that add one or more values for an attribute. */
131  public static final int MOD_TYPE_ADD = 0;
132  /** The enumerated type for modify operations that remove one or more values from an attribute. */
133  public static final int MOD_TYPE_DELETE = 1;
134  /** The enumerated type for modify operations that replace the set of values for an attribute. */
135  public static final int MOD_TYPE_REPLACE = 2;
136  /** The enumerated type for modify operations that increment the value for an attribute. */
137  public static final int MOD_TYPE_INCREMENT = 3;
138
139  /** The search scope value that will be used for base-level searches. */
140  public static final int SCOPE_BASE_OBJECT = 0;
141  /** The search scope value that will be used for single-level searches. */
142  public static final int SCOPE_SINGLE_LEVEL = 1;
143  /** The search scope value that will be used for whole subtree searches. */
144  public static final int SCOPE_WHOLE_SUBTREE = 2;
145  /** The search scope value that will be used for subordinate subtree searches. */
146  public static final int SCOPE_SUBORDINATE_SUBTREE = 3;
147
148  /**
149   * The alias dereferencing policy value that will be used for cases in which
150   * aliases are never to be dereferenced.
151   */
152  public static final int DEREF_NEVER = 0;
153  /**
154   * The alias dereferencing policy value that will be used for cases in which
155   * any aliases encountered while finding matching entries should be
156   * dereferenced.
157   */
158  public static final int DEREF_IN_SEARCHING = 1;
159  /**
160   * The alias dereferencing policy value that will be used for cases in which
161   * the search base should be dereferenced if it is an alias.
162   */
163  public static final int DEREF_FINDING_BASE = 2;
164  /**
165   * The alias dereferencing policy value that will be used for cases in which
166   * all aliases encountered should be dereferenced.
167   */
168  public static final int DEREF_ALWAYS = 3;
169
170  /** The OID for the Kerberos V GSSAPI mechanism. */
171  public static final String OID_GSSAPI_KERBEROS_V = "1.2.840.113554.1.2.2";
172
173  /** The OID for the LDAP notice of disconnection extended operation. */
174  public static final String OID_NOTICE_OF_DISCONNECTION =
175       "1.3.6.1.4.1.1466.20036";
176
177  /**
178   * The ASN.1 element decoding state that indicates that the next byte read
179   * should be the BER type for a new element.
180   */
181  public static final int ELEMENT_READ_STATE_NEED_TYPE = 0;
182  /**
183   * The ASN.1 element decoding state that indicates that the next byte read
184   * should be the first byte for the element length.
185   */
186  public static final int ELEMENT_READ_STATE_NEED_FIRST_LENGTH_BYTE = 1;
187  /**
188   * The ASN.1 element decoding state that indicates that the next byte read
189   * should be additional bytes of a multi-byte length.
190   */
191  public static final int ELEMENT_READ_STATE_NEED_ADDITIONAL_LENGTH_BYTES = 2;
192  /**
193   * The ASN.1 element decoding state that indicates that the next byte read
194   * should be applied to the value of the element.
195   */
196  public static final int ELEMENT_READ_STATE_NEED_VALUE_BYTES = 3;
197}