Topic 6 Application Layer Services and Protocols

14
  INTRODUCTION On top of the transport layer, additional layers can be built. These layers are intended to provide additional application-oriented services rather than being involved in the transfer of data, as the transport and lower layers are. In the OSI model (see Topic 1), the session layer provides communication session dialogue management and the presentation layer deals with data representation issues so that the semantics of the data exchanged between communicating partners are preserved even if the data have different representations in different environments. For the TCP/IP model, these layers are not defined. The applications will have to incorporate such functions when they are needed. Applications are written to provide services. Typically, these applications are arranged in a client-server configuration. In this model, an application providing service listens on a TCP port, waiting for incoming connection requests from client processes which are users of the service. A client process first makes a connection to the serverÊs TCP port and sends in a service request message. The server application processes the request and sends back the reply over the TCP connection. T T o o p p i i c c  6 6  Application Layer Services and Protocols  LEARNING OUTCOMES By the end of this topic, you should  be able to: 1. Student s will able able to give example s of applicati on layer servic es and protocols

Transcript of Topic 6 Application Layer Services and Protocols

Page 1: Topic 6 Application Layer Services and Protocols

8/8/2019 Topic 6 Application Layer Services and Protocols

http://slidepdf.com/reader/full/topic-6-application-layer-services-and-protocols 1/14

 

  INTRODUCTION

On top of the transport layer, additional layers can be built. These layers areintended to provide additional application-oriented services rather than beinginvolved in the transfer of data, as the transport and lower layers are. In the OSImodel (see Topic 1), the session layer provides communication session dialoguemanagement and the presentation layer deals with data representation issues sothat the semantics of the data exchanged between communicating partners arepreserved even if the data have different representations in different

environments. For the TCP/IP model, these layers are not defined. Theapplications will have to incorporate such functions when they are needed.

Applications are written to provide services. Typically, these applications arearranged in a client-server configuration. In this model, an application providingservice listens on a TCP port, waiting for incoming connection requests fromclient processes which are users of the service. A client process first makes aconnection to the serverÊs TCP port and sends in a service request message. Theserver application processes the request and sends back the reply over the TCPconnection.

TTooppiicc 66 Application Layer Services and Protocols 

LEARNING OUTCOMES

By the end of this topic, you should  be able to:1.  Students will able able to give examples of application layer services

and protocols

Page 2: Topic 6 Application Layer Services and Protocols

8/8/2019 Topic 6 Application Layer Services and Protocols

http://slidepdf.com/reader/full/topic-6-application-layer-services-and-protocols 2/14

Page 3: Topic 6 Application Layer Services and Protocols

8/8/2019 Topic 6 Application Layer Services and Protocols

http://slidepdf.com/reader/full/topic-6-application-layer-services-and-protocols 3/14

  TOPIC 6 APPLICATION LAYER SERVICES AND PROTOCOLS148

The leaves of the tree represent domain names of the hosts. For example:

plbpc00l.ouhk.edu.hk 

refers to the machine plbpc001 on the ouhk.edu.hk domain. Note that the root of the tree is unnamed.

The hierarchical architecture is intended as it greatly reduces the complexity of name management. The Internet authority only specifies the top level (com, edu,⁄ , uk, hk, ⁄ ) of the hierarchy. The authority of assigning domain names undereach node in the top level is delegated to organisations responsible for that node.For example, the hk domain was given to the Hong Kong Internet organisationresponsible. The edu.hk domain was given to the Internet organisationrepresenting universities and educational institutions. The Hong Kong OpenUniversity obtained the domain ouhk.edu.hk from this organisation. Theuniversity then had the authority to assign any domain name with ouhk.edu.hk as a suffix.

DNS SERVER

A DNS server provides a domain name mapping service to its clients. When sentA DNS server provides domain name mapping service to its clients. When sent a

service request to map a domain name of a machine, it replies with the IPaddress of the machine.

Since there are tens of millions of machines on the Internet, a single DNS servercannot cope with all the service requests (note that in addition to mappingrequests, there are administrative requests such as add, delete, update, etc.). TheDNS name tree is partitioned so that different parts are covered by different DNSservers. Usually, an organisation responsible for a domain is the authority of thedomains within and provides the DNS servers. Figure 6.2 shows an example:

6.2

Page 4: Topic 6 Application Layer Services and Protocols

8/8/2019 Topic 6 Application Layer Services and Protocols

http://slidepdf.com/reader/full/topic-6-application-layer-services-and-protocols 4/14

