/* */ #ifndef _D_FTP_CONNECTION_H_ #define _D_FTP_CONNECTION_H_ #include "common.h" #include "Socket.h" #include "Option.h" #include "Logger.h" #include "Segment.h" #include "Request.h" #include class FtpConnection { private: int32_t cuid; SocketHandle socket; RequestHandle req; const Option* option; const Logger* logger; string strbuf; int32_t getStatus(const string& response) const; bool isEndOfResponse(int32_t status, const string& response) const; bool bulkReceiveResponse(pair& response); public: FtpConnection(int32_t cuid, const SocketHandle& socket, const RequestHandle req, const Option* op); ~FtpConnection(); void sendUser() const; void sendPass() const; void sendType() const; void sendCwd() const; void sendSize() const; void sendPasv() const; SocketHandle sendPort() const; void sendRest(const SegmentHandle& segment) const; void sendRetr() const; int32_t receiveResponse(); int32_t receiveSizeResponse(int64_t& size); int32_t receivePasvResponse(pair& dest); }; #endif // _D_FTP_CONNECTION_H_