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.asn1;
028    
029    
030    
031    /**
032     * This class defines a number of constants that may be used when interacting
033     * with ASN.1 elements.
034     */
035    @org.opends.server.types.PublicAPI(
036         stability=org.opends.server.types.StabilityLevel.UNCOMMITTED,
037         mayInstantiate=false,
038         mayExtend=false,
039         mayInvoke=true)
040    public final class ASN1Constants
041    {
042      /**
043       * The BER type that is assigned to the universal Boolean element.
044       */
045      public static final byte UNIVERSAL_BOOLEAN_TYPE = 0x01;
046    
047    
048    
049      /**
050       * The BER type that is assigned to the universal integer type.
051       */
052      public static final byte UNIVERSAL_INTEGER_TYPE = 0x02;
053    
054    
055    
056      /**
057       * The BER type that is assigned to the universal octet string type.
058       */
059      public static final byte UNIVERSAL_OCTET_STRING_TYPE = 0x04;
060    
061    
062    
063      /**
064       * The BER type that is assigned to the universal null type.
065       */
066      public static final byte UNIVERSAL_NULL_TYPE = 0x05;
067    
068    
069    
070      /**
071       * The BER type that is assigned to the universal enumerated type.
072       */
073      public static final byte UNIVERSAL_ENUMERATED_TYPE = 0x0A;
074    
075    
076    
077      /**
078       * The BER type that is assigned to the universal sequence type.
079       */
080      public static final byte UNIVERSAL_SEQUENCE_TYPE = 0x30;
081    
082    
083    
084      /**
085       * The BER type that is assigned to the universal set type.
086       */
087      public static final byte UNIVERSAL_SET_TYPE = 0x31;
088    
089    
090    
091      /**
092       * The byte array that will be used for ASN.1 elements with no value.
093       */
094      public static final byte[] NO_VALUE = new byte[0];
095    
096    
097    
098      /**
099       * The bitmask that can be ANDed with the BER type to zero out all bits except
100       * those used in the class.
101       */
102      public static final byte TYPE_MASK_ALL_BUT_CLASS = (byte) 0xC0;
103    
104    
105    
106      /**
107       * The bitmask that can be ANDed with the BER type to determine if the element
108       * is in the universal class.
109       */
110      public static final byte TYPE_MASK_UNIVERSAL = 0x00;
111    
112    
113    
114      /**
115       * The bitmask that can be ANDed with the BER type to determine if the element
116       * is in the application-specific class.
117       */
118      public static final byte TYPE_MASK_APPLICATION = 0x40;
119    
120    
121    
122      /**
123       * The bitmask that can be ANDed with the BER type to determine if the element
124       * is in the context-specific class.
125       */
126      public static final byte TYPE_MASK_CONTEXT = (byte) 0x80;
127    
128    
129    
130      /**
131       * The bitmask that can be ANDed with the BER type to determine if the element
132       * is in the private class.
133       */
134      public static final byte TYPE_MASK_PRIVATE = (byte) 0xC0;
135    
136    
137    
138      /**
139       * The bitmask that can be ANDed with the BER type to zero out all bits except
140       * the primitive/constructed bit.
141       */
142      public static final byte TYPE_MASK_ALL_BUT_PC = (byte) 0x20;
143    
144    
145    
146      /**
147       * The bitmask that can be ANDed with the BER type to determine if the element
148       * is a primitive.
149       */
150      public static final byte TYPE_MASK_PRIMITIVE = 0x00;
151    
152    
153    
154      /**
155       * The bitmask that can be ANDed with the BER type to determine if the element
156       * is constructed.
157       */
158      public static final byte TYPE_MASK_CONSTRUCTED = 0x20;
159    
160    
161    
162      /**
163       * The byte array containing the pre-encoded ASN.1 encoding for a boolean
164       * value of "false".
165       */
166      public static final byte[] BOOLEAN_VALUE_FALSE = { 0x00 };
167    
168    
169    
170      /**
171       * The byte array containing the pre-encoded ASN.1 encoding for a boolean
172       * value of "false".
173       */
174      public static final byte[] BOOLEAN_VALUE_TRUE = { (byte) 0xFF };
175    }
176