]> git.saurik.com Git - apt.git/blame - methods/rsh.h
merged from lp:~donkult/apt/experimental
[apt.git] / methods / rsh.h
CommitLineData
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>
14#include <apt-pkg/strutl.h>
472ff00e
DK
15
16class Hashes;
17class FileFd;
b2e465d6
AL
18
19class RSHConn
20{
21 char Buffer[1024*10];
22 unsigned long Len;
23 int WriteFd;
24 int ReadFd;
25 URI ServerName;
26
27 // Private helper functions
8f3ba4e8 28 bool ReadLine(std::string &Text);
b2e465d6
AL
29
30 public:
31
b3d44315 32 pid_t Process;
b2e465d6
AL
33
34 // Raw connection IO
8f3ba4e8
DK
35 bool WriteMsg(std::string &Text,bool Sync,const char *Fmt,...);
36 bool Connect(std::string Host, std::string User);
f5a34606 37 bool Comp(URI Other) const {return Other.Host == ServerName.Host && Other.Port == ServerName.Port;};
b2e465d6
AL
38
39 // Connection control
40 bool Open();
41 void Close();
42
43 // Query
650faab0 44 bool Size(const char *Path,unsigned long long &Size);
b2e465d6 45 bool ModTime(const char *Path, time_t &Time);
650faab0
DK
46 bool Get(const char *Path,FileFd &To,unsigned long long Resume,
47 Hashes &Hash,bool &Missing, unsigned long long Size);
b2e465d6
AL
48
49 RSHConn(URI Srv);
50 ~RSHConn();
51};
52
472ff00e
DK
53#include <apt-pkg/acquire-method.h>
54
b2e465d6
AL
55class RSHMethod : public pkgAcqMethod
56{
57 virtual bool Fetch(FetchItem *Itm);
8f3ba4e8 58 virtual bool Configuration(std::string Message);
b2e465d6
AL
59
60 RSHConn *Server;
61
8f3ba4e8 62 static std::string FailFile;
b2e465d6
AL
63 static int FailFd;
64 static time_t FailTime;
65 static void SigTerm(int);
66
67 public:
68
69 RSHMethod();
70};
71
72#endif