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