directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r179161 - /directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/codec/grammars/BindResponseGrammar.java
Date Mon, 30 May 2005 22:18:11 GMT
Author: elecharny
Date: Mon May 30 15:18:09 2005
New Revision: 179161

URL: http://svn.apache.org/viewcvs?rev=179161&view=rev
Log:
- Fixed the grammar to deal correctly with the LdapResult sub-grammar ending.
- Some javadoc refactoring.

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

Modified: directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/codec/grammars/BindResponseGrammar.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/codec/grammars/BindResponseGrammar.java?rev=179161&r1=179160&r2=179161&view=diff
==============================================================================
--- directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/codec/grammars/BindResponseGrammar.java
(original)
+++ directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/codec/grammars/BindResponseGrammar.java
Mon May 30 15:18:09 2005
@@ -58,11 +58,11 @@
      */
     private BindResponseGrammar()
     {
-        name = BindResponseGrammar.class.getName();
+        name       = BindResponseGrammar.class.getName();
         statesEnum = LdapStatesEnum.getInstance();
 
-        // We have 17 differents states, so 16 transitions between states.
-        super.transitions = new GrammarTransition[LdapStatesEnum.LAST_LDAP_STATE][256];
+        // Initialisation of the transitions table
+        super.transitions = new GrammarTransition[LdapStatesEnum.LAST_BIND_RESPONSE_STATE][256];
 
         //============================================================================================
         // BindResponse Message
@@ -109,15 +109,29 @@
 
         // LdapMessage ::= ... BindResponse ...
         // BindResponse ::= [APPLICATION 1] SEQUENCE { ... (Value)
-        // The first Tag will be the LDAPResult Tag (0x0A). So we have to switch the grammar.
+        // We won't have a value. The next Tag will be the LDAPResult Tag (0x0A)
         super.transitions[LdapStatesEnum.BIND_RESPONSE_VALUE][0x61] = new GrammarTransition(
-                LdapStatesEnum.BIND_RESPONSE_VALUE, LdapStatesEnum.BIND_RESPONSE_LDAP_RESULT,
null );
+                LdapStatesEnum.BIND_RESPONSE_VALUE, LdapStatesEnum.BIND_RESPONSE_LDAP_RESULT,
+                null );
 
         // LdapMessage ::= ... BindResponse ...
         // BindResponse ::= [APPLICATION 1] SEQUENCE { ... (Value)
-        // The first Tag will be the LDAPResult Tag (0x0A). So we have to switch the grammar.
+        //    COMPONENTS OF LDAPResult, ...
+        // The Tag will be the LDAPResult Tag (0x0A). So we have to switch the grammar.
+        // The current state will be stored.
         super.transitions[LdapStatesEnum.BIND_RESPONSE_LDAP_RESULT][0x0A] = new GrammarTransition(
-                LdapStatesEnum.BIND_RESPONSE_LDAP_RESULT, LdapStatesEnum.LDAP_RESULT_GRAMMAR_SWITCH,
null );
+                LdapStatesEnum.BIND_RESPONSE_LDAP_RESULT, LdapStatesEnum.LDAP_RESULT_GRAMMAR_SWITCH,
+                null );
+
+        // LdapMessage ::= ... BindResponse ...
+        // BindResponse ::= [APPLICATION 1] SEQUENCE {
+        //       COMPONENTS OF LDAPResult,
+        //    serverSaslCreds    [7] OCTET STRING OPTIONAL }
+        // If there is a sasl credential, we will decode it here. We must control that we
had a LdapResult
+        //
+        super.transitions[LdapStatesEnum.BIND_RESPONSE_LDAP_RESULT][0x87] = new GrammarTransition(
+                LdapStatesEnum.BIND_RESPONSE_LDAP_RESULT,
+                LdapStatesEnum.BIND_RESPONSE_SERVER_SASL_CREDS_LENGTH, null );
 
         // BindResponse ::= APPLICATION 1] SEQUENCE {
         //     ...
@@ -126,12 +140,7 @@
         // Otherwise, if the tag is 0x80, it's a control
         super.transitions[LdapStatesEnum.BIND_RESPONSE_SERVER_SASL_CREDS_TAG][0x87] =
             new GrammarTransition( LdapStatesEnum.BIND_RESPONSE_SERVER_SASL_CREDS_TAG,
-                    LdapStatesEnum.BIND_RESPONSE_SERVER_SASL_CREDS_LENGTH, null );
-
-        // It's a control if it's 0x80. We have to quit this grammar.
-        super.transitions[LdapStatesEnum.BIND_RESPONSE_SERVER_SASL_CREDS_TAG][( 0x80 &
0x00FF )] =
-            new GrammarTransition( LdapStatesEnum.BIND_RESPONSE_SERVER_SASL_CREDS_TAG,
-                    LdapStatesEnum.GRAMMAR_END, null );
+                LdapStatesEnum.BIND_RESPONSE_SERVER_SASL_CREDS_LENGTH, null );
 
         // BindResponse ::= APPLICATION 1] SEQUENCE {
         //     ...
@@ -148,7 +157,7 @@
                         LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer
)
                             container;
 
-                        BindResponsePOJO     bindResponseMessage = 
+                        BindResponsePOJO     bindResponseMessage =
                             ldapMessageContainer.getLdapMessage().getBindResponse();
 
                         TLV                  tlv = ldapMessageContainer.getCurrentTLV();
@@ -186,7 +195,7 @@
                         LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer
)
                             container;
 
-                        BindResponsePOJO     bindResponseMessage = 
+                        BindResponsePOJO     bindResponseMessage =
                             ldapMessageContainer.getLdapMessage().getBindResponse();
 
                         // Get the Value and store it in the BindRequest



Mime
View raw message