28 #ifndef WEBSOCKETPP_TRANSPORT_ASIO_SOCKET_BASE_HPP
29 #define WEBSOCKETPP_TRANSPORT_ASIO_SOCKET_BASE_HPP
31 #include <websocketpp/common/asio.hpp>
32 #include <websocketpp/common/memory.hpp>
33 #include <websocketpp/common/functional.hpp>
34 #include <websocketpp/common/system_error.hpp>
35 #include <websocketpp/common/cpp11.hpp>
36 #include <websocketpp/common/connection_hdl.hpp>
67 typedef lib::function<
void(lib::asio::error_code
const &)> shutdown_handler;
110 class socket_category :
public lib::error_category {
112 char const * name()
const _WEBSOCKETPP_NOEXCEPT_TOKEN_ {
113 return "websocketpp.transport.asio.socket";
116 std::string message(
int value)
const {
118 case error::security:
119 return "Security policy error";
121 return "Socket component error";
122 case error::invalid_state:
123 return "Invalid state";
124 case error::invalid_tls_context:
125 return "Invalid or empty TLS context supplied";
126 case error::tls_handshake_timeout:
127 return "TLS handshake timed out";
128 case error::pass_through:
129 return "Pass through from socket policy";
130 case error::missing_tls_init_handler:
131 return "Required tls_init handler not present.";
132 case error::tls_handshake_failed:
133 return "TLS handshake failed";
134 case error::tls_failed_sni_hostname:
135 return "Failed to set TLS SNI hostname";
142 inline lib::error_category
const & get_socket_category() {
143 static socket_category instance;
147 inline lib::error_code make_error_code(error::value e) {
148 return lib::error_code(
static_cast<
int>(e), get_socket_category());
152 typedef lib::function<
void(
const lib::error_code&)> init_handler;