directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: rev 9363 - in incubator/directory/snickers/trunk: . ber ber/src/java/org/apache/snickers/ber ber/src/java/org/apache/snickers/test ber/src/test/org/apache/snickers/asn ber/src/test/org/apache/snickers/ber
Date Thu, 11 Mar 2004 23:12:15 GMT
Author: akarasulu
Date: Thu Mar 11 15:12:11 2004
New Revision: 9363

Added:
   incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/ber/BERDecoderTestCase.java   (contents, props changed)
      - copied, changed from rev 9358, incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/ber/BERDecoderTest.java
   incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/asn/
   incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/asn/TestBitString.java   (contents, props changed)
      - copied, changed from rev 9358, incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/test/TestBitString.java
   incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/BERDecoderCallbackAdapterTest.java
   incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/BERDecoderTest.java
   incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/TupleTest.java
   incubator/directory/snickers/trunk/ber/todo.txt
Removed:
   incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/ber/BERDecoderTest.java
   incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/test/TestBitString.java
Modified:
   incubator/directory/snickers/trunk/ber/project.properties
   incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/ber/BERDecoder.java
   incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/ber/Tuple.java
   incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/ConstructedTLVTests.java
   incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/MultiByteLengthTests.java
   incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/MultiByteTagTests.java
   incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/SimplePrimitiveTLVTests.java
   incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/SingleByteLengthTests.java
   incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/SingleByteTagTests.java
   incubator/directory/snickers/trunk/project.xml
Log:
* Make sure clover is working correctly so we can get a true measure of test 
  coverage.  USED FORK OPTION WITH UNIT TEST PLUGIN SO CLOVER CORRECTLY 
  COLLECTS ITS STATS.

* Added utility method overloads to decode() in the abstract BERDecoderTest 
  which is used as the basis for decoder test cases:
  
  - decode( Tuple )
  - decode( byte )
  - decode( byte[] )
  
* Wrote unit tests for Tuple encode functions

* Took a good look at how we can use the largest integer possible - right now
  we truncate values due to byte boundries when encoding and decoding tags but
  lengths do use the maximum value expressible by an int.  The length might be
  best a long but we'll leave that until we find a need.  Presently over two
  billion bytes, 2,147,483,647 to be exact can be transmitted in a single TLV's
  tuple which equals a transfer stream of 2 GB.  I don't think we'll be hitting
  this soon.  
  
* svn mv src/java/org/apache/snickers/test/TestBitString.java to the 
  respective src/test/org/apache/snickers/asn directory to get it out of the
  way for now.
  




Modified: incubator/directory/snickers/trunk/ber/project.properties
==============================================================================
--- incubator/directory/snickers/trunk/ber/project.properties	(original)
+++ incubator/directory/snickers/trunk/ber/project.properties	Thu Mar 11 15:12:11 2004
@@ -12,3 +12,5 @@
 tag2.scope=all
 
 maven.license.licenseFile=../../../LICENSE.txt
+#maven.clover.instrument.tests=true
+maven.junit.fork=true
\ No newline at end of file

Modified: incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/ber/BERDecoder.java
==============================================================================
--- incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/ber/BERDecoder.java	(original)
+++ incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/ber/BERDecoder.java	Thu Mar 11 15:12:11 2004
@@ -49,8 +49,9 @@
  * leaf TLV tuples of the TLV tuple tree will only contain non null values.  
  * Therefore the nature of a TLV tuple should be investigated by callbacks 
  * before attempting to interpret their values.
- * </p> 
- *
+ * </p>
+ * 
+ * @see Tuple for TLV tuple value size limitations
  * @author <a href="mailto:directory-dev@incubator.apache.org">
  * Apache Directory Project</a>
  * @version $Rev$

Copied: incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/ber/BERDecoderTestCase.java (from rev 9358, incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/ber/BERDecoderTest.java)
==============================================================================
--- incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/ber/BERDecoderTest.java	(original)
+++ incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/ber/BERDecoderTestCase.java	Thu Mar 11 15:12:11 2004
@@ -38,7 +38,7 @@
  * Apache Directory Project</a>
  * @version $Rev$
  */
