-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
615 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#pragma once | ||
|
||
#include "asio.hpp" | ||
#include "log.h" | ||
#include "noncopyable.hpp" | ||
|
||
#ifdef ASIO_NET_ENABLE_SSL | ||
#include "asio/ssl.hpp" | ||
#endif | ||
|
||
namespace asio_net { | ||
namespace detail { | ||
|
||
enum class socket_type { | ||
normal, | ||
domain, | ||
ssl, | ||
}; | ||
|
||
template <socket_type T> | ||
struct socket_impl; | ||
|
||
template <> | ||
struct socket_impl<socket_type::normal> { | ||
using socket = asio::ip::tcp::socket; | ||
using endpoint = asio::ip::tcp::endpoint; | ||
using resolver = asio::ip::tcp::resolver; | ||
using acceptor = asio::ip::tcp::acceptor; | ||
}; | ||
|
||
template <> | ||
struct socket_impl<socket_type::domain> { | ||
using socket = asio::local::stream_protocol::socket; | ||
using endpoint = asio::local::stream_protocol::endpoint; | ||
using acceptor = asio::local::stream_protocol::acceptor; | ||
}; | ||
|
||
#ifdef ASIO_NET_ENABLE_SSL | ||
template <> | ||
struct socket_impl<socket_type::ssl> { | ||
using socket = asio::ssl::stream<asio::ip::tcp::socket>; | ||
using endpoint = asio::ip::tcp::endpoint; | ||
using resolver = asio::ip::tcp::resolver; | ||
using acceptor = asio::ip::tcp::acceptor; | ||
}; | ||
#endif | ||
|
||
} // namespace detail | ||
} // namespace asio_net |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.