]>
Commit | Line | Data |
---|---|---|
b2e465d6 | 1 | // -*- mode: cpp; mode: fold -*- |
5e775e59 AL |
2 | // Description /*{{{*/// $Id: rsh.h,v 1.4 2002/11/09 23:33:26 doogie Exp $ |
3 | // $Id: rsh.h,v 1.4 2002/11/09 23:33:26 doogie Exp $ | |
b2e465d6 AL |
4 | /* ###################################################################### |
5 | ||
6 | RSH method - Transfer files via rsh compatible program | |
7 | ||
8 | ##################################################################### */ | |
9 | /*}}}*/ | |
10 | #ifndef APT_RSH_H | |
11 | #define APT_RSH_H | |
12 | ||
13 | #include <string> | |
453b82a3 DK |
14 | #include <time.h> |
15 | ||
b2e465d6 | 16 | #include <apt-pkg/strutl.h> |
472ff00e DK |
17 | |
18 | class Hashes; | |
19 | class FileFd; | |
b2e465d6 AL |
20 | |
21 | class RSHConn | |
22 | { | |
23 | char Buffer[1024*10]; | |
24 | unsigned long Len; | |
25 | int WriteFd; | |
26 | int ReadFd; | |
27 | URI ServerName; | |
28 | ||
29 | // Private helper functions | |
8f3ba4e8 | 30 | bool ReadLine(std::string &Text); |
b2e465d6 AL |
31 | |
32 | public: | |
33 | ||
b3d44315 | 34 | pid_t Process; |
b2e465d6 AL |
35 | |
36 | // Raw connection IO | |
8f3ba4e8 DK |
37 | bool WriteMsg(std::string &Text,bool Sync,const char *Fmt,...); |
38 | bool Connect(std::string Host, std::string User); | |
c7872a2c | 39 | bool Connect(std::string Host, unsigned int Port, std::string User); |
f5a34606 | 40 | bool Comp(URI Other) const {return Other.Host == ServerName.Host && Other.Port == ServerName.Port;}; |
b2e465d6 AL |
41 | |
42 | // Connection control | |
43 | bool Open(); | |
44 | void Close(); | |
45 | ||
46 | // Query | |
650faab0 | 47 | bool Size(const char *Path,unsigned long long &Size); |
b2e465d6 | 48 | bool ModTime(const char *Path, time_t &Time); |
650faab0 DK |
49 | bool Get(const char *Path,FileFd &To,unsigned long long Resume, |
50 | Hashes &Hash,bool &Missing, unsigned long long Size); | |
b2e465d6 AL |
51 | |
52 | RSHConn(URI Srv); | |
53 | ~RSHConn(); | |
54 | }; | |
55 | ||
472ff00e DK |
56 | #include <apt-pkg/acquire-method.h> |
57 | ||
b2e465d6 AL |
58 | class RSHMethod : public pkgAcqMethod |
59 | { | |
3b302846 DK |
60 | virtual bool Fetch(FetchItem *Itm) APT_OVERRIDE; |
61 | virtual bool Configuration(std::string Message) APT_OVERRIDE; | |
b2e465d6 AL |
62 | |
63 | RSHConn *Server; | |
64 | ||
8f3ba4e8 | 65 | static std::string FailFile; |
b2e465d6 AL |
66 | static int FailFd; |
67 | static time_t FailTime; | |
a02db58f | 68 | static APT_NORETURN void SigTerm(int); |
b2e465d6 AL |
69 | |
70 | public: | |
71 | ||
72 | RSHMethod(); | |
73 | }; | |
74 | ||
75 | #endif |