1 / 16

15-441 Project 1 Overview

This project involves the implementation of a TFTP server. TFTP (Trivial File Transfer Protocol) is a basic file transfer protocol that supports only Get and Put operations. It is used for netbooting workstations and is a simple but useful protocol defined by RFC 1350. The server will send and receive packets over UDP and follow the stop and wait protocol. Debugging and project planning are also important aspects to consider.

jmark
Download Presentation

15-441 Project 1 Overview

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 15-441 Project 1 Overview 1/25/06 Mike Cui

  2. Your Assignment Is … To implement a TFTP server. Detailed handout on course website. What exactly does this involve ?

  3. What is TFTP ? • The Trivial File Transfer Protocol • Basic file transfer protocol • Supports only Get & Put operations • Major uses : • Netbooting workstations • Example of a simple but useful protocol • Defined by a standards body document • RFC 1350 (1992) • RFC 1123 (1989) (bug fix) • RFC 783 (1981) (obsolete)

  4. The Standard • Defines • Message types & formats • Sequence of messages • Connection set-up and termination • Written in very rigid style • Not necessarily easy to understand

  5. Packets • Sent over User Datagram Protocol (UDP) • Single message (datagram) • See chapter 5.1 for details • Only 5 types : • RRQ (filename, mode) • WRQ (filename, mode) • DATA (block number, data bytes) • ACK (block number) • ERROR (error code, error message) • Largest packet is limited to 516 bytes • DATA packets, specified by the RFC • RRQ/WRQ packets, specified by us for this project

  6. Protocol • Stop and wait protocol - send a message, wait for reply • Send DATA(1,…) in response to RRQ • Send ACK(n) in response to DATA(n) • Send DATA(n+1,...) in response to ACK(n) • What happens when a message is lost? • Sender retransmits DATA or RRQ • How do you know when to stop?

  7. Get Example Client Server RRQ(foo,...) DATA(1,…) ACK(1) DATA(2,…) ACK(2)

  8. Get Example (lost packet) Client Server RRQ(foo,...) DATA(1,…) Timeout ACK(1) DATA(1,…) ACK(1)

  9. Hints • Protocol Issues • UDP • Network Byte Order • Debugging tools • Project Planning

  10. General Protocol Issues • TFTP uses the well known UDP port 69 • Usually only superuser can bind to ports < 1024 • Use a different port instead • Responses to RRQ/WRQ must be sent out on a different port than the well known port. • Must to create another socket • bind to port 0 will pick any free port • Each side can consider the connection terminated when it sends to or receives from the other side an ERROR packet. • What if the ERROR packet is lost ?

  11. UDP • socket(AF_INET, SOCK_DGRAM, 0) creates a UDP socket • bind() assigns the socket an address and port • recv()/recvfrom() gets an entire packet addressed to the port assigned by bind() • Or (optionally) blocks until an entire packet arrives • No short-count, or EOF • Packet is truncated if buffer isn’t large enough • recvfrom() also fills in the source address • connect() sets the default destination • Just a shortcut, no “connection” is actually made! • send() sends a packet to the destination set by connect() • Packets might reach destination 0 or more times • sendto() can specify a destination • accept()/listen() not applicable

  12. More on UDP • man udp • UDP server example in the reference section of Project handout

  13. Network Byte Order • Network functions deal in bytes • Multi-byte structures in a message are more complicated (eg: integers) • One host could be big-endian, the other little-endian • Choose one byte order for messages on the wire (pages 536-538), which is big-endian • Provide conversion functions for common types • Long : htonl, ntohl • Short : htons, ntohs

  14. Debugging Tools • TFTP clients • tftp installed on Andrew Linux & Solaris % tftp quark.weh.andrew.cmu.edu 3000 tftp> binary tftp> get foo.c tftp> put bar.sml • trace prints the packets sent & received • netstat • List open sockets • gdb

  15. Project Planning • Start early ! • Should already have read the RFC by now • Read it again • This project may be larger than your previous ones. • Expect about 750-1000 lines of C-code • Most of the complexity will be in exceptional handling. • Think about the corner cases early • Use office hours

  16. Questions ?

More Related