]> git.saurik.com Git - apt.git/blob - methods/mirror.h
* apt-pkg/deb/debsystem.cc:
[apt.git] / methods / mirror.h
1 // -*- mode: cpp; mode: fold -*-
2 // Description /*{{{*/// $Id: http.h,v 1.12 2002/04/18 05:09:38 jgg Exp $
3 // $Id: http.h,v 1.12 2002/04/18 05:09:38 jgg Exp $
4 /* ######################################################################
5
6 MIRROR Aquire Method - This is the MIRROR aquire method for APT.
7
8 ##################################################################### */
9 /*}}}*/
10
11 #ifndef APT_MIRROR_H
12 #define APT_MIRROR_H
13
14
15 #include <iostream>
16
17 using std::cout;
18 using std::cerr;
19 using std::endl;
20
21 #include "http.h"
22
23 class MirrorMethod : public HttpMethod
24 {
25 FetchResult Res;
26 // we simply transform between BaseUri and Mirror
27 string BaseUri; // the original mirror://... url
28 string Mirror; // the selected mirror uri (http://...)
29 vector<string> AllMirrors; // all available mirrors
30 string MirrorFile; // the file that contains the list of mirrors
31 bool DownloadedMirrorFile; // already downloaded this session
32
33 bool Debug;
34
35 protected:
36 bool DownloadMirrorFile(string uri);
37 string GetMirrorFileName(string uri);
38 bool InitMirrors();
39 bool TryNextMirror();
40 void CurrentQueueUriToMirror();
41 bool Clean(string dir);
42
43 // we need to overwrite those to transform the url back
44 virtual void Fail(string Why, bool Transient = false);
45 virtual void URIStart(FetchResult &Res);
46 virtual void URIDone(FetchResult &Res,FetchResult *Alt = 0);
47 virtual bool Configuration(string Message);
48
49 public:
50 MirrorMethod();
51 virtual bool Fetch(FetchItem *Itm);
52 };
53
54
55 #endif