error.ipp 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. //
  2. // ssl/impl/error.ipp
  3. // ~~~~~~~~~~~~~~~~~~
  4. //
  5. // Copyright (c) 2003-2015 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 ASIO_SSL_IMPL_ERROR_IPP
  11. #define 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 "asio/detail/config.hpp"
  16. #include "asio/ssl/error.hpp"
  17. #include "asio/ssl/detail/openssl_init.hpp"
  18. #include "asio/detail/push_options.hpp"
  19. namespace asio {
  20. namespace error {
  21. namespace detail {
  22. class ssl_category : public asio::error_category
  23. {
  24. public:
  25. const char* name() const ASIO_ERROR_CATEGORY_NOEXCEPT
  26. {
  27. return "asio.ssl";
  28. }
  29. std::string message(int value) const
  30. {
  31. const char* s = ::ERR_reason_error_string(value);
  32. return s ? s : "asio.ssl error";
  33. }
  34. };
  35. } // namespace detail
  36. const asio::error_category& get_ssl_category()
  37. {
  38. static detail::ssl_category instance;
  39. return instance;
  40. }
  41. } // namespace error
  42. } // namespace asio
  43. #include "asio/detail/pop_options.hpp"
  44. #endif // ASIO_SSL_IMPL_ERROR_IPP