clboss/Net/Connector.hpp
2020-09-14 10:58:33 +08:00

27 lines
493 B
C++

#ifndef NET_CONNECTOR_HPP
#define NET_CONNECTOR_HPP
#include<string>
namespace Net { class SocketFd; }
namespace Net {
/* Interface to an entity that is capable of connecting
* to a host:port.
* This is an abstract interface since we might want to
* use a proxy of some kind.
*/
class Connector {
public:
virtual ~Connector() { }
/* Returns null if failed to connect. */
virtual
Net::SocketFd
connect(std::string const& host, int port) =0;
};
}
#endif /* NET_CONNECTOR_HPP */