00001
00002
00003
00004
00005 #ifndef PKGLIB_INDEXRECORDS_H
00006 #define PKGLIB_INDEXRECORDS_H
00007
00008
00009 #include <apt-pkg/pkgcache.h>
00010 #include <apt-pkg/fileutl.h>
00011 #include <apt-pkg/hashes.h>
00012
00013 #include <map>
00014 #include <vector>
00015 #include <ctime>
00016
00017 class indexRecords
00018 {
00019 bool parseSumData(const char *&Start, const char *End, string &Name,
00020 string &Hash, size_t &Size);
00021 public:
00022 struct checkSum;
00023 string ErrorText;
00024
00025 protected:
00026 string Dist;
00027 string Suite;
00028 string ExpectedDist;
00029 time_t ValidUntil;
00030
00031 std::map<string,checkSum *> Entries;
00032
00033 public:
00034
00035 indexRecords();
00036 indexRecords(const string ExpectedDist);
00037
00038
00039 virtual const checkSum *Lookup(const string MetaKey);
00041 bool Exists(string const &MetaKey) const;
00042 std::vector<std::string> MetaKeys();
00043
00044 virtual bool Load(string Filename);
00045 string GetDist() const;
00046 time_t GetValidUntil() const;
00047 virtual bool CheckDist(const string MaybeDist) const;
00048 string GetExpectedDist() const;
00049 virtual ~indexRecords(){};
00050 };
00051
00052 struct indexRecords::checkSum
00053 {
00054 string MetaKeyFilename;
00055 HashString Hash;
00056 size_t Size;
00057 };
00058
00059 #endif