directory-commits mailing list archives

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

URL: http://svn.apache.org/viewcvs?rev=165063&view=rev
Log:
Added some states, but still more to add.

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

Modified: directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/spnego/codec/grammars/SpnegoStatesEnum.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/spnego/codec/grammars/SpnegoStatesEnum.java?rev=165063&r1=165062&r2=165063&view=diff
==============================================================================
--- directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/spnego/codec/grammars/SpnegoStatesEnum.java
(original)
+++ directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/spnego/codec/grammars/SpnegoStatesEnum.java
Wed Apr 27 16:05:00 2005
@@ -18,14 +18,25 @@
 
 import org.apache.asn1.ber.grammar.IStates;
 
+
 /**
+ * DOCUMENT ME!
+ * 
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class SpnegoStatesEnum implements IStates {
-    // LdapMessage ------------------------------------------------------------
+public class SpnegoStatesEnum implements IStates
+{
+    // SPNEGO ------------------------------------------------------------
+
+    //~ Static fields/initializers -----------------------------------------------------------------
+
     /** Initiate the counter to 0 */
     private static final int SPNEGO_START_STATE = 0;
 
+    //====================================================================
+    // NegTokenInit state
+    //====================================================================
     /** SPNEGO neg token init Tag */
     public static final int SPNEGO_NEG_TOKEN_INIT_TAG = 0;
 
@@ -34,7 +45,10 @@
 
     /** SPNEGO neg token init Value */
     public static final int SPNEGO_NEG_TOKEN_INIT_VALUE = 2;
-    
+
+    //--------------------------------------------------------------------
+    // negTokenInit state (the SEQUENCE)
+    //--------------------------------------------------------------------
     /** SPNEGO neg token init SEQUENCE Tag */
     public static final int SPNEGO_NEG_TOKEN_INIT_SEQUENCE_TAG = 3;
 
@@ -43,54 +57,127 @@
 
     /** SPNEGO neg token init SEQUENCE Value */
     public static final int SPNEGO_NEG_TOKEN_INIT_SEQUENCE_VALUE = 5;
-    
+
+    //--------------------------------------------------------------------
+    // As the next element is optional, we need to use a special
+    // transition to fork to the good state
+    //--------------------------------------------------------------------
     /** SPNEGO neg token init SEQUENCE Value next tag */
-    public static final int SPNEGO_NEG_TOKEN_INIT_SEQUENCE_VALUE_TAG = 6;
-    
+    public static final int SPNEGO_NEG_TOKEN_INIT_SEQUENCE_FOLLOWING_TAG = 6;
+
+    //--------------------------------------------------------------------
+    // MechTypes state
+    //--------------------------------------------------------------------
     /** SPNEGO mech types length */
     public static final int SPNEGO_MECH_TYPES_LENGTH = 7;
-    
+
     /** SPNEGO mech types value */
     public static final int SPNEGO_MECH_TYPES_VALUE = 8;
-    
+
+    //--------------------------------------------------------------------
+    // MechTypes List state
+    //--------------------------------------------------------------------
     /** SPNEGO mech types list tag */
     public static final int SPNEGO_MECH_TYPES_LIST_TAG = 9;
-    
+
     /** SPNEGO mech types list length */
     public static final int SPNEGO_MECH_TYPES_LIST_LENGTH = 10;
-    
+
     /** SPNEGO mech types list value */
     public static final int SPNEGO_MECH_TYPES_LIST_VALUE = 11;
-    
+
+    //--------------------------------------------------------------------
+    // MechType state
+    //--------------------------------------------------------------------
     /** SPNEGO mech type tag */
     public static final int SPNEGO_MECH_TYPE_TAG = 12;
-    
+
     /** SPNEGO mech type length */
     public static final int SPNEGO_MECH_TYPE_LENGTH = 13;
-    
+
     /** SPNEGO mech type value */
     public static final int SPNEGO_MECH_TYPE_VALUE = 14;
-    
+
+    //--------------------------------------------------------------------
+    // The next tag could be either
+    // - a mech type
+    // - a reqFlags
+    // - a mechToken
+    // - a mechListMIC
+    // - the end of the grammar
+    //--------------------------------------------------------------------
     /** SPNEGO mech type following tag */
-    public static final int SPNEGO_MECH_TYPE_FOLLOW_TAG = 15;
-    
-    
-    
-    
-
-    /** SPNEGO req flags tag */
-    public static final int SPNEGO_REQ_FLAGS_TAG = 9;
-    
-    /** SPNEGO req flags length */
-    public static final int SPNEGO_REQ_FLAGS_LENGTH = 10;
-    
+    public static final int SPNEGO_MECH_TYPE_FOLLOWING_TAG = 15;
+
+    //--------------------------------------------------------------------
+    // reqFlags state
+    //--------------------------------------------------------------------
+    /** SPNEGO mech types length */
+    public static final int SPNEGO_REQ_FLAGS_LENGTH = 16;
+
+    /** SPNEGO mech types value */
+    public static final int SPNEGO_REQ_FLAGS_VALUE = 17;
+
+    /** SPNEGO mech types length */
+    public static final int SPNEGO_REQ_FLAGS_BIT_STRING_TAG = 18;
+
+    /** SPNEGO mech types value */
+    public static final int SPNEGO_REQ_FLAGS_BIT_STRING_LENGTH = 19;
 
