On Fri, 13 Apr 2001 [EMAIL PROTECTED] wrote:

> I have some problem in encoding of BER values for a particular ASN part.
> 
> SEQUENCE
> {
>      legID [2] CHOICE
>      {
>           sendingSideID [0] IMPLICIT OCTET STRING (SIZE (1)),
>           receivingSideID [1] IMPLICIT OCTET STRING (SIZE (1))
>      } OPTIONAL,
>      dPSpecificCriteria [30] CHOICE
>      {
>           numberOfDigits [0] IMPLICIT INTEGER (1..255),
>           applicationTimer [1] IMPLICIT INTEGER (0..2047)
>      } OPTIONAL
> },
> 
> 
> I guess first the Type and Length for the Sequence will be specified.Can anyone
> tell
> me how the TLV format for the CHOICE will be specified while encoding.
> It will be of great help!!!!!!!!!

A CHOICE type is encoded as the chosen item. That is, there is no
difference in the BER encoding between cHosen and notChosen in the
examples below.

Choices ::= CHOICE { a INTEGER,
                   b BOOLEAN}
cHosen Choices ::= a: 15


NoChoice ::= INTEGER
notChosen NoChoice ::= 15

In your case, what remains from the [2] CHOICE is the tag [2],
and from the [30] CHOICE is the tag [30], thus, assuming the OPTIONAL
fields are present, you would have

T of the SEQUENCE
L 
  T [2]
  L length of the 1st choice (3)
    T either [0] or [1]
    L 1
    V the octet   
  T [30]
  L length of the 2nd choice
    T either [0] or [1]
    L 1 if [0], 2 if [1]
    V the integer

=====================================================================
Conrad Sigona                         Toll Free      : 1-888-OSS-ASN1  
OSS Nokalva                           Voice Mail     : 1-732-302-9669 x400  
[EMAIL PROTECTED]                        Fax            : 1-419-831-5035
http://www.oss.com                    My direct line : 1-315-845-1773


Reply via email to