/* */ #ifndef _D_DOWNLOAD_COMMAND_H_ #define _D_DOWNLOAD_COMMAND_H_ #include "AbstractCommand.h" namespace aria2 { class TransferEncoding; class Decoder; class PeerStat; #ifdef ENABLE_MESSAGE_DIGEST class MessageDigestContext; #endif // ENABLE_MESSAGE_DIGEST class DownloadCommand : public AbstractCommand { private: unsigned int maxDownloadSpeedLimit; time_t startupIdleTime; unsigned int lowestDownloadSpeedLimit; SharedHandle peerStat; #ifdef ENABLE_MESSAGE_DIGEST bool _pieceHashValidationEnabled; SharedHandle _messageDigestContext; #endif // ENABLE_MESSAGE_DIGEST void validatePieceHash(const SharedHandle& segment, const std::string& expectedPieceHash, const std::string& actualPieceHash); void checkLowestDownloadSpeed() const; protected: SharedHandle transferDecoder; SharedHandle _contentEncodingDecoder; virtual bool executeInternal(); virtual bool prepareForNextSegment(); public: DownloadCommand(int cuid, const SharedHandle& req, RequestGroup* requestGroup, DownloadEngine* e, const SharedHandle& s); virtual ~DownloadCommand(); void setTransferDecoder(const SharedHandle& transferDecoder); void setContentEncodingDecoder(const SharedHandle& decoder); void setMaxDownloadSpeedLimit(unsigned int maxDownloadSpeedLimit) { this->maxDownloadSpeedLimit = maxDownloadSpeedLimit; } void setStartupIdleTime(time_t startupIdleTime) { this->startupIdleTime = startupIdleTime; } void setLowestDownloadSpeedLimit(unsigned int lowestDownloadSpeedLimit) { this->lowestDownloadSpeedLimit = lowestDownloadSpeedLimit; } }; } // namespace aria2 #endif // _D_DOWNLOAD_COMMAND_H_