From 30b30ec1c01acb6f128e3fc8eb74d978a287ae1a Mon Sep 17 00:00:00 2001 From: Arch Librarian Date: Mon, 20 Sep 2004 16:53:01 +0000 Subject: First draft Author: jgg Date: 1999-03-15 06:00:59 GMT First draft --- methods/ftp.h | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 methods/ftp.h (limited to 'methods/ftp.h') diff --git a/methods/ftp.h b/methods/ftp.h new file mode 100644 index 000000000..1b2e147d0 --- /dev/null +++ b/methods/ftp.h @@ -0,0 +1,51 @@ +// -*- mode: cpp; mode: fold -*- +// Description /*{{{*/// $Id: ftp.h,v 1.1 1999/03/15 06:01:00 jgg Exp $ +/* ###################################################################### + + FTP Aquire Method - This is the FTP aquire method for APT. + + ##################################################################### */ + /*}}}*/ +#ifndef APT_FTP_H +#define APT_FTP_H + +class FTPConn +{ + char Buffer[1024*10]; + unsigned long Len; + int ServerFd; + int DataFd; + int DataListenFd; + URI ServerName; + bool TryPassive; + + struct sockaddr_in PasvAddr; + struct sockaddr_in Peer; + + // Private helper functions + bool ReadLine(string &Text); + bool Login(); + bool CreateDataFd(); + bool Finalize(); + + public: + + // Raw connection IO + bool ReadResp(unsigned int &Ret,string &Text); + bool WriteMsg(unsigned int &Ret,string &Text,const char *Fmt,...); + + // Connection control + bool Open(); + void Close(); + bool GoPasv(); + + // Query + unsigned long Size(const char *Path); + bool ModTime(const char *Path, time_t &Time); + bool Get(const char *Path,FileFd &To,unsigned long Resume = 0); + + FTPConn(URI Srv); + ~FTPConn(); +}; + +#endif -- cgit v1.2.3