annotate DEPENDENCIES/generic/include/boost/asio/ssl/old/context_service.hpp @ 133:4acb5d8d80b6 tip

Don't fail environmental check if README.md exists (but .txt and no-suffix don't)
author Chris Cannam
date Tue, 30 Jul 2019 12:25:44 +0100
parents c530137014c0
children
rev   line source
Chris@16 1 //
Chris@16 2 // ssl/old/context_service.hpp
Chris@16 3 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~
Chris@16 4 //
Chris@16 5 // Copyright (c) 2005 Voipster / Indrek dot Juhani at voipster dot com
Chris@101 6 // Copyright (c) 2005-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
Chris@16 7 //
Chris@16 8 // Distributed under the Boost Software License, Version 1.0. (See accompanying
Chris@16 9 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
Chris@16 10 //
Chris@16 11
Chris@16 12 #ifndef BOOST_ASIO_SSL_OLD_CONTEXT_SERVICE_HPP
Chris@16 13 #define BOOST_ASIO_SSL_OLD_CONTEXT_SERVICE_HPP
Chris@16 14
Chris@16 15 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
Chris@16 16 # pragma once
Chris@16 17 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
Chris@16 18
Chris@16 19 #include <boost/asio/detail/config.hpp>
Chris@16 20 #include <string>
Chris@16 21 #include <boost/noncopyable.hpp>
Chris@16 22 #include <boost/asio/error.hpp>
Chris@16 23 #include <boost/asio/io_service.hpp>
Chris@16 24 #include <boost/asio/ssl/context_base.hpp>
Chris@16 25 #include <boost/asio/ssl/old/detail/openssl_context_service.hpp>
Chris@16 26
Chris@16 27 #include <boost/asio/detail/push_options.hpp>
Chris@16 28
Chris@16 29 namespace boost {
Chris@16 30 namespace asio {
Chris@16 31 namespace ssl {
Chris@16 32 namespace old {
Chris@16 33
Chris@16 34 /// Default service implementation for a context.
Chris@16 35 class context_service
Chris@16 36 #if defined(GENERATING_DOCUMENTATION)
Chris@16 37 : public boost::asio::io_service::service
Chris@16 38 #else
Chris@16 39 : public boost::asio::detail::service_base<context_service>
Chris@16 40 #endif
Chris@16 41 {
Chris@16 42 private:
Chris@16 43 // The type of the platform-specific implementation.
Chris@16 44 typedef old::detail::openssl_context_service service_impl_type;
Chris@16 45
Chris@16 46 public:
Chris@16 47 #if defined(GENERATING_DOCUMENTATION)
Chris@16 48 /// The unique service identifier.
Chris@16 49 static boost::asio::io_service::id id;
Chris@16 50 #endif
Chris@16 51
Chris@16 52 /// The type of the context.
Chris@16 53 #if defined(GENERATING_DOCUMENTATION)
Chris@16 54 typedef implementation_defined impl_type;
Chris@16 55 #else
Chris@16 56 typedef service_impl_type::impl_type impl_type;
Chris@16 57 #endif
Chris@16 58
Chris@16 59 /// Constructor.
Chris@16 60 explicit context_service(boost::asio::io_service& io_service)
Chris@16 61 : boost::asio::detail::service_base<context_service>(io_service),
Chris@16 62 service_impl_(boost::asio::use_service<service_impl_type>(io_service))
Chris@16 63 {
Chris@16 64 }
Chris@16 65
Chris@16 66 /// Return a null context implementation.
Chris@16 67 impl_type null() const
Chris@16 68 {
Chris@16 69 return service_impl_.null();
Chris@16 70 }
Chris@16 71
Chris@16 72 /// Create a new context implementation.
Chris@16 73 void create(impl_type& impl, context_base::method m)
Chris@16 74 {
Chris@16 75 service_impl_.create(impl, m);
Chris@16 76 }
Chris@16 77
Chris@16 78 /// Destroy a context implementation.
Chris@16 79 void destroy(impl_type& impl)
Chris@16 80 {
Chris@16 81 service_impl_.destroy(impl);
Chris@16 82 }
Chris@16 83
Chris@16 84 /// Set options on the context.
Chris@16 85 boost::system::error_code set_options(impl_type& impl,
Chris@16 86 context_base::options o, boost::system::error_code& ec)
Chris@16 87 {
Chris@16 88 return service_impl_.set_options(impl, o, ec);
Chris@16 89 }
Chris@16 90
Chris@16 91 /// Set peer verification mode.
Chris@16 92 boost::system::error_code set_verify_mode(impl_type& impl,
Chris@16 93 context_base::verify_mode v, boost::system::error_code& ec)
Chris@16 94 {
Chris@16 95 return service_impl_.set_verify_mode(impl, v, ec);
Chris@16 96 }
Chris@16 97
Chris@16 98 /// Load a certification authority file for performing verification.
Chris@16 99 boost::system::error_code load_verify_file(impl_type& impl,
Chris@16 100 const std::string& filename, boost::system::error_code& ec)
Chris@16 101 {
Chris@16 102 return service_impl_.load_verify_file(impl, filename, ec);
Chris@16 103 }
Chris@16 104
Chris@16 105 /// Add a directory containing certification authority files to be used for
Chris@16 106 /// performing verification.
Chris@16 107 boost::system::error_code add_verify_path(impl_type& impl,
Chris@16 108 const std::string& path, boost::system::error_code& ec)
Chris@16 109 {
Chris@16 110 return service_impl_.add_verify_path(impl, path, ec);
Chris@16 111 }
Chris@16 112
Chris@16 113 /// Use a certificate from a file.
Chris@16 114 boost::system::error_code use_certificate_file(impl_type& impl,
Chris@16 115 const std::string& filename, context_base::file_format format,
Chris@16 116 boost::system::error_code& ec)
Chris@16 117 {
Chris@16 118 return service_impl_.use_certificate_file(impl, filename, format, ec);
Chris@16 119 }
Chris@16 120
Chris@16 121 /// Use a certificate chain from a file.
Chris@16 122 boost::system::error_code use_certificate_chain_file(impl_type& impl,
Chris@16 123 const std::string& filename, boost::system::error_code& ec)
Chris@16 124 {
Chris@16 125 return service_impl_.use_certificate_chain_file(impl, filename, ec);
Chris@16 126 }
Chris@16 127
Chris@16 128 /// Use a private key from a file.
Chris@16 129 boost::system::error_code use_private_key_file(impl_type& impl,
Chris@16 130 const std::string& filename, context_base::file_format format,
Chris@16 131 boost::system::error_code& ec)
Chris@16 132 {
Chris@16 133 return service_impl_.use_private_key_file(impl, filename, format, ec);
Chris@16 134 }
Chris@16 135
Chris@16 136 /// Use an RSA private key from a file.
Chris@16 137 boost::system::error_code use_rsa_private_key_file(impl_type& impl,
Chris@16 138 const std::string& filename, context_base::file_format format,
Chris@16 139 boost::system::error_code& ec)
Chris@16 140 {
Chris@16 141 return service_impl_.use_rsa_private_key_file(impl, filename, format, ec);
Chris@16 142 }
Chris@16 143
Chris@16 144 /// Use the specified file to obtain the temporary Diffie-Hellman parameters.
Chris@16 145 boost::system::error_code use_tmp_dh_file(impl_type& impl,
Chris@16 146 const std::string& filename, boost::system::error_code& ec)
Chris@16 147 {
Chris@16 148 return service_impl_.use_tmp_dh_file(impl, filename, ec);
Chris@16 149 }
Chris@16 150
Chris@16 151 /// Set the password callback.
Chris@16 152 template <typename PasswordCallback>
Chris@16 153 boost::system::error_code set_password_callback(impl_type& impl,
Chris@16 154 PasswordCallback callback, boost::system::error_code& ec)
Chris@16 155 {
Chris@16 156 return service_impl_.set_password_callback(impl, callback, ec);
Chris@16 157 }
Chris@16 158
Chris@16 159 private:
Chris@16 160 // Destroy all user-defined handler objects owned by the service.
Chris@16 161 void shutdown_service()
Chris@16 162 {
Chris@16 163 }
Chris@16 164
Chris@16 165 // The service that provides the platform-specific implementation.
Chris@16 166 service_impl_type& service_impl_;
Chris@16 167 };
Chris@16 168
Chris@16 169 } // namespace old
Chris@16 170 } // namespace ssl
Chris@16 171 } // namespace asio
Chris@16 172 } // namespace boost
Chris@16 173
Chris@16 174 #include <boost/asio/detail/pop_options.hpp>
Chris@16 175
Chris@16 176 #endif // BOOST_ASIO_SSL_OLD_CONTEXT_SERVICE_HPP