+    /** SPNEGO mech types value */
+    public static final int SPNEGO_REQ_FLAGS_BIT_STRING_VALUE = 20;
+
+    //--------------------------------------------------------------------
+    // The next tag could be either
+    // - a mechToken
+    // - a mechListMIC
+    // - the end of the grammar
+    //--------------------------------------------------------------------
+    /** SPNEGO req flags following tag */
+    public static final int SPNEGO_REQ_FLAGS_FOLLOWING_TAG = 21;
+
+    //--------------------------------------------------------------------
+    // mechToken state
+    //--------------------------------------------------------------------
     /** SPNEGO mech token length */
-    public static final int SPNEGO_MECH_TOKEN_LENGTH = 7;
+    public static final int SPNEGO_MECH_TOKEN_LENGTH = 22;
+
+    /** SPNEGO mech token value */
+    public static final int SPNEGO_MECH_TOKEN_VALUE = 23;
+
+    /** SPNEGO mech token length */
+    public static final int SPNEGO_MECH_TOKEN_OCTET_STRING_TAG = 24;
+
+    /** SPNEGO mech token length */
+    public static final int SPNEGO_MECH_TOKEN_OCTET_STRING_LENGTH = 25;
+
+    /** SPNEGO mech token value */
+    public static final int SPNEGO_MECH_TOKEN_OCTET_STRING_VALUE = 26;
+
+    //--------------------------------------------------------------------
+    // mechListMIC state
+    //--------------------------------------------------------------------
+    /** SPNEGO mech list MIC tag */
+    public static final int SPNEGO_MECH_LIST_MIC_TAG = 27;
+
+    /** SPNEGO mech list MIC length */
+    public static final int SPNEGO_MECH_LIST_MIC_LENGTH = 28;
+
+    /** SPNEGO mech list MIC value */
+    public static final int SPNEGO_MECH_LIST_MIC_VALUE = 29;
 
+    /** SPNEGO mech list MIC tag */
+    public static final int SPNEGO_MECH_LIST_MIC_OCTET_STRING_TAG = 30;
 
     /** SPNEGO mech list MIC length */
-    public static final int SPNEGO_MECH_LIST_MIC_LENGTH = 7;
+    public static final int SPNEGO_MECH_LIST_MIC_OCTET_STRING_LENGTH = 31;
+
+    /** SPNEGO mech list MIC value */
+    public static final int SPNEGO_MECH_LIST_MIC_OCTET_STRING_VALUE = 32;
+
+    //====================================================================
+    // NegTokenTarg state
+    //====================================================================
 
 
     /** SPNEGO neg token targ Tag */
@@ -101,28 +188,13 @@
 
     /** SPNEGO neg token targ Value */
     public static final int SPNEGO_NEG_TOKEN_TARG_VALUE = 8;
-    
+
     /** SPNEGO last state */
-    public static final int LAST_SPNEGO_STATE = 16;
+    public static final int LAST_SPNEGO_STATE = 33;
 
     /** SPNEGO Grammar */
     public static final int SPNEGO_GRAMMAR = 0;
 
-    /** A string representation of all the states */
-    private static String[] SpnegoMessageString =
-        new String[]
-        {
-            "LDAP_MESSAGE_TAG", 
-            "LDAP_MESSAGE_LENGTH", 
-            "LDAP_MESSAGE_VALUE", 
-            "LDAP_MESSAGE_ID_TAG",
-            "LDAP_MESSAGE_ID_LENGTH", 
-            "LDAP_MESSAGE_ID_VALUE", 
-            "PROTOCOL_OP_TAG",
-            "PROTOCOL_OP_LENGTH", 
-            "PROTOCOL_OP_VALUE"
-        };
-
     /** The instance */
     private static SpnegoStatesEnum instance = new SpnegoStatesEnum();
 
@@ -136,6 +208,8 @@
     {
     }
 
