MySQL 9.1.0
Source Code Documentation
tls_error.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 MYSQL_HARNESS_TLS_ERROR_H_INCLUDED
27#define MYSQL_HARNESS_TLS_ERROR_H_INCLUDED
28
29#include <system_error>
30
31#include <openssl/ssl.h>
32
34
35static_assert(SSL_ERROR_WANT_READ != 0);
36
37enum class TlsErrc {
38 kWantRead = SSL_ERROR_WANT_READ,
39 kWantWrite = SSL_ERROR_WANT_WRITE,
40 kZeroReturn = SSL_ERROR_ZERO_RETURN,
41};
42
43enum class TlsCertErrc {
44 kNoRSACert = 1,
47};
48
49namespace std {
50template <>
51struct is_error_code_enum<TlsErrc> : std::true_type {};
52
53template <>
54struct is_error_code_enum<TlsCertErrc> : std::true_type {};
55} // namespace std
56
57/**
58 * make std::error_code from TlsCertErrc.
59 */
61
62/**
63 * make std::error_code from TlsErrc.
64 */
66
67/**
68 * make a std::error_code from ERR_get_error().
69 */
70HARNESS_TLS_EXPORT std::error_code make_tls_error();
71
72/**
73 * make a std::error_code from SSL_get_error().
74 *
75 * @param ssl a SSL connection
76 * @param res result of a SSL_ function.
77 */
78HARNESS_TLS_EXPORT std::error_code make_tls_ssl_error(const SSL *ssl, int res);
79
80#endif
constexpr value_type ssl
Definition: classic_protocol_constants.h:49
Definition: gcs_xcom_synode.h:64
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:104
TlsCertErrc
Definition: tls_error.h:43
TlsErrc
Definition: tls_error.h:37
HARNESS_TLS_EXPORT std::error_code make_error_code(TlsCertErrc ec)
make std::error_code from TlsCertErrc.
Definition: tls_error.cc:55
HARNESS_TLS_EXPORT std::error_code make_tls_error()
make a std::error_code from ERR_get_error().
Definition: tls_error.cc:100
#define HARNESS_TLS_EXPORT
Definition: tls_export.h:15