Download presentation
Presentation is loading. Please wait.
Published byBlaze Bradley Modified over 8 years ago
1
9/21/2016 Presentation layer Abstract Syntax Notation #1 Basic Encoding Rules
2
9/21/2016 GET/INT/LOR 2 Outline Overview of the presentation layer Notions of syntaxes XDR BER Description languages ASN.1
3
9/21/2016 GET/INT/LOR 3 Without the presentation layer Layer 7 0 0 0 5 "5 " "83886080 " The internal data representation is different. The final representation is different Real syntax
4
9/21/2016 GET/INT/LOR 4 With the presentation layer (1) Layer 7 0 0 0 5 5 0 0 0 "5 " Layer 6 5 0 0 0 0 0 0 5 5 0 0 0 The source syntax is converted into the target syntax Both syntaxes must be known
5
9/21/2016 GET/INT/LOR 5 With the presentation layer (2) Layer 7 0 0 0 5 5 0 0 0 "5 " Layer 6 02 01 05 0 0 0 5 02 01 05 The source syntax is converted into the transfer syntax The transfer syntax is decoded into the target syntax 5 0 0 0
6
9/21/2016 GET/INT/LOR 6 Interest of the transfer syntax There is no need to know all the real syntaxes used by the communicating applications Acts as a common language between the different applications: different architectures different operating systems different programming languages
7
9/21/2016 GET/INT/LOR 7 Overview of the presentation layer The presentation layer is the 6 th of the OSI Reference Model The layer is responsible for the delivery and formatting of information to the application layer for further processing or display preservation of the semantics of data negociation of the transfer syntaxes access to the session layer
8
9/21/2016 GET/INT/LOR 8 XDR eXternal Data Representation XDR is a transfer syntax RFC 1014, then 1832 and finally 4506 (may 2006) Used by RPC (Remote Procedure Call), NFS (Network File System) Associated description language: “C” Encoding: implicit tags
9
9/21/2016 GET/INT/LOR 9 BER Basic Encoding Rules BER is a transfer syntax ITU Recommendations X.409 (original; BER and ASN.1) X.209 (BER) X.691 (BER, CER, DER) Used by many protocols (SMTP, MAP, SET, LDAP...) Associated description language: ASN.1 Encoding: explicit tags
10
9/21/2016 GET/INT/LOR 10 ASN.1 ASN.1 stands for Abstract Syntax Notation # 1 This is a language to describe, in an abstract way, data which are subject to transmission By definition, this language is independant from processors, operating systems programming languages
11
9/21/2016 GET/INT/LOR 11 ASN.1 Used by SMTP X.500 protocols MAP (Mobile Application Part) [GSM, UMTS...] Certificates X.509 PKCS#7 SET (Secured Electronic Transactions) H.323 family (VoIP) LDAP etc.
12
9/21/2016 GET/INT/LOR 12 ASN.1 The language offers: Basic data types INTEGER BOOLEAN Several String types etc. Special types to build new types SEQUENCE SET CHOICE etc.
13
9/21/2016 GET/INT/LOR 13 Example of type definitions Badge ::= INTEGER Name ::= Printable String Wage ::= REAL Deceased ::= BOOLEAN First-name ::= [APPLICATION 1] Printable String
14
9/21/2016 GET/INT/LOR 14 An ASN.1 example The following slides will show the use of ASN.1 to describe some application data. In this example, we want to describe a “Person”. A person will have: a name (family name) one (or more) first name(s) a birthday date a gender a marital status an address etc.
15
9/21/2016 GET/INT/LOR 15 Construction of a new type Person ::= description “Person” is the name of a newly created type; it begins with a capital letter ::= is the assignment symbol description is the ASN.1 of the newly created type
16
9/21/2016 GET/INT/LOR 16 Construction of a new type (2) Person ::= SEQUENCE {... } “Person” will be a sequence of different fields (name, birthday, address...) SEQUENCE specifies that the fields will be sent in the order used to describe the new type.
17
9/21/2016 GET/INT/LOR 17 Construction (3) Person ::= SEQUENCE { Printable String,... } First possibility The first field will contain the family name The second field will contain the first name Other possibility First field: first name Second field: family name
18
9/21/2016 GET/INT/LOR 18 Construction (4) Person ::= SEQUENCE { familyname Printable String, firstname Printable String,... } This description uses text identifiers (begin with small letters) to identify the different fields. “Printable String” is a basic string type
19
9/21/2016 GET/INT/LOR 19 Construction (5) Person ::= SEQUENCE { familyname Printable String, firstname SEQUENCE OF Printable String,... } The “firstname” field is a sequence of identical fields. The number of these fields is not specified
20
9/21/2016 GET/INT/LOR 20 Construction (6) Person ::= SEQUENCE { familyname Printable String, firstname SEQUENCE OF Printable String, birthday GENERALIZED TIME, gender BOOLEAN,... } GENERALIZED TIME is a basic ASN.1 type. In this example, “gender” is obviously badly specified.
21
9/21/2016 GET/INT/LOR 21 Construction (7) Person ::= SEQUENCE { familyname Printable String, firstname SEQUENCE OF Printable String, birthday GENERALIZED TIME, gender ENUMERATED {male(0), female(1), unknown(2)},... } “gender” now uses a type giving the different available values.
22
9/21/2016 GET/INT/LOR 22 Construction (8) The type Person can be used in a recursive way. In this description, the “children” and “spouse” fields need a definition of some values. This may be not suitable for all real persons. Person ::= SEQUENCE { familyname Printable String, firstname SEQUENCE OF Printable String, birthday GENERALIZED TIME, gender ENUMERATED {male(0), female(1), unknown(2)}, children SEQUENCE OF Person, spouse Person,... }
23
9/21/2016 GET/INT/LOR 23 Construction (9) The “children” and “spouse” fields are described as optional. If no values are available, the content of the fields are not sent. The fields “children” and “spouse” are both SEQUENCES ambiguity. Person ::= SEQUENCE { familyname Printable String, firstname SEQUENCE OF Printable String, birthday GENERALIZED TIME, gender ENUMERATED {male(0), female(1), unknown(2)}, children SEQUENCE OF Person OPTIONAL, spouse Person OPTIONAL,... }
24
9/21/2016 GET/INT/LOR 24 Construction (10) To avoid ambiguity, the fields “children” and “spouse” must be tagged. A tag is a user-defined numeric identifier. These identifiers are local to the type in which there are defined. Person ::= SEQUENCE { familyname Printable String, firstname SEQUENCE OF Printable String, birthday GENERALIZED TIME, gender ENUMERATED {male(0), female(1), unknown(2)}, children [0] SEQUENCE OF Person OPTIONAL, spouse [1] Person OPTIONAL,... }
25
9/21/2016 GET/INT/LOR 25 Other constructions Meal ::= [APPLICATION 0] SEQUENCE { starter [0] CHOICE { salad [0] Printable String, pâté [1] Printable String } main-course [1] CHOICE { meat [0] Printable String, fish [1] Printable String } dessert Printable String } “Meal” is tagged. Useful if there are several main types. All the fields are also tagged. This is needed here to allow the distinction between them.
26
9/21/2016 GET/INT/LOR 26 Other constructions (2) Person ::= SET { name [0] Printable String, given-name [1] Printable String, birthday GENERALIZED TIME } The three fields can be sent in any order. The two first fields must be tagged (same type).
27
9/21/2016 GET/INT/LOR 27 BER Principle: Type (tag) Length Value TypeLengthValue 1 to n bytes 1 to 127 bytes 1 to 2 1008 bytes
28
9/21/2016 GET/INT/LOR 28 BER: type field The type field contains: a class identifier (2 bits) Universal Application Private context-specific a form identifier (1 bit) atomic structured a tag field (several bits)
29
9/21/2016 GET/INT/LOR 29 BER: length field length < 127 one-byte field length > 127 N bytes (N ≤ 127) the real length is coded on 126 bytes at most. max length: 2 1008
30
9/21/2016 GET/INT/LOR 30 Information about this document Initially written with OpenOffice.org 2.1 (impress, calc, draw), then OOo 2.3.1 Fonts used in this document:
31
9/21/2016 GET/INT/LOR 31 Public Documentation licence Notice ● The contents of this Documentation are subject to the Public Documentation License Version 1.0 (the “License”); you may only use this Documentation if you comply with the terms of this License. A copy of the License is available at http://www.openoffice.org/licenses/PDL.html.http://www.openoffice.org/licenses/PDL.html ● The Original Documentation is “The presentation layer; Abstract Syntax Notation #1; Basic Encoding Rules”. The Initial Writer of the Original Documentation is Michel Gardie, Copyright © 2007. All Rights Reserved. (Initial Writer contact(s): michel.gardie@int-edu.eu). ● Contributor(s): none.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.