]> git.saurik.com Git - apt.git/blame - apt-pkg/metaindex.h
implement Signed-By option for sources.list
[apt.git] / apt-pkg / metaindex.h
CommitLineData
b3d44315
MV
1#ifndef PKGLIB_METAINDEX_H
2#define PKGLIB_METAINDEX_H
3
b3d44315 4#include <apt-pkg/indexfile.h>
7014e148 5#include <apt-pkg/init.h>
b3d44315 6
453b82a3
DK
7#include <stddef.h>
8
9#include <string>
10#include <vector>
11
12#ifndef APT_10_CLEANER_HEADERS
13#include <apt-pkg/pkgcache.h>
14class pkgCacheGenerator;
15class OpProgress;
16#endif
a4f6bdc8 17#ifndef APT_8_CLEANER_HEADERS
b9dadc24
DK
18#include <apt-pkg/srcrecords.h>
19#include <apt-pkg/pkgrecords.h>
20#include <apt-pkg/vendor.h>
a4f6bdc8
DK
21using std::string;
22#endif
23
b3d44315 24class pkgAcquire;
261727f0 25class IndexTarget;
b07aeb1a
DK
26class pkgCacheGenerator;
27class OpProgress;
b3d44315
MV
28
29class metaIndex
30{
5ad0096a
DK
31public:
32 APT_IGNORE_DEPRECATED_PUSH
33 struct checkSum
34 {
35 std::string MetaKeyFilename;
36 HashStringList Hashes;
37 unsigned long long Size;
38
39 APT_DEPRECATED HashString Hash;
40 };
41 APT_IGNORE_DEPRECATED_POP
42
43 enum APT_HIDDEN TriState {
44 TRI_YES, TRI_DONTCARE, TRI_NO, TRI_UNSET
45 };
46private:
6c55f07a 47 void * const d;
5ad0096a 48protected:
8f3ba4e8 49 std::vector <pkgIndexFile *> *Indexes;
5ad0096a 50 // parsed from the sources.list
b3d44315 51 const char *Type;
8f3ba4e8
DK
52 std::string URI;
53 std::string Dist;
5ad0096a 54 TriState Trusted;
b0d40854 55 std::string SignedBy;
b3d44315 56
5ad0096a
DK
57 // parsed from a file
58 std::string Suite;
59 std::string Codename;
60 time_t Date;
61 time_t ValidUntil;
62 bool SupportsAcquireByHash;
63 std::map<std::string, checkSum *> Entries;
b0d40854 64 TriState LoadedSuccessfully;
b3d44315 65
5ad0096a 66public:
b3d44315 67 // Various accessors
5ad0096a
DK
68 std::string GetURI() const;
69 std::string GetDist() const;
70 const char* GetType() const;
71 TriState GetTrusted() const;
b0d40854 72 std::string GetSignedBy() const;
b3d44315 73
5ad0096a
DK
74 std::string GetCodename() const;
75 std::string GetSuite() const;
76 bool GetSupportsAcquireByHash() const;
77 time_t GetValidUntil() const;
78 time_t GetDate() const;
79
80 std::string GetExpectedDist() const;
81 bool CheckDist(std::string const &MaybeDist) const;
7014e148 82
b3d44315 83 // Interface for acquire
5ad0096a 84 virtual std::string Describe() const;
7014e148 85 virtual std::string ArchiveURI(std::string const& File) const = 0;
5ad0096a 86 virtual bool GetIndexes(pkgAcquire *Owner, bool const &GetAll=false) = 0;
261727f0 87 virtual std::vector<IndexTarget> GetIndexTargets() const = 0;
f105aaba 88 virtual std::vector<pkgIndexFile *> *GetIndexFiles() = 0;
b3d44315 89 virtual bool IsTrusted() const = 0;
5ad0096a
DK
90 virtual bool Load(std::string const &Filename, std::string * const ErrorText) = 0;
91 /** @return a new metaIndex object based on this one, but without information from #Load */
92 virtual metaIndex * UnloadedClone() const = 0;
93 // the given metaIndex is potentially invalid after this call and should be deleted
94 void swapLoad(metaIndex * const OldMetaIndex);
b3d44315 95
5ad0096a
DK
96 // Lookup functions for parsed Hashes
97 checkSum *Lookup(std::string const &MetaKey) const;
98 /** \brief tests if a checksum for this file is available */
99 bool Exists(std::string const &MetaKey) const;
100 std::vector<std::string> MetaKeys() const;
101 TriState GetLoadedSuccessfully() const;
102
103 // Interfaces for pkgCacheGen
3fd89e62 104 virtual pkgCache::RlsFileIterator FindInCache(pkgCache &Cache, bool const ModifyCheck) const;
b07aeb1a
DK
105 virtual bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const;
106
5ad0096a 107
f105aaba
DK
108 metaIndex(std::string const &URI, std::string const &Dist,
109 char const * const Type);
110 virtual ~metaIndex();
b3d44315
MV
111};
112
113#endif