Project Description 1 Introduction 2 SFTP Architecture and Design
Transcription
Project Description 1 Introduction 2 SFTP Architecture and Design
Spring 2015 CS2520/TelCom2321-WANs Project Description 1 Introduction The purpose of a file transfer protocol is to enable the transfer of files between machines, typically under the command of a user. Several issues need to be addressed in the design of a file transfer protocol, including dealing with differences in file name conventions, text and data representation, and directory structure. Furthermore, the protocol much ensure reliable transfer of files from one system to another. The main objective of this project is to design and implement a Simple File Transfer Protocol (SFTP) on top of an unreliable transport channel. The project is intended to expose you to several aspects of computer and network programming, including the client/server paradigm, the concept of layering and interfaces, and a better understanding of flow and error control protocol implementation and performance. The basic requirement of this project include two main tasks: 1. SFTP Architecture Design and Implementation. This task entails: • The design of a file transfer architecture composed of two main layers: – A session layer focused on handling files and directory management, and – A transport layer to transmit data segments reliably between client and server. • The design of an interface between the session and transport to support connection establishment and data transfer between the two layers, and • The design of a name server to support name resolution between clients and servers; 2. SFTP Implementation and Analysis. This task entails: • The implementation of SFTP based on a client-server communication model using the Socket API; • The design of a set of experiments to study the performance of selected window flow control protocols, for different packet errors and different levels of traffic congestion. 2 SFTP Architecture and Design Issues SFTP is a client-server protocol that supports the transfer of text and binary files from one machine to another. The file being transferred can be of arbitrary size. To achieve reliable file transfer, the SFTP client has three components, as depicted in Figure 1. • A user interface (UI) component to handle requests from an interactive user, • A client control and file management layer (CFM) to interpret commands and handle file and directory requests, and • A client Transport Channel (TC) layer to handle information transfer, data or control, between the SFTP client and server. 1 The SFTP server has two components: • A server control and file management (CFM) layer to interpret commands and handle file and directory requests, and • A server Transport Channel (TC) layer to handle information transfer, data or control, between the SFTP server and client. SFTP Client SFTP Server User Interface UI-CFM Control Connection Control and File Management CFM-DD Control and File Management Internet Data Delivery CFM-DD Data Delivery Data Connection Figure 1: SFTP Architecture 2.1 SFTP Client-Server Interaction The interaction between the SFTP client and server is achieved through two connections: a control connection and a data connection. The control connection is established between the client and server control processes. Communication across the control connection is achieved through commands and responses. Only one command at a time can be sent. A new command can be issued only after a response to the pending command is received by the client. When a server receives a command for a file transfer, the server opens a data connection to the client. The data connection is used to transfer files between SFTP client and server. The connection can also be used to transfer directory content. The connection remains open until a close command is issued by the the client. 2.2 SFTP Control and File Management Through its User Interface, an SFTP client supports two types of commands: 2 1. Access Commands: • SFTP: to start SFTP; if a machine is specified a connection to that machine is immediately made; otherwise, the SFTP prompt is displayed. • OPEN: to open connection to the specified machine. • CLOSE: to close a connection to the specified machine. • ABORT: to abort the previous SFTP command and any data transfer. • QUIT: to terminate an SFTP session. 2. File Management Commands: • RCD: to change directory on the remote machine. • LCD: to change directory on the local machine. • PWD: to list working directory on the remote machine. • RLS: to list directory content on the remote machine. • LLS: to list directory content on the local machine. • GET: to copy one file from the remote machine to the local machine. • MGET: to copy multiple files from the remote machine to the local machine. • PUT: to copy one file from the local machine to the remote machine. • MPUT: to copy multiple files from the remote machine to the local machine. The Control and File Management (CFM) layer running on the SFTP client interprets user commands and interfaces with the Transport Channel (CC) to establish appropriate connections with the SFTP server and send requests containing the user command and associated parameters to the SFTP server. The Interface between the CFM and the TC is defined by the following primitives: • TranspInitCntrl(): This primitive is invoked to establish a control connection between the SFTP client and server. • TranspInitData(): This primitive is invoked to establish a data connections between the SFTP client and server. • DataTranspSend(): This primitive is invoked by the client or the server to send data over the data connection. • DataTranspRecv(): This primitive is invoked by the client or the server to receive data over the data connection. • CtrlTranspSend(): This primitive is invoked by the client to send a command over the control connection. • CtrlTranspRecv(): This primitive is invoked by the server to receive a command over the control connection. • TranspCloseCntrl(): This primitive is invoked to close the control connection between the SFTP client and server. • TranspClose(): This primitive is invoked to close the data connection between the SFTP client and server. 3 3 SFTP Configuration and Initialization The first step toward initialization the system is to activate the name server. The name server obtains an IP address and port number and stores them in a well-known file, Name Server Info. The server is then activated and initialized. During the initialization, the server is provided with the path to Name Server Info. The server then requests an IP address and a port number from the system and register its name (SFTP) and the assigned address and port number with the name server. Upon completion of the registration phase, the server invokes the CtrlTranspRecv() and remains passive until it receives a request for connection establishment from a client. In response to TranspInit, the TC client establishes a connection with the passive SFTP server using TCP Socket Streams. The DataTranspSend(), DataTranspRecv() and CtrlTranspSend() primitives use the established TCP connections for all data and control transmissions between the client and the server. The TC layer accepts data passed via DataTranspSend() and CtrlTranspSend(), places the data into segments and sends these segments on the appropriate TCP connection. The data portion of a segment is limited by the maximum segment size, a configurable parameter. The actual communication between the SFTP client and server takes places using the Socket API over TCP/IP. The design of the TC layer must include the ability to handle an error-prone transport channel. Consequently, the TC layer must include considerations for buffering, retransmissions and a form a flow control. You must implement a sliding window protocol of fixed size. For error control, you will experiment with two protocols: Go-Back-N and Selective Repeat. Retransmissions will require a timer mechanism to detect lack of acknowledgments. This can be achieved using the select() system call. When an entire file has been transferred, the receiving side should close the file for writing. If multiple segments are outstanding at a time, segments received by the TC layer may not be passed up to to the CFM layer if they are out-of-sequence. Instead, they should be buffered or discarded depending on the ARQ protocol being used. As part of introducing unreliability into the network, you are responsible for artificially introducing errors into the segment to be transmitted; this is achieved by randomly selecting a bit and changing its value before transmission. The error must be detected by the receiving end using a CRC-based error checking algorithm. Depending on the protocol being implemented, a NAK must be sent to the sender. As part of dealing with congestion control, a segment is randomly selected and dropped before transmission. Any segment can be potentially lost. The error rate to be used by the client and the server is a variable parameter. So is the probability of dropping a segment. The server and the client should be configured accordingly during the initialization phase. 4 SFTP Name Service Design The SFTP server translates names (i.e., SFTPServer) into IP address and port number. The SFTP Name Service protocol supports two primitives: RegisterName() and ResolveName(). The first primitive, RegisterName(), is used by a server to register its name, IP address and port number with the Name Server. In response, the Name Server records this association into its database. The second primitive, ResolveName(), is used to resolve a name (e.g., SFTPServer) into an IP address and a port number. For robustness, it is recommended to have at least two name servers. The first server is the primary server, while the second one is used as a backup server if the first server is not responding. 5 Project Requirements • You must design and implement a simple user interface to initialize and configure the name server, SFTP client and SFTP server with the appropriate parameters must be provided. A graphical interface 4 should be considered only if time permits. The implementation of such an interface will be awarded extra credits (10 pts). • You must design and implement the control and File Management layer, including its interface to the Data Delivery layer. • The design must accommodate several clients connected simultaneously to the SFTP server. • You must design and implement the Data Delivery layer, using Stream Sockets. – The TC layer protocol protocol must include a CRC-based error control protocol. It must also implement a window-based flow control, with the possibility to select a Go-back-N or SelectRepeat ARQ protocol. – The design must include an ACK/NAK mechanism for reliable transmission between the sender and the receiver. – The Design must handle out-of-sequence segments. – The design must simulate segment errors and segment drops. • You must design a name server for the system. As a minimum requirement, only one server is required. Dealing with robustness, using a backup DNS server, will be awarded extra credits (10 pts). The following tasks are to be completed as part of the project: • Task 1. 1. A complete design of the system architecture, with clearly defined semantics for each command and primitive, and a description of the segment format to be used for control and data transmission, ACKs and NAKs, and file management related data transfer. The design must include a description of how the data and control connections will be established: which entity is the passive side and which entity is the active side of the connection. The design must also describe in sufficient detail how multiple connections to the same server are handled. 2. As part of the experimental study of the sliding window protocol performance in an error-prove, potentially congested environment, you must design a set of experiments to collect statistics of interest. You need to describe the set of experiments you plan to carry out, the data to be collected, and the statistical tools you will use to validate your analysis. 3. A first progress report which discusses the design and implementation issues must be submitted. The report will be read and feedback will be returned promptly after submission, including recommendation for improvement or changes when applicable. 4. Due Date : February 10, 2015 • Task 2. 1. Implement the SFTP model using Socket API and TCP/IP protocol, including the proposed set of experiments. 2. Submit a final report in which you describe your final architecture and implementation design decisions. – As part of the final report, you are expected to discuss the design and implementation in detail (justify whatever final design decisions you made), and provide a thorough analysis of the performance study results. Statistical validation of your results is a must. – You need to make available in a public directory a well documented listing of the source code, in a compressed file (A Makefile will be highly appreciated). – You need to schedule a time onbetween April 16 or April 17 to demo your project. – The final grade will be based on of the implementation of the model and the quality of the experiments carried out and their analysis. – (Due Date : April 15, 2015) 5