application layer chapter-9
TRANSCRIPT
© Oxford University Press 2011
Computer NetworksComputer Networks
Bhushan Trivedi, Director, MCA Programme, at the GLS Institute of
Computer Technology, Ahmadabad
© Oxford University Press 2011
Chapter 9
Computer NetworksThe Application Layer
© Oxford University Press 2011
The application layer
• A layer interacting with the user• Applications run at application layer• Use TCP or UDP to get their job done• SOCKET API is used for interaction• Varieties of applications to deal with• Users expect similar behavior for Internet
based applications like browsers
© Oxford University Press 2011
The DNS
© Oxford University Press 2011
Domain namespace requirements
• Efficient• Continue working despite break downs• Should not introduce additional overheads• Information available from the nearby servers• Contain a few additional information• A single server can manage multiple
networks.• It should be secure enough (not provided)
© Oxford University Press 2011
Labels and domains
© Oxford University Press 2011
© Oxford University Press 2011
Domains and
hierarchy:
lower level
domains are part of higher
level domains
© Oxford University Press 2011
Domains and
hierarchy:
lower level
domains are part of higher
level domains
© Oxford University Press 2011
Domain names
• Partially and fully qualified names• Resolver• Resolution process
© Oxford University Press 2011
Advantages of hierarchy
• Space constraint • Processing time constraint• Congestion near the server• Organized form of information• Efficient resolution of domain names
© Oxford University Press 2011
Advantages of hierarchy
• A comparatively static database is better to be organized this way
• Clear cut controlling infrastructure• Delegation of authority is clearly defined• Autonomous control
© Oxford University Press 2011
Distributed database
• Most of the queries in DNS are resolved within the local server’s scope
• It reduces the network traffic • No single point of failure• Easy maintenance• Can be easily managed
© Oxford University Press 2011
Distributed databases
Database for ‘in’ac Address of acmil Address of miledu Address of edu… …
Database for ‘ac’A Address of ABC… …
Database for ‘ABC’ict Address of ictibm Address of ibmica Address of ica
Table 9.4 Database for ‘ict’Lara Resource records
for LaraPonting Resource records
for PontingVishwanath Resource records
for Vishwanath
© Oxford University Press 2011
Iterative Name
Resolution
© Oxford University Press 2011
Recursive name resolutio
n
© Oxford University Press 2011
Zones
© Oxford University Press 2011
The registration process
© Oxford University Press 2011
Domain Name
servers, root,
TLD and Local
servers
© Oxford University Press 2011
Type Meaning ValueA IPv4 address 32-bit value
AAAA IPv6 address 128-bit valueCNAME Canonical Name Alias name for host
PTR Pointer IP address (IPv4 or IPv6)NS Name Server Name server(s)
SOA Start of Authority Zone name etcMX Mail Exchanger mail server/exchanger
HINFO Host Info Optional informationSPF Sender Policy
FrameworkIdentify mail servers
TXT Text Text informationDNSKEY DNS Key Public key of domain
RRSIG R R Signature Resource Record Signature
© Oxford University Press 2011
Domain Time-to-live
Class Type Value
207.118.130.194 / 24
172800 IN PTR abcict.org.
ftp.abcict.org.
172800 IN CNAME
Vishwanath.abcict.org.
abcict.org. 172800 IN NS ns2.webmastersindia.com.
abcict.org. 172800 IN NS ns1.webmastersindia.com.
abcict.org. 172800 IN A 207.118.130.194
© Oxford University Press 2011
abcict.org. 172800 IN MX (10) mail.abcict.org.172800 IN MX (20) Vishwanath.abcic
t.org172800 IN MX (30) Ponting.abcict.org
mail.abcict.org.
172800 IN A 207.118.130.194
www.abcict.org.
172800 IN CNAME Ponting.abcict.org
www.abcict.org.
172800 IN CNAME abcict.org.
© Oxford University Press 2011
Ponting.abcict.org.
172800 IN A 208.118.130.194
Ponting.abcict.org.
172800 IN HINFO HP laptop with RHEL 9
Vishwanath.abcict.org.
172800 IN A 209.118.130.194
172800 IN HINFO HP I3laser.abcict.org
172800 IN A 210.118.130.194
172800 IN HINFO The laser printer
© Oxford University Press 2011
Different types of resource records
DNS records for a big website with multiple serversDomain Time to
liveClass Type Value
www.TheBigWebsite.com
172800 IN A 1.2.3.4
www.TheBigWebsite.com
172800 IN A 2.3.4.5
www.TheBigWebsite.com
172800 IN A 3.4.5.6
www.TheBigWebsite.com
172800 IN A 4.5.6.7
www.TheBigWebsite.com
172800 IN A 5.6.7.8
© Oxford University Press 2011
Name serversabcict.org. 172800 IN NS ns2.webmastersindia.com.abcict.org. 172800 IN NS ns1.webmastersindia.com.
© Oxford University Press 2011
Load balancing in name servers
DomainTime to
liveClass Type Value
oracle.com. 172800 IN NS u-ns2.oracle.com.oracle.com. 172800 IN NS u-ns3.oracle.com.oracle.com. 172800 IN NS u-ns4.oracle.comoracle.com. 172800 IN NS u-ns5.oracle.comoracle.com. 172800 IN NS u-ns6.oracle.com.oracle.com. 172800 IN NS ns1.oracle.com.oracle.com. 172800 IN NS ns4.oracle.com.oracle.com. 172800 IN NS Ns1.oracle.com.
© Oxford University Press 2011
CNAME to help
• www.gogol.com. 172800 IN CNAMEwww.google.com
• www.goggle.com. 172800 IN CNAME www.google.com
• abcict.org. 172800 IN CNAME www.abcict.org
• www.abcict.org. 172800 IN CNAME abcict.org
© Oxford University Press 2011
Partially qualified domain nameswww 172800 IN CNAME Ponting ;canonical name
is Ponting.abcict.orgftp 172800 IN CNAME Vishwanath ;canonical
name is Vishwanath.abcict.org
ftp.abcict
172800 IN CNAME Vishwanath.abcict.org ;exactly as above
Resource records with blank namesabcict.org. 172800 IN MX (10) mail.abcict.org.
172800 IN MX (20) Vishwanath.abcict.org
© Oxford University Press 2011
DNS query and resource record in response
© Oxford University Press 2011
Dynamic DNS
© Oxford University Press 2011
DNS Sec
• The DNS records are kept encrypted using the private key of the DNS. It can only be decrypted using the public key of the DNS itself.
• DNS resource records also contain a digital signature
• Name servers contain public keys for the zones they are responsible for
© Oxford University Press 2011
Browser and server interacting
© Oxford University Press 2011
The HTTP request exampleGET http://www.oup.co.in/category.php?cat_id=43
HTTP/1.1Host: www.oup.co.inUser-Agent: Mozilla/5.0; Accept: text/html,application/xhtml+xml,
application/xml;q=0.9,*/*;q=0.8Accept-Language: en-us,en;q=0.5Accept-Encoding: gzip,deflateCookie:
PHPSESSID=c3a1082780a2c6621126fa3bd8ad11f1
© Oxford University Press 2011
HTTP ResponseHTTP/1.0 200 OKDate: Mon, 19 Apr 2010 10:50:00 GMTServer: Apache/1.3.27 (Unix) PHP/4.2.3
mod_ssl/2.8.12 OpenSSL/0.9.7gX-Powered-By: PHP/4.2.3Expires: Thu, 19 Nov 2010 08:52:00 GMTCache-Control: no-store, no-cache, must-
revalidate, post-check=0, pre-check=0Content-Type: text/htmlConnection: close
© Oxford University Press 2011
HTTP request and response
© Oxford University Press 2011
The structure of request and response
© Oxford University Press 2011
Components of request and response
© Oxford University Press 2011
Complete request structure
© Oxford University Press 2011
Complete response structure
© Oxford University Press 2011
Method FunctionGET Retrieve a page from the server. A few
simple inputs can be provided. Body is always empty.
POST Provide information to the server. Nonempty body part contains the information.
HEADER Same as GET except the body of the page is not retrieved.
PUT Place the data at the user- specified URL.DELETE Remove an object from the web server.CONNECT Helps converting an HTTP request into
HTTPS.
© Oxford University Press 2011
The persistent connection
• Often , multiple requests are sent and responses are sought from a single connection
• When the connection does not need to be established afresh, the response time improves
• Pipelining also helps
© Oxford University Press 2011
Persistent connection
© Oxford University Press 2011
Cookies
© Oxford University Press 2011
Session variables
• if (username == “ ”),• //no username provided • Jump to login page• else if (user name != administrator)• Display “this page is restricted” message•
© Oxford University Press 2011
Conditional download: request
GET http://www.glsict.org/mcaregular.htm HTTP/1.1
Host: www.glsict.orgIf-modified-since: Thu, 29 Mar 2010 4:35:10
GMT
© Oxford University Press 2011
Conditional download: Two responses
Response-1HTTP/1.1 304 Not Modified
Response-2HTTP/1.1 200 OKDate: Mon, 19 Apr 2010 10:50:00 GMTServer: ApacheLast-Modified: 15 Apr 2010 3:34:05 GMT
© Oxford University Press 2011
Conditional Download-1
© Oxford University Press 2011
Conditional download-2
© Oxford University Press 2011
Conditional download-3
© Oxford University Press 2011
Proxies as intermediaries
• Reduce load on web servers• Reduced response time• Traffic monitoring• Extending Internet access to others • Max-forwards header
© Oxford University Press 2011
How Proxy works
© Oxford University Press 2011
Dynamic Web, client and server side
© Oxford University Press 2011
The email sending process
© Oxford University Press 2011
The email receiving process
© Oxford University Press 2011
Components of the email system
• The first component is known as the user agent.
• It is what the users interact with to send and receive mails.
• The second component is known as the message transfer agent which navigates the mails to their intended recipients.
• The third component is the mail itself.
© Oxford University Press 2011
The complete mailing process
© Oxford University Press 2011
Mail transfer using SMTP client and server
© Oxford University Press 2011
Alias expansion while sending
© Oxford University Press 2011
Alias expansion while recceiving
© Oxford University Press 2011
Alias expansion in
web mail
© Oxford University Press 2011
conventional mail
Example with the Email format
From: Lara BrianABC ICT AhmedabadTo:Gayle ChrisOBS
Content description
Example of content Name of content
Sender’s andReceiver’s mail address
[email protected]@OBS.com
Envelope
From: Lara BrianTo:Gayle Chris
Sender’s andReceiver’s name
Prof. Lara BrianGayle Chris
Header The message
Dear Gayle,Here is second bookRegardsLara
The content of the message
Dear Gayle,Here is second book RegardsLara
Body
© Oxford University Press 2011
SMTP
© Oxford University Press 2011
Client Server Communication SMTP
S: 220 OBS.com SMTP server readyC: HELO abcict.orgS: 250 Hello OBS.com, I
am glad to meet youC: MAIL FROM:[email protected]: 250 OkC: RCPT TO:[email protected]: 250 OkC: RCPT
TO:[email protected]: 250 OkC: RCPT TO:[email protected]
© Oxford University Press 2011
Continue…
S: 550 No such user hereC: DATAS: 354 End data with <CR><LF>.<CR><LF>C: From: "LARA Brian" < [email protected] >C: To: “Gayle Chris” [email protected]: Cc: [email protected]: Subject: The Second BookC:
© Oxford University Press 2011
Continue…
C: Hello Gayle.C: I will soon send you the second Book.C: regardsC: LaraC: .S: 250 Ok: C: QUITS: 221 Bye {The server closes the connection}
© Oxford University Press 2011
Internet Media Types
From: [email protected] To: [email protected]: Thu, 29 APR 2010 16:02:43 -0500MIME-Version: 1.0Content-Type: image/jpegContent-Transfer-Encoding: base64< a blank line>………..binary data for the image in text form………
© Oxford University Press 2011
Type and meaning
Content Type Meaningtext Text information, i.e. a notepad file.
image A photograph or graphicsaudio Recorded sound.video Recorded video.
application A binary file like a Word doc. multipart Message divided in multiple parts, each
with different type of datamessage A forwarded email or a reference linkX–…. Non-standard header.
© Oxford University Press 2011
SMTP and HTTP comparison• Both of them connects and transfer files• Considering HTTP 1.1, they use persistent
connection. • use headers and values in their messages• HTTP does not convert non-text data into text,
SMTP converts non-text data into 7-bit ASCII. • HTTP needs separate fetch for each object.
SMTP converts the non-text portion into text and send together
© Oxford University Press 2011
SMTP and HTTP comparison
• In HTTP, the client fetches the data, while in SMTP, the client sends the data.
• As SMTP needs to covert other types of data into 7-bit ASCII, it needs MIME.
• HTTP does not require such service, as it transfers every object individually.
© Oxford University Press 2011
Base 64 encoding
6-bit sequence
010100 010010 101010 101000 011100
Converted character
U S w o c
ASCII value
85 83 119 111 99
Value in binary
01010101
01010011
01110111
01101111
01100011
© Oxford University Press 2011
Quoted printable encoding0000 0010
0000 0111
1100 1011
0100 1001
0101 0011
2 7 Non-ASCII
I S
0000 0010
0000 0111
00111101
01000011
(ASCII of C)
1000010
(ASCII of B)
0100 1001
0101 0011
2 7 = 1100, i.e. C (Hex)
1011, i.e. B (Hex)
I S
© Oxford University Press 2011
Intermediaries in mailing
© Oxford University Press 2011
Intermediary in web mail
© Oxford University Press 2011
POP3 and IMAP
• Delete mail is default in POP3• IMAP can have multiple mailboxes• IMAP allows partial mail download• IMAP allows access by features and content• IMAP allows message status to be informed• IMAP is more complicated• Webmails provide everything IMAP provides
© Oxford University Press 2011
Filters and SPAM
• Differentiating incoming mails– subject line– sender’s name– some specific words in the body
• Yahoo! And Gmail also provides filters• SPAM is one popular type of filter
© Oxford University Press 2011
FTP Features
• Authentication is provided• Separates its control messages from the
actual data• interactive and providing format
specification• it is stateful
© Oxford University Press 2011
FTP process
© Oxford University Press 2011
Conventional FTP
connection
© Oxford University Press 2011
Control connection open
© Oxford University Press 2011
Data connection open
© Oxford University Press 2011
The Passive
FTP connection
© Oxford University Press 2011
Data connection open in Passive FTP
© Oxford University Press 2011
Transfer between heterogeneous computers: control characters
Command Decimal value
Action
NUL 0 No operationBEL 7 bell-like sound.BS 8 Move left by one and deleteCR 13 Move to left margin
© Oxford University Press 2011
The GUI version of FTP
© Oxford University Press 2011
Secure FTP, SSL-FTP
• FTP sends and receives everything in plaintext
• SFTP is FTP over Secure TCP or SSH• Secure FTP is from IETF. This also uses
SSH• FTP based on SSL or FTPS is also popular• For simpler copy operations SCP also is
possible to be used
© Oxford University Press 2011
BluetoothPiconets
and scatternet
© Oxford University Press 2011
Bluetooth
• Architecture• Pairing• Applications• Profiles• Protocol stack
© Oxford University Press 2011
Applications/ Profiles Application layer
Audio
OtherRFComm
.
Telephon
y
Serviced discovery
Control
Middleware layer
LLC
Data link layer
Logical link control adaptation protocol
Link ManagerBaseband Physical
layerPhysical Radio802.15 protocol stack
© Oxford University Press 2011
© Oxford University Press 2011
Most common frame format
© Oxford University Press 2011
Header which is repeated three times