activemq-cpp-3.8.2
OpenSSLSocket.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_OPENSSLSOCKET_H_
19 #define _DECAF_INTERNAL_NET_SSL_OPENSSL_OPENSSLSOCKET_H_
20 
21 #include <decaf/util/Config.h>
22 
24 
25 #include <decaf/io/InputStream.h>
26 #include <decaf/io/OutputStream.h>
27 
28 namespace decaf {
29 namespace internal {
30 namespace net {
31 namespace ssl {
32 namespace openssl {
33 
34  class OpenSSLParameters;
35  class SocketData;
36 
44  private:
45 
46  // Private data related to the OpenSSL Socket impl.
47  SocketData* data;
48 
49  // Parameters object containing the OpenSSL settings and objects for this Socket.
50  OpenSSLParameters* parameters;
51 
52  // The InputStream owned by this Socket
54 
55  // The OutputStream owned by this Socket
57 
58  private:
59 
61  OpenSSLSocket& operator=(const OpenSSLSocket&);
62 
63  public:
64 
65  OpenSSLSocket(OpenSSLParameters* parameters);
66 
67  OpenSSLSocket(OpenSSLParameters* parameters, const decaf::net::InetAddress* address, int port);
68 
69  OpenSSLSocket(OpenSSLParameters* parameters, const decaf::net::InetAddress* address, int port, const decaf::net::InetAddress* localAddress, int localPort);
70 
71  OpenSSLSocket(OpenSSLParameters* parameters, const std::string& host, int port);
72 
73  OpenSSLSocket(OpenSSLParameters* parameters, const std::string& host, int port, const decaf::net::InetAddress* localAddress, int localPort);
74 
75  virtual ~OpenSSLSocket();
76 
77  public:
78  // Socket Overrides.
79 
83  virtual void connect(const std::string& host, int port, int timeout);
84 
88  virtual void close();
89 
93  virtual decaf::io::InputStream* getInputStream();
94 
98  virtual decaf::io::OutputStream* getOutputStream();
99 
103  virtual void shutdownInput();
104 
108  virtual void shutdownOutput();
109 
113  virtual void setOOBInline(bool value);
114 
118  virtual void sendUrgentData(int data);
119 
120  public: // SSLSocket Overrides
121 
125  virtual decaf::net::ssl::SSLParameters getSSLParameters() const;
126 
130  virtual void setSSLParameters(const decaf::net::ssl::SSLParameters& value);
131 
135  virtual std::vector<std::string> getSupportedCipherSuites() const;
136 
140  virtual std::vector<std::string> getSupportedProtocols() const;
141 
145  virtual std::vector<std::string> getEnabledCipherSuites() const;
146 
150  virtual void setEnabledCipherSuites(const std::vector<std::string>& suites);
151 
155  virtual std::vector<std::string> getEnabledProtocols() const;
156 
160  virtual void setEnabledProtocols(const std::vector<std::string>& protocols);
161 
165  virtual void startHandshake();
166 
170  virtual void setUseClientMode(bool value);
171 
175  virtual bool getUseClientMode() const;
176 
180  virtual void setNeedClientAuth(bool value);
181 
185  virtual bool getNeedClientAuth() const;
186 
190  virtual void setWantClientAuth(bool value);
191 
195  virtual bool getWantClientAuth() const;
196 
197  public:
198 
217  int read(unsigned char* buffer, int size, int offset, int length);
218 
235  void write(const unsigned char* buffer, int size, int offset, int length);
236 
244  int available();
245 
246  private:
247 
248  // Perform some additional checks on the Server's Certificate to ensure that
249  // its really valid.
250  void verifyServerCert(const std::string& serverName);
251 
252  };
253 
254 }}}}}
255 
256 #endif /* _DECAF_INTERNAL_NET_SSL_OPENSSL_OPENSSLSOCKET_H_ */
A base class that must be implemented by all classes wishing to provide a class that reads in a strea...
Definition: InputStream.h:39
Wraps a a Normal Socket object and extends or overrides functions in that class to make use of the Op...
Definition: OpenSSLSocket.h:43
Represents an IP address.
Definition: InetAddress.h:33
Definition: SSLParameters.h:30
Container class for parameters that are Common to OpenSSL socket classes.
Definition: OpenSSLParameters.h:41
#define DECAF_API
Definition: Config.h:29
Base interface for any class that wants to represent an output stream of bytes.
Definition: OutputStream.h:39
Definition: SSLSocket.h:34
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements...
Definition: AprPool.h:25