]> git.saurik.com Git - apt.git/blame_incremental - methods/rsh.h
Use some semantically more correct buffer operations
[apt.git] / methods / rsh.h
... / ...
CommitLineData
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
18class Hashes;
19class FileFd;
20
21class RSHConn
22{
23 char Buffer[1024*10];
24 unsigned long Len;
25 int WriteFd;
26 int ReadFd;
27 URI ServerName;
28 std::string const Prog;
29
30 // Private helper functions
31 bool ReadLine(std::string &Text);
32
33 public:
34
35 pid_t Process;
36
37 // Raw connection IO
38 bool WriteMsg(std::string &Text,bool Sync,const char *Fmt,...);
39 bool Connect(std::string Host, std::string User);
40 bool Connect(std::string Host, unsigned int Port, std::string User);
41 bool Comp(URI Other) const {return Other.Host == ServerName.Host && Other.Port == ServerName.Port;};
42
43 // Connection control
44 bool Open();
45 void Close();
46
47 // Query
48 bool Size(const char *Path,unsigned long long &Size);
49 bool ModTime(const char *Path, time_t &Time);
50 bool Get(const char *Path,FileFd &To,unsigned long long Resume,
51 Hashes &Hash,bool &Missing, unsigned long long Size);
52
53 RSHConn(std::string const &Prog, URI Srv);
54 ~RSHConn();
55};
56
57#include <apt-pkg/acquire-method.h>
58#include "aptmethod.h"
59
60class RSHMethod : public aptMethod
61{
62 std::string const Prog;
63 virtual bool Fetch(FetchItem *Itm) APT_OVERRIDE;
64 virtual bool Configuration(std::string Message) APT_OVERRIDE;
65
66 RSHConn *Server;
67
68 static std::string FailFile;
69 static int FailFd;
70 static time_t FailTime;
71 static APT_NORETURN void SigTerm(int);
72
73 public:
74
75 explicit RSHMethod(std::string const &Prog);
76};
77
78#endif