You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2010/04/30 16:45:41 UTC
svn commit: r939692 - in /activemq/activemq-cpp/trunk/activemq-cpp/src/main:
./ decaf/internal/net/ssl/ decaf/net/ssl/
Author: tabish
Date: Fri Apr 30 14:45:41 2010
New Revision: 939692
URL: http://svn.apache.org/viewvc?rev=939692&view=rev
Log:
https://issues.apache.org/activemq/browse/AMQCPP-140
Rearrange some code to start work in SSL implementation, make the default SSL factory throw an exception to indicate no SSL support.
Added:
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/DefaultSSLSocketFactory.cpp
- copied, changed from r938018, activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/DefaultSSLSocketFactory.cpp
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/DefaultSSLSocketFactory.h
- copied, changed from r938018, activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/DefaultSSLSocketFactory.h
Removed:
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/DefaultSSLSocketFactory.cpp
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/DefaultSSLSocketFactory.h
Modified:
activemq/activemq-cpp/trunk/activemq-cpp/src/main/Makefile.am
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLSocketFactory.cpp
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLSocketFactory.h
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/Makefile.am
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/Makefile.am?rev=939692&r1=939691&r2=939692&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/Makefile.am (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/Makefile.am Fri Apr 30 14:45:41 2010
@@ -484,6 +484,7 @@ cc_sources = \
decaf/internal/io/StandardOutputStream.cpp \
decaf/internal/net/URIEncoderDecoder.cpp \
decaf/internal/net/URIHelper.cpp \
+ decaf/internal/net/ssl/DefaultSSLSocketFactory.cpp \
decaf/internal/net/tcp/DefaultSocketFactory.cpp \
decaf/internal/net/tcp/TcpSocket.cpp \
decaf/internal/net/tcp/TcpSocketInputStream.cpp \
@@ -559,7 +560,6 @@ cc_sources = \
decaf/net/URL.cpp \
decaf/net/URLDecoder.cpp \
decaf/net/URLEncoder.cpp \
- decaf/net/ssl/DefaultSSLSocketFactory.cpp \
decaf/net/ssl/SSLSocketFactory.cpp \
decaf/nio/Buffer.cpp \
decaf/nio/ByteBuffer.cpp \
@@ -1145,6 +1145,7 @@ h_sources = \
decaf/internal/net/URIEncoderDecoder.h \
decaf/internal/net/URIHelper.h \
decaf/internal/net/URIType.h \
+ decaf/internal/net/ssl/DefaultSSLSocketFactory.h \
decaf/internal/net/tcp/DefaultSocketFactory.h \
decaf/internal/net/tcp/TcpSocket.h \
decaf/internal/net/tcp/TcpSocketInputStream.h \
@@ -1272,7 +1273,6 @@ h_sources = \
decaf/net/URLEncoder.h \
decaf/net/UnknownHostException.h \
decaf/net/UnknownServiceException.h \
- decaf/net/ssl/DefaultSSLSocketFactory.h \
decaf/net/ssl/SSLSocketFactory.h \
decaf/nio/Buffer.h \
decaf/nio/BufferOverflowException.h \
Copied: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/DefaultSSLSocketFactory.cpp (from r938018, activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/DefaultSSLSocketFactory.cpp)
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/DefaultSSLSocketFactory.cpp?p2=activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/DefaultSSLSocketFactory.cpp&p1=activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/DefaultSSLSocketFactory.cpp&r1=938018&r2=939692&rev=939692&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/DefaultSSLSocketFactory.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/DefaultSSLSocketFactory.cpp Fri Apr 30 14:45:41 2010
@@ -17,11 +17,55 @@
#include "DefaultSSLSocketFactory.h"
+#include <decaf/io/IOException.h>
+
using namespace decaf;
+using namespace decaf::io;
using namespace decaf::net;
using namespace decaf::net::ssl;
+using namespace decaf::internal;
+using namespace decaf::internal::net;
+using namespace decaf::internal::net::ssl;
+
+////////////////////////////////////////////////////////////////////////////////
+DefaultSSLSocketFactory::DefaultSSLSocketFactory( const std::string& errorMessage ) :
+ SSLSocketFactory(), errorMessage( errorMessage ) {
+}
////////////////////////////////////////////////////////////////////////////////
DefaultSSLSocketFactory::~DefaultSSLSocketFactory() {
}
+////////////////////////////////////////////////////////////////////////////////
+decaf::net::Socket* DefaultSSLSocketFactory::createSocket()
+ throw( decaf::io::IOException ) {
+
+ throw IOException( __FILE__, __LINE__, errorMessage.c_str() );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+decaf::net::Socket* DefaultSSLSocketFactory::createSocket( const std::string& name DECAF_UNUSED, int port DECAF_UNUSED )
+ throw( decaf::io::IOException, decaf::net::UnknownHostException ) {
+
+ throw IOException( __FILE__, __LINE__, errorMessage.c_str() );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+std::vector<std::string> DefaultSSLSocketFactory::getDefaultCipherSuites() {
+
+ return std::vector<std::string>();
+}
+
+////////////////////////////////////////////////////////////////////////////////
+std::vector<std::string> DefaultSSLSocketFactory::getSupportedCipherSuites() {
+
+ return std::vector<std::string>();
+}
+
+////////////////////////////////////////////////////////////////////////////////
+Socket* DefaultSSLSocketFactory::createSocket( Socket* socket DECAF_UNUSED, std::string host DECAF_UNUSED,
+ int port DECAF_UNUSED, bool autoClose DECAF_UNUSED )
+ throw( decaf::io::IOException, decaf::net::UnknownHostException ) {
+
+ throw IOException( __FILE__, __LINE__, errorMessage.c_str() );
+}
Copied: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/DefaultSSLSocketFactory.h (from r938018, activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/DefaultSSLSocketFactory.h)
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/DefaultSSLSocketFactory.h?p2=activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/DefaultSSLSocketFactory.h&p1=activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/DefaultSSLSocketFactory.h&r1=938018&r2=939692&rev=939692&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/DefaultSSLSocketFactory.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/DefaultSSLSocketFactory.h Fri Apr 30 14:45:41 2010
@@ -15,30 +15,69 @@
* limitations under the License.
*/
-#ifndef _DECAF_NET_SSL_DEFAULTSSLSOCKETFACTORY_H_
-#define _DECAF_NET_SSL_DEFAULTSSLSOCKETFACTORY_H_
+#ifndef _DECAF_INTERNAL_NET_SSL_DEFAULTSSLSOCKETFACTORY_H_
+#define _DECAF_INTERNAL_NET_SSL_DEFAULTSSLSOCKETFACTORY_H_
#include <decaf/util/Config.h>
#include <decaf/net/ssl/SSLSocketFactory.h>
+#include <string>
+#include <vector>
+
namespace decaf {
+namespace internal {
namespace net {
namespace ssl {
/**
- * Default implementation of the SSLSocketFactory, creates an SSLSocket layered
- * around a Decaf TCP/IP Socket instance.
+ * Default implementation of the SSLSocketFactory, this factory throws an Exception
+ * from all its create methods to indicate that SSL is not supported, this factory
+ * is used when OpenSSL is not enabled in the builds.
*
* @since 1.0
*/
- class DECAF_API DefaultSSLSocketFactory : public SSLSocketFactory {
+ class DECAF_API DefaultSSLSocketFactory : public decaf::net::ssl::SSLSocketFactory {
+ private:
+
+ std::string errorMessage;
+
public:
+ DefaultSSLSocketFactory( const std::string& errorMessage );
+
virtual ~DefaultSSLSocketFactory();
+ /**
+ * {@inheritDoc}
+ */
+ virtual decaf::net::Socket* createSocket()
+ throw( decaf::io::IOException );
+
+ /**
+ * {@inheritDoc}
+ */
+ virtual decaf::net::Socket* createSocket( const std::string& name, int port )
+ throw( decaf::io::IOException, decaf::net::UnknownHostException );
+
+ /**
+ * {@inheritDoc}
+ */
+ virtual std::vector<std::string> getDefaultCipherSuites();
+
+ /**
+ * {@inheritDoc}
+ */
+ virtual std::vector<std::string> getSupportedCipherSuites();
+
+ /**
+ * {@inheritDoc}
+ */
+ virtual decaf::net::Socket* createSocket( decaf::net::Socket* socket, std::string host, int port, bool autoClose )
+ throw( decaf::io::IOException, decaf::net::UnknownHostException );
+
};
-}}}
+}}}}
-#endif /* _DECAF_NET_SSL_DEFAULTSSLSOCKETFACTORY_H_ */
+#endif /* _DECAF_INTERNAL_NET_SSL_DEFAULTSSLSOCKETFACTORY_H_ */
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLSocketFactory.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLSocketFactory.cpp?rev=939692&r1=939691&r2=939692&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLSocketFactory.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLSocketFactory.cpp Fri Apr 30 14:45:41 2010
@@ -17,9 +17,16 @@
#include "SSLSocketFactory.h"
+#include <decaf/internal/net/ssl/DefaultSSLSocketFactory.h>
+
using namespace decaf;
using namespace decaf::net;
using namespace decaf::net::ssl;
+using namespace decaf::internal::net::ssl;
+
+////////////////////////////////////////////////////////////////////////////////
+SSLSocketFactory::SSLSocketFactory() {
+}
////////////////////////////////////////////////////////////////////////////////
SSLSocketFactory::~SSLSocketFactory() {
@@ -27,6 +34,5 @@ SSLSocketFactory::~SSLSocketFactory() {
////////////////////////////////////////////////////////////////////////////////
SocketFactory* SSLSocketFactory::getDefault() {
-
- return NULL;
+ return new DefaultSSLSocketFactory( "SSL Support is not enabled in this build." );
}
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLSocketFactory.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLSocketFactory.h?rev=939692&r1=939691&r2=939692&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLSocketFactory.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLSocketFactory.h Fri Apr 30 14:45:41 2010
@@ -35,6 +35,10 @@ namespace ssl {
* @since 1.0
*/
class DECAF_API SSLSocketFactory : public SocketFactory {
+ protected:
+
+ SSLSocketFactory();
+
public:
virtual ~SSLSocketFactory();