directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r165064 - /directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/spnego/codec/grammars/SpnegoGrammar.java
Date Wed, 27 Apr 2005 23:05:56 GMT
Author: elecharny
Date: Wed Apr 27 16:05:56 2005
New Revision: 165064

URL: http://svn.apache.org/viewcvs?rev=165064&view=rev
Log:
The first working spnego decoder... This will just allow the junit test to pass, but all actions
are empty.

Modified:
    directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/spnego/codec/grammars/SpnegoGrammar.java

Modified: directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/spnego/codec/grammars/SpnegoGrammar.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/spnego/codec/grammars/SpnegoGrammar.java?rev=165064&r1=165063&r2=165064&view=diff
==============================================================================
--- directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/spnego/codec/grammars/SpnegoGrammar.java
(original)
+++ directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/spnego/codec/grammars/SpnegoGrammar.java
Wed Apr 27 16:05:56 2005
@@ -52,156 +52,292 @@
     /** The instance of grammar. LdapMessageGrammar is a singleton */
     private static IGrammar instance = new SpnegoGrammar();
 
-    /**
-     * Get the instance of this grammar
-     *
-     * @return An instance on the LdapMessage Grammar
-     */
-    public static IGrammar getInstance()
-    {
-        return instance;
-    }
-    
     //~ Constructors -------------------------------------------------------------------------------
