#ifndef cVerify_h #define cVerify_h class cSocket; class sFile; #define BLOCK_RECIVE 2000 #define BLOCK_VERIFY 4000 typedef struct { size_t von; size_t bis; size_t stat; // 0=Not Fetched 1 ... 1000 In Progress 2000=Fetched (only 2000 saved on file) time_t since; } dtype; typedef std::map tRange_Map; typedef enum { tED2K = 1, tTIGER_TREE = 2, tSHA1_FULL = 4 } eHASH; class cVerify { private: eHASH Type; public: cVerify (int fd); // Hash an Compleate file cVerify (int fd, int part, bool check); // Load from part.met virtual ~cVerify () = 0; virtual bool Store (int fd) = 0; // Write it to part.met with its tags virtual int Verify (int fd, size_t *von, size_t *bis) = 0; // 1 mean Range is OK // 0 mean Range is defekt, but with request more hashes it can be defined smaller // -1 mean Range is defekt, this hash can not define it finer // -2 mean Range need more hash to be verified // -3 mean Range with this smal amount can not be verified // Range is modified to the first defekt virtual bool RequestHash (class cSocket *, size_t von, size_t bis) = 0; // Request Hash list that at least can check this range // and can be verified against the top hash virtual bool SendHash (class cSocket *, size_t von, size_t bis, size_t level) = 0; // Transmit the hashes that cover this range virtual bool SendInfo (class cSocket *, tRange_Map *) = 0; // Send info wich file Data is avail (verified) virtual tRange_Map* RequestInfo (class cSocket *) = 0; // Return the part list avail for this source }; #endif