File indexing completed on 2025-01-18 09:29:01
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef BOOST_ASIO_SSL_DETAIL_ENGINE_HPP
0012 #define BOOST_ASIO_SSL_DETAIL_ENGINE_HPP
0013
0014 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
0015 # pragma once
0016 #endif
0017
0018 #include <boost/asio/detail/config.hpp>
0019
0020 #include <boost/asio/buffer.hpp>
0021 #include <boost/asio/detail/static_mutex.hpp>
0022 #include <boost/asio/ssl/detail/openssl_types.hpp>
0023 #include <boost/asio/ssl/detail/verify_callback.hpp>
0024 #include <boost/asio/ssl/stream_base.hpp>
0025 #include <boost/asio/ssl/verify_mode.hpp>
0026
0027 #include <boost/asio/detail/push_options.hpp>
0028
0029 namespace boost {
0030 namespace asio {
0031 namespace ssl {
0032 namespace detail {
0033
0034 class engine
0035 {
0036 public:
0037 enum want
0038 {
0039
0040
0041
0042 want_input_and_retry = -2,
0043
0044
0045
0046
0047 want_output_and_retry = -1,
0048
0049
0050
0051 want_nothing = 0,
0052
0053
0054
0055
0056 want_output = 1
0057 };
0058
0059
0060 BOOST_ASIO_DECL explicit engine(SSL_CTX* context);
0061
0062
0063 BOOST_ASIO_DECL explicit engine(SSL* ssl_impl);
0064
0065
0066 BOOST_ASIO_DECL engine(engine&& other) noexcept;
0067
0068
0069 BOOST_ASIO_DECL ~engine();
0070
0071
0072 BOOST_ASIO_DECL engine& operator=(engine&& other) noexcept;
0073
0074
0075 BOOST_ASIO_DECL SSL* native_handle();
0076
0077
0078 BOOST_ASIO_DECL boost::system::error_code set_verify_mode(
0079 verify_mode v, boost::system::error_code& ec);
0080
0081
0082 BOOST_ASIO_DECL boost::system::error_code set_verify_depth(
0083 int depth, boost::system::error_code& ec);
0084
0085
0086 BOOST_ASIO_DECL boost::system::error_code set_verify_callback(
0087 verify_callback_base* callback, boost::system::error_code& ec);
0088
0089
0090
0091 BOOST_ASIO_DECL want handshake(
0092 stream_base::handshake_type type, boost::system::error_code& ec);
0093
0094
0095 BOOST_ASIO_DECL want shutdown(boost::system::error_code& ec);
0096
0097
0098 BOOST_ASIO_DECL want write(const boost::asio::const_buffer& data,
0099 boost::system::error_code& ec, std::size_t& bytes_transferred);
0100
0101
0102 BOOST_ASIO_DECL want read(const boost::asio::mutable_buffer& data,
0103 boost::system::error_code& ec, std::size_t& bytes_transferred);
0104
0105
0106 BOOST_ASIO_DECL boost::asio::mutable_buffer get_output(
0107 const boost::asio::mutable_buffer& data);
0108
0109
0110 BOOST_ASIO_DECL boost::asio::const_buffer put_input(
0111 const boost::asio::const_buffer& data);
0112
0113
0114
0115
0116 BOOST_ASIO_DECL const boost::system::error_code& map_error_code(
0117 boost::system::error_code& ec) const;
0118
0119 private:
0120
0121 engine(const engine&);
0122 engine& operator=(const engine&);
0123
0124
0125 BOOST_ASIO_DECL static int verify_callback_function(
0126 int preverified, X509_STORE_CTX* ctx);
0127
0128 #if (OPENSSL_VERSION_NUMBER < 0x10000000L)
0129
0130
0131 BOOST_ASIO_DECL static boost::asio::detail::static_mutex& accept_mutex();
0132 #endif
0133
0134
0135
0136
0137 BOOST_ASIO_DECL want perform(int (engine::* op)(void*, std::size_t),
0138 void* data, std::size_t length, boost::system::error_code& ec,
0139 std::size_t* bytes_transferred);
0140
0141
0142 BOOST_ASIO_DECL int do_accept(void*, std::size_t);
0143
0144
0145 BOOST_ASIO_DECL int do_connect(void*, std::size_t);
0146
0147
0148 BOOST_ASIO_DECL int do_shutdown(void*, std::size_t);
0149
0150
0151 BOOST_ASIO_DECL int do_read(void* data, std::size_t length);
0152
0153
0154 BOOST_ASIO_DECL int do_write(void* data, std::size_t length);
0155
0156 SSL* ssl_;
0157 BIO* ext_bio_;
0158 };
0159
0160 }
0161 }
0162 }
0163 }
0164
0165 #include <boost/asio/detail/pop_options.hpp>
0166
0167 #if defined(BOOST_ASIO_HEADER_ONLY)
0168 # include <boost/asio/ssl/detail/impl/engine.ipp>
0169 #endif
0170
0171 #endif