Provides stream-oriented functionality using SSL. More...
#include <stream.hpp>
Classes | |
struct | impl_struct |
Structure for use with deprecated impl_type. More... | |
Public Types | |
typedef SSL * | native_handle_type |
The native handle type of the SSL stream. More... | |
typedef impl_struct * | impl_type |
(Deprecated: Use native_handle_type.) The underlying implementation type. More... | |
typedef remove_reference < Stream >::type | next_layer_type |
The type of the next layer. More... | |
typedef next_layer_type::lowest_layer_type | lowest_layer_type |
The type of the lowest layer. More... | |
enum | handshake_type { client, server } |
Different handshake types. More... | |
Public Member Functions | |
template<typename Arg > | |
stream (Arg &arg, context &ctx) | |
Construct a stream. More... | |
~stream () | |
Destructor. More... | |
boost::asio::io_service & | get_io_service () |
Get the io_service associated with the object. More... | |
native_handle_type | native_handle () |
Get the underlying implementation in the native type. More... | |
impl_type | impl () |
(Deprecated: Use native_handle().) Get the underlying implementation in the native type. More... | |
const next_layer_type & | next_layer () const |
Get a reference to the next layer. More... | |
next_layer_type & | next_layer () |
Get a reference to the next layer. More... | |
lowest_layer_type & | lowest_layer () |
Get a reference to the lowest layer. More... | |
const lowest_layer_type & | lowest_layer () const |
Get a reference to the lowest layer. More... | |
void | set_verify_mode (verify_mode v) |
Set the peer verification mode. More... | |
boost::system::error_code | set_verify_mode (verify_mode v, boost::system::error_code &ec) |
Set the peer verification mode. More... | |
void | set_verify_depth (int depth) |
Set the peer verification depth. More... | |
boost::system::error_code | set_verify_depth (int depth, boost::system::error_code &ec) |
Set the peer verification depth. More... | |
template<typename VerifyCallback > | |
void | set_verify_callback (VerifyCallback callback) |
Set the callback used to verify peer certificates. More... | |
template<typename VerifyCallback > | |
boost::system::error_code | set_verify_callback (VerifyCallback callback, boost::system::error_code &ec) |
Set the callback used to verify peer certificates. More... | |
void | handshake (handshake_type type) |
Perform SSL handshaking. More... | |
boost::system::error_code | handshake (handshake_type type, boost::system::error_code &ec) |
Perform SSL handshaking. More... | |
template<typename ConstBufferSequence > | |
void | handshake (handshake_type type, const ConstBufferSequence &buffers) |
Perform SSL handshaking. More... | |
template<typename ConstBufferSequence > | |
boost::system::error_code | handshake (handshake_type type, const ConstBufferSequence &buffers, boost::system::error_code &ec) |
Perform SSL handshaking. More... | |
template<typename HandshakeHandler > | |
BOOST_ASIO_INITFN_RESULT_TYPE (HandshakeHandler, void(boost::system::error_code)) async_handshake(handshake_type type | |
Start an asynchronous SSL handshake. More... | |
BOOST_ASIO_MOVE_ARG (HandshakeHandler) handler) | |
template<typename ConstBufferSequence , typename BufferedHandshakeHandler > | |
BOOST_ASIO_INITFN_RESULT_TYPE (BufferedHandshakeHandler, void(boost::system::error_code, std::size_t)) async_handshake(handshake_type type | |
Start an asynchronous SSL handshake. More... | |
const ConstBufferSequence | BOOST_ASIO_MOVE_ARG (BufferedHandshakeHandler) handler) |
void | shutdown () |
Shut down SSL on the stream. More... | |
boost::system::error_code | shutdown (boost::system::error_code &ec) |
Shut down SSL on the stream. More... | |
template<typename ShutdownHandler > | |
BOOST_ASIO_INITFN_RESULT_TYPE (ShutdownHandler, void(boost::system::error_code)) async_shutdown(BOOST_ASIO_MOVE_ARG(ShutdownHandler) handler) | |
Asynchronously shut down SSL on the stream. More... | |
template<typename ConstBufferSequence > | |
std::size_t | write_some (const ConstBufferSequence &buffers) |
Write some data to the stream. More... | |
template<typename ConstBufferSequence > | |
std::size_t | write_some (const ConstBufferSequence &buffers, boost::system::error_code &ec) |
Write some data to the stream. More... | |
template<typename ConstBufferSequence , typename WriteHandler > | |
BOOST_ASIO_INITFN_RESULT_TYPE (WriteHandler, void(boost::system::error_code, std::size_t)) async_write_some(const ConstBufferSequence &buffers | |
Start an asynchronous write. More... | |
BOOST_ASIO_MOVE_ARG (WriteHandler) handler) | |
template<typename MutableBufferSequence > | |
std::size_t | read_some (const MutableBufferSequence &buffers) |
Read some data from the stream. More... | |
template<typename MutableBufferSequence > | |
std::size_t | read_some (const MutableBufferSequence &buffers, boost::system::error_code &ec) |
Read some data from the stream. More... | |
template<typename MutableBufferSequence , typename ReadHandler > | |
BOOST_ASIO_INITFN_RESULT_TYPE (ReadHandler, void(boost::system::error_code, std::size_t)) async_read_some(const MutableBufferSequence &buffers | |
Start an asynchronous read. More... | |
BOOST_ASIO_MOVE_ARG (ReadHandler) handler) | |
Public Attributes | |
const ConstBufferSequence & | buffers |
Provides stream-oriented functionality using SSL.
The stream class template provides asynchronous and blocking stream-oriented functionality using SSL.
typedef impl_struct* boost::asio::ssl::stream< Stream >::impl_type |
(Deprecated: Use native_handle_type.) The underlying implementation type.
typedef next_layer_type::lowest_layer_type boost::asio::ssl::stream< Stream >::lowest_layer_type |
The type of the lowest layer.
typedef SSL* boost::asio::ssl::stream< Stream >::native_handle_type |
The native handle type of the SSL stream.
typedef remove_reference<Stream>::type boost::asio::ssl::stream< Stream >::next_layer_type |
The type of the next layer.
|
inherited |
|
inline |
Construct a stream.
This constructor creates a stream and initialises the underlying stream object.
arg | The argument to be passed to initialise the underlying stream. |
ctx | The SSL context to be used for the stream. |
References boost::asio::ssl::stream< Stream >::impl_struct::ssl.
|
inline |
Destructor.
boost::asio::ssl::stream< Stream >::BOOST_ASIO_INITFN_RESULT_TYPE | ( | HandshakeHandler | , |
void(boost::system::error_code) | |||
) |
Start an asynchronous SSL handshake.
This function is used to asynchronously perform an SSL handshake on the stream. This function call always returns immediately.
type | The type of handshaking to be performed, i.e. as a client or as a server. |
handler | The handler to be called when the handshake operation completes. Copies will be made of the handler as required. The equivalent function signature of the handler must be: |
boost::asio::ssl::stream< Stream >::BOOST_ASIO_INITFN_RESULT_TYPE | ( | BufferedHandshakeHandler | , |
void(boost::system::error_code, std::size_t) | |||
) |
Start an asynchronous SSL handshake.
This function is used to asynchronously perform an SSL handshake on the stream. This function call always returns immediately.
type | The type of handshaking to be performed, i.e. as a client or as a server. |
buffers | The buffered data to be reused for the handshake. Although the buffers object may be copied as necessary, ownership of the underlying buffers is retained by the caller, which must guarantee that they remain valid until the handler is called. |
handler | The handler to be called when the handshake operation completes. Copies will be made of the handler as required. The equivalent function signature of the handler must be: void handler(
std::size_t bytes_transferred // Amount of buffers used in handshake.
);
|
|
inline |
Asynchronously shut down SSL on the stream.
This function is used to asynchronously shut down SSL on the stream. This function call always returns immediately.
handler | The handler to be called when the handshake operation completes. Copies will be made of the handler as required. The equivalent function signature of the handler must be: |
References boost::asio::detail::async_result_init< Handler, Signature >::handler, boost::unit_test::framework::init(), boost::asio::detail::async_result_init< Handler, Signature >::result, and boost::detail::void.
boost::asio::ssl::stream< Stream >::BOOST_ASIO_INITFN_RESULT_TYPE | ( | WriteHandler | , |
void(boost::system::error_code, std::size_t) | |||
) | const |
Start an asynchronous write.
This function is used to asynchronously write one or more bytes of data to the stream. The function call always returns immediately.
buffers | The data to be written to the stream. Although the buffers object may be copied as necessary, ownership of the underlying buffers is retained by the caller, which must guarantee that they remain valid until the handler is called. |
handler | The handler to be called when the write operation completes. Copies will be made of the handler as required. The equivalent function signature of the handler must be: void handler(
std::size_t bytes_transferred // Number of bytes written.
);
|
boost::asio::ssl::stream< Stream >::BOOST_ASIO_INITFN_RESULT_TYPE | ( | ReadHandler | , |
void(boost::system::error_code, std::size_t) | |||
) | const |
Start an asynchronous read.
This function is used to asynchronously read one or more bytes of data from the stream. The function call always returns immediately.
buffers | The buffers into which the data will be read. Although the buffers object may be copied as necessary, ownership of the underlying buffers is retained by the caller, which must guarantee that they remain valid until the handler is called. |
handler | The handler to be called when the read operation completes. Copies will be made of the handler as required. The equivalent function signature of the handler must be: void handler(
std::size_t bytes_transferred // Number of bytes read.
);
|
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Get the io_service associated with the object.
This function may be used to obtain the io_service object that the stream uses to dispatch handlers for asynchronous operations.
|
inline |
Perform SSL handshaking.
This function is used to perform SSL handshaking on the stream. The function call will block until handshaking is complete or an error occurs.
type | The type of handshaking to be performed, i.e. as a client or as a server. |
boost::system::system_error | Thrown on failure. |
Referenced by boost::asio::ssl::stream< Stream >::handshake().
|
inline |
Perform SSL handshaking.
This function is used to perform SSL handshaking on the stream. The function call will block until handshaking is complete or an error occurs.
type | The type of handshaking to be performed, i.e. as a client or as a server. |
ec | Set to indicate what error occurred, if any. |
|
inline |
Perform SSL handshaking.
This function is used to perform SSL handshaking on the stream. The function call will block until handshaking is complete or an error occurs.
type | The type of handshaking to be performed, i.e. as a client or as a server. |
buffers | The buffered data to be reused for the handshake. |
boost::system::system_error | Thrown on failure. |
References boost::asio::ssl::stream< Stream >::handshake().
|
inline |
Perform SSL handshaking.
This function is used to perform SSL handshaking on the stream. The function call will block until handshaking is complete or an error occurs.
type | The type of handshaking to be performed, i.e. as a client or as a server. |
buffers | The buffered data to be reused for the handshake. |
ec | Set to indicate what error occurred, if any. |
|
inline |
(Deprecated: Use native_handle().) Get the underlying implementation in the native type.
This function may be used to obtain the underlying implementation of the context. This is intended to allow access to stream functionality that is not otherwise provided.
|
inline |
Get a reference to the lowest layer.
This function returns a reference to the lowest layer in a stack of stream layers.
|
inline |
Get a reference to the lowest layer.
This function returns a reference to the lowest layer in a stack of stream layers.
|
inline |
Get the underlying implementation in the native type.
This function may be used to obtain the underlying implementation of the context. This is intended to allow access to context functionality that is not otherwise provided.
SSL*
that is suitable for passing to functions such as SSL_get_verify_result
and SSL_get_peer_certificate:
|
inline |
Get a reference to the next layer.
This function returns a reference to the next layer in a stack of stream layers.
|
inline |
Get a reference to the next layer.
This function returns a reference to the next layer in a stack of stream layers.
|
inline |
Read some data from the stream.
This function is used to read data from the stream. The function call will block until one or more bytes of data has been read successfully, or until an error occurs.
buffers | The buffers into which the data will be read. |
boost::system::system_error | Thrown on failure. |
References boost::n.
|
inline |
Read some data from the stream.
This function is used to read data from the stream. The function call will block until one or more bytes of data has been read successfully, or until an error occurs.
buffers | The buffers into which the data will be read. |
ec | Set to indicate what error occurred, if any. |
|
inline |
Set the callback used to verify peer certificates.
This function is used to specify a callback function that will be called by the implementation when it needs to verify a peer certificate.
callback | The function object to be used for verifying a certificate. The function signature of the handler must be: bool verify_callback(
bool preverified, // True if the certificate passed pre-verification.
verify_context& ctx // The peer certificate and other context.
);
|
boost::system::system_error | Thrown on failure. |
SSL_set_verify
.
|
inline |
Set the callback used to verify peer certificates.
This function is used to specify a callback function that will be called by the implementation when it needs to verify a peer certificate.
callback | The function object to be used for verifying a certificate. The function signature of the handler must be: bool verify_callback(
bool preverified, // True if the certificate passed pre-verification.
verify_context& ctx // The peer certificate and other context.
);
|
ec | Set to indicate what error occurred, if any. |
SSL_set_verify
.
|
inline |
Set the peer verification depth.
This function may be used to configure the maximum verification depth allowed by the stream.
depth | Maximum depth for the certificate chain verification that shall be allowed. |
boost::system::system_error | Thrown on failure. |
SSL_set_verify_depth
.
|
inline |
Set the peer verification depth.
This function may be used to configure the maximum verification depth allowed by the stream.
depth | Maximum depth for the certificate chain verification that shall be allowed. |
ec | Set to indicate what error occurred, if any. |
SSL_set_verify_depth
.
|
inline |
Set the peer verification mode.
This function may be used to configure the peer verification mode used by the stream. The new mode will override the mode inherited from the context.
v | A bitmask of peer verification modes. See verify_mode for available values. |
boost::system::system_error | Thrown on failure. |
SSL_set_verify
.
|
inline |
Set the peer verification mode.
This function may be used to configure the peer verification mode used by the stream. The new mode will override the mode inherited from the context.
v | A bitmask of peer verification modes. See verify_mode for available values. |
ec | Set to indicate what error occurred, if any. |
SSL_set_verify
.
|
inline |
Shut down SSL on the stream.
This function is used to shut down SSL on the stream. The function call will block until SSL has been shut down or an error occurs.
boost::system::system_error | Thrown on failure. |
|
inline |
Shut down SSL on the stream.
This function is used to shut down SSL on the stream. The function call will block until SSL has been shut down or an error occurs.
ec | Set to indicate what error occurred, if any. |
|
inline |
Write some data to the stream.
This function is used to write data on the stream. The function call will block until one or more bytes of data has been written successfully, or until an error occurs.
buffers | The data to be written. |
boost::system::system_error | Thrown on failure. |
References boost::n.
|
inline |
Write some data to the stream.
This function is used to write data on the stream. The function call will block until one or more bytes of data has been written successfully, or until an error occurs.
buffers | The data to be written to the stream. |
ec | Set to indicate what error occurred, if any. |
const ConstBufferSequence& boost::asio::ssl::stream< Stream >::buffers |