260 likes | 460 Views
Abstract Syntax Notation ASN.1 Week-5. Ref: “SNMP…” by Stallings (Appendix B). ABSTRACT SYNTAX NOTATION ASN.1. Formal Language developed by ITU-T and ISO for defining abstract syntax of application data. Abstract Syntax.
E N D
Abstract Syntax NotationASN.1Week-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
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
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.
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
Transfer Syntax • The way in which data are actually represented in terms of bit patterns while in transit between applications.
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.
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.
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.
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.
ASN.1 Concepts • Module – a basic building block • Define data structures, the name of the module can be used to reference the structure.
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
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
Basic form of Module <modulereference> DEFINITIONS::= BEGIN EXPORTS IMPORTS AssignmentList END
<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
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
Abstract Data Types Four categories of types • Simple • Structured (has components) • Tagged • Other
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
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
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 )
Abstract Data Types Tagged types • Used to assign new type names Eg Employee_name Customer_name which are the same type
Abstract Data Types Other types • CHOICE and ANY are data types without tags. • The type is assigned at execution.
Macro Definitions • ASN.1 Permits the definition of macros to extend the syntax to define new types and their values.
Macro Definitions • A macro definition has the following form: <macroname> MACRO ::= BEGIN TYPE NOTATION ::= <new-type-syntax> VALUE NOTATION ::= <new-value-syntax> <supporting productions> END • <macroname> is written in upper case
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 of type; length; value