26#ifndef ROUTER_SRC_OPENSSL_INCLUDE_TLS_DETAILS_SSL_OPERATION_H_
27#define ROUTER_SRC_OPENSSL_INCLUDE_TLS_DETAILS_SSL_OPERATION_H_
29#include <openssl/bio.h>
43 return std::addressof(b);
48 return std::addressof(b) + 1;
53 return std::addressof(b);
58 return std::addressof(b) + 1;
63 ->
decltype(c.begin()) {
74 template <
typename Layer,
typename Handler>
76 return layer->async_receive(input,
handler);
79 template <
typename Layer,
typename Handler>
81 return layer->async_send(output,
handler);
91 template <
typename Layer,
typename Handler>
96 template <
typename Layer,
typename Handler>
101 template <
typename Handler>
112 template <
typename Handler>
127template <
typename SslIO,
typename BufferSequence,
typename Token,
133 std::conditional_t<std::is_same<Token, Token_result>::value,
136 template <
typename UniToken>
167 return Operation::Result::fatal;
177 return Operation::Result::fatal;
194 size_t page_begin = 0;
195 size_t page_end = it->size();
198 const bool is_last = it_next == end;
201 page_begin = page_end;
202 if (it != end) page_end += it->size();
207 size_t number_of_bytes = 0;
210 cast_and_increment<uint8_t>(it->data(),
page_offset),
216 case Operation::Result::fatal:
224 case Operation::Result::ok:
228 case Operation::Result::want_read: {
231 return Operation::Result::ok;
236 case Operation::Result::want_write:
241 return Operation::Result::ok;
244 template <
typename HandlerToken>
246 HandlerToken &&token) {
248 std::forward<HandlerToken>(token),
NOP_token());
251 template <
typename HandlerToken>
253 HandlerToken &&token) {
255 std::forward<HandlerToken>(token),
NOP_token());
258 void do_token(
const std::error_code &ec,
const size_t no_of_bytes) {
265#if OPENSSL_VERSION_NUMBER >= NET_TLS_USE_BACKWARD_COMPATIBLE_OPENSSL
279#if OPENSSL_VERSION_NUMBER >= NET_TLS_USE_BACKWARD_COMPATIBLE_OPENSSL
300 return Operation::Result::want_write;
307 return Operation::Result::want_read;
316 template <
typename Type>
318 return static_cast<const Type *
>(ptr) + value;
321 template <
typename Type>
323 return static_cast<Type *
>(ptr) + value;
The handler class is the interface for dynamically loadable storage engines.
Definition: handler.h:4573
Definition: ssl_io_completion.h:72
auto send(Layer *layer, FlexibleOutputBuffer &output, Handler &&handler)
Definition: ssl_io_completion.h:80
auto recv(Layer *layer, FlexibleInputBuffer &input, Handler &&handler)
Definition: ssl_io_completion.h:75
size_t size_used() const
Definition: flexible_buffer.h:59
bool pop(size_t v) noexcept
Definition: flexible_buffer.h:67
void * data_free() const
Definition: flexible_buffer.h:57
void * data_used() const noexcept
Definition: flexible_buffer.h:56
bool push(size_t v) noexcept
Definition: flexible_buffer.h:78
size_t size_free() const
Definition: flexible_buffer.h:58
Definition: flexible_buffer.h:91
Definition: lower_layer_completion.h:40
Definition: lower_layer_completion.h:77
Definition: lower_layer_completion.h:34
Result
Definition: ssl_operation.h:41
Definition: ssl_io_completion.h:129
FlexibleInputBuffer & input_
Definition: ssl_io_completion.h:329
int bio_write_ex(size_t *out_written)
Definition: ssl_io_completion.h:276
static Type * cast_and_increment(void *ptr, int value)
Definition: ssl_io_completion.h:322
LowerLayerReadCompletionToken< HandlerToken, NOP_token > get_read_handler(HandlerToken &&token)
Definition: ssl_io_completion.h:252
Operation::Result handle_read(std::error_code ec, size_t size)
Definition: ssl_io_completion.h:164
FlexibleOutputBuffer & output_
Definition: ssl_io_completion.h:328
int bio_read_ex(size_t *out_readbytes)
Definition: ssl_io_completion.h:262
Action action_
Definition: ssl_io_completion.h:332
Token token_
Definition: ssl_io_completion.h:331
Operation::Result do_write()
Definition: ssl_io_completion.h:290
SslIoCompletionToken(TlsLayer &tls_layer, const BufferSequence &buffer, UniToken &&token, Action action=Action())
Definition: ssl_io_completion.h:137
std::decay_t< Token > Token_result
Definition: ssl_io_completion.h:131
std::conditional_t< std::is_same< Token, Token_result >::value, Token_result &, Token_result > Token_handler
Definition: ssl_io_completion.h:134
Operation::Result handle_write(std::error_code ec, size_t size)
Definition: ssl_io_completion.h:174
SslIoCompletionToken(SslIoCompletionToken &&other)
Definition: ssl_io_completion.h:146
SslIoCompletionToken(const SslIoCompletionToken &other)
Definition: ssl_io_completion.h:155
Operation::Result do_it()
Definition: ssl_io_completion.h:188
TlsLayer & tls_layer_
Definition: ssl_io_completion.h:327
const BufferSequence buffer_
Definition: ssl_io_completion.h:330
LowerLayerWriteCompletionToken< HandlerToken > get_write_handler(HandlerToken &&token)
Definition: ssl_io_completion.h:245
size_t number_bytes_transfered_
Definition: ssl_io_completion.h:326
Operation::Result do_read()
Definition: ssl_io_completion.h:303
static const Type * cast_and_increment(const void *ptr, int value)
Definition: ssl_io_completion.h:317
void do_token(const std::error_code &ec, const size_t no_of_bytes)
Definition: ssl_io_completion.h:258
Definition: ssl_io_completion.h:85
Handler_result handle_write_result(Handler *handler)
Definition: ssl_io_completion.h:102
auto send(Layer *layer, FlexibleOutputBuffer &output, Handler &&)
Definition: ssl_io_completion.h:97
Handler_result handle_read_result(Handler *handler)
Definition: ssl_io_completion.h:113
Handler_arguments write_result_
Definition: ssl_io_completion.h:123
Handler_arguments read_result_
Definition: ssl_io_completion.h:124
auto recv(Layer *layer, FlexibleInputBuffer &input, Handler &&)
Definition: ssl_io_completion.h:92
Definition: expected.h:284
std::error_code make_error_code(DynamicLoaderErrc ec)
make error_code from a DynamicLoaderErrc.
Definition: dynamic_loader.cc:79
size_t size(const char *const c)
Definition: base64.h:46
stdx::expected< void, std::error_code > close(file_handle_type native_handle)
close file handle.
Definition: file.h:239
const mutable_buffer * tls_buffer_sequence_begin(const mutable_buffer &b) noexcept
Definition: ssl_io_completion.h:41
const mutable_buffer * tls_buffer_sequence_end(const mutable_buffer &b) noexcept
Definition: ssl_io_completion.h:46
mutable_buffer buffer(void *p, size_t n) noexcept
Definition: buffer.h:418
size_t buffer_size(const ConstBufferSequence &buffers) noexcept
Definition: buffer.h:313
Type
Definition: resource_group_basic_types.h:33
Definition: gcs_xcom_synode.h:64
Definition: tls_keylog_dumper.h:32
static ulint page_offset(const void *ptr)
Gets the offset within a page.
struct result result
Definition: result.h:34
message Action
Definition: replication_group_member_actions.proto:30
repeated Action action
Definition: replication_group_member_actions.proto:43
Definition: ssl_io_completion.h:87
HARNESS_TLS_EXPORT std::error_code make_tls_error()
make a std::error_code from ERR_get_error().
Definition: tls_error.cc:100