Types and values

The fundamental concept of ASN.1 are interrelated notion of type and value. A type is a non-empty set of values and represents a potential for conveying information. Only values are actualy conveyed, but their type governs the domain of possibilities. A type can have only a few values (e.g. Boolean) and capable to transfer just a few distinctions. On the other hand, there are types having lots of values (e.g. Real) offering very fine distinctions.

A type is called a subtype, if its values are subset of another type called in this case a parent type, or abreviated parent. For example, a type natural number could be defined as a non-negative subset of whole number type, which is equal to Integer.

In most of higher level languages a structural type can be defined. The same is it with ASN.1. All the types are divided into two main groups: simple and structured. Imagining simple types being bicks then structured type becomes anything thac can be built of bricks - from a fence to skyscraper (thoug they have never built one of bricks...;-).

As can be seen from mentioned, user can define a certain type by one of possible ways, can give it a name and then reference this type by given name. These types are called defined types. Types brought by ASN.1 itself are then called built-in types. But it is still not enough, there are also so-called useful types, brought to user by ASN.1 on built-in basis, which are potentially useable in a wide range of applications.

ASN.1 alows two styles of notation: type notation, where appropriate types and/or subtypes are used in structures; and value notation, which alows arbitrary values of designed types to be written down. Here are short and simple examples, on which an assignment can be seen (and hopefuly understood), too:

To explain both assignment syntaxes: a type assignment consist of three parts:

  1. <constructed type reference name>, e.g. StudentNumber
  2. ::=, i. e. assignment sign, often read as 'is defined as'
  3. <appropriate type notation>, e.i. built-in type, subtype or defined type

Value assignment is very similar, but includes one item more:

  1. <value reference>, i.e. variable name, e.g. myId
  2. <type>, e.g. StudentNumber
  3. ::=, that funny assignment symbol
  4. <assigned value>

The definition of types and values is almost the only thing that has to be done, so let's have a closer look at subtypes and their definitions - on the next page of course.