600 likes | 730 Views
Application Layer Protocols. NETS3303/3603 Week 12. E-mail Web Instant messaging Remote login P2P file sharing Multi-user network games Streaming stored video clips. Internet telephone Real-time video conference Massive parallel computing. Some network apps.
E N D
Application Layer Protocols NETS3303/3603 Week 12
E-mail Web Instant messaging Remote login P2P file sharing Multi-user network games Streaming stored video clips Internet telephone Real-time video conference Massive parallel computing Some network apps
Internet apps: application, transport protocols Application layer protocol SMTP [RFC 2821] Telnet [RFC 854] HTTP [RFC 2616] FTP [RFC 959] proprietary (e.g. RealNetworks) proprietary (e.g., Dialpad) Underlying transport protocol TCP TCP TCP TCP TCP or UDP typically UDP Application e-mail remote terminal access Web file transfer streaming multimedia Internet telephony
Types of messages exchanged, eg, request & response messages Syntax of message types: what fields in messages & how fields are delineated Semantics of the fields, ie, meaning of information in fields Timing - rules for when and how processes send & respond to messages Public-domain protocols: defined in RFCs allows for interoperability eg, HTTP, SMTP Proprietary protocols: eg, KaZaA App-layer protocol defines
Remote Interaction • Devised when computers used (ASCII) terminals • Terminal abstraction extended to remote access over a network
Client-Server Interaction • Client • Invoked by user • Forms connection to remote server • Passes keystrokes from user’s keyboard to server and displays output from server on user’s screen • Server • Accepts connection over the network • Passes incoming characters to OS as if they were typed on a local keyboard • Sends output over connection to client
TELNET • Standard protocol for remote terminal access over TCP • Allows a user to log into a computer remotely • Passes keystrokes directly to remote machine as if coming from local keyboard • Defines network virtual terminal that provides standard interface • NVT describes system independent encoding • TELNET client and server map NVT into local computer’s representation • Mechanism that allows client and server to negotiate options (e.g., character set)
Secure Remote Login (ssh) • Alternative to TELNET • Can be used as a transport layer protocol with service authentication • User authentication protocol • Connection protocol • Multiplexes multiple transfers • Uses encryption for privacy
On-Line File Sharing • Always a popular application • Two basic paradigms • Whole-file copying (gets a local copy) • On-line access
FTP user interface FTP client FTP server file transfer local file system user at host File Transfer • Whole file copying • Client • Contacts server • Specifies file • Specifies transfer direction • Server • Maintains set of files on local disk • Waits for contact • Honours request from client
File Transfer Protocol (FTP) • Major TCP/IP protocol for whole-file copying • Uses TCP for transport • FTP client contacts FTP server at port 21 • Features • Interactive access • Format specification (ASCII or EBCDIC) • Authentication control (login and password)
TCP control connection port 21 TCP data connection port 20 FTP client FTP server FTP Process Model • Separate processes handle • Interaction with user • Individual transfer requests • Data transfer connections created dynamically when needed • The control connection persists throughout a session
Control Connection Vs. Data Connection • For data transfer, client side becomes server and server side becomes client • Client • Creates process to handle data transfer • Allocates port and sends number to server over control connection • Process waits for contact • Server • Receives request • Creates process to handle data transfer • Process contacts client-side
Out-of-band Control • Control connection: “out of band” • FTP server maintains “state”: • current directory, earlier authentication • What special relationship is required between FTP and NAT?
Sample commands: sent as ASCII text over control channel USER username PASS password LISTreturn list of file in current directory RETR filenameretrieves (gets) file STOR filenamestores (puts) file onto remote host Sample return codes status code and phrase (as in HTTP) 331 Username OK, password required 125 data connection already open; transfer starting 425 Can’t open data connection 452 Error writing file FTP commands, responses
Secure File Transfer Protocols • Secure Sockets Layer FTP (SSL-FTP) • Uses secure sockets layer technology • All transfers are confidential • Secure File Transfer Program (sftp) • Almost nothing in common with FTP • Uses ssh tunnel • Secure Copy (scp) • Derivative of Unix remote copy (rcp) • Uses ssh tunnel
Trivial File Transfer Protocol (TFTP) • Alternative to FTP • Whole-file copying • Not as much functionality as FTP • Code is much smaller • Intended for use on Local Area Network • Runs over UDP • Diskless machine can use to obtain image at bootstrap
TFTP Retransmission • Symmetric • both sides implement timeout and retransmission • Network File System (NFS) • A protocol for on-line file access, not copying
Three major components: user agents mail servers simple mail transfer protocol: SMTP User Agent a.k.a. “mail reader” composing, editing, reading mail messages e.g., Eudora, Outlook, elm, Netscape Messenger outgoing, incoming messages stored on server user agent user agent user agent user agent user agent user agent SMTP SMTP SMTP mail server mail server mail server outgoing message queue user mailbox Electronic Mail
Mail Servers mailbox contains incoming messages for user messagequeue of outgoing (to be sent) mail messages SMTP protocol between mail servers to send email messages client: sending mail server “server”: receiving mail server user agent user agent user agent user agent user agent user agent SMTP SMTP SMTP mail server mail server mail server Electronic Mail: mail servers
uses TCP to reliably transfer email message from client to server, port 25 direct transfer: sending server to receiving server three phases of transfer handshaking (greeting) transfer of messages closure command/response interaction commands: ASCII text response: status code and phrase messages must be in 7-bit ASCII Electronic Mail: SMTP [RFC 2821]
1) Alice uses UA to compose message and “to” bob@someschool.edu 2) Alice’s UA sends message to her mail server; message placed in message queue 3) Client side of SMTP opens TCP connection with Bob’s mail server 4) SMTP client sends Alice’s message over the TCP connection 5) Bob’s mail server places the message in Bob’s mailbox 6) Bob invokes his user agent to read message user agent user agent mail server mail server Scenario: Alice sends message to Bob 1 2 6 3 4 5
Sample SMTP interaction S: 220 hamburger.edu SMTP Ready C: HELO crepes.fr S: 250 Hello crepes.fr, pleased to meet you C: MAIL FROM: <alice@crepes.fr> S: 250 alice@crepes.fr... Sender ok C: RCPT TO: <bob@hamburger.edu> S: 250 bob@hamburger.edu ... Recipient ok C: DATA S: 354 Enter mail, end with "." on a line by itself C: Do you like ketchup? C: How about pickles? C: . S: 250 Message accepted for delivery C: QUIT S: 221 hamburger.edu closing connection
Try SMTP interaction for yourself: • telnet servername 25 • see 220 reply from server • enter HELO, MAIL FROM, RCPT TO, DATA, QUIT commands above lets you send email without using email client (reader)
SMTP: final words • SMTP uses persistent connections • SMTP requires message (header & body) to be in 7-bit ASCII • SMTP server uses CRLF.CRLF to determine end of message
SMTP: protocol for exchanging email msgs RFC 822: standard for text message format: header lines, e.g., To: From: Subject: differentfrom SMTP commands! body the “message”, ASCII characters only Mail message format header blank line body
Multipurpose Internet Mail Extension (MIME) • Permits nontextual data to be sent in email • Graphics image • Voice or video clip • Sender • Encodes binary item into printable characters • Places in email message for transfer • Receiver • Receives email message containing encoded item • Decodes message to extract original binary value
multimedia mail extension - RFC 2045, 2056 additional lines in msg header declare MIME content type and encoding From: alice@crepes.fr To: bob@hamburger.edu Subject: Picture of yummy crepe. MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Type: image/jpeg base64 encoded data ..... ......................... ......base64 encoded data MIME: multimedia extensions MIME version method used to encode data multimedia data type, subtype, parameter declaration encoded data
SMTP: delivery/storage to receiver’s server Mail access protocol: retrieval from server POP: Post Office Protocol [RFC 1939] authorization (agent <-->server) and download IMAP: Internet Mail Access Protocol [RFC 1730] more features (more complex) manipulation of stored msgs on server HTTP: Hotmail , Yahoo! Mail, etc. user agent user agent sender’s mail server SMTP Mail access protocols SMTP access protocol receiver’s mail server
authorization phase client commands: user: declare username pass: password server responses +OK -ERR transaction phase, client: list: list message numbers retr: retrieve message by number dele: delete quit S: +OK POP3 server ready C: user bob S: +OK C: pass hungry S: +OK user successfully logged on POP3 protocol C: list S: 1 498 S: 2 912 S: . C: retr 1 S: <message 1 contents> S: . C: dele 1 C: retr 2 S: <message 1 contents> S: . C: dele 2 C: quit S: +OK POP3 server signing off
More about POP3 Previous example uses “download and delete” mode. Bob cannot re-read e-mail if he changes client “Download-and-keep”: copies of messages on different clients POP3 is stateless across sessions IMAP Keep all messages in one place: the server Allows user to organize messages in folders IMAP keeps user state across sessions: names of folders and mappings between message IDs and folder name POP3 (more) and IMAP
World Wide Web • Distributed hypermedia paradigm • various forms of information, as data, text, graphics, video, and audio, are linked together by hyperlinks • Major service on the Internet • Use surpassed file transfer in 1995
Web Page Identifier • Known as Uniform Resource Locator (URL) • Encodes • Access protocol to use • Domain name of server • Protocol port number (optional) • Path through server’s file system (optional) • Parameters (optional) • Query (optional) • Format • http: // hostname [: port] / path [; parameters] [? query]
Web Standards • Separate standards for • Representation • Transfer
Representation • HyperText Markup Language (HTML) • Document contains text plus embedded links and formatting • HTML gives guidelines for display, not details • Consequence: two browsers may choose to display same document differently
Transfer • Used between browser and web server • Protocol is HyperText Transfer Protocol (HTTP) • Runs over TCP • HTTP vs SMTP: • Pull vs push paradigm
HTTP Characteristics • Application level • Request / response paradigm • Stateless • Permits bi-directional transfer • Offers capability negotiation • Support for caching • Support for intermediaries (proxy)
HTTP Operation • Browser sends requests to which server replies • Typical request: GET used to fetch document • Example GET http://www.it.usyd.edu/current_students/ HTTP/1.1 • Relative URL also permitted GET /current_students/ HTTP/1.1
Error Messages • HTTP includes set of error responses • Server can format error as HTML message for user or use internal form and allow browser to format message
Persistent Connections • HTTP version 1.0 uses one TCP connection per transfer • Browser forms TCP connection to server • Browser sends GET request • Server returns header describing item • Server returns item • Server closes connection • HTTP version 1.1 permits connection to persist across multiple requests
HTTP Headers • HTTP uses MIME-like headers to carry meta information • Both browsers and servers send headers that allow them to negotiate agreement on the document representation and encoding to be used
Headers And Length Encoding • HTTP headers use same syntax as email headers • Lines of text followed by blank line • Lines of text have form keyword:information • For persistent connection, header specifies length (in octets) of data item that follows Header Meaning Content-Length Size of item in octets Content-Type Type of item Content-Encoding Encoding used for item Content-Language Language(s) used in item
Example Of Header Content-Length: 34 Content-Language: english Content-Encoding: ascii <HTML> A trivial example. </HTML> • Note: if length is not known in advance, server can inform browser that connection will close following transfer Connection: close Blank line!
Conditional Request • Allows browser to check cached copy for freshness • Eliminates useless latency • Sends If-Modified-Since in header of GET request • Example: If-Modified-Since: Wed, 28 May 2007 08:00:01 GMT • Avoids transfer if item older than 28 May 2007