Botan 3.1.1
Crypto and TLS for C&
|
#include <asio_async_ops.h>
Public Types | |
using | allocator_type = boost::asio::associated_allocator_t< Handler, Allocator > |
using | executor_type = boost::asio::associated_executor_t< Handler, Executor1 > |
Public Member Functions | |
allocator_type | get_allocator () const noexcept |
executor_type | get_executor () const noexcept |
Protected Member Functions | |
template<class HandlerT > | |
AsyncBase (HandlerT &&handler, const Executor1 &executor) | |
template<class... Args> | |
void | complete_now (Args &&... args) |
Protected Attributes | |
Handler | m_handler |
boost::asio::executor_work_guard< Executor1 > | m_work_guard_1 |
Base class for asynchronous stream operations.
Asynchronous operations, used for example to implement an interface for boost::asio::async_read_some and boost::asio::async_write_some, are based on boost::asio::coroutines. Derived operations should implement a call operator and invoke it with the correct parameters upon construction. The call operator needs to make sure that the user-provided handler is not called directly. Typically, yield / reenter is used for this in the following fashion:
Once the operation is completed and ready to call the completion handler it checks if an intermediate initiating function has been called using the isContinuation
parameter. If not, it will call an asynchronous operation, such as async_read_some
, with and empty buffer, set the object itself as the handler, and yield
. As a result, the call operator will be invoked again, this time as a continuation, and will jump to the location where it yielded before using reenter
. It is now safe to call the handler function via complete_now
.
Handler | Type of the completion handler |
Executor1 | Type of the asio executor (usually derived from the lower layer) |
Allocator | Type of the allocator to be used |
Definition at line 68 of file asio_async_ops.h.
using Botan::TLS::detail::AsyncBase< Handler, Executor1, Allocator >::allocator_type = boost::asio::associated_allocator_t<Handler, Allocator> |
Definition at line 70 of file asio_async_ops.h.
using Botan::TLS::detail::AsyncBase< Handler, Executor1, Allocator >::executor_type = boost::asio::associated_executor_t<Handler, Executor1> |
Definition at line 71 of file asio_async_ops.h.
|
inlineprotected |
Definition at line 81 of file asio_async_ops.h.
|
inlineprotected |
Call the completion handler.
This function should only be called after an intermediate initiating function has been called.
args | Arguments forwarded to the completion handler function. |
Definition at line 92 of file asio_async_ops.h.
References Botan::TLS::detail::AsyncBase< Handler, Executor1, Allocator >::m_handler, and Botan::TLS::detail::AsyncBase< Handler, Executor1, Allocator >::m_work_guard_1.
Referenced by Botan::TLS::detail::AsyncReadOperation< Handler, Stream, MutableBufferSequence, Allocator >::operator()(), Botan::TLS::detail::AsyncWriteOperation< Handler, Stream, Allocator >::operator()(), and Botan::TLS::detail::AsyncHandshakeOperation< Handler, Stream, Allocator >::operator()().
|
inlinenoexcept |
Definition at line 73 of file asio_async_ops.h.
References Botan::TLS::detail::AsyncBase< Handler, Executor1, Allocator >::m_handler.
|
inlinenoexcept |
Definition at line 75 of file asio_async_ops.h.
References Botan::TLS::detail::AsyncBase< Handler, Executor1, Allocator >::m_handler, and Botan::TLS::detail::AsyncBase< Handler, Executor1, Allocator >::m_work_guard_1.
|
protected |
Definition at line 97 of file asio_async_ops.h.
Referenced by Botan::TLS::detail::AsyncBase< Handler, Executor1, Allocator >::complete_now(), Botan::TLS::detail::AsyncBase< Handler, Executor1, Allocator >::get_allocator(), and Botan::TLS::detail::AsyncBase< Handler, Executor1, Allocator >::get_executor().
|
protected |
Definition at line 98 of file asio_async_ops.h.
Referenced by Botan::TLS::detail::AsyncBase< Handler, Executor1, Allocator >::complete_now(), and Botan::TLS::detail::AsyncBase< Handler, Executor1, Allocator >::get_executor().