> Let�s consider the following two cases:
>
> 1).
> field CHOICE
> {
> field1 SEQUENCE
> {
> field11 BOOL
> field12 INTEGER
> }
>
> field2 SEQUENCE
> {
> field21 BOOL
> field22 REAL
> }
> }
>
> and
>
> 2).
> field CHOICE
> {
> field1 REAL
>
> field2 CHOICE
> {
> field21 REAL
> field22 BOOL
> }
> }
>
> BER specifies that the Tag number for a Choice type is the tag of the chosen
> type. Because of that, in the first case, when decoding an object, there is
> no way to tell which is the chosen type because both types will have the
> same Tag number (16 as specified by the ASN.1 standard).
It behooves the writer of the ASN.1 syntax to make them unique. If he
does so via tags (either automatic or manual ones), you would know which
is which. If he doesn't, you don't.
> ...................................................... Moreover, in the
> second case, if field2 is the chosen one and within that, field21 is the
> chosen one, the Tag number (9 for Real numbers) gets propagated up in the
> hierarchy, from the field21 to field2 to field. In this case, when decoding,
> it�s impossible to tell whether field1 is encoded or field21 from field2.
> Am I missing something?
Perhaps what you're missing is that the writer may (in your case, should)
a) insert tags by hand, or
b) have the software insert automatic tags.
Are you familiar with the notation for tags?
> field CHOICE
> {
> field1 [0] REAL,
>
> field2 [1] CHOICE
> {
> field21 [0] REAL,
> field22 [1] BOOLEAN
> }
> }
Or for automatic tagging?
ModuleName DEFINITIONS AUTOMATIC TAGS BEGIN
....
END
=====================================================================
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