Subject: [Megaco] Urgent - ASN BER encoding/decoding of OPTIONAL fields!

From: "Atanum" <[email-masked]>
Date: Thu, 16 Aug 2001 19:37:04 +0530

> HI List,
> 
> I would like to know how exactly the OPTIONAL fields are handled
> during BER encode/decode.
> I understand that the TLV  for an OPT field if present,  shall appear in
> the encoding at the point corresponding to the appearance of the type in
> the ASN.1 definition.
> What is the way to decode such an incoming ASN stream, which contains an
> OPT field?
> 
> eg. : in the definition below, how will we know that streamMode is
> PRESENT or NOT in the incoming ASN BER stream? The situation sure looks
> more complicated if we have more than one OPT field.
> 
>    LocalControlDescriptor ::= SEQUENCE
>    {
>         streamMode      StreamMode OPTIONAL,
>         reserveValue    BOOLEAN,
>         reserveGroup    BOOLEAN,
>         propertyParms   SEQUENCE OF PropertyParm,
>         ...
>    }
> 
> In the above case, we may be able to find out by looking at the TAG
> octets. This is possible since TAGs of streamMode and reserveValue are
> different.
> But how will we decode if, say reserve value is also of type StreamMode
> (see below)
> 
>    LocalControlDescriptor ::= SEQUENCE
>    {
>         streamMode      StreamMode OPTIONAL,
>         reserveValue    StreamMode,
>         reserveGroup    BOOLEAN,
>         propertyParms   SEQUENCE OF PropertyParm,
>         ...
>    }
> 
> 
> Thanks in Advance
> Regards
> 
> 

_______________________________________________
Megaco mailing list
[email-masked]
http://www1.ietf.org/mailman/listinfo/megaco

---

From: Troy Cauble <[email-masked]>
Date: Thu, 16 Aug 2001 11:22:28 -0400

> >         propertyParms   SEQUENCE OF PropertyParm,

Yes, you do it by looking at the tags.
The tags are different in your second example too.

The AUTOMATIC TAGS declaration implies IMPLICIT positional tags,
roughly equivalent to IMPLICIT sequential tagging starting from [0]
within each SEQUENCE, SET or CHOICE (but not the "OF"s).

I strongly suggest you get an ASN.1 compiler.  There are some
available without target licensing.

-troy