]> git.saurik.com Git - apt.git/blob - methods/ftp.h
Fixed See Also
[apt.git] / methods / ftp.h
1 // -*- mode: cpp; mode: fold -*-
2 // Description /*{{{*/// $Id: ftp.h,v 1.2 1999/03/15 07:20:41 jgg Exp $
3 /* ######################################################################
4
5 FTP Aquire Method - This is the FTP aquire method for APT.
6
7 ##################################################################### */
8 /*}}}*/
9 #ifndef APT_FTP_H
10 #define APT_FTP_H
11
12 class FTPConn
13 {
14 char Buffer[1024*10];
15 unsigned long Len;
16 int ServerFd;
17 int DataFd;
18 int DataListenFd;
19 URI ServerName;
20 bool TryPassive;
21 bool Debug;
22
23 struct sockaddr_in PasvAddr;
24 struct sockaddr_in Peer;
25
26 // Private helper functions
27 bool ReadLine(string &Text);
28 bool Login();
29 bool CreateDataFd();
30 bool Finalize();
31
32 public:
33
34 bool Comp(URI Other) {return Other.Host == ServerName.Host && Other.Port == ServerName.Port;};
35
36 // Raw connection IO
37 bool ReadResp(unsigned int &Ret,string &Text);
38 bool WriteMsg(unsigned int &Ret,string &Text,const char *Fmt,...);
39
40 // Connection control
41 bool Open(pkgAcqMethod *Owner);
42 void Close();
43 bool GoPasv();
44
45 // Query
46 bool Size(const char *Path,unsigned long &Size);
47 bool ModTime(const char *Path, time_t &Time);
48 bool Get(const char *Path,FileFd &To,unsigned long Resume,
49 MD5Summation &MD5,bool &Missing);
50
51 FTPConn(URI Srv);
52 ~FTPConn();
53 };
54
55 class FtpMethod : public pkgAcqMethod
56 {
57 virtual bool Fetch(FetchItem *Itm);
58 virtual bool Configuration(string Message);
59
60 FTPConn *Server;
61
62 static string FailFile;
63 static int FailFd;
64 static time_t FailTime;
65 static void SigTerm(int);
66
67 public:
68
69 FtpMethod();
70 };
71
72 #endif