activemq-cpp-3.6.0
OpenSSLParameters.h
Go to the documentation of this file.
1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 #ifndef _DECAF_INTERNAL_NET_SSL_OPENSSL_OPENSSLPARAMETERS_H_
19 #define _DECAF_INTERNAL_NET_SSL_OPENSSL_OPENSSLPARAMETERS_H_
20 
21 #include <decaf/util/Config.h>
22 
23 #include <string>
24 #include <vector>
25 
26 #ifdef HAVE_OPENSSL
27 #include <openssl/ssl.h>
28 #endif
29 
30 namespace decaf {
31 namespace internal {
32 namespace net {
33 namespace ssl {
34 namespace openssl {
35 
42  private:
43 
44  bool needClientAuth;
45  bool wantClientAuth;
46  bool useClientMode;
47 
48 #ifdef HAVE_OPENSSL
49  SSL_CTX* context;
50  SSL* ssl;
51 #endif
52 
53  std::vector<std::string> enabledCipherSuites;
54  std::vector<std::string> enabledProtocols;
55 
56  private:
57 
59  OpenSSLParameters& operator= ( const OpenSSLParameters& );
60 
61  public:
62 
63 #ifdef HAVE_OPENSSL
64  OpenSSLParameters( SSL_CTX* context );
65 #endif
66 
67  virtual ~OpenSSLParameters();
68 
69  bool getNeedClientAuth() const {
70  return this->needClientAuth;
71  }
72 
73  void setNeedClientAuth( bool value ) {
74  this->needClientAuth = value;
75  this->wantClientAuth = false;
76  }
77 
78  bool getWantClientAuth() const {
79  return this->wantClientAuth;
80  }
81 
82  void setWantClientAuth( bool value ) {
83  this->wantClientAuth = value;
84  this->needClientAuth = false;
85  }
86 
87  bool getUseClientMode() const {
88  return this->useClientMode;
89  }
90 
91  void setUseClientMode( bool value ) {
92  this->useClientMode = value;
93  }
94 
95  std::vector<std::string> getSupportedCipherSuites() const;
96 
97  std::vector<std::string> getSupportedProtocols() const;
98 
99  std::vector<std::string> getEnabledCipherSuites() const;
100 
101  void setEnabledCipherSuites( const std::vector<std::string>& suites );
102 
103  std::vector<std::string> getEnabledProtocols() const;
104 
105  void setEnabledProtocols( const std::vector<std::string>& protocols );
106 
107 #ifdef HAVE_OPENSSL
108 
109  SSL_CTX* getSSLContext() const {
110  return this->context;
111  }
112 
113  SSL* getSSL() const {
114  return this->ssl;
115  }
116 
117 #endif
118 
123  OpenSSLParameters* clone() const;
124 
125  };
126 
127 }}}}}
128 
129 #endif /* _DECAF_INTERNAL_NET_SSL_OPENSSL_OPENSSLPARAMETERS_H_ */