TOPIC 6 APPLICATION LAYER SERVICES AND PROTOCOLS   149

Figure 6.2: DNS server hierarchy

The root server for the top level domain co m does not know about the names of all the machines in xyz.com but it knows how to get to the DNS server that

knows. Note that a DNS server is not restricted to handling only one level of thename hierarchy. Note also that there is more than one way to assign domains toservers.

Each DNS server has links to a root server and at least those servers that aresubparts of the hierarchy. For example in the figure above, the server for xyz.com  knows the server for div1.xyz.com . If a name cannot be resolved by a DNSserver, say xyz.com , it can be referred to the root server.

RESOLVING A NAME

Each machine on the Internet has a piece of software for resolving names. It isoften known as resolver. A resolver is configured with the address of a local DNSserver. When called, it packages a request to the DNS server and returns theresult to the caller.

When a request reaches a DNS server, the name is extracted. If the server is anauthority for the name, then the name appears in its database and a lookup will

Com Root server ( R )

server for

xyz.com (j)

div 1

dept 1 dept 2 dept 3

xyz

div 2

server for

div 1.xyz

.com (k)

6.3

Page 5: Topic 6 Application Layer Services and Protocols

8/8/2019 Topic 6 Application Layer Services and Protocols

http://slidepdf.com/reader/full/topic-6-application-layer-services-and-protocols 5/14

  TOPIC 6 APPLICATION LAYER SERVICES AND PROTOCOLS150

return the IP address. Otherwise, this DNS server becomes the client of anotherDNS server and sends a request. When the reply comes back, it in turn replies tothe resolver.

Suppose a machine in domain ibm.com sends a request to a local DNS server, sayL, to resolve the name:

venus.dept3.div1.xyz.com

Since L is not an authority for the name, it sends a request to the root server forco m (R). Similarly, R is not an authority of the name but it responds with (theaddress of) the DNS server for xyz.com (J). L then sends a request to J. J returnsthe address of the DNS server for div1.xyz.com (K). Finally, L sends the request

to K and K responds with an authoritative answer with the requested IP addressof  venus.dept3.div1.xyz.com . Now L can return the result to its client. Theprocess of stepping through the hierarchy of servers to find the server that is anauthority for a name is called iterative resolution .

Another approach for a client of a DNS server is to request recursive resolution .In this case, the request is passed to the local DNS server, and if it cannot resolvethe mapping, it is passed to the next server, etc. If recursive resolution isrequested in the above example, the local DNS server L, on receiving the request,will send the request to the root server for co m R. R in turn sends the request tothe DNS server for foolbar.com J. J sends the request to the DNS server forwalnut.candy.foolbar.com K. K then responds with the authoritative answer,which is relayed back K J R L. L then returns the answer back to theresolver.

Note that a resolver on a host always requests recursive resolution when it sendsa request to a DNS server. A DNS server, when acting as a client to another DNSserver, may or may not request recursive resolution.

IMPROVING DNS PERFORMANCELike any very large distributed database, DNS service performance can beimproved by two primary means: replication and caching . This is based on theprinciple of locality of references:

 –  Machines in a domain are more likely to communicate with each other thanwith „remote‰ machines physical locality.

 –  When a machine makes reference to a name, it is likely that it will refer to thesame name again in the near future time locality.

6.4

Page 6: Topic 6 Application Layer Services and Protocols

8/8/2019 Topic 6 Application Layer Services and Protocols

http://slidepdf.com/reader/full/topic-6-application-layer-services-and-protocols 6/14

TOPIC 6 APPLICATION LAYER SERVICES AND PROTOCOLS   151

Replication:  Each root server is replicated. There are many copies of the rootserver in the world. A local DNS server is initialised with a list of root servers

„closest‰ to it. The local server monitors the response performance and tunes tothe closest.

Caching:  Recent name resolution results are cached. When a request comes in,the cache is searched first. To avoid out-of-date entries in the cache, entries can begiven a finite lifetime.

OTHER TYPES OF DNS ENTRY

The mapping of domain name to IP address is achieved through an A (address)type entry in the DNS database:

aaa.xyz.com A 146.204.18.21  

A DNS database entry can have other than address type (A type) entries (theseare for name to address mapping).

An MX type (Mail Exchange) entry is used to map a computer name found in ane-mail address to an IP address. E-mail software sends requests of MX type to a

DNS server.

For example, an MX entry:

xyz.com MX mailsever.ouhk.edu.hk 

E-mail sent to [email protected] will be sent to mailserver.ouhk.edu.hk 

