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>
15 #include "aptmethod.h"
17 #include <sys/socket.h>
18 #include <sys/types.h>
34 struct addrinfo
*PasvAddr
;
36 // Generic Peer Address
37 struct sockaddr_storage PeerAddr
;
38 socklen_t PeerAddrLen
;
40 // Generic Server Address (us)
41 struct sockaddr_storage ServerAddr
;
42 socklen_t ServerAddrLen
;
44 // Private helper functions
45 bool ReadLine(std::string
&Text
);
52 bool Comp(URI Other
) {return Other
.Host
== ServerName
.Host
&& Other
.Port
== ServerName
.Port
&& Other
.User
== ServerName
.User
&& Other
.Password
== ServerName
.Password
; };
55 bool ReadResp(unsigned int &Ret
,std::string
&Text
);
56 bool WriteMsg(unsigned int &Ret
,std::string
&Text
,const char *Fmt
,...);
59 bool Open(pkgAcqMethod
*Owner
);
65 bool Size(const char *Path
,unsigned long long &Size
);
66 bool ModTime(const char *Path
, time_t &Time
);
67 bool Get(const char *Path
,FileFd
&To
,unsigned long long Resume
,
68 Hashes
&MD5
,bool &Missing
, unsigned long long MaximumSize
,
75 class FtpMethod
: public aptMethod
77 virtual bool Fetch(FetchItem
*Itm
) APT_OVERRIDE
;
78 virtual bool Configuration(std::string Message
) APT_OVERRIDE
;
82 static std::string FailFile
;
84 static time_t FailTime
;
85 static APT_NORETURN
void SigTerm(int);