summaryrefslogtreecommitdiff
path: root/methods/ftp.h
diff options
context:
space:
mode:
authorArch Librarian <arch@canonical.com>2004-09-20 16:53:01 +0000
committerArch Librarian <arch@canonical.com>2004-09-20 16:53:01 +0000
commit30b30ec1c01acb6f128e3fc8eb74d978a287ae1a (patch)
treec53b6e36de83b3122cd055157faef6236ac78c02 /methods/ftp.h
parentf17ac0977167d1e58316d3b3f7159f65d40a090a (diff)
First draft
Author: jgg Date: 1999-03-15 06:00:59 GMT First draft
Diffstat (limited to 'methods/ftp.h')
-rw-r--r--methods/ftp.h51
1 files changed, 51 insertions, 0 deletions
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