context.hpp 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. //
  2. // ssl/impl/context.hpp
  3. // ~~~~~~~~~~~~~~~~~~~~
  4. //
  5. // Copyright (c) 2005 Voipster / Indrek dot Juhani at voipster dot com
  6. // Copyright (c) 2005-2021 Christopher M. Kohlhoff (chris at kohlhoff dot com)
  7. //
  8. // Distributed under the Boost Software License, Version 1.0. (See accompanying
  9. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  10. //
  11. #ifndef BOOST_ASIO_SSL_IMPL_CONTEXT_HPP
  12. #define BOOST_ASIO_SSL_IMPL_CONTEXT_HPP
  13. #if defined(_MSC_VER) && (_MSC_VER >= 1200)
  14. # pragma once
  15. #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
  16. #include <boost/asio/detail/config.hpp>
  17. #include <boost/asio/detail/throw_error.hpp>
  18. #include <boost/asio/detail/push_options.hpp>
  19. namespace boost {
  20. namespace asio {
  21. namespace ssl {
  22. template <typename VerifyCallback>
  23. void context::set_verify_callback(VerifyCallback callback)
  24. {
  25. boost::system::error_code ec;
  26. this->set_verify_callback(callback, ec);
  27. boost::asio::detail::throw_error(ec, "set_verify_callback");
  28. }
  29. template <typename VerifyCallback>
  30. BOOST_ASIO_SYNC_OP_VOID context::set_verify_callback(
  31. VerifyCallback callback, boost::system::error_code& ec)
  32. {
  33. do_set_verify_callback(
  34. new detail::verify_callback<VerifyCallback>(callback), ec);
  35. BOOST_ASIO_SYNC_OP_VOID_RETURN(ec);
  36. }
  37. template <typename PasswordCallback>
  38. void context::set_password_callback(PasswordCallback callback)
  39. {
  40. boost::system::error_code ec;
  41. this->set_password_callback(callback, ec);
  42. boost::asio::detail::throw_error(ec, "set_password_callback");
  43. }
  44. template <typename PasswordCallback>
  45. BOOST_ASIO_SYNC_OP_VOID context::set_password_callback(
  46. PasswordCallback callback, boost::system::error_code& ec)
  47. {
  48. do_set_password_callback(
  49. new detail::password_callback<PasswordCallback>(callback), ec);
  50. BOOST_ASIO_SYNC_OP_VOID_RETURN(ec);
  51. }
  52. } // namespace ssl
  53. } // namespace asio
  54. } // namespace boost
  55. #include <boost/asio/detail/pop_options.hpp>
  56. #endif // BOOST_ASIO_SSL_IMPL_CONTEXT_HPP