Download presentation
Presentation is loading. Please wait.
Published byHadian Atmadja Modified over 6 years ago
1
7. End-to-end data Rocky K. C. Chang Department of Computing
The Hong Kong Polytechnic University 15 April 2016
2
The problem From the network’s perspective, application programs send messages to each other. Each of these messages is just an uninterpreted string of bytes. From the application’s perspective, however, these messages contain various kinds of data—arrays of integers, video frames, lines of text, digital images, and so on. In other words, these bytes have meaning. We now consider the problem of how best to encode the different kinds of data that application programs want to exchange into byte strings.
3
Presentation formatting
Format the representation used by the application program into a form that is suitable for transmission over a network and vice versa. The sending program translates the data it wants to transmit into a message that can be transmitted over the network. Marshalling (encoding) application data into messages On the receiving side, the application translates this arriving message into a representation that it can then process. Unmarshalling (decoding) messages into application data
4
Presentation formatting
Presentation formatting is a transformation between the data representation used by programs and the data representation suitable for transmission over a network. Application Application data data Presentation Presentation encoding decoding … Message Message Message
5
Presentation formatting
Difficulties Representation of base types floating point: IEEE 754 versus non-standard integer: big-endian versus little-endian (e.g., 34,677,374) Implementation by different languages or compilers
6
Big endian vs little endian
(2) (17) (34) (126) Big- endian 1 1 1 1 1 1 1 1 1 1 (126) (34) (17) (2) Little- endian 1 1 1 1 1 1 1 1 1 1 1 High Low address address Big-endian and little-endian byte order for the integer 34,677,374
7
Taxonomy: Data types base types (e.g., ints, floats); must convert
flat types (e.g., structures, arrays); must pack complex types (e.g., pointers); must serialize
8
Taxonomy: conversion strategy
Once the type system is established, the next issue is what conversion strategy the argument marshaller will use. There are two general options: canonical intermediate form and receiver-makes-right Conversion strategy canonical intermediate form local format 1 external format local format 2 receiver-makes-right (an N x N solution) local format 1 local format 2
9
Taxonomy: tagging The third issue is how the receiver knows what kind of data is contained in the message it receives. There are two common approaches: tagged and untagged data. A tag is any additional information included in a message—beyond the concrete representation of the base types—that helps the receiver decode the message. The alternative is not to use tags. How does the receiver know how to decode the data in this case? It knows because it was programmed to know.
10
Taxonomy: tagging type = len = 4 value = 417892 INT
A 32-bit integer encoded in a tagged message
11
Taxonomy: stubs a piece of code that implement argument marshalling
compiled interpreted Interface descriptor for Procedure P Call P P Arguments Specification Arguments Client Code Stub Code Server stub compiler stub Marshalled Marshalled arguments arguments RPC RPC Message
12
Examples XDR: eXternal Data Representation
Defined by Sun for use with SunRPC C type system (without function pointers) Canonical intermediate form Untagged (except array length) Compiled stubs
13
Examples ASN.1: Abstract Syntax Notation One An ISO standard
Essentially the C type system Canonical intermediate form Tagged Compiled or interpreted stubs BER: Basic Encoding Rules <tag, length, value> type length type length value type length value value
14
Examples NDR: Network Data Representation Defined by DCE
Essentially the C type system Receiver-makes-right (architecture tag) Individual data items untagged Compiled stubs from IDL
15
Markup Languages – XML Markup languages, of which HTML and XML are both examples, take the tagged data approach to the extreme. Data is represented as text, and text tags known as markup are intermingled with the data text to express information about the data. In the case of HTML, markup merely indicates how the text should be displayed; other markup languages like XML can express the type and structure of the data
16
Markup Languages – XML <?xml version="1.0"?> <employee>
<name>John Doe</name> <title>Head Bottle Washer</title> <id> </id> <hiredate> <day>5</day> <month>June</month> <year>1986</year> </hiredate> </employee>
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.