Title: The Application Layer
1The Application Layer
2Layers
- Communication is logically on the application
layer - Only that has to be considered
- except for speed and cost
- Error correction might be on application layer,
but is usually on lower layers - Security is important here
3Client-Server and Peer-to-Peer
Server always on Client and Peers not
P2P Skype, BitTorrent IM partly, messages yes,
setupaddr. not
4Problems
- No throughput guaranties
- problems with bandwidth-sensitive application,
like many multimedia applications - some may use adaptive coding techniques (reducing
quality) to match available throughput - No timing (delay or jitter) guaranties
- problems for real-time streaming multimedia
- like telephony, multi-layer games,
teleconferencing - no solution for this except special networks
- non-real time streaming multimedia (like a movie
replay) can buffer at the receiver - No security
- this can be cured by SSL(secure socket layer)
- also by network layer security methods
5Domain Name System (DNS)
Programs refer to hosts and their resources not
by an IP address, but by an ASCII strings like
hera.cs.ru.nl. DNS is a hierarchical,
domain-based naming scheme and a distributed
database system for implementing the name-IP
conversion. The Internet is divided into several
top-level domains, generic (com, edu, gov, int,
mil, net) and countries (us, nl, etc. according
ISO 3166). Each domain is named by the path
upward from it to the unnamed root cs.ru.nl.
Domain names are case insensitive, each component
can be up to 63 characters and the total length
may not exceed 255 characters.
6Distributed hierarchical database
- Data for Name-IP pairs are distributed over a
hierarchical organized system of servers - Root DNS servers (13 now)
- gives the IP address of the servers for the next
level - actually each one is a cluster of servers for
security and reliability reasons - Top level domain (TLD) DNS servers
- for each of the top level domains
- com, edu, etc.. and all the countries
- give the IP addresses of the servers for the
level below - Authoritative DNS servers
- every organization with publicly available hosts
needs one - contain the name-IP pairs (and more information)
7Recursive lookup
- Requests go via the local DNS server first to a
root DNS server, which forwards the request to
the relevant TLD DNS server, which forwards it to
the relevant authoritative DNS server. - The answer goes back the same route.
- Name-IP pairs may be cached
- In case TLD only knows dns.umass.edu two more DNS
messages are needed.
8Iterative lookup
Requests and answers go now directly from the
local DNS server into the hierarchy. This is the
most often used method. Each DNS server caches
received (name-IP) pairs for a certain amount of
time.
9DNS services
- host name IP conversion
- domain name (cucg.gh) DNS server (dns.cucg.gh)
names - host aliasing
- simple names for a long canonical name
- relay1.west-coast.enterprise.com
www.enterprise.com - mail server aliasing
- e.g. to use theo_at_enterprise.com
- load distribution over replicated servers of e.g.
cnn.com - the DNS contains a list of IP numbers
- the total list is returned but the order is
rotated each time - the receiver usually takes the top of the list
- used for web and email servers
- recently also more complicated use for replicated
servers, taking geographic distribution into
account
10Resource DNS records
- These are 4-tuples
- (Name, Value, Type, TTL)
- TTL (time to live) indicates how long it may be
cached - Types
- A Name is hostname, Value the IP address
- NS Name is a domain, Value the name of an
authoritative DNS server for it - CNAME Name is an alias hostname, Value its
canonical name - MX Name is an alias name for a mail server,
Value is its canonical name - there are more, like PTR (IP-gthostname) and INFO
(information over the host, like type and OS)
11DNS messages
Questions are kept when answers are send The 16
bits identification allows to separate different
requests The flags indicate e.g. request or reply
message, recursion or not, etc.
12Further DNS developments
- reverse lookup via special domains, eg
100.10.30.194.in-addr.arpa - wildcard () in domain names
- ExtendedDNS removes the length limitations
- IDNA allowing non-ASCII characters in domain
names - DNSSEC adding security to DNS
- new top level domains, like museum, travel, etc.
- more complicated use for replicated servers,
taking geographic distribution and loads on the
servers into account
13Email overview
- SMTP Simple Mail Transfer protocol
- transfer of email messages to user mailboxes
- uses TCP on port 25
- POP3, IMAP or HTTP are protocols used to read the
mail - POP3 transfers email messages to the user agent
on the PC - IMAP and HTTP (Webmail) leaves them on the
server, allowing the user to manipulate them
14POP3 and IMAP
Webmail access mail in POP3 inbox using forms on
webpages.
15Electronic Mail systems
- 2 subsystems
- user agents, which allow people to send and read
email - message transfer agents, move messages from
source to destination. - Typically 5 basic functions are supported
- Composition refers to the process of creating
messages and answers. - Transfer refers to moving messages from the
originator to the recipient. - Reporting has to do with telling the originator
what has happened to the message. - Displaying sometimes conversion is required or a
special viewer must be invoked - Disposition concerns what the recipient does with
the messages after receiving it. - Commands are needed to create and destroy
mailboxes, inspect their contents, insert and
delete messages, and so on. - A key in all modern email systems is the
distinction between - envelope contains the contents and the
information for transporting it - contents
- the header, containing control information for
the user agents - the body which is entirely for the human
recipient.
16Message Formats RFC 822
17MIME RFC 2045
- Multipurpose Internet Mail Extensions
- Added international languages non-text
- Languages with accents (French, German).
- Languages non-Latin alphabets (Hebrew, Russian).
- Languages without alphabets (Chinese, Japanese).
- Messages not containing text (audio, images).
18WWW HTTP
HyperText Transfer Protocol, to transfer pages
between a client and a server Stateless server
maintains no information about the client
- pair of 1 request and 1 response
- originally per pair 1 TCP connection was
established and closed - now more pairs / connection (a persistent
connection) - less overhead, better settings of self-learning
parameters
19HTTP request message
Request are in ASCI text, e.g. GET
/somedir/page.html HTTP/1.1 Host www.cucg.gh,
the server name (more than 1 per IP) Connection
Close User-agent Mozilla/4.0 Accept-language fr
20HTTP Methods
- Conditional Get with If-Modified-Since header
- PUT, POST and DELETE allows changing a site using
HTTP
21HTTP Message Headers
The accept headers tell the server what the
client is willing to accept in case it has a
limited repertoire of what it can handle. It also
allows the server to send back a page in a
certain language, if it has a choice.
22Browser
- A web page may contain HTML code, images in GIF
or JPEG format, sound in MP3 format, video in
MPEG format, documents in PDF, MSWord or other
formats, or information in many other formats. - Some are handled directly by a browser.
- Some by a plug-in, a code module that the browser
fetches from disk and installs as an extension to
itself. - For others the browser starts up a helper
application as a separate process.
23Client side actions
- Clicking in a browser on http//www.cs.ru.nl/ths
/index.html. - The steps that occur then are
- The browser determines the URL (by seeing what
was selected) - The browser asks DNS for the IP address of
www.cs.ru.nl - DNS answers with the IP number
- The browser makes a TCP connection to that number
on port 80 - It then sends a GET /ths/index.html command
- The www.cs.ru.nl server sends the file index.html
- The TCP connection is released
- The browser displays all the text in index.html
- The browser fetches all images indicated in
index.html, by establishing a TCP connection for
each of them, and displays them.
24URLs Uniform Resource Locaters
A URL consists of 3 parts a protocol, the
DNS name of the host, and the file name.
25Server side actions
- This performs the following steps in its main
loop - Accept a TCP connection from a client.
- Resolve the name of the page requested.
- Authenticate the client if needed.
- Perform access control on the client, can the
requested page be sent given the client's
identity and location. - Perform access control on the web page, some
pages may only been sent to clients on particular
domains, e.g. inside the company. - Check the cache if the page is there, otherwise
get it from disk. - Determine the MIME type and include it in the
header of the reply. - Other possible tasks, like building a user
profile, gathering statistics or making an entry
in a logfile. - Return a reply, either the requested file or
error information - Release the TCP connection
26Statelessness and Cookies
- For newer applications the server likes to know
more about the user requesting pages e.g. to keep
information between request - IP numbers are not suitable for that, because of
dynamic IP addresses and NAT and there may be
more than one user on a computer. - When a client requests a page, the server may
send in the reply header a cookie a small, at
most 4 KB, text string. - Browers may accept it. When the browser later
sends a request it checks whether it has cookies
for the domain the request is for. It includes
them in the request so the server can use them.
27HTML HyperText Markup Language
By embedding the markup commands within each HTML
file, a browser may reformat any web page. A web
page can be shown full screen on a 1024 x 768
display with 24-bit color but also in a small
window on a 640 x 480 screen with 8-bit color.
The designer of a web page can indicate how the
page can be best displayed, but the client can
overwrite these settings. In contrast to Adobe
Acrobat and Flash. HTML is an application of SGML
(Standard Generalized Markup Language), XHTML
uses XML (Extensible Markup Language).
28Cascaded style sheets
HTML is constantly changing. Version 1.0 was the
de- facto standard used in the Mosaic browser.
When new browsers came along version 2.0 became
an Internet standard. Version 3.0 added many new
features, including tables, toolbars and cascaded
style sheets. This gives page designers more
control over the desired appearance of pages on
browsers. The semantics of a text are defined in
the HTML file, while a style sheet defines the
appearance h1 color FF0000 h2
color 0000FF body color 000000
background ffffff .red color FF0000
e.g. ltp classredgtlt/pgt HTML 4.01 is now the
current version.
29XML
XML (eXtensible Markup Language) describes Web
content in a structured way. On the left a
structure called book_list, a list of books, each
having 3 fields, is defined. The structure could
have repeated fields (e.g. multiple authors),
optional fields (e.g. title of included CD-rom)
and alternative fields.
30XSL
How the XML page is to be formatted and displayed
on a screen is determined by a XSL (eXtensible
Style Language) file. It looks like HTML but has
stricter syntax requirements, a browser should
reject it if for instance a closing tag like
lt/thgt is missing. XSL commands are given with a
xsl tag, like ltxslxxxxgt. The for-each command
iterates over the given structure, the list of
books. XHTML (X from eXtended) is essentially
HTML 4 reformulated in XML. It needs a XSL file
to provide display meaning to its tags. Strict
performance to the syntax is required, like
closing tags, tags and attributes in lower case,
attributes in quotation marks and proper nesting
of tags.
31Forms for interaction
Input is returned in a string added to the
URL http//www.ru.nl/cgi-bin/ query?namejancity
a A indicates a space, a 2B indicates a
typed in , etc.
On the server the CGI (Common Gateway Interface)
starts the script (or program) 'query' with the
string after the ? as its parameter. The script
does its work, e.g. search a database, and
returns its result as a HTML page.
32Server-side Dynamic Web Pages
Another way to generate dynamic content is to
embed little scripts inside HTML pages to be
executed by the server to generate the page. A
popular language for this is PHP (PHP Hypertext
Preprocessor). To use it the server has to
understand PHP, usually page containing PHP have
file extension 'php' rather than 'html' or 'htm'.
JSP (Java Server Pages) is similar to PHP,
except that the dynamic part is written in the
JAVA programming language. ASP (Active Server
Pages) is Microsoft's version, using Visual Basic
Script for generating the dynamic content.
33with PHP
The PHP commands are included in the HTML tag
lt?php ... ?gt. On the top a form with 2 entry
fields. Below is the 'action.php' file with the
PHP commands. They have access to the information
filled in the form using the name of the fields,
e.g. age. They produce a text string which is
included in the output send to the client. PHP
is a powerful programming language oriented
towards interfacing between the WEB and a server
database. It is open source and freely available,
and specially designed to work well with Apache,
which is also open source and is the world's most
widely used Web server.
34Client-Side Dynamic Web Pages
Here a program contained in a web page is
executed by the browser and the result is
displayed. No information is send to the
server. JavaScript can be used for this, a
scripting language very loosely inspired by some
ideas from JAVA. It is a full-blown programming
language, with variables, strings, arrays,
objects, functions, and all the usual control
structures. Another way to make web pages highly
interactive is through the use of applets. These
are small JAVA programs embedded with the
'applet' tag and executed by a Java Virtual
Machine. As they are interpreted, the interpreter
can prevent them from doing Bad Things. In theory
at least, in practice many bugs were
found. Microsoft's answer to SUN's applet was
allowing web pages to hold ActiveX controls. They
are faster than applets, but only run on Window
machines.
35Client-Side Javascript
It has the ability to manage windows and frames,
set and get cookies, deal with forms and handle
hyperlinks. As these things are rather internal
to browsers, and often different for different
browsers and versions, it is difficult to write
JavaScript programs which work correctly for all
browsers, versions and platforms.
It can also track mouse movements and actions.
When the mouse is over a link, a window with a
certain image is displayed. It is embedded in a
HTML page using the 'script' tag or inline at
certain locations.
36Client-Server overview
Cascaded Style Sheets are part of HTML. Plug-ins
or helpers can display other contents, such as
ps, pdf, video, sound and images, e.g. SVG
(scalable vector graphics). SGI scripts can be in
various languages, Perl, Python, C, etc.
37WAP The Wireless Application Protocol
WAP provides mobile phones or PDAs with a
built-in screen for wireless access to email and
Web pages. It is essentially a protocol stack for
accessing the Web, optimized for low-bandwidth
connections using wireless devices having a slow
CPU, little memory and a small screen. The lowest
layer provides a data rate of 9600 bps. WDP is in
essence UDP. WTLS is a subset of Netscape's SSL
(Secure Socket Layer). WTP replaces TCP, which is
not used over the air link for efficiency
reasons.
38WAP architecture
WSP is similar to HTTP/1.1 but with some
restrictions and extensions for optimization
purposes. WAE is a microbrowser. Its does not use
HTML but WML (Wireless Markup Language), which is
an application of XML. In principle, a WAP device
can only access pages that have been converted to
XML. An on-the-fly filter from HTML to WML is
used to increase the set of pages available to
the user. WAP-1.0 was probably a little ahead of
its time by its use of XML instead of HTML. It
was not a success, also due to its high costs.
39I-Mode architecture
I-Mode is a success in Japan, read Tanenbaum why
and why it will not be easily transportable to
Europe or the US.
It is based on a new transmission network, a new
handset and a new language for Web page design.
The handset looks like a mobile phone with a
small screen added, from 72x94 up to 120x160
pixels with 8 bit colors. For voice the existing
circuit switched network is used and billing is
per minute of connect time. For data a new packet
switched network is used specially constructed
for i-mode, it is always on and billing is based
on the number of packets. It is based on CDMA and
transmits 128-byte packets at 9600 bps.
40Second-Generation Wireless Web
- New features of WAP 2.0.
- Push model as well as pull model.
- Support for integrating telephony into apps.
- Multimedia messaging.
- Inclusion of 264 pictograms.
- Interface to a storage device.
- Support for plug-ins in the browser
- More standard protocols in the stack
41WAP-2 protocol stacks
WAP-2 will run at 384 bps, better than the 9600
bps of WAP-1. Upgrades are coming HSPA (4 later
14 Mbps), MIMO (28 Mbps) and 3G LTE (long-term
evolution) with 100 Mbps downstream and 50 Mbps
upstream), planned for 2009. But the 11 or 54
Mbps of WiFi (802.11) and the coming WiMAX
(802.16) will be concurrents. One might see
dual-mode wireless devices.
42Multimedia Audio
In a microphone pressure changes are converted
into an electrical signal. To make it digital the
signal is sampled at regular time intervals by an
ADC. The Nyquist theorem states that it is
sufficient to make samples at a frequency of 2f
if the highest frequency in the signal is f. Each
sample is quantized into a number of bits
Telephone uses 8000 samples per second (thus
maximal 4 kHz) with 8 bits, thus 256 levels.
Audio CDs use 44,100 samples/sec (up to 22,050
Hz) with 16 bits, thus 65,536 levels. This gives
a rate of 1.411 Mbps for stereo sound.
43Audio Compression
Compression methods use perceptual coding to
achieve a high compression. It exploits certain
characteristics of the human ear frequency
masking meaning that a loud sound at a certain
frequency makes softer sounds in other
frequencies un-hearable (shown in the figure) and
temporal masking meaning that this effect
continues a while after the loud sound is
ended. Frequency bands with the most unmasked
(hearable) spectral power are encoded in more
bits than bands with less power. Various other
techniques are used for noise reduction,
anti-aliasing and exploiting the inter-channel
redundancy for stereo. MP3 (MPEG audio layer 3)
samples the waveform at 32, 44.1 or 48 kHz and
the output rate can be chosen, e.g. 96 kbps for
rock 'n roll or 128 kbps for a piano concert.
44Audio file download
A browser can get an audio file from a HTTP
server, store it on disk and start a media player
(e.g. RealOne Player, Windows Media Player,
Winamp, etc.). A song is fully downloaded before
it starts to play. Starting to play during the
download is often more desirable.
45Streaming Audio
The server is often a specialized media server
like RTSP (Real time Streaming Protocol) with
suitable commands, like PLAY or PAUSE. This is
used to keep sufficient data in the buffer, used
to eliminate jitter and to compensate for small
interruptions in the transfer. The actual data
transfer is done with a protocol like RTP, a real
time protocol on top of UDP. Lost packets are
compensated for as much as possible by
interpolating from neighboring data.
46Streaming Audio alternate packets
By sending alternating packets with even and odd
time samples the effect of a lost packet can be
reduced. It reduces the temporal resolution
rather than creating a gap in time. As described
here it only works with uncompressed samples, but
there is also a scheme that works with compressed
audio.
47VoIP, Videoconferencing H323
- Many protocols used
- G.7xx compression methods for audio
- Also various video formats
- H.245 negotiate compression methods, bit rates,
etc. - H.225 interface to standard telephone network.
- T120 enables real-time, multi-point audio and
video communication - V150 a scheme for carrying legacy modem
connections over IP - T38 fax over IP
48H323 protocol stack
49SIP The Session Initiation Protocol
Alternative from IETF uses URLs instead of
telephone numbers. Skype uses its own
proprietary protocol stack.
50Comparison of H.323 and SIP