MySQL 8.0.39
Source Code Documentation
basic_protocol_splicer.h
Go to the documentation of this file.
1/*
2 Copyright (c) 2020, 2024, Oracle and/or its affiliates.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License, version 2.0,
6 as published by the Free Software Foundation.
7
8 This program is designed to work with certain software (including
9 but not limited to OpenSSL) that is licensed under separate terms,
10 as designated in a particular file or component or in included license
11 documentation. The authors of MySQL hereby grant you an additional
12 permission to link the program and your derivative works with the
13 separately licensed software that they have either included with
14 the program or referenced in the documentation.
15
16 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU General Public License for more details.
20
21 You should have received a copy of the GNU General Public License
22 along with this program; if not, write to the Free Software
23 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24*/
25
26#ifndef ROUTING_BASIC_PROTOCOL_SPLICER_INCLUDED
27#define ROUTING_BASIC_PROTOCOL_SPLICER_INCLUDED
28
29#include <cstdint> // size_t
30#include <cstdio>
31#include <functional> // function
32#include <sstream>
33#include <string>
34
35#ifdef _WIN32
36// include winsock2.h before openssl/ssl.h
37#include <windows.h>
38#include <winsock2.h>
39#include <ws2tcpip.h>
40#endif
41
42#include <openssl/ssl.h> // SSL_CTX
43
44#include "blocked_endpoints.h"
45#include "channel.h"
46#include "harness_assert.h"
50#include "mysql/harness/net_ts/internet.h" // net::ip::tcp
52#include "mysql/harness/net_ts/local.h" // local::stream_protocol
56#include "ssl_mode.h"
57
58enum class TlsContentType {
59 kChangeCipherSpec = 0x14,
60 kAlert,
64};
65
67 switch (v) {
69 return "change-cipher-spec";
71 return "alert";
73 return "handshake";
75 return "application";
77 return "heartbeat";
78 }
79
80 return "unknown-" + std::to_string(static_cast<int>(v));
81}
82
84 public:
85 using ssl_ctx_gettor_type = std::function<SSL_CTX *(const std::string &id)>;
86
88
89 [[nodiscard]] SslMode ssl_mode() const { return ssl_mode_; }
90
91 private:
93};
94
96 public:
97 virtual ~RoutingConnectionBase() = default;
98
99 [[nodiscard]] virtual std::vector<std::pair<std::string, std::string>>
101
102 virtual uint64_t reset_error_count(BlockedEndpoints &blocked_endpoints) = 0;
103 virtual uint64_t increment_error_count(
104 BlockedEndpoints &blocked_endpoints) = 0;
105};
106
107template <class Protocol>
108struct IsTransportSecure : std::false_type {};
109
110#ifdef NET_TS_HAS_UNIX_SOCKET
111template <>
112struct IsTransportSecure<local::stream_protocol> : std::true_type {};
113#endif
114
115/**
116 * basic connection which wraps a net-ts Protocol.
117 *
118 * knows about mysql-protocol specifics like:
119 *
120 * - session attributes
121 * - connection error-tracking.
122 *
123 * @tparam Protocol a protocol like net::ip::tcp or local::stream_protocol
124 */
125template <class Protocol>
127 public:
130 using endpoint_type = typename protocol_type::endpoint;
131
133
135 : sock_{std::move(sock)}, ep_{std::move(ep)} {}
136
137 net::io_context &io_ctx() override { return sock_.get_executor().context(); }
138
140 net::io_context &new_ctx) override {
141 // nothing to do.
142 if (sock_.get_executor() == new_ctx.get_executor()) return {};
143
144 return sock_.release().and_then(
145 [this, &new_ctx](
147 socket_type new_sock(new_ctx);
148
149 auto assign_res = new_sock.assign(ep_.protocol(), native_handle);
150 if (!assign_res) return assign_res;
151
152 std::swap(sock_, new_sock);
153
154 return {};
155 });
156 }
157
159 std::function<void(std::error_code ec, size_t transferred)>
160 completion) override {
162 std::move(completion));
163 }
164
166 std::function<void(std::error_code ec, size_t transferred)>
167 completion) override {
168 if (sock_.native_non_blocking()) {
169 // if the socket is non-blocking try to send directly as the send-buffer
170 // is usually empty
171 auto write_res = net::write(sock_, net::dynamic_buffer(buf),
173 if (write_res) {
174 net::defer(sock_.get_executor(), [completion = std::move(completion),
175 transferred = *write_res]() {
176 completion({}, transferred);
177 });
178 return;
179 }
180
181 const auto ec = write_res.error();
182
183 if (ec != make_error_condition(std::errc::operation_would_block) &&
184 ec !=
185 make_error_condition(std::errc::resource_unavailable_try_again)) {
186 net::defer(sock_.get_executor(), [completion = std::move(completion),
187 ec]() { completion(ec, 0); });
188 return;
189 }
190
191 // if it would-block, use the normal async-write.
192 }
193
195 std::move(completion));
196 }
197
199 std::function<void(std::error_code ec)> completion) override {
200 sock_.async_wait(net::socket_base::wait_write, std::move(completion));
201 }
202
204 std::function<void(std::error_code ec)> completion) override {
205 sock_.async_wait(net::socket_base::wait_read, std::move(completion));
206 }
207
209 std::function<void(std::error_code ec)> completion) override {
210 sock_.async_wait(net::socket_base::wait_error, std::move(completion));
211 }
212
213 [[nodiscard]] bool is_open() const override { return sock_.is_open(); }
214
216 const override {
217 return sock_.native_handle();
218 }
219
221 return sock_.close();
222 }
223
225 return sock_.cancel();
226 }
227
230 return sock_.shutdown(st);
231 }
232
233 [[nodiscard]] std::string endpoint() const override {
235
236 oss << ep_;
237
238 return oss.str();
239 }
240
241 template <class GettableSocketOption>
243 GettableSocketOption &opt) const {
244 return sock_.get_option(opt);
245 }
246
247 /**
248 * check if the underlying transport is secure.
249 *
250 * - unix-socket, shared-memory, ... are secure.
251 */
252 [[nodiscard]] bool is_secure_transport() const override {
254 }
255
256 protected:
259};
260
261template <class Protocol>
263 public:
265 using endpoint_type = typename protocol_type::endpoint;
266
268
269 [[nodiscard]] std::vector<std::pair<std::string, std::string>>
272 }
273
274 uint64_t reset_error_count(BlockedEndpoints &blocked_endpoints) override {
275 return blocked_endpoints.reset_error_count(ep_);
276 }
277
278 uint64_t increment_error_count(BlockedEndpoints &blocked_endpoints) override {
279 return blocked_endpoints.increment_error_count(ep_);
280 }
281
282 private:
284};
285
287#ifdef NET_TS_HAS_UNIX_SOCKET
288using UnixDomainConnection = BasicConnection<local::stream_protocol>;
289#endif
290
292 public:
293 virtual ~ProtocolStateBase() = default;
294};
295
296/**
297 * a Connection that can be switched to TLS.
298 *
299 * wraps
300 *
301 * - a low-level connections (conn)
302 * - a routing connection (endpoints, destinations, ...)
303 * - a tls switchable (a SSL_CTX * wrapper)
304 * - protocol state (classic, xproto)
305 */
307 public:
308 // 16kb per buffer
309 // 2 buffers per channel (send/recv)
310 // 2 channels per connection
311 // 10000 connections
312 // = 640MByte
313 static constexpr size_t kRecvBufferSize{16UL * 1024};
314
315 TlsSwitchableConnection(std::unique_ptr<ConnectionBase> conn,
316 std::unique_ptr<RoutingConnectionBase> routing_conn,
318 std::unique_ptr<ProtocolStateBase> state)
319 : conn_{std::move(conn)},
320 routing_conn_{std::move(routing_conn)},
321 ssl_mode_{std::move(ssl_mode)},
323 protocol_{std::move(state)} {
324 channel_->recv_buffer().reserve(kRecvBufferSize);
325 }
326
327 TlsSwitchableConnection(std::unique_ptr<ConnectionBase> conn,
328 std::unique_ptr<RoutingConnectionBase> routing_conn,
329 SslMode ssl_mode, std::unique_ptr<Channel> channel,
330 std::unique_ptr<ProtocolStateBase> state)
331 : conn_{std::move(conn)},
332 routing_conn_{std::move(routing_conn)},
333 ssl_mode_{std::move(ssl_mode)},
334 channel_{std::move(channel)},
335 protocol_{std::move(state)} {
336 channel_->recv_buffer().reserve(kRecvBufferSize);
337 }
338
339 [[nodiscard]] std::vector<std::pair<std::string, std::string>>
341 return routing_conn_->initial_connection_attributes();
342 }
343
344 /**
345 * assign a low-level connection.
346 */
347 void assign_connection(std::unique_ptr<ConnectionBase> conn) {
348 conn_ = std::move(conn);
349 }
350
351 /**
352 * async receive data from connection into the channel's receive buffer.
353 *
354 * calls func when async operation is completed.
355 */
356 template <class Func>
357 void async_recv(Func &&func) {
358 harness_assert(conn_ != nullptr);
359 harness_assert(channel_ != nullptr);
360
361 // discard everything that has been marked as 'consumed'
362 channel_->view_discard_raw();
363
364 conn_->async_recv(channel_->recv_buffer(),
365 [this, func = std::forward<Func>(func)](
366 std::error_code ec, size_t transferred) {
367 if (ec == std::error_code()) {
368 channel_->view_sync_raw();
369 }
370
371 func(ec, transferred);
372 });
373 }
374
375 /**
376 * async send data from the channel's send buffer to the connection.
377 *
378 * calls func when async operation is completed.
379 */
380 template <class Func>
381 void async_send(Func &&func) {
382 conn_->async_send(channel_->send_buffer(), std::forward<Func>(func));
383 }
384
385 /**
386 * async wait until connection allows to send data.
387 *
388 * calls func when async operation is completed.
389 */
390 template <class Func>
391 void async_wait_send(Func &&func) {
392 conn_->async_wait_send(std::forward<Func>(func));
393 }
394
395 template <class Func>
396 void async_wait_error(Func &&func) {
397 conn_->async_wait_error(std::forward<Func>(func));
398 }
399
400 [[nodiscard]] Channel *channel() { return channel_.get(); }
401
402 [[nodiscard]] const Channel *channel() const { return channel_.get(); }
403
404 [[nodiscard]] SslMode ssl_mode() const { return ssl_mode_; }
405
406 [[nodiscard]] bool is_open() const { return conn_ && conn_->is_open(); }
407
409 return conn_->native_handle();
410 }
411
413 if (!conn_) {
414 return stdx::make_unexpected(make_error_code(std::errc::not_connected));
415 }
416 return conn_->close();
417 }
418
421 if (!conn_) {
422 return stdx::make_unexpected(make_error_code(std::errc::not_connected));
423 }
424 return conn_->shutdown(st);
425 }
426
427 [[nodiscard]] std::string endpoint() const {
428 if (!is_open()) return "";
429
430 return conn_->endpoint();
431 }
432
433 [[nodiscard]] uint64_t reset_error_count(
434 BlockedEndpoints &blocked_endpoints) {
435 return routing_conn_->reset_error_count(blocked_endpoints);
436 }
437
438 [[nodiscard]] uint64_t increment_error_count(
439 BlockedEndpoints &blocked_endpoints) {
440 return routing_conn_->increment_error_count(blocked_endpoints);
441 }
442
444 if (!conn_) return {};
445
446 return conn_->cancel();
447 }
448
449 [[nodiscard]] ProtocolStateBase *protocol() { return protocol_.get(); }
450
451 [[nodiscard]] const ProtocolStateBase *protocol() const {
452 return protocol_.get();
453 }
454
455 std::unique_ptr<ConnectionBase> &connection() { return conn_; }
456
457 /**
458 * check if the channel is secure.
459 *
460 * - if TLS is enabled, it the transport is secure
461 * - if transport is secure, the channel is secure
462 */
463 [[nodiscard]] bool is_secure_transport() const {
464 return conn_->is_secure_transport() || channel_->ssl();
465 }
466
467 private:
468 // tcp/unix-socket
469 std::unique_ptr<ConnectionBase> conn_;
470 std::unique_ptr<RoutingConnectionBase> routing_conn_;
471
473
474 // socket buffers
475 std::unique_ptr<Channel> channel_;
476
477 // higher-level protocol
478 std::unique_ptr<ProtocolStateBase> protocol_;
479};
480
481/**
482 * splices two connections together.
483 */
485 public:
488 : client_conn_{std::move(client_conn)},
489 server_conn_{std::move(server_conn)} {}
490
491 template <class Func>
492 void async_wait_send_server(Func &&func) {
493 server_conn_.async_wait_send(std::forward<Func>(func));
494 }
495
496 template <class Func>
497 void async_recv_server(Func &&func) {
498 server_conn_.async_recv(std::forward<Func>(func));
499 }
500
501 template <class Func>
502 void async_send_server(Func &&func) {
503 server_conn_.async_send(std::forward<Func>(func));
504 }
505
506 template <class Func>
507 void async_recv_client(Func &&func) {
508 client_conn_.async_recv(std::forward<Func>(func));
509 }
510
511 template <class Func>
512 void async_send_client(Func &&func) {
513 client_conn_.async_send(std::forward<Func>(func));
514 }
515
516 template <class Func>
517 void async_client_wait_error(Func &&func) {
518 client_conn_.async_wait_error(std::forward<Func>(func));
519 }
520
522
523 [[nodiscard]] const TlsSwitchableConnection &client_conn() const {
524 return client_conn_;
525 }
526
528
529 [[nodiscard]] const TlsSwitchableConnection &server_conn() const {
530 return server_conn_;
531 }
532
533 [[nodiscard]] SslMode source_ssl_mode() const {
534 return client_conn().ssl_mode();
535 }
536
537 [[nodiscard]] SslMode dest_ssl_mode() const {
538 return server_conn().ssl_mode();
539 }
540
541 [[nodiscard]] Channel *client_channel() { return client_conn().channel(); }
542
543 [[nodiscard]] const Channel *client_channel() const {
544 return client_conn().channel();
545 }
546
547 [[nodiscard]] Channel *server_channel() { return server_conn().channel(); }
548
549 /**
550 * accept a TLS connection from the client_channel_.
551 */
553 // write socket data to SSL struct
554 auto *channel = client_conn_.channel();
555
556 {
557 const auto flush_res = channel->flush_from_recv_buf();
558 if (!flush_res) return flush_res.get_unexpected();
559 }
560
561 if (!channel->tls_init_is_finished()) {
562 const auto res = channel->tls_accept();
563
564 // flush the TLS message to the send-buffer.
565 {
566 const auto flush_res = channel->flush_to_send_buf();
567 if (!flush_res) {
568 const auto ec = flush_res.error();
569 if (ec != make_error_code(std::errc::operation_would_block)) {
570 return flush_res.get_unexpected();
571 }
572 }
573 }
574
575 if (!res) {
576 return res.get_unexpected();
577 }
578 }
579
580 return {};
581 }
582
583 protected:
586};
587
588#endif
std::string tls_content_type_to_string(TlsContentType v)
Definition: basic_protocol_splicer.h:66
TlsContentType
Definition: basic_protocol_splicer.h:58
basic connection which wraps a net-ts Protocol.
Definition: basic_protocol_splicer.h:126
stdx::expected< void, std::error_code > set_io_context(net::io_context &new_ctx) override
Definition: basic_protocol_splicer.h:139
stdx::expected< void, std::error_code > get_option(GettableSocketOption &opt) const
Definition: basic_protocol_splicer.h:242
stdx::expected< void, std::error_code > close() override
Definition: basic_protocol_splicer.h:220
void async_wait_error(std::function< void(std::error_code ec)> completion) override
Definition: basic_protocol_splicer.h:208
std::string endpoint() const override
Definition: basic_protocol_splicer.h:233
void async_wait_recv(std::function< void(std::error_code ec)> completion) override
Definition: basic_protocol_splicer.h:203
net::impl::socket::native_handle_type native_handle() const override
Definition: basic_protocol_splicer.h:215
void async_recv(recv_buffer_type &buf, std::function< void(std::error_code ec, size_t transferred)> completion) override
Definition: basic_protocol_splicer.h:158
stdx::expected< void, std::error_code > cancel() override
Definition: basic_protocol_splicer.h:224
bool is_open() const override
Definition: basic_protocol_splicer.h:213
socket_type sock_
Definition: basic_protocol_splicer.h:257
typename protocol_type::socket socket_type
Definition: basic_protocol_splicer.h:129
BasicConnection(socket_type sock, endpoint_type ep)
Definition: basic_protocol_splicer.h:134
bool is_secure_transport() const override
check if the underlying transport is secure.
Definition: basic_protocol_splicer.h:252
net::io_context & io_ctx() override
Definition: basic_protocol_splicer.h:137
endpoint_type ep_
Definition: basic_protocol_splicer.h:258
stdx::expected< void, std::error_code > shutdown(net::socket_base::shutdown_type st) override
Definition: basic_protocol_splicer.h:228
void async_send(recv_buffer_type &buf, std::function< void(std::error_code ec, size_t transferred)> completion) override
Definition: basic_protocol_splicer.h:165
void async_wait_send(std::function< void(std::error_code ec)> completion) override
Definition: basic_protocol_splicer.h:198
typename protocol_type::endpoint endpoint_type
Definition: basic_protocol_splicer.h:130
Definition: blocked_endpoints.h:34
uint64_t increment_error_count(const net::ip::tcp::endpoint &endpoint)
increments the error count of an endpoint.
Definition: blocked_endpoints.cc:45
uint64_t reset_error_count(const net::ip::tcp::endpoint &endpoint)
resets error counter for an endpoint.
Definition: blocked_endpoints.cc:58
SSL aware socket buffers.
Definition: channel.h:64
virtual base-class of BasicConnection.
Definition: connection_base.h:42
std::vector< uint8_t, default_init_allocator< uint8_t > > recv_buffer_type
Definition: connection_base.h:47
splices two connections together.
Definition: basic_protocol_splicer.h:484
void async_send_client(Func &&func)
Definition: basic_protocol_splicer.h:512
void async_client_wait_error(Func &&func)
Definition: basic_protocol_splicer.h:517
TlsSwitchableConnection client_conn_
Definition: basic_protocol_splicer.h:584
void async_send_server(Func &&func)
Definition: basic_protocol_splicer.h:502
const TlsSwitchableConnection & server_conn() const
Definition: basic_protocol_splicer.h:529
void async_wait_send_server(Func &&func)
Definition: basic_protocol_splicer.h:492
Channel * server_channel()
Definition: basic_protocol_splicer.h:547
void async_recv_server(Func &&func)
Definition: basic_protocol_splicer.h:497
const Channel * client_channel() const
Definition: basic_protocol_splicer.h:543
Channel * client_channel()
Definition: basic_protocol_splicer.h:541
void async_recv_client(Func &&func)
Definition: basic_protocol_splicer.h:507
stdx::expected< void, std::error_code > tls_accept()
accept a TLS connection from the client_channel_.
Definition: basic_protocol_splicer.h:552
TlsSwitchableConnection & client_conn()
Definition: basic_protocol_splicer.h:521
SslMode dest_ssl_mode() const
Definition: basic_protocol_splicer.h:537
SslMode source_ssl_mode() const
Definition: basic_protocol_splicer.h:533
ProtocolSplicerBase(TlsSwitchableConnection client_conn, TlsSwitchableConnection server_conn)
Definition: basic_protocol_splicer.h:486
TlsSwitchableConnection server_conn_
Definition: basic_protocol_splicer.h:585
TlsSwitchableConnection & server_conn()
Definition: basic_protocol_splicer.h:527
const TlsSwitchableConnection & client_conn() const
Definition: basic_protocol_splicer.h:523
Definition: basic_protocol_splicer.h:291
virtual ~ProtocolStateBase()=default
Definition: protocol.h:33
Definition: basic_protocol_splicer.h:95
virtual std::vector< std::pair< std::string, std::string > > initial_connection_attributes() const =0
virtual ~RoutingConnectionBase()=default
virtual uint64_t increment_error_count(BlockedEndpoints &blocked_endpoints)=0
virtual uint64_t reset_error_count(BlockedEndpoints &blocked_endpoints)=0
Definition: basic_protocol_splicer.h:262
typename protocol_type::endpoint endpoint_type
Definition: basic_protocol_splicer.h:265
std::vector< std::pair< std::string, std::string > > initial_connection_attributes() const override
Definition: basic_protocol_splicer.h:270
uint64_t increment_error_count(BlockedEndpoints &blocked_endpoints) override
Definition: basic_protocol_splicer.h:278
RoutingConnection(endpoint_type ep)
Definition: basic_protocol_splicer.h:267
endpoint_type ep_
Definition: basic_protocol_splicer.h:283
uint64_t reset_error_count(BlockedEndpoints &blocked_endpoints) override
Definition: basic_protocol_splicer.h:274
a Connection that can be switched to TLS.
Definition: basic_protocol_splicer.h:306
TlsSwitchableConnection(std::unique_ptr< ConnectionBase > conn, std::unique_ptr< RoutingConnectionBase > routing_conn, SslMode ssl_mode, std::unique_ptr< Channel > channel, std::unique_ptr< ProtocolStateBase > state)
Definition: basic_protocol_splicer.h:327
stdx::expected< void, std::error_code > shutdown(net::socket_base::shutdown_type st) const
Definition: basic_protocol_splicer.h:419
std::unique_ptr< ProtocolStateBase > protocol_
Definition: basic_protocol_splicer.h:478
TlsSwitchableConnection(std::unique_ptr< ConnectionBase > conn, std::unique_ptr< RoutingConnectionBase > routing_conn, SslMode ssl_mode, std::unique_ptr< ProtocolStateBase > state)
Definition: basic_protocol_splicer.h:315
void async_send(Func &&func)
async send data from the channel's send buffer to the connection.
Definition: basic_protocol_splicer.h:381
void assign_connection(std::unique_ptr< ConnectionBase > conn)
assign a low-level connection.
Definition: basic_protocol_splicer.h:347
std::unique_ptr< RoutingConnectionBase > routing_conn_
Definition: basic_protocol_splicer.h:470
bool is_secure_transport() const
check if the channel is secure.
Definition: basic_protocol_splicer.h:463
void async_wait_error(Func &&func)
Definition: basic_protocol_splicer.h:396
std::string endpoint() const
Definition: basic_protocol_splicer.h:427
stdx::expected< void, std::error_code > close() const
Definition: basic_protocol_splicer.h:412
const Channel * channel() const
Definition: basic_protocol_splicer.h:402
void async_recv(Func &&func)
async receive data from connection into the channel's receive buffer.
Definition: basic_protocol_splicer.h:357
SslMode ssl_mode_
Definition: basic_protocol_splicer.h:472
const ProtocolStateBase * protocol() const
Definition: basic_protocol_splicer.h:451
Channel * channel()
Definition: basic_protocol_splicer.h:400
void async_wait_send(Func &&func)
async wait until connection allows to send data.
Definition: basic_protocol_splicer.h:391
uint64_t reset_error_count(BlockedEndpoints &blocked_endpoints)
Definition: basic_protocol_splicer.h:433
std::vector< std::pair< std::string, std::string > > initial_connection_attributes() const
Definition: basic_protocol_splicer.h:340
std::unique_ptr< ConnectionBase > & connection()
Definition: basic_protocol_splicer.h:455
net::impl::socket::native_handle_type native_handle() const
Definition: basic_protocol_splicer.h:408
std::unique_ptr< Channel > channel_
Definition: basic_protocol_splicer.h:475
bool is_open() const
Definition: basic_protocol_splicer.h:406
uint64_t increment_error_count(BlockedEndpoints &blocked_endpoints)
Definition: basic_protocol_splicer.h:438
static constexpr size_t kRecvBufferSize
Definition: basic_protocol_splicer.h:313
ProtocolStateBase * protocol()
Definition: basic_protocol_splicer.h:449
std::unique_ptr< ConnectionBase > conn_
Definition: basic_protocol_splicer.h:469
SslMode ssl_mode() const
Definition: basic_protocol_splicer.h:404
stdx::expected< void, std::error_code > cancel()
Definition: basic_protocol_splicer.h:443
Definition: basic_protocol_splicer.h:83
SslMode ssl_mode() const
Definition: basic_protocol_splicer.h:89
SslMode ssl_mode_
Definition: basic_protocol_splicer.h:92
std::function< SSL_CTX *(const std::string &id)> ssl_ctx_gettor_type
Definition: basic_protocol_splicer.h:85
TlsSwitchable(SslMode ssl_mode)
Definition: basic_protocol_splicer.h:87
Definition: io_context.h:61
executor_type get_executor() noexcept
Definition: io_context.h:1080
static constexpr wait_type wait_read
Definition: socket.h:168
shutdown_type
Definition: socket.h:172
static constexpr wait_type wait_write
Definition: socket.h:169
static constexpr wait_type wait_error
Definition: socket.h:170
Definition: buffer.h:698
Definition: expected.h:944
#define harness_assert(COND)
Improved assert()
Definition: harness_assert.h:37
std::vector< std::pair< std::string, std::string > > initial_connection_attributes(const net::ip::tcp::endpoint &ep)
TCP/IP socket related connection attributes.
Definition: initial_connection_attributes.h:43
static std::string to_string(const LEX_STRING &str)
Definition: lex_string.h:50
static MYSQL * sock
Definition: mysqlcheck.cc:56
Definition: buf0block_hint.cc:30
Definition: local.h:60
Unique_ptr< T, std::nullptr_t > make_unique(size_t size)
In-place constructs a new unique pointer with no specific allocator and with array type T.
std::error_code make_error_code(DynamicLoaderErrc ec)
make error_code from a DynamicLoaderErrc.
Definition: dynamic_loader.cc:79
stdx::expected< native_handle_type, error_type > socket(int family, int sock_type, int protocol)
Definition: socket.h:63
int native_handle_type
Definition: socket_constants.h:51
dynamic_vector_buffer< T, Allocator > dynamic_buffer(std::vector< T, Allocator > &vec) noexcept
Definition: buffer.h:663
auto defer(CompletionToken &&token)
Definition: executor.h:804
std::enable_if_t< is_const_buffer_sequence< ConstBufferSequence >::value, stdx::expected< size_t, std::error_code > > write(SyncWriteStream &stream, const ConstBufferSequence &buffers)
Definition: buffer.h:992
std::enable_if_t< is_dynamic_buffer< DynamicBuffer >::value, void > async_read(AsyncReadStream &stream, DynamicBuffer &&b, CompletionCondition completion_condition, CompletionToken &&token)
Definition: buffer.h:928
std::error_condition make_error_condition(net::stream_errc e) noexcept
Definition: buffer.h:107
std::enable_if_t< is_dynamic_buffer< DynamicBuffer >::value, void > async_write(AsyncWriteStream &stream, DynamicBuffer &&b, CompletionCondition cond, CompletionToken &&token)
Definition: buffer.h:1074
Definition: gcs_xcom_synode.h:64
constexpr auto make_unexpected(E &&e) -> unexpected< std::decay_t< E > >
Definition: expected.h:125
std::basic_ostringstream< char, std::char_traits< char >, ut::allocator< char > > ostringstream
Specialization of basic_ostringstream which uses ut::allocator.
Definition: ut0new.h:2870
static void swap(String &a, String &b) noexcept
Definition: sql_string.h:642
SslMode
Definition: ssl_mode.h:29
Definition: basic_protocol_splicer.h:108
Definition: task.h:427
unsigned long id[MAX_DEAD]
Definition: xcom_base.cc:510