restinio::socket_type_dependent_settings_t< Settings, tls_socket_t > Class Template Reference

Customizes extra settings needed for working with socket. More...

`#include <tls.hpp>`

## Public Member Functions

| socket_type_dependent_settings_t ()=default
| socket_type_dependent_settings_t (socket_type_dependent_settings_t &&)=default
Settings & | tls_context (asio_ns::ssl::context context) &
| Setup an exclusive TLS-context for server's settings. More...
Settings && | tls_context (asio_ns::ssl::context context) &&
| Setup an exclusive TLS-context for server's settings. More...
Settings & | tls_context (std::shared_ptr< asio_ns::ssl::context > shared_context) &
| Setup a shared TLS-context for server's settings. More...
Settings && | tls_context (std::shared_ptr< asio_ns::ssl::context > shared_context) &&
| Setup a shared TLS-context for server's settings. More...
asio_ns::ssl::context | tls_context ()
std::shared_ptr< asio_ns::ssl::context > | giveaway_tls_context ()
| Get away the TLS-context from settings. More...

## Protected Member Functions

| ~socket_type_dependent_settings_t ()=default

## Private Member Functions

Settings & | upcast_reference ()

## Private Attributes

std::shared_ptr< asio_ns::ssl::context > | m_tls_context

## Detailed Description

template<typename Settings>
class restinio::socket_type_dependent_settings_t< Settings, tls_socket_t >

Customizes extra settings needed for working with socket.

Adds tls context setting.

Definition at line 189 of file tls.hpp.

## Constructor & Destructor Documentation

## ~socket_type_dependent_settings_t()

template<typename Settings >

restinio::socket_type_dependent_settings_t< Settings, tls_socket_t >::~socket_type_dependent_settings_t | ( |  | ) |

protecteddefault

## socket_type_dependent_settings_t() [1/2]

template<typename Settings >

restinio::socket_type_dependent_settings_t< Settings, tls_socket_t >::socket_type_dependent_settings_t | ( |  | ) |

default

## socket_type_dependent_settings_t() [2/2]

template<typename Settings >

restinio::socket_type_dependent_settings_t< Settings, tls_socket_t >::socket_type_dependent_settings_t | ( | socket_type_dependent_settings_t< Settings, tls_socket_t > && |  | ) |

default

## Member Function Documentation

## giveaway_tls_context()

template<typename Settings >

std::shared_ptr< asio_ns::ssl::context > restinio::socket_type_dependent_settings_t< Settings, tls_socket_t >::giveaway_tls_context | ( |  | ) |

inline

Get away the TLS-context from settings.

Note
  This method is intended to be used by RESTinio's internals.

Since
  v.0.6.10

Definition at line 318 of file tls.hpp.

## tls_context() [1/5]

template<typename Settings >

asio_ns::ssl::context restinio::socket_type_dependent_settings_t< Settings, tls_socket_t >::tls_context | ( |  | ) |

inline

Deprecated:
  This method is going to be removed in v.0.7. giveaway_tls_context() should be used instead.

Definition at line 302 of file tls.hpp.

## tls_context() [2/5]

template<typename Settings >

Settings & restinio::socket_type_dependent_settings_t< Settings, tls_socket_t >::tls_context | ( | asio_ns::ssl::context | context | ) | &

inline

Setup an exclusive TLS-context for server's settings.

Definition at line 201 of file tls.hpp.

## tls_context() [3/5]

template<typename Settings >

Settings && restinio::socket_type_dependent_settings_t< Settings, tls_socket_t >::tls_context | ( | asio_ns::ssl::context | context | ) | &&

inline

Setup an exclusive TLS-context for server's settings.

Definition at line 211 of file tls.hpp.

## tls_context() [4/5]

template<typename Settings >

Settings & restinio::socket_type_dependent_settings_t< Settings, tls_socket_t >::tls_context | ( | std::shared_ptr< asio_ns::ssl::context > | shared_context | ) | &

inline

Setup a shared TLS-context for server's settings.

This method can be used when several servers should share the same TLS context. Or if TLS should be shared with some other entity in an application.

Example:

using traits_t = restinio::default_tls_traits_t;
auto tls_context = std::make_shared< asio::ssl::context >(
asio::ssl::context::sslv23 );
... // Tuning of tls_context.
restinio::server_settings_t< traits_t > first_settings;
first_settings.address( "localhost" );
first_settings.port( 443 );
first_settings.tls_context( tls_context );
...
restinio::server_settings_t< traits_t > second_settings;
second_settings.address( "localhost" );
second_settings.port( 5553 );
second_settings.tls_context( tls_context );
...
restinio::basic_server_settings_t::port
Derived & port(std::uint16_t p) &
Server endpoint.
Definition: settings.hpp:586
restinio::basic_server_settings_t::address
Derived & address(std::string addr) &
Definition: settings.hpp:643
restinio::server_settings_t
A fluent style interface for setting http server params.
Definition: settings.hpp:1768
restinio::socket_type_dependent_settings_t< Settings, tls_socket_t >::tls_context
asio_ns::ssl::context tls_context()
Definition: tls.hpp:302
restinio::default_tls_traits_t
tls_traits_t< asio_timer_manager_t, null_logger_t > default_tls_traits_t
Definition: tls.hpp:152

Since
  v.0.6.10

Definition at line 247 of file tls.hpp.

## tls_context() [5/5]

template<typename Settings >

Settings && restinio::socket_type_dependent_settings_t< Settings, tls_socket_t >::tls_context | ( | std::shared_ptr< asio_ns::ssl::context > | shared_context | ) | &&

inline

Setup a shared TLS-context for server's settings.

This method can be used when several servers should share the same TLS context. Or if TLS should be shared with some other entity in an application.

Example:

using traits_t = restinio::default_tls_traits_t;
auto tls_context = std::make_shared< asio::ssl::context >(
asio::ssl::context::sslv23 );
... // Tuning of tls_context.
auto first_server = restinio::run_async< traits_t >(
restinio::own_io_context(),
restinio::server_settings_t< traits_t >{}
.address( "localhost" )
.port( 443 )
.tls_context( tls_context ),
4u );
auto second_server = restinio::run_async< traits_t >(
restinio::own_io_context(),
restinio::server_settings_t< traits_t >{}
.address( "localhost" )
.port( 5553 )
.tls_context( tls_context ),
4u );
restinio::own_io_context
io_context_holder_t own_io_context()
Function which tells that http_server should create and use its own instance of io_context.
Definition: http_server.hpp:65

Since
  v.0.6.10

Definition at line 288 of file tls.hpp.

## upcast_reference()

template<typename Settings >

Settings & restinio::socket_type_dependent_settings_t< Settings, tls_socket_t >::upcast_reference | ( |  | ) |

inlineprivate

Definition at line 325 of file tls.hpp.

## Member Data Documentation

## m_tls_context

template<typename Settings >

std::shared_ptr< asio_ns::ssl::context > restinio::socket_type_dependent_settings_t< Settings, tls_socket_t >::m_tls_context

private

Initial value:
{
std::make_shared< asio_ns::ssl::context >(
asio_ns::ssl::context::sslv23 )
}

Definition at line 330 of file tls.hpp.

The documentation for this class was generated from the following file:

- restinio/tls.hpp