A CNAME type entry is used to provide a symbolic link or alias for another DNSentry. For example, the domain cs.ouhk.edu.hk has two machines that can run a

www server. These two machines are m1.cs.ouhk.edu.hk and m2.cs.ouhk.edu.hk.

www.cs.ouhk.edu.hk CNAME m1.cs.ouhk.edu.hk 

Whenever Web software requests resolution of www.cs.ouhk.edu.hk , the addressof m1.cs.ouhk.edu.hk is returned instead. Note that later, one can move the wwwserver to m2.cs.ouhk.edu.hk without affecting users of the website. In this case,only the entry in the DNS database is changed:

\www.cs.ouhk.edu.hk CNAME m2.cs.ouhk.edu.hk 

6.5

Page 7: Topic 6 Application Layer Services and Protocols

8/8/2019 Topic 6 Application Layer Services and Protocols

http://slidepdf.com/reader/full/topic-6-application-layer-services-and-protocols 7/14

  TOPIC 6 APPLICATION LAYER SERVICES AND PROTOCOLS152

ELECTRONIC MAIL APPLICATION

E-mail is one of the mostly widely used applications. The main concepts includeaddressing, mailbox, mail server and post office server.

An e-mail address has the form:

[email protected] 

Where user specifies a mailbox on machine cs.ouhk.edu.hk.

A mailserver accepts an e-mail message and places it in the specified mailbox.Note that the mailserver may not run on cs.ouhk.edu.hk. A MX or CNAME entryin the DNS database may redirect it to another machine.

The protocol for delivering e-mail is the SMTP protocol (Simple Mail TransferProtocol). Basically, the source application (an e-mail client, also called a useragent) passes the e-mail to an e-mail transfer program which establishes a TCPconnection to the mailserver who is listening at port 25 of the target machine.(Port number 25 is pre-assigned for such a purpose). The source enquireswhether the specified mailbox exists, and if yes, transfers the rest of the message.The mailserver stores the message in the respective mailbox.

Reading

Chapter 7, Section 7.2, pages 622630 in Computer Networks (3rd edn).

Chapter 7, Section 7.1, pages 579588 in Computer Networks (4th edn).

6.6

Page 8: Topic 6 Application Layer Services and Protocols

8/8/2019 Topic 6 Application Layer Services and Protocols

http://slidepdf.com/reader/full/topic-6-application-layer-services-and-protocols 8/14

TOPIC 6 APPLICATION LAYER SERVICES AND PROTOCOLS   153

Figure 6.3: Email processes

Another protocol is used to receive e-mail from the mailbox. The Post OfficeProtocol (POP) protocol is defined between the userÊs e-mail application (POPclient) and the POP server. The recipient e-mail application (POP client) cancontact the POP server to check on the respective mailbox and transfer the e-mail

messages. A userid-password authentication is usually required for such access.The various processes and their relationships to the mailbox are depicted inFigure 6.3.

From the above decryption, it can be seen that an e-mail user agent application isusually configured with the names of the mail transfer program (usually the localSMTP server) and that of the POP server.

E-mail message format was originally defined in RFC 822 and is basically textual.The general layout is as follows:

To:From:Cc:Subject:⁄⁄ 

Body of TextOrdinary e-mail format is defined by RFC 822 and is restricted to ASCII text. Inorder to encode other types of data such as image and audio, RFC 1341 defines

Internet

Sending

computer

recipient's

mailbox

mail

transfer

program

mail

computer with

mailbox

POP

client

POP

server

user's com uter

Page 9: Topic 6 Application Layer Services and Protocols

8/8/2019 Topic 6 Application Layer Services and Protocols

http://slidepdf.com/reader/full/topic-6-application-layer-services-and-protocols 9/14

  TOPIC 6 APPLICATION LAYER SERVICES AND PROTOCOLS154

the Multipurpose Internet Mail Extensions (MIME). More details can be found inthe textbook Computer Networks .

FILE TRANSFER PROTOCOL — FTP

The FTP protocol is among the oldest Internet protocols because a fundamentalrequirement for working with remote systems is to transfer files. To use FTP forfile transfer, a user starts up an FTP client program. Different FTP clientprograms may have different user interfaces; some use command line inputwhile others provide GUI. Basically, the user supplies the IP address or dns nameof the remote computer. The FTP client makes a TCP connection to port 21 of thatcomputer, which is the default port for the FTP server program (if any) runningon the machine.

After the connection (called control connection) is made between the FTP client

