abstract syntax notation asn.1 week-5 ref: “snmp…” by stallings (appendix b)

25
Abstract Syntax Notation ASN.1 Week-5 Ref: “SNMP…” by Stallings (Appendix B)

Upload: alexina-arnold

Post on 13-Jan-2016

220 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Abstract Syntax Notation ASN.1 Week-5 Ref: “SNMP…” by Stallings (Appendix B)

Abstract Syntax NotationASN.1Week-5

Ref: “SNMP…” by Stallings (Appendix B)

Page 2: Abstract Syntax Notation ASN.1 Week-5 Ref: “SNMP…” by Stallings (Appendix B)

ABSTRACT SYNTAX NOTATIONASN.1

Formal Language developed by ITU-T and ISO for defining abstract syntax of application data

Page 3: Abstract Syntax Notation ASN.1 Week-5 Ref: “SNMP…” by Stallings (Appendix B)

Abstract Syntax

Describes the generic structure of data independent of any encoding technique used to represent the data.

The syntax allows data types to be defined and values of those types to be specified

Page 4: Abstract Syntax Notation ASN.1 Week-5 Ref: “SNMP…” by Stallings (Appendix B)

Data Type

A named set of values. A type may be simple, which is defined by

specifying the set of values, or structured, which is defined in terms of other types.

Page 5: Abstract Syntax Notation ASN.1 Week-5 Ref: “SNMP…” by Stallings (Appendix B)

Some Terms and Definitions…

Encoding The complete sequence of octets used to

represent a data value.

Encoding Rules Rules for encoding the data corresponding to the

specific transfer syntax

Page 6: Abstract Syntax Notation ASN.1 Week-5 Ref: “SNMP…” by Stallings (Appendix B)

Transfer Syntax The way in which data are actually

represented in terms of bit patterns while in transit between applications.

Page 7: Abstract Syntax Notation ASN.1 Week-5 Ref: “SNMP…” by Stallings (Appendix B)

Why use ASN.1 ?

Application data is supported by representing information in an abstract form independent from any specific representation

Many similarities to the data-definition type languages eg Pascal and to grammars used to define them eg BNF.

Page 8: Abstract Syntax Notation ASN.1 Week-5 Ref: “SNMP…” by Stallings (Appendix B)

Abstract syntax is used for the exchange of information between application components in different systems.

Information within a system must be mapped from abstracted form into some form for local storage and presentation to the user/application.

Page 9: Abstract Syntax Notation ASN.1 Week-5 Ref: “SNMP…” by Stallings (Appendix B)

Deals with the two problems that relate to data representation in heterogeneous, networked environments:

Common representation for the exchange of data between differing systems

Internal to a system, an application uses its own representation of data. This scheme deals with differences between local application entities.

Page 10: Abstract Syntax Notation ASN.1 Week-5 Ref: “SNMP…” by Stallings (Appendix B)

Transfer syntax must support Abstract syntax

Transfer syntax may have characteristics that are not related to the abstract syntax - eg, compression, encryption. Choice of transfer syntax used depends upon cost and security considerations.

Page 11: Abstract Syntax Notation ASN.1 Week-5 Ref: “SNMP…” by Stallings (Appendix B)

ASN.1 Concepts

Module – a basic building block Define data structures, the name of the

module can be used to reference the structure.

Page 12: Abstract Syntax Notation ASN.1 Week-5 Ref: “SNMP…” by Stallings (Appendix B)

ASN.1 Lexical Conventions

Layout is not significant (multiple spaces and blank lines can be ignored)

Comments delimited by - - at beginning and the end of the comment or ended by the end of the line

Identifiers (names), type references (type names), and module names can be constructed from letters, digits and hyphens

Page 13: Abstract Syntax Notation ASN.1 Week-5 Ref: “SNMP…” by Stallings (Appendix B)

ASN.1 Lexical Conventions

An identifier begins with a lower case letter A type reference or module name begins with a

uppercase letter A built-in type (commonly used type) consists of

all capital letters

Page 14: Abstract Syntax Notation ASN.1 Week-5 Ref: “SNMP…” by Stallings (Appendix B)

Basic form of Module

<modulereference> DEFINITIONS::=

BEGIN

EXPORTS

IMPORTS

AssignmentList

END

Page 15: Abstract Syntax Notation ASN.1 Week-5 Ref: “SNMP…” by Stallings (Appendix B)

<modulereference> is the module name

EXPORTS construct indicates which definitions in this module may be imported by other modules

IMPORTS construct indicates which type and value definitions from other modules are to be imported into the module

Page 16: Abstract Syntax Notation ASN.1 Week-5 Ref: “SNMP…” by Stallings (Appendix B)

The assignment list consists of type assignments, value assignments, and macro definitions

Type and value assignments have the form:<name> ::= <description>eg of a type definition

SerialNumber ::= INTEGER

Page 17: Abstract Syntax Notation ASN.1 Week-5 Ref: “SNMP…” by Stallings (Appendix B)

Abstract Data Types

Four categories of types Simple Structured (has components) Tagged Other

Page 18: Abstract Syntax Notation ASN.1 Week-5 Ref: “SNMP…” by Stallings (Appendix B)

Abstract Data Types

Four classes of tags UNIVERSAL: general, application independent

APPLICATION: relevant to particular application

Context-specific: limited to a specific context

Private: defined by users, non-standard

Page 19: Abstract Syntax Notation ASN.1 Week-5 Ref: “SNMP…” by Stallings (Appendix B)

Abstract Data Types

Simple types Defined by specifying the set of its values

(may be in binary or Hexadecimal, or some other form)

eg BOOLEAN, INTEGER, BIT STRING, REAL

Page 20: Abstract Syntax Notation ASN.1 Week-5 Ref: “SNMP…” by Stallings (Appendix B)

Abstract Data Types

Structured types Consist of components.

There are four structured types: SEQUENCE )ordered list of values SEQUENCE OF ) SET )unordered list of values SET OF )

Page 21: Abstract Syntax Notation ASN.1 Week-5 Ref: “SNMP…” by Stallings (Appendix B)

Abstract Data Types

Tagged types Used to assign new type names

Eg Employee_name

Customer_name

which are the same type

Page 22: Abstract Syntax Notation ASN.1 Week-5 Ref: “SNMP…” by Stallings (Appendix B)

Abstract Data Types

Other types CHOICE and ANY are data types without

tags. The type is assigned at execution.

Page 23: Abstract Syntax Notation ASN.1 Week-5 Ref: “SNMP…” by Stallings (Appendix B)

Macro Definitions

ASN.1 Permits the definition of macros to extend the syntax to define new types and their values.

Page 24: Abstract Syntax Notation ASN.1 Week-5 Ref: “SNMP…” by Stallings (Appendix B)

Macro Definitions

A macro definition has the following form:<macroname> MACRO ::=BEGINTYPE NOTATION ::= <new-type-syntax>VALUE NOTATION ::= <new-value-syntax><supporting productions>END

<macroname> is written in upper case

Page 25: Abstract Syntax Notation ASN.1 Week-5 Ref: “SNMP…” by Stallings (Appendix B)

Basic Encoding Rules

ASN.1 types are encoded as a string of octets according to ITU-T X.209 and ISO 8825 Encoding in the form oftype; length; value