]> git.saurik.com Git - apt.git/blob - apt-pkg/acquire-method.h
74489913fa775325a931d2936ddc1393e0e0b513
[apt.git] / apt-pkg / acquire-method.h
1 // -*- mode: cpp; mode: fold -*-
2 // Description /*{{{*/
3 // $Id: acquire-method.h,v 1.1 1998/10/30 07:53:35 jgg Exp $
4 /* ######################################################################
5
6 Acquire Method - Method helper class + functions
7
8 These functions are designed to be used within the method task to
9 ease communication with APT.
10
11 ##################################################################### */
12 /*}}}*/
13 #ifndef PKGLIB_ACQUIRE_METHOD_H
14 #define PKGLIB_ACQUIRE_METHOD_H
15
16 #include <apt-pkg/configuration.h>
17 #include <strutl.h>
18
19 #ifdef __GNUG__
20 #pragma interface "apt-pkg/acquire-method.h"
21 #endif
22
23 class pkgAcqMethod
24 {
25 protected:
26
27 string CurrentURI;
28 string DestFile;
29 time_t LastModified;
30
31 vector<string> Messages;
32
33 struct FetchResult
34 {
35 string MD5Sum;
36 time_t LastModified;
37 bool IMSHit;
38 string Filename;
39 unsigned long Size;
40 FetchResult();
41 };
42
43 // Handlers for messages
44 virtual bool Configuration(string Message);
45 virtual bool Fetch(string Message,URI Get) {return true;};
46
47 // Outgoing messages
48 void Fail();
49 void Fail(string Why);
50 // void Log(const char *Format,...);
51 void URIStart(FetchResult &Res,unsigned long Resume = 0);
52 void URIDone(FetchResult &Res,FetchResult *Alt = 0);
53
54 public:
55
56 enum CnfFlags {SingleInstance = (1<<0), PreScan = (1<<1),
57 Pipeline = (1<<2), SendConfig = (1<<3)};
58
59 int Run();
60
61 pkgAcqMethod(const char *Ver,unsigned long Flags = 0);
62 virtual ~pkgAcqMethod() {};
63 };
64
65 #endif