]>
Commit | Line | Data |
---|---|---|
7db98ffc MZ |
1 | // -*- mode: cpp; mode: fold -*- |
2 | // Description /*{{{*/ | |
3 | // $Id: indexrecords.h,v 1.1.2.1 2003/12/24 23:09:17 mdz Exp $ | |
4 | /*}}}*/ | |
5 | #ifndef PKGLIB_INDEXRECORDS_H | |
6 | #define PKGLIB_INDEXRECORDS_H | |
7 | ||
495e5cb2 | 8 | #include <apt-pkg/hashes.h> |
7db98ffc MZ |
9 | |
10 | #include <map> | |
a75c6a6e | 11 | #include <vector> |
1ddb8596 | 12 | #include <ctime> |
453b82a3 | 13 | #include <string> |
7db98ffc | 14 | |
b9dadc24 DK |
15 | #ifndef APT_8_CLEANER_HEADERS |
16 | #include <apt-pkg/fileutl.h> | |
17 | #endif | |
453b82a3 DK |
18 | #ifndef APT_10_CLEANER_HEADERS |
19 | #include <apt-pkg/pkgcache.h> | |
20 | #endif | |
b9dadc24 | 21 | |
7db98ffc MZ |
22 | class indexRecords |
23 | { | |
3809194b | 24 | APT_HIDDEN bool parseSumData(const char *&Start, const char *End, std::string &Name, |
8f3ba4e8 | 25 | std::string &Hash, unsigned long long &Size); |
7db98ffc MZ |
26 | public: |
27 | struct checkSum; | |
8f3ba4e8 | 28 | std::string ErrorText; |
07cb47e7 DK |
29 | |
30 | private: | |
31 | enum APT_HIDDEN { ALWAYS_TRUSTED, NEVER_TRUSTED, CHECK_TRUST } Trusted; | |
32 | // dpointer (for later) | |
a2fdb57f | 33 | void * d; |
07cb47e7 | 34 | |
7db98ffc | 35 | protected: |
8f3ba4e8 DK |
36 | std::string Dist; |
37 | std::string Suite; | |
38 | std::string ExpectedDist; | |
6bf93605 | 39 | time_t Date; |
1ddb8596 | 40 | time_t ValidUntil; |
a2fdb57f | 41 | bool SupportsAcquireByHash; |
1ddb8596 | 42 | |
8f3ba4e8 | 43 | std::map<std::string,checkSum *> Entries; |
7db98ffc MZ |
44 | |
45 | public: | |
fa5404ab | 46 | #if APT_PKG_ABI >= 413 |
07cb47e7 | 47 | indexRecords(const std::string &ExpectedDist = ""); |
fa5404ab DK |
48 | #else |
49 | indexRecords(); | |
50 | indexRecords(const std::string ExpectedDist); | |
51 | #endif | |
7db98ffc MZ |
52 | |
53 | // Lookup function | |
1dca8dc5 | 54 | virtual checkSum *Lookup(const std::string MetaKey); |
e1430400 | 55 | /** \brief tests if a checksum for this file is available */ |
8f3ba4e8 | 56 | bool Exists(std::string const &MetaKey) const; |
a75c6a6e MZ |
57 | std::vector<std::string> MetaKeys(); |
58 | ||
8f3ba4e8 | 59 | virtual bool Load(std::string Filename); |
07cb47e7 DK |
60 | virtual bool CheckDist(const std::string MaybeDist) const; |
61 | ||
8f3ba4e8 | 62 | std::string GetDist() const; |
7014e148 | 63 | std::string GetSuite() const; |
a2fdb57f | 64 | bool GetSupportsAcquireByHash() const; |
1ddb8596 | 65 | time_t GetValidUntil() const; |
6bf93605 | 66 | time_t GetDate() const; |
8f3ba4e8 | 67 | std::string GetExpectedDist() const; |
07cb47e7 DK |
68 | |
69 | /** \brief check if source is marked as always trusted */ | |
70 | bool IsAlwaysTrusted() const; | |
71 | /** \brief check if source is marked as never trusted */ | |
72 | bool IsNeverTrusted() const; | |
73 | ||
74 | /** \brief sets an explicit trust value | |
75 | * | |
76 | * \b true means that the source should always be considered trusted, | |
77 | * while \b false marks a source as always untrusted, even if we have | |
78 | * a valid signature and everything. | |
79 | */ | |
80 | void SetTrusted(bool const Trusted); | |
81 | ||
862bafea | 82 | virtual ~indexRecords(); |
7db98ffc MZ |
83 | }; |
84 | ||
586d8704 | 85 | APT_IGNORE_DEPRECATED_PUSH |
7db98ffc MZ |
86 | struct indexRecords::checkSum |
87 | { | |
8f3ba4e8 | 88 | std::string MetaKeyFilename; |
b3501edb | 89 | HashStringList Hashes; |
650faab0 | 90 | unsigned long long Size; |
b3501edb DK |
91 | |
92 | APT_DEPRECATED HashString Hash; | |
7db98ffc | 93 | }; |
586d8704 | 94 | APT_IGNORE_DEPRECATED_POP |
7db98ffc MZ |
95 | |
96 | #endif |