-public abstract class BERDecoderTest extends TestCase 
+public abstract class BERDecoderTestCase extends TestCase 
     implements BERDecoderCallback, DecoderMonitor
 {
     protected ArrayList tlvList = new ArrayList() ;
@@ -92,7 +92,7 @@
      * Constructor for BERDecoderTest.
      * @param arg0
      */
-    public BERDecoderTest( String arg0 )
+    public BERDecoderTestCase( String arg0 )
     {
         super( arg0 ) ;
     }
@@ -111,6 +111,98 @@
         ByteBuffer buf = ByteBuffer.wrap( bites ) ;
         int lastSize = tlvList.size() ;
         decoder.decode( buf ) ;
+        
+        if ( tlvList.isEmpty() || tlvList.size() == lastSize )
+        {
+            return decoder.getCurrentTuple() ;
+        }
+        
+        return ( Tuple ) tlvList.get( tlvList.size() - 1 ) ;
+    }
+
+    
+    /**
+     * BER decodes a single byte.
+     * 
+     * @param bite a single byte to decode
+     * @return a copy of the decoded tuple or the partially decoded current tlv
+     * @throws DecoderException if there are errors while decoding.
+     */
+    public Tuple decode( byte bite ) throws DecoderException
+    {
+        byte [] bites = { bite } ;
+        ByteBuffer buf = ByteBuffer.wrap( bites ) ;
+        int lastSize = tlvList.size() ;
+        decoder.decode( buf ) ;
+        
+        if ( tlvList.isEmpty() || tlvList.size() == lastSize )
+        {
+            return decoder.getCurrentTuple() ;
+        }
+        
+        return ( Tuple ) tlvList.get( tlvList.size() - 1 ) ;
+    }
+
+    
+    /**
+     * BER decodes a byte array.
+     * 
+     * @param bites a byte array to decode
+     * @return a copy of the decoded tuple or the partially decoded current tlv
+     * @throws DecoderException if there are errors while decoding.
+     */
+    public Tuple decode( byte[] bites ) throws DecoderException
+    {
+        ByteBuffer buf = ByteBuffer.wrap( bites ) ;
+        int lastSize = tlvList.size() ;
+        decoder.decode( buf ) ;
+        
+        if ( tlvList.isEmpty() || tlvList.size() == lastSize )
+        {
+            return decoder.getCurrentTuple() ;
+        }
+        
+        return ( Tuple ) tlvList.get( tlvList.size() - 1 ) ;
+    }
+
+    
+    /**
+     * First BER encodes then BER decodes a Tuple.
+     * 
+     * @param tlv a tuple to encode then decode
+     * @return a copy of the decoded tuple or the partially decoded current tlv
+     * @throws DecoderException if there are errors while decoding
+     */
+    public Tuple decode( Tuple tlv ) throws DecoderException
+    {
+        ByteBuffer buf = ByteBuffer.wrap( tlv.encode() ) ;
+        int lastSize = tlvList.size() ;
+        decoder.decode( buf ) ;
+        
+        if ( tlvList.isEmpty() || tlvList.size() == lastSize )
+        {
+            return decoder.getCurrentTuple() ;
+        }
+        
+        return ( Tuple ) tlvList.get( tlvList.size() - 1 ) ;
+    }
+
+    
+    /**
+     * First BER encodes then BER decodes a train of Tuples.
+     * 
+     * @param tlvs a tuple array to encode then decode
+     * @return a copy of the decoded tuple or the partially decoded current tlv
+     * @throws DecoderException if there are errors while decoding
+     */
+    public Tuple decode( Tuple[] tlvs ) throws DecoderException
+    {
+        int lastSize = tlvList.size() ;
+
+        for ( int ii = 0; ii < tlvs.length; ii++ )
+        {
+            decode( tlvs[ii] ) ;
+        }
         
         if ( tlvList.isEmpty() || tlvList.size() == lastSize )
         {

Modified: incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/ber/Tuple.java
==============================================================================
--- incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/ber/Tuple.java	(original)
+++ incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/ber/Tuple.java	Thu Mar 11 15:12:11 2004
@@ -22,8 +22,11 @@
 
 
 /**
- * Simple TLV Tuple.
- *
+ * Simple TLV Tuple.  Because the length fields is a primitive int it's maximum
+ * value is 2,147,483,647 a single TLV's tuple cannot have a length over this
+ * amount or a value size over 2 GB.  I don't think we'll be hitting this soon
+ * especially with the value size protection feature planned for the decoder.
+ * 
  * @author <a href="mailto:directory-dev@incubator.apache.org">
  * Apache Directory Project</a>
  * @version $Rev$
@@ -31,24 +34,30 @@
 public class Tuple
 {
     /** precalculated left shift of 1 by 7 places */
-    public static final int SHIFT_7 = 1 << 7 ;
+    public static final int BIT_6 = 1 << 7 ;
+    /** precalculated left shift of 1 by 8 places */
+    public static final int BIT_7 = 1 << 8 ;
     /** precalculated left shift of 1 by 14 places */
-    public static final int SHIFT_14 = 1 << 14 ;
+    public static final int BIT_13 = 1 << 14 ;
+    /** precalculated left shift of 1 by 16 places */
+    public static final int BIT_15 = 1 << 16 ;
     /** precalculated left shift of 1 by 21 places */
-    public static final int SHIFT_21 = 1 << 21 ;
-    /** precalculated left shift of 1 by by 28 places */
-    public static final int SHIFT_28 = 1 << 28 ;
+    public static final int BIT_20 = 1 << 21 ;
+    /** precalculated left shift of 1 by 24 places */
+    public static final int BIT_23 = 1 << 24 ;
+    /** precalculated left shift of 1 by 28 places */
+    public static final int BIT_27 = 1 << 28 ;
     
     /** the tag id for this TLV tuple */
     int id = 0 ;
     /** the flag for whether or not this TLV is constructed or primitive */
     boolean isPrimitive = true ;
     /** the type class for this TLV */
-    TypeClass typeClass = null ;
+    TypeClass typeClass = TypeClass.APPLICATION ;
     /** the length for this TLV tuple */
     int length = 0 ;
     /** the value for this TLV tuple */
-    Object value = null ;
+    Object value = ArrayUtils.EMPTY_BYTE_ARRAY ;
     
     /** tlv byte index */
     int index = BERDecoder.UNDEFINED ;
@@ -62,8 +71,7 @@
     
 
     /**
-     * Empty do nothing tuple that does not really have any member propertly 
-     * initialized.
+     * Empty do nothing tuple.
      */
     Tuple() 
     { 
@@ -71,46 +79,117 @@
     
     
     /**
-     * Creates a constructed application tuple with the following tag id and 
-     * with an indefinate value length.
+     * Creates constructed application type tlv tuples.  Constructed TLV's with
+     * a definate length will use this constructor predominantly.  The TypeClass
+     * defualts to APPLICATION.
      * 
      * @param id the tag id of the tlv
+     * @param length the length of the value which is the length of all the 
+     *      nested tuples.
      */
-    public Tuple( int id )
+    public Tuple( int id, int length )
     {
-        this( id, BERDecoder.INDEFINATE, TypeClass.APPLICATION, false, null ) ;
+        this( id, length, TypeClass.APPLICATION ) ;
     }
     
     
     /**
-     * Creates a constructed application type tlv with a set length. 
+     * Creates constructed application type tlv tuples.  Constructed TLV's with
+     * a definate length will use this constructor predominantly.
      * 
      * @param id the tag id of the tlv
-     * @param length the length of the tlv
+     * @param length the length of the value which is the length of all the 
+     *      nested tuples.
+     * @param typeClass the type class of this tlv tuple
      */
-    public Tuple( int id, int length )
+    public Tuple( int id, int length, TypeClass typeClass )
     {
-        this( id, length, TypeClass.APPLICATION, false, null ) ;
+        this.id = id ;
+        this.length = length ;
+        value = ArrayUtils.EMPTY_BYTE_ARRAY ;
+        isPrimitive = false ;
+        
+        if ( typeClass != null )
+        {
+            this.typeClass = typeClass ;
+        }
     }
     
     
     /**
-     * Creates a tuple where every member is specified.
+     * Creates primitive application type tlv tuples.  This will be the primary
+     * constructor used to build primitives.
+     * 
+     * @param id the tag id of the tlv
+     * @param value the value portion for this Tuple
+     */
+    public Tuple( int id, byte[] value )
+    {
+        this( id, TypeClass.APPLICATION, true, value ) ;
+    }
+    
+    
+    /**
+     * Creates an application type tlv with a set value and length.  
+     * 
+     * @param id the tag id of the tlv
+     * @param isPrimitive whether or not the tlv is primitive or constructed
+     * @param value the value portion for this Tuple
+     */
+    public Tuple( int id, boolean isPrimitive, byte[] value )
+    {
+        this( id, TypeClass.APPLICATION, isPrimitive, value ) ;
+    }
+    
+    
+    /**
+     * Creates a tuple where the length is indefinate.  The tuple according to
+     * the BER encoding must be of the constructed type.
      * 
      * @param id the tag id of the tlv
-     * @param length the length of the tlv
      * @param typeClass the type class for the tlv
      * @param isPrimitive whether or not the tlv is primitive or constructed
-     * @param value the 
+     * @param value the value portion for this Tuple
      */
-    public Tuple( int id, int length, TypeClass typeClass, boolean isPrimitive,
+    public Tuple( int id, TypeClass typeClass )
+    {
+        this.id = id ;
+        this.isPrimitive = false ;
+        value = ArrayUtils.EMPTY_BYTE_ARRAY ;
+        length = BERDecoder.INDEFINATE ;
+        
+        if ( typeClass != null )
+        {
+            this.typeClass = typeClass ;
+        }
+    }
+    
+    
+    /**
+     * Creates a tuple where every member is specified including the length 
+     * which is taken from the value array.
+     * 
+     * @param id the tag id of the tlv
+     * @param typeClass the type class for the tlv
+     * @param isPrimitive whether or not the tlv is primitive or constructed
+     * @param value the value portion for this Tuple
+     */
+    public Tuple( int id, TypeClass typeClass, boolean isPrimitive, 
                   byte[] value )
     {
         this.id = id ;
-        this.length = length ;
-        this.typeClass = typeClass ;
         this.isPrimitive = isPrimitive ;
-        this.value = value ;
+        
+        if ( value != null )
+        {
+            this.value = value ;
+            this.length = value.length ;
+        }
+        
+        if ( typeClass != null )
+        {
+            this.typeClass = typeClass ;
+        }
     }
     
     
@@ -165,7 +244,7 @@
     
     
     // ------------------------------------------------------------------------
-    // Utility methods and Object overrides
+    // Utility methods and java.lang.Object overrides
     // ------------------------------------------------------------------------
     
     
@@ -178,18 +257,27 @@
         this.index = 0 ;
         this.isPrimitive = true ;
         this.length = BERDecoder.UNDEFINED ;
-        this.typeClass = null ;
-        this.value = null ;
+        this.typeClass = TypeClass.APPLICATION ;
+        this.value = ArrayUtils.EMPTY_BYTE_ARRAY ;
         this.valueIndex = BERDecoder.UNDEFINED ;
     }
 
     
-    /*
-     * (non-Javadoc)
+    /**
+     * Does not take into account the index or the valueIndex values when
+     * checking for equality.  Technically if both are being constructed by
+     * the decoder then they should only be equal when these values are equal
+     * because the tag, length or value would not be correct.
+     *
      * @see java.lang.Object#equals(java.lang.Object)
      */
     public boolean equals( Object o )
     {
+        if ( o == this )
+        {
+            return true ;
+        }
+        
         if ( o instanceof Tuple )
         {
             Tuple t = ( Tuple ) o ;
@@ -199,11 +287,6 @@
                 return false ;
             }
             
-            if ( t.index != index )
-            {
-                return false ;
-            }
-            
             if ( t.isPrimitive != isPrimitive )
             {
                 return false ;
@@ -223,12 +306,7 @@
             {
                 
             }
-            else if ( ArrayUtils.isEquals( t.value, value ) )
-            {
-                return false ;
-            }
-            
-            if ( t.valueIndex != valueIndex )
+            else if ( ! ArrayUtils.isEquals( t.value, value ) )
             {
                 return false ;
             }
@@ -305,7 +383,7 @@
      * @param octets the array of bytes to set the tag in
      * @param tagLength the length of the tag section
      */
-    public void setTag( byte[] octets, int tagLength )
+    void setTag( byte[] octets, int tagLength )
     {
         octets[0] = ( byte ) typeClass.getValue() ;
         
@@ -317,7 +395,6 @@
         if ( tagLength == 1 )
         {
             octets[0] |= id ;
-            return ;
         }
         else
         {
@@ -326,45 +403,85 @@
         
         if ( tagLength >= 2 )
         {
-            int shifted = id << 25 ;
-            octets[1] = ( byte ) ( shifted >> 25 ) ;
+            octets[1] = ( byte ) ( ( int ) 0x0000007f & id ) ;
             
             if ( tagLength > 2 )
             {
                 octets[1] |= Binary.BIT_7 ;
             }
         }
-        else if ( tagLength >= 3 )
+        else
         {
-            int shifted = id << 18 ;
-            octets[2] = ( byte ) ( shifted >> 25 ) ;
+            return ;
+        }
+        
+        /* 
+         * Take bits [8-14] (1 based bit indexing) inclusive in id and set the
+         * value for the second byte to this when shifted down 7 positions so
+         * we need the following mask:
+         * 
+         * 0011 1111 1000 0000 => 0x3f80
+         * 
+         */
+        if ( tagLength >= 3 )
+        {
+            octets[2] = ( byte ) ( ( ( int ) 0x3f80 & id ) >> 7 ) ;
             
             if ( tagLength > 3 )
             {
                 octets[2] |= Binary.BIT_7 ;
             }
         }
-        else if ( tagLength >= 4 )
+        else
         {
-            int shifted = id << 11 ;
-            octets[3] = ( byte ) ( shifted >> 25 ) ;
+            return ;
+        }
+        
+        /* 
+         * Take bits [15-21] (1 based bit indexing) inclusive in id and set the
+         * value for the second byte to this when shifted down 14 positions so
+         * we need the following mask:
+         * 
+         * 0001 1111 1100 0000 0000 0000 => 0x1fc000
+         * 
+         */
+        if ( tagLength >= 4 )
+        {
+            octets[3] = ( byte ) ( ( ( int ) 0x1fc000 & id ) >> 14 ) ;
             
             if ( tagLength > 4 )
             {
                 octets[3] |= Binary.BIT_7 ;
             }
         }
-        else if ( tagLength >= 5 )
+        else
         {
-            int shifted = id << 4 ;
-            octets[4] = ( byte ) ( shifted >> 25 ) ;
+            return ;
+        }
+        
+        /* 
+         * Take bits [22-28] (1 based bit indexing) inclusive in id and set the
+         * value for the second byte to this when shifted down 21 positions so
+         * we need the following mask:
+         * 
+         * 0000 1111 1110 0000 0000 0000 0000 0000 => 0x0fe00000
+         * 
+         */
+        if ( tagLength >= 5 )
+        {
+            octets[4] = ( byte ) ( ( ( int ) 0x0fe00000 & id ) >> 21 ) ;
             
             if ( tagLength > 5 )
             {
                 octets[4] |= Binary.BIT_7 ;
             }
         }
-        else if ( tagLength >= 6 )
+        else
+        {
+            return ;
+        }
+        
+        if ( tagLength >= 6 )
         {    
             throw new IllegalArgumentException( "cannot support id's as large "
                     + "as " + id + " unless we start using longs for the id" ) ;
@@ -377,41 +494,56 @@
      * 
      * @param octets the byte [] to set length in
      * @param offset the offset in the array to start the length section in
-     * @param lengthOfLength the length of the length section
+     * @param lengthBytes the number bytes for the length section
      */
-    public void setLength( byte[] octets, int offset, int lengthOfLength )
+    void setLength( byte[] octets, int offset, int lengthBytes )
     {
-        if ( length == 1 )
+        if ( lengthBytes == 1 )
         {
             octets[offset] |= length ;
+        }
+        else
+        {
+            octets[offset] |= Binary.BIT_7 | lengthBytes - 1 ;
+        }
+        
+        if ( lengthBytes >= 2 )
+        {
+            octets[offset + 1] =  ( byte ) ( 0xff & length ) ;
+        }
+        else
+        {
             return ;
         }
+        
+        if ( lengthBytes >= 3 )
+        {
+            octets[offset + 2] = ( byte ) ( ( 0xff00 & length ) >> 8 ) ;
+        }
         else
         {
-            octets[offset] |= Binary.BIT_7 | lengthOfLength ;
+            return ;
         }
         
-        if ( lengthOfLength >= 2 )
+        if ( lengthBytes >= 4 )
         {
-            int shifted = length << 25 ;
-            octets[offset + 1] = ( byte ) ( shifted >> 25 ) ;
+            octets[offset + 3] = ( byte ) ( ( 0xff0000 & length ) >> 16 ) ;
         }
-        else if ( lengthOfLength >= 3 )
+        else
         {
-            int shifted = length << 18 ;
-            octets[offset + 2] = ( byte ) ( shifted >> 25 ) ;
+            return ;
         }
-        else if ( lengthOfLength >= 4 )
+        
+        if ( lengthBytes >= 5 )
         {
-            int shifted = length << 11 ;
-            octets[offset + 3] = ( byte ) ( shifted >> 25 ) ;
+            octets[offset + 4] = ( byte ) ( ( 0xff000000 & length ) >> 24 ) ;
         }
-        else if ( lengthOfLength >= 5 )
+        else
         {
-            int shifted = length << 4 ;
-            octets[offset + 4] = ( byte ) ( shifted >> 25 ) ;
+            return ;
         }
-        else if ( lengthOfLength >= 6 )
+        
+        if ( lengthBytes >= 6 )
         {    
             throw new IllegalArgumentException( "cannot support lengths as "
                     + "large as " + length 
@@ -431,20 +563,20 @@
         {
             return 1 ;
         }
-        else if ( id < SHIFT_7 )
+        else if ( id < BIT_6 )
         {
             return 2 ;
         }
         
-        else if ( id < SHIFT_14 )
+        else if ( id < BIT_13 )
         {
             return 3 ;
         }
-        else if ( id < SHIFT_21 )
+        else if ( id < BIT_20 )
         {
             return 4 ;
         }
-        else if ( id < SHIFT_28 )
+        else if ( id < BIT_27 )
         {
             return 5 ;
         }
@@ -461,24 +593,32 @@
      */
     public int getLengthLength()
     {
-        if ( length < SHIFT_7 )
+        if ( length < 0 )
+        {
+            throw new IllegalArgumentException( "integer overflow makes id " 
+                    + "negative with a value of " + id 
+                    + " - unless we start using longs for"
+                    + " the id there you've hit a limitation" ) ;
+        }
+        else if ( length < BIT_6 )
         {
             return 1 ;
         }
-        else if ( length < SHIFT_14 )
+        else if ( length < BIT_7 )
         {    
+            return 2 ;
+        }
+        else if ( length < BIT_15 )
+        {
             return 3 ;
         }
-        else if ( length < SHIFT_21 )
+        else if ( length < BIT_23 )
         {
             return 4 ;
         }
-        else if ( length < SHIFT_28 )
+        else 
         {
             return 5 ;
         }
-
-        throw new IllegalArgumentException( "cannot support lengths's as large " 
-                + "as " + id + " unless we start using longs for them" ) ;
     }
 }

Copied: incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/asn/TestBitString.java (from rev 9358, incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/test/TestBitString.java)
==============================================================================
--- incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/test/TestBitString.java	(original)
+++ incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/asn/TestBitString.java	Thu Mar 11 15:12:11 2004
@@ -48,7 +48,7 @@
 
 */
 
-package org.apache.snickers.test;
+package org.apache.snickers.asn;
 
 import java.util.BitSet;
 import junit.framework.TestCase;

Added: incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/BERDecoderCallbackAdapterTest.java
==============================================================================
--- (empty file)
+++ incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/BERDecoderCallbackAdapterTest.java	Thu Mar 11 15:12:11 2004
@@ -0,0 +1,82 @@
+/*
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.snickers.ber ;
+
+
+import junit.framework.TestCase ;
+
+
+/**
+ * Tests for the adapter to pass clover coverage.
+ *
+ * @author <a href="mailto:directory-dev@incubator.apache.org">
+ * Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class BERDecoderCallbackAdapterTest extends TestCase
+{
+    BERDecoderCallbackAdapter adapter = null ;
+    
+
+    public static void main(String[] args)
+    {
+        junit.textui.TestRunner.run(BERDecoderCallbackAdapterTest.class);
+    }
+
+    /*
+     * @see TestCase#setUp()
+     */
+    protected void setUp() throws Exception
+    {
+        super.setUp();
+        adapter = new BERDecoderCallbackAdapter() ;
+    }
+
+    /*
+     * @see TestCase#tearDown()
+     */
+    protected void tearDown() throws Exception
+    {
+        super.tearDown();
+        adapter = null ;
+    }
+
+    /**
+     * Constructor for BERDecoderCallbackAdapter.
+     * @param arg0
+     */
+    public BERDecoderCallbackAdapterTest(String arg0)
+    {
+        super(arg0);
+    }
+
+    public void testTagDecoded()
+    {
+        adapter.tagDecoded( null ) ;
+    }
+
+    public void testLengthDecoded()
+    {
+        adapter.lengthDecoded( null ) ;
+    }
+
+    public void testDecodeOccurred()
+    {
+        adapter.decodeOccurred( null, null ) ;
+    }
+
+}

Added: incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/BERDecoderTest.java
==============================================================================
--- (empty file)
+++ incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/BERDecoderTest.java	Thu Mar 11 15:12:11 2004
@@ -0,0 +1,44 @@
+/*
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.snickers.ber ;
+
+
+import org.apache.commons.lang.ArrayUtils ;
+
+
+/**
+ * Tests the decoder using various complext TLV decoding scenarios and performs
+ * round trip encode - decode functionality.
+ *
+ * @author <a href="mailto:directory-dev@incubator.apache.org">
+ * Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class BERDecoderTest extends BERDecoderTestCase
+{
+    public BERDecoderTest()
+    {
+        super( BERDecoderTest.class.getName() ) ;
+    }
+    
+    
+    public void testPrimitives() throws Exception
+    {
+        Tuple t = new Tuple( 45, ArrayUtils.EMPTY_BYTE_ARRAY ) ;
+        assertTrue( decode( t ).equals( t ) ) ; 
+    }
+}

Modified: incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/ConstructedTLVTests.java
==============================================================================
--- incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/ConstructedTLVTests.java	(original)
+++ incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/ConstructedTLVTests.java	Thu Mar 11 15:12:11 2004
@@ -24,7 +24,7 @@
  * Apache Directory Project</a>
  * @version $Rev$
  */
-public class ConstructedTLVTests extends BERDecoderTest
+public class ConstructedTLVTests extends BERDecoderTestCase
 {
 
     /**

Modified: incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/MultiByteLengthTests.java
==============================================================================
--- incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/MultiByteLengthTests.java	(original)
+++ incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/MultiByteLengthTests.java	Thu Mar 11 15:12:11 2004
@@ -24,7 +24,7 @@
  * Apache Directory Project</a>
  * @version $Rev$
  */
-public class MultiByteLengthTests extends BERDecoderTest
+public class MultiByteLengthTests extends BERDecoderTestCase
 {
     /**
      * Creates a single byte lenth test case.

Modified: incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/MultiByteTagTests.java
==============================================================================
--- incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/MultiByteTagTests.java	(original)
+++ incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/MultiByteTagTests.java	Thu Mar 11 15:12:11 2004
@@ -25,7 +25,7 @@
  * Apache Directory Project</a>
  * @version $Rev: 9318 $
  */
-public class MultiByteTagTests extends BERDecoderTest
+public class MultiByteTagTests extends BERDecoderTestCase
 {
 
     /**
@@ -140,7 +140,7 @@
         assertEquals( BERDecoderState.TAG, decoder.getState() ) ;
 
         tlv = decode( "00000001" ) ;
-        assertEquals( Tuple.SHIFT_14, tlv.id ) ;
+        assertEquals( Tuple.BIT_13, tlv.id ) ;
         assertEquals( BERDecoderState.LENGTH, decoder.getState() ) ;
     }
 
@@ -159,7 +159,7 @@
         assertEquals( BERDecoderState.TAG, decoder.getState() ) ;
 
         tlv = decode( "01111111" ) ;
-        assertEquals( Tuple.SHIFT_14 - 1, tlv.id ) ;
+        assertEquals( Tuple.BIT_13 - 1, tlv.id ) ;
         assertEquals( BERDecoderState.LENGTH, decoder.getState() ) ;
     }
 
@@ -182,7 +182,7 @@
         assertEquals( BERDecoderState.TAG, decoder.getState() ) ;
 
         tlv = decode( "00000001" ) ;
-        assertEquals( Tuple.SHIFT_14 + 1, tlv.id ) ;
+        assertEquals( Tuple.BIT_13 + 1, tlv.id ) ;
         assertEquals( BERDecoderState.LENGTH, decoder.getState() ) ;
     }
 
@@ -209,7 +209,7 @@
         assertEquals( BERDecoderState.TAG, decoder.getState() ) ;
 
         tlv = decode( "00000001" ) ;
-        assertEquals( Tuple.SHIFT_21, tlv.id ) ;
+        assertEquals( Tuple.BIT_20, tlv.id ) ;
         assertEquals( BERDecoderState.LENGTH, decoder.getState() ) ;
     }
 
@@ -232,7 +232,7 @@
         assertEquals( BERDecoderState.TAG, decoder.getState() ) ;
 
         tlv = decode( "01111111" ) ;
-        assertEquals( Tuple.SHIFT_21 - 1, tlv.id ) ;
+        assertEquals( Tuple.BIT_20 - 1, tlv.id ) ;
         assertEquals( BERDecoderState.LENGTH, decoder.getState() ) ;
     }
 
@@ -259,7 +259,7 @@
         assertEquals( BERDecoderState.TAG, decoder.getState() ) ;
 
         tlv = decode( "00000001" ) ;
-        assertEquals( Tuple.SHIFT_21 + 1, tlv.id ) ;
+        assertEquals( Tuple.BIT_20 + 1, tlv.id ) ;
         assertEquals( BERDecoderState.LENGTH, decoder.getState() ) ;
     }
 
@@ -290,7 +290,7 @@
         assertEquals( BERDecoderState.TAG, decoder.getState() ) ;
 
         tlv = decode( "00000001" ) ;
-        assertEquals( Tuple.SHIFT_28, tlv.id ) ;
+        assertEquals( Tuple.BIT_27, tlv.id ) ;
         assertEquals( BERDecoderState.LENGTH, decoder.getState() ) ;
     }
 
@@ -317,7 +317,7 @@
         assertEquals( BERDecoderState.TAG, decoder.getState() ) ;
 
         tlv = decode( "01111111" ) ;
-        assertEquals( Tuple.SHIFT_28 - 1, tlv.id ) ;
+        assertEquals( Tuple.BIT_27 - 1, tlv.id ) ;
         assertEquals( BERDecoderState.LENGTH, decoder.getState() ) ;
     }
 
@@ -348,7 +348,7 @@
         assertEquals( BERDecoderState.TAG, decoder.getState() ) ;
 
         tlv = decode( "00000001" ) ;
-        assertEquals( Tuple.SHIFT_28 + 1, tlv.id ) ;
+        assertEquals( Tuple.BIT_27 + 1, tlv.id ) ;
         assertEquals( BERDecoderState.LENGTH, decoder.getState() ) ;
     }
 }

Modified: incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/SimplePrimitiveTLVTests.java
==============================================================================
--- incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/SimplePrimitiveTLVTests.java	(original)
+++ incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/SimplePrimitiveTLVTests.java	Thu Mar 11 15:12:11 2004
@@ -24,7 +24,7 @@
  * Apache Directory Project</a>
  * @version $Rev$
  */
-public class SimplePrimitiveTLVTests extends BERDecoderTest
+public class SimplePrimitiveTLVTests extends BERDecoderTestCase
 {
 
     /**

Modified: incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/SingleByteLengthTests.java
==============================================================================
--- incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/SingleByteLengthTests.java	(original)
+++ incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/SingleByteLengthTests.java	Thu Mar 11 15:12:11 2004
@@ -24,7 +24,7 @@
  * Apache Directory Project</a>
  * @version $Rev$
  */
-public class SingleByteLengthTests extends BERDecoderTest
+public class SingleByteLengthTests extends BERDecoderTestCase
 {
     /**
      * Creates a single byte lenth test case.

Modified: incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/SingleByteTagTests.java
==============================================================================
--- incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/SingleByteTagTests.java	(original)
+++ incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/SingleByteTagTests.java	Thu Mar 11 15:12:11 2004
@@ -25,7 +25,7 @@
  * Apache Directory Project</a>
  * @version $Rev$
  */
-public class SingleByteTagTests extends BERDecoderTest
+public class SingleByteTagTests extends BERDecoderTestCase
 {
 
     /**

Added: incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/TupleTest.java
==============================================================================
--- (empty file)
+++ incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/TupleTest.java	Thu Mar 11 15:12:11 2004
@@ -0,0 +1,920 @@
+/*
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.snickers.ber ;
+
+
+import org.apache.commons.lang.ArrayUtils ;
+import org.apache.commons.codec.binary.Binary ;
+
+import junit.framework.TestCase ;
+
+
+/**
+ * Tests Tuple class.
+ *
+ * @author <a href="mailto:directory-dev@incubator.apache.org">
+ * Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class TupleTest extends TestCase
+{
+
+    public static void main(String[] args)
+    {
+        junit.textui.TestRunner.run(TupleTest.class);
+    }
+
+    /*
+     * @see TestCase#setUp()
+     */
+    protected void setUp() throws Exception
+    {
+        super.setUp();
+    }
+
+    /*
+     * @see TestCase#tearDown()
+     */
+    protected void tearDown() throws Exception
+    {
+        super.tearDown();
+    }
+
+    /**
+     * Constructor for TupleTest.
+     * @param arg0
+     */
+    public TupleTest(String arg0)
+    {
+        super(arg0);
+    }
+
+    /*
+     * Class to test for void Tuple()
+     */
+    public void testTuple()
+    {
+        assertNotNull( new Tuple() ) ;
+    }
+
+    /*
+     * Class to test for void Tuple(int)
+     */
+    public void testTupleint()
+    {
+        Tuple t0 = new Tuple( 0, 0 ) ;
+        assertEquals( 0, t0.id ) ;
+        Tuple t1 = new Tuple( 1, 0 ) ;
+        assertEquals( 1, t1.id ) ;
+        assertFalse( t0.equals(t1) ) ;
+    }
+
+    /*
+     * Class to test for void Tuple(int, int)
+     */
+    public void testTupleintint()
+    {
+        Tuple t0 = new Tuple( 0, 0 ) ;
+        assertEquals( 0, t0.id ) ;
+        assertEquals( 0, t0.length ) ;
+        Tuple t1 = new Tuple( 0, 1 ) ;
+        assertEquals( 0, t1.id ) ;
+        assertEquals( 1, t1.length ) ;
+        assertFalse( t0.equals(t1) ) ;
+    }
+
+    /*
+     * Class to test for void Tuple(int, int, TypeClass)
+     */
+    public void testTupleintintTypeClass()
+    {
+        Tuple t0 = new Tuple( 0, 0, TypeClass.PRIVATE ) ;
+        assertEquals( 0, t0.id ) ;
+        assertEquals( 0, t0.length ) ;
+        assertEquals( TypeClass.PRIVATE, t0.getTypeClass() ) ;
+        Tuple t1 = new Tuple( 0, 1, null ) ;
+        assertEquals( 0, t1.id ) ;
+        assertEquals( 1, t1.length ) ;
+        assertFalse( t0.equals(t1) ) ;
+        assertEquals( TypeClass.APPLICATION, t1.getTypeClass() ) ;
+    }
+
+    /*
+     * Class to test for void Tuple(int, int, TypeClass, boolean, byte[])
+     */
+    public void testTupleintTypeClassbooleanbyteArray()
+    {
+        Tuple t = new Tuple( 2, TypeClass.PRIVATE, true, 
+                ArrayUtils.EMPTY_BYTE_ARRAY ) ;
+        assertEquals( 2, t.getId() ) ;
+        assertEquals( TypeClass.PRIVATE, t.getTypeClass() ) ;
+        assertEquals( true, t.isPrimitive() ) ;
+        assertEquals( 0, t.getLength() ) ;
+        assertEquals( ArrayUtils.EMPTY_BYTE_ARRAY, t.getValue() ) ;
+
+        t = new Tuple( 2, TypeClass.PRIVATE, true, null ) ;
+        assertEquals( 2, t.getId() ) ;
+        assertEquals( TypeClass.PRIVATE, t.getTypeClass() ) ;
+        assertEquals( true, t.isPrimitive() ) ;
+        assertEquals( 0, t.getLength() ) ;
+        assertEquals( ArrayUtils.EMPTY_BYTE_ARRAY, t.getValue() ) ;
+
+        byte[] bites = new byte[7] ;
+        t = new Tuple( 2, (TypeClass) null, false, bites ) ;
+        assertEquals( 2, t.getId() ) ;
+        assertEquals( TypeClass.APPLICATION, t.getTypeClass() ) ;
+        assertEquals( false, t.isPrimitive() ) ;
+        assertEquals( 7, t.getLength() ) ;
+        assertEquals( bites, t.getValue() ) ;
+        
+        t = new Tuple( 2, null, false,  null ) ; 
+        assertEquals( 2, t.getId() ) ;
+        assertEquals( TypeClass.APPLICATION, t.getTypeClass() ) ;
+        assertEquals( false, t.isPrimitive() ) ;
+        assertEquals( 0, t.getLength() ) ;
+        assertEquals( ArrayUtils.EMPTY_BYTE_ARRAY, t.getValue() ) ;
+    }
+
+    /*
+     * Class to test for void Tuple(int, int, TypeClass, boolean, byte[])
+     */
+    public void testTupleintbyteArray()
+    {
+        Tuple t = new Tuple( 2, ArrayUtils.EMPTY_BYTE_ARRAY ) ;
+        assertEquals( 2, t.getId() ) ;
+        assertEquals( TypeClass.APPLICATION, t.getTypeClass() ) ;
+        assertEquals( true, t.isPrimitive() ) ;
+        assertEquals( 0, t.getLength() ) ;
+        assertEquals( ArrayUtils.EMPTY_BYTE_ARRAY, t.getValue() ) ;
+        
+        byte[] bites = new byte[5] ;
+        t = new Tuple( 2, ArrayUtils.EMPTY_BYTE_ARRAY ) ;
+        assertEquals( 2, t.getId() ) ;
+        assertEquals( TypeClass.APPLICATION, t.getTypeClass() ) ;
+        assertEquals( true, t.isPrimitive() ) ;
+        assertEquals( 5, t.getLength() ) ;
+        assertEquals( bites, t.getValue() ) ;
+    }
+
+    /*
+     * Class to test for void Tuple(int, int, TypeClass, boolean, byte[])
+     */
+    public void testTupleintbooleanbyteArray()
+    {
+        Tuple t = new Tuple( 2, false, ArrayUtils.EMPTY_BYTE_ARRAY ) ;
+        assertEquals( 2, t.getId() ) ;
+        assertEquals( TypeClass.APPLICATION, t.getTypeClass() ) ;
+        assertEquals( false, t.isPrimitive() ) ;
+        assertEquals( 0, t.getLength() ) ;
+        assertEquals( ArrayUtils.EMPTY_BYTE_ARRAY, t.getValue() ) ;
+        
+        byte[] bites = new byte[5] ;
+        t = new Tuple( 2, false, ArrayUtils.EMPTY_BYTE_ARRAY ) ;
+        assertEquals( 2, t.getId() ) ;
+        assertEquals( TypeClass.APPLICATION, t.getTypeClass() ) ;
+        assertEquals( false, t.isPrimitive() ) ;
+        assertEquals( 5, t.getLength() ) ;
+        assertEquals( bites, t.getValue() ) ;
+    }
+
+    /*
+     * Class to test for void Tuple(int, int, TypeClass, boolean, byte[])
+     */
+    public void testTupleintTypeClass()
+    {
+        Tuple t = new Tuple( 2, TypeClass.PRIVATE ) ;
+        assertEquals( 2, t.getId() ) ;
+        assertEquals( TypeClass.PRIVATE, t.getTypeClass() ) ;
+        assertEquals( false, t.isPrimitive() ) ;
+        assertEquals( BERDecoder.INDEFINATE, t.getLength() ) ;
+        assertEquals( ArrayUtils.EMPTY_BYTE_ARRAY, t.getValue() ) ;
+
+        t = new Tuple( 2, (TypeClass) null ) ;
+        assertEquals( 2, t.getId() ) ;
+        assertEquals( TypeClass.APPLICATION, t.getTypeClass() ) ;
+        assertEquals( false, t.isPrimitive() ) ;
+        assertEquals( BERDecoder.INDEFINATE, t.getLength() ) ;
+        assertEquals( ArrayUtils.EMPTY_BYTE_ARRAY, t.getValue() ) ;
+    }
+
+    public void testGetId()
+    {
+        Tuple t = new Tuple() ;
+        assertEquals( 0, t.getId() ) ;
+        t = new Tuple( 2, 0 ) ;
+        assertEquals( 2, t.getId() ) ;
+        t.id = 21 ;
+        assertEquals( 21, t.getId() ) ;
+    }
+
+    public void testIsPrimitive()
+    {
+        Tuple t = new Tuple() ;
+        assertTrue( t.isPrimitive() ) ;
+        t.isPrimitive = false ;
+        assertFalse( t.isPrimitive() ) ;
+    }
+
+    public void testGetLength()
+    {
+        Tuple t = new Tuple() ;
+        assertEquals( 0, t.getLength() ) ;
+        t = new Tuple( 1, 2 ) ;
+        assertEquals( 2, t.getLength() ) ;
+        t.length = 21 ;
+        assertEquals( 21, t.getLength() ) ;
+    }
+
+    public void testGetTypeClass()
+    {
+        Tuple t = new Tuple() ;
+        assertEquals( t.typeClass, TypeClass.APPLICATION ) ;
+        t = new Tuple( 0, 0 ) ;
+        assertEquals( TypeClass.APPLICATION, t.getTypeClass() ) ;
+        t.typeClass = TypeClass.PRIVATE ;
+        assertEquals( TypeClass.PRIVATE, t.getTypeClass() ) ;
+    }
+
+    public void testGetValue()
+    {
+        Tuple t = new Tuple() ;
+        assertEquals( ArrayUtils.EMPTY_BYTE_ARRAY, t.getValue() ) ;
+        byte[] bites = {1, 2, 3, 45} ;
+        t.value = bites ;
+        assertEquals( bites, t.getValue() ) ;
+        byte[] bites2 = {1, 2, 3, 45} ;
+        assertFalse( bites2 == t.getValue() ) ;
+        t.clear() ;
+        assertEquals( ArrayUtils.EMPTY_BYTE_ARRAY, t.getValue() ) ;
+    }
+
+    public void testClear()
+    {
+        Tuple t = new Tuple() ;
+        t.id = 12 ;
+        assertEquals( 12, t.id ) ;
+        t.clear() ;
+        assertEquals( 0, t.id ) ;
+
+        t.length = 12 ;
+        assertEquals( 12, t.length ) ;
+        t.clear() ;
+        assertEquals( BERDecoder.UNDEFINED, t.length ) ;
+
+        t.index = 12 ;
+        assertEquals( 12, t.index ) ;
+        t.clear() ;
+        assertEquals( 0, t.index ) ;
+
+        t.isPrimitive = false ;
+        assertEquals( false, t.isPrimitive ) ;
+        t.clear() ;
+        assertEquals( true, t.isPrimitive ) ;
+
+        t.typeClass = TypeClass.CONTEXT_SPECIFIC ;
+        assertEquals( TypeClass.CONTEXT_SPECIFIC, t.typeClass ) ;
+        t.clear() ;
+        assertEquals( TypeClass.APPLICATION, t.typeClass ) ;
+
+        t.value = new byte[3] ;
+        assertNotNull( t.value ) ;
+        t.clear() ;
+        assertEquals( ArrayUtils.EMPTY_BYTE_ARRAY, t.value ) ;
+
+        t.valueIndex = 12 ;
+        assertEquals( 12, t.valueIndex ) ;
+        t.clear() ;
+        assertEquals( BERDecoder.UNDEFINED, t.valueIndex ) ;
+
+    }
+
+    /*
+     * Class to test for boolean equals(Object)
+     */
+    public void testEqualsObject()
+    {
+        Tuple tnull0 = new Tuple() ;
+        tnull0.value = null ;
+        Tuple tnull1 = new Tuple() ;
+        tnull1.value = null ;
+        tnull0.equals( tnull1 ) ;
+        
+        tnull1.equals( tnull1 ) ;
+        tnull0.equals( tnull0 ) ;
+        
+        Tuple t0 = new Tuple() ;
+        Tuple t1 = ( Tuple ) t0.clone() ;
+        
+        assertTrue( t0.equals( t1 ) ) ;
+        t0.id = 23 ;
+        assertFalse( t0.equals( t1 ) ) ;
+        t1 = ( Tuple ) t0.clone() ;
+        assertTrue( t0.equals( t1 ) ) ;
+
+        t0.index = 23 ;
+        assertFalse( t0.equals( t1 ) ) ;
+        t1 = ( Tuple ) t0.clone() ;
+        assertTrue( t0.equals( t1 ) ) ;
+
+        t0.isPrimitive = false ;
+        assertFalse( t0.equals( t1 ) ) ;
+        t1 = ( Tuple ) t0.clone() ;
+        assertTrue( t0.equals( t1 ) ) ;
+
+        t0.length = 23 ;
+        assertFalse( t0.equals( t1 ) ) ;
+        t1 = ( Tuple ) t0.clone() ;
+        assertTrue( t0.equals( t1 ) ) ;
+
+        t0.typeClass = TypeClass.PRIVATE ;
+        assertFalse( t0.equals( t1 ) ) ;
+        t1 = ( Tuple ) t0.clone() ;
+        assertTrue( t0.equals( t1 ) ) ;
+
+        t0.valueIndex = 23 ;
+        assertFalse( t0.equals( t1 ) ) ;
+        t1 = ( Tuple ) t0.clone() ;
+        assertTrue( t0.equals( t1 ) ) ;
+
+        t0.value = new byte[4] ;
+        assertFalse( t0.equals( t1 ) ) ;
+        t1 = ( Tuple ) t0.clone() ;
+        assertTrue( t0.equals( t1 ) ) ;
+
+        assertFalse( t0.equals( new Object() )) ;
+     }
+
+    /*
+     * Class to test for Object clone()
+     */
+    public void testClone()
+    {
+        Tuple t = new Tuple() ;
+        assertTrue( t.equals( t.clone() ) ) ;
+    }
+
+    public void testEncodeConstructed()
+    {
+        Tuple t = null ;
+        byte[] encoded ;
+        String binary ;
+        
+        t = new Tuple( 0, 0 ) ;
+        encoded = t.encode() ;
+        binary = Binary.toAsciiString( encoded ) ;
+        assertEquals( 
+                "00000000" +
+                "01100000"
+                , Binary.toAsciiString( encoded ) ) ;
+
+        t = new Tuple( 2, 0 ) ;
+        encoded = t.encode() ;
+        binary = Binary.toAsciiString( encoded ) ;
+        assertEquals( 
+                "00000000" +
+                "01100010"
+                , Binary.toAsciiString( encoded ) ) ;
+
+        t = new Tuple( 30, 0 ) ;
+        encoded = t.encode() ;
+        binary = Binary.toAsciiString( encoded ) ;
+        assertEquals( 
+                "00000000" +
+                "01111110"
+                , Binary.toAsciiString( encoded ) ) ;
+
+        t = new Tuple( 31, 0 ) ;
+        encoded = t.encode() ;
+        binary = Binary.toAsciiString( encoded ) ;
+        assertEquals( 
+                "00000000" +
+                "00011111" +
+                "01111111"
+                , Binary.toAsciiString( encoded ) ) ;
+
+        t = new Tuple( 128, 0 ) ;
+        encoded = t.encode() ;
+        binary = Binary.toAsciiString( encoded ) ;
+        assertEquals( 
+                "00000000" +
+                "00000001" +
+                "10000000" +
+                "01111111"
+                , Binary.toAsciiString( encoded ) ) ;
+
+        t = new Tuple( 128, 127 ) ;
+        encoded = t.encode() ;
+        binary = Binary.toAsciiString( encoded ) ;
+        assertEquals( 
+                "01111111" +
+                "00000001" +
+                "10000000" +
+                "01111111"
+                , Binary.toAsciiString( encoded ) ) ;
+
+        t = new Tuple( 128, 128 ) ;
+        encoded = t.encode() ;
+        binary = Binary.toAsciiString( encoded ) ;
+        assertEquals( 
+                "10000000" +
+                "10000001" +
+                "00000001" +
+                "10000000" +
+                "01111111"
+                , Binary.toAsciiString( encoded ) ) ;
+
+        t = new Tuple( 128, 255 ) ;
+        encoded = t.encode() ;
+        binary = Binary.toAsciiString( encoded ) ;
+        assertEquals( 
+                "11111111" +
+                "10000001" +
+                "00000001" +
+                "10000000" +
+                "01111111"
+                , Binary.toAsciiString( encoded ) ) ;
+
+        t = new Tuple( 128, 256 ) ;
+        encoded = t.encode() ;
+        binary = Binary.toAsciiString( encoded ) ;
+        assertEquals( 
+                "00000001" +
+                "00000000" +
+                "10000010" +
+                "00000001" +
+                "10000000" +
+                "01111111"
+                , Binary.toAsciiString( encoded ) ) ;
+
+        t = new Tuple( Tuple.BIT_27-1, Integer.MAX_VALUE ) ;
+        encoded = t.encode() ;
+        binary = Binary.toAsciiString( encoded ) ;
+        assertEquals( Binary.toAsciiString( Integer.MAX_VALUE ) + 
+                "10000100" +
+                "01111111" +
+                "11111111" +
+                "11111111" +
+                "11111111" +
+                "01111111"
+                , Binary.toAsciiString( encoded ) ) ;
+    }
+
+    public void testEncodePrimitive()
+    {
+        Tuple t = null ;
+        byte[] encoded ;
+        byte[] data ;
+        String binary ;
+        
+        data = new byte[0] ;
+        t = new Tuple( 0, TypeClass.APPLICATION, true, data ) ;
+        encoded = t.encode() ;
+        binary = Binary.toAsciiString( encoded ) ;
+        assertEquals( 
+                "00000000" +
+                "01000000"
+                , Binary.toAsciiString( encoded ) ) ;
+
+        data = new byte[0] ;
+        t = new Tuple( 2, TypeClass.APPLICATION, true, data ) ;
+        encoded = t.encode() ;
+        binary = Binary.toAsciiString( encoded ) ;
+        assertEquals( 
+                "00000000" +
+                "01000010"
+                , Binary.toAsciiString( encoded ) ) ;
+
+        data = new byte[0] ;
+        t = new Tuple( 30, TypeClass.APPLICATION, true, data ) ;
+        encoded = t.encode() ;
+        binary = Binary.toAsciiString( encoded ) ;
+        assertEquals( 
+                "00000000" +
+                "01011110"
+                , Binary.toAsciiString( encoded ) ) ;
+
+        data = new byte[0] ;
+        t = new Tuple( 31, TypeClass.APPLICATION, true, data ) ;
+        encoded = t.encode() ;
+        binary = Binary.toAsciiString( encoded ) ;
+        assertEquals( 
+                "00000000" +
+                "00011111" +
+                "01011111"
+                , Binary.toAsciiString( encoded ) ) ;
+
+        data = new byte[0] ;
+        t = new Tuple( 128, TypeClass.APPLICATION, true, data ) ;
+        encoded = t.encode() ;
+        binary = Binary.toAsciiString( encoded ) ;
+        assertEquals( 
+                "00000000" +
+                "00000001" +
+                "10000000" +
+                "01011111"
+                , Binary.toAsciiString( encoded ) ) ;
+
+        data = new byte[1] ;
+        t = new Tuple( 128, TypeClass.APPLICATION, true, data ) ;
+        encoded = t.encode() ;
+        binary = Binary.toAsciiString( encoded ) ;
+        assertEquals( 
+                "00000000" +
+                "00000001" +
+                "00000001" +
+                "10000000" +
+                "01011111"
+                , Binary.toAsciiString( encoded ) ) ;
+
+        data = new byte[127] ;
+        t = new Tuple( 128, TypeClass.APPLICATION, true, data ) ;
+        encoded = t.encode() ;
+        binary = Binary.toAsciiString( encoded ) ;
+        assertEquals( Binary.toAsciiString( data ) +
+                "01111111" +
+                "00000001" +
+                "10000000" +
+                "01011111"
+                , Binary.toAsciiString( encoded ) ) ;
+
+        data = new byte[128] ;
+        t = new Tuple( 128, TypeClass.APPLICATION, true, data ) ;
+        encoded = t.encode() ;
+        binary = Binary.toAsciiString( encoded ) ;
+        assertEquals( Binary.toAsciiString( data ) +
+                "10000000" +
+                "10000001" +
+                "00000001" +
+                "10000000" +
+                "01011111"
+                , Binary.toAsciiString( encoded ) ) ;
+
+        data = new byte[255] ;
+        t = new Tuple( 128, TypeClass.APPLICATION, true, data ) ;
+        encoded = t.encode() ;
+        binary = Binary.toAsciiString( encoded ) ;
+        assertEquals( Binary.toAsciiString( data ) +
+                "11111111" +
+                "10000001" +
+                "00000001" +
+                "10000000" +
+                "01011111"
+                , Binary.toAsciiString( encoded ) ) ;
+
+        data = new byte[256] ;
+        t = new Tuple( 128, TypeClass.APPLICATION, true, data ) ;
+        encoded = t.encode() ;
+        binary = Binary.toAsciiString( encoded ) ;
+        assertEquals( Binary.toAsciiString( data ) + 
+                "00000001" +
+                "00000000" +
+                "10000010" +
+                "00000001" +
+                "10000000" +
+                "01011111"
+                , Binary.toAsciiString( encoded ) ) ;
+    }
+
+    public void testSetTag()
+    {
+        byte[] bites = new byte[1] ;
+        Tuple t = new Tuple( 0, 0 ) ;
+        t.setTag( bites, 1 ) ;
+        String binary = Binary.toAsciiString( bites ) ;
+        assertEquals( "01100000", binary ) ;
+        
+        bites = new byte[1] ;
+        t = new Tuple( 30, 0 ) ;
+        t.setTag( bites, 1 ) ;
+        binary = Binary.toAsciiString( bites ) ;
+        assertEquals( "01111110", binary ) ;
+
+        bites = new byte[1] ;
+        t = new Tuple( 30, 0 ) ;
+        t.isPrimitive = true ;
+        t.setTag( bites, 1 ) ;
+        binary = Binary.toAsciiString( bites ) ;
+        assertEquals( "01011110", binary ) ;
+
+        bites = new byte[2] ;
+        t = new Tuple( 31, 0 ) ;
+        t.setTag( bites, 2 ) ;
+        binary = Binary.toAsciiString( bites ) ;
+        assertEquals( "00011111" + "01111111", binary ) ;
+
+        bites = new byte[2] ;
+        t = new Tuple( 127, 0 ) ;
+        t.setTag( bites, 2 ) ;
+        binary = Binary.toAsciiString( bites ) ;
+        assertEquals( "01111111" + "01111111", binary ) ;
+
+        bites = new byte[3] ;
+        t = new Tuple( 128, 0 ) ;
+        t.setTag( bites, 3 ) ;
+        binary = Binary.toAsciiString( bites ) ;
+        assertEquals( "00000001" + "10000000" + "01111111", binary ) ;
+
+        bites = new byte[3] ;
+        t = new Tuple( Tuple.BIT_13 - 1, 0 ) ;
+        t.setTag( bites, 3 ) ;
+        binary = Binary.toAsciiString( bites ) ;
+        assertEquals( "01111111" + 
+                      "11111111" + 
+                      "01111111", binary ) ;
+
+        bites = new byte[4] ;
+        t = new Tuple( Tuple.BIT_13, 0 ) ;
+        t.setTag( bites, 4 ) ;
+        binary = Binary.toAsciiString( bites ) ;
+        assertEquals( "00000001" +
+                      "10000000" +
+                      "10000000" + 
+                      "01111111", binary ) ;
+
+        bites = new byte[4] ;
+        t = new Tuple( Tuple.BIT_13 + 1, 0 ) ;
+        t.setTag( bites, 4 ) ;
+        binary = Binary.toAsciiString( bites ) ;
+        assertEquals( "00000001" +
+                      "10000000" +
+                      "10000001" + 
+                      "01111111", binary ) ;
+
+        bites = new byte[4] ;
+        t = new Tuple( Tuple.BIT_20 - 1, 0 ) ;
+        t.setTag( bites, 4 ) ;
+        binary = Binary.toAsciiString( bites ) ;
+        assertEquals( "01111111" + 
+                      "11111111" + 
+                      "11111111" + 
+                      "01111111", binary ) ;
+
+        bites = new byte[5] ;
+        t = new Tuple( Tuple.BIT_20, 0 ) ;
+        t.setTag( bites, 5 ) ;
+        binary = Binary.toAsciiString( bites ) ;
+        assertEquals( "00000001" +
+                      "10000000" +
+                      "10000000" +
+                      "10000000" + 
+                      "01111111", binary ) ;
+
+        bites = new byte[5] ;
+        t = new Tuple( Tuple.BIT_20 + 1, 0 ) ;
+        t.setTag( bites, 5 ) ;
+        binary = Binary.toAsciiString( bites ) ;
+        assertEquals( "00000001" +
+                      "10000000" +
+                      "10000000" +
+                      "10000001" + 
+                      "01111111", binary ) ;
+
+        bites = new byte[5] ;
+        t = new Tuple( Tuple.BIT_27 - 1, 0 ) ;
+        t.setTag( bites, 5 ) ;
+        binary = Binary.toAsciiString( bites ) ;
+        assertEquals( "01111111" + 
+                      "11111111" + 
+                      "11111111" + 
+                      "11111111" + 
+                      "01111111", binary ) ;
+
+        bites = new byte[6] ;
+        t = new Tuple( Tuple.BIT_27, 0 ) ;
+        
+        try
+        {
+            t.setTag( bites, 6 ) ;
+            fail( "should never reach this point due to thrown exception" ) ;
+        }
+        catch( IllegalArgumentException e )
+        {
+            assertNotNull( e ) ;
+        }
+    }
+
+    public void testSetLength()
+    {
+        byte[] bites = new byte[1] ;
+        Tuple t = new Tuple( 0, 0 ) ;
+        t.setLength( bites, 0, 1 ) ;
+        String binary = Binary.toAsciiString( bites ) ;
+        assertEquals( "00000000", binary ) ;
+
+        bites = new byte[1] ;
+        t = new Tuple( 30, 15 ) ;
+        t.setLength( bites, 0, 1 ) ;
+        binary = Binary.toAsciiString( bites ) ;
+        assertEquals( "00001111", binary ) ;
+
+        bites = new byte[1] ;
+        t = new Tuple( 30, 127 ) ;
+        t.setLength( bites, 0, 1 ) ;
+        binary = Binary.toAsciiString( bites ) ;
+        assertEquals( "01111111", binary ) ;
+        
+        bites = new byte[2] ;
+        t = new Tuple( 30, 128 ) ;
+        t.setLength( bites, 0, 2 ) ;
+        binary = Binary.toAsciiString( bites ) ;
+        assertEquals( "10000000" +
+                      "10000001", binary ) ;
+        
+        bites = new byte[2] ;
+        t = new Tuple( 30, 255 ) ;
+        t.setLength( bites, 0, 2 ) ;
+        binary = Binary.toAsciiString( bites ) ;
+        assertEquals( "11111111" +
+                      "10000001", binary ) ;
+        
+        bites = new byte[3] ;
+        t = new Tuple( 30, 256 ) ;
+        t.setLength( bites, 0, 3 ) ;
+        binary = Binary.toAsciiString( bites ) ;
+        assertEquals( "00000001" +
+                      "00000000" +
+                      "10000010", binary ) ;
+        
+        bites = new byte[3] ;
+        t = new Tuple( 30, Tuple.BIT_15 - 1 ) ;
+        t.setLength( bites, 0, 3 ) ;
+        binary = Binary.toAsciiString( bites ) ;
+        assertEquals( "11111111" +
+                      "11111111" +
+                      "10000010", binary ) ;
+        
+        bites = new byte[4] ;
+        t = new Tuple( 30, Tuple.BIT_15 ) ;
+        t.setLength( bites, 0, 4 ) ;
+        binary = Binary.toAsciiString( bites ) ;
+        assertEquals( "00000001" +
+                      "00000000" +
+                      "00000000" +
+                      "10000011", binary ) ;
+        
+        bites = new byte[4] ;
+        t = new Tuple( 30, Tuple.BIT_15 + 1 ) ;
+        t.setLength( bites, 0, 4 ) ;
+        binary = Binary.toAsciiString( bites ) ;
+        assertEquals( "00000001" +
+                      "00000000" +
+                      "00000001" +
+                      "10000011", binary ) ;
+        
+        bites = new byte[4] ;
+        t = new Tuple( 30, Tuple.BIT_23 - 1 ) ;
+        t.setLength( bites, 0, 4 ) ;
+        binary = Binary.toAsciiString( bites ) ;
+        assertEquals( "11111111" +
+                      "11111111" +
+                      "11111111" +
+                      "10000011", binary ) ;
+        
+        bites = new byte[5] ;
+        t = new Tuple( 30, Tuple.BIT_23 ) ;
+        t.setLength( bites, 0, 5 ) ;
+        binary = Binary.toAsciiString( bites ) ;
+        assertEquals( "00000001" +
+                      "00000000" +
+                      "00000000" +
+                      "00000000" +
+                      "10000100", binary ) ;
+        
+        bites = new byte[5] ;
+        t = new Tuple( 30, Tuple.BIT_23 + 1 ) ;
+        t.setLength( bites, 0, 5 ) ;
+        binary = Binary.toAsciiString( bites ) ;
+        assertEquals( "00000001" +
+                      "00000000" +
+                      "00000000" +
+                      "00000001" +
+                      "10000100", binary ) ;
+        
+        bites = new byte[5] ;
+        t = new Tuple( 30, Integer.MAX_VALUE ) ;
+        t.setLength( bites, 0, 5 ) ;
+        t.setLength( bites, 0, 5 ) ;
+        binary = Binary.toAsciiString( bites ) ;
+        assertEquals( Binary.toAsciiString( Integer.MAX_VALUE ) +
+                      "10000100", binary ) ;
+        
+        
+        bites = new byte[6] ;
+        t = new Tuple( 30, Integer.MAX_VALUE + 1 ) ;
+
+        try
+        {
+            t.setLength( bites, 0, 6 ) ;
+            fail( "should never get here due to thrown exception" ) ;
+        }
+        catch( IllegalArgumentException e ) 
+        {
+            assertNotNull( e ) ;
+        }
+    }
+
+    public void testGetTagLength()
+    {
+        Tuple t = new Tuple() ;
+        assertEquals( 1, t.getTagLength() ) ;
+        t.id = 30 ;
+        assertEquals( 1, t.getTagLength() ) ;
+        t.id = 31 ;
+        assertEquals( 2, t.getTagLength() ) ;
+        t.id = 100 ;
+        assertEquals( 2, t.getTagLength() ) ;
+        t.id = 127 ;
+        assertEquals( 2, t.getTagLength() ) ;
+        t.id = 128 ;
+        assertEquals( 3, t.getTagLength() ) ;
+        t.id = 129 ;
+        assertEquals( 3, t.getTagLength() ) ;
+
+        t.id = Tuple.BIT_13 - 1 ;
+        assertEquals( 3, t.getTagLength() ) ;
+        t.id = Tuple.BIT_13 ;
+        assertEquals( 4, t.getTagLength() ) ;
+        t.id = Tuple.BIT_13 + 100 ;
+        assertEquals( 4, t.getTagLength() ) ;
+        
+        t.id = Tuple.BIT_20 - 1 ;
+        assertEquals( 4, t.getTagLength() ) ;
+        t.id = Tuple.BIT_20 ;
+        assertEquals( 5, t.getTagLength() ) ;
+        t.id = Tuple.BIT_20 + 100 ;
+        assertEquals( 5, t.getTagLength() ) ;
+
+        t.id = Tuple.BIT_27 - 1 ;
+        assertEquals( 5, t.getTagLength() ) ;
+
+        t.id = Tuple.BIT_27 ;
+        
+        try
+        {
+            assertEquals( 6, t.getTagLength() ) ;
+            fail( "should throw an exception before getting here" ) ;
+        }
+        catch( IllegalArgumentException e )
+        {
+            assertNotNull( e ) ;
+        }
+    }
+
+    public void testGetLengthLength()
+    {
+        Tuple t = new Tuple() ;
+        assertEquals( 1, t.getLengthLength() ) ;
+        t.length = 127 ;
+        assertEquals( 1, t.getLengthLength() ) ;
+        t.length = 128 ;
+        assertEquals( 2, t.getLengthLength() ) ;
+        t.length = 255 ;
+        assertEquals( 2, t.getLengthLength() ) ;
+        t.length = 256 ;
+        assertEquals( 3, t.getLengthLength() ) ;
+
+        t.length = Tuple.BIT_15 - 1 ;
+        assertEquals( 3, t.getLengthLength() ) ;
+        t.length = Tuple.BIT_15 ;
+        assertEquals( 4, t.getLengthLength() ) ;
+        t.length = Tuple.BIT_15 + 100 ;
+        assertEquals( 4, t.getLengthLength() ) ;
+        
+        t.length = Tuple.BIT_23 - 1 ;
+        assertEquals( 4, t.getLengthLength() ) ;
+        t.length = Tuple.BIT_23 ;
+        assertEquals( 5, t.getLengthLength() ) ;
+        t.length = Tuple.BIT_23 + 100 ;
+        assertEquals( 5, t.getLengthLength() ) ;
+
+        t.length = Integer.MAX_VALUE ;
+        assertEquals( 5, t.getLengthLength() ) ;
+
+        
+        t.length = Integer.MAX_VALUE + 1 ;
+        try
+        {
+            assertEquals( 6, t.getLengthLength() ) ;
+            fail( "should throw an exception before getting here" ) ;
+        }
+        catch( IllegalArgumentException e )
+        {
+            assertNotNull( e ) ;
+        }
+        
+    }
+}

Added: incubator/directory/snickers/trunk/ber/todo.txt
==============================================================================
--- (empty file)
+++ incubator/directory/snickers/trunk/ber/todo.txt	Thu Mar 11 15:12:11 2004
@@ -0,0 +1,52 @@
+
+
+                                T O D O   L I S T 
+                                =================
+
+* Try to the best of our ability to write sophisticated unit tests to test 
+  every aspect of the decoder using these new overloads.
+  
+* Create a TupleNode interface to nest TLV's to easily generate constructed
+  TLV's.
+
+* Write a TupleNode tree generator that implements the decoder callback.  This
+  is where the DOM like functionality comes in.  We want tuple node 
+  implementations to be able to be TreeNode implementors as well for display.
+  
+* Might want to build a utility for capturing, displaying and generating test
+  cases for TLV structures.  Might also be used to stress test the parser.  This
+  little peices of code will be in use more than 30% of the time.  It might be
+  worth taking the time to make it air tight.
+
+* For the mock decoder in Eve see if we can rig in a decoder that builds on this
+  BERDecoder that can at a bare minimum detect when an LDAP message starts and 
+  ends.  This way we can continue working on Eve while the snickers code 
+  progresses forward.  In fact we could even capture a full buffer and feed it
+  to the old synchronous SNACC provider just for now to get decodes working.
+
+--o--
+
+* Add a value size protection feature to the decoder to either break up 
+  incomming massive tlv's into smaller tlv's or to stream them to disk, 
+  and providing a data reference rather than a byte[] to the callback's 
+  decodeOccurred method.  This will be huge for both performance and the
+  prevention of denial of service attacks where massive TLV's bombard the
+  decoder.  We need to look at the big picture to figure out which approach
+  is best within the whole decoding processs.
+
+--o--
+
+* Build a library of primitive ASN.1 data types mapping them to Java types.
+
+* Build a digester like tool on top of the BERDecoder, for now we'll call it a
+  TLVDecoder.  It is fed a train of TLV's and it statefully constructs ASN.1
+  stubs based on the input.  When an entire stub has been assembled it is 
+  emitted via the decodeOccurred callback.
+  
+* It will be worth while taking a good look at the way digester works to get 
+  some ideas here.
+  
+* Also we need to need the Sample Neufeld papper to make sure we're decoding
+  appropriately.
+  
+  
\ No newline at end of file

Modified: incubator/directory/snickers/trunk/project.xml
==============================================================================
--- incubator/directory/snickers/trunk/project.xml	(original)
+++ incubator/directory/snickers/trunk/project.xml	Thu Mar 11 15:12:11 2004
@@ -206,6 +206,7 @@
     	<report>maven-license-plugin</report>
         <!-- report>maven-changelog-plugin</report -->
         <report>maven-javadoc-plugin</report>
+        <report>maven-clover-plugin</report>
     	<report>maven-tasklist-plugin</report>
     </reports>
 </project>

Mime
View raw message