directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r178682 - /directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ber/grammar/StatesEnum.java
Date Thu, 26 May 2005 20:47:27 GMT
Author: elecharny
Date: Thu May 26 13:47:26 2005
New Revision: 178682

URL: http://svn.apache.org/viewcvs?rev=178682&view=rev
Log:
Added. Strange, because it was supposed to have been added a month ago ...

Added:
    directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ber/grammar/StatesEnum.java

Added: directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ber/grammar/StatesEnum.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ber/grammar/StatesEnum.java?rev=178682&view=auto
==============================================================================
--- directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ber/grammar/StatesEnum.java
(added)
+++ directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ber/grammar/StatesEnum.java
Thu May 26 13:47:26 2005
@@ -0,0 +1,383 @@
+/*
+ *   Copyright 2005 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.asn1.ber.grammar;
+
+/**
+ * All the possible states of the LDAP decoder.
+ * 
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class StatesEnum
+{
+    //~ Static fields/initializers -----------------------------------------------------------------
+
+    /** The initial state of every grammar */
+    public static int INIT_GRAMMAR_STATE = 0;
+    
+    /** Initiate the counter to 0 */
+    private static int INIT_STATE = 0;
+
+    // LdapMessage ------------------------------------------------------------
+    /** LDAPMessage Tag */
+    public static int LDAP_MESSAGE_TAG = INIT_STATE++;
+
+    /** LDAPMessage Length */
+    public static int LDAP_MESSAGE_LENGTH = INIT_STATE++;
+
+    /** LDAPMessage Value */
+    public static int LDAP_MESSAGE_VALUE = INIT_STATE++;
+
+    // Message ID -------------------------------------------------------------
+    /** MessageID Tag */
+    public static int LDAP_MESSAGE_ID_TAG = INIT_STATE++;
+
+    /** MessageID Length */
+    public static int LDAP_MESSAGE_ID_LENGTH = INIT_STATE++;
+
+    /** MessageID Value */
+    public static int LDAP_MESSAGE_ID_VALUE = INIT_STATE++;
+
+    // ProtocolOp -------------------------------------------------------------
+    /** protocolOp CHOICE Tag */
+    public static int PROTOCOL_OP_TAG = INIT_STATE++;
+
+    /** protocolOp CHOICE Length */
+    public static int PROTOCOL_OP_LENGTH = INIT_STATE++;
+
+    /** protocolOp CHOICE Value */
+    public static int PROTOCOL_OP_VALUE = INIT_STATE++;
+
+    // BindRequest ============================================================
+    // Version ----------------------------------------------------------------
+    /**  Version Tag */
+    public static int BIND_REQUEST_VERSION_TAG = INIT_STATE++;
+
+    /** Version Length */
+    public static int BIND_REQUEST_VERSION_LENGTH = INIT_STATE++;
+
+    /** Version Length */
+    public static int BIND_REQUEST_VERSION_VALUE = INIT_STATE++;
+
+    // Name -------------------------------------------------------------------
+    /** Name Tag */
+    public static int BIND_REQUEST_NAME_TAG = INIT_STATE++;
+
+    /** Name Length */
+    public static int BIND_REQUEST_NAME_LENGTH = INIT_STATE++;
+
+    /** Name Value */
+    public static int BIND_REQUEST_NAME_VALUE = INIT_STATE++;
+
+    // Authentication choice --------------------------------------------------
+    /** Authentication choice Tag */
+    public static int BIND_REQUEST_AUTHENTICATION_CHOICE_TAG = INIT_STATE++;
+
+    // Authentication simple --------------------------------------------------
+    /** Authentication Simple Tag */
+    //public static int BIND_REQUEST_AUTHENTICATION_SIMPLE_TAG = INIT_STATE++;
+
+    /** Authentication Simple Length */
+    public static int BIND_REQUEST_AUTHENTICATION_SIMPLE_LENGTH = INIT_STATE++;
+
+    /** Authentication Simple Value */
+    public static int BIND_REQUEST_AUTHENTICATION_SIMPLE_VALUE = INIT_STATE++;
+
+    // Authentication sasl ----------------------------------------------------
+    /** Authentication Sasl Tag */
+    //public static int BIND_AUTHENTICATION_SASL_TAG = INIT_STATE++;
+
+    /** Authentication Sasl Length */
+    public static int BIND_REQUEST_AUTHENTICATION_SASL_LENGTH = INIT_STATE++;
+
+    /** Authentication Sasl Value */
+    public static int BIND_REQUEST_AUTHENTICATION_SASL_VALUE = INIT_STATE++;
+
+    // Authentication sasl mechanism ------------------------------------------
+    /** Authentication Sasl mechanism Tag */
+    public static int BIND_REQUEST_AUTHENTICATION_MECHANISM_TAG = INIT_STATE++;
+
+    /** Authentication sasl mechanism Length */
+    public static int BIND_REQUEST_AUTHENTICATION_MECHANISM_LENGTH = INIT_STATE++;
+
+    /** Authentication sasl mechanism Value */
+    public static int BIND_REQUEST_AUTHENTICATION_MECHANISM_VALUE = INIT_STATE++;
+
+    // Authentication sasl mechanism ------------------------------------------
+    /** Authentication Sasl credentials Tag */
+    public static int BIND_REQUEST_AUTHENTICATION_CREDENTIALS_TAG = INIT_STATE++;
+
+    /** Authentication sasl credentials Length */
+    public static int BIND_REQUEST_AUTHENTICATION_CREDENTIALS_LENGTH = INIT_STATE++;
+
+    /** Authentication sasl credentials Value */
+    public static int BIND_REQUEST_AUTHENTICATION_CREDENTIALS_VALUE = INIT_STATE++;
+
+    // Controls ===============================================================
+    /** Controls Tag */
+    public static int CONTROLS_TAG = INIT_STATE++;
+
+    /** Controls Length */
+    public static int CONTROLS_LENGTH = INIT_STATE++;
+
+    /** Controls Value */
+    public static int CONTROLS_VALUE = INIT_STATE++;
+
+    // Control ----------------------------------------------------------------
+    /** Control Tag */
+    public static int CONTROL_TAG = INIT_STATE++;
+
+    /** Control Length */
+    public static int CONTROL_LENGTH = INIT_STATE++;
+
+    /** Control Value */
+    public static int CONTROL_VALUE = INIT_STATE++;
+
+    // Control controltype ----------------------------------------------------
+    /** Control type Tag */
+    public static int CONTROL_TYPE_TAG = INIT_STATE++;
+
+    /** Control type Length */
+    public static int CONTROL_TYPE_LENGTH = INIT_STATE++;
+
+    /** Control type Value */
+    public static int CONTROL_TYPE_VALUE = INIT_STATE++;
+
+    // Control criticality ----------------------------------------------------
+    /** Control criticality Tag */
+    public static int CONTROL_CRITICALITY_TAG = INIT_STATE++;
+
+    /** Control criticality Length */
+    public static int CONTROL_CRITICALITY_LENGTH = INIT_STATE++;
+
+    /** Control criticality Value */
+    public static int CONTROL_CRITICALITY_VALUE = INIT_STATE++;
+
+    // Control controlvalue ---------------------------------------------------
+    /** Control value Tag */
+    public static int CONTROL_VALUE_TAG = INIT_STATE++;
+
+    /** Control value Length */
+    public static int CONTROL_VALUE_LENGTH = INIT_STATE++;
+
+    /** Control value Value */
+    public static int CONTROL_VALUE_VALUE = INIT_STATE++;
+
+    // BindResponse ===========================================================
+    // Version ----------------------------------------------------------------
+    /**  Response Tag */
+    public static int BIND_RESPONSE_TAG = INIT_STATE++;
+
+    /**  Response Length */
+    public static int BIND_RESPONSE_LENGTH = INIT_STATE++;
+
+    /**  Response Value */
+    public static int BIND_RESPONSE_VALUE = INIT_STATE++;
+
+    /**  Response message ID Tag */
+    public static int BIND_RESPONSE_MESSAGE_ID_TAG = INIT_STATE++;
+
+    /** serverSaslCreds Tag */
+    public static int SERVER_SASL_CREDS_TAG = INIT_STATE++;
+
+    /** serverSaslCreds Length */
+    public static int SERVER_SASL_CREDS_LENGTH = INIT_STATE++;
+
+    /** serverSaslCreds Length */
+    public static int SERVER_SASL_CREDS_VALUE = INIT_STATE++;
+
+    /** Last state */
+    public static int LAST_LDAP_STATE = INIT_STATE; 
+    
+    
+    // LdapResult grammar states ==============================================
+    private static int LDAP_RESULT_STATE = 0;
+    
+    // LdapResult Code --------------------------------------------------------
+    /** LdapResult Code Tag */
+    public static int LDAP_RESULT_CODE_TAG = LDAP_RESULT_STATE++;
+
+    /** LdapResult Code Length */
+    public static int LDAP_RESULT_CODE_LENGTH = LDAP_RESULT_STATE++;
+
+    /** LdapResult Code Value */
+    public static int LDAP_RESULT_CODE_VALUE = LDAP_RESULT_STATE++;
+
+    // LdapResult Matched DN --------------------------------------------------
+    /** LdapResult Matched DN Tag */
+    public static int LDAP_RESULT_MATCHED_DN_TAG = LDAP_RESULT_STATE++;
+
+    /** LdapResult Matched DN Length */
+    public static int LDAP_RESULT_MATCHED_DN_LENGTH = LDAP_RESULT_STATE++;
+
+    /** LdapResult Matched DN Value */
+    public static int LDAP_RESULT_MATCHED_DN_VALUE = LDAP_RESULT_STATE++;
+
+    // LdapResult error message -----------------------------------------------
+    /** LdapResult error message Tag */
+    public static int LDAP_RESULT_ERROR_MESSAGE_TAG = LDAP_RESULT_STATE++;
+
+    /** LdapResult error message Length */
+    public static int LDAP_RESULT_ERROR_MESSAGE_LENGTH = LDAP_RESULT_STATE++;
+
+    /** LdapResult error message Value */
+    public static int LDAP_RESULT_ERROR_MESSAGE_VALUE = LDAP_RESULT_STATE++;
+
+    // LdapResult referral sequence -------------------------------------------
+    /** LdapResult referral sequence Tag */
+    public static int LDAP_RESULT_REFERRAL_SEQUENCE_TAG = LDAP_RESULT_STATE++;
+
+    /** LdapResult referral sequence Length */
+    public static int LDAP_RESULT_REFERRAL_SEQUENCE_LENGTH = LDAP_RESULT_STATE++;
+
+    // LdapResult referrale ---------------------------------------------------
+    /** LdapResult referral Tag */
+    public static int LDAP_RESULT_REFERRAL_TAG = LDAP_RESULT_STATE++;
+
+    /** LdapResult referral Length */
+    public static int LDAP_RESULT_REFERRAL_LENGTH = LDAP_RESULT_STATE++;
+
+    /** LdapResult referral Value */
+    public static int LDAP_RESULT_REFERRAL_VALUE = LDAP_RESULT_STATE++;
+
+    /** The last state */
+    public static int LDAP_RESULT_LAST_STATE = LDAP_RESULT_STATE;
+    
+    
+    
+    /** The mask to filter between states transition and grammar switch */
+    public final static int GRAMMAR_SWITCH_MASK = 0x0F00;
+    
+    /** Ldap Grammar */
+    public final static int LDAP_GRAMMAR_SWITCH = 0x0100;
+    public final static int LDAP_GRAMMAR = 0;
+
+    /** LdapResult Grammar */
+    public final static int LDAP_RESULT_GRAMMAR_SWITCH = 0x0200;
+    public final static int LDAP_RESULT_GRAMMAR = 1;
+
+    /** A string representation of all the states */
+    private static String[] LdapString =
+        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",
+			"LDAP_RESULT_CODE_TAG",
+			"LDAP_RESULT_CODE_LENGTH",
+			"LDAP_RESULT_CODE_VALUE",
+			"LDAP_RESULT_MATCHED_DN_TAG",
+			"LDAP_RESULT_MATCHED_DN_LENGTH",
+			"LDAP_RESULT_MATCHED_DN_VALUE",
+			"LDAP_RESULT_ERROR_MESSAGE_TAG",
+			"LDAP_RESULT_ERROR_MESSAGE_LENGTH",
+			"LDAP_RESULT_ERROR_MESSAGE_VALUE",
+			"LDAP_RESULT_REFERRAL_SEQUENCE_TAG",
+			"LDAP_RESULT_REFERRAL_SEQUENCE_LENGTH",
+			"LDAP_RESULT_REFERRAL_TAG",
+			"LDAP_RESULT_REFERRAL_LENGTH",
+			"LDAP_RESULT_REFERRAL_VALUE",
+			"BIND_REQUEST_VERSION_TAG",
+			"BIND_REQUEST_VERSION_LENGTH",
+			"BIND_REQUEST_VERSION_VALUE",
+			"BIND_REQUEST_NAME_TAG",
+			"BIND_REQUEST_NAME_LENGTH",
+			"BIND_REQUEST_NAME_VALUE",
+			"BIND_REQUEST_AUTHENTICATION_CHOICE_TAG",
+			//public static int BIND_AUTHENTICATION_SIMPLE_TAG",
+			"BIND_REQUEST_AUTHENTICATION_SIMPLE_LENGTH",
+			"BIND_REQUEST_AUTHENTICATION_SIMPLE_VALUE",
+			//public static int BIND_AUTHENTICATION_SASL_TAG",
+			"BIND_REQUEST_AUTHENTICATION_SASL_LENGTH",
+			"BIND_REQUEST_AUTHENTICATION_SASL_VALUE",
+			"BIND_REQUEST_AUTHENTICATION_MECHANISM_TAG",
+			"BIND_REQUEST_AUTHENTICATION_MECHANISM_LENGTH",
+			"BIND_REQUEST_AUTHENTICATION_MECHANISM_VALUE",
+			"BIND_REQUEST_AUTHENTICATION_CREDENTIALS_TAG",
+			"BIND_REQUEST_AUTHENTICATION_CREDENTIALS_LENGTH",
+			"BIND_REQUEST_AUTHENTICATION_CREDENTIALS_VALUE",
+			"CONTROLS_TAG",
+			"CONTROLS_LENGTH",
+			"CONTROLS_VALUE",
+			"CONTROL_TAG",
+			"CONTROL_LENGTH",
+			"CONTROL_VALUE",
+			"CONTROL_TYPE_TAG",
+			"CONTROL_TYPE_LENGTH",
+			"CONTROL_TYPE_VALUE",
+			"CONTROL_CRITICALITY_TAG",
+			"CONTROL_CRITICALITY_LENGTH",
+			"CONTROL_CRITICALITY_VALUE",
+			"CONTROL_VALUE_TAG",
+			"CONTROL_VALUE_LENGTH",
+			"CONTROL_VALUE_VALUE",
+			"BIND_RESPONSE_TAG",
+			"SERVER_SASL_CREDS_TAG",
+			"SERVER_SASL_CREDS_LENGTH",
+			"SERVER_SASL_CREDS_VALUE",
+			"LAST_STATE"
+        };
+
+    /** A string representation of all the LdapResult states */
+    private static String[] LdapResultString =
+        new String[]
+        {
+			"LDAP_RESULT_CODE_TAG",
+			"LDAP_RESULT_CODE_LENGTH",
+			"LDAP_RESULT_CODE_VALUE",
+			"LDAP_RESULT_MATCHED_DN_TAG",
+			"LDAP_RESULT_MATCHED_DN_LENGTH",
+			"LDAP_RESULT_MATCHED_DN_VALUE",
+			"LDAP_RESULT_ERROR_MESSAGE_TAG",
+			"LDAP_RESULT_ERROR_MESSAGE_LENGTH",
+			"LDAP_RESULT_ERROR_MESSAGE_VALUE",
+			"LDAP_RESULT_REFERRAL_SEQUENCE_TAG",
+			"LDAP_RESULT_REFERRAL_SEQUENCE_LENGTH",
+			"LDAP_RESULT_REFERRAL_TAG",
+			"LDAP_RESULT_REFERRAL_LENGTH",
+			"LDAP_RESULT_REFERRAL_VALUE",
+			"LAST_STATE"
+        };
+    //~ Methods ------------------------------------------------------------------------------------
+
+    /**
+     * Get the string representing the state
+     * 
+     * @param state The state number
+     * @return The String representing the state
+     */
+    public static String getState( int grammar, int state )
+    {
+        switch (grammar)
+        {
+            case LDAP_GRAMMAR :
+                return ( ( state == -1 ) ? "END_STATE" : LdapString[state] );
+                
+            case LDAP_RESULT_GRAMMAR :
+                return ( ( state == -1 ) ? "END_STATE" : LdapResultString[state] );
+                
+            default :
+                return "";
+        }
+    }
+}



Mime
View raw message