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_OPENSSL_INIT_HPP
0012 #define BOOST_ASIO_SSL_DETAIL_OPENSSL_INIT_HPP
0013
0014 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
0015 # pragma once
0016 #endif
0017
0018 #include <boost/asio/detail/config.hpp>
0019 #include <cstring>
0020 #include <boost/asio/detail/memory.hpp>
0021 #include <boost/asio/detail/noncopyable.hpp>
0022 #include <boost/asio/ssl/detail/openssl_types.hpp>
0023
0024 #include <boost/asio/detail/push_options.hpp>
0025
0026 namespace boost {
0027 namespace asio {
0028 namespace ssl {
0029 namespace detail {
0030
0031 class openssl_init_base
0032 : private noncopyable
0033 {
0034 protected:
0035
0036 class do_init;
0037
0038
0039
0040
0041
0042
0043 BOOST_ASIO_DECL static boost::asio::detail::shared_ptr<do_init> instance();
0044
0045 #if !defined(SSL_OP_NO_COMPRESSION) \
0046 && (OPENSSL_VERSION_NUMBER >= 0x00908000L)
0047
0048
0049 BOOST_ASIO_DECL static STACK_OF(SSL_COMP)* get_null_compression_methods();
0050 #endif
0051
0052 };
0053
0054 template <bool Do_Init = true>
0055 class openssl_init : private openssl_init_base
0056 {
0057 public:
0058
0059 openssl_init()
0060 : ref_(instance())
0061 {
0062 using namespace std;
0063
0064
0065 openssl_init* tmp = &instance_;
0066 memmove(&tmp, &tmp, sizeof(openssl_init*));
0067 }
0068
0069
0070 ~openssl_init()
0071 {
0072 }
0073
0074 #if !defined(SSL_OP_NO_COMPRESSION) \
0075 && (OPENSSL_VERSION_NUMBER >= 0x00908000L)
0076 using openssl_init_base::get_null_compression_methods;
0077 #endif
0078
0079
0080 private:
0081
0082 static openssl_init instance_;
0083
0084
0085
0086 boost::asio::detail::shared_ptr<do_init> ref_;
0087 };
0088
0089 template <bool Do_Init>
0090 openssl_init<Do_Init> openssl_init<Do_Init>::instance_;
0091
0092 }
0093 }
0094 }
0095 }
0096
0097 #include <boost/asio/detail/pop_options.hpp>
0098
0099 #if defined(BOOST_ASIO_HEADER_ONLY)
0100 # include <boost/asio/ssl/detail/impl/openssl_init.ipp>
0101 #endif
0102
0103 #endif