context_service.hpp
Go to the documentation of this file.
00001 //
00002 // context_service.hpp
00003 // ~~~~~~~~~~~~~~~~~~~
00004 //
00005 // Copyright (c) 2005 Voipster / Indrek dot Juhani at voipster dot com
00006 // Copyright (c) 2005-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com)
00007 //
00008 // Distributed under the Boost Software License, Version 1.0. (See accompanying
00009 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
00010 //
00011 
00012 #ifndef ASIO_SSL_CONTEXT_SERVICE_HPP
00013 #define ASIO_SSL_CONTEXT_SERVICE_HPP
00014 
00015 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
00016 # pragma once
00017 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
00018 
00019 #include "asio/detail/push_options.hpp"
00020 
00021 #include "asio/detail/push_options.hpp"
00022 #include <string>
00023 #include <boost/noncopyable.hpp>
00024 #include "asio/detail/pop_options.hpp"
00025 
00026 #include "asio/error.hpp"
00027 #include "asio/io_service.hpp"
00028 #include "asio/detail/service_base.hpp"
00029 #include "asio/ssl/context_base.hpp"
00030 #include "asio/ssl/detail/openssl_context_service.hpp"
00031 
00032 namespace asio {
00033 namespace ssl {
00034 
00036 class context_service
00037 #if defined(GENERATING_DOCUMENTATION)
00038   : public asio::io_service::service
00039 #else
00040   : public asio::detail::service_base<context_service>
00041 #endif
00042 {
00043 private:
00044   // The type of the platform-specific implementation.
00045   typedef detail::openssl_context_service service_impl_type;
00046 
00047 public:
00048 #if defined(GENERATING_DOCUMENTATION)
00049 
00050   static asio::io_service::id id;
00051 #endif
00052 
00054 #if defined(GENERATING_DOCUMENTATION)
00055   typedef implementation_defined impl_type;
00056 #else
00057   typedef service_impl_type::impl_type impl_type;
00058 #endif
00059 
00061   explicit context_service(asio::io_service& io_service)
00062     : asio::detail::service_base<context_service>(io_service),
00063       service_impl_(asio::use_service<service_impl_type>(io_service))
00064   {
00065   }
00066 
00068   void shutdown_service()
00069   {
00070   }
00071 
00073   impl_type null() const
00074   {
00075     return service_impl_.null();
00076   }
00077 
00079   void create(impl_type& impl, context_base::method m)
00080   {
00081     service_impl_.create(impl, m);
00082   }
00083 
00085   void destroy(impl_type& impl)
00086   {
00087     service_impl_.destroy(impl);
00088   }
00089 
00091   asio::error_code set_options(impl_type& impl,
00092       context_base::options o, asio::error_code& ec)
00093   {
00094     return service_impl_.set_options(impl, o, ec);
00095   }
00096 
00098   asio::error_code set_verify_mode(impl_type& impl,
00099       context_base::verify_mode v, asio::error_code& ec)
00100   {
00101     return service_impl_.set_verify_mode(impl, v, ec);
00102   }
00103 
00105   asio::error_code load_verify_file(impl_type& impl,
00106       const std::string& filename, asio::error_code& ec)
00107   {
00108     return service_impl_.load_verify_file(impl, filename, ec);
00109   }
00110 
00113   asio::error_code add_verify_path(impl_type& impl,
00114       const std::string& path, asio::error_code& ec)
00115   {
00116     return service_impl_.add_verify_path(impl, path, ec);
00117   }
00118 
00120   asio::error_code use_certificate_file(impl_type& impl,
00121       const std::string& filename, context_base::file_format format,
00122       asio::error_code& ec)
00123   {
00124     return service_impl_.use_certificate_file(impl, filename, format, ec);
00125   }
00126 
00128   asio::error_code use_certificate_chain_file(impl_type& impl,
00129       const std::string& filename, asio::error_code& ec)
00130   {
00131     return service_impl_.use_certificate_chain_file(impl, filename, ec);
00132   }
00133 
00135   asio::error_code use_private_key_file(impl_type& impl,
00136       const std::string& filename, context_base::file_format format,
00137       asio::error_code& ec)
00138   {
00139     return service_impl_.use_private_key_file(impl, filename, format, ec);
00140   }
00141 
00143   asio::error_code use_rsa_private_key_file(impl_type& impl,
00144       const std::string& filename, context_base::file_format format,
00145       asio::error_code& ec)
00146   {
00147     return service_impl_.use_rsa_private_key_file(impl, filename, format, ec);
00148   }
00149 
00151   asio::error_code use_tmp_dh_file(impl_type& impl,
00152       const std::string& filename, asio::error_code& ec)
00153   {
00154     return service_impl_.use_tmp_dh_file(impl, filename, ec);
00155   }
00156 
00158   template <typename PasswordCallback>
00159   asio::error_code set_password_callback(impl_type& impl,
00160       PasswordCallback callback, asio::error_code& ec)
00161   {
00162     return service_impl_.set_password_callback(impl, callback, ec);
00163   }
00164 
00165 private:
00166   // The service that provides the platform-specific implementation.
00167   service_impl_type& service_impl_;
00168 };
00169 
00170 } // namespace ssl
00171 } // namespace asio
00172 
00173 #include "asio/detail/pop_options.hpp"
00174 
00175 #endif // ASIO_SSL_CONTEXT_SERVICE_HPP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines


Castor
Author(s): Carpe Noctem
autogenerated on Fri Nov 8 2013 11:05:39