Tcl Library Source Code

View Ticket
Login
Ticket UUID: 1558351
Title: ASN Library
Type: Bug Version: None
Submitter: wajih_ur_rehman Created on: 2006-09-14 04:59:14
Subsystem: asn Assigned To: mic42
Priority: 5 Medium Severity:
Status: Open Last Modified: 2007-04-21 01:16:27
Resolution: None Closed By:
    Closed on:
Description:
Dear TCL Experts and Developer,

Recently , I used TCL Asn linrary package which made 
lots of thing easier. However, I found that bugs or 
possibilites of improvement.

Please check the following and see if it will be a 
good idea to make following changes:

1. TAG Verification
In all of the asn Package, after reading TAG value it 
is verified with Universal TAG , e.g.

    if {$tag != 0x02} {
        return -code error \
            [format "Expected Integer (0x02), but got 
%02x" $tag]
    }

This , however , is true only when universal TAGs are 
in use. In many cases private TAG are also use for 
the data encoding.

I think , such checks should be removed as it should 
be consider programmer responsibility to verify if 
the TAG is expected , universal or private. Library 
should not provide any restriction.


2. TAG Length
The library package consider TAG length as one byte 
only. This , however , might not be true in some case 
where the TAG can be of 2 bytes.

This should be corrected with the possibility of TAG 
with variable length.

3. PeekBytes Procedure?
There is no procedure for PeekBytes. Sometimes it is 
necessary to read the byte/bytes without affecting 
the original Data. ::asn::asnPeekByte though exist 
but there is nothing like PeekBytes

4. Output of getByte
The output byte of asnGetByte gives the result in 
decimal format. Since it is binary data I will 
suggest the result should be hex coded format to keep 
all things in same format.


5. Introduction of Choce Structure ( and others )
The ASN library package should be able to handle 
other kinds of ASN structure e.g. Choice structure

The Choice structure allows to match one of the 
various possibilites:

Choice :: {

          1. Money
          2. Car
          3. Nothing
          
          }

With this type of encoding any one of the above 
choice may happen. Therefore , there should be a 
possibility of passing TAG values as an argument and 
the procedure should try which to match the TAG and 
then pass the value back of the choice which actually 
appeared .

Similarly , we have SEQOF , SETOF types of data 
structure which should also be consider.

Many thanks!

Wajih
User Comments: mic42 added on 2007-04-21 01:16:27:
Logged In: YES 
user_id=302287
Originator: NO

Some of this is fixed in asn 0.8. I added a asn::peekTag, and some others to handle multi-byte tags and retag things. Not the best solution currently, but works. 

PeekBytes is basically not needed, as the asn data is just a string. If you want a peek at the first x bytes, simply use string range for now, it works fine with binary data.