Add TcpEndpoint to network facade
This commit is contained in:
parent
51cd897b96
commit
53c4fdb746
1 changed files with 28 additions and 0 deletions
|
@ -64,8 +64,36 @@ public:
|
||||||
template <typename Buffer, typename Match>
|
template <typename Buffer, typename Match>
|
||||||
friend inline constexpr auto AsyncReadUntil(TcpSocket& socket, Buffer buffer, Match match);
|
friend inline constexpr auto AsyncReadUntil(TcpSocket& socket, Buffer buffer, Match match);
|
||||||
};
|
};
|
||||||
|
class TcpEntry;
|
||||||
|
|
||||||
|
class TcpEndpoint {
|
||||||
|
boost::asio::ip::tcp::endpoint impl;
|
||||||
|
inline constexpr TcpEndpoint(boost::asio::ip::tcp::endpoint impl) : impl(std::move(impl)) {};
|
||||||
|
public:
|
||||||
|
friend TcpEntry;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class TcpEntry {
|
||||||
|
boost::asio::ip::tcp::resolver::results_type::value_type impl;
|
||||||
|
public:
|
||||||
|
inline constexpr TcpEntry() = default;
|
||||||
|
inline constexpr TcpEntry(const TcpEndpoint& ep,
|
||||||
|
std::string_view host,
|
||||||
|
std::string_view service) : impl(ep.impl, host, service) {};
|
||||||
|
inline constexpr auto Endpoint() -> TcpEndpoint {
|
||||||
|
return {this->impl.endpoint()};
|
||||||
|
};
|
||||||
|
inline constexpr auto HostName() -> std::string {
|
||||||
|
return this->impl.host_name();
|
||||||
|
};
|
||||||
|
inline constexpr auto ServiceName() -> std::string {
|
||||||
|
return this->impl.service_name();
|
||||||
|
};
|
||||||
|
inline constexpr operator TcpEndpoint() {
|
||||||
|
return {this->impl};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
class TcpResolver {
|
class TcpResolver {
|
||||||
|
|
Loading…
Reference in a new issue