ASN.1
Previous:
Structured Types Up:
Abstract Syntax Notation
Next: Useful Types
Type TAGGED is used to enable the receiving system to correctly decode values from several datatypes that a protocol determines may be transmitted at any given time. TAGGED has no value notation of its own. Its type notation consists of three elements: a user-defined tag, possibly followed by IMPLICIT or EXPLICIT, followed by the value notation of the type being tagged.
The user-defined tag consists of a class and class number contained in braces. Class is UNIVERSAL, APPLICATION, PRIVATE, or CONTEXT-SPECIFIC. The UNIVERSAL class is restricted to the ASN.1 built-in types. It defines an application-independent data type that must be distinguishable from all other data types. The other three classes are user defined. The APPLICATION class distinguishes data types that have a wide, scattered use within a particular presentation context. PRIVATE distinguishes data types within a particular organization or country. CONTEXT-SPECIFIC distinguishes members of a sequence or set, the alternatives of a CHOICE, or universally tagged set members. Only the class number appears in braces for this data type; the term COONTEXT-SPECIFIC does not appear.
For example, suppose ``seats'' in AirlineFlight of the previous Section were of type SET rather than sequence. Three different ways to specify ``seats'' by tagging and one (invalid) way without tagging are shown in the Figure below.
a) seats SET { maximum INTEGER, occupied INTEGER, vacant INTEGER } b) seats SET { maximum [APPLICATION 0] INTEGER, occupied [APPLICATION 1] INTEGER, vacant [APPLICATION 2] INTEGER } c) seats SET { maximum [APPLICATION 0] IMPLICIT INTEGER, occupied [APPLICATION 1] IMPLICIT INTEGER, vacant [APPLICATION 2] IMPLICIT INTEGER } d) seats SET { maximum [0] INTEGER, occupied [1] INTEGER, vacant [2] INTEGER }
Figure: Using tagging to specify SET components. Note
that a) is invalid.
As we indicated in the above discussion of type SET, the representation in a) is invalid in ASN.1 because its instances can be ambiguous. The tagging in representations b), c), and d) overcome the problem and allow instances to be transmitted uniquely. IMPLICIT in c) indicates that an original tag is replaced by any of the three user-defined tags. EXPLICIT tagging would be appropriate when strong-type-checking is more important than compact representation; it can be used when the original tag is accompanied by a user-defined tag. The context-specific tagging in d) is similar to the APPLICATION class tagging in b) except that the class of the tag is not specifically trasmitted.
Previous: Structured Types Up: Abstract Syntax Notation Next: Useful Types
This site was developed from: Computer Networks and Open Systems An Application Development Perspective by Lillian N. Cassel Richard H. Austing Jones & Bartlett Publisher ISBN 0-7637-1122-5 |
This site is hosted by: ![]() Real World ASN.1 and XML Solutions |