TLS enabled Boost ASIO connection socket component.
More...
#include <tls.hpp>
|
typedef connection | type |
| Type of this connection socket component.
|
|
typedef lib::shared_ptr< type > | ptr |
| Type of a shared pointer to this connection socket component.
|
|
typedef lib::asio::ssl::stream< lib::asio::ip::tcp::socket > | socket_type |
| Type of the ASIO socket being used.
|
|
typedef lib::shared_ptr< socket_type > | socket_ptr |
| Type of a shared pointer to the ASIO socket being used.
|
|
typedef lib::asio::io_service * | io_service_ptr |
| Type of a pointer to the ASIO io_service being used.
|
|
typedef lib::shared_ptr< lib::asio::io_service::strand > | strand_ptr |
| Type of a pointer to the ASIO io_service strand being used.
|
|
typedef lib::shared_ptr< lib::asio::ssl::context > | context_ptr |
| Type of a shared pointer to the ASIO TLS context being used.
|
|
TLS enabled Boost ASIO connection socket component.
transport::asio::tls_socket::connection implements a secure connection socket component that uses Asio's ssl::stream to wrap an ip::tcp::socket.
Definition at line 63 of file tls.hpp.
socket_type::next_layer_type& websocketpp::transport::asio::tls_socket::connection::get_next_layer |
( |
| ) |
|
|
inline |
Retrieve a pointer to the layer below the ssl stream.
This is used internally.
Definition at line 111 of file tls.hpp.
socket_type::lowest_layer_type& websocketpp::transport::asio::tls_socket::connection::get_raw_socket |
( |
| ) |
|
|
inline |
Retrieve a pointer to the underlying socket.
This is used internally. It can also be used to set socket options, etc
Definition at line 103 of file tls.hpp.
std::string websocketpp::transport::asio::tls_socket::connection::get_remote_endpoint |
( |
lib::error_code & |
ec | ) |
const |
|
inline |
Get the remote endpoint address.
The iostream transport has no information about the ultimate remote endpoint. It will return the string "iostream transport". To indicate this.
TODO: allow user settable remote endpoint addresses if this seems useful
- Returns
- A string identifying the address of the remote endpoint
Definition at line 158 of file tls.hpp.
socket_type& websocketpp::transport::asio::tls_socket::connection::get_socket |
( |
| ) |
|
|
inline |
Retrieve a pointer to the wrapped socket.
This is used internally.
Definition at line 119 of file tls.hpp.
lib::error_code websocketpp::transport::asio::tls_socket::connection::init_asio |
( |
io_service_ptr |
service, |
|
|
strand_ptr |
strand, |
|
|
bool |
is_server |
|
) |
| |
|
inlineprotected |
Perform one time initializations.
init_asio is called once immediately after construction to initialize Asio components to the io_service
- Parameters
-
service | A pointer to the endpoint's io_service |
strand | A pointer to the connection's strand |
is_server | Whether or not the endpoint is a server or not. |
Definition at line 185 of file tls.hpp.
bool websocketpp::transport::asio::tls_socket::connection::is_secure |
( |
| ) |
const |
|
inline |
Check whether or not this connection is secure.
- Returns
- Whether or not this connection is secure
Definition at line 95 of file tls.hpp.
void websocketpp::transport::asio::tls_socket::connection::post_init |
( |
init_handler |
callback | ) |
|
|
inlineprotected |
Post-initialize security policy.
Called by the transport after all intermediate proxies have been negotiated. This gives the security policy the chance to talk with the real remote endpoint for a bit before the websocket handshake.
- Parameters
-
callback | Handler to call back with completion information |
Definition at line 263 of file tls.hpp.
void websocketpp::transport::asio::tls_socket::connection::pre_init |
( |
init_handler |
callback | ) |
|
|
inlineprotected |
Pre-initialize security policy.
Called by the transport after a new connection is created to initialize the socket component of the connection. This method is not allowed to write any bytes to the wire. This initialization happens before any proxies or other intermediate wrappers are negotiated.
- Parameters
-
callback | Handler to call back with completion information |
Definition at line 231 of file tls.hpp.
void websocketpp::transport::asio::tls_socket::connection::set_handle |
( |
connection_hdl |
hdl | ) |
|
|
inlineprotected |
Sets the connection handle.
The connection handle is passed to any handlers to identify the connection
- Parameters
-
Definition at line 295 of file tls.hpp.
void websocketpp::transport::asio::tls_socket::connection::set_socket_init_handler |
( |
socket_init_handler |
h | ) |
|
|
inline |
Set the socket initialization handler.
The socket initialization handler is called after the socket object is created but before it is used. This gives the application a chance to set any ASIO socket options it needs.
- Parameters
-
h | The new socket_init_handler |
Definition at line 131 of file tls.hpp.
void websocketpp::transport::asio::tls_socket::connection::set_tls_init_handler |
( |
tls_init_handler |
h | ) |
|
|
inline |
Set TLS init handler.
The tls init handler is called when needed to request a TLS context for the library to use. A TLS init handler must be set and it must return a valid TLS context in order for this endpoint to be able to initialize TLS connections
- Parameters
-
h | The new tls_init_handler |
Definition at line 144 of file tls.hpp.
void websocketpp::transport::asio::tls_socket::connection::set_uri |
( |
uri_ptr |
u | ) |
|
|
inlineprotected |
Set hostname hook.
Called by the transport as a connection is being established to provide the hostname being connected to to the security/socket layer.
This socket policy uses the hostname to set the appropriate TLS SNI header.
- Since
- 0.6.0
- Parameters
-
Definition at line 218 of file tls.hpp.
lib::error_code websocketpp::transport::asio::tls_socket::connection::translate_ec |
( |
boost::system::error_code |
ec | ) |
|
|
inlineprotected |
Translate any security policy specific information about an error code.
Translate_ec takes a boost error code and attempts to convert its value to an appropriate websocketpp error code. Any error that is determined to be related to TLS but does not have a more specific websocketpp error code is returned under the catch all error "tls_error".
Non-TLS related errors are returned as the transport generic pass_through error.
- Since
- 0.3.0
- Parameters
-
ec | The error code to translate_ec |
- Returns
- The translated error code
Definition at line 337 of file tls.hpp.
The documentation for this class was generated from the following file:
- websocketpp/transport/asio/security/tls.hpp