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/05/03 23:28:51 UTC

svn commit: r940628 - in /activemq/activemq-cpp/trunk/activemq-cpp/src/main: Makefile.am decaf/net/ssl/SSLParameters.cpp decaf/net/ssl/SSLParameters.h

Author: tabish
Date: Mon May  3 21:28:51 2010
New Revision: 940628

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

Add SSLParameters class for holding the Context configuration.

Added:
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLParameters.cpp   (with props)
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLParameters.h   (with props)
Modified:
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/Makefile.am

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=940628&r1=940627&r2=940628&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/Makefile.am (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/Makefile.am Mon May  3 21:28:51 2010
@@ -564,6 +564,7 @@ cc_sources = \
     decaf/net/URLDecoder.cpp \
     decaf/net/URLEncoder.cpp \
     decaf/net/ssl/SSLContent.cpp \
+    decaf/net/ssl/SSLParameters.cpp \
     decaf/net/ssl/SSLSocket.cpp \
     decaf/net/ssl/SSLSocketFactory.cpp \
     decaf/nio/Buffer.cpp \
@@ -1282,6 +1283,7 @@ h_sources = \
     decaf/net/UnknownHostException.h \
     decaf/net/UnknownServiceException.h \
     decaf/net/ssl/SSLContent.h \
+    decaf/net/ssl/SSLParameters.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/net/ssl/SSLParameters.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLParameters.cpp?rev=940628&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLParameters.cpp (added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLParameters.cpp Mon May  3 21:28:51 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.
+ */
+
+#include "SSLParameters.h"
+
+using namespace decaf;
+using namespace decaf::net;
+using namespace decaf::net::ssl;
+
+////////////////////////////////////////////////////////////////////////////////
+SSLParameters::SSLParameters() : cipherSuites(), protocols(), needClientAuth( false ), wantClientAuth( false ) {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+SSLParameters::SSLParameters( const std::vector<std::string>& cipherSuites ) :
+    cipherSuites( cipherSuites ), protocols(), needClientAuth( false ), wantClientAuth( false ) {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+SSLParameters::SSLParameters( const std::vector<std::string>& cipherSuites,
+                              const std::vector<std::string>& protocols ) :
+    cipherSuites( cipherSuites ), protocols( protocols ), needClientAuth( false ), wantClientAuth( false ) {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+SSLParameters::~SSLParameters() {
+}

Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLParameters.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLParameters.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLParameters.h?rev=940628&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLParameters.h (added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLParameters.h Mon May  3 21:28:51 2010
@@ -0,0 +1,144 @@
+/*
+ * 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_SSLPARAMETERS_H_
+#define _DECAF_NET_SSL_SSLPARAMETERS_H_
+
+#include <decaf/util/Config.h>
+
+#include <string>
+#include <vector>
+
+namespace decaf {
+namespace net {
+namespace ssl {
+
+    class DECAF_API SSLParameters {
+    private:
+
+        std::vector<std::string> cipherSuites;
+        std::vector<std::string> protocols;
+        bool needClientAuth;
+        bool wantClientAuth;
+
+    public:
+
+        /**
+         * Creates a new SSLParameters instance with empty vectors for the protocols and the
+         * cipherSuites, the wantClientAuth and needClientAuth flags are set to false.
+         */
+        SSLParameters();
+
+        /**
+         * Creates a new SSLParameters instance with the given cipherSuites value, the protocols
+         * vector is empty and the wantClientAuth and needClientAuth flags are set to false.
+         *
+         * @param cipherSuites
+         *      The vector of cipherSuites for this SSLParameters instance (can be empty).
+         */
+        SSLParameters( const std::vector<std::string>& cipherSuites );
+
+        /**
+         * Creates a new SSLParameters instance with the given cipherSuites value and protocols
+         * value, the wantClientAuth and needClientAuth flags are set to false.
+         *
+         * @param cipherSuites
+         *      The vector of cipherSuites for this SSLParameters instance (can be empty).
+         * @param protocols
+         *      The vector of protocols for this SSLParameters instance (can be empty).
+         */
+        SSLParameters( const std::vector<std::string>& cipherSuites,
+                       const std::vector<std::string>& protocols );
+
+        virtual ~SSLParameters();
+
+        /**
+         * @returns a copy of the vector of ciphersuites or an empty vector if none have been set.
+         */
+        std::vector<std::string> getCipherSuites() const {
+            return this->cipherSuites;
+        }
+
+        /**
+         * Sets the vector of ciphersuites.
+         *
+         * @param cipherSuites
+         *      The vector of cipherSuites (can be an empty vector).
+         */
+        void setCipherSuites( const std::vector<std::string>& cipherSuites ) {
+            this->cipherSuites = cipherSuites;
+        }
+
+        /**
+         * @returns a copy of the vector of protocols or an empty vector if none have been set.
+         */
+        std::vector<std::string> getProtocols() const {
+            return this->protocols;
+        }
+
+        /**
+         * Sets the vector of protocols.
+         *
+         * @param protocols
+         *      the vector of protocols (or an empty vector)
+         */
+        void setProtocols( const std::vector<std::string>& protocols ) {
+            this->protocols = protocols;
+        }
+
+        /**
+         * @returns whether client authentication should be requested.
+         */
+        bool getWantClientAuth() const {
+            return this->wantClientAuth;
+        }
+
+        /**
+         * Sets whether client authentication should be requested. Calling this method clears the
+         * needClientAuth flag.
+         *
+         * @param whether client authentication should be requested.
+         */
+        void setWantClientAuth( bool wantClientAuth ) {
+            this->wantClientAuth = wantClientAuth;
+            this->needClientAuth = false;
+        }
+
+        /**
+         * @returns whether client authentication should be required.
+         */
+        bool getNeedClientAuth() const {
+            return this->needClientAuth;
+        }
+
+        /**
+         * Sets whether client authentication should be required. Calling this method clears the
+         * wantClientAuth flag.
+         *
+         * @param needClientAuth
+         *      whether client authentication should be required.
+         */
+        void setNeedClientAuth( bool needClientAuth ) {
+            this->needClientAuth = needClientAuth;
+            this->wantClientAuth = false;
+        }
+
+    };
+
+}}}
+
+#endif /* _DECAF_NET_SSL_SSLPARAMETERS_H_ */

Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLParameters.h
------------------------------------------------------------------------------
    svn:eol-style = native