PRESENTATION LAYER Communicating computers represent information in different ways Character code: ASCII/EBCDIC? Numbers size 1 s complement/2 s complement real format: mantissa/exponent sizes, is exponent a power of 2, 16,? Data structures arrays, records, dynamic data structures Data compression reduces line charges reduces transport delays
Network security systems need to prevent eavesdropping prevent unauthorised messages prevent unauthorised deletion of messages ensure identity of sender
DATA REPRESENTATION AND ASN.1 Data structures used by an application may change during session context n - set of data structures in use at time n presentation layer allows context definition (ASN.1) context changing Specify abstract syntax (data comprises these items) Specify transfer syntax (these items are formatted thus)
DATA STRUCTURES consider a banking transaction sender must unambiguously transmit source bank and destination bank name, address, branch no, account numbers amount, currency, exchange rate date, time application uses ASN.1 to define data types similar to Pascal data type definitions sends definition to receiver
ASN.1 primitives: INTEGER BOOLEAN BIT STRING e.g. 00101010 B or 2A H - Hex version OCTET STRING ANY (union of all types) NULL OBJECT IDENTIFIER (e.g. name of a library of ASN.1 definitions) [iso standard 8571 part 4 ftam-pci(1)] tree-structured name File Transfer, access and Management e.g. for updating a database on a different type of machine Protocol Control Information
Constructors SEQUENCE SEQUENCE OF SET SET OF CHOICE list of various types list of one type (SEQUENCE OF INTEGER) unordered collection of various types unordered collection of one type one type from a given list
An RJE application might use this ASN.1 definition Job ::= SEQUENCE{ header body trailer } Account-PDU, SEQUENCE OF Command-PDU, Termination-PDU Command-PDU ::= CHOICE{ Account-PDU Local-Command ::= Joblib.local etc. ::= Joblib.account Local-command, Remote-command } library module
TRANSFER SYNTAX Layer 6 header includes ASN.1 type with every value transmitted So no need for lexical analysis at destination ASN.1 TYPE IDENTIFIER 1 2 3 4 5 6 7 8 Class Type Tag Known by this app Universal Application disambiguates variant records Context-specific used within the organisation Private 0=Primitive, 1 = Constructed 1 = Boolean 2 = Integer etc Known by everyone LENGTH CONTENTS Class and tag have some mutually redundant info. Can use both (gives error-check) or omit one
Application entity ASN.1 definition data application syntax 1 application syntax 2 Application entity ASN.1 definition data APDU transfer syntax APDU Presentation entity PPDU Presentation entity Non-universal parts of an ASN.1 negotiated beforehand
DATA COMPRESSION run-length encoding 11111111111111111000000000000011111110000 17 13 7 4 00010001 1 00001101 0 00000111 1 00000100 0 can encode 256-bit sequence as 9 bits =41 bits =36 bits Many files contain long runs of zeros run-length encode zeros only
DATA ENCRYPTION & DECRYPTION occur at level 6
Huffman coding 33 Analyse text & construct tree Put most common unplaced character in right subtree Put other charcters in left subtree 8 18 Character codes: Path to character determines code add 0 for each rt branch, add 1 for each left branch d 3 a 5 t 10 e 15 so e -> 0 Relative frequency of occurrence of the letter d t -> 10 a -> 110 d -> 111