activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r946345 - in /activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf: internal/net/ssl/openssl/OpenSSLServerSocket.cpp internal/net/ssl/openssl/OpenSSLServerSocket.h net/ServerSocket.h
Date Wed, 19 May 2010 19:12:01 GMT
Author: tabish
Date: Wed May 19 19:12:01 2010
New Revision: 946345

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

Add some more implementation to OpenSSLServerSocket

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

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/openssl/OpenSSLServerSocket.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/openssl/OpenSSLServerSocket.cpp?rev=946345&r1=946344&r2=946345&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/openssl/OpenSSLServerSocket.cpp
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/openssl/OpenSSLServerSocket.cpp
Wed May 19 19:12:01 2010
@@ -37,17 +37,118 @@ using namespace decaf::lang;
 using namespace decaf::lang::exceptions;
 using namespace decaf::io;
 using namespace decaf::net;
-//using namespace decaf::net::ssl;
+using namespace decaf::net::ssl;
 using namespace decaf::internal;
 using namespace decaf::internal::net;
 using namespace decaf::internal::net::ssl;
 using namespace decaf::internal::net::ssl::openssl;
 
 ////////////////////////////////////////////////////////////////////////////////
-OpenSSLServerSocket::OpenSSLServerSocket() {
+namespace decaf {
+namespace internal {
+namespace net {
+namespace ssl {
+namespace openssl {
+
+    class ServerSocketData {
+    public:
+
+#ifdef HAVE_OPENSSL
+        SSL* ssl;
+#endif
+        bool needsClientAuth;
+        bool wantsClientAuth;
+
+    public:
+
+        ServerSocketData() : ssl( NULL ), needsClientAuth( false ), wantsClientAuth( false
) {
+        }
+
+        ~ServerSocketData() {
+            try{
+#ifdef HAVE_OPENSSL
+                if( ssl ) {
+                    SSL_free( ssl );
+                }
+#endif
+            } catch(...) {}
+        }
+
+    };
+
+}}}}}
+
+////////////////////////////////////////////////////////////////////////////////
+OpenSSLServerSocket::OpenSSLServerSocket( void* ssl ) : SSLServerSocket(), data( new ServerSocketData()
) {
+
+    if( ssl == NULL ) {
+        throw NullPointerException(
+            __FILE__, __LINE__, "The OpenSSL SSL object instance passed was NULL." );
+    }
+
+#ifdef HAVE_OPENSSL
+    this->data->ssl = static_cast<SSL*>( ssl );
+#endif
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 OpenSSLServerSocket::~OpenSSLServerSocket() {
 }
 
+////////////////////////////////////////////////////////////////////////////////
+std::vector<std::string> OpenSSLServerSocket::getSupportedCipherSuites() const {
+
+    return std::vector<std::string>();
+}
+
+////////////////////////////////////////////////////////////////////////////////
+std::vector<std::string> OpenSSLServerSocket::getSupportedProtocols() const {
+
+    return std::vector<std::string>();
+}
+
+////////////////////////////////////////////////////////////////////////////////
+std::vector<std::string> OpenSSLServerSocket::getEnabledCipherSuites() const {
+
+    return std::vector<std::string>();
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void OpenSSLServerSocket::setEnabledCipherSuites( const std::vector<std::string>&
suites DECAF_UNUSED ) {
+
+}
+
+////////////////////////////////////////////////////////////////////////////////
+std::vector<std::string> OpenSSLServerSocket::getEnabledProtocols() const {
+
+    return std::vector<std::string>();
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void OpenSSLServerSocket::setEnabledProtocols( const std::vector<std::string>&
protocols DECAF_UNUSED ) {
+
+}
+
+////////////////////////////////////////////////////////////////////////////////
+bool OpenSSLServerSocket::getNeedClientAuth() const {
+    return this->data->needsClientAuth;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void OpenSSLServerSocket::setNeedClientAuth( bool value ) {
+
+    this->data->needsClientAuth = value;
+    this->data->wantsClientAuth = value;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+bool OpenSSLServerSocket::getWantClientAuth() const {
+    return this->data->wantsClientAuth;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void OpenSSLServerSocket::setWantClientAuth( bool value ) {
+
+    this->data->needsClientAuth = value;
+    this->data->wantsClientAuth = value;
+}

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/openssl/OpenSSLServerSocket.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/openssl/OpenSSLServerSocket.h?rev=946345&r1=946344&r2=946345&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/openssl/OpenSSLServerSocket.h
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/openssl/OpenSSLServerSocket.h
Wed May 19 19:12:01 2010
@@ -20,18 +20,84 @@
 
 #include <decaf/util/Config.h>
 
+#include <decaf/net/ssl/SSLServerSocket.h>
+
 namespace decaf {
 namespace internal {
 namespace net {
 namespace ssl {
 namespace openssl {
 
-    class DECAF_API OpenSSLServerSocket {
+    class ServerSocketData;
+
+    /**
+     * SSLServerSocket based on OpenSSL library code.
+     *
+     * @since 1.0
+     */
+    class DECAF_API OpenSSLServerSocket : public decaf::net::ssl::SSLServerSocket {
+    private:
+
+        ServerSocketData* data;
+
     public:
 
-        OpenSSLServerSocket();
+        OpenSSLServerSocket( void* ssl );
+
         virtual ~OpenSSLServerSocket();
 
+    public: // SSLServerSocket overrides
+
+        /**
+         * {@inheritDoc}
+         */
+        virtual std::vector<std::string> getSupportedCipherSuites() const;
+
+        /**
+         * {@inheritDoc}
+         */
+        virtual std::vector<std::string> getSupportedProtocols() const;
+
+        /**
+         * {@inheritDoc}
+         */
+        virtual std::vector<std::string> getEnabledCipherSuites() const;
+
+        /**
+         * {@inheritDoc}
+         */
+        virtual void setEnabledCipherSuites( const std::vector<std::string>& suites
);
+
+        /**
+         * {@inheritDoc}
+         */
+        virtual std::vector<std::string> getEnabledProtocols() const;
+
+        /**
+         * {@inheritDoc}
+         */
+        virtual void setEnabledProtocols( const std::vector<std::string>& protocols
);
+
+        /**
+         * {@inheritDoc}
+         */
+        virtual bool getWantClientAuth() const;
+
+        /**
+         * {@inheritDoc}
+         */
+        virtual void setWantClientAuth( bool value );
+
+        /**
+         * {@inheritDoc}
+         */
+        virtual bool getNeedClientAuth() const;
+
+        /**
+         * {@inheritDoc}
+         */
+        virtual void setNeedClientAuth( bool value );
+
     };
 
 }}}}}

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ServerSocket.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ServerSocket.h?rev=946345&r1=946344&r2=946345&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ServerSocket.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ServerSocket.h Wed May 19
19:12:01 2010
@@ -173,7 +173,7 @@ namespace net{
          * @throws IOException if an I/O error occurs while binding the socket.
          * @throws IllegalArgumentException if the parameters are not valid.
          */
-        void bind( const std::string& host, int port )
+        virtual void bind( const std::string& host, int port )
             throw ( decaf::io::IOException, decaf::lang::exceptions::IllegalArgumentException
);
 
         /**
@@ -194,7 +194,7 @@ namespace net{
          * @throws IOException if an I/O error occurs while binding the socket.
          * @throws IllegalArgumentException if the parameters are not valid.
          */
-        void bind( const std::string& host, int port, int backlog )
+        virtual void bind( const std::string& host, int port, int backlog )
             throw ( decaf::io::IOException, decaf::lang::exceptions::IllegalArgumentException
);
 
         /**
@@ -209,7 +209,7 @@ namespace net{
          * @throws SocketException if an error occurs while blocking on the accept call.
          * @throws SocketTimeoutException if the SO_TIMEOUT option was used and the accept
timed out.
          */
-        Socket* accept() throw( decaf::io::IOException );
+        virtual Socket* accept() throw( decaf::io::IOException );
 
         /**
          * Closes the server socket, causing any Threads blocked on an accept call to
@@ -217,17 +217,17 @@ namespace net{
          *
          * @throws IOException if an I/O error occurs while performing this operation.
          */
-        void close() throw( decaf::io::IOException );
+        virtual void close() throw( decaf::io::IOException );
 
         /**
          * @returns true if the close method has been called on the ServerSocket.
          */
-        bool isClosed() const;
+        virtual bool isClosed() const;
 
         /**
          * @return true of the server socket is bound.
          */
-        bool isBound() const;
+        virtual bool isBound() const;
 
         /**
          * Gets the receive buffer size for this socket, SO_RCVBUF.  This is the buffer used
@@ -237,7 +237,7 @@ namespace net{
          *
          * @throws SocketException if the operation fails.
          */
-        int getReceiveBufferSize() const throw( SocketException );
+        virtual int getReceiveBufferSize() const throw( SocketException );
 
         /**
          * Sets the receive buffer size for this socket, SO_RCVBUF.
@@ -248,7 +248,7 @@ namespace net{
          * @throws SocketException if the operation fails.
          * @throws IllegalArgumentException if the value is zero or negative.
          */
-        void setReceiveBufferSize( int size )
+        virtual void setReceiveBufferSize( int size )
             throw( SocketException, decaf::lang::exceptions::IllegalArgumentException );
 
         /**
@@ -258,7 +258,7 @@ namespace net{
          *
          * @throws SocketException if the operation fails.
          */
-        bool getReuseAddress() const throw( SocketException );
+        virtual bool getReuseAddress() const throw( SocketException );
 
         /**
          * Sets the reuse address flag, SO_REUSEADDR.
@@ -268,7 +268,7 @@ namespace net{
          *
          * @throws SocketException if the operation fails.
          */
-        void setReuseAddress( bool reuse ) throw( SocketException );
+        virtual void setReuseAddress( bool reuse ) throw( SocketException );
 
         /**
          * Gets the timeout for socket operations, SO_TIMEOUT.
@@ -277,7 +277,7 @@ namespace net{
          *
          * @throws SocketException Thrown if unable to retrieve the information.
          */
-        int getSoTimeout() const throw( SocketException );
+        virtual int getSoTimeout() const throw( SocketException );
 
         /**
          * Sets the timeout for socket operations, SO_TIMEOUT.  A value of zero indicates
that timeout
@@ -289,7 +289,7 @@ namespace net{
          * @throws SocketException Thrown if unable to set the information.
          * @throws IllegalArgumentException if the timeout value is negative.
          */
-        void setSoTimeout( int timeout )
+        virtual void setSoTimeout( int timeout )
             throw( SocketException, decaf::lang::exceptions::IllegalArgumentException );
 
         /**
@@ -297,12 +297,12 @@ namespace net{
          *
          * @returns the port number of this machine that is bound, if not bound returns -1.
          */
-        int getLocalPort() const;
+        virtual int getLocalPort() const;
 
         /**
          * @returns a string representing this ServerSocket.
          */
-        std::string toString() const;
+        virtual std::string toString() const;
 
     public:
 



Mime
View raw message