]> git.saurik.com Git - apt.git/blob - apt-pkg/acquire-item.h
Fixed a few minor dpkg settings
[apt.git] / apt-pkg / acquire-item.h
1 // -*- mode: cpp; mode: fold -*-
2 // Description /*{{{*/
3 // $Id: acquire-item.h,v 1.14 1999/01/30 08:08:54 jgg Exp $
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
15 A Archive class is provided for downloading .deb files. It does Md5
16 checking and source location.
17
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>
25 #include <apt-pkg/pkgrecords.h>
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;
37 inline void QueueURI(ItemDesc &Item)
38 {Owner->Enqueue(Item);};
39
40 void Rename(string From,string To);
41
42 public:
43
44 // State of the item
45 enum {StatIdle, StatFetching, StatDone, StatError} Status;
46 string ErrorText;
47 unsigned long FileSize;
48 char *Mode;
49 unsigned long ID;
50 bool Complete;
51 bool Local;
52
53 // Number of queues we are inserted into
54 unsigned int QueueCounter;
55
56 // File to write the fetch into
57 string DestFile;
58
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;
64
65 virtual string Custom600Headers() {return string();};
66
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;
77 bool Decompression;
78 bool Erase;
79 pkgAcquire::ItemDesc Desc;
80
81 public:
82
83 virtual void Done(string Message,unsigned long Size,string Md5Hash);
84 virtual string Custom600Headers();
85 virtual string Describe();
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;
96 pkgAcquire::ItemDesc Desc;
97
98 public:
99
100 virtual void Done(string Message,unsigned long Size,string Md5Hash);
101 virtual string Custom600Headers();
102 virtual string Describe();
103
104 pkgAcqIndexRel(pkgAcquire *Owner,const pkgSourceList::Item *Location);
105 };
106
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;
117 string &StoreFilename;
118 pkgCache::VerFileIterator Vf;
119 unsigned int Retries;
120
121 bool QueueNext();
122
123 public:
124
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();
129
130 pkgAcqArchive(pkgAcquire *Owner,pkgSourceList *Sources,
131 pkgRecords *Recs,pkgCache::VerIterator const &Version,
132 string &StoreFilename);
133 };
134
135 #endif