/* */ #ifndef D_DOWNLOAD_COMMAND_H #define D_DOWNLOAD_COMMAND_H #include "AbstractCommand.h" #include namespace aria2 { class PeerStat; class StreamFilter; #ifdef ENABLE_MESSAGE_DIGEST class MessageDigest; #endif // ENABLE_MESSAGE_DIGEST class DownloadCommand : public AbstractCommand { private: time_t startupIdleTime_; int lowestDownloadSpeedLimit_; SharedHandle peerStat_; bool pieceHashValidationEnabled_; #ifdef ENABLE_MESSAGE_DIGEST SharedHandle messageDigest_; #endif // ENABLE_MESSAGE_DIGEST void validatePieceHash(const SharedHandle& segment, const std::string& expectedPieceHash, const std::string& actualPieceHash); void checkLowestDownloadSpeed() const; void completeSegment(cuid_t cuid, const SharedHandle& segment); SharedHandle streamFilter_; bool sinkFilterOnly_; protected: virtual bool executeInternal(); virtual bool prepareForNextSegment(); // This is file local offset virtual int64_t getRequestEndOffset() const = 0; public: DownloadCommand(cuid_t cuid, const SharedHandle& req, const SharedHandle& fileEntry, RequestGroup* requestGroup, DownloadEngine* e, const SharedHandle& s, const SharedHandle& socketRecvBuffer); virtual ~DownloadCommand(); const SharedHandle& getStreamFilter() const { return streamFilter_; } void installStreamFilter(const SharedHandle& streamFilter); void setStartupIdleTime(time_t startupIdleTime) { startupIdleTime_ = startupIdleTime; } void setLowestDownloadSpeedLimit(int lowestDownloadSpeedLimit) { lowestDownloadSpeedLimit_ = lowestDownloadSpeedLimit; } }; } // namespace aria2 #endif // D_DOWNLOAD_COMMAND_H