]>
git.saurik.com Git - apt.git/blob - apt-pkg/acquire-item.h
1 // -*- mode: cpp; mode: fold -*-
3 // $Id: acquire-item.h,v 1.14 1999/01/30 08:08:54 jgg Exp $
4 /* ######################################################################
6 Acquire Item - Item to acquire
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.
12 Two item classes are provided to provide functionality for downloading
13 of Index files and downloading of Packages.
15 A Archive class is provided for downloading .deb files. It does Md5
16 checking and source location.
18 ##################################################################### */
20 #ifndef PKGLIB_ACQUIRE_ITEM_H
21 #define PKGLIB_ACQUIRE_ITEM_H
23 #include <apt-pkg/acquire.h>
24 #include <apt-pkg/sourcelist.h>
25 #include <apt-pkg/pkgrecords.h>
28 #pragma interface "apt-pkg/acquire-item.h"
32 class pkgAcquire::Item
37 inline void QueueURI(ItemDesc
&Item
)
38 {Owner
->Enqueue(Item
);};
40 void Rename(string From
,string To
);
45 enum {StatIdle
, StatFetching
, StatDone
, StatError
} Status
;
47 unsigned long FileSize
;
53 // Number of queues we are inserted into
54 unsigned int QueueCounter
;
56 // File to write the fetch into
59 virtual void Failed(string Message
,pkgAcquire::MethodConfig
*Cnf
);
60 virtual void Done(string Message
,unsigned long Size
,string Md5Hash
);
61 virtual void Start(string Message
,unsigned long Size
);
62 virtual string
MD5Sum() {return string();};
63 virtual string
Describe() = 0;
65 virtual string
Custom600Headers() {return string();};
67 Item(pkgAcquire
*Owner
);
71 // Item class for index files
72 class pkgAcqIndex
: public pkgAcquire::Item
76 const pkgSourceList::Item
*Location
;
79 pkgAcquire::ItemDesc Desc
;
83 virtual void Done(string Message
,unsigned long Size
,string Md5Hash
);
84 virtual string
Custom600Headers();
85 virtual string
Describe();
87 pkgAcqIndex(pkgAcquire
*Owner
,const pkgSourceList::Item
*Location
);
90 // Item class for index files
91 class pkgAcqIndexRel
: public pkgAcquire::Item
95 const pkgSourceList::Item
*Location
;
96 pkgAcquire::ItemDesc Desc
;
100 virtual void Done(string Message
,unsigned long Size
,string Md5Hash
);
101 virtual string
Custom600Headers();
102 virtual string
Describe();
104 pkgAcqIndexRel(pkgAcquire
*Owner
,const pkgSourceList::Item
*Location
);
107 // Item class for archive files
108 class pkgAcqArchive
: public pkgAcquire::Item
112 pkgCache::VerIterator Version
;
113 pkgAcquire::ItemDesc Desc
;
114 pkgSourceList
*Sources
;
117 string
&StoreFilename
;
118 pkgCache::VerFileIterator Vf
;
119 unsigned int Retries
;
125 virtual void Failed(string Message
,pkgAcquire::MethodConfig
*Cnf
);
126 virtual string
MD5Sum() {return MD5
;};
127 virtual void Done(string Message
,unsigned long Size
,string Md5Hash
);
128 virtual string
Describe();
130 pkgAcqArchive(pkgAcquire
*Owner
,pkgSourceList
*Sources
,
131 pkgRecords
*Recs
,pkgCache::VerIterator
const &Version
,
132 string
&StoreFilename
);