/* */ #ifndef D_INITIATE_CONNECTION_COMMAND_H #define D_INITIATE_CONNECTION_COMMAND_H #include "AbstractCommand.h" namespace aria2 { struct BackupConnectInfo; class ConnectCommand; class InitiateConnectionCommand : public AbstractCommand { protected: /** * Connect to the server. * This method just send connection request to the server. * Using nonblocking mode of socket, this funtion returns immediately * after send connection packet to the server. */ virtual bool executeInternal() CXX11_OVERRIDE; // hostname and port are the hostname and port number we are going // to connect. If proxy server is used, these values are hostname // and port of proxy server. addr is one of resolved address and we // use this address this time. resolvedAddresses are all addresses // resolved. proxyRequest is set if we are going to use proxy // server. virtual std::unique_ptr createNextCommand (const std::string& hostname, const std::string& addr, uint16_t port, const std::vector& resolvedAddresses, const std::shared_ptr& proxyRequest) = 0; void setConnectedAddrInfo (const std::shared_ptr& req, const std::string& hostname, const std::shared_ptr& socket); std::shared_ptr createBackupIPv4ConnectCommand (const std::string& hostname, const std::string& ipaddr, uint16_t port, Command* mainCommand); void setupBackupConnection (const std::string& hostname, const std::string& addr, uint16_t port, ConnectCommand* c); public: InitiateConnectionCommand(cuid_t cuid, const std::shared_ptr& req, const std::shared_ptr& fileEntry, RequestGroup* requestGroup, DownloadEngine* e); virtual ~InitiateConnectionCommand(); }; } // namespace aria2 #endif // D_INITIATE_CONNECTION_COMMAND_H