First draft
[ntk/apt.git] / methods / ftp.h
CommitLineData
30b30ec1
AL
1// -*- mode: cpp; mode: fold -*-
2// Description /*{{{*/// $Id: ftp.h,v 1.1 1999/03/15 06:01:00 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
12class 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
22 struct sockaddr_in PasvAddr;
23 struct sockaddr_in Peer;
24
25 // Private helper functions
26 bool ReadLine(string &Text);
27 bool Login();
28 bool CreateDataFd();
29 bool Finalize();
30
31 public:
32
33 // Raw connection IO
34 bool ReadResp(unsigned int &Ret,string &Text);
35 bool WriteMsg(unsigned int &Ret,string &Text,const char *Fmt,...);
36
37 // Connection control
38 bool Open();
39 void Close();
40 bool GoPasv();
41
42 // Query
43 unsigned long Size(const char *Path);
44 bool ModTime(const char *Path, time_t &Time);
45 bool Get(const char *Path,FileFd &To,unsigned long Resume = 0);
46
47 FTPConn(URI Srv);
48 ~FTPConn();
49};
50
51#endif