MySQL 9.1.0
Source Code Documentation
lower_layer_completion.h
Go to the documentation of this file.
1/*
2 Copyright (c) 2021, 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 ROUTER_SRC_OPENSSL_INCLUDE_TLS_DETAILS_LOWER_LAYER_COMPLETION_H_
27#define ROUTER_SRC_OPENSSL_INCLUDE_TLS_DETAILS_LOWER_LAYER_COMPLETION_H_
28
29#include <utility>
30
31namespace net {
32namespace tls {
33
34class NOP_token {
35 public:
36 void operator()(const std::error_code &, size_t) {}
37};
38
39template <typename FirstToken, typename SecondToken = NOP_token>
41 public:
42 using First_token_type = std::decay_t<FirstToken>;
43 using Second_token_type = std::decay_t<SecondToken>;
44
47
49 : first_token_{std::move(other.first_token_)},
50 second_token_{std::move(other.second_token_)} {}
51
52 LowerLayerReadCompletionToken(FirstToken &token, SecondToken &second_token)
53 : first_token_{std::forward<First_handler_type>(token)},
54 second_token_{std::forward<Second_handler_type>(second_token)} {}
55
56 LowerLayerReadCompletionToken(FirstToken &&token, SecondToken &&second_token)
57 : first_token_{token}, second_token_{second_token} {}
58
59 void operator()(std::error_code ec, size_t size) const {
60 first_token_.handle_read(ec, size);
62 }
63
64 private:
66 std::conditional_t<std::is_same<FirstToken, First_token_type>::value,
68
70 std::conditional_t<std::is_same<SecondToken, Second_token_type>::value,
72 mutable FirstToken first_token_;
73 mutable SecondToken second_token_;
74};
75
76template <typename FirstToken, typename SecondToken = NOP_token>
78 public:
79 using First_token_type = std::decay_t<FirstToken>;
80 using Second_token_type = std::decay_t<SecondToken>;
81
84
86 : first_token_{std::move(other.first_token_)},
87 second_token_{std::move(other.second_token_)} {}
88
89 LowerLayerWriteCompletionToken(FirstToken &token, SecondToken &second_token)
90 : first_token_{std::forward<First_handler_type>(token)},
91 second_token_{std::forward<Second_handler_type>(second_token)} {}
92
93 LowerLayerWriteCompletionToken(FirstToken &&token, SecondToken &&second_token)
94 : first_token_{token}, second_token_{second_token} {}
95
96 void operator()(std::error_code ec, size_t size) const {
97 first_token_.handle_write(ec, size);
99 }
100
101 private:
103 std::conditional_t<std::is_same<FirstToken, First_token_type>::value,
105
107 std::conditional_t<std::is_same<SecondToken, Second_token_type>::value,
109
110 mutable FirstToken first_token_;
111 mutable SecondToken second_token_;
112};
113
114template <typename FirstToken, typename SecondToken = NOP_token>
116 public:
117 using First_token_type = std::decay_t<FirstToken>;
118 using Second_token_type = std::decay_t<SecondToken>;
119
123
125 : first_token_{std::move(other.first_token_)},
126 second_token_{std::move(other.second_token_)} {}
127
129 SecondToken &second_token)
130 : first_token_{std::forward<First_handler_type>(token)},
131 second_token_{std::forward<Second_handler_type>(second_token)} {}
132
134 SecondToken &&second_token)
135 : first_token_{token}, second_token_{second_token} {}
136
137 void operator()(std::error_code ec, size_t size) const {
138 first_token_.handle_handshake(ec, size);
139 second_token_(ec, size);
140 }
141
142 private:
144 std::conditional_t<std::is_same<FirstToken, First_token_type>::value,
146
148 std::conditional_t<std::is_same<SecondToken, Second_token_type>::value,
150 mutable FirstToken first_token_;
151 mutable SecondToken second_token_;
152};
153
154} // namespace tls
155} // namespace net
156
157#endif // ROUTER_SRC_OPENSSL_INCLUDE_TLS_DETAILS_LOWER_LAYER_COMPLETION_H_
Definition: lower_layer_completion.h:115
SecondToken second_token_
Definition: lower_layer_completion.h:151
std::decay_t< FirstToken > First_token_type
Definition: lower_layer_completion.h:117
LowerLayerHandshakeCompletionToken(LowerLayerHandshakeCompletionToken &&other)
Definition: lower_layer_completion.h:124
std::conditional_t< std::is_same< FirstToken, First_token_type >::value, First_token_type &, First_token_type > First_handler_type
Definition: lower_layer_completion.h:145
std::conditional_t< std::is_same< SecondToken, Second_token_type >::value, Second_token_type &, Second_token_type > Second_handler_type
Definition: lower_layer_completion.h:149
void operator()(std::error_code ec, size_t size) const
Definition: lower_layer_completion.h:137
FirstToken first_token_
Definition: lower_layer_completion.h:150
LowerLayerHandshakeCompletionToken(FirstToken &token, SecondToken &second_token)
Definition: lower_layer_completion.h:128
LowerLayerHandshakeCompletionToken(FirstToken &&token, SecondToken &&second_token)
Definition: lower_layer_completion.h:133
std::decay_t< SecondToken > Second_token_type
Definition: lower_layer_completion.h:118
LowerLayerHandshakeCompletionToken(const LowerLayerHandshakeCompletionToken &other)
Definition: lower_layer_completion.h:120
Definition: lower_layer_completion.h:40
LowerLayerReadCompletionToken(LowerLayerReadCompletionToken &&other)
Definition: lower_layer_completion.h:48
std::conditional_t< std::is_same< SecondToken, Second_token_type >::value, Second_token_type &, Second_token_type > Second_handler_type
Definition: lower_layer_completion.h:71
LowerLayerReadCompletionToken(const LowerLayerReadCompletionToken &other)
Definition: lower_layer_completion.h:45
LowerLayerReadCompletionToken(FirstToken &token, SecondToken &second_token)
Definition: lower_layer_completion.h:52
LowerLayerReadCompletionToken(FirstToken &&token, SecondToken &&second_token)
Definition: lower_layer_completion.h:56
std::conditional_t< std::is_same< FirstToken, First_token_type >::value, First_token_type &, First_token_type > First_handler_type
Definition: lower_layer_completion.h:67
FirstToken first_token_
Definition: lower_layer_completion.h:72
std::decay_t< FirstToken > First_token_type
Definition: lower_layer_completion.h:42
void operator()(std::error_code ec, size_t size) const
Definition: lower_layer_completion.h:59
std::decay_t< SecondToken > Second_token_type
Definition: lower_layer_completion.h:43
SecondToken second_token_
Definition: lower_layer_completion.h:73
Definition: lower_layer_completion.h:77
LowerLayerWriteCompletionToken(const LowerLayerWriteCompletionToken &other)
Definition: lower_layer_completion.h:82
LowerLayerWriteCompletionToken(FirstToken &token, SecondToken &second_token)
Definition: lower_layer_completion.h:89
std::conditional_t< std::is_same< FirstToken, First_token_type >::value, First_token_type &, First_token_type > First_handler_type
Definition: lower_layer_completion.h:104
SecondToken second_token_
Definition: lower_layer_completion.h:111
std::decay_t< FirstToken > First_token_type
Definition: lower_layer_completion.h:79
LowerLayerWriteCompletionToken(LowerLayerWriteCompletionToken &&other)
Definition: lower_layer_completion.h:85
FirstToken first_token_
Definition: lower_layer_completion.h:110
void operator()(std::error_code ec, size_t size) const
Definition: lower_layer_completion.h:96
LowerLayerWriteCompletionToken(FirstToken &&token, SecondToken &&second_token)
Definition: lower_layer_completion.h:93
std::decay_t< SecondToken > Second_token_type
Definition: lower_layer_completion.h:80
std::conditional_t< std::is_same< SecondToken, Second_token_type >::value, Second_token_type &, Second_token_type > Second_handler_type
Definition: lower_layer_completion.h:108
Definition: lower_layer_completion.h:34
void operator()(const std::error_code &, size_t)
Definition: lower_layer_completion.h:36
size_t size(const char *const c)
Definition: base64.h:46
Definition: buffer.h:45
Definition: gcs_xcom_synode.h:64
Definition: tls_keylog_dumper.h:32