error.hpp 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. //
  2. // ssl/error.hpp
  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_ERROR_HPP
  11. #define ASIO_SSL_ERROR_HPP
  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/error_code.hpp"
  17. #include "asio/detail/push_options.hpp"
  18. namespace asio {
  19. namespace error {
  20. enum ssl_errors
  21. {
  22. };
  23. extern ASIO_DECL
  24. const asio::error_category& get_ssl_category();
  25. static const asio::error_category& ssl_category
  26. = asio::error::get_ssl_category();
  27. } // namespace error
  28. } // namespace asio
  29. #if defined(ASIO_HAS_STD_SYSTEM_ERROR)
  30. namespace std {
  31. template<> struct is_error_code_enum<asio::error::ssl_errors>
  32. {
  33. static const bool value = true;
  34. };
  35. } // namespace std
  36. #endif // defined(ASIO_HAS_STD_SYSTEM_ERROR)
  37. namespace asio {
  38. namespace error {
  39. inline asio::error_code make_error_code(ssl_errors e)
  40. {
  41. return asio::error_code(
  42. static_cast<int>(e), get_ssl_category());
  43. }
  44. } // namespace error
  45. } // namespace asio
  46. #include "asio/detail/pop_options.hpp"
  47. #if defined(ASIO_HEADER_ONLY)
  48. # include "asio/ssl/impl/error.ipp"
  49. #endif // defined(ASIO_HEADER_ONLY)
  50. #endif // ASIO_SSL_ERROR_HPP