MySQL 8.3.0
Source Code Documentation
tls_error.h
Go to the documentation of this file.
1/*
2 Copyright (c) 2020, 2023, 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 also distributed 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 included with MySQL.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23*/
24
25#ifndef MYSQL_HARNESS_TLS_ERROR_H_INCLUDED
26#define MYSQL_HARNESS_TLS_ERROR_H_INCLUDED
27
28#include <system_error>
29
30#include <openssl/ssl.h>
31
33
34static_assert(SSL_ERROR_WANT_READ != 0);
35
36enum class TlsErrc {
37 kWantRead = SSL_ERROR_WANT_READ,
38 kWantWrite = SSL_ERROR_WANT_WRITE,
39 kZeroReturn = SSL_ERROR_ZERO_RETURN,
40};
41
42enum class TlsCertErrc {
43 kNoRSACert = 1,
46};
47
48namespace std {
49template <>
50struct is_error_code_enum<TlsErrc> : std::true_type {};
51
52template <>
53struct is_error_code_enum<TlsCertErrc> : std::true_type {};
54} // namespace std
55
56/**
57 * make std::error_code from TlsCertErrc.
58 */
60
61/**
62 * make std::error_code from TlsErrc.
63 */
65
66/**
67 * make a std::error_code from ERR_get_error().
68 */
69HARNESS_TLS_EXPORT std::error_code make_tls_error();
70
71/**
72 * make a std::error_code from SSL_get_error().
73 *
74 * @param ssl a SSL connection
75 * @param res result of a SSL_ function.
76 */
77HARNESS_TLS_EXPORT std::error_code make_tls_ssl_error(const SSL *ssl, int res);
78
79#endif
constexpr value_type ssl
Definition: classic_protocol_constants.h:48
Definition: varlen_sort.h:174
HARNESS_TLS_EXPORT std::error_code make_tls_ssl_error(const SSL *ssl, int res)
make a std::error_code from SSL_get_error().
Definition: tls_error.cc:102
TlsCertErrc
Definition: tls_error.h:42
TlsErrc
Definition: tls_error.h:36
HARNESS_TLS_EXPORT std::error_code make_error_code(TlsCertErrc ec)
make std::error_code from TlsCertErrc.
Definition: tls_error.cc:54
HARNESS_TLS_EXPORT std::error_code make_tls_error()
make a std::error_code from ERR_get_error().
Definition: tls_error.cc:98
#define HARNESS_TLS_EXPORT
Definition: tls_export.h:15