error.ipp 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. //
  2. // ssl/impl/error.ipp
  3. // ~~~~~~~~~~~~~~~~~~
  4. //
  5. // Copyright (c) 2003-2013 Christopher M. Kohlhoff (chris at kohlhoff dot com)
  6. //
  7. // Distributed under the Boost Software License, Version 1.0. (See accompanying
  8. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  9. //
  10. #ifndef BOOST_ASIO_SSL_IMPL_ERROR_IPP
  11. #define BOOST_ASIO_SSL_IMPL_ERROR_IPP
  12. #if defined(_MSC_VER) && (_MSC_VER >= 1200)
  13. # pragma once
  14. #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
  15. #include <boost/asio/detail/config.hpp>
  16. #include <boost/asio/ssl/error.hpp>
  17. #include <boost/asio/ssl/detail/openssl_init.hpp>
  18. #include <boost/asio/detail/push_options.hpp>
  19. namespace boost {
  20. namespace asio {
  21. namespace error {
  22. namespace detail {
  23. class ssl_category : public boost::system::error_category
  24. {
  25. public:
  26. const char* name() const BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT
  27. {
  28. return "asio.ssl";
  29. }
  30. std::string message(int value) const
  31. {
  32. const char* s = ::ERR_reason_error_string(value);
  33. return s ? s : "asio.ssl error";
  34. }
  35. };
  36. } // namespace detail
  37. const boost::system::error_category& get_ssl_category()
  38. {
  39. static detail::ssl_category instance;
  40. return instance;
  41. }
  42. } // namespace error
  43. } // namespace asio
  44. } // namespace boost
  45. #include <boost/asio/detail/pop_options.hpp>
  46. #endif // BOOST_ASIO_SSL_IMPL_ERROR_IPP