Return-Path: Delivered-To: apmail-activemq-commits-archive@www.apache.org Received: (qmail 94342 invoked from network); 18 May 2010 22:25:17 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 18 May 2010 22:25:17 -0000 Received: (qmail 52510 invoked by uid 500); 18 May 2010 22:25:17 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 52461 invoked by uid 500); 18 May 2010 22:25:16 -0000 Mailing-List: contact commits-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list commits@activemq.apache.org Received: (qmail 52454 invoked by uid 99); 18 May 2010 22:25:16 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 18 May 2010 22:25:16 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 18 May 2010 22:25:10 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 442CD2388978; Tue, 18 May 2010 22:24:44 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r945930 - in /activemq/activemq-cpp/trunk/activemq-cpp/src: main/ main/decaf/internal/net/ main/decaf/internal/net/ssl/ main/decaf/internal/net/ssl/openssl/ main/decaf/internal/net/tcp/ main/decaf/net/ main/decaf/net/ssl/ test/decaf/net/ Date: Tue, 18 May 2010 22:24:43 -0000 To: commits@activemq.apache.org From: tabish@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100518222444.442CD2388978@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: tabish Date: Tue May 18 22:24:43 2010 New Revision: 945930 URL: http://svn.apache.org/viewvc?rev=945930&view=rev Log: https://issues.apache.org/activemq/browse/AMQCPP-140 Reorganize some of the Socket Factory code, add ServerSocketFactory and DefaultServerSocketFactory and SSL versions of same. Clean up the factory interfaces a bit. Added: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/DefaultServerSocketFactory.cpp (with props) activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/DefaultServerSocketFactory.h (with props) activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/DefaultSocketFactory.cpp - copied, changed from r944043, activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/tcp/DefaultSocketFactory.cpp activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/DefaultSocketFactory.h - copied, changed from r944043, activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/tcp/DefaultSocketFactory.h activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ServerSocketFactory.cpp (with props) activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ServerSocketFactory.h (with props) activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLServerSocket.cpp (with props) activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLServerSocket.h (with props) activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLServerSocketFactory.cpp (with props) activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLServerSocketFactory.h (with props) Removed: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/tcp/DefaultSocketFactory.cpp activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/tcp/DefaultSocketFactory.h Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/Makefile.am activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/DefaultSSLSocketFactory.cpp activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/DefaultSSLSocketFactory.h activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/openssl/OpenSSLSocketFactory.cpp activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/openssl/OpenSSLSocketFactory.h activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ServerSocket.cpp activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ServerSocket.h activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/Socket.cpp activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/Socket.h activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/SocketFactory.cpp activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/SocketFactory.h activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/net/SocketTest.cpp 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=945930&r1=945929&r2=945930&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/Makefile.am (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/Makefile.am Tue May 18 22:24:43 2010 @@ -484,6 +484,8 @@ cc_sources = \ decaf/internal/io/StandardErrorOutputStream.cpp \ decaf/internal/io/StandardInputStream.cpp \ decaf/internal/io/StandardOutputStream.cpp \ + decaf/internal/net/DefaultServerSocketFactory.cpp \ + decaf/internal/net/DefaultSocketFactory.cpp \ decaf/internal/net/Network.cpp \ decaf/internal/net/SocketFileDescriptor.cpp \ decaf/internal/net/URIEncoderDecoder.cpp \ @@ -498,7 +500,6 @@ cc_sources = \ decaf/internal/net/ssl/openssl/OpenSSLSocketFactory.cpp \ decaf/internal/net/ssl/openssl/OpenSSLSocketInputStream.cpp \ decaf/internal/net/ssl/openssl/OpenSSLSocketOutputStream.cpp \ - decaf/internal/net/tcp/DefaultSocketFactory.cpp \ decaf/internal/net/tcp/TcpSocket.cpp \ decaf/internal/net/tcp/TcpSocketInputStream.cpp \ decaf/internal/net/tcp/TcpSocketOutputStream.cpp \ @@ -567,6 +568,7 @@ cc_sources = \ decaf/net/InetAddress.cpp \ decaf/net/InetSocketAddress.cpp \ decaf/net/ServerSocket.cpp \ + decaf/net/ServerSocketFactory.cpp \ decaf/net/Socket.cpp \ decaf/net/SocketError.cpp \ decaf/net/SocketFactory.cpp \ @@ -579,6 +581,8 @@ cc_sources = \ decaf/net/ssl/SSLContext.cpp \ decaf/net/ssl/SSLContextSpi.cpp \ decaf/net/ssl/SSLParameters.cpp \ + decaf/net/ssl/SSLServerSocket.cpp \ + decaf/net/ssl/SSLServerSocketFactory.cpp \ decaf/net/ssl/SSLSocket.cpp \ decaf/net/ssl/SSLSocketFactory.cpp \ decaf/nio/Buffer.cpp \ @@ -1166,6 +1170,8 @@ h_sources = \ decaf/internal/io/StandardErrorOutputStream.h \ decaf/internal/io/StandardInputStream.h \ decaf/internal/io/StandardOutputStream.h \ + decaf/internal/net/DefaultServerSocketFactory.h \ + decaf/internal/net/DefaultSocketFactory.h \ decaf/internal/net/Network.h \ decaf/internal/net/SocketFileDescriptor.h \ decaf/internal/net/URIEncoderDecoder.h \ @@ -1181,7 +1187,6 @@ h_sources = \ decaf/internal/net/ssl/openssl/OpenSSLSocketFactory.h \ decaf/internal/net/ssl/openssl/OpenSSLSocketInputStream.h \ decaf/internal/net/ssl/openssl/OpenSSLSocketOutputStream.h \ - decaf/internal/net/tcp/DefaultSocketFactory.h \ decaf/internal/net/tcp/TcpSocket.h \ decaf/internal/net/tcp/TcpSocketInputStream.h \ decaf/internal/net/tcp/TcpSocketOutputStream.h \ @@ -1296,6 +1301,7 @@ h_sources = \ decaf/net/PortUnreachableException.h \ decaf/net/ProtocolException.h \ decaf/net/ServerSocket.h \ + decaf/net/ServerSocketFactory.h \ decaf/net/Socket.h \ decaf/net/SocketAddress.h \ decaf/net/SocketError.h \ @@ -1315,6 +1321,8 @@ h_sources = \ decaf/net/ssl/SSLContext.h \ decaf/net/ssl/SSLContextSpi.h \ decaf/net/ssl/SSLParameters.h \ + decaf/net/ssl/SSLServerSocket.h \ + decaf/net/ssl/SSLServerSocketFactory.h \ decaf/net/ssl/SSLSocket.h \ decaf/net/ssl/SSLSocketFactory.h \ decaf/nio/Buffer.h \ Added: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/DefaultServerSocketFactory.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/DefaultServerSocketFactory.cpp?rev=945930&view=auto ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/DefaultServerSocketFactory.cpp (added) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/DefaultServerSocketFactory.cpp Tue May 18 22:24:43 2010 @@ -0,0 +1,86 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "DefaultServerSocketFactory.h" + +#include +#include + +#include + +using namespace decaf; +using namespace decaf::io; +using namespace decaf::net; +using namespace decaf::lang; +using namespace decaf::internal; +using namespace decaf::internal::net; + +//////////////////////////////////////////////////////////////////////////////// +DefaultServerSocketFactory::DefaultServerSocketFactory() { +} + +//////////////////////////////////////////////////////////////////////////////// +DefaultServerSocketFactory::~DefaultServerSocketFactory() { +} + +//////////////////////////////////////////////////////////////////////////////// +ServerSocket* DefaultServerSocketFactory::createServerSocket() { + + try{ + std::auto_ptr socket( new ServerSocket() ); + return socket.release(); + } + DECAF_CATCH_RETHROW( IOException ) + DECAF_CATCH_EXCEPTION_CONVERT( Exception, IOException ) + DECAF_CATCHALL_THROW( IOException ) +} + +//////////////////////////////////////////////////////////////////////////////// +ServerSocket* DefaultServerSocketFactory::createServerSocket( int port ) { + + try{ + std::auto_ptr socket( new ServerSocket( port ) ); + return socket.release(); + } + DECAF_CATCH_RETHROW( IOException ) + DECAF_CATCH_EXCEPTION_CONVERT( Exception, IOException ) + DECAF_CATCHALL_THROW( IOException ) +} + +//////////////////////////////////////////////////////////////////////////////// +ServerSocket* DefaultServerSocketFactory::createServerSocket( int port, int backlog ) { + + try{ + std::auto_ptr socket( new ServerSocket( port, backlog ) ); + return socket.release(); + } + DECAF_CATCH_RETHROW( IOException ) + DECAF_CATCH_EXCEPTION_CONVERT( Exception, IOException ) + DECAF_CATCHALL_THROW( IOException ) +} + +//////////////////////////////////////////////////////////////////////////////// +ServerSocket* DefaultServerSocketFactory::createServerSocket( int port, int backlog, const InetAddress* address ) { + + try{ + std::auto_ptr socket( new ServerSocket( port, backlog, address ) ); + return socket.release(); + } + DECAF_CATCH_RETHROW( IOException ) + DECAF_CATCH_EXCEPTION_CONVERT( Exception, IOException ) + DECAF_CATCHALL_THROW( IOException ) +} Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/DefaultServerSocketFactory.cpp ------------------------------------------------------------------------------ svn:eol-style = native Added: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/DefaultServerSocketFactory.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/DefaultServerSocketFactory.h?rev=945930&view=auto ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/DefaultServerSocketFactory.h (added) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/DefaultServerSocketFactory.h Tue May 18 22:24:43 2010 @@ -0,0 +1,72 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef _DECAF_INTERNAL_NET_DEFAULTSERVERSOCKETFACTORY_H_ +#define _DECAF_INTERNAL_NET_DEFAULTSERVERSOCKETFACTORY_H_ + +#include + +#include + +namespace decaf { +namespace internal { +namespace net { + + /** + * Default implementation of the Decaf ServerSocketFactory, creates ServerSocket + * objects with supplied options. + * + * @since 1.0 + */ + class DefaultServerSocketFactory : public decaf::net::ServerSocketFactory { + private: + + DefaultServerSocketFactory( const DefaultServerSocketFactory& ); + DefaultServerSocketFactory& operator= ( const DefaultServerSocketFactory& ); + + public: + + DefaultServerSocketFactory(); + + virtual ~DefaultServerSocketFactory(); + + /** + * {@inheritDoc} + */ + virtual decaf::net::ServerSocket* createServerSocket(); + + /** + * {@inheritDoc} + */ + virtual decaf::net::ServerSocket* createServerSocket( int port ); + + /** + * {@inheritDoc} + */ + virtual decaf::net::ServerSocket* createServerSocket( int port, int backlog ); + + /** + * {@inheritDoc} + */ + virtual decaf::net::ServerSocket* createServerSocket( + int port, int backlog, const decaf::net::InetAddress* address ); + + }; + +}}} + +#endif /* _DECAF_INTERNAL_NET_DEFAULTSERVERSOCKETFACTORY_H_ */ Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/DefaultServerSocketFactory.h ------------------------------------------------------------------------------ svn:eol-style = native Copied: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/DefaultSocketFactory.cpp (from r944043, activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/tcp/DefaultSocketFactory.cpp) URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/DefaultSocketFactory.cpp?p2=activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/DefaultSocketFactory.cpp&p1=activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/tcp/DefaultSocketFactory.cpp&r1=944043&r2=945930&rev=945930&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/tcp/DefaultSocketFactory.cpp (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/DefaultSocketFactory.cpp Tue May 18 22:24:43 2010 @@ -17,11 +17,10 @@ #include "DefaultSocketFactory.h" +#include #include #include -#include - #include using namespace decaf; @@ -30,7 +29,6 @@ using namespace decaf::net; using namespace decaf::lang; using namespace decaf::internal; using namespace decaf::internal::net; -using namespace decaf::internal::net::tcp; //////////////////////////////////////////////////////////////////////////////// DefaultSocketFactory::DefaultSocketFactory() : SocketFactory() { @@ -46,9 +44,9 @@ Socket* DefaultSocketFactory::createSock try{ - std::auto_ptr theSocket( new Socket( new TcpSocket() ) ); + std::auto_ptr socket( new Socket() ); - return theSocket.release(); + return socket.release(); } DECAF_CATCH_RETHROW( IOException ) DECAF_CATCHALL_THROW( IOException ) @@ -69,11 +67,32 @@ Socket* DefaultSocketFactory::createSock throw SocketException( __FILE__, __LINE__, "valid port not provided" ); } - std::auto_ptr tcpSocket( new TcpSocket() ); - std::auto_ptr socket( new Socket( tcpSocket.release() ) ); + std::auto_ptr socket( new Socket( hostname, port ) ); + + return socket.release(); + } + DECAF_CATCH_RETHROW( IOException ) + DECAF_CATCH_EXCEPTION_CONVERT( Exception, IOException ) + DECAF_CATCHALL_THROW( IOException ) +} + +//////////////////////////////////////////////////////////////////////////////// +Socket* DefaultSocketFactory::createSocket( const std::string& hostname, int port, + const InetAddress* ifAddress, int localPort ) + throw( decaf::io::IOException, decaf::net::UnknownHostException ) { + + try { + + // Ensure something is actually passed in for the URI + if( hostname == "" ) { + throw SocketException( __FILE__, __LINE__, "uri not provided" ); + } + + if( port <= 0 ) { + throw SocketException( __FILE__, __LINE__, "valid port not provided" ); + } - // Connect the socket. - socket->connect( hostname.c_str(), port ); + std::auto_ptr socket( new Socket( hostname, port, ifAddress, localPort ) ); return socket.release(); } Copied: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/DefaultSocketFactory.h (from r944043, activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/tcp/DefaultSocketFactory.h) URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/DefaultSocketFactory.h?p2=activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/DefaultSocketFactory.h&p1=activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/tcp/DefaultSocketFactory.h&r1=944043&r2=945930&rev=945930&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/tcp/DefaultSocketFactory.h (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/DefaultSocketFactory.h Tue May 18 22:24:43 2010 @@ -15,8 +15,8 @@ * limitations under the License. */ -#ifndef DEFAULTSOCKETFACTORY_H_ -#define DEFAULTSOCKETFACTORY_H_ +#ifndef _DECAF_INTERNAL_NET_DEFAULTSOCKETFACTORY_H_ +#define _DECAF_INTERNAL_NET_DEFAULTSOCKETFACTORY_H_ #include @@ -25,14 +25,18 @@ namespace decaf { namespace internal { namespace net { -namespace tcp { /** - * SocketFactory implementation that is used to create TCP style Sockets. + * SocketFactory implementation that is used to create Sockets. * * @since 1.0 */ class DECAF_API DefaultSocketFactory : public decaf::net::SocketFactory { + private: + + DefaultSocketFactory( const DefaultSocketFactory& ); + DefaultSocketFactory& operator= ( const DefaultSocketFactory& ); + public: DefaultSocketFactory(); @@ -51,8 +55,15 @@ namespace tcp { virtual decaf::net::Socket* createSocket( const std::string& name, int port ) throw( decaf::io::IOException, decaf::net::UnknownHostException ); + /** + * {@inheritDoc} + */ + virtual decaf::net::Socket* createSocket( const std::string& name, int port, + const decaf::net::InetAddress* ifAddress, int localPort ) + throw( decaf::io::IOException, decaf::net::UnknownHostException ); + }; -}}}} +}}} -#endif /* DEFAULTSOCKETFACTORY_H_ */ +#endif /* _DECAF_INTERNAL_NET_DEFAULTSOCKETFACTORY_H_ */ Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/DefaultSSLSocketFactory.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/DefaultSSLSocketFactory.cpp?rev=945930&r1=945929&r2=945930&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/DefaultSSLSocketFactory.cpp (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/DefaultSSLSocketFactory.cpp Tue May 18 22:24:43 2010 @@ -51,6 +51,14 @@ decaf::net::Socket* DefaultSSLSocketFact } //////////////////////////////////////////////////////////////////////////////// +decaf::net::Socket* DefaultSSLSocketFactory::createSocket( const std::string& name DECAF_UNUSED, int port DECAF_UNUSED, + const InetAddress* ifAddress DECAF_UNUSED, int localPort DECAF_UNUSED ) + throw( decaf::io::IOException, decaf::net::UnknownHostException ) { + + throw IOException( __FILE__, __LINE__, errorMessage.c_str() ); +} + +//////////////////////////////////////////////////////////////////////////////// std::vector DefaultSSLSocketFactory::getDefaultCipherSuites() { return std::vector(); Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/DefaultSSLSocketFactory.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/DefaultSSLSocketFactory.h?rev=945930&r1=945929&r2=945930&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/DefaultSSLSocketFactory.h (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/DefaultSSLSocketFactory.h Tue May 18 22:24:43 2010 @@ -63,6 +63,13 @@ namespace ssl { /** * {@inheritDoc} */ + virtual decaf::net::Socket* createSocket( const std::string& name, int port, + const decaf::net::InetAddress* ifAddress, int localPort ) + throw( decaf::io::IOException, decaf::net::UnknownHostException ); + + /** + * {@inheritDoc} + */ virtual std::vector getDefaultCipherSuites(); /** Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/openssl/OpenSSLSocketFactory.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/openssl/OpenSSLSocketFactory.cpp?rev=945930&r1=945929&r2=945930&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/openssl/OpenSSLSocketFactory.cpp (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/openssl/OpenSSLSocketFactory.cpp Tue May 18 22:24:43 2010 @@ -101,7 +101,32 @@ Socket* OpenSSLSocketFactory::createSock } DECAF_CATCH_RETHROW( IOException ) DECAF_CATCH_EXCEPTION_CONVERT( Exception, IOException ) - DECAF_CATCHALL_THROW( IOException )} + DECAF_CATCHALL_THROW( IOException ) +} + +//////////////////////////////////////////////////////////////////////////////// +Socket* OpenSSLSocketFactory::createSocket( const std::string& hostname, int port, + const InetAddress* ifAddress, int localPort ) + throw( decaf::io::IOException, decaf::net::UnknownHostException ) { + + try{ + +#ifdef HAVE_OPENSSL + // Create a new SSL object for the Socket then create a new unconnected Socket. + SSL_CTX* ctx = static_cast( this->parent->getOpenSSLCtx() ); + std::auto_ptr socket( new OpenSSLSocket( SSL_new( ctx ) ) ); + std::string bindAddress = ifAddress == NULL ? "0.0.0.0" : ifAddress->getHostAddress(); + socket->bind( bindAddress, localPort ); + socket->connect( hostname, port ); + return socket.release(); +#else + return NULL; +#endif + } + DECAF_CATCH_RETHROW( IOException ) + DECAF_CATCH_EXCEPTION_CONVERT( Exception, IOException ) + DECAF_CATCHALL_THROW( IOException ) +} //////////////////////////////////////////////////////////////////////////////// Socket* OpenSSLSocketFactory::createSocket( Socket* socket DECAF_UNUSED, Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/openssl/OpenSSLSocketFactory.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/openssl/OpenSSLSocketFactory.h?rev=945930&r1=945929&r2=945930&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/openssl/OpenSSLSocketFactory.h (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/openssl/OpenSSLSocketFactory.h Tue May 18 22:24:43 2010 @@ -60,6 +60,13 @@ namespace openssl { /** * {@inheritDoc} */ + virtual decaf::net::Socket* createSocket( const std::string& name, int port, + const decaf::net::InetAddress* ifAddress, int localPort ) + throw( decaf::io::IOException, decaf::net::UnknownHostException ); + + /** + * {@inheritDoc} + */ virtual std::vector getDefaultCipherSuites(); /** Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ServerSocket.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ServerSocket.cpp?rev=945930&r1=945929&r2=945930&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ServerSocket.cpp (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ServerSocket.cpp Tue May 18 22:24:43 2010 @@ -55,7 +55,7 @@ ServerSocket::ServerSocket( int port ) __FILE__, __LINE__, "Port value was invalid: %d", port ); } - this->setupSocketImpl( "", port, getDefaultBacklog() ); + this->setupSocketImpl( port, getDefaultBacklog(), NULL ); } //////////////////////////////////////////////////////////////////////////////// @@ -70,11 +70,11 @@ ServerSocket::ServerSocket( int port, in __FILE__, __LINE__, "Port value was invalid: %d", port ); } - this->setupSocketImpl( "", port, backlog ); + this->setupSocketImpl( port, backlog, NULL ); } //////////////////////////////////////////////////////////////////////////////// -ServerSocket::ServerSocket( const std::string& ipAddress, int port, int backlog ) +ServerSocket::ServerSocket( int port, int backlog, const InetAddress* ifAddress ) throw( decaf::io::IOException, decaf::lang::exceptions::IllegalArgumentException ) : impl(NULL), created(false), closed(false), bound(false) { @@ -85,7 +85,7 @@ ServerSocket::ServerSocket( const std::s __FILE__, __LINE__, "Port value was invalid: %d", port ); } - this->setupSocketImpl( ipAddress, port, backlog ); + this->setupSocketImpl( port, backlog, ifAddress ); } //////////////////////////////////////////////////////////////////////////////// @@ -100,14 +100,18 @@ ServerSocket::~ServerSocket() { } //////////////////////////////////////////////////////////////////////////////// -void ServerSocket::setupSocketImpl( const std::string ipAddress, int port, int backlog ) { +void ServerSocket::setupSocketImpl( int port, int backlog, const InetAddress* ifAddress ) { try{ this->impl->create(); this->created = true; - std::string bindAddr = ipAddress.empty() ? "0.0.0.0" : ipAddress; + std::string bindAddr = "0.0.0.0"; + + if( ifAddress != NULL ) { + bindAddr = ifAddress->getHostAddress(); + } try { this->impl->bind( bindAddr, port ); 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=945930&r1=945929&r2=945930&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 Tue May 18 22:24:43 2010 @@ -19,6 +19,7 @@ #include +#include #include #include @@ -114,8 +115,8 @@ namespace net{ /** * Creates a new ServerSocket bound to the specified port, if the value of port is 0, then - * any free port is chosen. If the value of the ipAddress is empty then the ANY address is - * used. + * any free port is chosen. If the value of the ifAddress is empty or NULL then the ANY address + * is used. * * When this constructor is called the size of the backlog queue is set at backlog, connections * that arrive after the backlog has been reached are refused. If backlog is zero or negative @@ -124,17 +125,17 @@ namespace net{ * If a SocketImplFactory is registered then the createSocketImpl method on the factory * will be called otherwise a default SocketImpl is created. * - * @param ipAddress - * The IP Address to bind to on the local machine. * @param port * The port to bind the ServerSocket to. * @param backlog * The the number of incoming connection attempts to queue before connections are refused. + * @param ifAddress + * The IP Address to bind to on the local machine. * * @throws IOException if there is an I/O error while performing this operation. * @throws IllegalArgumentException if the port value is negative or greater than 65535. */ - ServerSocket( const std::string& ipAddress, int port, int backlog ) + ServerSocket( int port, int backlog, const InetAddress* address ) throw( decaf::io::IOException, decaf::lang::exceptions::IllegalArgumentException ); @@ -350,7 +351,7 @@ namespace net{ void ensureCreated() const throw( decaf::io::IOException ); // Binds and sets up the Listen for this Server Socket - void setupSocketImpl( const std::string ipAddress, int port, int backlog ); + void setupSocketImpl( int port, int backlog, const InetAddress* ifAddress ); }; Added: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ServerSocketFactory.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ServerSocketFactory.cpp?rev=945930&view=auto ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ServerSocketFactory.cpp (added) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ServerSocketFactory.cpp Tue May 18 22:24:43 2010 @@ -0,0 +1,64 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "ServerSocketFactory.h" + +#include +#include +#include +#include + +using namespace decaf; +using namespace decaf::io; +using namespace decaf::net; +using namespace decaf::util; +using namespace decaf::util::concurrent; +using namespace decaf::internal::net; + +//////////////////////////////////////////////////////////////////////////////// +ServerSocketFactory* ServerSocketFactory::defaultFactory = NULL; + +//////////////////////////////////////////////////////////////////////////////// +ServerSocketFactory::ServerSocketFactory() { +} + +//////////////////////////////////////////////////////////////////////////////// +ServerSocketFactory::~ServerSocketFactory() { +} + +//////////////////////////////////////////////////////////////////////////////// +ServerSocket* ServerSocketFactory::createServerSocket() { + + throw IOException( + __FILE__, __LINE__, "Unconnected Sockets not implemented for this Socket Type." ); +} + +//////////////////////////////////////////////////////////////////////////////// +ServerSocketFactory* ServerSocketFactory::getDefault() { + + Network* networkRuntime = Network::getNetworkRuntime(); + + synchronized( networkRuntime->getRuntimeLock() ) { + + if( defaultFactory == NULL ) { + defaultFactory = new DefaultServerSocketFactory(); + networkRuntime->addAsResource( defaultFactory ); + } + } + + return defaultFactory; +} Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ServerSocketFactory.cpp ------------------------------------------------------------------------------ svn:eol-style = native Added: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ServerSocketFactory.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ServerSocketFactory.h?rev=945930&view=auto ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ServerSocketFactory.h (added) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ServerSocketFactory.h Tue May 18 22:24:43 2010 @@ -0,0 +1,119 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef _DECAF_NET_SERVERSOCKETFACTORY_H_ +#define _DECAF_NET_SERVERSOCKETFACTORY_H_ + +#include + +#include + +namespace decaf { +namespace net { + + class ServerSocket; + + /** + * Class used to create Server Sockets, subclasses can be created that create certain + * types of server sockets according to specific policies. + * + * @since 1.0 + */ + class DECAF_API ServerSocketFactory { + private: + + static ServerSocketFactory* defaultFactory; + + protected: + + ServerSocketFactory(); + + public: + + virtual ~ServerSocketFactory(); + + /** + * Create a new ServerSocket that is unbound. The ServerSocket will have been configured + * with the defaults from the factory. + * + * @return new ServerSocket pointer that is owned by the caller. + * + * @throw IOException if the ServerSocket cannot be created for some reason. + */ + virtual ServerSocket* createServerSocket(); + + /** + * Create a new ServerSocket that is bound to the given port. The ServerSocket will have + * been configured with the defaults from the factory. + * + * @param port + * The port to bind the ServerSocket to. + * + * @return new ServerSocket pointer that is owned by the caller. + * + * @throw IOException if the ServerSocket cannot be created for some reason. + */ + virtual ServerSocket* createServerSocket( int port ) = 0; + + /** + * Create a new ServerSocket that is bound to the given port. The ServerSocket will have + * been configured with the defaults from the factory. The ServerSocket will use the + * specified connection backlog setting. + * + * @param port + * The port to bind the ServerSocket to. + * @param backlog + * The number of pending connect request the ServerSocket can queue. + * + * @return new ServerSocket pointer that is owned by the caller. + * + * @throw IOException if the ServerSocket cannot be created for some reason. + */ + virtual ServerSocket* createServerSocket( int port, int backlog ) = 0; + + /** + * Create a new ServerSocket that is bound to the given port. The ServerSocket will have + * been configured with the defaults from the factory. The ServerSocket will bind to the + * specified interface on the local host, and accept connections only on that interface. + * If the address parameter is NULL than the ServerSocket will listen on all interfaces. + * + * @param port + * The port to bind the ServerSocket to. + * @param backlog + * The number of pending connect request the ServerSocket can queue. + * @param address + * The address of the interface on the local machine to bind to. + * + * @return new ServerSocket pointer that is owned by the caller. + * + * @throw IOException if the ServerSocket cannot be created for some reason. + */ + virtual ServerSocket* createServerSocket( int port, int backlog, const InetAddress* address ) = 0; + + /** + * Returns the Default ServerSocket factory, the pointer is owned by the Decaf runtime and + * should not be deleted by the caller. Only one default ServerSocketFactory exists for the + * lifetime of the Application. + * + * @return the default ServerSocketFactory for this application. + */ + static ServerSocketFactory* getDefault(); + + }; + +}} + +#endif /* _DECAF_NET_SERVERSOCKETFACTORY_H_ */ Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ServerSocketFactory.h ------------------------------------------------------------------------------ svn:eol-style = native Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/Socket.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/Socket.cpp?rev=945930&r1=945929&r2=945930&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/Socket.cpp (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/Socket.cpp Tue May 18 22:24:43 2010 @@ -74,7 +74,7 @@ Socket::Socket( const std::string& host, this->impl = new TcpSocket(); } - this->initSocketImpl( host, port, "0.0.0.0", 0 ); + this->initSocketImpl( host, port, NULL, 0 ); } DECAF_CATCH_RETHROW( UnknownHostException ) DECAF_CATCH_RETHROW( IOException ) @@ -83,7 +83,7 @@ Socket::Socket( const std::string& host, } //////////////////////////////////////////////////////////////////////////////// -Socket::Socket( const std::string& host, int port, const std::string& localAddress, int localPort ) : +Socket::Socket( const std::string& host, int port, const InetAddress* localAddress, int localPort ) : impl(NULL), created(false), connected(false), closed(false), bound(false), inputShutdown(false), outputShutdown(false) { @@ -119,15 +119,21 @@ Socket::~Socket() { } //////////////////////////////////////////////////////////////////////////////// -void Socket::initSocketImpl( const std::string& host, int port, const std::string& localAddress, int localPort ) +void Socket::initSocketImpl( const std::string& host, int port, const InetAddress* localAddress, int localPort ) throw( decaf::io::IOException, decaf::net::UnknownHostException ) { try{ ensureCreated(); + std::string bindAddress = "0.0.0.0"; + + if( localAddress != NULL ) { + bindAddress = localAddress->getHostAddress(); + } + try { - this->impl->bind( localAddress, localPort ); + this->impl->bind( bindAddress, localPort ); this->bound = true; this->impl->connect( host, port, -1 ); this->connected = true; Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/Socket.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/Socket.h?rev=945930&r1=945929&r2=945930&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/Socket.h (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/Socket.h Tue May 18 22:24:43 2010 @@ -17,6 +17,7 @@ #ifndef _DECAF_NET_SOCKET_H_ #define _DECAF_NET_SOCKET_H_ +#include #include #include #include @@ -41,6 +42,11 @@ namespace net{ * @since 1.0 */ class DECAF_API Socket : public decaf::io::Closeable { + protected: + + // The actual Socket that this Socket represents. + mutable SocketImpl* impl; + private: // Factory for creating sockets, if not set a Plan TCP Socket is created @@ -56,11 +62,6 @@ namespace net{ friend class ServerSocket; - protected: - - // The actual Socket that this Socket represents. - mutable SocketImpl* impl; - public: /** @@ -119,7 +120,7 @@ namespace net{ * @throws IOException if an I/O error occurs while connecting the Socket. * @throws IllegalArgumentException if the port if not in range [0...65535] */ - Socket( const std::string& host, int port, const std::string& localAddress, int localPort ); + Socket( const std::string& host, int port, const InetAddress* localAddress, int localPort ); virtual ~Socket(); @@ -532,7 +533,7 @@ namespace net{ void accepted(); // Sets up a connected socket for the constructors that take connection arguments. - void initSocketImpl( const std::string& address, int port, const std::string& localAddress, int localPort ) + void initSocketImpl( const std::string& address, int port, const InetAddress* localAddress, int localPort ) throw( decaf::io::IOException, decaf::net::UnknownHostException ); // Check for already closed and throw an error if so. Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/SocketFactory.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/SocketFactory.cpp?rev=945930&r1=945929&r2=945930&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/SocketFactory.cpp (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/SocketFactory.cpp Tue May 18 22:24:43 2010 @@ -16,16 +16,25 @@ */ #include -#include +#include +#include using namespace decaf; using namespace decaf::io; using namespace decaf::net; -using namespace decaf::internal::net::tcp; +using namespace decaf::util; +using namespace decaf::util::concurrent; +using namespace decaf::internal::net; + +//////////////////////////////////////////////////////////////////////////////// +SocketFactory* SocketFactory::defaultFactory = NULL; //////////////////////////////////////////////////////////////////////////////// SocketFactory::SocketFactory() { +} +//////////////////////////////////////////////////////////////////////////////// +SocketFactory::~SocketFactory() { } //////////////////////////////////////////////////////////////////////////////// @@ -37,5 +46,16 @@ Socket* SocketFactory::createSocket() th //////////////////////////////////////////////////////////////////////////////// SocketFactory* SocketFactory::getDefault() { - return new DefaultSocketFactory(); + + Network* networkRuntime = Network::getNetworkRuntime(); + + synchronized( networkRuntime->getRuntimeLock() ) { + + if( defaultFactory == NULL ) { + defaultFactory = new DefaultSocketFactory(); + networkRuntime->addAsResource( defaultFactory ); + } + } + + return defaultFactory; } Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/SocketFactory.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/SocketFactory.h?rev=945930&r1=945929&r2=945930&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/SocketFactory.h (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/SocketFactory.h Tue May 18 22:24:43 2010 @@ -26,6 +26,7 @@ namespace decaf{ namespace net{ class Socket; + class InetAddress; /** * The SocketFactory is used to create Socket objects and can be sub-classed to @@ -36,13 +37,17 @@ namespace net{ * @since 1.0 */ class DECAF_API SocketFactory { + private: + + static SocketFactory* defaultFactory; + protected: SocketFactory(); public: - virtual ~SocketFactory() {} + virtual ~SocketFactory(); /** * Creates an unconnected Socket object. @@ -71,10 +76,34 @@ namespace net{ throw( decaf::io::IOException, decaf::net::UnknownHostException ) = 0; /** - * Creates and returns an instance of the environments default SocketFactory - * type. + * Creates a new Socket object and connects it to the specified remote host and + * port using the configuration of this SocketFactory. + * + * @param host + * The host name or IP address to connect the socket to. + * @param port + * The port on the remote host to connect to. + * @param ifAddress + * The address on the local machine to bind the Socket to. + * @param localPort + * The local port to bind the Socket to. + * + * @return a new Socket object, caller must free this object when done. + * + * @throws IOException if an I/O error occurs while creating the Socket object. + * @throws UnknownHostException if the host name is not known. + */ + virtual Socket* createSocket( const std::string& name, int port, const InetAddress* ifAddress, int localPort ) + throw( decaf::io::IOException, decaf::net::UnknownHostException ) = 0; + + /** + * Returns an pointer to the default SocketFactory for this Application, there is only one + * default SocketFactory per application, the pointer returned by this method is owned by + * the SocketFactory class and in not to be deleted by the caller. + * + * @returns pointer to the applications default SocketFactory. * - * @throws SocketException. + * @throws SocketException if an error occurs while getting the default instance. */ static SocketFactory* getDefault(); Added: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLServerSocket.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLServerSocket.cpp?rev=945930&view=auto ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLServerSocket.cpp (added) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLServerSocket.cpp Tue May 18 22:24:43 2010 @@ -0,0 +1,35 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "SSLServerSocket.h" + +#include +#include + +using namespace decaf; +using namespace decaf::net; +using namespace decaf::net::ssl; +using namespace decaf::lang; +using namespace decaf::lang::exceptions; + +//////////////////////////////////////////////////////////////////////////////// +SSLServerSocket::SSLServerSocket() { +} + +//////////////////////////////////////////////////////////////////////////////// +SSLServerSocket::~SSLServerSocket() { +} Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLServerSocket.cpp ------------------------------------------------------------------------------ svn:eol-style = native Added: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLServerSocket.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLServerSocket.h?rev=945930&view=auto ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLServerSocket.h (added) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLServerSocket.h Tue May 18 22:24:43 2010 @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef _DECAF_NET_SSL_SSLSERVERSOCKET_H_ +#define _DECAF_NET_SSL_SSLSERVERSOCKET_H_ + +#include + +namespace decaf { +namespace net { +namespace ssl { + + /** + * + * @since 1.0 + */ + class DECAF_API SSLServerSocket { + public: + + SSLServerSocket(); + + virtual ~SSLServerSocket(); + }; + +}}} + +#endif /* _DECAF_NET_SSL_SSLSERVERSOCKET_H_ */ Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLServerSocket.h ------------------------------------------------------------------------------ svn:eol-style = native Added: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLServerSocketFactory.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLServerSocketFactory.cpp?rev=945930&view=auto ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLServerSocketFactory.cpp (added) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLServerSocketFactory.cpp Tue May 18 22:24:43 2010 @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "SSLServerSocketFactory.h" + +#include + +using namespace decaf; +using namespace decaf::net; +using namespace decaf::net::ssl; +using namespace decaf::lang; + +//////////////////////////////////////////////////////////////////////////////// +SSLServerSocketFactory::SSLServerSocketFactory() { +} + +//////////////////////////////////////////////////////////////////////////////// +SSLServerSocketFactory::~SSLServerSocketFactory() { +} + Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLServerSocketFactory.cpp ------------------------------------------------------------------------------ svn:eol-style = native Added: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLServerSocketFactory.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLServerSocketFactory.h?rev=945930&view=auto ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLServerSocketFactory.h (added) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLServerSocketFactory.h Tue May 18 22:24:43 2010 @@ -0,0 +1,47 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef _DECAF_NET_SSL_SSLSERVERSOCKETFACTORY_H_ +#define _DECAF_NET_SSL_SSLSERVERSOCKETFACTORY_H_ + +#include + +#include + +#include +#include + +namespace decaf { +namespace net { +namespace ssl { + + /** + * + * @since 1.0 + */ + class DECAF_API SSLServerSocketFactory { + public: + + SSLServerSocketFactory(); + + virtual ~SSLServerSocketFactory(); + + }; + +}}} + +#endif /* _DECAF_NET_SSL_SSLSERVERSOCKETFACTORY_H_ */ Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLServerSocketFactory.h ------------------------------------------------------------------------------ svn:eol-style = native Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/net/SocketTest.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/net/SocketTest.cpp?rev=945930&r1=945929&r2=945930&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/net/SocketTest.cpp (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/net/SocketTest.cpp Tue May 18 22:24:43 2010 @@ -601,7 +601,7 @@ void SocketTest::testTx() { Thread::sleep( 100 ); - std::auto_ptr factory( SocketFactory::getDefault() ); + SocketFactory* factory = SocketFactory::getDefault(); std::auto_ptr client( factory->createSocket() ); client->connect("127.0.0.1", serverThread.getLocalPort() ); @@ -657,7 +657,7 @@ void SocketTest::testTrx() { Thread::sleep( 100 ); - std::auto_ptr factory( SocketFactory::getDefault() ); + SocketFactory* factory = SocketFactory::getDefault(); std::auto_ptr client( factory->createSocket() ); client->connect( "127.0.0.1", serverThread.getLocalPort() ); @@ -711,7 +711,7 @@ void SocketTest::testRxFail() { Thread::sleep( 100 ); - std::auto_ptr factory( SocketFactory::getDefault() ); + SocketFactory* factory = SocketFactory::getDefault(); std::auto_ptr client( factory->createSocket() ); client->connect("127.0.0.1", serverThread.getLocalPort() ); @@ -760,7 +760,7 @@ void SocketTest::testTrxNoDelay() { Thread::sleep( 10 ); - std::auto_ptr factory( SocketFactory::getDefault() ); + SocketFactory* factory = SocketFactory::getDefault(); std::auto_ptr client( factory->createSocket() ); client->connect("127.0.0.1", serverThread.getLocalPort() );