////
Copyright 2019 Damian Jarek

Distributed under the Boost Software License, Version 1.0.

See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt
////

= TLS extensions, `<boost/certify/extensions.hpp>`

This file contains extensions to the implementation of `asio::ssl`.

== sni_hostname(stream)
[source, c++]
----
template<class AsyncStream>
boost::string_view
sni_hostname(boost::asio::asio::ssl::stream<AsyncStream> const& stream);
----

Returns the SNI hostname set on the provided stream or a default
constructed `string_view` if none was set.

== sni_hostname(stream, hostname, error_code)
[source, c++]
----
template<class AsyncStream>
void
sni_hostname(boost::asio::asio::ssl::stream<AsyncStream>& stream,
             std::string const& hostname,
             boost::system::error_code& ec);
----

Sets the provided SNI hostname on the provided stream. On success, `ec` is
cleared, on error it will contain an error.

== sni_hostname(stream, hostname)
[source, c++]
----
template<class AsyncStream>
void
sni_hostname(asio::ssl::stream<AsyncStream>& stream,
             std::string const& hostname);
----

Sets the provided SNI hostname on the provided stream. On error a
`boost::system::system_error` is thrown.
