]>
Commit | Line | Data |
---|---|---|
0118833a AL |
1 | // -*- mode: cpp; mode: fold -*- |
2 | // Description /*{{{*/ | |
7d8afa39 | 3 | // $Id: acquire-item.h,v 1.14 1999/01/30 08:08:54 jgg Exp $ |
0118833a AL |
4 | /* ###################################################################### |
5 | ||
6 | Acquire Item - Item to acquire | |
7 | ||
8 | When an item is instantiated it will add it self to the local list in | |
9 | the Owner Acquire class. Derived classes will then call QueueURI to | |
10 | register all the URI's they wish to fetch for at the initial moment. | |
11 | ||
12 | Two item classes are provided to provide functionality for downloading | |
13 | of Index files and downloading of Packages. | |
14 | ||
b185acc2 AL |
15 | A Archive class is provided for downloading .deb files. It does Md5 |
16 | checking and source location. | |
17 | ||
0118833a AL |
18 | ##################################################################### */ |
19 | /*}}}*/ | |
20 | #ifndef PKGLIB_ACQUIRE_ITEM_H | |
21 | #define PKGLIB_ACQUIRE_ITEM_H | |
22 | ||
23 | #include <apt-pkg/acquire.h> | |
24 | #include <apt-pkg/sourcelist.h> | |
03e39e59 | 25 | #include <apt-pkg/pkgrecords.h> |
0118833a AL |
26 | |
27 | #ifdef __GNUG__ | |
28 | #pragma interface "apt-pkg/acquire-item.h" | |
29 | #endif | |
30 | ||
31 | // Item to acquire | |
32 | class pkgAcquire::Item | |
33 | { | |
34 | protected: | |
35 | ||
36 | pkgAcquire *Owner; | |
8267fe24 AL |
37 | inline void QueueURI(ItemDesc &Item) |
38 | {Owner->Enqueue(Item);}; | |
0118833a | 39 | |
8b89e57f AL |
40 | void Rename(string From,string To); |
41 | ||
0118833a AL |
42 | public: |
43 | ||
c88edf1d AL |
44 | // State of the item |
45 | enum {StatIdle, StatFetching, StatDone, StatError} Status; | |
46 | string ErrorText; | |
8267fe24 | 47 | unsigned long FileSize; |
b98f2859 AL |
48 | char *Mode; |
49 | unsigned long ID; | |
8267fe24 | 50 | bool Complete; |
a6568219 | 51 | bool Local; |
30e1eab5 | 52 | |
0a8a80e5 | 53 | // Number of queues we are inserted into |
0118833a | 54 | unsigned int QueueCounter; |
0118833a | 55 | |
0a8a80e5 AL |
56 | // File to write the fetch into |
57 | string DestFile; | |
7d8afa39 AL |
58 | |
59 | virtual void Failed(string Message,pkgAcquire::MethodConfig *Cnf); | |
c88edf1d | 60 | virtual void Done(string Message,unsigned long Size,string Md5Hash); |
8267fe24 | 61 | virtual void Start(string Message,unsigned long Size); |
f7a08e33 | 62 | virtual string MD5Sum() {return string();}; |
30e1eab5 AL |
63 | virtual string Describe() = 0; |
64 | ||
0a8a80e5 AL |
65 | virtual string Custom600Headers() {return string();}; |
66 | ||
0118833a AL |
67 | Item(pkgAcquire *Owner); |
68 | virtual ~Item(); | |
69 | }; | |
70 | ||
71 | // Item class for index files | |
72 | class pkgAcqIndex : public pkgAcquire::Item | |
73 | { | |
74 | protected: | |
75 | ||
76 | const pkgSourceList::Item *Location; | |
8b89e57f | 77 | bool Decompression; |
bfd22fc0 | 78 | bool Erase; |
8267fe24 | 79 | pkgAcquire::ItemDesc Desc; |
0118833a AL |
80 | |
81 | public: | |
82 | ||
8b89e57f | 83 | virtual void Done(string Message,unsigned long Size,string Md5Hash); |
0a8a80e5 | 84 | virtual string Custom600Headers(); |
30e1eab5 | 85 | virtual string Describe(); |
0118833a AL |
86 | |
87 | pkgAcqIndex(pkgAcquire *Owner,const pkgSourceList::Item *Location); | |
88 | }; | |
89 | ||
90 | // Item class for index files | |
91 | class pkgAcqIndexRel : public pkgAcquire::Item | |
92 | { | |
93 | protected: | |
94 | ||
95 | const pkgSourceList::Item *Location; | |
8267fe24 | 96 | pkgAcquire::ItemDesc Desc; |
0118833a AL |
97 | |
98 | public: | |
99 | ||
8b89e57f | 100 | virtual void Done(string Message,unsigned long Size,string Md5Hash); |
0a8a80e5 | 101 | virtual string Custom600Headers(); |
30e1eab5 | 102 | virtual string Describe(); |
0a8a80e5 | 103 | |
0118833a AL |
104 | pkgAcqIndexRel(pkgAcquire *Owner,const pkgSourceList::Item *Location); |
105 | }; | |
106 | ||
03e39e59 AL |
107 | // Item class for archive files |
108 | class pkgAcqArchive : public pkgAcquire::Item | |
109 | { | |
110 | protected: | |
111 | ||
112 | pkgCache::VerIterator Version; | |
113 | pkgAcquire::ItemDesc Desc; | |
114 | pkgSourceList *Sources; | |
115 | pkgRecords *Recs; | |
116 | string MD5; | |
30e1eab5 | 117 | string &StoreFilename; |
b185acc2 | 118 | pkgCache::VerFileIterator Vf; |
7d8afa39 | 119 | unsigned int Retries; |
b185acc2 AL |
120 | |
121 | bool QueueNext(); | |
03e39e59 AL |
122 | |
123 | public: | |
124 | ||
7d8afa39 | 125 | virtual void Failed(string Message,pkgAcquire::MethodConfig *Cnf); |
f7a08e33 | 126 | virtual string MD5Sum() {return MD5;}; |
03e39e59 | 127 | virtual void Done(string Message,unsigned long Size,string Md5Hash); |
30e1eab5 | 128 | virtual string Describe(); |
03e39e59 AL |
129 | |
130 | pkgAcqArchive(pkgAcquire *Owner,pkgSourceList *Sources, | |
30e1eab5 AL |
131 | pkgRecords *Recs,pkgCache::VerIterator const &Version, |
132 | string &StoreFilename); | |
03e39e59 AL |
133 | }; |
134 | ||
0118833a | 135 | #endif |