RESTinio
|
Type of object that tells that new connection has been accepted. More...
#include <connection_state_listener.hpp>
Public Member Functions | |
accepted_t (tls_socket_t *tls_socket) | |
RESTINIO_NODISCARD bool | is_tls_connection () const noexcept |
Checks if the accepted connection is a TLS-connection. More... | |
template<typename Lambda > | |
void | try_inspect_tls (Lambda &&lambda) const |
Calls the specified lambda-function if the accepted connection is a TLS-connection. More... | |
template<typename Lambda > | |
decltype(auto) | inspect_tls_or_throw (Lambda &&lambda) const |
Calls the specified lambda-function if the accepted connection is a TLS-connection. More... | |
template<typename Lambda , typename T > | |
T | inspect_tls_or_default (Lambda &&lambda, T &&default_value) const |
Calls the specified lambda-function if the accepted connection is a TLS-connection. More... | |
Private Attributes | |
tls_socket_t * | m_tls_socket |
An optional pointer to TLS-related connection. More... | |
Type of object that tells that new connection has been accepted.
If a new connection is a TLS-connection then is_tls_connection() returns true
and the information about TLS-socket can be inspected via try_inspect_tls(), inspect_tls_or_throw() and inspect_tls_or_default() methods.
Definition at line 35 of file connection_state_listener.hpp.
|
inline |
Definition at line 48 of file connection_state_listener.hpp.
T restinio::connection_state::accepted_t::inspect_tls_or_default | ( | Lambda && | lambda, |
T && | default_value | ||
) | const |
Calls the specified lambda-function if the accepted connection is a TLS-connection.
Returns the value of default_value if the accepted connection doens't use TLS.
Lambda function should accept one argument of a type restinio::connection_state::tls_accessor_t (by value of by const reference).
Usage example:
decltype(auto) restinio::connection_state::accepted_t::inspect_tls_or_throw | ( | Lambda && | lambda | ) | const |
Calls the specified lambda-function if the accepted connection is a TLS-connection.
Throws an instance of exception_t if the accepted connection doens't use TLS.
Lambda function should accept one argument of a type restinio::connection_state::tls_accessor_t (by value of by const reference).
Usage example:
|
inlinenoexcept |
Checks if the accepted connection is a TLS-connection.
true | if the accepted connection is a TLS-connection. |
false | if the accepted connection doesn't use TLS. |
Definition at line 61 of file connection_state_listener.hpp.
void restinio::connection_state::accepted_t::try_inspect_tls | ( | Lambda && | lambda | ) | const |
Calls the specified lambda-function if the accepted connection is a TLS-connection.
Do nothing if the accepted connection doens't use TLS.
Lambda function should accept one argument of a type restinio::connection_state::tls_accessor_t (by value of by const reference).
Usage example:
|
private |
An optional pointer to TLS-related connection.
Will be nullptr for non-TLS connections.
Definition at line 45 of file connection_state_listener.hpp.