+    //~ Methods ------------------------------------------------------------------------------------
+
     /**
      * Get an instance of this class
      * @return An instance on this class
@@ -155,31 +229,98 @@
     public String getState( int grammar, int state )
     {
 
-        if (grammar == SPNEGO_GRAMMAR)
+        if ( grammar == SPNEGO_GRAMMAR )
         {
-            if  ( state == -1 ) 
+
+            if ( state == -1 )
             {
                 return "END_STATE";
             }
             else
             {
-                switch (state)
+
+                switch ( state )
                 {
-                    case SPNEGO_NEG_TOKEN_INIT_TAG : return "SPNEGO_NEG_TOKEN_INIT_TAG";
-                    case SPNEGO_NEG_TOKEN_INIT_LENGTH : return "SPNEGO_NEG_TOKEN_INIT_LENGTH";

-                    case SPNEGO_NEG_TOKEN_INIT_VALUE : return "SPNEGO_NEG_TOKEN_INIT_VALUE";
-                    case SPNEGO_NEG_TOKEN_INIT_SEQUENCE_TAG : return "SPNEGO_NEG_TOKEN_INIT_SEQUENCE_TAG";
-                    case SPNEGO_NEG_TOKEN_INIT_SEQUENCE_LENGTH : return "SPNEGO_NEG_TOKEN_INIT_SEQUENCE_LENGTH";
-                    case SPNEGO_NEG_TOKEN_INIT_SEQUENCE_VALUE : return "SPNEGO_NEG_TOKEN_INIT_SEQUENCE_VALUE";
-                    case SPNEGO_NEG_TOKEN_TARG_TAG : return "SPNEGO_NEG_TOKEN_TARG_TAG";
-                    case SPNEGO_NEG_TOKEN_TARG_LENGTH : return "SPNEGO_NEG_TOKEN_TARG_LENGTH";
-                    case SPNEGO_NEG_TOKEN_TARG_VALUE : return "SPNEGO_NEG_TOKEN_TARG_VALUE";
-                	default : return "UNKNOWN";
+
+                    case SPNEGO_NEG_TOKEN_INIT_TAG :
+                        return "SPNEGO_NEG_TOKEN_INIT_TAG";
+
+                    case SPNEGO_NEG_TOKEN_INIT_LENGTH :
+                        return "SPNEGO_NEG_TOKEN_INIT_LENGTH";
+
+                    case SPNEGO_NEG_TOKEN_INIT_VALUE :
+                        return "SPNEGO_NEG_TOKEN_INIT_VALUE";
+
+                    case SPNEGO_NEG_TOKEN_INIT_SEQUENCE_TAG :
+                        return "SPNEGO_NEG_TOKEN_INIT_SEQUENCE_TAG";
+
+                    case SPNEGO_NEG_TOKEN_INIT_SEQUENCE_LENGTH :
+                        return "SPNEGO_NEG_TOKEN_INIT_SEQUENCE_LENGTH";
+
+                    case SPNEGO_NEG_TOKEN_INIT_SEQUENCE_VALUE :
+                        return "SPNEGO_NEG_TOKEN_INIT_SEQUENCE_VALUE";
+
+                    case SPNEGO_NEG_TOKEN_INIT_SEQUENCE_FOLLOWING_TAG :
+                        return "SPNEGO_NEG_TOKEN_INIT_SEQUENCE_FOLLOWING_TAG";
+
+                    case SPNEGO_MECH_TYPES_LENGTH :
+                        return "SPNEGO_MECH_TYPES_LENGTH";
+
+                    case SPNEGO_MECH_TYPES_VALUE :
+                        return "SPNEGO_MECH_TYPES_VALUE";
+
+                    case SPNEGO_MECH_TYPES_LIST_TAG :
+                        return "SPNEGO_MECH_TYPES_LIST_TAG";
+
+                    case SPNEGO_MECH_TYPES_LIST_LENGTH :
+                        return "SPNEGO_MECH_TYPES_LIST_LENGTH";
+
+                    case SPNEGO_MECH_TYPES_LIST_VALUE :
+                        return "SPNEGO_MECH_TYPES_LIST_VALUE";
+
+                    case SPNEGO_MECH_TYPE_TAG :
+                        return "SPNEGO_MECH_TYPE_TAG";
+
+                    case SPNEGO_MECH_TYPE_LENGTH :
+                        return "SPNEGO_MECH_TYPE_LENGTH";
+
+                    case SPNEGO_MECH_TYPE_VALUE :
+                        return "SPNEGO_MECH_TYPE_VALUE";
+
+                    case SPNEGO_MECH_TYPE_FOLLOWING_TAG :
+                        return "SPNEGO_MECH_TYPE_FOLLOWING_TAG";
+
+                    case SPNEGO_REQ_FLAGS_LENGTH :
+                        return "SPNEGO_REQ_FLAGS_LENGTH";
+
+                    case SPNEGO_REQ_FLAGS_VALUE :
+                        return "SPNEGO_REQ_FLAGS_VALUE";
+
+                    case SPNEGO_REQ_FLAGS_FOLLOWING_TAG :
+                        return "SPNEGO_REQ_FLAGS_FOLLOWING_TAG";
+
+                    case SPNEGO_MECH_TOKEN_LENGTH :
+                        return "SPNEGO_MECH_TOKEN_LENGTH";
+
+                    case SPNEGO_MECH_TOKEN_VALUE :
+                        return "SPNEGO_MECH_TOKEN_VALUE";
+
+                    case SPNEGO_MECH_LIST_MIC_TAG :
+                        return "SPNEGO_MECH_LIST_MIC_TAG";
+
+                    case SPNEGO_MECH_LIST_MIC_LENGTH :
+                        return "SPNEGO_MECH_LIST_MIC_LENGTH";
+
+                    case SPNEGO_MECH_LIST_MIC_VALUE :
+                        return "SPNEGO_MECH_LIST_MIC_VALUE";
+
+                    default :
+                        return "UNKNOWN";
                 }
             }
-            
+
         }
-        else 
+        else
         {
             return "UNKNOWN";
         }



Mime
View raw message