Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00020 #ifndef PKGLIB_ACQUIRE_METHOD_H
00021 #define PKGLIB_ACQUIRE_METHOD_H
00022
00023 #include <apt-pkg/configuration.h>
00024 #include <apt-pkg/strutl.h>
00025
00026
00027 class Hashes;
00028 class pkgAcqMethod
00029 {
00030 protected:
00031
00032 struct FetchItem
00033 {
00034 FetchItem *Next;
00035
00036 string Uri;
00037 string DestFile;
00038 time_t LastModified;
00039 bool IndexFile;
00040 bool FailIgnore;
00041 };
00042
00043 struct FetchResult
00044 {
00045 string MD5Sum;
00046 string SHA1Sum;
00047 string SHA256Sum;
00048 vector<string> GPGVOutput;
00049 time_t LastModified;
00050 bool IMSHit;
00051 string Filename;
00052 unsigned long Size;
00053 unsigned long ResumePoint;
00054
00055 void TakeHashes(Hashes &Hash);
00056 FetchResult();
00057 };
00058
00059
00060 vector<string> Messages;
00061 FetchItem *Queue;
00062 FetchItem *QueueBack;
00063 string FailReason;
00064 string UsedMirror;
00065 string IP;
00066
00067
00068 virtual bool Configuration(string Message);
00069 virtual bool Fetch(FetchItem * ) {return true;};
00070
00071
00072 void Fail(bool Transient = false);
00073 inline void Fail(const char *Why, bool Transient = false) {Fail(string(Why),Transient);};
00074 virtual void Fail(string Why, bool Transient = false);
00075 virtual void URIStart(FetchResult &Res);
00076 virtual void URIDone(FetchResult &Res,FetchResult *Alt = 0);
00077
00078 bool MediaFail(string Required,string Drive);
00079 virtual void Exit() {};
00080
00081 public:
00082 enum CnfFlags {SingleInstance = (1<<0),
00083 Pipeline = (1<<1), SendConfig = (1<<2),
00084 LocalOnly = (1<<3), NeedsCleanup = (1<<4),
00085 Removable = (1<<5)};
00086
00087 void Log(const char *Format,...);
00088 void Status(const char *Format,...);
00089
00090 void Redirect(const string &NewURI);
00091
00092 int Run(bool Single = false);
00093 inline void SetFailReason(string Msg) {FailReason = Msg;};
00094 inline void SetIP(string aIP) {IP = aIP;};
00095
00096 pkgAcqMethod(const char *Ver,unsigned long Flags = 0);
00097 virtual ~pkgAcqMethod() {};
00098 };
00099
00102 #endif