/* */ #ifndef D_PEER_LISTEN_COMMAND_H #define D_PEER_LISTEN_COMMAND_H #include "Command.h" #include "SharedHandle.h" #include "IntSequence.h" namespace aria2 { class DownloadEngine; class SocketCore; class PeerListenCommand : public Command { private: DownloadEngine* e_; int family_; SharedHandle socket_; unsigned int lowestSpeedLimit_; static unsigned int numInstance_; static PeerListenCommand* instance_; static PeerListenCommand* instance6_; public: PeerListenCommand(cuid_t cuid, DownloadEngine* e, int family); virtual ~PeerListenCommand(); virtual bool execute(); /** * Binds port. If successful, the binded port number is assinged to port and * returns true, otherwise port is undefined and returns false. */ bool bindPort(uint16_t& port, IntSequence& seq); // Returns binded port uint16_t getPort() const; void setLowestSpeedLimit(unsigned int speed) { lowestSpeedLimit_ = speed; } static PeerListenCommand* getInstance(DownloadEngine* e, int family); static unsigned int getNumInstance() { return numInstance_; } }; } // namespace aria2 #endif // D_PEER_LISTEN_COMMAND_H