/* */ #ifndef _D_BT_CONTEXT_H_ #define _D_BT_CONTEXT_H_ #include "DownloadContext.h" #include #include namespace aria2 { class AnnounceTier; class RequestGroup; class BtContext:public DownloadContext { protected: bool _private; public: BtContext():_private(false) {} virtual ~BtContext() {} virtual const unsigned char* getInfoHash() const = 0; virtual size_t getInfoHashLength() const = 0; virtual const std::string& getInfoHashAsString() const = 0; virtual std::deque > getAnnounceTiers() const = 0; virtual void load(const std::string& torrentFile) = 0; /** * Returns the peer id of localhost, 20 byte length */ virtual const unsigned char* getPeerId() = 0; bool isPrivate() const { return _private; } virtual void computeFastSet (std::deque& fastSet, const std::string& ipaddr, size_t fastSetSize) = 0; virtual RequestGroup* getOwnerRequestGroup() = 0; virtual std::deque >& getNodes() = 0; static const std::string NAME; static const std::string FILES; static const std::string LENGTH; static const std::string PATH; static const std::string INFO; static const std::string PIECES; static const std::string PIECE_LENGTH; static const std::string PRIVATE; // This is just a string "1". Used as a value of "private" flag. static const std::string PRIVATE_ON; static const std::string URL_LIST; static const std::string ANNOUNCE; static const std::string ANNOUNCE_LIST; static const std::string NODES; }; class BtContext; typedef SharedHandle BtContextHandle; } // namespace aria2 #endif // _D_BT_CONTEXT_H_