Service Primitives Presentation Services

www.pragsoft.com Chapter 7: The Presentation Layer 89 Other Other All remaining session functional units are also available as presentation functional units.

7.1.3. Functional Units

Figure 7.66 summarizes the available presentation functional units, which includes all of the session functional units. Kernel represents a mandatory subset of services which all presentation layer implementations must provide.

7.2. Abstract Syntax Notation One

Abstract Syntax Notation One ASN.1 is a formal language which has been designed to enable applications share a common data definition. It supports the programming language-independent and machine-independent definition of data. ASN.1 is used by the application layer for defining application data, and by the presentation layer for defining the protocol data units used for exchanging the data. A separate notation, BER, is used for specifying concrete syntaxes. These two are discussed in the next two sections.

7.2.1. Definitions in ASN.1

A set of ASN.1 data type definitions is embodied by a module. The general but simplified structure of a module definition is as follows: Module-name DEFINITIONS ::= BEGIN Type-assignment 1 ... Type-assignment n END where items appearing in italics are place holders, and items appearing in upper case throughout are literals. This definition simply states that a module definition consists of one or more type assignments. Each type assignment is of the form: Type-name ::= Type-definition A type definition may be just a reference to a simple type or consist of a structured type. An example of a simple type would be: PacketLifetime ::= INTEGER 90 Communication Networks Copyright © 2005 PragSoft Figure 7.75 summarizes the built-in simple types of ASN.1. Figure 7.75 Built-in simple types of ASN.1. Type Description BOOLEAN Represents logical data taking true or false values. INTEGER Represents all whole numbers. REAL Represents scientific notation real numbers. BIT STRING Represents arbitrary sequences of bits. OCTET STRING Represents arbitrary sequences of octets. ENUMERATED Represents a set of uniquely-named values. NULL Represents the empty set no information. A structured type is always defined in terms of other predefined or user- defined types. An example of a structured type would be: Message ::= SEQUENCE { protocol INTEGER, ack-needed BOOLEAN, source Address, destination Address, data BIT STRING } which defines a Message as an ordered sequence of five other components. Address denotes a user-defined type which we assume has already been defined. Figure 7.76 summarizes the structured types of ASN.1. Figure 7.76 Built-in structured types of ASN.1. Type Description SET A collection of items of possibly different types and in no particular order. SET OF Same as SET except that all the items are of the same type. SEQUENCE A collection of items of possibly different types but in a specific order. SEQUENCE OF Same as SEQUENCE except that all the items are of the same type. CHOICE A data type which may assume one of several types. SELECTION An item whose type is previously defined as a CHOICE type. ANY Represents any valid ANS.1 type. TAGGED Represents a way of identifying multiple occurrences of the same type. Tagged types are used to resolve potential ambiguity in type definitions. For example, had Message been defined as a SET instead of a SEQUENCE, an ambiguity would arise between source and destination components, because both these are of the same type. This presents no problems at the abstract syntax level, www.pragsoft.com Chapter 7: The Presentation Layer 91 but as far as the transfer syntax is concerned, source and destination can occur in any order and are therefore indistinguishable. The ambiguity is resolved by simply tagging the clashing components: Message ::= SET { protocol INTEGER, ack-needed BOOLEAN, source [0] Address, destination [1] Address, data BIT STRING } Tags represent the general mechanism for encoding type information for use in the transfer syntax. Overall, there are four classes of tags. These are summarized in Figure 7.77. Explicit use of universal tags is redundant because each of these has a corresponding built-in type. So, for example, instead of [UNIVERSAL 1] which represents the built-in boolean type, the keyword BOOLEAN is used. Figure 7.77 The four tag classes of ASN.1. Tag Class Usage Description Universal Type-name ::= [UNIVERSAL n] Type-name Application-independent types of general use. It represents the simple and structured built-in types described earlier. Application-wide Type-name ::= [APPLICATION n] Type-name Application-specific types which have been devised to serve the needs of application layer standards. Context-specific [k] Type-name ... [n] Type-name Used for distinguishing between the clashing types of the components of a group. Private-use Type-name ::= [PRIVATE n] Type-name Reserved for the private use of applications, outside the scope of the standards.

7.2.2. Basic Encoding Rules

The Basic Encoding Rules BER of ASN.1 provide a mechanism for mapping an abstract syntax definition of data in ASN.1 to a representative transfer syntax. The transfer syntax is defined as a set of transfer types, which are specified as data elements. A data element consists of three fields: • Identifier . This uniquely identifies the data type. It is an encoding of a tag class, a tag number, and a flag which indicates the form of the element as being primitive or structured see Figure 7.78.