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.

context_base.hpp 5.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. //
  2. // ssl/context_base.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_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. /// Generic TLS version 1.3.
  65. tlsv13,
  66. /// TLS version 1.3 client.
  67. tlsv13_client,
  68. /// TLS version 1.3 server.
  69. tlsv13_server,
  70. /// Generic TLS.
  71. tls,
  72. /// TLS client.
  73. tls_client,
  74. /// TLS server.
  75. tls_server
  76. };
  77. /// Bitmask type for SSL options.
  78. typedef long options;
  79. #if defined(GENERATING_DOCUMENTATION)
  80. /// Implement various bug workarounds.
  81. static const long default_workarounds = implementation_defined;
  82. /// Always create a new key when using tmp_dh parameters.
  83. static const long single_dh_use = implementation_defined;
  84. /// Disable SSL v2.
  85. static const long no_sslv2 = implementation_defined;
  86. /// Disable SSL v3.
  87. static const long no_sslv3 = implementation_defined;
  88. /// Disable TLS v1.
  89. static const long no_tlsv1 = implementation_defined;
  90. /// Disable TLS v1.1.
  91. static const long no_tlsv1_1 = implementation_defined;
  92. /// Disable TLS v1.2.
  93. static const long no_tlsv1_2 = implementation_defined;
  94. /// Disable TLS v1.3.
  95. static const long no_tlsv1_3 = implementation_defined;
  96. /// Disable compression. Compression is disabled by default.
  97. static const long no_compression = implementation_defined;
  98. #else
  99. ASIO_STATIC_CONSTANT(long, default_workarounds = SSL_OP_ALL);
  100. ASIO_STATIC_CONSTANT(long, single_dh_use = SSL_OP_SINGLE_DH_USE);
  101. ASIO_STATIC_CONSTANT(long, no_sslv2 = SSL_OP_NO_SSLv2);
  102. ASIO_STATIC_CONSTANT(long, no_sslv3 = SSL_OP_NO_SSLv3);
  103. ASIO_STATIC_CONSTANT(long, no_tlsv1 = SSL_OP_NO_TLSv1);
  104. # if defined(SSL_OP_NO_TLSv1_1)
  105. ASIO_STATIC_CONSTANT(long, no_tlsv1_1 = SSL_OP_NO_TLSv1_1);
  106. # else // defined(SSL_OP_NO_TLSv1_1)
  107. ASIO_STATIC_CONSTANT(long, no_tlsv1_1 = 0x10000000L);
  108. # endif // defined(SSL_OP_NO_TLSv1_1)
  109. # if defined(SSL_OP_NO_TLSv1_2)
  110. ASIO_STATIC_CONSTANT(long, no_tlsv1_2 = SSL_OP_NO_TLSv1_2);
  111. # else // defined(SSL_OP_NO_TLSv1_2)
  112. ASIO_STATIC_CONSTANT(long, no_tlsv1_2 = 0x08000000L);
  113. # endif // defined(SSL_OP_NO_TLSv1_2)
  114. # if defined(SSL_OP_NO_TLSv1_3)
  115. ASIO_STATIC_CONSTANT(long, no_tlsv1_3 = SSL_OP_NO_TLSv1_3);
  116. # else // defined(SSL_OP_NO_TLSv1_3)
  117. ASIO_STATIC_CONSTANT(long, no_tlsv1_3 = 0x20000000L);
  118. # endif // defined(SSL_OP_NO_TLSv1_3)
  119. # if defined(SSL_OP_NO_COMPRESSION)
  120. ASIO_STATIC_CONSTANT(long, no_compression = SSL_OP_NO_COMPRESSION);
  121. # else // defined(SSL_OP_NO_COMPRESSION)
  122. ASIO_STATIC_CONSTANT(long, no_compression = 0x20000L);
  123. # endif // defined(SSL_OP_NO_COMPRESSION)
  124. #endif
  125. /// File format types.
  126. enum file_format
  127. {
  128. /// ASN.1 file.
  129. asn1,
  130. /// PEM file.
  131. pem
  132. };
  133. #if !defined(GENERATING_DOCUMENTATION)
  134. // The following types and constants are preserved for backward compatibility.
  135. // New programs should use the equivalents of the same names that are defined
  136. // in the asio::ssl namespace.
  137. typedef int verify_mode;
  138. ASIO_STATIC_CONSTANT(int, verify_none = SSL_VERIFY_NONE);
  139. ASIO_STATIC_CONSTANT(int, verify_peer = SSL_VERIFY_PEER);
  140. ASIO_STATIC_CONSTANT(int,
  141. verify_fail_if_no_peer_cert = SSL_VERIFY_FAIL_IF_NO_PEER_CERT);
  142. ASIO_STATIC_CONSTANT(int, verify_client_once = SSL_VERIFY_CLIENT_ONCE);
  143. #endif
  144. /// Purpose of PEM password.
  145. enum password_purpose
  146. {
  147. /// The password is needed for reading/decryption.
  148. for_reading,
  149. /// The password is needed for writing/encryption.
  150. for_writing
  151. };
  152. protected:
  153. /// Protected destructor to prevent deletion through this type.
  154. ~context_base()
  155. {
  156. }
  157. };
  158. } // namespace ssl
  159. } // namespace asio
  160. #include "asio/detail/pop_options.hpp"
  161. #endif // ASIO_SSL_CONTEXT_BASE_HPP