/* */ #ifndef _D_FTP_NEGOTIATION_COMMAND_H_ #define _D_FTP_NEGOTIATION_COMMAND_H_ #include "AbstractCommand.h" namespace aria2 { class FtpConnection; class SocketCore; class FtpNegotiationCommand : public AbstractCommand { private: enum Seq { SEQ_RECV_GREETING, SEQ_SEND_USER, SEQ_RECV_USER, SEQ_SEND_PASS, SEQ_RECV_PASS, SEQ_SEND_TYPE, SEQ_RECV_TYPE, SEQ_SEND_CWD, SEQ_RECV_CWD, SEQ_SEND_SIZE, SEQ_RECV_SIZE, SEQ_SEND_PORT, SEQ_RECV_PORT, SEQ_SEND_PASV, SEQ_RECV_PASV, SEQ_SEND_REST_PASV, SEQ_SEND_REST, SEQ_RECV_REST, SEQ_SEND_RETR, SEQ_RECV_RETR, SEQ_WAIT_CONNECTION, SEQ_NEGOTIATION_COMPLETED, SEQ_RETRY, SEQ_HEAD_OK, SEQ_DOWNLOAD_ALREADY_COMPLETED, SEQ_FILE_PREPARATION }; bool recvGreeting(); bool sendUser(); bool recvUser(); bool sendPass(); bool recvPass(); bool sendType(); bool recvType(); bool sendCwd(); bool recvCwd(); bool sendSize(); bool recvSize(); bool sendPort(); bool recvPort(); bool sendPasv(); bool recvPasv(); bool sendRest(const SharedHandle& segment); bool sendRestPasv(const SharedHandle& segment); bool recvRest(); bool sendRetr(); bool recvRetr(); bool waitConnection(); bool processSequence(const SharedHandle& segment); void afterFileAllocation(); SharedHandle dataSocket; SharedHandle serverSocket; int32_t sequence; FtpConnection* ftp; protected: virtual bool executeInternal(); public: FtpNegotiationCommand(int32_t cuid, const SharedHandle& req, RequestGroup* requestGroup, DownloadEngine* e, const SharedHandle& s); virtual ~FtpNegotiationCommand(); }; } // namespace aria2 #endif // _D_FTP_NEGOTIATION_COMMAND_H_