|
activemq-cpp-3.4.0
|
00001 /* 00002 * Licensed to the Apache Software Foundation (ASF) under one or more 00003 * contributor license agreements. See the NOTICE file distributed with 00004 * this work for additional information regarding copyright ownership. 00005 * The ASF licenses this file to You under the Apache License, Version 2.0 00006 * (the "License"); you may not use this file except in compliance with 00007 * the License. You may obtain a copy of the License at 00008 * 00009 * http://www.apache.org/licenses/LICENSE-2.0 00010 * 00011 * Unless required by applicable law or agreed to in writing, software 00012 * distributed under the License is distributed on an "AS IS" BASIS, 00013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00014 * See the License for the specific language governing permissions and 00015 * limitations under the License. 00016 */ 00017 00018 #ifndef _DECAF_INTERNAL_NET_SSL_OPENSSL_OPENSSLPARAMETERS_H_ 00019 #define _DECAF_INTERNAL_NET_SSL_OPENSSL_OPENSSLPARAMETERS_H_ 00020 00021 #include <decaf/util/Config.h> 00022 00023 #include <string> 00024 #include <vector> 00025 00026 #ifdef HAVE_OPENSSL 00027 #include <openssl/ssl.h> 00028 #endif 00029 00030 namespace decaf { 00031 namespace internal { 00032 namespace net { 00033 namespace ssl { 00034 namespace openssl { 00035 00041 class OpenSSLParameters { 00042 private: 00043 00044 bool needClientAuth; 00045 bool wantClientAuth; 00046 bool useClientMode; 00047 00048 #ifdef HAVE_OPENSSL 00049 SSL_CTX* context; 00050 SSL* ssl; 00051 #endif 00052 00053 std::vector<std::string> enabledCipherSuites; 00054 std::vector<std::string> enabledProtocols; 00055 00056 private: 00057 00058 OpenSSLParameters( const OpenSSLParameters& ); 00059 OpenSSLParameters& operator= ( const OpenSSLParameters& ); 00060 00061 public: 00062 00063 #ifdef HAVE_OPENSSL 00064 OpenSSLParameters( SSL_CTX* context ); 00065 #endif 00066 00067 virtual ~OpenSSLParameters(); 00068 00069 bool getNeedClientAuth() const { 00070 return this->needClientAuth; 00071 } 00072 00073 void setNeedClientAuth( bool value ) { 00074 this->needClientAuth = value; 00075 this->wantClientAuth = false; 00076 } 00077 00078 bool getWantClientAuth() const { 00079 return this->wantClientAuth; 00080 } 00081 00082 void setWantClientAuth( bool value ) { 00083 this->wantClientAuth = value; 00084 this->needClientAuth = false; 00085 } 00086 00087 bool getUseClientMode() const { 00088 return this->useClientMode; 00089 } 00090 00091 void setUseClientMode( bool value ) { 00092 this->useClientMode = value; 00093 } 00094 00095 std::vector<std::string> getSupportedCipherSuites() const; 00096 00097 std::vector<std::string> getSupportedProtocols() const; 00098 00099 std::vector<std::string> getEnabledCipherSuites() const; 00100 00101 void setEnabledCipherSuites( const std::vector<std::string>& suites ); 00102 00103 std::vector<std::string> getEnabledProtocols() const; 00104 00105 void setEnabledProtocols( const std::vector<std::string>& protocols ); 00106 00107 #ifdef HAVE_OPENSSL 00108 00109 SSL_CTX* getSSLContext() const { 00110 return this->context; 00111 } 00112 00113 SSL* getSSL() const { 00114 return this->ssl; 00115 } 00116 00117 #endif 00118 00123 OpenSSLParameters* clone() const; 00124 00125 }; 00126 00127 }}}}} 00128 00129 #endif /* _DECAF_INTERNAL_NET_SSL_OPENSSL_OPENSSLPARAMETERS_H_ */