Return-Path: Delivered-To: apmail-incubator-directory-cvs-archive@www.apache.org Received: (qmail 78095 invoked from network); 18 Feb 2005 06:21:26 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 18 Feb 2005 06:21:26 -0000 Received: (qmail 24414 invoked by uid 500); 18 Feb 2005 06:21:24 -0000 Delivered-To: apmail-incubator-directory-cvs-archive@incubator.apache.org Received: (qmail 24376 invoked by uid 500); 18 Feb 2005 06:21:24 -0000 Mailing-List: contact directory-cvs-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: directory-dev@incubator.apache.org Delivered-To: mailing list directory-cvs@incubator.apache.org Received: (qmail 24361 invoked by uid 99); 18 Feb 2005 06:21:24 -0000 X-ASF-Spam-Status: No, hits=-9.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from minotaur.apache.org (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.28) with SMTP; Thu, 17 Feb 2005 22:21:24 -0800 Received: (qmail 78049 invoked from network); 18 Feb 2005 06:21:23 -0000 Received: from localhost.hyperreal.org (HELO minotaur.apache.org) (127.0.0.1) by localhost.hyperreal.org with SMTP; 18 Feb 2005 06:21:23 -0000 Content-Type: text/plain; charset="iso-8859-1" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: directory-cvs@incubator.apache.org To: directory-cvs@incubator.apache.org Subject: =?iso-8859-1?q?=5BApache_Directory_Project_Wiki=5D_Updated=3A__TLVPageInf?= =?iso-8859-1?q?o?= Date: Fri, 18 Feb 2005 06:21:23 -0000 Message-ID: <20050218062123.78019.96806@minotaur.apache.org> X-Spam-Rating: localhost.hyperreal.org 1.6.2 0/1000/N X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Date: 2005-02-17T22:21:22 Editor: AlexKarasulu Wiki: Apache Directory Project Wiki Page: TLVPageInfo URL: http://wiki.apache.org/directory/TLVPageInfo no comment Change Log: ---------------------------------------------------------------------------= --- @@ -19,11 +19,13 @@ = Labels are numbers used to identify elements in a '''SET''' (see Asn.1 gra= mmar), for instance. Generally, we don't have to deal with label above 30, = which can be encoded in 5 bits (so this kind of '''Tag''' will be 1 byte lo= ng), and never above 1024. In the LDAP ASN.1 grammar, no label exceed 19 (i= n ''LdapMessage'', the ''ExtendedResponse'' label is 19), so we can focus o= n 1 byte tags. Whatever, it could be interesting to accept longer labels to= be able to support any LDAP evolution (or other protocols, as this '''Tag'= '' decoder is not specifically written for LDAP) = -''In the current setup we use a Java primitive int to store a maximum of 4= Tag field bytes. The Tags within a protocol can be pre-fabricated. An en= umeration constant can be reused. This way all we need is a 4 byte referen= ce to the constant to represent the tag value. This works well especially = for using the enumeration type's value for switch statments. Today here's = how we pack Tag bytes into a Java primitive int:'' +''In the current setup we use a Java primitive int to store a maximum of 4= Tag field bytes. The Tags within a protocol can be pre-fabricated. An en= umeration constant can be reused. This way all we need is a 4 byte referen= ce to the constant to represent the tag value. This works well especially = for using the enumeration type's value for switch statments. Today here's = how we pack Tag bytes into a Java primitive int.'' = [http://incubator.apache.org/directory/subprojects/asn1/images/tag-integer= -encoding.png] = -''Looking at the automaton below it occurred to me that we can create two = different Tag decoders. A stateless one for protocols that only requires a= single byte Tag. You get whole bytes delivered in buffers so no need to k= eep state right? The stateless Tag really simplifies the automaton ;). Fo= r multibyte protocols we do collect bytes in a TagOctetCollector which is j= ust a wrapper around a Java int. Do you think this needs to be revamped?'' +''Looking at the automaton below it occurred to me that we can create two = different Tag decoders. A stateless one for protocols that only requires a= single byte Tag. You get whole bytes delivered in buffers so no need to k= eep state right? The stateless Tag really simplifies the automaton ;). Fo= r multibyte protocols we do collect bytes in a TagOctetCollector which is j= ust a wrapper around a Java int. Do you think this needs to be revamped? = In the case of a protocol where the number of Tag octets can be greater tha= n 1 we can use a less efficient stateful Tag decoder which needs the full l= ogic of the automaton. I know this is just some extra if-then-else logic b= ut that adds up for every byte. So we can swap out the Tag decoder used ba= sed on the protocol. Most hopefully will take the simple tag decoder and n= ot pay too much of a penalty.'' + +''BTW note that if we have a protocol with more that 30 tags we only need = one multibyte tag decoder per stream. This is a per connection setup cost = paid once and not for every Tag that comes through.'' = Decoding a Tag has to follow the finite state automaton showed on this pic= ture : =20