activemq-cpp-3.9.5
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: // Socket Overrides.
78 
82  virtual void connect(const std::string& host, int port, int timeout);
83 
87  virtual void close();
88 
92  virtual decaf::io::InputStream* getInputStream();
93 
97  virtual decaf::io::OutputStream* getOutputStream();
98 
102  virtual void shutdownInput();
103 
107  virtual void shutdownOutput();
108 
112  virtual void setOOBInline(bool value);
113 
117  virtual void sendUrgentData(int data);
118 
119  public: // SSLSocket Overrides
120 
124  virtual decaf::net::ssl::SSLParameters getSSLParameters() const;
125 
129  virtual void setSSLParameters(const decaf::net::ssl::SSLParameters& value);
130 
134  virtual std::vector<std::string> getSupportedCipherSuites() const;
135 
139  virtual std::vector<std::string> getSupportedProtocols() const;
140 
144  virtual std::vector<std::string> getEnabledCipherSuites() const;
145 
149  virtual void setEnabledCipherSuites(const std::vector<std::string>& suites);
150 
154  virtual std::vector<std::string> getEnabledProtocols() const;
155 
159  virtual void setEnabledProtocols(const std::vector<std::string>& protocols);
160 
164  virtual void startHandshake();
165 
169  virtual void setUseClientMode(bool value);
170 
174  virtual bool getUseClientMode() const;
175 
179  virtual void setNeedClientAuth(bool value);
180 
184  virtual bool getNeedClientAuth() const;
185 
189  virtual void setWantClientAuth(bool value);
190 
194  virtual bool getWantClientAuth() const;
195 
196  public:
197 
216  int read(unsigned char* buffer, int size, int offset, int length);
217 
234  void write(const unsigned char* buffer, int size, int offset, int length);
235 
243  int available();
244 
245  private:
246 
247  // Perform some additional checks on the Server's Certificate to ensure that
248  // its really valid.
249  void verifyServerCert(const std::string& serverName);
250 
251  public:
252 
254 
255  };
256 
257 }}}}}
258 
259 #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
virtual void connect(const std::string &host, int port)
Connects to the specified destination.
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