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