See the assignment turn-in page (last modified on 4 March 2002) for instructions on turning in your assignment.
SFTP provides a client-server interface to a set of files on a computing system. The SFTP server is responsible for saving and distributing the files. The SFTP clients connect to various SFTP servers and copy files to and from them.
/
(root).
struct status { bool error; string response; };
If error is true, then something bad happend at the sftp server while trying so execute a command; if error is false, then the command was carried out correctly.
The contents of response depends on the command given and whetehr or not it was successful. If error is false, response generally will contain a descriptive error message.
All the SFTP API procedures return status
; this return value is omitted
from the descriptions that follow.
sftp::cdir(const char * new-directory)
sftp::connect(const char * remote-host, const char * session-id)
A client cannot specify any other commands in a session until the sftp server sends a positive response to a connect command for the session.
sftp::delete(const char * file-spec)
sftp::disconnect(void)
sftp::get(bool append, const char * local-file-spec, const char * remote-file-spec)
File contents are transmitted as a sequence of 8-bit bytes.
sftp::list(bool verbose, const char * directory-path)
sftp::put(bool append, const char * remote-file-spec, const char * local-file-spec)
File contents are transmitted as a sequence of 8-bit bytes.
sftp::rename(const char * old-file-spec, const char * new-file-spec)
A set of SFTP directories are in sync when all directories in the set have the same files, and they all have the most recent version of each file. Keeping a set of SFTP directories in sync essentially involves making sure the most recent version of each file in the set can be found on every directory in the set.
You should build a single tool called sftp-mirror
having the command-line
format
sftp-mirror sftp-directory sftp-directory...
The form of a sftp-directory is
directory-path@hostname:port
For example, the command
sftp-mirror /cs-538/p3@clsab18:1942 \ /projects/sftp@rockhopper.monmouth.edu:2001 \ /538-projects/3-current@AddisAbaba:21012
would sync the SFTP directories /cs-538/p3
, /projects/sftp
, and
/538-projects/3-current
.
You can use these four mechanisms however you like (assuming it doesn't choke the HTTP server or CGI programs).
You may implement the client and server side using whatever languages and techniques you feel best, as long as they are or can be easily installed on Unix. If you're not going to use C or C++ you should let me know as soon as you can so I can figure out how to deal with it and let you know if it's acceptable.
There's a simple, CGI-capable server available in
/export/home/class/cs-537/p3/thttpd
. You are not required to use it, but it's the
server I'll be using to test your code. See the thttpd
page for some information about running thttpd
.
It's not an absolute requirement that you solve the server side of this problem using CGI; however, if you want to use something else we'll have to talk about it first.
This page last modified on 3 May 2002.