and the FTP server, the user can, through the FTP client, issue commands to theFTP server. For example, one can display the directory, and move up and downthe directory tree. When the user locates the desired file and issues a commandfor downloading the file, the FTP server sets up another TCP connection (calleddata connection)7 to be used for the transfer of the file from the server machine tothe client machine. The user also specifies a local directory (and any new filename) to hold the downloaded file. At the end of the file transfer, the dataconnection is closed. The control connection would still be active and can be usedfor further command transfer. This is illustrated in Figure 6.4.

Figure 6.4: FTP connections

User FTP

client

control

connection

data

connection

FTP

server

Reading

Chapter 7, Section 7.4, pages 643663 in Computer Networks (3rd edn).

Chapter 7, Section 7.2, pages 588611 in Computer Networks (4th edn).

6.7

Page 10: Topic 6 Application Layer Services and Protocols

8/8/2019 Topic 6 Application Layer Services and Protocols

http://slidepdf.com/reader/full/topic-6-application-layer-services-and-protocols 10/14

TOPIC 6 APPLICATION LAYER SERVICES AND PROTOCOLS   155

The command messages passed over the control connection consist of lines of text. The FTP server, on receiving the command over the control connection,interacts with the file system of its host computer to obtain the data for sending

 back8

to the FTP client, which in turn displays the result and stores anydownloaded file through its hostÊs file system.

Some of the more commonly used FTP (client) commands are listed below:

open Open a control connection. The dns name or the IP address of the remote host is provided as a parameter.

close Close the control connection.

dir List the current directory 

ls List current directory. But it does not list type (file or directory) and other attributes (date last modified, size, etc.), as is done for dir.

  get Download specified file. The source and destination file names (path) are given as parameters.

  put Upload specified file. The source and destination file names (path) are  given as parameters.

cd Set current working directory to that specified (by the parameter).

cdup Move to the parent directory of the current directory.

  pwd Print current working directory.

Note that the actual command sent over the control connection may be differentfrom the above, which is typical of an FTP client with a command line userinterface.

The more frequently used commands (i.e., commands sent over the controlconnection) for the FTP server are:

user Specify a userid (as parameter) to the FTP server.

  pass Send password (as parameter).

quit Terminate control connection.

cwd Change to another directory  the path is provided as a parameter.

cdup Move to parent directory.

nlist List files in a directory.

retr Retrieve (get) a file  the filename is provided as parameter.

stor Store (put, upload) a file.

Page 11: Topic 6 Application Layer Services and Protocols

8/8/2019 Topic 6 Application Layer Services and Protocols

http://slidepdf.com/reader/full/topic-6-application-layer-services-and-protocols 11/14

  TOPIC 6 APPLICATION LAYER SERVICES AND PROTOCOLS156

6.7.1 File Types

FTP differentiates two types of file contents: text file and binary file. When a text

file is transferred, the FTP client and server cooperate to ensure correctrepresentation of the character set. For example, a file transferred from a remotecomputer which uses ebcdic9 encoding would have to be converted if the clientcomputer uses ASCII encoding.

For binary files, the file content is transferred as a byte stream transparently.

6.7.2 Security

The FTP server can implement various levels of security. Examples are:

 –  Block access from certain range of IP address.

 –  Require user identifier and password authentication. Access control such aswhat directories can be accessed by a user with a particular user identifierand in what mode (read, write, delete, etc.) the file can be defined.

Most FTP servers allow anonymous login in that everybody is allowed access.10 This is useful for opening up a directory (of files) for public access. However,anonymous login is usually restricted only to a certain directory (sub)tree andoften in read-only mode only.

WWW APPLICATION

A very powerful information dissemination paradigm was created by combiningthe concepts of:

 –  hypermedia document

 –  client-server computing

A hypertext document is a document in which links to other hypertextdocuments can be embedded. It is called a hypermedia document if it containsother media types than textual, such as image and audio. The client is a Web

  browser which requests and interprets hypermedia documents and the serversupplies the document requested. The Web server listens at port 80 (by default)for incoming requests.

Documents are referred to by URLs (Universal Resource Locators). A URL hasthree parts:

6.8

Page 12: Topic 6 Application Layer Services and Protocols

8/8/2019 Topic 6 Application Layer Services and Protocols

http://slidepdf.com/reader/full/topic-6-application-layer-services-and-protocols 12/14

TOPIC 6 APPLICATION LAYER SERVICES AND PROTOCOLS   157

http://www.cs.ouhk.edu.hk/main/index.html

The first part indicates the protocol: http ; the second part specifies a machine:

