directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From directory-...@incubator.apache.org
Subject [Apache Directory Project Wiki] Updated: TLVPageInfo
Date Sat, 19 Feb 2005 18:58:19 GMT
   Date: 2005-02-19T10:58:19
   Editor: EmmanuelLecharny
   Wiki: Apache Directory Project Wiki
   Page: TLVPageInfo
   URL: http://wiki.apache.org/directory/TLVPageInfo

   no comment

Change Log:

------------------------------------------------------------------------------
@@ -75,14 +75,29 @@
 
 What about the decoding? We can also represent the decoding as a finite state automaton :
 
-'''TODO''' : ''Correct transitions int the following pircture : the bit 7 is NOT a marker,
it's a part of the length (I probably copy/past it from TagStateAutomaton ...:(''
-
 attachment:LengthStateAutomaton.png
 
+Note that an error occurs when ''expectedLength > 4 or expectedLength == 0x7F'', which
is quite redundant. In fact, those two conditions lead to different errors : 0X7F is a reserved
value, while 4 is an arbitrary length limit. You will get two different exceptions : '''LengthOverflowException'''
and '''ReservedExtensionException'''.
 
+There is nothing special about this automaton, it's quite an obvious one. We will only store
an '''int''' in the '''Length''' container, as it contains 4 bytes. Optionnaly, we could extend
the automaton to accept more than 4 bytes length values, but its quite unlucky to be ever
necessary (we aren't storing DVD movies in a LDAP server, are we? ;-)
 
 ==== Value ====
 
+'''Value''' is the last element to be decoded. It's the one that contains valuable informations.
There are two kind of '''Value''' : ''Primitive Values'' and ''Constructed Values''.
+
+==== Primitive Value ====
+Those '''Value''' are terminal. They can't contain another TLV. In the sample, we have 4
primitive '''Values''' :
+ * 02 01 01 which is an ''Integer'' representing the Message ID #1
+ * 0A 01 00 which is an ''ENUMERATED'' which value is 0 (success for a BindResponse LDAP
Message)
+ * 04 00 are OCTET STRING with no value, as the ''Length'' is 0.
+
+We can see that even if we can read a '''TLV''', the semantic is carried by the upper layer.
'''TLV''' are just structured containers, no more.
+
+A primitive value may be quite big : even if  we have limited ourself to a 4 bytes long length,
the value part could still contain 2 ^ 32 - 1 bytes (4 294 967 295 bytes ...), so we must
take care of those big values. It can't be an option to keep the full value in memory, we
must find a way to store them on disk, for instance. Of course, it's not an option either
to flush to disk all the values.... 
+
+The last point is that a primitive value has a fixed size, given by the '''Lengh''' part
of the '''TLV'''. It will be used for ''constructed values''.
+
+==== Constructed Value ====
 (TODO : replace the total BS below ...)
 
 What about the '''Values'''? '''Length''' was easy, it was totally context-free. Which kind
of '''Value''' can we have? How do we know the type of each '''Value'''?

Mime
View raw message