]>
Commit | Line | Data |
---|---|---|
0118833a AL |
1 | // -*- mode: cpp; mode: fold -*- |
2 | // Description /*{{{*/ | |
681d76d0 | 3 | // $Id: acquire-item.h,v 1.15 1999/01/31 22:25:34 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);}; | |
681d76d0 | 39 | inline void Dequeue() {Owner->Dequeue(this);}; |
0118833a | 40 | |
8b89e57f AL |
41 | void Rename(string From,string To); |
42 | ||
0118833a AL |
43 | public: |
44 | ||
c88edf1d AL |
45 | // State of the item |
46 | enum {StatIdle, StatFetching, StatDone, StatError} Status; | |
47 | string ErrorText; | |
8267fe24 | 48 | unsigned long FileSize; |
b98f2859 AL |
49 | char *Mode; |
50 | unsigned long ID; | |
8267fe24 | 51 | bool Complete; |
a6568219 | 52 | bool Local; |
30e1eab5 | 53 | |
0a8a80e5 | 54 | // Number of queues we are inserted into |
0118833a | 55 | unsigned int QueueCounter; |
0118833a | 56 | |
0a8a80e5 AL |
57 | // File to write the fetch into |
58 | string DestFile; | |
7d8afa39 AL |
59 | |
60 | virtual void Failed(string Message,pkgAcquire::MethodConfig *Cnf); | |
c88edf1d | 61 | virtual void Done(string Message,unsigned long Size,string Md5Hash); |
8267fe24 | 62 | virtual void Start(string Message,unsigned long Size); |
f7a08e33 | 63 | virtual string MD5Sum() {return string();}; |
30e1eab5 AL |
64 | virtual string Describe() = 0; |
65 | ||
0a8a80e5 AL |
66 | virtual string Custom600Headers() {return string();}; |
67 | ||
0118833a AL |
68 | Item(pkgAcquire *Owner); |
69 | virtual ~Item(); | |
70 | }; | |
71 | ||
72 | // Item class for index files | |
73 | class pkgAcqIndex : public pkgAcquire::Item | |
74 | { | |
75 | protected: | |
76 | ||
77 | const pkgSourceList::Item *Location; | |
8b89e57f | 78 | bool Decompression; |
bfd22fc0 | 79 | bool Erase; |
8267fe24 | 80 | pkgAcquire::ItemDesc Desc; |
0118833a AL |
81 | |
82 | public: | |
83 | ||
8b89e57f | 84 | virtual void Done(string Message,unsigned long Size,string Md5Hash); |
0a8a80e5 | 85 | virtual string Custom600Headers(); |
30e1eab5 | 86 | virtual string Describe(); |
0118833a AL |
87 | |
88 | pkgAcqIndex(pkgAcquire *Owner,const pkgSourceList::Item *Location); | |
89 | }; | |
90 | ||
91 | // Item class for index files | |
92 | class pkgAcqIndexRel : public pkgAcquire::Item | |
93 | { | |
94 | protected: | |
95 | ||
96 | const pkgSourceList::Item *Location; | |
8267fe24 | 97 | pkgAcquire::ItemDesc Desc; |
0118833a AL |
98 | |
99 | public: | |
100 | ||
681d76d0 | 101 | virtual void Failed(string Message,pkgAcquire::MethodConfig *Cnf); |
8b89e57f | 102 | virtual void Done(string Message,unsigned long Size,string Md5Hash); |
0a8a80e5 | 103 | virtual string Custom600Headers(); |
30e1eab5 | 104 | virtual string Describe(); |
0a8a80e5 | 105 | |
0118833a AL |
106 | pkgAcqIndexRel(pkgAcquire *Owner,const pkgSourceList::Item *Location); |
107 | }; | |
108 | ||
03e39e59 AL |
109 | // Item class for archive files |
110 | class pkgAcqArchive : public pkgAcquire::Item | |
111 | { | |
112 | protected: | |
113 | ||
114 | pkgCache::VerIterator Version; | |
115 | pkgAcquire::ItemDesc Desc; | |
116 | pkgSourceList *Sources; | |
117 | pkgRecords *Recs; | |
118 | string MD5; | |
30e1eab5 | 119 | string &StoreFilename; |
b185acc2 | 120 | pkgCache::VerFileIterator Vf; |
7d8afa39 | 121 | unsigned int Retries; |
b185acc2 AL |
122 | |
123 | bool QueueNext(); | |
03e39e59 AL |
124 | |
125 | public: | |
126 | ||
7d8afa39 | 127 | virtual void Failed(string Message,pkgAcquire::MethodConfig *Cnf); |
f7a08e33 | 128 | virtual string MD5Sum() {return MD5;}; |
03e39e59 | 129 | virtual void Done(string Message,unsigned long Size,string Md5Hash); |
30e1eab5 | 130 | virtual string Describe(); |
03e39e59 AL |
131 | |
132 | pkgAcqArchive(pkgAcquire *Owner,pkgSourceList *Sources, | |
30e1eab5 AL |
133 | pkgRecords *Recs,pkgCache::VerIterator const &Version, |
134 | string &StoreFilename); | |
03e39e59 AL |
135 | }; |
136 | ||
0118833a | 137 | #endif |