activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r948224 - in /activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/openssl: OpenSSLParameters.cpp OpenSSLParameters.h
Date Tue, 25 May 2010 22:26:26 GMT
Author: tabish
Date: Tue May 25 22:26:26 2010
New Revision: 948224

URL: http://svn.apache.org/viewvc?rev=948224&view=rev
Log:
https://issues.apache.org/activemq/browse/AMQCPP-140

Implements all the common data shared between client and server ssl sockets.

Modified:
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/openssl/OpenSSLParameters.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/openssl/OpenSSLParameters.h

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/openssl/OpenSSLParameters.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/openssl/OpenSSLParameters.cpp?rev=948224&r1=948223&r2=948224&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/openssl/OpenSSLParameters.cpp
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/openssl/OpenSSLParameters.cpp
Tue May 25 22:26:26 2010
@@ -17,7 +17,17 @@
 
 #include "OpenSSLParameters.h"
 
+#include <decaf/lang/exceptions/NullPointerException.h>
+
+#ifdef HAVE_OPENSSL
+#include <openssl/ssl.h>
+#endif
+
+#include <memory>
+
 using namespace decaf;
+using namespace decaf::lang;
+using namespace decaf::lang::exceptions;
 using namespace decaf::internal;
 using namespace decaf::internal::net;
 using namespace decaf::internal::net::ssl;
@@ -28,6 +38,12 @@ using namespace decaf::internal::net::ss
 ////////////////////////////////////////////////////////////////////////////////
 OpenSSLParameters::OpenSSLParameters( SSL_CTX* context ) : context( context ) {
 
+    if( context == NULL ) {
+        throw NullPointerException( __FILE__, __LINE__, "SSL Context was NULL" );
+    }
+
+    // Create a new SSL instance for this Parameters object, each one needs its own.
+    this->ssl = SSL_new( context );
 }
 
 #endif
@@ -35,7 +51,65 @@ OpenSSLParameters::OpenSSLParameters( SS
 ////////////////////////////////////////////////////////////////////////////////
 OpenSSLParameters::~OpenSSLParameters() {
 
+    try {
 #ifdef HAVE_OPENSSL
 
+    SSL_free( this->ssl );
+
+#endif
+    }
+    DECAF_CATCH_NOTHROW( Exception )
+    DECAF_CATCHALL_NOTHROW()
+}
+
+////////////////////////////////////////////////////////////////////////////////
+std::vector<std::string> OpenSSLParameters::getSupportedCipherSuites() const {
+    return std::vector<std::string>();
+}
+
+////////////////////////////////////////////////////////////////////////////////
+std::vector<std::string> OpenSSLParameters::getSupportedProtocols() const {
+    return std::vector<std::string>();
+}
+
+////////////////////////////////////////////////////////////////////////////////
+std::vector<std::string> OpenSSLParameters::getEnabledCipherSuites() const {
+    return std::vector<std::string>();
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void OpenSSLParameters::setEnabledCipherSuites( const std::vector<std::string>&
suites ) {
+
+}
+
+////////////////////////////////////////////////////////////////////////////////
+std::vector<std::string> OpenSSLParameters::getEnabledProtocols() const {
+    return std::vector<std::string>();
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void OpenSSLParameters::setEnabledProtocols( const std::vector<std::string>& protocols
) {
+
+}
+
+////////////////////////////////////////////////////////////////////////////////
+OpenSSLParameters* OpenSSLParameters::clonse() const {
+
+#ifdef HAVE_OPENSSL
+
+    std::auto_ptr<OpenSSLParameters> cloned( new OpenSSLParameters( this->context
) );
+
+    cloned->setEnabledCipherSuites( this->getEnabledCipherSuites() );
+    cloned->setEnabledProtocols( this->getEnabledProtocols() );
+    cloned->needClientAuth = this->needClientAuth;
+    cloned->wantClientAuth = this->wantClientAuth;
+    cloned->useClientMode = this->useClientMode;
+
+    return cloned.release();
+
+#else
+
+    return NULL;
+
 #endif
 }

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/openssl/OpenSSLParameters.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/openssl/OpenSSLParameters.h?rev=948224&r1=948223&r2=948224&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/openssl/OpenSSLParameters.h
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/openssl/OpenSSLParameters.h
Tue May 25 22:26:26 2010
@@ -84,9 +84,36 @@ namespace openssl {
             this->useClientMode = value;
         }
 
+        std::vector<std::string> getSupportedCipherSuites() const;
+
+        std::vector<std::string> getSupportedProtocols() const;
+
+        std::vector<std::string> getEnabledCipherSuites() const;
+
+        void setEnabledCipherSuites( const std::vector<std::string>& suites );
+
+        std::vector<std::string> getEnabledProtocols() const;
+
+        void setEnabledProtocols( const std::vector<std::string>& protocols );
+
 #ifdef HAVE_OPENSSL
 
+        SSL_CTX* getSSLContext() const {
+            return this->context;
+        }
+
+        SSL* getSSL() const {
+            return this->ssl;
+        }
+
 #endif
+
+        /**
+         * Creates a clone of this object such that all settings are transferred to a new
+         * instance of an SSL object whose parent is the same SSL_CTX as this object's.
+         */
+        OpenSSLParameters* clonse() const;
+
     };
 
 }}}}}



Mime
View raw message