RESTinio
Loading...
Searching...
No Matches
connection_state_listener.hpp
Go to the documentation of this file.
1/*
2 * RESTinio
3 */
4
12#pragma once
13
16#include <restinio/tls_fwd.hpp>
17
18#include <variant>
19
20namespace restinio
21{
22
23namespace connection_state
24{
25
37{
47
48public:
53
60 [[nodiscard]]
61 bool
63
93 template< typename Lambda >
94 void
95 try_inspect_tls( Lambda && lambda ) const;
96
129 template< typename Lambda >
130 decltype(auto)
132
170 template< typename Lambda, typename T >
171 T
173};
174
184{
185};
186
199
209using cause_t = std::variant< accepted_t, closed_t, upgraded_to_websocket_t >;
210
258
271{
272 // empty type by design.
273};
274
275} /* namespace connection_state */
276
277} /* namespace restinio */
278
Type of object that tells that new connection has been accepted.
decltype(auto) inspect_tls_or_throw(Lambda &&lambda) const
Calls the specified lambda-function if the accepted connection is a TLS-connection.
Definition tls.hpp:109
T inspect_tls_or_default(Lambda &&lambda, T &&default_value) const
Calls the specified lambda-function if the accepted connection is a TLS-connection.
Definition tls.hpp:120
tls_socket_t * m_tls_socket
An optional pointer to TLS-related connection.
void try_inspect_tls(Lambda &&lambda) const
Calls the specified lambda-function if the accepted connection is a TLS-connection.
Definition tls.hpp:101
bool is_tls_connection() const noexcept
Checks if the accepted connection is a TLS-connection.
Type of object that tells that the connection has been closed.
An object with info about connection to be passed to state listener.
endpoint_t remote_endpoint() const noexcept
Get the remote endpoint for the connection.
connection_id_t connection_id() const noexcept
Get the connection id.
notice_t(connection_id_t conn_id, endpoint_t remote_endpoint, cause_t cause)
Initializing constructor.
cause_t cause() const noexcept
Get the cause for the notification.
Type of object that tells that the connection has been upgraded to WebSocket.
Socket adapter for asio::ssl::stream< asio::ip::tcp::socket >.
Detection of compiler version and absence of various features.
std::variant< accepted_t, closed_t, upgraded_to_websocket_t > cause_t
A type for the representation of the current state of a connection.
asio_ns::ip::tcp::endpoint endpoint_t
An alias for endpoint type from Asio.
run_on_this_thread_settings_t< Traits > on_this_thread()
A special marker for the case when http_server must be run on the context of the current thread.
std::uint64_t connection_id_t
Type for ID of connection.
Forward declarations for TLS-related things.