1 // -*- mode: cpp; mode: fold -*-
2 // Description /*{{{*/// $Id: ftp.h,v 1.4 2001/03/06 07:15:29 jgg Exp $
3 // $Id: ftp.h,v 1.4 2001/03/06 07:15:29 jgg Exp $
4 /* ######################################################################
6 FTP Acquire Method - This is the FTP acquire method for APT.
8 ##################################################################### */
13 #include <apt-pkg/acquire-method.h>
14 #include <apt-pkg/strutl.h>
16 #include <sys/socket.h>
17 #include <sys/types.h>
33 struct addrinfo
*PasvAddr
;
35 // Generic Peer Address
36 struct sockaddr_storage PeerAddr
;
37 socklen_t PeerAddrLen
;
39 // Generic Server Address (us)
40 struct sockaddr_storage ServerAddr
;
41 socklen_t ServerAddrLen
;
43 // Private helper functions
44 bool ReadLine(std::string
&Text
);
51 bool Comp(URI Other
) {return Other
.Host
== ServerName
.Host
&& Other
.Port
== ServerName
.Port
&& Other
.User
== ServerName
.User
&& Other
.Password
== ServerName
.Password
; };
54 bool ReadResp(unsigned int &Ret
,std::string
&Text
);
55 bool WriteMsg(unsigned int &Ret
,std::string
&Text
,const char *Fmt
,...);
58 bool Open(pkgAcqMethod
*Owner
);
64 bool Size(const char *Path
,unsigned long long &Size
);
65 bool ModTime(const char *Path
, time_t &Time
);
66 bool Get(const char *Path
,FileFd
&To
,unsigned long long Resume
,
67 Hashes
&MD5
,bool &Missing
, unsigned long long MaximumSize
,
74 class FtpMethod
: public pkgAcqMethod
76 virtual bool Fetch(FetchItem
*Itm
) APT_OVERRIDE
;
77 virtual bool Configuration(std::string Message
) APT_OVERRIDE
;
81 static std::string FailFile
;
83 static time_t FailTime
;
84 static APT_NORETURN
void SigTerm(int);