CS475 – Networks Assignments Lecture 23 Chapter 7: End-to-End Data

advertisement
CS475 – Networks
Lecture 23
Chapter 7: End-to-End Data
Assignments
• Reading for Lecture 24: Section 7.2
Chapter 7: End-to-End Data
A sender and receiver must agree to a message or
We may want to use data compression to encode the data as
__________________________ format. How do we send
efficiently as possible for network transmission. However,
traditional (integers, floating-point numbers, characters, arrays,
compression and decompression processing places increased
structures) and multimedia (audio, image, video) data?
demands on the end hosts.
7.1 Presentation Formatting
Data must be encoded into a form suitable for transmission over Encoding is necessary because computers represent data in
the network. It is decoded at the receiver. (Encoding/decoding
different ways. For example, the native size of an integer may
are also known as marshalling/unmarshalling.)
differ between computers and languages. Computers also have
different ____________________.
7.1.1 Taxonomy – Data Types
Marshalling systems differ in the data types they support. At the
lowest level is support for the base types (integers, floats,
characters).
At the next level is support for flat types – structures and arrays.
At the highest level is support for complex types that contain
pointers. The pointer can not be simply copied across. The data
pointed to must also be copied. This is known as flattening or
_______________________.
Argument marshalling: converting, packing and linearizing
11/15/2011
Page 1 of 3
7.1.1 Taxonomy – Conversion Strategy
7.1.1 Taxonomy – Tags
Some systems convert all data to canonical intermediate form.
Tags can be sent with the data to indicate the type and length of a
For example a system may require that all integers be sent in
data item. A tag can also be used to indicate the endianess of the
big-endian regardless of the endianess of either the source or
data in a receiver-makes-right system.
receiver.
If tags are not used then the receiver must be programmed to
The alternative approach is ____________________________
expect data of a particular type in a particular order.
in which the sender transmits data in its native form. The
receiver is responsible for translating the data to its own local
A 32-bit integer encoded in a tagged message
form.
7.1.1 Taxonomy – Stubs
Stubs are typically used to implement argument marshalling in
support of ______________. They may be either compiled or
interpreted. Compiled stubs are more efficient while interpreted
stubs are more flexible.
Interpreted stubs translate data according to a data description
file. Changing the data description file does not require
recompilation.
A stub compiler produces stubs from an interface
description.
7.1.2 Examples - XDR
External Data Representation (XDR) is used with SunRPC for
argument _________________________.
•
It supports the entire C type system except for function
pointers.
Example XDR encoding of a structure containing a 32-bit
•
It uses a canonical intermediate form.
integer, a 7 character string, and a 3 element 32-bit integer
•
It does not use tags (except to indicate array lengths)
•
It uses compiled stubs.
11/15/2011
Page 2 of 3
array.
7.1.2 Examples - ASN.1
Abstract Syntax Notation One (ASN.1) is an ISO standard that
defines a representation (the Basic Encoding Rules or BER) for
ASN.1/BER encoding of a 32-bit integer. The value is preceded
data sent over a network.
It supports all C types except function pointers, uses a canonical
by TYPE and LENGTH tags.
intermediate form, and it uses tags. The stubs can be either
compiled or interpreted.
ASN.1/BER LENGTH tags can be of variable size. If the data
Compound types (structures) can be created by means of
item is less than 128 bytes in length, the LENGTH tag is a single
___________________ in ASN.1/BER.
byte. If the data item is longer than 127 bytes, that LENGTH tag
is multiple bytes long. The MSB of the leading byte is one. The
remaining 7 bits indicate the length of the LENGTH tag.
7.1.2 Examples - NDR
Network Data Representation (NDR) uses receiver makes right. NDR inserts an __________________________ tag (shown
It supports the C type system. Data items are not tagged.
below) at the front of each message so that the receiver knows
Compiled stubs are generated from the Interface Description
how to translate the data from source format to a local format.
Language (IDL).
7.1.3 Markup Languages (XML)
In XML all data are tagged and represented using text.
The XML data types and compound data type formats are
<?xml version=”1.0”?>
<employee>
<name>John Doe</name>
<title>Head Bottle
Washer</title>
<id>123456789</id>
<hiredate>
<day>5</day>
<month>June</month>
<year>1986</year>
</hiredate>
</employee>
defined in an XML Schema Definition (XSD) file. XSDs are
also written in XML.
XML messages are easy to read and edit. They are naturally
___________________ between architectures. They are
inefficient (compared to binary representations of data) and slow
to parse.
In Class Exercise
Write a C++ program that writes your name (first and last
network to another computer. Simulate this by copying the
names), your age (as an integer) and the first 5 digits of pi
memory block to a new location (using memcpy) and then have
(3.1415) to memory using XDR (refer to the xdr man page).
your program read the values from the new location and display
Normally this block of memory would then be sent across the
them to standard output. Email program to instructor by Thurs.
11/15/2011
Page 3 of 3
Download