Audio plugin host https://kx.studio/carla
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

error.hpp 2.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. //
  2. // ssl/error.hpp
  3. // ~~~~~~~~~~~~~
  4. //
  5. // Copyright (c) 2003-2019 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/ssl/detail/openssl_types.hpp"
  18. #include "asio/detail/push_options.hpp"
  19. namespace asio {
  20. namespace error {
  21. enum ssl_errors
  22. {
  23. // Error numbers are those produced by openssl.
  24. };
  25. extern ASIO_DECL
  26. const asio::error_category& get_ssl_category();
  27. static const asio::error_category&
  28. ssl_category ASIO_UNUSED_VARIABLE
  29. = asio::error::get_ssl_category();
  30. } // namespace error
  31. namespace ssl {
  32. namespace error {
  33. enum stream_errors
  34. {
  35. #if defined(GENERATING_DOCUMENTATION)
  36. /// The underlying stream closed before the ssl stream gracefully shut down.
  37. stream_truncated,
  38. /// The underlying SSL library returned a system error without providing
  39. /// further information.
  40. unspecified_system_error,
  41. /// The underlying SSL library generated an unexpected result from a function
  42. /// call.
  43. unexpected_result
  44. #else // defined(GENERATING_DOCUMENTATION)
  45. # if (OPENSSL_VERSION_NUMBER < 0x10100000L) && !defined(OPENSSL_IS_BORINGSSL)
  46. stream_truncated = ERR_PACK(ERR_LIB_SSL, 0, SSL_R_SHORT_READ),
  47. # else
  48. stream_truncated = 1,
  49. # endif
  50. unspecified_system_error = 2,
  51. unexpected_result = 3
  52. #endif // defined(GENERATING_DOCUMENTATION)
  53. };
  54. extern ASIO_DECL
  55. const asio::error_category& get_stream_category();
  56. static const asio::error_category&
  57. stream_category ASIO_UNUSED_VARIABLE
  58. = asio::ssl::error::get_stream_category();
  59. } // namespace error
  60. } // namespace ssl
  61. } // namespace asio
  62. #if defined(ASIO_HAS_STD_SYSTEM_ERROR)
  63. namespace std {
  64. template<> struct is_error_code_enum<asio::error::ssl_errors>
  65. {
  66. static const bool value = true;
  67. };
  68. template<> struct is_error_code_enum<asio::ssl::error::stream_errors>
  69. {
  70. static const bool value = true;
  71. };
  72. } // namespace std
  73. #endif // defined(ASIO_HAS_STD_SYSTEM_ERROR)
  74. namespace asio {
  75. namespace error {
  76. inline asio::error_code make_error_code(ssl_errors e)
  77. {
  78. return asio::error_code(
  79. static_cast<int>(e), get_ssl_category());
  80. }
  81. } // namespace error
  82. namespace ssl {
  83. namespace error {
  84. inline asio::error_code make_error_code(stream_errors e)
  85. {
  86. return asio::error_code(
  87. static_cast<int>(e), get_stream_category());
  88. }
  89. } // namespace error
  90. } // namespace ssl
  91. } // namespace asio
  92. #include "asio/detail/pop_options.hpp"
  93. #if defined(ASIO_HEADER_ONLY)
  94. # include "asio/ssl/impl/error.ipp"
  95. #endif // defined(ASIO_HEADER_ONLY)
  96. #endif // ASIO_SSL_ERROR_HPP