www.cs.ouhk.edu.hk ; and the last part specifies a file on the machine:/main/index.html .

The document may contain links (associated with a URL) to another documenton the same or a different machine. Such links are called hyperlinks.

The document interpreted by the browser is written in a language calledHyperText Markup Language (HTML). This is a markup language which allowsthe author to specify the general layout of the document but leaves the details of display to the browser. The directives for display layout are called tags in HTML.Basic tags and examples of HTML documents can be found in the textbook.

The protocol used between the browser and the server is HyperText TransferProtocol (HTTP). The browser, when given a URL, extracts the machine domainname and does a DNS lookup to obtain the IP address of the destinationmachine. It then establishes a connection to port 80 (where the http/Web serverlistens at) of that machine and passes the document request. The server sendsdown the document. After the document is downloaded, the connection isclosed. HTTP is the protocol used for the requests and responses between the

  browser and the Web server over the TCP connection (or other underlyingtransport connection).

During the interpretation of a document, the browser may encounter objects (e.g.,an image) that require further downloading from the current or other server. Inthis case, another connection is established to fetch the object.

The basic model allows information browsing using a browser . In manyapplications, interaction with the Web server is desired. For example, a user maywant to send back a fill-in questionnaire. This can be accomplished by using theFORM HTML tag. A form is displayed to solicit the userÊs input. The input isthen sent back to the Web server. Associated with a form is a URL to a program

(usually co-located with the Web server) that will interpret the form data (i.e., theinput data) and may produce output for sending back to the browser. Thismethod is called Common Gateway Interface (CGI). CGI provides a means forinteractions that involve a moderate transfer rate of data.

For applications that require high interactivity such as spreadsheets or largeamounts of real-time data from the server such as animation, the CGI approachmay be too slow. In such cases, the Java approach is more suitable. Recall that the

  browser interprets the Web page download from the Web server. Usually, theinterpretation consists of displaying the page. In the Java model, a special type of 

Page 13: Topic 6 Application Layer Services and Protocols

8/8/2019 Topic 6 Application Layer Services and Protocols

http://slidepdf.com/reader/full/topic-6-application-layer-services-and-protocols 13/14

  TOPIC 6 APPLICATION LAYER SERVICES AND PROTOCOLS158

object called Java applet and identified by the APPLET CODE tag can bespecified. A Java applet is a program written in the Java programming languageand compiled to an intermediate object code called bytecode. When a browser

encounters an APPLET CODE tag which specifies the URL of an applet, theapplet is downloaded and executed on the browserÊs machine. The interpretativeexecution of the applet is supported either by the machineÊs OS or by the browseritself.

Both CGI and Java are described in more detail in the folowing chapters in thetextbook.

On top of the transport layer are applications, usually arranged in client-serverconfigurations, communicating to implement services and functions for the end-users. Some of these services and application layer protocols were studied asexamples, including DNS, e-mail, FTP and the World Wide Web.

Reading

Chapter 7, Section 7.6, pages 681

723 in Computer Networks (3rd edn).Chapter 7, Section 7.3, pages 611662 in Computer Networks (4th edn).

1. Suppose one wants to run a siteÊs Web server on one of the threemachines m1.cs.xyz.com , m2.cs.xyz.com , m3.cs.xyz.com . It is desirednot to require either the client browsers or any references to the

website be changed when machine switch-over happens. Explainhow this can be achieved by showing the relevant DNS entries.

2. Derive the base 64 encoding of the following bit string:

000111000010111110010001

3. Suppose someone in the CS Department at Stanford has just writtena new program that he wants to distribute by FTP. He puts theprogram in the FTP directory ftp/pub/freebies/newprog.c. What isthe URL for this program likely to be? Assume that the website at

Stanford can be reached at www.cs.stanford.edu. 

SELF TEST 6.1

Page 14: Topic 6 Application Layer Services and Protocols

8/8/2019 Topic 6 Application Layer Services and Protocols

http://slidepdf.com/reader/full/topic-6-application-layer-services-and-protocols 14/14

TOPIC 6 APPLICATION LAYER SERVICES AND PROTOCOLS   159

SOLUTIONS TO SELF TESTS

Self Test 61. m1.cs.xyz.comA 144.214.20.10

www.cs.xyz.comCNAMEm1.cs.xyz.comIf the Web server is moved to another machine, say m2.cs.xyz.com, thenonly the DNS entry needs be changed. References need not be changed.

2. The base64 encoding is GB+Q.

3. The URL is probably:ftp://www.cs.stanford.edu/ftp/pub/freebies/newprog.c