]>
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; | |
d29d27b5 | 28 | std::string const Prog; |
b2e465d6 AL |
29 | |
30 | // Private helper functions | |
8f3ba4e8 | 31 | bool ReadLine(std::string &Text); |
b2e465d6 AL |
32 | |
33 | public: | |
34 | ||
b3d44315 | 35 | pid_t Process; |
b2e465d6 AL |
36 | |
37 | // Raw connection IO | |
8f3ba4e8 DK |
38 | bool WriteMsg(std::string &Text,bool Sync,const char *Fmt,...); |
39 | bool Connect(std::string Host, std::string User); | |
c7872a2c | 40 | bool Connect(std::string Host, unsigned int Port, std::string User); |
f5a34606 | 41 | bool Comp(URI Other) const {return Other.Host == ServerName.Host && Other.Port == ServerName.Port;}; |
b2e465d6 AL |
42 | |
43 | // Connection control | |
44 | bool Open(); | |
45 | void Close(); | |
46 | ||
47 | // Query | |
650faab0 | 48 | bool Size(const char *Path,unsigned long long &Size); |
b2e465d6 | 49 | bool ModTime(const char *Path, time_t &Time); |
650faab0 DK |
50 | bool Get(const char *Path,FileFd &To,unsigned long long Resume, |
51 | Hashes &Hash,bool &Missing, unsigned long long Size); | |
b2e465d6 | 52 | |
d29d27b5 | 53 | RSHConn(std::string const &Prog, URI Srv); |
b2e465d6 AL |
54 | ~RSHConn(); |
55 | }; | |
56 | ||
23e64f6d | 57 | #include "aptmethod.h" |
472ff00e | 58 | |
23e64f6d | 59 | class RSHMethod : public aptMethod |
b2e465d6 | 60 | { |
3b302846 DK |
61 | virtual bool Fetch(FetchItem *Itm) APT_OVERRIDE; |
62 | virtual bool Configuration(std::string Message) APT_OVERRIDE; | |
b2e465d6 AL |
63 | |
64 | RSHConn *Server; | |
65 | ||
8f3ba4e8 | 66 | static std::string FailFile; |
b2e465d6 AL |
67 | static int FailFd; |
68 | static time_t FailTime; | |
a02db58f | 69 | static APT_NORETURN void SigTerm(int); |
b2e465d6 AL |
70 | |
71 | public: | |
72 | ||
30060442 | 73 | explicit RSHMethod(std::string &&Prog); |
b2e465d6 AL |
74 | }; |
75 | ||
76 | #endif |