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.

184 lines
4.6KB

  1. //
  2. // ssl/context_base.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_CONTEXT_BASE_HPP
  11. #define ASIO_SSL_CONTEXT_BASE_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/ssl/detail/openssl_types.hpp"
  17. #include "asio/detail/push_options.hpp"
  18. namespace asio {
  19. namespace ssl {
  20. /// The context_base class is used as a base for the basic_context class
  21. /// template so that we have a common place to define various enums.
  22. class context_base
  23. {
  24. public:
  25. /// Different methods supported by a context.
  26. enum method
  27. {
  28. /// Generic SSL version 2.
  29. sslv2,
  30. /// SSL version 2 client.
  31. sslv2_client,
  32. /// SSL version 2 server.
  33. sslv2_server,
  34. /// Generic SSL version 3.
  35. sslv3,
  36. /// SSL version 3 client.
  37. sslv3_client,
  38. /// SSL version 3 server.
  39. sslv3_server,
  40. /// Generic TLS version 1.
  41. tlsv1,
  42. /// TLS version 1 client.
  43. tlsv1_client,
  44. /// TLS version 1 server.
  45. tlsv1_server,
  46. /// Generic SSL/TLS.
  47. sslv23,
  48. /// SSL/TLS client.
  49. sslv23_client,
  50. /// SSL/TLS server.
  51. sslv23_server,
  52. /// Generic TLS version 1.1.
  53. tlsv11,
  54. /// TLS version 1.1 client.
  55. tlsv11_client,
  56. /// TLS version 1.1 server.
  57. tlsv11_server,
  58. /// Generic TLS version 1.2.
  59. tlsv12,
  60. /// TLS version 1.2 client.
  61. tlsv12_client,
  62. /// TLS version 1.2 server.
  63. tlsv12_server
  64. };
  65. /// Bitmask type for SSL options.
  66. typedef long options;
  67. #if defined(GENERATING_DOCUMENTATION)
  68. /// Implement various bug workarounds.
  69. static const long default_workarounds = implementation_defined;
  70. /// Always create a new key when using tmp_dh parameters.
  71. static const long single_dh_use = implementation_defined;
  72. /// Disable SSL v2.
  73. static const long no_sslv2 = implementation_defined;
  74. /// Disable SSL v3.
  75. static const long no_sslv3 = implementation_defined;
  76. /// Disable TLS v1.
  77. static const long no_tlsv1 = implementation_defined;
  78. /// Disable TLS v1.1.
  79. static const long no_tlsv1_1 = implementation_defined;
  80. /// Disable TLS v1.2.
  81. static const long no_tlsv1_2 = implementation_defined;
  82. /// Disable compression. Compression is disabled by default.
  83. static const long no_compression = implementation_defined;
  84. #else
  85. ASIO_STATIC_CONSTANT(long, default_workarounds = SSL_OP_ALL);
  86. ASIO_STATIC_CONSTANT(long, single_dh_use = SSL_OP_SINGLE_DH_USE);
  87. ASIO_STATIC_CONSTANT(long, no_sslv2 = SSL_OP_NO_SSLv2);
  88. ASIO_STATIC_CONSTANT(long, no_sslv3 = SSL_OP_NO_SSLv3);
  89. ASIO_STATIC_CONSTANT(long, no_tlsv1 = SSL_OP_NO_TLSv1);
  90. # if defined(SSL_OP_NO_TLSv1_1)
  91. ASIO_STATIC_CONSTANT(long, no_tlsv1_1 = SSL_OP_NO_TLSv1_1);
  92. # else // defined(SSL_OP_NO_TLSv1_1)
  93. ASIO_STATIC_CONSTANT(long, no_tlsv1_1 = 0x10000000L);
  94. # endif // defined(SSL_OP_NO_TLSv1_1)
  95. # if defined(SSL_OP_NO_TLSv1_2)
  96. ASIO_STATIC_CONSTANT(long, no_tlsv1_2 = SSL_OP_NO_TLSv1_2);
  97. # else // defined(SSL_OP_NO_TLSv1_2)
  98. ASIO_STATIC_CONSTANT(long, no_tlsv1_2 = 0x08000000L);
  99. # endif // defined(SSL_OP_NO_TLSv1_2)
  100. # if defined(SSL_OP_NO_COMPRESSION)
  101. ASIO_STATIC_CONSTANT(long, no_compression = SSL_OP_NO_COMPRESSION);
  102. # else // defined(SSL_OP_NO_COMPRESSION)
  103. ASIO_STATIC_CONSTANT(long, no_compression = 0x20000L);
  104. # endif // defined(SSL_OP_NO_COMPRESSION)
  105. #endif
  106. /// File format types.
  107. enum file_format
  108. {
  109. /// ASN.1 file.
  110. asn1,
  111. /// PEM file.
  112. pem
  113. };
  114. #if !defined(GENERATING_DOCUMENTATION)
  115. // The following types and constants are preserved for backward compatibility.
  116. // New programs should use the equivalents of the same names that are defined
  117. // in the asio::ssl namespace.
  118. typedef int verify_mode;
  119. ASIO_STATIC_CONSTANT(int, verify_none = SSL_VERIFY_NONE);
  120. ASIO_STATIC_CONSTANT(int, verify_peer = SSL_VERIFY_PEER);
  121. ASIO_STATIC_CONSTANT(int,
  122. verify_fail_if_no_peer_cert = SSL_VERIFY_FAIL_IF_NO_PEER_CERT);
  123. ASIO_STATIC_CONSTANT(int, verify_client_once = SSL_VERIFY_CLIENT_ONCE);
  124. #endif
  125. /// Purpose of PEM password.
  126. enum password_purpose
  127. {
  128. /// The password is needed for reading/decryption.
  129. for_reading,
  130. /// The password is needed for writing/encryption.
  131. for_writing
  132. };
  133. protected:
  134. /// Protected destructor to prevent deletion through this type.
  135. ~context_base()
  136. {
  137. }
  138. };
  139. } // namespace ssl
  140. } // namespace asio
  141. #include "asio/detail/pop_options.hpp"
  142. #endif // ASIO_SSL_CONTEXT_BASE_HPP