]> git.saurik.com Git - apt.git/blob - methods/rsh.h
restore ABI of pkgTagSection
[apt.git] / methods / rsh.h
1 // -*- mode: cpp; mode: fold -*-
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 $
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>
14 #include <time.h>
15
16 #include <apt-pkg/strutl.h>
17
18 class Hashes;
19 class FileFd;
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
30 bool ReadLine(std::string &Text);
31
32 public:
33
34 pid_t Process;
35
36 // Raw connection IO
37 bool WriteMsg(std::string &Text,bool Sync,const char *Fmt,...);
38 bool Connect(std::string Host, std::string User);
39 bool Comp(URI Other) const {return Other.Host == ServerName.Host && Other.Port == ServerName.Port;};
40
41 // Connection control
42 bool Open();
43 void Close();
44
45 // Query
46 bool Size(const char *Path,unsigned long long &Size);
47 bool ModTime(const char *Path, time_t &Time);
48 bool Get(const char *Path,FileFd &To,unsigned long long Resume,
49 Hashes &Hash,bool &Missing, unsigned long long Size);
50
51 RSHConn(URI Srv);
52 ~RSHConn();
53 };
54
55 #include <apt-pkg/acquire-method.h>
56
57 class RSHMethod : public pkgAcqMethod
58 {
59 virtual bool Fetch(FetchItem *Itm);
60 virtual bool Configuration(std::string Message);
61
62 RSHConn *Server;
63
64 static std::string FailFile;
65 static int FailFd;
66 static time_t FailTime;
67 static APT_NORETURN void SigTerm(int);
68
69 public:
70
71 RSHMethod();
72 };
73
74 #endif