$search
00001 // 00002 // context_base.hpp 00003 // ~~~~~~~~~~~~~~~~ 00004 // 00005 // Copyright (c) 2005-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) 00006 // 00007 // Distributed under the Boost Software License, Version 1.0. (See accompanying 00008 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 00009 // 00010 00011 #ifndef ASIO_SSL_CONTEXT_BASE_HPP 00012 #define ASIO_SSL_CONTEXT_BASE_HPP 00013 00014 #if defined(_MSC_VER) && (_MSC_VER >= 1200) 00015 # pragma once 00016 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 00017 00018 #include "asio/detail/push_options.hpp" 00019 00020 #include "asio/detail/push_options.hpp" 00021 #include <boost/config.hpp> 00022 #include <boost/detail/workaround.hpp> 00023 #include "asio/detail/pop_options.hpp" 00024 00025 #include "asio/ssl/detail/openssl_types.hpp" 00026 00027 namespace asio { 00028 namespace ssl { 00029 00032 class context_base 00033 { 00034 public: 00036 enum method 00037 { 00039 sslv2, 00040 00042 sslv2_client, 00043 00045 sslv2_server, 00046 00048 sslv3, 00049 00051 sslv3_client, 00052 00054 sslv3_server, 00055 00057 tlsv1, 00058 00060 tlsv1_client, 00061 00063 tlsv1_server, 00064 00066 sslv23, 00067 00069 sslv23_client, 00070 00072 sslv23_server 00073 }; 00074 00076 typedef int options; 00077 00078 #if defined(GENERATING_DOCUMENTATION) 00079 00080 static const int default_workarounds = implementation_defined; 00081 00083 static const int single_dh_use = implementation_defined; 00084 00086 static const int no_sslv2 = implementation_defined; 00087 00089 static const int no_sslv3 = implementation_defined; 00090 00092 static const int no_tlsv1 = implementation_defined; 00093 #else 00094 BOOST_STATIC_CONSTANT(int, default_workarounds = SSL_OP_ALL); 00095 BOOST_STATIC_CONSTANT(int, single_dh_use = SSL_OP_SINGLE_DH_USE); 00096 BOOST_STATIC_CONSTANT(int, no_sslv2 = SSL_OP_NO_SSLv2); 00097 BOOST_STATIC_CONSTANT(int, no_sslv3 = SSL_OP_NO_SSLv3); 00098 BOOST_STATIC_CONSTANT(int, no_tlsv1 = SSL_OP_NO_TLSv1); 00099 #endif 00100 00102 enum file_format 00103 { 00105 asn1, 00106 00108 pem 00109 }; 00110 00112 typedef int verify_mode; 00113 00114 #if defined(GENERATING_DOCUMENTATION) 00115 00116 static const int verify_none = implementation_defined; 00117 00119 static const int verify_peer = implementation_defined; 00120 00123 static const int verify_fail_if_no_peer_cert = implementation_defined; 00124 00127 static const int verify_client_once = implementation_defined; 00128 #else 00129 BOOST_STATIC_CONSTANT(int, verify_none = SSL_VERIFY_NONE); 00130 BOOST_STATIC_CONSTANT(int, verify_peer = SSL_VERIFY_PEER); 00131 BOOST_STATIC_CONSTANT(int, 00132 verify_fail_if_no_peer_cert = SSL_VERIFY_FAIL_IF_NO_PEER_CERT); 00133 BOOST_STATIC_CONSTANT(int, verify_client_once = SSL_VERIFY_CLIENT_ONCE); 00134 #endif 00135 00137 enum password_purpose 00138 { 00140 for_reading, 00141 00143 for_writing 00144 }; 00145 00146 protected: 00148 ~context_base() 00149 { 00150 } 00151 00152 #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) 00153 private: 00154 // Workaround to enable the empty base optimisation with Borland C++. 00155 char dummy_; 00156 #endif 00157 }; 00158 00159 } // namespace ssl 00160 } // namespace asio 00161 00162 #include "asio/detail/pop_options.hpp" 00163 00164 #endif // ASIO_SSL_CONTEXT_BASE_HPP