/* */ #ifndef D_SFTP_NEGOTIATION_COMMAND_H #define D_SFTP_NEGOTIATION_COMMAND_H #include "AbstractCommand.h" namespace aria2 { class SocketCore; class AuthConfig; class SftpNegotiationCommand : public AbstractCommand { public: enum Seq { SEQ_HANDSHAKE, SEQ_AUTH_PASSWORD, SEQ_SFTP_OPEN, SEQ_SFTP_STAT, SEQ_SFTP_SEEK, SEQ_NEGOTIATION_COMPLETED, SEQ_DOWNLOAD_ALREADY_COMPLETED, SEQ_HEAD_OK, SEQ_FILE_PREPARATION, SEQ_EXIT, }; private: void onFileSizeDetermined(int64_t totalLength); void poolConnection() const; void onDryRunFileFound(); std::string getPath() const; std::shared_ptr socket_; Seq sequence_; std::unique_ptr authConfig_; // remote file path std::string path_; // expected host's public key message digest: hash type and digest // (raw binary value). std::string hashType_; std::string digest_; protected: virtual bool executeInternal() CXX11_OVERRIDE; public: SftpNegotiationCommand(cuid_t cuid, const std::shared_ptr& req, const std::shared_ptr& fileEntry, RequestGroup* requestGroup, DownloadEngine* e, const std::shared_ptr& s, Seq seq = SEQ_HANDSHAKE); virtual ~SftpNegotiationCommand(); }; } // namespace aria2 #endif // D_SFTP_NEGOTIATION_COMMAND_H