+
     /**
      * Creates a new LdapMessageGrammar object.
      */
     private SpnegoGrammar()
     {
 
-        name = SpnegoGrammar.class.getName();
+        name       = SpnegoGrammar.class.getName();
 
         statesEnum = SpnegoStatesEnum.getInstance();
 
-        // We have 
+        // We have
         super.transitions = new GrammarTransition[SpnegoStatesEnum.LAST_SPNEGO_STATE][256];
 
         //============================================================================================
-        // SPNEGO 
+        // SPNEGO
         //============================================================================================
         // SPNEGO --> CHOICE {
         //      negTokenInit  [0]  NegTokenInit, (Tag)
         // We have a negTokenInit, and the tag must be 0xA0
-        super.transitions[SpnegoStatesEnum.SPNEGO_NEG_TOKEN_INIT_TAG][0xA0] = new GrammarTransition(
SpnegoStatesEnum.SPNEGO_NEG_TOKEN_INIT_TAG,
-                SpnegoStatesEnum.SPNEGO_NEG_TOKEN_INIT_LENGTH, new GrammarAction( "Spnego
neg token init tag" )
+        super.transitions[SpnegoStatesEnum.SPNEGO_NEG_TOKEN_INIT_TAG][0xA0] =
+            new GrammarTransition( SpnegoStatesEnum.SPNEGO_NEG_TOKEN_INIT_TAG,
+                SpnegoStatesEnum.SPNEGO_NEG_TOKEN_INIT_LENGTH,
+                new GrammarAction( "Spnego neg token init tag" )
                 {
                     public void action( IAsn1Container container ) throws DecoderException
                     {
-                    	try {
-	                    	SpnegoContainer spnegoContainer = (SpnegoContainer)container;
-	
-	                        // First, create a empty Spnego POJO
-	                    	SpnegoPOJO spnegoPOJO = ( SpnegoNegTokenInitPOJO) spnegoContainer.getPoolManager().allocate(SpnegoPoolEnum.SPNEGO_NEG_TOKEN_INIT_POJO_POOL);
-	
-	                        // Then stores it into the container
-	                    	spnegoContainer.setSpnego(spnegoPOJO);
-	                        
-	                        return;
-	                    }
-	                    catch ( PoolException pe )
-	                    {
-	                        throw new DecoderException(
-	                            "Cannot allocate a spnego Pojo : " + pe.getMessage() );
-	                    }
+
+                        try
+                        {
+
+                            SpnegoContainer spnegoContainer = ( SpnegoContainer ) container;
+
+                            // First, create a empty Spnego POJO
+                            SpnegoPOJO spnegoPOJO = ( SpnegoNegTokenInitPOJO )
+                                spnegoContainer.getPoolManager().allocate(
+                                    SpnegoPoolEnum.SPNEGO_NEG_TOKEN_INIT_POJO_POOL );
+
+                            // Then stores it into the container
+                            spnegoContainer.setSpnego( spnegoPOJO );
+
+                            return;
+                        }
+                        catch ( PoolException pe )
+                        {
+                            throw new DecoderException(
+                                "Cannot allocate a spnego Pojo : " + pe.getMessage() );
+                        }
                     }
                 } );
 
-        // SPNEGO --> CHOICE { ... 
+        // SPNEGO --> CHOICE { ...
         //      negTokenInit  [0]  NegTokenInit, (Length)
         // We have a negTokenInit, and the tag must be 0xA0
         // Ok, get the negTokenInit length
-        super.transitions[SpnegoStatesEnum.SPNEGO_NEG_TOKEN_INIT_LENGTH][0xA0] = new GrammarTransition(
SpnegoStatesEnum.SPNEGO_NEG_TOKEN_INIT_LENGTH,
-                SpnegoStatesEnum.SPNEGO_NEG_TOKEN_INIT_VALUE, new GrammarAction( "Spnego
neg token init Length" )
+        super.transitions[SpnegoStatesEnum.SPNEGO_NEG_TOKEN_INIT_LENGTH][0xA0] =
+            new GrammarTransition( SpnegoStatesEnum.SPNEGO_NEG_TOKEN_INIT_LENGTH,
+                SpnegoStatesEnum.SPNEGO_NEG_TOKEN_INIT_VALUE,
+                new GrammarAction( "Spnego neg token init Length" )
                 {
                     public void action( IAsn1Container container ) throws DecoderException
                     {
-                    	// We have to store the expected Length of the PDU
-                        SpnegoContainer spnegoContainer = (SpnegoContainer)container;
-                        SpnegoPOJO spnego = spnegoContainer.getSpnego();
 
-                        spnego.setExpectedLength(spnegoContainer.getCurrentTLV().getLength().getLength());
-                        spnego.setCurrentLength(0);
+                        // We have to store the expected Length of the PDU
+                        SpnegoContainer spnegoContainer = ( SpnegoContainer ) container;
+                        SpnegoPOJO      spnego          = spnegoContainer.getSpnego();
+
+                        spnego.setExpectedLength( spnegoContainer.getCurrentTLV().getLength()
+                            .getLength() );
+                        spnego.setCurrentLength( 0 );
 
-                    	return;
+                        return;
                     }
                 } );
-        
-        // SPNEGO --> CHOICE { ... 
+
+        // SPNEGO --> CHOICE { ...
         //      negTokenInit  [0]  NegTokenInit, (Value)
         // We will have a SEQUENCE. There is no value, so this is just a phantom transition.
-        super.transitions[SpnegoStatesEnum.SPNEGO_NEG_TOKEN_INIT_VALUE][0xA0] = new GrammarTransition(
SpnegoStatesEnum.SPNEGO_NEG_TOKEN_INIT_VALUE, SpnegoStatesEnum.SPNEGO_NEG_TOKEN_INIT_SEQUENCE_TAG,
null);
+        super.transitions[SpnegoStatesEnum.SPNEGO_NEG_TOKEN_INIT_VALUE][0xA0] =
+            new GrammarTransition( SpnegoStatesEnum.SPNEGO_NEG_TOKEN_INIT_VALUE,
+                SpnegoStatesEnum.SPNEGO_NEG_TOKEN_INIT_SEQUENCE_TAG, null );
 
         // NegTokenInit ::= SEQUENCE { (Tag)
         // Nothing to do, but setting the parent link.
-        super.transitions[SpnegoStatesEnum.SPNEGO_NEG_TOKEN_INIT_SEQUENCE_TAG][0x30] = new
GrammarTransition( SpnegoStatesEnum.SPNEGO_NEG_TOKEN_INIT_SEQUENCE_TAG, SpnegoStatesEnum.SPNEGO_NEG_TOKEN_INIT_SEQUENCE_LENGTH,
null);
+        super.transitions[SpnegoStatesEnum.SPNEGO_NEG_TOKEN_INIT_SEQUENCE_TAG][0x30] =
+            new GrammarTransition( SpnegoStatesEnum.SPNEGO_NEG_TOKEN_INIT_SEQUENCE_TAG,
+                SpnegoStatesEnum.SPNEGO_NEG_TOKEN_INIT_SEQUENCE_LENGTH, null );
 
         // NegTokenInit ::= SEQUENCE { (Length)
         // We have to check the length
-        super.transitions[SpnegoStatesEnum.SPNEGO_NEG_TOKEN_INIT_SEQUENCE_LENGTH][0x30] =
new GrammarTransition( SpnegoStatesEnum.SPNEGO_NEG_TOKEN_INIT_SEQUENCE_LENGTH,
-                SpnegoStatesEnum.SPNEGO_NEG_TOKEN_INIT_SEQUENCE_VALUE, new GrammarAction(
"Spnego neg token init sequence Length" )
+        super.transitions[SpnegoStatesEnum.SPNEGO_NEG_TOKEN_INIT_SEQUENCE_LENGTH][0x30] =
+            new GrammarTransition( SpnegoStatesEnum.SPNEGO_NEG_TOKEN_INIT_SEQUENCE_LENGTH,
+                SpnegoStatesEnum.SPNEGO_NEG_TOKEN_INIT_SEQUENCE_VALUE,
+                new GrammarAction( "Spnego neg token init sequence Length" )
                 {
                     public void action( IAsn1Container container ) throws DecoderException
                     {
-                    	// We have to store the expected Length of the PDU
-                        SpnegoContainer spnegoContainer = (SpnegoContainer)container;
-                        SpnegoPOJO spnego = spnegoContainer.getSpnego();
-                        checkLength(spnego, spnegoContainer.getCurrentTLV());
-                    	return;
+
+                        // We have to store the expected Length of the PDU
+                        SpnegoContainer spnegoContainer = ( SpnegoContainer ) container;
+                        SpnegoPOJO      spnego          = spnegoContainer.getSpnego();
+                        checkLength( spnego, spnegoContainer.getCurrentTLV() );
+                        return;
                     }
                 } );
-        
+
         // NegTokenInit ::= SEQUENCE { (Value)
         //    mechTypes     [0]  MechTypeList  OPTIONAL,
         //    reqFlags      [1]  ContextFlags  OPTIONAL,
         //    mechToken     [2]  OCTET STRING  OPTIONAL,
-        //    mechListMIC   [3]  OCTET STRING  OPTIONAL } (Length)
-        // The next token will be either 0xA0, 0xA1, 0xA2 or 0xA3, depending on the
+        //    mechListMIC   [3]  OCTET STRING  OPTIONAL }
+        // The next token will be either 0xA0, 0xA1, 0xA2, 0xA3 or the grammar end, depending
on the
         // element : mechType, reqFlages, mechToken or mechListMIC.
         // This transition does nothing.
-        super.transitions[SpnegoStatesEnum.SPNEGO_NEG_TOKEN_INIT_SEQUENCE_VALUE][0x30] =
new GrammarTransition( SpnegoStatesEnum.SPNEGO_NEG_TOKEN_INIT_SEQUENCE_VALUE, SpnegoStatesEnum.SPNEGO_NEG_TOKEN_INIT_SEQUENCE_VALUE_TAG,
null);
+        super.transitions[SpnegoStatesEnum.SPNEGO_NEG_TOKEN_INIT_SEQUENCE_VALUE][0x30] =
+            new GrammarTransition( SpnegoStatesEnum.SPNEGO_NEG_TOKEN_INIT_SEQUENCE_VALUE,
+                SpnegoStatesEnum.SPNEGO_NEG_TOKEN_INIT_SEQUENCE_FOLLOWING_TAG, null );
+
+        // NegTokenInit ::= SEQUENCE {
+        //    mechTypes     [0]  MechTypeList  OPTIONAL, (Tag)
+        //    ...
+        // We have a 0xA0 tag, so this is a mechTypes. We have to check the length
+        super.transitions[SpnegoStatesEnum.SPNEGO_NEG_TOKEN_INIT_SEQUENCE_FOLLOWING_TAG][0xA0]
=
+            new GrammarTransition( SpnegoStatesEnum.SPNEGO_NEG_TOKEN_INIT_SEQUENCE_FOLLOWING_TAG,
+                SpnegoStatesEnum.SPNEGO_MECH_TYPES_LENGTH, null );
 
         // NegTokenInit ::= SEQUENCE {
         //    mechTypes     [0]  MechTypeList  OPTIONAL, (Length)
         //    ...
-        super.transitions[SpnegoStatesEnum.SPNEGO_NEG_TOKEN_INIT_SEQUENCE_VALUE_TAG][0xA0]
= new GrammarTransition( SpnegoStatesEnum.SPNEGO_NEG_TOKEN_INIT_SEQUENCE_VALUE_TAG, SpnegoStatesEnum.SPNEGO_MECH_TYPES_LENGTH,
null);
+        // MechTypeList ::= SEQUENCE OF MechType 
+        // The value part. As it is a SEQUENCE, we have to allocate a list
+        // in the Spnego object
+        super.transitions[SpnegoStatesEnum.SPNEGO_MECH_TYPES_LENGTH][0xA0] =
+            new GrammarTransition( SpnegoStatesEnum.SPNEGO_MECH_TYPES_LENGTH,
+                SpnegoStatesEnum.SPNEGO_MECH_TYPES_VALUE, null );
 
         // NegTokenInit ::= SEQUENCE {
         //    mechTypes     [0]  MechTypeList  OPTIONAL, (Value)
         //    ...
-        super.transitions[SpnegoStatesEnum.SPNEGO_MECH_TYPES_LENGTH][0xA0] = new GrammarTransition(
SpnegoStatesEnum.SPNEGO_MECH_TYPES_LENGTH, SpnegoStatesEnum.SPNEGO_MECH_TYPES_VALUE, null);
+        // We have nothing to do.
+        super.transitions[SpnegoStatesEnum.SPNEGO_MECH_TYPES_VALUE][0xA0]       = new GrammarTransition(
+                SpnegoStatesEnum.SPNEGO_MECH_TYPES_VALUE,
+                SpnegoStatesEnum.SPNEGO_MECH_TYPES_LIST_TAG, null );
+
+        // MechTypeList ::= SEQUENCE OF MechType (Tag) 
+        super.transitions[SpnegoStatesEnum.SPNEGO_MECH_TYPES_LIST_TAG][0x30] =
+            new GrammarTransition( SpnegoStatesEnum.SPNEGO_MECH_TYPES_LIST_TAG,
+                SpnegoStatesEnum.SPNEGO_MECH_TYPES_LIST_LENGTH, null );
+
+        // MechTypeList ::= SEQUENCE OF MechType (Length) 
+        super.transitions[SpnegoStatesEnum.SPNEGO_MECH_TYPES_LIST_LENGTH][0x30] =
+            new GrammarTransition( SpnegoStatesEnum.SPNEGO_MECH_TYPES_LIST_LENGTH,
+                SpnegoStatesEnum.SPNEGO_MECH_TYPES_LIST_VALUE, null );
+
+        // MechTypeList ::= SEQUENCE OF MechType (Value) 
+        // As it is a SEQUENCE, we have to allocate a list
+        // in the Spnego object
+        super.transitions[SpnegoStatesEnum.SPNEGO_MECH_TYPES_LIST_VALUE][0x30] =
+            new GrammarTransition( SpnegoStatesEnum.SPNEGO_MECH_TYPES_LIST_VALUE,
+                SpnegoStatesEnum.SPNEGO_MECH_TYPE_TAG, null );
+
+        // MechType ::= OBJECT IDENTIFIER (Tag) 
+        super.transitions[SpnegoStatesEnum.SPNEGO_MECH_TYPE_TAG][0x06]    = new GrammarTransition(
+                SpnegoStatesEnum.SPNEGO_MECH_TYPE_TAG, SpnegoStatesEnum.SPNEGO_MECH_TYPE_LENGTH,
+                null );
+
+        // MechType ::= OBJECT IDENTIFIER (Length) 
+        super.transitions[SpnegoStatesEnum.SPNEGO_MECH_TYPE_LENGTH][0x06] = new GrammarTransition(
+                SpnegoStatesEnum.SPNEGO_MECH_TYPE_LENGTH, SpnegoStatesEnum.SPNEGO_MECH_TYPE_VALUE,
+                null );
+
+        // MechType ::= OBJECT IDENTIFIER (Value) 
+        super.transitions[SpnegoStatesEnum.SPNEGO_MECH_TYPE_VALUE][0x06]  = new GrammarTransition(
+                SpnegoStatesEnum.SPNEGO_MECH_TYPE_VALUE,
+                SpnegoStatesEnum.SPNEGO_MECH_TYPE_FOLLOWING_TAG, null );
+
+        // MechType ::= OBJECT IDENTIFIER (Tag) 
+        super.transitions[SpnegoStatesEnum.SPNEGO_MECH_TYPE_FOLLOWING_TAG][0x06]    = new
GrammarTransition(
+                SpnegoStatesEnum.SPNEGO_MECH_TYPE_FOLLOWING_TAG, SpnegoStatesEnum.SPNEGO_MECH_TYPE_LENGTH,
+                null );
 
-        super.transitions[SpnegoStatesEnum.SPNEGO_MECH_TYPES_VALUE][0xA0] = new GrammarTransition(
SpnegoStatesEnum.SPNEGO_MECH_TYPES_VALUE, SpnegoStatesEnum.SPNEGO_MECH_TYPES_LIST_TAG, null);
+        // NegTokenInit ::= SEQUENCE {
+        //    ...
+        //    reqFlags      [1]  ContextFlags  OPTIONAL, (Tag)
+        //    ...
+        // Here, we have to switch to the Length transition of a reqFlags state
+        super.transitions[SpnegoStatesEnum.SPNEGO_MECH_TYPE_FOLLOWING_TAG][0xA1] =
+            new GrammarTransition( SpnegoStatesEnum.SPNEGO_MECH_TYPE_FOLLOWING_TAG,
+                SpnegoStatesEnum.SPNEGO_REQ_FLAGS_LENGTH, null );
+
+        // NegTokenInit ::= SEQUENCE {
+        //    ...
+        //    reqFlags      [1]  ContextFlags  OPTIONAL, (Tag)
+        //    ...
+        super.transitions[SpnegoStatesEnum.SPNEGO_NEG_TOKEN_INIT_SEQUENCE_FOLLOWING_TAG][0xA1]
=
+            new GrammarTransition( SpnegoStatesEnum.SPNEGO_NEG_TOKEN_INIT_SEQUENCE_FOLLOWING_TAG,
+                SpnegoStatesEnum.SPNEGO_REQ_FLAGS_LENGTH, null );
 
-        super.transitions[SpnegoStatesEnum.SPNEGO_MECH_TYPES_LIST_TAG][0x30] = new GrammarTransition(
SpnegoStatesEnum.SPNEGO_MECH_TYPES_LIST_TAG, SpnegoStatesEnum.SPNEGO_MECH_TYPES_LIST_LENGTH,
null);
-        
-        super.transitions[SpnegoStatesEnum.SPNEGO_MECH_TYPES_LIST_LENGTH][0x30] = new GrammarTransition(
SpnegoStatesEnum.SPNEGO_MECH_TYPES_LIST_LENGTH, SpnegoStatesEnum.SPNEGO_MECH_TYPES_LIST_VALUE,
null);
-        
-        super.transitions[SpnegoStatesEnum.SPNEGO_MECH_TYPES_LIST_VALUE][0x30] = new GrammarTransition(
SpnegoStatesEnum.SPNEGO_MECH_TYPES_LIST_VALUE, SpnegoStatesEnum.SPNEGO_MECH_TYPE_TAG, null);
-        
-        super.transitions[SpnegoStatesEnum.SPNEGO_MECH_TYPE_TAG][0x06] = new GrammarTransition(
SpnegoStatesEnum.SPNEGO_MECH_TYPE_TAG, SpnegoStatesEnum.SPNEGO_MECH_TYPE_TAG, null);
-        
-        super.transitions[SpnegoStatesEnum.SPNEGO_MECH_TYPE_LENGTH][0x06] = new GrammarTransition(
SpnegoStatesEnum.SPNEGO_MECH_TYPE_LENGTH, SpnegoStatesEnum.SPNEGO_MECH_TYPE_VALUE, null);
-
-        super.transitions[SpnegoStatesEnum.SPNEGO_MECH_TYPE_VALUE][0x06] = new GrammarTransition(
SpnegoStatesEnum.SPNEGO_MECH_TYPE_VALUE, SpnegoStatesEnum.SPNEGO_MECH_TYPE_FOLLOW_TAG, null);
-
-        
-        
-        
         // NegTokenInit ::= SEQUENCE {
         //    ...
         //    reqFlags      [1]  ContextFlags  OPTIONAL, (Length)
         //    ...
-        super.transitions[SpnegoStatesEnum.SPNEGO_NEG_TOKEN_INIT_SEQUENCE_VALUE_TAG][0xA1]
= new GrammarTransition( SpnegoStatesEnum.SPNEGO_NEG_TOKEN_INIT_SEQUENCE_VALUE_TAG, SpnegoStatesEnum.SPNEGO_REQ_FLAGS_LENGTH,
null);
+        super.transitions[SpnegoStatesEnum.SPNEGO_REQ_FLAGS_LENGTH][0x03] = new GrammarTransition(
+                SpnegoStatesEnum.SPNEGO_REQ_FLAGS_LENGTH, SpnegoStatesEnum.SPNEGO_REQ_FLAGS_VALUE,
+                null );
 
         // NegTokenInit ::= SEQUENCE {
         //    ...
-        //    mechToken     [2]  OCTET STRING  OPTIONAL, (Length)
+        //    reqFlags      [1]  ContextFlags  OPTIONAL, (Value)
         //    ...
-        super.transitions[SpnegoStatesEnum.SPNEGO_NEG_TOKEN_INIT_SEQUENCE_VALUE_TAG][0xA2]
= new GrammarTransition( SpnegoStatesEnum.SPNEGO_NEG_TOKEN_INIT_SEQUENCE_VALUE_TAG, SpnegoStatesEnum.SPNEGO_MECH_TOKEN_LENGTH,
null);
+        // The next state will be the MechToken following
+        super.transitions[SpnegoStatesEnum.SPNEGO_REQ_FLAGS_VALUE][0x03] = new GrammarTransition(
+                SpnegoStatesEnum.SPNEGO_REQ_FLAGS_VALUE, SpnegoStatesEnum.SPNEGO_REQ_FLAGS_FOLLOWING_TAG,
+                null );
+
+        // NegTokenInit ::= SEQUENCE { (Length)
+        //    ...
+        //    mechToken     [2]  OCTET STRING  OPTIONAL,
+        //    ...
+        super.transitions[SpnegoStatesEnum.SPNEGO_REQ_FLAGS_FOLLOWING_TAG][0xA2] =
+            new GrammarTransition( SpnegoStatesEnum.SPNEGO_REQ_FLAGS_FOLLOWING_TAG,
+                SpnegoStatesEnum.SPNEGO_MECH_TOKEN_LENGTH, null );
+
+        // NegTokenInit ::= SEQUENCE {
+        //    ...
+        //    mechToken     [2]  OCTET STRING  OPTIONAL,
+        //    ...
+        super.transitions[SpnegoStatesEnum.SPNEGO_MECH_TYPE_FOLLOWING_TAG][0xA2] =
+            new GrammarTransition( SpnegoStatesEnum.SPNEGO_MECH_TYPE_FOLLOWING_TAG,
+                SpnegoStatesEnum.SPNEGO_MECH_TOKEN_LENGTH, null );
+
+        // NegTokenInit ::= SEQUENCE { (Length)
+        //    ...
+        //    mechToken     [2]  OCTET STRING  OPTIONAL,
+        //    ...
+        super.transitions[SpnegoStatesEnum.SPNEGO_NEG_TOKEN_INIT_SEQUENCE_FOLLOWING_TAG][0xA2]
=
+            new GrammarTransition( SpnegoStatesEnum.SPNEGO_NEG_TOKEN_INIT_SEQUENCE_FOLLOWING_TAG,
+                SpnegoStatesEnum.SPNEGO_MECH_TOKEN_LENGTH, null );
+
+        // NegTokenInit ::= SEQUENCE { (Value)
+        //    ...
+        //    mechToken     [2]  OCTET STRING  OPTIONAL,
+        //    ...
+        super.transitions[SpnegoStatesEnum.SPNEGO_MECH_TOKEN_LENGTH][0xA2] =
+            new GrammarTransition( SpnegoStatesEnum.SPNEGO_MECH_TOKEN_LENGTH,
+                SpnegoStatesEnum.SPNEGO_MECH_TOKEN_VALUE, null );
+
+        // mechToken     [2]  OCTET STRING  OPTIONAL, (Tag)
+        super.transitions[SpnegoStatesEnum.SPNEGO_MECH_TOKEN_VALUE][0xA2]    = new GrammarTransition(
+                SpnegoStatesEnum.SPNEGO_MECH_TOKEN_VALUE, SpnegoStatesEnum.SPNEGO_MECH_TOKEN_OCTET_STRING_TAG,
+                null );
+
+        // mechToken     [2]  OCTET STRING  OPTIONAL, (Tag)
+        super.transitions[SpnegoStatesEnum.SPNEGO_MECH_TOKEN_OCTET_STRING_TAG][0x04] = new
GrammarTransition(
+                SpnegoStatesEnum.SPNEGO_MECH_TOKEN_OCTET_STRING_TAG, SpnegoStatesEnum.SPNEGO_MECH_TOKEN_OCTET_STRING_LENGTH,
+                null );
+
+        // mechToken     [2]  OCTET STRING  OPTIONAL, (Length)
+        super.transitions[SpnegoStatesEnum.SPNEGO_MECH_TOKEN_OCTET_STRING_LENGTH][0x04] =
new GrammarTransition(
+                SpnegoStatesEnum.SPNEGO_MECH_TOKEN_OCTET_STRING_LENGTH, SpnegoStatesEnum.SPNEGO_MECH_TOKEN_OCTET_STRING_VALUE,
+                null );
+
+        // mechToken     [2]  OCTET STRING  OPTIONAL, (Value)
+        super.transitions[SpnegoStatesEnum.SPNEGO_MECH_TOKEN_OCTET_STRING_VALUE][0x04]  =
new GrammarTransition(
+                SpnegoStatesEnum.SPNEGO_MECH_TOKEN_OCTET_STRING_VALUE,
+                -1, null );
+
 
         // NegTokenInit ::= SEQUENCE {
         //    ...
         //    mechListMIC   [3]  OCTET STRING  OPTIONAL } (Length)
-        super.transitions[SpnegoStatesEnum.SPNEGO_NEG_TOKEN_INIT_SEQUENCE_VALUE_TAG][0xA3]
= new GrammarTransition( SpnegoStatesEnum.SPNEGO_NEG_TOKEN_INIT_SEQUENCE_VALUE_TAG, SpnegoStatesEnum.SPNEGO_MECH_LIST_MIC_LENGTH,
null);
+        super.transitions[SpnegoStatesEnum.SPNEGO_NEG_TOKEN_INIT_SEQUENCE_FOLLOWING_TAG][0xA3]
=
+            new GrammarTransition( SpnegoStatesEnum.SPNEGO_NEG_TOKEN_INIT_SEQUENCE_FOLLOWING_TAG,
+                SpnegoStatesEnum.SPNEGO_MECH_LIST_MIC_LENGTH, null );
+    }
+
+    //~ Methods ------------------------------------------------------------------------------------
+
+    /**
+     * Get the instance of this grammar
+     *
+     * @return An instance on the LdapMessage Grammar
+     */
+    public static IGrammar getInstance()
+    {
+        return instance;
     }
 }



Mime
View raw message