One other thing: Would I have to encode a length field for the CHOICE type or its tag will be followed right up by the tag of the chosen inner type?
-----Original Message----- From: Ed Day [mailto:[EMAIL PROTECTED] Sent: Monday, May 16, 2005 10:48 AM To: Eduard Lascu; Asn1 Subject: Re: [ASN1] Tag of class context-specific inserted before each CHOICE type > > In Mr. Dubuisson's book ("ASN.1 - Communication between Heterogenous > Systems") it is suggested (page 236) that if AUTOMATIC TAGS clause is not > used in the header module, a tag of class context-specific should be > inserted before each CHOICE type. The example reads: > > T ::= CHOICE { a [0] INTEGER, > b [1] NULL } This is not really necessary as long as all of the types within the choice construct are unique. In the example above, if the context-specific tags were omitted, the universal tags (UNIV 1 and UNIV 5) would be used to distinguish the elements. > Does that mean that when (BER) encoding the object, the choice will have two > tags in a row: first to tell that the CHOICE is present within its parent > SET or SEQUENCE type and the second to indicate which is the chosen > object/type inside the CHOICE? Yes. Regards, Ed Day Objective Systems, Inc. REAL WORLD ASN.1 AND XML SOLUTIONS Tel: +1 (484) 875-9841 Fax: +1 (484) 875-9830 Toll-free: (877) 307-6855 (USA only) mailto:[EMAIL PROTECTED] http://www.obj-sys.com ----- Original Message ----- From: "Eduard Lascu" <[EMAIL PROTECTED]> To: "Asn1" <[email protected]> Sent: Monday, May 16, 2005 10:28 AM Subject: [ASN1] Tag of class context-specific inserted before each CHOICE type > > In Mr. Dubuisson's book ("ASN.1 - Communication between Heterogenous > Systems") it is suggested (page 236) that if AUTOMATIC TAGS clause is not > used in the header module, a tag of class context-specific should be > inserted before each CHOICE type. The example reads: > > T ::= CHOICE { a [0] INTEGER, > b [1] NULL } > > U ::= SET { x [0] REAL, > y [1] T, > z [2] CHOICE { c [1] BIT STRING, > d [2] OCTET STRING } } > > If U were a SEQUENCE, I guess the correct definitions would be: > > T ::= CHOICE { a [0] INTEGER, > b [1] NULL } > > U ::= SEQUENCE { x [0] REAL, > y [1] T, > z [2] CHOICE { c [1] BIT STRING, > d [2] OCTET STRING } } > > Does that mean that when (BER) encoding the object, the choice will have two > tags in a row: first to tell that the CHOICE is present within its parent > SET or SEQUENCE type and the second to indicate which is the chosen > object/type inside the CHOICE? > > Regards, > Eddie L > > Eddie Lascu > Senior Software Developer, Associate > IBI Group > 230 Richmond St. W., 5th Floor > Toronto ON M5V 1V6 > Tel. (416) 596-1930 x312 > Fax. (416) 596-0644 > www.ibigroup.com > > > NOTE: This e-mail message and attachments may contain privileged and > confidential information. If you have received this message in error, > please immediately notify the sender and delete this e-mail message. > > "NOTE: Ce courriel peut contenir de l'information privil�gi�e et > confidentielle. Si vous avez re�u ce message par erreur, veuillez le > mentionner imm�diatement � l'exp�diteur et effacer ce courriel." > > _______________________________________________ > ASN1 mailing list > [email protected] > http://lists.asn1.org/mailman/listinfo/asn1 > > > _______________________________________________ ASN1 mailing list [email protected] http://lists.asn1.org/mailman/listinfo/asn1
