Condivisione file approccio on-line (NFS) modifiche immediatamente visibili a tutti prbl: synchro tra utenti, bottleneck al approccio off-line (FTP, HTTP) copia replicata su host utente prbl: riconciliazione copie trasferimento batch vs. interattivo batch: noto meno latenza; interatt: risolvo subito errori FTP [RFC 959]: trasferimento interattivo autenticazione utenti gestione problemi derivanti da sistemi eterogenei (naming, rappresentazione interna dati) [2.3] 1 of 23 FTP: modalità d uso $ ftp ftp.cs.purdue.edu Connected to lucan.cs.purdue.edu 220 lucan.cs.purdue.edu FTP (Version wu-2.4.2- VR16(1) ready. Name (ftp.cs.purdue.edu:s): anonymous 331 Guest login ok, send e-mail address as password Password: ******** 230 Guest login ok, access restrictions apply. ftp> get pub/comer/tcpbook.tar bookfile 200 PORT command okay. /* creazione port per client */ 150 Opening ASCII mode data connection for tcpbook.tar (9895469 bytes). 226 Transfer complete. 9895469 bytes received in 22.76 seconds (4.3e+02 Kbytes/s) ftp> close 221 Goodbye. ftp> quit [2.3] 2 of 23 1
File Transfer Protocol [2.3] at host FTP interface FTP client local file system file transfer FTP remote file system transfer file to/from remote host client/ model client: side that initiates transfer (either to/from remote) : remote host ftp: RFC 959 ftp : port 21 data transferred in either ASCII (7 bit) or binary format 3 of 23 Control & data connections [2.3] ftp client contacts ftp at port 21, specifying TCP as transport protocol two parallel TCP connections opened: control: exchange commands, responses between client,. out of band control data: file data to/from FTP client permanently open TCP control connection port 21 TCP data connection port 20 opened on demand FTP ftp maintains state : current directory, earlier authentication 4 of 23 2
FTP: protocollo [2.3] padre port 21 fork port 21 port 5000 client 1 figlio port 20 fork figlio port 21 port 20 port 5001 client 2 SO_REUSEADDR orange apple 5 of 23 FTP: comandi e risposte [2.3] Sample commands: sent as ASCII text over control channel USER name PASS password LIST return list of file in current directory RETR filename retrieves (gets) file STOR filename stores (puts) file onto remote host Sample return codes status code and phrase (as in SMTP) 331 Username OK, password required 125 data connection already open; transfer starting 425 Can t open data connection 452 Error writing file 6 of 23 3
Three major components: s mail s 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 Electronic mail SMTP mail mail SMTP SMTP mail 7 of 23 outgoing message queue mailbox E-mail: funzionalità composizione messaggio: opportuno formato (header); codifica eventuali attachment trasferimento: SMTP reporting esito a sender (registered e-mail) display, disposition a ricevente: opportuna elaborazione attachment gestione mailing list, alias, sicurezza, Cc:, priorità Mail Servers mailbox contains incoming messages (yet to be read) for message queue of outgoing (to be sent) mail messages 8 of 23 4
Simple Mail Transfer Protocol applicazione = (UA) tutti gli UA si interfacciano con UA push via SMTP a mail mittente trasferimento via message transfer (MTA) MTAs dialogano via SMTP aggiunta envelope a messaggio, con info ctrl per dialogo tra peer SMTP indirizzo destinatario@location: se è mailing list, mail espande msg deve contenere header e body header per controllo: <keyword: value> SMTP usa CRLF.CRLF per determinare end of message alcuni caratteri non permessi nel msg (e.g., CRLF.CRLF) msg deve essere encoded (base-64 o quoted printable) 9 of 23 Schema scambio mail 10 of 23 5
Struttura mail header con info controllo; body; attachment fatta 1 copia dest, con tutto deve essere campo testo opportuno ASCII in su 7 bit envelope 11 of 23 SMTP [RFC 821, 822] client/: both running for each mail uses TCP to reliably transfer email msg from client to, port 25 direct transfer: sending to receiving three phases of transfer handshaking (greeting): autenticazione, controllo esistenza destinatario transfer of messages: tutti per il dest. (connessione persistente) closure command/response interaction command: ASCII text ; response: status code and phrase 12 of 23 6
SMTP command & respose 13 of 23 Sample SMTP interaction S: 220 hamburger.edu 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 14 of 23 7
Mail access protocols (PUSH) (PUSH) SMTP SMTP POP3 or IMAP (PULL) sender s mail receiver s mail SMTP: delivery/storage to receiver s (sempre in esecuzione e connesso a Internet) se PC domestico: UA dialoga con mail di ISP via POP3 o IMAP POP3: Post Office Protocol [RFC 1939] /* port 110 */ download & delete ; download & keep IMAP: Internet Mail Access Protocol [RFC 2060] more features (more complex) manipulation of stored msgs on 15 of 23 POP3 protocol authorization phase client commands: : declare name pass: password responses +OK -ERR transaction phase, client: list: list message numbers retr: retrieve message by # dele: delete quit: mailbox update S: +OK POP3 ready C: alice S: +OK C: pass hungry S: +OK successfully logged on 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 signing off 16 of 23 8
IMAP supporto a accesso utente da diversi host: NON scarica mail su host utente POP3 solo se configurato download & keep consente mantenimento folder multipli per uno stesso utente mantiene info stato tra sessioni diverse POP3 non lo fa (stateless) permette download componente msg per connessioni con poca bwth stato : non-autenticato -> autenticato -> selected -> logout 17 of 23 MIME per parti non-ascii : opportuna codifica Multipurpose Internet Mail Extensions standard definisce tipi ammissibili attachment MIME aggiunge info in header mail per specificare contenuto MIME-version: Content-Description: Content-Id: Content-Type: Content-Transfer-Encoding: Content-Length: versione MIME descrizione testuale id unico assegnato da UA tipo/subtype dell attachment tecnica codifica utilizzata #byte dell attachment 18 of 23 9
Tipi MIME Content-Type: type/subtype; parameters Text subtypes: plain, html charset: us-ascii, ISO-8859-1 Image subtypes: jpeg, gif Audio subtypes: basic (8-bit mulaw encoded), 32kadpcm (32 kbps coding) Video subtype: mpeg Application other data that must be processed by reader before viewable example subtypes: msword, octet-stream 19 of 23 Tipi MIME multipart/mixed: per msg contenenti + oggetti MIME header che descrive ogni oggetto boundary characters tra oggetti diversi per ogni oggetto azioni opportune (metamail) codifiche: quoted printable: trasforma testo ascii arbitrario in testo senza caratteri indesiderabili (eg. CRLF.CRLF) base64: gruppo 24 bit frammentato in 4 pezzi di 6 bit, ognuno codificato con ascii char A Z, a z, 0 9, +, / 20 of 23 10
esempio MIME 21 of 23 e-mail gateway traduce msg in transito tra sistemi che usano diversi formati e protocolli mapping tra indirizzi con rappresentazioni diverse manipolazione header non presenti/riconosciuti procedura: msg trasferito da mail a gateway dell organizzazione gateway determina su quale rete deve essere inoltrato, in base a indirizzo destinazione gateway ri-formatta msg in funzione natura rete 22 of 23 11
tutti e 3 usano TCP FTP vs. HTTP vs. SMTP HTTP stateless; trasferisce info controllo in-band; può usare connessioni TCP non-permanenti o permanenti FTP ha stato; trasferisce info controllo out-of-band connessione di controllo permanente; connessione dati nonpermanente SMTP: trasferimento asincrono di file ftp/http: pull proto; e-mail: push proto mail deve essere sequenza di ascii char (7 bit): tutto deve essere convertito http: ogni oggetto può essere trasferito in msg separato mail: tutti gli oggetti posti nello stesso msg 23 of 23 12