From fc11cb328f23d141ecfedd16d791e39fd4e1d299 Mon Sep 17 00:00:00 2001
From: Matthew Swift <matthew.swift@forgerock.com>
Date: Tue, 18 Sep 2012 07:58:15 +0000
Subject: [PATCH] Fix OPENDJ-595: Merge ASN1Constants into ASN1
---
opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/asn1/ASN1.java | 114 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 114 insertions(+), 0 deletions(-)
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/asn1/ASN1.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/asn1/ASN1.java
index 3063245..e3e7a91 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/asn1/ASN1.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/asn1/ASN1.java
@@ -22,6 +22,7 @@
*
*
* Copyright 2006-2008 Sun Microsystems, Inc.
+ * Portions copyright 2012 ForgeRock AS.
*/
package org.forgerock.opendj.asn1;
@@ -46,6 +47,119 @@
public final class ASN1 {
/**
+ * The byte array containing the pre-encoded ASN.1 encoding for a boolean
+ * value of "false".
+ */
+ public static final byte BOOLEAN_VALUE_FALSE = 0x00;
+
+ /**
+ * The byte array containing the pre-encoded ASN.1 encoding for a boolean
+ * value of "false".
+ */
+ public static final byte BOOLEAN_VALUE_TRUE = (byte) 0xFF;
+
+ /**
+ * The BER type that is assigned to the universal Boolean element.
+ */
+ public static final byte UNIVERSAL_BOOLEAN_TYPE = 0x01;
+
+ /**
+ * The BER type that is assigned to the universal enumerated type.
+ */
+ public static final byte UNIVERSAL_ENUMERATED_TYPE = 0x0A;
+
+ /**
+ * The BER type that is assigned to the universal integer type.
+ */
+ public static final byte UNIVERSAL_INTEGER_TYPE = 0x02;
+
+ /**
+ * The BER type that is assigned to the universal null type.
+ */
+ public static final byte UNIVERSAL_NULL_TYPE = 0x05;
+
+ /**
+ * The BER type that is assigned to the universal octet string type.
+ */
+ public static final byte UNIVERSAL_OCTET_STRING_TYPE = 0x04;
+
+ /**
+ * The BER type that is assigned to the universal sequence type.
+ */
+ public static final byte UNIVERSAL_SEQUENCE_TYPE = 0x30;
+
+ /**
+ * The BER type that is assigned to the universal set type.
+ */
+ public static final byte UNIVERSAL_SET_TYPE = 0x31;
+
+ /**
+ * The ASN.1 element decoding state that indicates that the next byte read
+ * should be additional bytes of a multi-byte length.
+ */
+ static final int ELEMENT_READ_STATE_NEED_ADDITIONAL_LENGTH_BYTES = 2;
+
+ /**
+ * The ASN.1 element decoding state that indicates that the next byte read
+ * should be the first byte for the element length.
+ */
+ static final int ELEMENT_READ_STATE_NEED_FIRST_LENGTH_BYTE = 1;
+ /**
+ * The ASN.1 element decoding state that indicates that the next byte read
+ * should be the BER type for a new element.
+ */
+ static final int ELEMENT_READ_STATE_NEED_TYPE = 0;
+ /**
+ * The ASN.1 element decoding state that indicates that the next byte read
+ * should be applied to the value of the element.
+ */
+ static final int ELEMENT_READ_STATE_NEED_VALUE_BYTES = 3;
+ /**
+ * The byte array that will be used for ASN.1 elements with no value.
+ */
+ static final byte[] NO_VALUE = new byte[0];
+ /**
+ * The bitmask that can be ANDed with the BER type to zero out all bits
+ * except those used in the class.
+ */
+ static final byte TYPE_MASK_ALL_BUT_CLASS = (byte) 0xC0;
+ /**
+ * The bitmask that can be ANDed with the BER type to zero out all bits
+ * except the primitive/constructed bit.
+ */
+ static final byte TYPE_MASK_ALL_BUT_PC = (byte) 0x20;
+ /**
+ * The bitmask that can be ANDed with the BER type to determine if the
+ * element is in the application-specific class.
+ */
+ static final byte TYPE_MASK_APPLICATION = 0x40;
+ /**
+ * The bitmask that can be ANDed with the BER type to determine if the
+ * element is constructed.
+ */
+ static final byte TYPE_MASK_CONSTRUCTED = 0x20;
+ /**
+ * The bitmask that can be ANDed with the BER type to determine if the
+ * element is in the context-specific class.
+ */
+ static final byte TYPE_MASK_CONTEXT = (byte) 0x80;
+ /**
+ * The bitmask that can be ANDed with the BER type to determine if the
+ * element is a primitive.
+ */
+ static final byte TYPE_MASK_PRIMITIVE = 0x00;
+ /**
+ * The bitmask that can be ANDed with the BER type to determine if the
+ * element is in the private class.
+ */
+ static final byte TYPE_MASK_PRIVATE = (byte) 0xC0;
+ /**
+ * The bitmask that can be ANDed with the BER type to determine if the
+ * element is in the universal class.
+ */
+ static final byte TYPE_MASK_UNIVERSAL = 0x00;
+
+ /**
* Returns an ASN.1 reader whose source is the provided byte array and
* having an unlimited maximum BER element size.
*
--
Gitblit v1.10.0