]> git.saurik.com Git - apt.git/blame - apt-pkg/acquire-item.h
Archive acquire code
[apt.git] / apt-pkg / acquire-item.h
CommitLineData
0118833a
AL
1// -*- mode: cpp; mode: fold -*-
2// Description /*{{{*/
03e39e59 3// $Id: acquire-item.h,v 1.8 1998/11/13 04:23:28 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
15 ##################################################################### */
16 /*}}}*/
17#ifndef PKGLIB_ACQUIRE_ITEM_H
18#define PKGLIB_ACQUIRE_ITEM_H
19
20#include <apt-pkg/acquire.h>
21#include <apt-pkg/sourcelist.h>
03e39e59 22#include <apt-pkg/pkgrecords.h>
0118833a
AL
23
24#ifdef __GNUG__
25#pragma interface "apt-pkg/acquire-item.h"
26#endif
27
28// Item to acquire
29class pkgAcquire::Item
30{
31 protected:
32
33 pkgAcquire *Owner;
8267fe24
AL
34 inline void QueueURI(ItemDesc &Item)
35 {Owner->Enqueue(Item);};
0118833a 36
8b89e57f
AL
37 void Rename(string From,string To);
38
0118833a
AL
39 public:
40
c88edf1d
AL
41 // State of the item
42 enum {StatIdle, StatFetching, StatDone, StatError} Status;
43 string ErrorText;
8267fe24 44 unsigned long FileSize;
b98f2859
AL
45 char *Mode;
46 unsigned long ID;
8267fe24 47 bool Complete;
c88edf1d 48
0a8a80e5 49 // Number of queues we are inserted into
0118833a 50 unsigned int QueueCounter;
0118833a 51
0a8a80e5
AL
52 // File to write the fetch into
53 string DestFile;
0118833a 54
c88edf1d
AL
55 virtual void Failed(string Message);
56 virtual void Done(string Message,unsigned long Size,string Md5Hash);
8267fe24 57 virtual void Start(string Message,unsigned long Size);
c88edf1d 58
0a8a80e5
AL
59 virtual string Custom600Headers() {return string();};
60
0118833a
AL
61 Item(pkgAcquire *Owner);
62 virtual ~Item();
63};
64
65// Item class for index files
66class pkgAcqIndex : public pkgAcquire::Item
67{
68 protected:
69
70 const pkgSourceList::Item *Location;
8b89e57f 71 bool Decompression;
bfd22fc0 72 bool Erase;
8267fe24 73 pkgAcquire::ItemDesc Desc;
0118833a
AL
74
75 public:
76
8b89e57f 77 virtual void Done(string Message,unsigned long Size,string Md5Hash);
0a8a80e5 78 virtual string Custom600Headers();
0118833a
AL
79
80 pkgAcqIndex(pkgAcquire *Owner,const pkgSourceList::Item *Location);
81};
82
83// Item class for index files
84class pkgAcqIndexRel : public pkgAcquire::Item
85{
86 protected:
87
88 const pkgSourceList::Item *Location;
8267fe24 89 pkgAcquire::ItemDesc Desc;
0118833a
AL
90
91 public:
92
8b89e57f 93 virtual void Done(string Message,unsigned long Size,string Md5Hash);
0a8a80e5
AL
94 virtual string Custom600Headers();
95
0118833a
AL
96 pkgAcqIndexRel(pkgAcquire *Owner,const pkgSourceList::Item *Location);
97};
98
03e39e59
AL
99// Item class for archive files
100class pkgAcqArchive : public pkgAcquire::Item
101{
102 protected:
103
104 pkgCache::VerIterator Version;
105 pkgAcquire::ItemDesc Desc;
106 pkgSourceList *Sources;
107 pkgRecords *Recs;
108 string MD5;
109
110 public:
111
112 virtual void Done(string Message,unsigned long Size,string Md5Hash);
113
114 pkgAcqArchive(pkgAcquire *Owner,pkgSourceList *Sources,
115 pkgRecords *Recs,pkgCache::VerIterator const &Version);
116};
117
0118833a 118#endif